[Scummvm-cvs-logs] scummvm master -> 5f96dc6867a509291af4e9b2632ae5c548101707

dhewg dhewg at wiibrew.org
Tue Mar 22 21:04:44 CET 2011


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
bb12acfa0f AUDIO: Cleanup
18d9654ca2 TIMER: Cleanup
5f96dc6867 ANDROID: Fix timer frequency to match SDL


Commit: bb12acfa0ffc0c1fe0a907e6b63c3dd0c2acaec5
    https://github.com/scummvm/scummvm/commit/bb12acfa0ffc0c1fe0a907e6b63c3dd0c2acaec5
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-22T13:02:08-07:00

Commit Message:
AUDIO: Cleanup

Is it just me or is overwriting-but-not-marking-as-virtual
irritating?

Changed paths:
    audio/mpu401.cpp
    audio/mpu401.h
    audio/softsynth/emumidi.h
    audio/softsynth/fluidsynth.cpp
    audio/softsynth/mt32.cpp



diff --git a/audio/mpu401.cpp b/audio/mpu401.cpp
index 4f62de9..8d1e5b6 100644
--- a/audio/mpu401.cpp
+++ b/audio/mpu401.cpp
@@ -101,6 +101,9 @@ MidiDriver_MPU401::MidiDriver_MPU401() :
 	}
 }
 
+MidiDriver_MPU401::~MidiDriver_MPU401() {
+}
+
 void MidiDriver_MPU401::close() {
 	if (_timer_proc)
 		g_system->getTimerManager()->removeTimerProc(_timer_proc);
diff --git a/audio/mpu401.h b/audio/mpu401.h
index 070eaf6..07e2817 100644
--- a/audio/mpu401.h
+++ b/audio/mpu401.h
@@ -46,22 +46,22 @@ private:
 public:
 	MidiDriver *device();
 	byte getNumber() { return _channel; }
-	void release() { _allocated = false; }
+	virtual void release() { _allocated = false; }
 
-	void send(uint32 b);
+	virtual void send(uint32 b);
 
 	// Regular messages
-	void noteOff(byte note);
-	void noteOn(byte note, byte velocity);
-	void programChange(byte program);
-	void pitchBend(int16 bend);
+	virtual void noteOff(byte note);
+	virtual void noteOn(byte note, byte velocity);
+	virtual void programChange(byte program);
+	virtual void pitchBend(int16 bend);
 
 	// Control Change messages
-	void controlChange(byte control, byte value);
-	void pitchBendFactor(byte value);
+	virtual void controlChange(byte control, byte value);
+	virtual void pitchBendFactor(byte value);
 
 	// SysEx messages
-	void sysEx_customInstrument(uint32 type, const byte *instr);
+	virtual void sysEx_customInstrument(uint32 type, const byte *instr);
 
 	// Only to be called by the owner
 	void init(MidiDriver *owner, byte channel);
@@ -78,14 +78,15 @@ private:
 
 public:
 	MidiDriver_MPU401();
+	virtual ~MidiDriver_MPU401();
 
 	virtual void close();
-	void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc);
-	uint32 getBaseTempo(void) { return 10000; }
-	uint32 property(int prop, uint32 param);
+	virtual void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc);
+	virtual uint32 getBaseTempo(void) { return 10000; }
+	virtual uint32 property(int prop, uint32 param);
 
-	MidiChannel *allocateChannel();
-	MidiChannel *getPercussionChannel() { return &_midi_channels[9]; }
+	virtual MidiChannel *allocateChannel();
+	virtual MidiChannel *getPercussionChannel() { return &_midi_channels[9]; }
 };
 
 
diff --git a/audio/softsynth/emumidi.h b/audio/softsynth/emumidi.h
index 35c8149..815c020 100644
--- a/audio/softsynth/emumidi.h
+++ b/audio/softsynth/emumidi.h
@@ -45,25 +45,24 @@ private:
 	int _samplesPerTick;
 
 protected:
+	int _baseFreq;
+
 	virtual void generateSamples(int16 *buf, int len) = 0;
 	virtual void onTimer() {}
 
-	int _baseFreq;
-
 public:
-	MidiDriver_Emulated(Audio::Mixer *mixer) : _mixer(mixer) {
-		_isOpen = false;
-
-		_timerProc = 0;
-		_timerParam = 0;
-
-		_nextTick = 0;
-		_samplesPerTick = 0;
-
-		_baseFreq = 250;
+	MidiDriver_Emulated(Audio::Mixer *mixer) :
+		_mixer(mixer),
+		_isOpen(false),
+		_timerProc(0),
+		_timerParam(0),
+		_nextTick(0),
+		_samplesPerTick(0),
+		_baseFreq(250) {
 	}
 
-	int open() {
+	// MidiDriver API
+	virtual int open() {
 		_isOpen = true;
 
 		int d = getRate() / _baseFreq;
@@ -73,19 +72,21 @@ public:
 		// but less prone to arithmetic overflow.
 
 		_samplesPerTick = (d << FIXP_SHIFT) + (r << FIXP_SHIFT) / _baseFreq;
+
 		return 0;
 	}
 
-	void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
+	virtual void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
 		_timerProc = timer_proc;
 		_timerParam = timer_param;
 	}
 
-	uint32 getBaseTempo() { return 1000000 / _baseFreq; }
-
+	virtual uint32 getBaseTempo() {
+		return 1000000 / _baseFreq;
+	}
 
 	// AudioStream API
-	int readBuffer(int16 *data, const int numSamples) {
+	virtual int readBuffer(int16 *data, const int numSamples) {
 		const int stereoFactor = isStereo() ? 2 : 1;
 		int len = numSamples / stereoFactor;
 		int step;
@@ -101,16 +102,22 @@ public:
 			if (!(_nextTick >> FIXP_SHIFT)) {
 				if (_timerProc)
 					(*_timerProc)(_timerParam);
+
 				onTimer();
+
 				_nextTick += _samplesPerTick;
 			}
+
 			data += step * stereoFactor;
 			len -= step;
 		} while (len);
 
 		return numSamples;
 	}
-	bool endOfData() const { return false; }
+
+	virtual bool endOfData() const {
+		return false;
+	}
 };
 
 #endif
diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp
index bd01654..f6f66ce 100644
--- a/audio/softsynth/fluidsynth.cpp
+++ b/audio/softsynth/fluidsynth.cpp
@@ -40,7 +40,6 @@ private:
 	fluid_synth_t *_synth;
 	int _soundFont;
 	int _outputRate;
-	Audio::SoundHandle _handle;
 
 protected:
 	// Because GCC complains about casting from const to non-const...
@@ -144,7 +143,7 @@ int MidiDriver_FluidSynth::open() {
 	MidiDriver_Emulated::open();
 
 	// The MT-32 emulator uses kSFXSoundType here. I don't know why.
-	_mixer->playStream(Audio::Mixer::kMusicSoundType, &_handle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+	_mixer->playStream(Audio::Mixer::kMusicSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
 	return 0;
 }
 
@@ -153,7 +152,7 @@ void MidiDriver_FluidSynth::close() {
 		return;
 	_isOpen = false;
 
-	_mixer->stopHandle(_handle);
+	_mixer->stopHandle(_mixerSoundHandle);
 
 	if (_soundFont != -1)
 		fluid_synth_sfunload(_synth, _soundFont, 1);
diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp
index a980b56..dd2c7e2 100644
--- a/audio/softsynth/mt32.cpp
+++ b/audio/softsynth/mt32.cpp
@@ -51,7 +51,6 @@ class MidiChannel_MT32 : public MidiChannel_MPU401 {
 
 class MidiDriver_MT32 : public MidiDriver_Emulated {
 private:
-	Audio::SoundHandle _handle;
 	MidiChannel_MT32 _midiChannels[16];
 	uint16 _channelMask;
 	MT32Emu::Synth *_synth;
@@ -336,7 +335,7 @@ int MidiDriver_MT32::open() {
 
 	g_system->updateScreen();
 
-	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_handle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
 
 	return 0;
 }
@@ -378,7 +377,7 @@ void MidiDriver_MT32::close() {
 	// Detach the player callback handler
 	setTimerCallback(NULL, NULL);
 	// Detach the mixer callback handler
-	_mixer->stopHandle(_handle);
+	_mixer->stopHandle(_mixerSoundHandle);
 
 	_synth->close();
 	delete _synth;


Commit: 18d9654ca2b86033aff58c1e20ec9683cb97c47f
    https://github.com/scummvm/scummvm/commit/18d9654ca2b86033aff58c1e20ec9683cb97c47f
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-22T13:02:41-07:00

Commit Message:
TIMER: Cleanup

Changed paths:
    backends/timer/default/default-timer.cpp
    backends/timer/default/default-timer.h



diff --git a/backends/timer/default/default-timer.cpp b/backends/timer/default/default-timer.cpp
index dd468bb..b5060c4 100644
--- a/backends/timer/default/default-timer.cpp
+++ b/backends/timer/default/default-timer.cpp
@@ -34,7 +34,7 @@ struct TimerSlot {
 	uint32 interval;	// in microseconds
 
 	uint32 nextFireTime;	// in milliseconds
-	uint32 nextFireTimeMicro;	// mircoseconds part of nextFire
+	uint32 nextFireTimeMicro;	// microseconds part of nextFire
 
 	TimerSlot *next;
 };
diff --git a/backends/timer/default/default-timer.h b/backends/timer/default/default-timer.h
index e7ac3d1..a4c7385 100644
--- a/backends/timer/default/default-timer.h
+++ b/backends/timer/default/default-timer.h
@@ -40,9 +40,9 @@ private:
 
 public:
 	DefaultTimerManager();
-	~DefaultTimerManager();
-	bool installTimerProc(TimerProc proc, int32 interval, void *refCon);
-	void removeTimerProc(TimerProc proc);
+	virtual ~DefaultTimerManager();
+	virtual bool installTimerProc(TimerProc proc, int32 interval, void *refCon);
+	virtual void removeTimerProc(TimerProc proc);
 
 	/**
 	 * Timer callback, to be invoked at regular time intervals by the backend.


Commit: 5f96dc6867a509291af4e9b2632ae5c548101707
    https://github.com/scummvm/scummvm/commit/5f96dc6867a509291af4e9b2632ae5c548101707
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-03-22T13:02:42-07:00

Commit Message:
ANDROID: Fix timer frequency to match SDL

Changed paths:
    backends/platform/android/android.cpp



diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 69b3f1e..9a69956 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -162,7 +162,7 @@ void *OSystem_Android::timerThreadFunc(void *arg) {
 
 	struct timespec tv;
 	tv.tv_sec = 0;
-	tv.tv_nsec = 100 * 1000 * 1000;	// 100ms
+	tv.tv_nsec = 10 * 1000 * 1000; // 10ms
 
 	while (!system->_timer_thread_exit) {
 		if (JNI::pause) {






More information about the Scummvm-git-logs mailing list