diff 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/sdl/SoundSDL.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,56 @@
     1.4 +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
     1.5 +// Copyright (C) 2008 VBA-M development team
     1.6 +
     1.7 +// This program is free software; you can redistribute it and/or modify
     1.8 +// it under the terms of the GNU General Public License as published by
     1.9 +// the Free Software Foundation; either version 2, or(at your option)
    1.10 +// any later version.
    1.11 +//
    1.12 +// This program is distributed in the hope that it will be useful,
    1.13 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 +// GNU General Public License for more details.
    1.16 +//
    1.17 +// You should have received a copy of the GNU General Public License
    1.18 +// along with this program; if not, write to the Free Software Foundation,
    1.19 +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    1.20 +
    1.21 +#ifndef __VBA_SOUND_SDL_H__
    1.22 +#define __VBA_SOUND_SDL_H__
    1.23 +
    1.24 +#include "SoundDriver.h"
    1.25 +#include "RingBuffer.h"
    1.26 +
    1.27 +#include <SDL.h>
    1.28 +
    1.29 +const int SDL_SAMPLE_RATE = 44100;
    1.30 +
    1.31 +class SoundSDL: public SoundDriver
    1.32 +{
    1.33 +public:
    1.34 +	SoundSDL();
    1.35 +	virtual ~SoundSDL();
    1.36 +
    1.37 +	virtual bool init();
    1.38 +	virtual void pause();
    1.39 +	virtual void reset();
    1.40 +	virtual void resume();
    1.41 +	virtual void write(u16 * finalWave, int length);
    1.42 +	virtual bool setThrottle(unsigned short throttle);
    1.43 +
    1.44 +//private:
    1.45 +	RingBuffer<u16> _rbuf;
    1.46 +
    1.47 +	SDL_cond  * _cond;
    1.48 +	SDL_mutex * _mutex;
    1.49 +
    1.50 +	bool _initialized;
    1.51 +
    1.52 +	// Defines what delay in seconds we keep in the sound buffer
    1.53 +	static const float _delay;
    1.54 +
    1.55 +	static void soundCallback(void *data, u8 *stream, int length);
    1.56 +	virtual void read(u16 * stream, int length);
    1.57 +};
    1.58 +
    1.59 +#endif // __VBA_SOUND_SDL_H__