Re: Playing Sounds
June 19, 2009 10:29PM
Don't you ever asked yourself what the parameter "3" was used for ? It was not picked out of nowhere ;-)

here's the function prototype:
ASND_SetVoice(s32 voice, s32 format, s32 pitch,s32 delay, void *snd, s32 size_snd, s32 volume_l, s32 volume_r, ASNDVoiceCallback callback);

as you can see the 2nd parameter is the voice format, defined like this in asndlib.h:

// SND_SetVoice format
#define VOICE_MONO_8BIT 0
#define VOICE_MONO_16BIT 1
#define VOICE_STEREO_8BIT 2
#define VOICE_STEREO_16BIT 3


3 means your 8 bits stereo samples will be treated like stereo 16 bits samples, meanings only half of the given number of samples will be played, and off course, a samplerate divided by 2.



Edited 1 time(s). Last edit at 06/19/2009 10:31PM by ekeeke.
Re: Playing Sounds
June 19, 2009 10:37PM
Uh, I had the stuff set up right in my code for each different format, was just quoting someone else

I have a semi-related problem though
Whenever I play a sound, it starts with a little click that sounds like a digital audio artefact. It's definitely not there in the actual file (I even get a click if I use a sound made entirely of silence). Any notion as to what's going wrong. I've tried padding the buffers, stopping the channel before playing the next sound, etc

edit: how do you guys normally convert the PCM to a header file? Maybe the way I'm doing it is wrong

Edit again: worked out the solution to this, the tool I was using to convert PCM sounds into header files, either didn't quite support pcm or was a little buggy or something because if I manually delete some lines off the start of the file, the glitch goes away.



Edited 3 time(s). Last edit at 06/20/2009 03:37PM by seiken.
Sorry, only registered users may post in this forum.

Click here to login