[AD] Some sound driver questions

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hello all.

I have just implemented the sound driver for the Amiga port of Allegro and I
have a couple of questions.

Firstly, in the DIGI_DRIVER structure we have voices, max_voices and
def_voices.  How do these differ in use?  I have currently set all three to
8 (which is a reasonable number for modern Amiga sound hardware, but really
just an arbitrary choice).  Also what is the basevoice member?  Currently I
simply leave this at zero.

Secondly, a question regarding the functions that are called to play a
sample.  When I play a sample I notice that the following functions in my
sound driver are called (in this order IIRC):

init_voice() => Load the sample into the Amiga audio API
start_voice() => Start playback of the sample loaded by init_voice()

Sample plays, and upon stopping:

release_voice() => ???
stop_voice() => I stop playback and free the sample

Two questions: 1) What am I supposed to do in release_voice()?  2) If
stop_voice() is called, can start_voice() be called again *without*
init_voice() being first called?  If that is the case then I guess
stop_voice() should stop playback but not free the sample.

Also, if the sample being loaded from a .wav file is an 8 bit sample then I
noticed that it is 8 bit unsigned.  The Amiga audio API doesn't support
this (it only supports signed samples, either 8 or 16 bit) so in
init_voice() I have to allocate a buffer and convert from 8 bit unsigned =>
8 bit signed.  This isn't nice because it means a memory allocation every
time that sample is played and because it is slow, not to mention that if a
sample is loaded once and then played multiple times then it has to be done
every time.  It would be better to convert it when it is being loaded by
src/sound.c/load_wav_pf().  If I wanted to add this feature as an
improvement to Allegro (with the aim of having it committed to Subversion,
maybe configured with a #define), what would be the best way of going about
it?

Thanks in advance for any advice.

-- 
/-------------------------------------------------------------------\
[Hitman/Code HQ - 6502/z80/68000/604e/80x86/ARM coder - Amiga rulez!]
[VZ-200/VIC-20/MZ-700/c16/c64*10/c128*8/Plus-4/CPC464/CD32/500*2    ]
[600/1000/1200*2/A4000/SNES/N64/Dreamcast/Athlon 1100/AmigaOne      ]
[Assembly Language: The most fun you can have with your clothes on! ]
\-------------------------------------------------------------------/





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/