[Scummvm-git-logs] scummvm master -> 38ddb196b31b8d735eb8e6ff0f654d6f29bc503c

athrxx athrxx at scummvm.org
Tue Sep 8 21:04:39 UTC 2020


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

Summary:
85755c893a AUDIO: (FM-TOWNS) - make use of Common::ObjectPool
38ddb196b3 AUDIO: (FM-TOWNS) - whitespace


Commit: 85755c893a32f83c2aeea276cf3fe853ff6466f8
    https://github.com/scummvm/scummvm/commit/85755c893a32f83c2aeea276cf3fe853ff6466f8
Author: athrxx (athrxx at scummvm.org)
Date: 2020-09-08T23:02:33+02:00

Commit Message:
AUDIO: (FM-TOWNS) - make use of Common::ObjectPool

Changed paths:
    audio/softsynth/fmtowns_pc98/towns_euphony.cpp
    audio/softsynth/fmtowns_pc98/towns_euphony.h


diff --git a/audio/softsynth/fmtowns_pc98/towns_euphony.cpp b/audio/softsynth/fmtowns_pc98/towns_euphony.cpp
index e989db33d8..999bf87200 100644
--- a/audio/softsynth/fmtowns_pc98/towns_euphony.cpp
+++ b/audio/softsynth/fmtowns_pc98/towns_euphony.cpp
@@ -27,6 +27,14 @@
 
 #define EUP_EVENT(x) _euphonyEvents.push_back(new EuphonyEvent(this, &EuphonyPlayer::event_##x))
 
+#ifdef EUP_USE_MEMPOOL
+#define EUP_EVENTS_DELETE(a)	_pendingEventsPool.deleteChunk(a)
+#define EUP_EVENTS_NEW			new (_pendingEventsPool)
+#else
+#define EUP_EVENTS_DELETE(a)	delete a
+#define EUP_EVENTS_NEW			new
+#endif
+
 EuphonyPlayer::EuphonyPlayer(Audio::Mixer *mixer) : _partConfig_enable(0), _partConfig_type(0), _partConfig_ordr(0), _partConfig_volume(0),
 	_partConfig_transpose(0), _musicPos(0), _musicStart(0), _playing(false), _pendingEventsChain(0), _tempoModifier(0), _bar(0),
 	_beat(0), _defaultBarLength(0), _barLength(0), _playerUpdatesLeft(0), _updatesPerPulseRemainder(0),	_updatesPerPulse(0),
