rlm@1: // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. rlm@1: // Copyright (C) 2008 VBA-M development team rlm@1: rlm@1: // This program is free software; you can redistribute it and/or modify rlm@1: // it under the terms of the GNU General Public License as published by rlm@1: // the Free Software Foundation; either version 2, or(at your option) rlm@1: // any later version. rlm@1: // rlm@1: // This program is distributed in the hope that it will be useful, rlm@1: // but WITHOUT ANY WARRANTY; without even the implied warranty of rlm@1: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the rlm@1: // GNU General Public License for more details. rlm@1: // rlm@1: // You should have received a copy of the GNU General Public License rlm@1: // along with this program; if not, write to the Free Software Foundation, rlm@1: // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. rlm@1: rlm@1: #ifndef __VBA_SOUND_SDL_H__ rlm@1: #define __VBA_SOUND_SDL_H__ rlm@1: rlm@1: #include "SoundDriver.h" rlm@1: #include "RingBuffer.h" rlm@1: rlm@1: #include rlm@1: rlm@1: const int SDL_SAMPLE_RATE = 44100; rlm@1: rlm@1: class SoundSDL: public SoundDriver rlm@1: { rlm@1: public: rlm@1: SoundSDL(); rlm@1: virtual ~SoundSDL(); rlm@1: rlm@1: virtual bool init(); rlm@1: virtual void pause(); rlm@1: virtual void reset(); rlm@1: virtual void resume(); rlm@1: virtual void write(u16 * finalWave, int length); rlm@1: virtual bool setThrottle(unsigned short throttle); rlm@1: rlm@1: //private: rlm@1: RingBuffer _rbuf; rlm@1: rlm@1: SDL_cond * _cond; rlm@1: SDL_mutex * _mutex; rlm@1: rlm@1: bool _initialized; rlm@1: rlm@1: // Defines what delay in seconds we keep in the sound buffer rlm@1: static const float _delay; rlm@1: rlm@1: static void soundCallback(void *data, u8 *stream, int length); rlm@1: virtual void read(u16 * stream, int length); rlm@1: }; rlm@1: rlm@1: #endif // __VBA_SOUND_SDL_H__