[Scummvm-git-logs] scummvm master -> 720f47c942fbfa972682b3b04e14e8258a08b9d3

NMIError noreply at scummvm.org
Tue Sep 23 18:54:31 UTC 2025


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

Summary:
720f47c942 AUDIO: Add MIDI loop section clearing


Commit: 720f47c942fbfa972682b3b04e14e8258a08b9d3
    https://github.com/scummvm/scummvm/commit/720f47c942fbfa972682b3b04e14e8258a08b9d3
Author: Coen Rampen (crampen at gmail.com)
Date: 2025-09-23T20:54:26+02:00

Commit Message:
AUDIO: Add MIDI loop section clearing

Changed paths:
    audio/midiparser.cpp
    audio/midiparser.h


diff --git a/audio/midiparser.cpp b/audio/midiparser.cpp
index be3dae773a5..f054dc288ed 100644
--- a/audio/midiparser.cpp
+++ b/audio/midiparser.cpp
@@ -464,17 +464,34 @@ void MidiParser::resetTracking() {
 }
 
 void MidiParser::setLoopSection(uint32 startPoint, uint32 endPoint) {
+	if (endPoint != 0 && endPoint <= startPoint) {
+		warning("MidiParser::setLoopSection - Attempt to set loop end point before start point");
+		return;
+	}
+
 	_loopStartPoint = startPoint;
 	_loopEndPoint = endPoint;
 }
 
 void MidiParser::setLoopSectionMicroseconds(uint32 startPoint, uint32 endPoint) {
+	if (endPoint != 0 && endPoint <= startPoint) {
+		warning("MidiParser::setLoopSectionMicroseconds - Attempt to set loop end point before start point");
+		return;
+	}
+
 	_loopStartPointMs = startPoint;
 	_loopEndPointMs = endPoint;
 	_loopStartPoint = (startPoint == 0 ? 0 : 0xFFFFFFFF);
 	_loopEndPoint = (endPoint == 0 ? 0 : 0xFFFFFFFF);
 }
 
+void MidiParser::clearLoopSection() {
+	_loopStartPoint = 0xFFFFFFFF;
+	_loopEndPoint = 0xFFFFFFFF;
+	_loopStartPointMs = 0xFFFFFFFF;
+	_loopEndPointMs = 0xFFFFFFFF;
+}
+
 bool MidiParser::setTrack(int track) {
 	if (track < 0 || track >= _numTracks)
 		return false;
@@ -720,6 +737,7 @@ void MidiParser::unloadMusic() {
 		_nextSubtrackEvents[i].subtrack = i;
 	}
 	_nextEvent = &_nextSubtrackEvents[0];
+	clearLoopSection();
 
 	if (_centerPitchWheelOnUnload) {
 		// Center the pitch wheels in preparation for the next piece of
diff --git a/audio/midiparser.h b/audio/midiparser.h
index 9b02c879112..0bb12c7271f 100644
--- a/audio/midiparser.h
+++ b/audio/midiparser.h
@@ -585,6 +585,7 @@ public:
 
 	void setLoopSection(uint32 startPoint, uint32 endPoint = 0);
 	void setLoopSectionMicroseconds(uint32 startPoint, uint32 endPoint = 0);
+	void clearLoopSection();
 
 	uint32 getPPQN() { return _ppqn; }
 	virtual uint32 getTick() { return _position._playTick; }




More information about the Scummvm-git-logs mailing list