[SDL] Re: Help needed with SDL audio
jakarppi at yahoo.com
Wed Aug 29 02:01:00 PDT 2001
Hm, I could have been more descriptive about the problem with audio
output. I will paste here the instructions written by the author of the
Here's a brief overview of how to use all this:
- do machine dependant initialization (audio, video, init input, etc.)
- set up bitmap structure
- set up cart structure (load game)
- call system_init()
- if snd.enabled is set, we can use sound
- load sram data if it exists for the game
in a loop:
- update input structure based on gamepad/keyboard
- call sms_frame()
- play sound using 'snd.buffer'
- copy 'bitmap.data' to the video display
- quit if needed
- save sram data if the game used it
- call system_shutdown()
This plan is very clear, except for the sound part. The dos port of the
emulator simply pushes the data in sound buffers to the soundcard. With
SDL, the audio callback is supposed to get more data when it is needed.
I don't understand how to get the emulation core work in synch with the
audio callback. I can get something played, but it doesn't sound right
(I don't know enough english to describe it).
I'm hoping someone with more experience could look at the code and give
me some advice. David proposed some good solutions, for example running
the audio emulation inside callback seems to be used in some emulators
(e.g. gnuboy). However, I don't know a lot of the internal workings of
the emulation core, so this solution is beyond me.
Perhaps I'll ignore the sound emulation for now and implement the other
features like joystick support first.
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
More information about the SDL