2012-06-09 14:12:05 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
// $Id$
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2015-01-05 00:12:41 +03:00
|
|
|
// Copyright (C) 2012-2015 The Bochs Project
|
2012-06-09 14:12:05 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
// Lowlevel sound output support for SDL written by Volker Ruppert
|
|
|
|
|
|
|
|
|
2014-06-23 23:37:58 +04:00
|
|
|
#if BX_WITH_SDL || BX_WITH_SDL2
|
2012-06-09 14:12:05 +04:00
|
|
|
|
|
|
|
#include "bochs.h"
|
2015-01-06 01:07:03 +03:00
|
|
|
#include <SDL_audio.h>
|
2012-06-09 14:12:05 +04:00
|
|
|
|
|
|
|
class bx_sound_sdl_c : public bx_sound_lowlevel_c {
|
|
|
|
public:
|
2013-06-24 23:19:12 +04:00
|
|
|
bx_sound_sdl_c();
|
2012-06-09 14:12:05 +04:00
|
|
|
virtual ~bx_sound_sdl_c();
|
|
|
|
|
|
|
|
virtual int get_type() {return BX_SOUNDLOW_SDL;}
|
|
|
|
|
|
|
|
virtual int waveready();
|
|
|
|
|
|
|
|
virtual int openwaveoutput(const char *wavedev);
|
|
|
|
virtual int startwaveplayback(int frequency, int bits, bx_bool stereo, int format);
|
2015-01-11 23:13:50 +03:00
|
|
|
virtual int sendwavepacket(int length, Bit8u data[], bx_pcm_param_t *param);
|
2012-06-09 14:12:05 +04:00
|
|
|
virtual int stopwaveplayback();
|
|
|
|
virtual int closewaveoutput();
|
2015-01-05 00:12:41 +03:00
|
|
|
|
2015-01-08 22:12:01 +03:00
|
|
|
virtual int register_wave_callback(void *, get_wave_cb_t wd_cb);
|
|
|
|
virtual void unregister_wave_callback(int callback_id);
|
2015-01-11 23:13:50 +03:00
|
|
|
void get_wave_data(Bit8u *stream, int len);
|
2012-06-09 14:12:05 +04:00
|
|
|
private:
|
|
|
|
bx_bool WaveOpen;
|
2015-01-06 01:07:03 +03:00
|
|
|
SDL_AudioSpec fmt;
|
2015-01-08 22:12:01 +03:00
|
|
|
int cb_count;
|
|
|
|
struct {
|
|
|
|
void *device;
|
|
|
|
get_wave_cb_t cb;
|
|
|
|
} get_wave[BX_MAX_WAVE_CALLBACKS];
|
2015-01-11 23:13:50 +03:00
|
|
|
int pcm_callback_id;
|
2012-06-09 14:12:05 +04:00
|
|
|
};
|
|
|
|
|
2014-06-23 23:37:58 +04:00
|
|
|
#endif // BX_WITH_SDL || BX_WITH_SDL2
|