18 July 2006, 05:23 | #1 |
RasterSoft Dev
|
Sampled sound player?
I haven't implemented anything, I want to hear some feedback first...
I'm now looking to add a simple 4 channel sampled sound player to my game. The sound would be started by a routine to play a sound. The sound would be stopped in the VBlank routine. Is a VBlank routine fast enough to control sound playback? I want to be able to stop the sound before it loops. I could add some silence to the end of the sound, and set the end point before the silence. This would allow a little bit of timing error of the VBlank. Is this the way it's *normally* done, or is there a better way? |
24 July 2006, 07:07 | #3 |
'Difficult'.
Join Date: May 2006
Location: No fixed abode
Age: 46
Posts: 105
|
"Mapping the Amiga" by Rhett Anderson and Randy Thompson.
$DFF0A4 AUD0LEN Channel 0 Waveform Length Status: *W Paula The length of your data in words is stored here. So, your data must be an even number of bytes, and may not exceed 131,070 bytes. (i.e. 65536 times two.) However, it is possible to play waveforms longer than 131,070 bytes due to the fact that the Amiga buffers the contents of the AUDxLC and AUDxLEN registers by using backup registers. So, you may change the AUDxLC and AUDxLEN registers while the Amiga is playing a sound, and when it is finished, it will start with the new data! Any of the Amiga's audio channels can cause a level 4 interrupt just before your sound starts a new waveform cycle. When this interrupt occurs, you know it's safe to change the registers. One warning however: Interrupts caused by high-frequency waveforms can occur quite rapidly. Even more rapidly than the operating system can keep up! It's best to leave the audio interrupts alone, unless you actually need them. Just wait a little while before changing the AUDxLC and AUDxLEN registers and all will work fine. - basically, once you know your waveform's playing, just load 0 into the channel's length register and it shouldn't loop |
24 July 2006, 11:22 | #4 |
Zone Friend
Join Date: Oct 2003
Location: France
Age: 51
Posts: 161
|
check http://ada.untergrund.net coding forum : there is an article about PAULA by philippe rivaillon
you can also find it here |
24 July 2006, 19:30 | #5 | |
RasterSoft Dev
|
Quote:
That should be easy enough. Thanks. |
|
23 August 2007, 06:17 | #6 |
RasterSoft Dev
|
Sorry to dig up an old thread.
I implemented this method, and learned a lot from the source in this thread: http://eab.abime.net/showthread.php?t=23347 Is 8 screen lines a reasonable amount of time to wait before changing the pointer and length? Last edited by cdoty; 23 August 2007 at 06:31. |
23 August 2007, 18:34 | #7 | |
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
|
Quote:
8 screen lines will be enough, if the previous sound was playing at 3906Hz or a higher frequency. For a slower sound, you need to wait longer. In the pathologically worst case, you would need to wait 65536 buscycles, which means waiting 289 screen lines. Some details in: http://ada.untergrund.net/forum/inde...&page=0#msg476 and in: http://ada.untergrund.net/forum/inde...um=1&topic=267 You will get around the "how long do I wait?" problem by letting the end-of-audio interrupt clear the sample settings. |
|
25 August 2007, 16:21 | #8 | |
Zone Friend
Join Date: Dec 2005
Location: Australia
Age: 50
Posts: 2,616
|
Quote:
( Couldnt resist it ) |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Protracker player with support for external sound fx | phx | Coders. Releases | 172 | 15 January 2024 19:44 |
Sampled loop in cracktro | absence | request.Music | 2 | 30 June 2012 11:33 |
MOD-player with external sound effects | phx | Coders. Asm / Hardware | 14 | 18 June 2012 10:41 |
Sampled Sounds | Solid Snake | Retrogaming General Discussion | 2 | 08 January 2007 17:34 |
Player Manager speed/sound problem | Guest | support.Games | 3 | 10 April 2002 23:46 |
|
|