@@ -62,7 +70,7 @@ EuphonyPlayer::~EuphonyPlayer() {
 	while (_pendingEventsChain) {
 		PendingEvent *evt = _pendingEventsChain;
 		_pendingEventsChain = _pendingEventsChain->next;
-		delete evt;
+		EUP_EVENTS_DELETE(evt);
 	}
 
 	delete[] _partConfig_enable;
@@ -92,7 +100,7 @@ bool EuphonyPlayer::init() {
 	while (_pendingEventsChain) {
 		PendingEvent *evt = _pendingEventsChain;
 		_pendingEventsChain = _pendingEventsChain->next;
-		delete evt;
+		EUP_EVENTS_DELETE(evt);
 	}
 
 	delete[] _partConfig_enable;
@@ -229,7 +237,7 @@ void EuphonyPlayer::reset() {
 	while (_pendingEventsChain) {
 		PendingEvent *evt = _pendingEventsChain;
 		_pendingEventsChain = _pendingEventsChain->next;
-		delete evt;
+		EUP_EVENTS_DELETE(evt);
 	}
 
 	_playing = _endOfTrack = _paused = _loop = false;
@@ -388,7 +396,7 @@ void EuphonyPlayer::updateHangingNotes() {
 			_pendingEventsChain = n;
 
 		sendPendingEvent(e->type, e->evt, e->note, e->velo);
-		delete e;
+		EUP_EVENTS_DELETE(e);
 
 		e = n;
 	}
@@ -399,7 +407,7 @@ void EuphonyPlayer::clearHangingNotes() {
 		PendingEvent *e = _pendingEventsChain;
 		_pendingEventsChain = _pendingEventsChain->next;
 		sendPendingEvent(e->type, e->evt, e->note, e->velo);
-		delete e;
+		EUP_EVENTS_DELETE(e);
 	}
 }
 
@@ -458,7 +466,7 @@ bool EuphonyPlayer::event_noteOn() {
 	velo = _musicPos[5];
 	uint16 len = (_musicPos[1] & 0x0f) | ((_musicPos[2] & 0x0f) << 4) | ((_musicPos[3] & 0x0f) << 8) | ((_musicPos[4] & 0x0f) << 12);
 
-	_pendingEventsChain = new PendingEvent(evt, type, note, velo, len ? len : 1, _pendingEventsChain);
+	_pendingEventsChain = EUP_EVENTS_NEW PendingEvent(evt, type, note, velo, len ? len : 1, _pendingEventsChain);
 
 	return false;
 }
@@ -971,3 +979,6 @@ bool Type0Driver::init() {
 
 void Type0Driver::send(uint8 command) {
 }
+
+#undef EUP_EVENTS_DELETE
+#undef EUP_EVENTS_NEW
diff --git a/audio/softsynth/fmtowns_pc98/towns_euphony.h b/audio/softsynth/fmtowns_pc98/towns_euphony.h
index 6b9d94acf4..03dd224093 100644
--- a/audio/softsynth/fmtowns_pc98/towns_euphony.h
+++ b/audio/softsynth/fmtowns_pc98/towns_euphony.h
@@ -23,10 +23,16 @@
 #ifndef TOWNS_EUP_H
 #define TOWNS_EUP_H
 
+#define EUP_USE_MEMPOOL
+
 #include "audio/softsynth/fmtowns_pc98/towns_audio.h"
 #include "common/array.h"
 #include "common/func.h"
 
+#ifdef EUP_USE_MEMPOOL
+#include "common/memorypool.h"
+#endif
+
 class EuphonyBaseDriver {
 public:
 	EuphonyBaseDriver() {}
@@ -191,6 +197,9 @@ private:
 		PendingEvent *next;
 	};
 
+#ifdef EUP_USE_MEMPOOL
+	Common::ObjectPool<PendingEvent> _pendingEventsPool;
+#endif
 	PendingEvent *_pendingEventsChain;
 
 	typedef Common::Functor0Mem<bool, EuphonyPlayer> EuphonyEvent;


Commit: 38ddb196b31b8d735eb8e6ff0f654d6f29bc503c
    https://github.com/scummvm/scummvm/commit/38ddb196b31b8d735eb8e6ff0f654d6f29bc503c
Author: athrxx (athrxx at scummvm.org)
Date: 2020-09-08T23:02:34+02:00

Commit Message:
AUDIO: (FM-TOWNS) - whitespace

Changed paths:
    audio/softsynth/fmtowns_pc98/pc98_audio.cpp
    audio/softsynth/fmtowns_pc98/towns_audio.cpp
    audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
    audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
    audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h


diff --git a/audio/softsynth/fmtowns_pc98/pc98_audio.cpp b/audio/softsynth/fmtowns_pc98/pc98_audio.cpp
index edf9353485..85e072eaaf 100644
--- a/audio/softsynth/fmtowns_pc98/pc98_audio.cpp
+++ b/audio/softsynth/fmtowns_pc98/pc98_audio.cpp
@@ -86,7 +86,7 @@ PC98AudioCoreInternal::~PC98AudioCoreInternal() {
 	_ready = false;
 
 	/*
-	
+
 	*/
 }
 
@@ -125,10 +125,10 @@ bool PC98AudioCoreInternal::init() {
 		return false;
 
 	reset();
-	
+
 	writeReg(0, 0x26, 0xDD);
 	writeReg(0, 0x25, 0x01);
-	writeReg(0, 0x24, 0x00);	
+	writeReg(0, 0x24, 0x00);
 	writeReg(0, 0x27, 0x30);
 
 	setVolumeChannelMasks(-1, 0);
diff --git a/audio/softsynth/fmtowns_pc98/towns_audio.cpp b/audio/softsynth/fmtowns_pc98/towns_audio.cpp
index a7dd4b340a..d197adef94 100644
--- a/audio/softsynth/fmtowns_pc98/towns_audio.cpp
+++ b/audio/softsynth/fmtowns_pc98/towns_audio.cpp
@@ -470,7 +470,7 @@ int TownsAudioInterfaceInternal::processCommand(int command, va_list &args) {
 
 	if (command < 0 || command > 81)
 		return 4;
-	
+
 	int res = (this->*_intfOpcodes[command])(args);
 
 	return res;
diff --git a/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp b/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
index 4a93d42454..75e90885e5 100644
--- a/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
+++ b/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
@@ -45,8 +45,8 @@ public:
 	virtual void loadData(uint8 *data);
 	virtual void processEvents();
 	virtual void processFrequency();
-	
-	virtual void fadeStep();	
+
+	virtual void fadeStep();
 
 	const uint8 _idFlag;
 
@@ -108,7 +108,7 @@ private:
 	int16 _vbrModCurVal;
 	uint8 _vbrDurLeft;
 	uint8 _algorithm;
-	
+
 	const uint8 _keyNum;
 	const uint8 _part;
 
diff --git a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
index ad12a4be57..eeabe6d05d 100644
--- a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
+++ b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
@@ -115,7 +115,7 @@ TownsPC98_FmSynthOperator::TownsPC98_FmSynthOperator(const uint32 tickLength, co
 void TownsPC98_FmSynthOperator::keyOn() {
 	if (_keyOn)
 		return;
-	
+
 	_keyOn = true;
 	//if (_state == kEnvReady)
 		_phase = 0;
@@ -1125,7 +1125,7 @@ int TownsPC98_FmSynth::readBuffer(int16 *buffer, const int numSamples) {
 		return 0;
 	}
 	_mixerThreadLockCounter++;
-	
+
 	// This assumes that the numSamples parameter will be the same on most (if not on all) calls to readBuffer(),
 	// although I don't know whether this is true for all backends. There is no need to reallocate the temp
 	// buffer every time, unless its size needs to be increased.
@@ -1142,13 +1142,13 @@ int TownsPC98_FmSynth::readBuffer(int16 *buffer, const int numSamples) {
 		_renderBuffer = new int32[_renderBufferSize];
 		memset(_renderBuffer, 0, sizeof(int32) * _renderBufferSize);
 	}
-	
+
 	int outSamplesLeft = numSamples >> 1;
 	int inSamplesLeft = (int)(_predSmpCount * outSamplesLeft) + 1;
 
 	while (_ready && outSamplesLeft) {
 		int render = inSamplesLeft;
-	
+
 		for (int i = 0; i < 2; i++) {
 			if (_timers[i].enabled) {
 				if (!_timers[i].smpTillCb) {
@@ -1225,7 +1225,7 @@ int TownsPC98_FmSynth::readBuffer(int16 *buffer, const int numSamples) {
 
 		int consumed = 0;
 		// Convert rate to the mixer output rate. I don't want to leave that to the mixer, since doing
-		// it here allows me the best control over the precise invocation of the timer callbacks. 
+		// it here allows me the best control over the precise invocation of the timer callbacks.
 		for (; consumed < render + _numPending && outSamplesLeft; ++consumed) {
 			for (_rateConvCnt -= _outRateMult; _rateConvCnt <= 0 && outSamplesLeft; --outSamplesLeft) {
 				_rateConvCnt += _internalRate;
@@ -1259,7 +1259,7 @@ int TownsPC98_FmSynth::getRate() const {
 
 void TownsPC98_FmSynth::deinit() {
 	_mixer->stopHandle(_soundHandle);
-	_ready = false;	
+	_ready = false;
 	_timers[0].cb = _timers[1].cb = _timerProcIdle;
 }
 
diff --git a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h
index 8b81cb8307..d0b5349e4c 100644
--- a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h
+++ b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h
@@ -40,7 +40,7 @@
 #endif
 
 /* Experimental code for emulation of the chip's busy flag wait cycle.
- * Explanation: 
+ * Explanation:
  * Before attempting a port write a client application would usually read the chip's
  * busy flag and remain in a loop until the flag is cleared. This does not work with
  * an emulator that is on the same thread as the client code (the busy flag will never




More information about the Scummvm-git-logs mailing list