Mercurial > vba-clojure
comparison src/sdl/SoundSDL.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
1 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. | |
2 // Copyright (C) 2008 VBA-M development team | |
3 | |
4 // This program is free software; you can redistribute it and/or modify | |
5 // it under the terms of the GNU General Public License as published by | |
6 // 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 of | |
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 // GNU General Public License for more details. | |
13 // | |
14 // You should have received a copy of the GNU General Public License | |
15 // along with this program; if not, write to the Free Software Foundation, | |
16 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | |
18 #ifndef __VBA_SOUND_SDL_H__ | |
19 #define __VBA_SOUND_SDL_H__ | |
20 | |
21 #include "SoundDriver.h" | |
22 #include "RingBuffer.h" | |
23 | |
24 #include <SDL.h> | |
25 | |
26 const int SDL_SAMPLE_RATE = 44100; | |
27 | |
28 class SoundSDL: public SoundDriver | |
29 { | |
30 public: | |
31 SoundSDL(); | |
32 virtual ~SoundSDL(); | |
33 | |
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); | |
40 | |
41 //private: | |
42 RingBuffer<u16> _rbuf; | |
43 | |
44 SDL_cond * _cond; | |
45 SDL_mutex * _mutex; | |
46 | |
47 bool _initialized; | |
48 | |
49 // Defines what delay in seconds we keep in the sound buffer | |
50 static const float _delay; | |
51 | |
52 static void soundCallback(void *data, u8 *stream, int length); | |
53 virtual void read(u16 * stream, int length); | |
54 }; | |
55 | |
56 #endif // __VBA_SOUND_SDL_H__ |