[Scummvm-git-logs] scummvm master -> 8670158cc6c9b820f7b3c223d34e29ee43cc2d28

athrxx noreply at scummvm.org
Sun Mar 17 01:12:08 UTC 2024


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:
a817c66bcb SCUMM: (IMS) - fix new system detune
8670158cc6 SCUMM: (IMS) - fix adlib detune for Samnmax


Commit: a817c66bcb09d76b261f11f7ee3ac4584a68aa6e
    https://github.com/scummvm/scummvm/commit/a817c66bcb09d76b261f11f7ee3ac4584a68aa6e
Author: athrxx (athrxx at scummvm.org)
Date: 2024-03-17T02:09:18+01:00

Commit Message:
SCUMM: (IMS) - fix new system detune

Can be tested inSamnmax in the Tunnel of Love,
after stuffing Max into the fuse box. Now it is like
DOSBox.

Changed paths:
    engines/scumm/imuse/imuse_part.cpp


diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp
index a125fa375d2..74b285ce892 100644
--- a/engines/scumm/imuse/imuse_part.cpp
+++ b/engines/scumm/imuse/imuse_part.cpp
@@ -112,7 +112,7 @@ void Part::saveLoadWithSerializer(Common::Serializer &ser) {
 void Part::set_detune(int8 detune) {
 	// Sam&Max does not have detune except for the parameter faders, so the argument
 	// here will always be 0 and the only relevant part will be the detune from the player.
-	_detune_eff = clamp((_detune = detune) + _player->getDetune(), -128, 127);
+	_detune_eff = _se->_newSystem ? _player->getDetune() : clamp((_detune = detune) + _player->getDetune(), -128, 127);
 	sendDetune();
 }
 


Commit: 8670158cc6c9b820f7b3c223d34e29ee43cc2d28
    https://github.com/scummvm/scummvm/commit/8670158cc6c9b820f7b3c223d34e29ee43cc2d28
Author: athrxx (athrxx at scummvm.org)
Date: 2024-03-17T02:09:23+01:00

Commit Message:
SCUMM: (IMS) - fix adlib detune for Samnmax

This didn't work before. I don't know if it is now accurate
but for now I rather do this than rewrite the driver...

Changed paths:
    audio/adlib.cpp


diff --git a/audio/adlib.cpp b/audio/adlib.cpp
index 533e8de882d..fa5c361d6f4 100644
--- a/audio/adlib.cpp
+++ b/audio/adlib.cpp
@@ -86,7 +86,7 @@ protected:
 	byte _pitchBendFactor;
 	int8 _transposeEff;
 	byte _volEff;
-	int8 _detuneEff;
+	int16 _detuneEff;
 	byte _modWheel;
 	bool _pedal;
 	byte _program;
@@ -1094,7 +1094,7 @@ void AdLibPart::pitchBend(int16 bend) {
 								  (_pitchBend * _pitchBendFactor >> 6) + _detuneEff);
 #ifdef ENABLE_OPL3
 		} else {
-			_owner->adlibNoteOn(voice->_channel, voice->_note + _transposeEff, (_pitchBend * _pitchBendFactor) >> 5);
+			_owner->adlibNoteOn(voice->_channel, voice->_note + _transposeEff, ((_pitchBend * _pitchBendFactor) >> 5) + _detuneEff);
 		}
 #endif
 	}
@@ -1206,39 +1206,37 @@ void AdLibPart::pitchBendFactor(byte value) {
 							  (_pitchBend * _pitchBendFactor >> 6) + _detuneEff);
 #ifdef ENABLE_OPL3
 		} else {
-			_owner->adlibNoteOn(voice->_channel, voice->_note + _transposeEff, (_pitchBend * _pitchBendFactor) >> 5);
+			_owner->adlibNoteOn(voice->_channel, voice->_note + _transposeEff, ((_pitchBend * _pitchBendFactor) >> 5) + _detuneEff);
 		}
 #endif
 	}
 }
 
 void AdLibPart::detune(int16 value) {
-	// Sam&Max's OPL3 driver uses this for a completly different purpose. It
-	// is related to voice allocation. We ignore this for now.
-	// TODO: We probably need to look how the interpreter side of Sam&Max's
-	// iMuse version handles all this too. Implementing the driver side here
-	// would be not that hard.
+	int shr = 6;
 #ifdef ENABLE_OPL3
-	if (_owner->_opl3Mode) {
-		//_maxNotes = value;
-		return;
-	}
+	if (_owner->_opl3Mode)
+		shr = 5;
 #endif
-
 	AdLibVoice *voice;
 
-	_detuneEff = (int8)value;
+	_detuneEff = value;
 	for (voice = _voice; voice; voice = voice->_next) {
 		_owner->adlibNoteOn(voice->_channel, voice->_note + _transposeEff,
-							  (_pitchBend * _pitchBendFactor >> 6) + _detuneEff);
+							((_pitchBend * _pitchBendFactor) >> shr) + _detuneEff);
 	}
 }
 
 void AdLibPart::transpose(int8 value) {
+	int shr = 6;
+#ifdef ENABLE_OPL3
+	if (_owner->_opl3Mode)
+		shr = 5;
+#endif
 	_transposeEff = value;
 	for (AdLibVoice *voice = _voice; voice; voice = voice->_next) {
 		_owner->adlibNoteOn(voice->_channel, voice->_note + _transposeEff,
-			(_pitchBend * _pitchBendFactor >> 6) + _detuneEff);
+			(_pitchBend * _pitchBendFactor >> shr) + _detuneEff);
 	}
 }
 
@@ -1582,7 +1580,7 @@ void MidiDriver_ADLIB::setPitchBendRange(byte channel, uint range) {
 						(part->_pitchBend * part->_pitchBendFactor >> 6) + part->_detuneEff);
 #ifdef ENABLE_OPL3
 		} else {
-			adlibNoteOn(voice->_channel, voice->_note + part->_transposeEff, (part->_pitchBend * part->_pitchBendFactor) >> 5);
+			adlibNoteOn(voice->_channel, voice->_note + part->_transposeEff, ((part->_pitchBend * part->_pitchBendFactor) >> 5) + part->_detuneEff);
 		}
 #endif
 	}
@@ -2101,7 +2099,7 @@ void MidiDriver_ADLIB::mcKeyOn(AdLibVoice *voice, const AdLibInstrument *instr,
 #ifdef ENABLE_OPL3
 	} else {
 		adlibSetupChannelSecondary(voice->_channel, second, secVol1, secVol2, pan);
-		adlibNoteOnEx(voice->_channel, note + part->_transposeEff, (part->_pitchBend * part->_pitchBendFactor) >> 5);
+		adlibNoteOnEx(voice->_channel, note + part->_transposeEff, ((part->_pitchBend * part->_pitchBendFactor) >> 5) + part->_detuneEff);
 	}
 #endif
 }




More information about the Scummvm-git-logs mailing list