annotate src/sdl/SoundSDL.h @ 369:abcc522a3242

script: wrote memory pattern from within game!
author Robert McIntyre <rlm@mit.edu>
date Tue, 10 Apr 2012 06:33:44 -0500
parents f9f4f1b99eed
children
rev   line source
rlm@1 1 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
rlm@1 2 // Copyright (C) 2008 VBA-M development team
rlm@1 3
rlm@1 4 // This program is free software; you can redistribute it and/or modify
rlm@1 5 // it under the terms of the GNU General Public License as published by
rlm@1 6 // the Free Software Foundation; either version 2, or(at your option)
rlm@1 7 // any later version.
rlm@1 8 //
rlm@1 9 // This program is distributed in the hope that it will be useful,
rlm@1 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
rlm@1 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
rlm@1 12 // GNU General Public License for more details.
rlm@1 13 //
rlm@1 14 // You should have received a copy of the GNU General Public License
rlm@1 15 // along with this program; if not, write to the Free Software Foundation,
rlm@1 16 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
rlm@1 17
rlm@1 18 #ifndef __VBA_SOUND_SDL_H__
rlm@1 19 #define __VBA_SOUND_SDL_H__
rlm@1 20
rlm@1 21 #include "SoundDriver.h"
rlm@1 22 #include "RingBuffer.h"
rlm@1 23
rlm@1 24 #include <SDL.h>
rlm@1 25
rlm@1 26 const int SDL_SAMPLE_RATE = 44100;
rlm@1 27
rlm@1 28 class SoundSDL: public SoundDriver
rlm@1 29 {
rlm@1 30 public:
rlm@1 31 SoundSDL();
rlm@1 32 virtual ~SoundSDL();
rlm@1 33
rlm@1 34 virtual bool init();
rlm@1 35 virtual void pause();
rlm@1 36 virtual void reset();
rlm@1 37 virtual void resume();
rlm@1 38 virtual void write(u16 * finalWave, int length);
rlm@1 39 virtual bool setThrottle(unsigned short throttle);
rlm@1 40
rlm@1 41 //private:
rlm@1 42 RingBuffer<u16> _rbuf;
rlm@1 43
rlm@1 44 SDL_cond * _cond;
rlm@1 45 SDL_mutex * _mutex;
rlm@1 46
rlm@1 47 bool _initialized;
rlm@1 48
rlm@1 49 // Defines what delay in seconds we keep in the sound buffer
rlm@1 50 static const float _delay;
rlm@1 51
rlm@1 52 static void soundCallback(void *data, u8 *stream, int length);
rlm@1 53 virtual void read(u16 * stream, int length);
rlm@1 54 };
rlm@1 55
rlm@1 56 #endif // __VBA_SOUND_SDL_H__