WIP - StepFive - Amiga Musics + SFX on falcon...

All about games on the Falcon, TT & clones

Moderators: Mug UK, moondog/.tSCc., [ProToS], lp, Moderator Team

ricco59
Atarian
Atarian
Posts: 9
Joined: Sat Apr 25, 2009 7:48 am
Location: Arras - France
Contact:

WIP - StepFive - Amiga Musics + SFX on falcon...

Postby ricco59 » Tue Dec 25, 2018 7:07 pm

... Hi Atari Fans ;)

I need some help.

Since few years, I'm coding, porting slowly an amiga game (few hours a week when I have a little spare time) to a basic Falcon030 and want to know what is the best way to play a 3 voices amiga format mod and use the other voices to play sample effects with frequency and volume values. Maybe you have some source examples

I'm using a basic vblank loop

Game :
- action 1 - play sfx1
- action 2 - play sfx2
- ...
- ...
- jsr mt_music (or something like this)
- wait vblank (using xbios)
bra game

Oh, I forgot, I code in asm using devpac (Hatari for coding and real Falcon for testing and bug hunting ;) )

Many thanks and Merry Christmas

Eric

ps :
I'm posting some screenshots very soon and maybe a short video. Thanks again
There are some work to do but the game is playable

ricco59
Atarian
Atarian
Posts: 9
Joined: Sat Apr 25, 2009 7:48 am
Location: Arras - France
Contact:

Re: WIP - StepFive - Amiga Musics + SFX on falcon...

Postby ricco59 » Tue Dec 25, 2018 7:11 pm

this post appears 2 times ?
Moderators, can you please delete the second post ?
Thank you

Eric

User avatar
ggn
Atari God
Atari God
Posts: 1245
Joined: Sat Dec 28, 2002 4:49 pm

Re: WIP - StepFive - Amiga Musics + SFX on falcon...

Postby ggn » Tue Dec 25, 2018 8:11 pm

Check out DSPmod34 (http://dhs.nu/files.php?t=democreation), it supports up to 4 channels music + 4 channels of sound effects.

Good luck with your game!

(and Happy Christmas!)
is 73 Falcon patched atari games enough ? ^^

ricco59
Atarian
Atarian
Posts: 9
Joined: Sat Apr 25, 2009 7:48 am
Location: Arras - France
Contact:

Re: WIP - StepFive - Amiga Musics + SFX on falcon...

Postby ricco59 » Tue Dec 25, 2018 10:42 pm

Many thanks ggn. I have to study this ;)

Here are some screenshots
Image Image Image Image
Image Image Image

and a video
https://www.youtube.com/watch?v=wCCLa_lgniA

See you

Eric

ps : Thanks to the Modo

MM41
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 114
Joined: Sun Jun 28, 2015 2:36 pm
Location: France

Re: WIP - StepFive - Amiga Musics + SFX on falcon...

Postby MM41 » Tue Dec 25, 2018 10:55 pm

Nice game Ricco59 :cheers: ,
My Falcon is happy to see a new game :D

User avatar
dma
Atari Super Hero
Atari Super Hero
Posts: 982
Joined: Wed Nov 20, 2002 11:22 pm
Location: France
Contact:

Re: WIP - StepFive - Amiga Musics + SFX on falcon...

Postby dma » Wed Dec 26, 2018 8:24 am

Waaah a falling quadraminos game, sweet!
Colorful graphs, and that book opening animation looks really cool.
Can't wait to play it. :)

ricco59
Atarian
Atarian
Posts: 9
Joined: Sat Apr 25, 2009 7:48 am
Location: Arras - France
Contact:

Re: WIP - StepFive - Amiga Musics + SFX on falcon...

Postby ricco59 » Wed Dec 26, 2018 8:12 pm

@MM41, dma > Thank you for your feedback

I have to finish it.
Those next days, I'm going to try to include sfx and musics

C U

ricco59
Atarian
Atarian
Posts: 9
Joined: Sat Apr 25, 2009 7:48 am
Location: Arras - France
Contact:

Re: WIP - StepFive - Amiga Musics + SFX on falcon...

Postby ricco59 » Sat Dec 29, 2018 7:35 pm

@ggn, is there a tuto to know how DSPmod34 works and how use it for sample playing (maybe a simple source code playing a .mod while playing 2 or 3 samples) ? It's my first try on Atari Falcon :)
Thanks again my Friend ;)

