From 8ff15ae72cb4adb6b5ffc549eb7a00422308f014 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 27 Nov 2004 16:12:11 +0000 Subject: Use modern form of setupPremix svn-id: r15915 --- scumm/player_mod.cpp | 7 +------ scumm/player_mod.h | 14 ++++++++++++-- scumm/player_v2.cpp | 6 +----- scumm/player_v2.h | 14 ++++++++++++-- 4 files changed, 26 insertions(+), 15 deletions(-) (limited to 'scumm') diff --git a/scumm/player_mod.cpp b/scumm/player_mod.cpp index 3102df1cd1..61f4d700d2 100644 --- a/scumm/player_mod.cpp +++ b/scumm/player_mod.cpp @@ -22,7 +22,6 @@ #include "stdafx.h" #include "scumm/player_mod.h" -#include "sound/audiostream.h" #include "sound/mixer.h" #include "sound/rate.h" @@ -46,7 +45,7 @@ Player_MOD::Player_MOD(ScummEngine *scumm) { _playproc = NULL; _playparam = NULL; - _mixer->setupPremix(premix_proc, this); + _mixer->setupPremix(this); } Player_MOD::~Player_MOD() { @@ -146,10 +145,6 @@ void Player_MOD::setChannelFreq(int id, int freq) { } } -void Player_MOD::premix_proc(void *param, int16 *buf, uint len) { - ((Player_MOD *) param)->do_mix(buf, len); -} - void Player_MOD::do_mix(int16 *data, uint len) { int i; int dpos = 0; diff --git a/scumm/player_mod.h b/scumm/player_mod.h index c4bda60665..a64f15d7c0 100644 --- a/scumm/player_mod.h +++ b/scumm/player_mod.h @@ -24,6 +24,7 @@ #define PLAYER_MOD_H #include "scumm/scumm.h" +#include "sound/audiostream.h" class AudioStream; class RateConverter; @@ -33,7 +34,7 @@ namespace Scumm { /** * Generic Amiga MOD mixer - provides a 60Hz 'update' routine. */ -class Player_MOD { +class Player_MOD : public AudioStream { public: Player_MOD(ScummEngine *scumm); virtual ~Player_MOD(); @@ -50,6 +51,16 @@ public: virtual void setUpdateProc(ModUpdateProc *proc, void *param, int freq); virtual void clearUpdateProc(); + + int readBuffer(int16 *buffer, const int numSamples) { + do_mix(buffer, numSamples / 2); + return numSamples; + } + bool isStereo() const { return true; } + bool endOfData() const { return false; } + + int getRate() const { return _samplerate; } + private: enum { MOD_MAXCHANS = 24 @@ -74,7 +85,6 @@ private: uint8 _maxvol; - static void premix_proc(void *param, int16 *buf, uint len); virtual void do_mix(int16 *buf, uint len); ModUpdateProc *_playproc; diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp index ea4032f41a..c1b2a6b428 100644 --- a/scumm/player_v2.cpp +++ b/scumm/player_v2.cpp @@ -376,7 +376,7 @@ Player_V2::Player_V2(ScummEngine *scumm, bool pcjr) { set_pcjr(pcjr); setMasterVolume(255); - _mixer->setupPremix(premix_proc, this); + _mixer->setupPremix(this); } Player_V2::~Player_V2() { @@ -792,10 +792,6 @@ void Player_V2::next_freqs(ChannelInfo *channel) { } } -void Player_V2::premix_proc(void *param, int16 *buf, uint len) { - ((Player_V2 *) param)->do_mix(buf, len); -} - void Player_V2::do_mix(int16 *data, uint len) { mutex_up(); uint step; diff --git a/scumm/player_v2.h b/scumm/player_v2.h index cb5e72dcc2..00dc43b419 100644 --- a/scumm/player_v2.h +++ b/scumm/player_v2.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/system.h" #include "scumm/music.h" +#include "sound/audiostream.h" class SoundMixer; @@ -72,7 +73,7 @@ struct channel_data { * This simulates the pc speaker sound, which is driven by the 8253 (square * wave generator) and a low-band filter. */ -class Player_V2 : public MusicEngine { +class Player_V2 : public AudioStream, public MusicEngine { public: Player_V2(ScummEngine *scumm, bool pcjr); virtual ~Player_V2(); @@ -84,6 +85,16 @@ public: virtual int getMusicTimer() const; virtual int getSoundStatus(int sound) const; + + int readBuffer(int16 *buffer, const int numSamples) { + do_mix(buffer, numSamples / 2); + return numSamples; + } + bool isStereo() const { return true; } + bool endOfData() const { return false; } + + int getRate() const { return _sample_rate; } + protected: bool _isV3Game; SoundMixer *_mixer; @@ -143,7 +154,6 @@ protected: int noiseFeedback, int16 *sample, uint len); private: - static void premix_proc(void *param, int16 *buf, uint len); void do_mix(int16 *buf, uint len); void set_pcjr(bool pcjr); -- cgit v1.2.3