[SDL] Audio Output
Paul Newton
Paul.Newton at sli-institute.ac.uk
Wed Aug 21 06:54:01 PDT 2002
I have been trying to get this going all week without success. Please help
me and stop me going mad!
I have implemmented a buffer which is a 2D array. This has BUFFERSIZE
(currently 20) elements by 4096 (as that is the size of convbuffer). I have
variables holding the posoitions of the audioPointer and the dataPointer. I
have put in the if condition
if(
(dataPointer >= BUFFERSIZE/2 && audioPointer < BUFFERSIZE/2)
||
(dataPointer < BUFFERSIZE/2 && audioPointer >=
BUFFERSIZE/2)
)
which basically splits th buffer in two so that it will fill half with data
and then the audio reads that half, then more data is put in and then the
audio reads that. I did this as I found that data was being written too
quickly and as such I was overwriting data before it had been read by the
audio callback. When I run this it appears to be working, by looking at
printf statements. However the sound makes no sense at all.
Could you tell me what I have done wrong. Have I set up the
SDL_AudioSpec fmt;
variable correctly?
fmt.freq = 44100;
fmt.format = AUDIO_S16SYS;
fmt.channels = 2;
fmt.samples = 4096;
fmt.callback = fill_audio;
fmt.userdata = NULL;
I desperately need to get this running as I am fast running out of time for
my MSc project. This is all that stands in my way of finishing the
practical side.
By the way I don't understand all of the vorbis stuff myself. The program
used to write a PCM bitstream to stdout. I just want to change that to
output sound to the soundcard.
Thanks,
Paul
<<decoder_example.c>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: decoder_example.c
Type: application/octet-stream
Size: 13133 bytes
Desc: not available
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020821/d834570f/attachment.obj>
More information about the SDL
mailing list