User avatar
ggn
Atari God
Atari God
Posts: 1245
Joined: Sat Dec 28, 2002 4:49 pm

Re: WIP - StepFive - Amiga Musics + SFX on falcon...

Postby ggn » Sat Dec 29, 2018 9:14 pm

ricco59 wrote:@ggn, is there a tuto to know how DSPmod34 works and how use it for sample playing (maybe a simple source code playing a .mod while playing 2 or 3 samples) ? It's my first try on Atari Falcon :)
Thanks again my Friend ;)


Sure thing!

You can start without even integrating it in your code to see how it works by assembling "easy_use.s". Don't forget to change the path to your .mod file in label "dspmod34_mod" first. This should assemble and run properly as a .prg.

Now that we got it working, let's butcher it a bit ;).

Go to label "dspmod34_voltab4" at line 256. Each word value tells the player how loud each channel will be. As you notice, there are 4 $7fff and 4 0 values. This means that the first 4 channels (which are used by the mod) are at max volume and the others are 0. For the player 0 means "don't use this channel ever". So change the first 2 zeros to say $3fff (which should be half the volume of the mod). If you assemble and run this, it should still play the mod fine.

Now, incbin a couple of samples so we can try the sample playing out.

From the docs, you can find that you have to call dspmod34_player+dspmod34_fx to play a sample. Also you have to set up some magic values before calling:

Code: Select all

      d0: fx-Channel ( 0 ... 3 )
   d1: Sample-Period
   d2: Sample-Volume
   d3: Sample-Position
   a0: Sample-Start   ( Adresse )
   a1: Sample-Ende         ( Adresse )
   a2: Repeat-Start        ( Adresse )
   a3: Repeat-Länge        ( Bytes )


So if you incbin your sample like this:

Code: Select all

my_ossom_sample: incbin "sample.raw"
my_ossom_sample_end:


you can load d0 with 0 to play your sample in the first fx channel (which is channel 5 if we count all channels), d2 with 64 (maximum allowable volume), d3 with 0 so we play the sample from start, a0 with my_ossom_sample, a1 with my_ossom_sample_end. If you don't want the sample to loop, just load a2 with my_ossom_sample and a3 with 2. Otherwise you need to calculate and enter the start position and length of the loop.

Which leaves us with d1 which I left for the end, because it's where the dreaded amiga comes into play. Because the mod player has to emulate the Paula chip to play the samples, it internally calculates sample frequencies using so called amiga period values. A quick search around the internets brought me to this site: https://bel.fi/alankila/modguide/interpolate.txt where we see that the Paula clock is around 3546895Hz. So if we want to play a 8KHz mono sample we have to calculate the period as 3546895/2/8000=221.6809375, so let's say 222. (I'm not 100% sure where that /2 comes from - I'm not an expert on Amiga stuff, just bear with me, I just did the absolute minimum to get the thing working :D).

So, with this knowledge we can now go to easy_use.s and add some code after line 88, i.e. after calling "dspmod34_supervisor_out" and before waiting for keypress. Something like:

Code: Select all

                lea my_ossom_sample,a0
                lea my_ossom_sample_end,a1
                moveq   #0,D0
                move.w  #222,D1
                move.w  #64,D2
                moveq   #0,D3
                movea.l A0,A2
                lea     2,A3
                bsr     dspmod34_player+dspmod34_fx


In theory this should play the sample once when the program is run. Perhaps you might want to change that "lea 2,a3" to something like "lea "my_ossom_sample_end-my_ossom_sample,a3" so it will loop the sample as long as the mod is playing.

And that should be all there is to it!

If you got this working then integrating it with your code shouldn't be too hard, just move the code from "begin" to "move.l #dspmod34_vbl,$04d2" in your startup code. If you check out the top of easy_use.s, there are some other useful routines to run, like turning the player off and on, etc etc.

Anyway, try this out and good luck :)
is 73 Falcon patched atari games enough ? ^^

ricco59
Atarian
Atarian
Posts: 9
Joined: Sat Apr 25, 2009 7:48 am
Location: Arras - France
Contact:

Re: WIP - StepFive - Amiga Musics + SFX on falcon...

Postby ricco59 » Fri Jan 04, 2019 10:01 pm

Thank you my friend and happy new year for all Atari & Retro Fans ;)


Social Media

     

Return to “Games”

Who is online

Users browsing this forum: No registered users and 3 guests