[Scummvm-cvs-logs] CVS: scummvm/sound mididrv.cpp,1.11,1.12

Max Horn fingolfin at users.sourceforge.net
Fri Oct 11 17:27:09 CEST 2002


Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv9347/sound

Modified Files:
	mididrv.cpp 
Log Message:
revised options dialog

Index: mididrv.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mididrv.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mididrv.cpp	11 Oct 2002 13:07:26 -0000	1.11
+++ mididrv.cpp	12 Oct 2002 00:26:24 -0000	1.12
@@ -815,11 +815,15 @@
 		break;
 
 	case 0xE0:{									// Pitch bend
-			long theBend = (long)midiCmd[1] | (long)(midiCmd[2] << 8);
 			// QuickTime specifies pitchbend in semitones, using 8.8 fixed point values;
-			// but iMuse sends us the pitch bend data relative to +/- 12 semitones. Thus
-			// we have to convert it to the QT format.
-			theBend = (theBend - 0x4000) * 6 / 128;
+			// but iMuse sends us the pitch bend data as 0-32768. which has to be mapped
+			// to +/- 12 semitones. Based on this, we first center the input data, then
+			// multiply it by a factor. If all was right, the factor would be 3/8, but for
+			// mysterious reasons the actual factor we have to use is more like 1/32 or 3/64.
+			// Maybe the QT docs are right, and 
+			long theBend = (long)midiCmd[1] | (long)(midiCmd[2] << 7);
+			theBend = (theBend - 0x2000) * 2 / 64;
+
 			NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerPitchBend, theBend);
 		}
 		break;
@@ -880,6 +884,9 @@
 	if (au_output != NULL)
 		return MERR_ALREADY_OPEN;
 
+	if (mode == MO_STREAMING)
+		return MERR_STREAMING_NOT_AVAILABLE;
+
 	_mode = mode;
 
 	int err;
@@ -913,6 +920,21 @@
 
 	// start the output
 	AudioOutputUnitStart(au_output);
+
+#if 1
+	// Send initial pitch bend sensitivity values for +/- 12 semitones.
+	// For information on control change registered parameters,
+	// which includes the Pitch Bend sensitivity settings,
+	// visit http://www.midi.org/about-midi/table3.htm,
+	// Table 3a.
+	int chan;
+	for (chan = 0; chan < 16; ++chan) {
+		MusicDeviceMIDIEvent(au_MusicDevice, (0xB0 | chan), 101,  0, 0);
+		MusicDeviceMIDIEvent(au_MusicDevice, (0xB0 | chan), 100,  0, 0);
+		MusicDeviceMIDIEvent(au_MusicDevice, (0xB0 | chan),   6, 12, 0);
+		MusicDeviceMIDIEvent(au_MusicDevice, (0xB0 | chan),  38,  0, 0);
+	} // next for
+#endif
 
 	return 0;
 }





More information about the Scummvm-git-logs mailing list