view src/sdl/SoundSDL.h @ 2:3549bbe597ed

adding makefile.am
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:47 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
2 // Copyright (C) 2008 VBA-M development team
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.
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 SoundDriver
29 {
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 buffer
50 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__