Mercurial > vba-clojure
view src/sdl/SoundSDL.h @ 359:8c474d1d6956
script: got leomnades and TM13, shopping is complete.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 09 Apr 2012 08:27:45 -0500 |
parents | f9f4f1b99eed |
children |
line wrap: on
line source
1 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.2 // Copyright (C) 2008 VBA-M development team4 // This program is free software; you can redistribute it and/or modify5 // it under the terms of the GNU General Public License as published by6 // the Free Software Foundation; either version 2, or(at your option)7 // any later version.8 //9 // This program is distributed in the hope that it will be useful,10 // but WITHOUT ANY WARRANTY; without even the implied warranty of11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 // GNU General Public License for more details.13 //14 // You should have received a copy of the GNU General Public License15 // along with this program; if not, write to the Free Software Foundation,16 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.18 #ifndef __VBA_SOUND_SDL_H__19 #define __VBA_SOUND_SDL_H__21 #include "SoundDriver.h"22 #include "RingBuffer.h"24 #include <SDL.h>26 const int SDL_SAMPLE_RATE = 44100;28 class SoundSDL: public SoundDriver29 {30 public:31 SoundSDL();32 virtual ~SoundSDL();34 virtual bool init();35 virtual void pause();36 virtual void reset();37 virtual void resume();38 virtual void write(u16 * finalWave, int length);39 virtual bool setThrottle(unsigned short throttle);41 //private:42 RingBuffer<u16> _rbuf;44 SDL_cond * _cond;45 SDL_mutex * _mutex;47 bool _initialized;49 // Defines what delay in seconds we keep in the sound buffer50 static const float _delay;52 static void soundCallback(void *data, u8 *stream, int length);53 virtual void read(u16 * stream, int length);54 };56 #endif // __VBA_SOUND_SDL_H__