[Scummvm-cvs-logs] CVS: scummvm/sound gmidi.cpp,1.5,1.6 gmidi.h,1.1,1.2 imuse.cpp,1.12,1.13
James Brown
ender at users.sourceforge.net
Thu Mar 14 00:05:03 CET 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sound gmidi.h,NONE,1.1 gmidi.cpp,1.4,1.5
- Next message: [Scummvm-cvs-logs] CVS: scummvm readme.txt,1.11,1.12 resource.cpp,1.50,1.51 scumm.h,1.80,1.81 scummvm.cpp,1.77,1.78 sdl.cpp,1.41,1.42 sound.cpp,1.26,1.27 sound.h,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv21510/sound
Modified Files:
gmidi.cpp gmidi.h imuse.cpp
Log Message:
Rewire the MIDI subsystem to use drivers selecting from the commandline.
No -DTIMIDITY, etc! Yippie!. Also updated readme.
Index: gmidi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/gmidi.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** gmidi.cpp 14 Mar 2002 06:10:25 -0000 1.5
--- gmidi.cpp 14 Mar 2002 08:04:21 -0000 1.6
***************
*** 31,307 ****
#include "gmidi.h"
! #if defined(WIN32)
! /* Windows sequencer support */
! void MidiSoundDriver::midiInit() {
! if (midiOutOpen((HMIDIOUT*)&_mo, MIDI_MAPPER, NULL, NULL, 0) != MMSYSERR_NOERROR)
! error("midiOutOpen failed");
! }
! #define MIDI_OUT(a,b) midiOutShortMsg((HMIDIOUT)(a), (b))
!
! #elif defined(USE_RAWMIDI)
! /* Raw midi support - dump to /dev/midi0 or something */
! static int open_rawmidi_device() {
! int device;
! char *device_name = getenv("SCUMMVM_MIDI");
! if (device_name != NULL) {
! device = (open((device_name), O_RDWR, 0));
! } else {
! warning("You need to set-up the SCUMMVM_MIDI environment variable properly (see readme.txt) ");
! }
! if ((device_name == NULL) || (device < 0)) {
! if (device_name == NULL)
! warning("Opening /dev/null (no music will be heard) ");
! else
! warning("Cannot open rawmidi device %s - using /dev/null (no music will be heard) ", device_name);
! device = (open(("/dev/null"), O_RDWR, 0));
! if (device < 0)
! error("Cannot open /dev/null to dump midi output");
! }
! return device;
! }
!
! void SoundEngine::midiInit() {
! int device;
! device = open_rawmidi_device();
! _mo = (void *) device;
! }
! static inline void MIDI_OUT(void *a, int b) {
! int device = (int) a;
! unsigned char buf[256];
! int position = 0;
!
! switch (b & 0xF0) {
! case 0x80:
! case 0x90:
! case 0xA0:
! case 0xB0:
! case 0xE0:
! buf[position++] = b;
! buf[position++] = (b >> 8) & 0x7F;
! buf[position++] = (b >> 16) & 0x7F;
break;
! case 0xC0:
! case 0xD0:
! buf[position++] = b;
! buf[position++] = (b >> 8) & 0x7F;
break;
! default:
! fprintf(stderr, "Unknown : %08x\n", b);
break;
}
! write(device, buf, position);
}
! #elif defined(USE_TIMIDITY)
! /* Timidity server support */
! static int connect_to_timidity(int port) {
! struct hostent *serverhost;
! struct sockaddr_in sadd;
! int s;
!
! serverhost = gethostbyname("localhost");
! if (serverhost == NULL)
! error("Could not resolve Timidity host ('localhost')");
!
! sadd.sin_family = serverhost->h_addrtype;
! sadd.sin_port = htons(port);
! memcpy(&(sadd.sin_addr), serverhost->h_addr_list[0], serverhost->h_length);
!
! s = socket(AF_INET,SOCK_STREAM,0);
! if (s < 0)
! error("Could not open Timidity socket");
!
! if (connect(s, (struct sockaddr *) &sadd, sizeof(struct sockaddr_in)) < 0)
! error("Could not connect to Timidity server");
! return s;
}
! void MidiSoundDriver::midiInit() {
! int s, s2;
! int len;
! int dummy, newport;
! char buf[256];
! s = connect_to_timidity(7777);
! len = read(s, buf, 256);
! buf[len] = '\0';
! printf("%s", buf);
! sprintf(buf, "SETBUF %f %f\n", 0.1, 0.15);
! write(s, buf, strlen(buf));
! len = read(s, buf, 256); // buf[len] = '\0'; printf("%s", buf);
!
! sprintf(buf, "OPEN lsb\n");
! write(s, buf, strlen(buf));
! len = read(s, buf, 256); // buf[len] = '\0'; printf("%s", buf);
! sscanf(buf, "%d %d", &dummy, &newport);
! printf(" => port = %d\n", newport);
!
! s2 = connect_to_timidity(newport);
! _mo = (void *) s2;
}
! static inline void MIDI_OUT(void *a, int b) {
! int s = (int) a;
! unsigned char buf[256];
! int position = 0;
! switch (b & 0xF0) {
! case 0x80:
! case 0x90:
! case 0xA0:
! case 0xB0:
! case 0xE0:
! buf[position++] = SEQ_MIDIPUTC;
! buf[position++] = b;
! buf[position++] = DEVICE_NUM;
! buf[position++] = 0;
! buf[position++] = SEQ_MIDIPUTC;
! buf[position++] = (b >> 8) & 0x7F;
! buf[position++] = DEVICE_NUM;
! buf[position++] = 0;
! buf[position++] = SEQ_MIDIPUTC;
! buf[position++] = (b >> 16) & 0x7F;
! buf[position++] = DEVICE_NUM;
! buf[position++] = 0;
! break;
! case 0xC0:
! case 0xD0:
! buf[position++] = SEQ_MIDIPUTC;
! buf[position++] = b;
! buf[position++] = DEVICE_NUM;
! buf[position++] = 0;
! buf[position++] = SEQ_MIDIPUTC;
! buf[position++] = (b >> 8) & 0x7F;
! buf[position++] = DEVICE_NUM;
! buf[position++] = 0;
! break;
! default:
! fprintf(stderr, "Unknown : %08x\n", b);
break;
}
! write(s, buf, position);
! }
! #elif defined(USE_QTMUSIC)
! /* Quicktime music support */
! void MidiSoundDriver::midiInit() {
! ComponentResult qtErr = noErr;
! qtNoteAllocator = NULL;
! for (int i = 0 ; i < 15 ; i++)
! qtNoteChannel[i] = NULL;
! qtNoteAllocator = OpenDefaultComponent(kNoteAllocatorComponentType, 0);
! if (qtNoteAllocator == NULL)
! goto bail;
! simpleNoteRequest.info.flags = 0;
! *(short *)(&simpleNoteRequest.info.polyphony) = EndianS16_NtoB(15); // simultaneous tones
! *(Fixed *)(&simpleNoteRequest.info.typicalPolyphony) = EndianU32_NtoB(0x00010000);
! qtErr = NAStuffToneDescription(qtNoteAllocator, 1, &simpleNoteRequest.tone);
! if (qtErr != noErr)
goto bail;
for (int i = 0 ; i < 15 ; i++) {
! qtErr = NANewNoteChannel(qtNoteAllocator, &simpleNoteRequest, &(qtNoteChannel[i]));
! if ((qtErr != noErr) || (qtNoteChannel == NULL))
! goto bail;
}
- return;
-
- bail:
- fprintf(stderr, "Init QT failed %x %x %d\n", qtNoteAllocator, qtNoteChannel, qtErr);
- for (int i = 0 ; i < 15 ; i++) {
- if (qtNoteChannel[i] != NULL)
- NADisposeNoteChannel(qtNoteAllocator, qtNoteChannel[i]);
- }
! if (qtNoteAllocator != NULL)
! CloseComponent(qtNoteAllocator);
! }
! static inline void MIDI_OUT(void *a, int b) {
! MusicMIDIPacket midPacket;
! unsigned char *midiCmd = midPacket.data;
! midPacket.length = 3;
! midiCmd[3] = (b & 0xFF000000)>>24;
! midiCmd[2] = (b & 0x00FF0000)>>16;
! midiCmd[1] = (b & 0x0000FF00)>>8;
! midiCmd[0] = b;
! unsigned char chanID = midiCmd[0] & 0x0F;
! switch (midiCmd[0] & 0xF0) {
! case 0x80: // Note off
! NAPlayNote(qtNoteAllocator, qtNoteChannel[chanID], midiCmd[1], 0);
! break;
!
! case 0x90: // Note on
! NAPlayNote(qtNoteAllocator, qtNoteChannel[chanID], midiCmd[1], midiCmd[2]);
! break;
!
! case 0xB0: // Effect
! switch (midiCmd[1]) {
! case 0x01: // Modulation
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerModulationWheel, midiCmd[2]<<8);
! break;
! case 0x07: // Volume
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerVolume, midiCmd[2]*300);
! break;
! case 0x0A: // Pan
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerPan, (midiCmd[2]<<1)+0xFF);
! break;
! case 0x40: // Sustain on/off
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerSustain, midiCmd[2]);
! break;
! case 0x5b: // ext effect depth
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerReverb, midiCmd[2]<<8);
! break;
! case 0x5d: // chorus depth
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerChorus, midiCmd[2]<<8);
! break;
! case 0x7b: // mode message all notes off
! for (int i = 0 ; i < 128 ; i++)
! NAPlayNote(qtNoteAllocator, qtNoteChannel[chanID], i, 0);
! break;
! default:
! fprintf(stderr, "Unknown MIDI effect: %08x\n", b);
! break;
! }
! break;
!
! case 0xC0: // Program change
! NASetInstrumentNumber(qtNoteAllocator, qtNoteChannel[chanID], midiCmd[1]);
! break;
! case 0xE0: { // Pitch bend
! long theBend = ((((long)midiCmd[1] + (long)(midiCmd[2] << 8)))-0x4000)/4;
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerPitchBend, theBend);
! }
! break;
! default:
! fprintf(stderr, "Unknown Command: %08x\n", b);
! NASendMIDI(qtNoteAllocator, qtNoteChannel[chanID], &midPacket);
! break;
}
! }
! #elif
!
! /* Null output driver */
! #define MIDI_OUT(a,b)
! void MidiSoundDriver::midiInit() {warning("Music not enabled - MIDI support selected with no MIDI driver available. Try Adlib";}
#endif
--- 31,341 ----
#include "gmidi.h"
! void MidiSoundDriver::midiSetDriver(int devicetype) {
! _midi_driver.DeviceType = devicetype;
! _midi_driver.midiInit();
! }
! void MidiDriver::midiInit() {
! if (MidiInitialized != true) {
! switch (DeviceType) {
! case MIDI_NULL:
! midiInitNull();
break;
! case MIDI_WINDOWS:
! midiInitWindows();
break;
! case MIDI_TIMIDITY:
! midiInitTimidity();
! break;
! case MIDI_SEQ:
! midiInitSeq();
! break;
! case MIDI_QTMUSIC:
! midiInitQuicktime();
! break;
! default:
! DeviceType = 0;
! midiInitNull();
break;
}
! MidiInitialized = true;
! } else {
! error("Midi driver already initialized");
}
+ }
! void MidiDriver::MidiOut(int b) {
! if (MidiInitialized != true)
! midiInit();
! if (MidiInitialized == true) {
! switch (DeviceType) {
! case MIDI_NULL:
! break;
! case MIDI_WINDOWS:
! MidiOutWindows(_mo, b);
! break;
! case MIDI_TIMIDITY:
! case MIDI_SEQ:
! MidiOutSeq(_mo, b);
! break;
! case MIDI_QTMUSIC:
! MidiOutQuicktime(_mo, b);
! break;
! default:
! error("Invalid midi device type ");
! break;
! }
! } else {
! warning("Trying to write midi data without the driver being initialized");
}
+ }
! /*********** Windows */
! void MidiDriver::midiInitWindows() {
! #ifdef WIN32
! if (midiOutOpen((HMIDIOUT*)&_mo, MIDI_MAPPER, NULL, NULL, 0) != MMSYSERR_NOERROR)
! error("midiOutOpen failed");
! #endif
! }
! void MidiDriver::MidiOutWindows(void *a, int b) {
! #ifdef WIN32
! midiOutShortMsg((HMIDIOUT) a, b);
! #endif
! }
! /*********** Raw midi support */
! void MidiDriver::midiInitSeq() {
! int device = open_sequencer_device();
! _mo = (void *) device;
! }
! int MidiDriver::open_sequencer_device() {
! int device;
! char *device_name = getenv("SCUMMVM_MIDI");
! if (device_name != NULL) {
! device = (open((device_name), O_RDWR, 0));
! } else {
! warning("You need to set-up the SCUMMVM_MIDI environment variable properly (see readme.txt) ");
}
+ if ((device_name == NULL) || (device < 0)) {
+ if (device_name == NULL)
+ warning("Opening /dev/null (no music will be heard) ");
+ else
+ warning("Cannot open rawmidi device %s - using /dev/null (no music will be heard) ", device_name);
+ device = (open(("/dev/null"), O_RDWR, 0));
+ if (device < 0)
+ error("Cannot open /dev/null to dump midi output");
+ }
+ return device;
+ }
! /*********** Timidity */
! int MidiDriver::connect_to_timidity(int port) {
! struct hostent *serverhost;
! struct sockaddr_in sadd;
! int s;
!
! serverhost = gethostbyname("localhost");
! if (serverhost == NULL)
! error("Could not resolve Timidity host ('localhost')");
! sadd.sin_family = serverhost->h_addrtype;
! sadd.sin_port = htons(port);
! memcpy(&(sadd.sin_addr), serverhost->h_addr_list[0], serverhost->h_length);
!
! s = socket(AF_INET,SOCK_STREAM,0);
! if (s < 0)
! error("Could not open Timidity socket");
!
! if (connect(s, (struct sockaddr *) &sadd, sizeof(struct sockaddr_in)) < 0)
! error("Could not connect to Timidity server");
!
! return s;
! }
!
! void MidiDriver::midiInitTimidity() {
! int s, s2;
! int len;
! int dummy, newport;
! char buf[256];
!
! s = connect_to_timidity(7777);
! len = read(s, buf, 256); // buf[len] = '\0'; printf("%s", buf);
! sprintf(buf, "SETBUF %f %f\n", 0.1, 0.15);
! write(s, buf, strlen(buf));
! len = read(s, buf, 256); // buf[len] = '\0'; printf("%s", buf);
!
! sprintf(buf, "OPEN lsb\n");
! write(s, buf, strlen(buf));
! len = read(s, buf, 256); // buf[len] = '\0'; printf("%s", buf);
!
! sscanf(buf, "%d %d", &dummy, &newport);
! printf(" => port = %d\n", newport);
!
! s2 = connect_to_timidity(newport);
! _mo = (void *) s2;
! }
!
! void MidiDriver::MidiOutSeq(void *a, int b) {
! int s = (int) a;
! unsigned char buf[256];
! int position = 0;
!
! switch (b & 0xF0) {
! case 0x80:
! case 0x90:
! case 0xA0:
! case 0xB0:
! case 0xE0:
! buf[position++] = SEQ_MIDIPUTC;
! buf[position++] = b;
! buf[position++] = DEVICE_NUM;
! buf[position++] = 0;
! buf[position++] = SEQ_MIDIPUTC;
! buf[position++] = (b >> 8) & 0x7F;
! buf[position++] = DEVICE_NUM;
! buf[position++] = 0;
! buf[position++] = SEQ_MIDIPUTC;
! buf[position++] = (b >> 16) & 0x7F;
! buf[position++] = DEVICE_NUM;
! buf[position++] = 0;
! break;
! case 0xC0:
! case 0xD0:
! buf[position++] = SEQ_MIDIPUTC;
! buf[position++] = b;
! buf[position++] = DEVICE_NUM;
! buf[position++] = 0;
! buf[position++] = SEQ_MIDIPUTC;
! buf[position++] = (b >> 8) & 0x7F;
! buf[position++] = DEVICE_NUM;
! buf[position++] = 0;
! break;
! default:
! fprintf(stderr, "Unknown : %08x\n", b);
break;
}
! write(s, buf, position);
! }
! /* Quicktime music support */
! void MidiDriver::midiInitQuicktime() {
! #ifdef __APPLE__CW
! ComponentResult qtErr = noErr;
! qtNoteAllocator = NULL;
! for (int i = 0 ; i < 15 ; i++)
! qtNoteChannel[i] = NULL;
! qtNoteAllocator = OpenDefaultComponent(kNoteAllocatorComponentType, 0);
! if (qtNoteAllocator == NULL)
! goto bail;
! simpleNoteRequest.info.flags = 0;
! *(short *)(&simpleNoteRequest.info.polyphony) = EndianS16_NtoB(15); // simultaneous tones
! *(Fixed *)(&simpleNoteRequest.info.typicalPolyphony) = EndianU32_NtoB(0x00010000);
! qtErr = NAStuffToneDescription(qtNoteAllocator, 1, &simpleNoteRequest.tone);
! if (qtErr != noErr)
! goto bail;
!
! for (int i = 0 ; i < 15 ; i++) {
! qtErr = NANewNoteChannel(qtNoteAllocator, &simpleNoteRequest, &(qtNoteChannel[i]));
! if ((qtErr != noErr) || (qtNoteChannel == NULL))
goto bail;
+ }
+ return;
+ bail:
+ fprintf(stderr, "Init QT failed %x %x %d\n", qtNoteAllocator, qtNoteChannel, qtErr);
for (int i = 0 ; i < 15 ; i++) {
! if (qtNoteChannel[i] != NULL)
! NADisposeNoteChannel(qtNoteAllocator, qtNoteChannel[i]);
}
! if (qtNoteAllocator != NULL)
! CloseComponent(qtNoteAllocator);
! #endif
! }
! void MidiDriver::MidiOutQuicktime(void *a, int b) {
! #ifdef __APPLE__CW
! MusicMIDIPacket midPacket;
! unsigned char *midiCmd = midPacket.data;
! midPacket.length = 3;
! midiCmd[3] = (b & 0xFF000000)>>24;
! midiCmd[2] = (b & 0x00FF0000)>>16;
! midiCmd[1] = (b & 0x0000FF00)>>8;
! midiCmd[0] = b;
! unsigned char chanID = midiCmd[0] & 0x0F;
! switch (midiCmd[0] & 0xF0) {
! case 0x80: // Note off
! NAPlayNote(qtNoteAllocator, qtNoteChannel[chanID], midiCmd[1], 0);
! break;
!
! case 0x90: // Note on
! NAPlayNote(qtNoteAllocator, qtNoteChannel[chanID], midiCmd[1], midiCmd[2]);
! break;
!
! case 0xB0: // Effect
! switch (midiCmd[1]) {
! case 0x01: // Modulation
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerModulationWheel, midiCmd[2]<<8);
! break;
! case 0x07: // Volume
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerVolume, midiCmd[2]*300);
! break;
! case 0x0A: // Pan
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerPan, (midiCmd[2]<<1)+0xFF);
! break;
! case 0x40: // Sustain on/off
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerSustain, midiCmd[2]);
! break;
! case 0x5b: // ext effect depth
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerReverb, midiCmd[2]<<8);
! break;
! case 0x5d: // chorus depth
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerChorus, midiCmd[2]<<8);
! break;
! case 0x7b: // mode message all notes off
! for (int i = 0 ; i < 128 ; i++)
! NAPlayNote(qtNoteAllocator, qtNoteChannel[chanID], i, 0);
! break;
! default:
! fprintf(stderr, "Unknown MIDI effect: %08x\n", b);
! break;
! }
! break;
! case 0xC0: // Program change
! NASetInstrumentNumber(qtNoteAllocator, qtNoteChannel[chanID], midiCmd[1]);
! break;
! case 0xE0: { // Pitch bend
! long theBend = ((((long)midiCmd[1] + (long)(midiCmd[2] << 8)))-0x4000)/4;
! NASetController(qtNoteAllocator, qtNoteChannel[chanID], kControllerPitchBend, theBend);
}
! break;
!
! default:
! fprintf(stderr, "Unknown Command: %08x\n", b);
! NASendMIDI(qtNoteAllocator, qtNoteChannel[chanID], &midPacket);
! break;
! }
#endif
+ }
+
+ void MidiDriver::midiInitNull() {warning("Music not enabled - MIDI support selected with no MIDI driver available. Try Adlib");}
+
***************
*** 313,317 ****
_midi_pitchbend_last[chan] = pitchbend;
tmp = (pitchbend<<2) + 0x2000;
! MIDI_OUT(_mo, ((tmp>>7)&0x7F)<<16 | (tmp&0x7F)<<8 | 0xE0 | chan);
}
}
--- 347,351 ----
_midi_pitchbend_last[chan] = pitchbend;
tmp = (pitchbend<<2) + 0x2000;
! _midi_driver.MidiOut(((tmp>>7)&0x7F)<<16 | (tmp&0x7F)<<8 | 0xE0 | chan);
}
}
***************
*** 320,324 ****
if (_midi_volume_last[chan] != volume) {
_midi_volume_last[chan] = volume;
! MIDI_OUT(_mo, volume<<16 | 7<<8 | 0xB0 | chan);
}
}
--- 354,358 ----
if (_midi_volume_last[chan] != volume) {
_midi_volume_last[chan] = volume;
! _midi_driver.MidiOut(volume<<16 | 7<<8 | 0xB0 | chan);
}
}
***************
*** 326,330 ****
if (_midi_pedal_last[chan] != pedal) {
_midi_pedal_last[chan] = pedal;
! MIDI_OUT(_mo, pedal<<16 | 64<<8 | 0xB0 | chan);
}
}
--- 360,364 ----
if (_midi_pedal_last[chan] != pedal) {
_midi_pedal_last[chan] = pedal;
! _midi_driver.MidiOut(pedal<<16 | 64<<8 | 0xB0 | chan);
}
}
***************
*** 333,337 ****
if (_midi_modwheel_last[chan] != modwheel) {
_midi_modwheel_last[chan] = modwheel;
! MIDI_OUT(_mo, modwheel<<16 | 1<<8 | 0xB0 | chan);
}
}
--- 367,371 ----
if (_midi_modwheel_last[chan] != modwheel) {
_midi_modwheel_last[chan] = modwheel;
! _midi_driver.MidiOut(modwheel<<16 | 1<<8 | 0xB0 | chan);
}
}
***************
*** 340,344 ****
if (_midi_effectlevel_last[chan] != level) {
_midi_effectlevel_last[chan] = level;
! MIDI_OUT(_mo, level<<16 | 91<<8 | 0xB0 | chan);
}
}
--- 374,378 ----
if (_midi_effectlevel_last[chan] != level) {
_midi_effectlevel_last[chan] = level;
! _midi_driver.MidiOut(level<<16 | 91<<8 | 0xB0 | chan);
}
}
***************
*** 347,363 ****
if (_midi_chorus_last[chan] != chorus) {
_midi_chorus_last[chan] = chorus;
! MIDI_OUT(_mo, chorus<<16 | 93<<8 | 0xB0 | chan);
}
}
void MidiSoundDriver::midiControl0(byte chan, byte value) {
! MIDI_OUT(_mo, value<<16 | 0<<8 | 0xB0 | chan);
}
void MidiSoundDriver::midiProgram(byte chan, byte program) {
! if (_se->_mt32emulate)
! program=mt32_to_gmidi[program];
!
! MIDI_OUT(_mo, program<<8 | 0xC0 | chan);
}
--- 381,399 ----
if (_midi_chorus_last[chan] != chorus) {
_midi_chorus_last[chan] = chorus;
! _midi_driver.MidiOut(chorus<<16 | 93<<8 | 0xB0 | chan);
}
}
void MidiSoundDriver::midiControl0(byte chan, byte value) {
! _midi_driver.MidiOut(value<<16 | 0<<8 | 0xB0 | chan);
}
void MidiSoundDriver::midiProgram(byte chan, byte program) {
! if ((chan + 1) != 10) { /* Ignore percussion prededed by patch change */
! if (_se->_mt32emulate)
! program=mt32_to_gmidi[program];
!
! _midi_driver.MidiOut(program<<8 | 0xC0 | chan);
! }
}
***************
*** 365,383 ****
if (_midi_pan_last[chan] != pan) {
_midi_pan_last[chan] = pan;
! MIDI_OUT(_mo, ((pan-64)&0x7F)<<16 | 10<<8 | 0xB0 | chan);
}
}
void MidiSoundDriver::midiNoteOn(byte chan, byte note, byte velocity) {
! MIDI_OUT(_mo, velocity<<16 | note<<8 | 0x90 | chan);
}
void MidiSoundDriver::midiNoteOff(byte chan, byte note) {
! MIDI_OUT(_mo, note<<8 | 0x80 | chan);
}
void MidiSoundDriver::midiSilence(byte chan) {
! MIDI_OUT(_mo, (64<<8)|0xB0|chan);
! MIDI_OUT(_mo, (123<<8)|0xB0|chan);
}
--- 401,419 ----
if (_midi_pan_last[chan] != pan) {
_midi_pan_last[chan] = pan;
! _midi_driver.MidiOut(((pan-64)&0x7F)<<16 | 10<<8 | 0xB0 | chan);
}
}
void MidiSoundDriver::midiNoteOn(byte chan, byte note, byte velocity) {
! _midi_driver.MidiOut(velocity<<16 | note<<8 | 0x90 | chan);
}
void MidiSoundDriver::midiNoteOff(byte chan, byte note) {
! _midi_driver.MidiOut(note<<8 | 0x80 | chan);
}
void MidiSoundDriver::midiSilence(byte chan) {
! _midi_driver.MidiOut((64<<8)|0xB0|chan);
! _midi_driver.MidiOut((123<<8)|0xB0|chan);
}
***************
*** 415,420 ****
for(i=0,mc=_midi_channels; i!=ARRAYSIZE(_midi_channels);i++,mc++)
mc->_chan = i;
-
- midiInit();
}
--- 451,454 ----
Index: gmidi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/gmidi.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** gmidi.h 14 Mar 2002 06:10:25 -0000 1.1
--- gmidi.h 14 Mar 2002 08:04:21 -0000 1.2
***************
*** 8,12 ****
#define DEVICE_NUM 0
! #if defined(USE_QTMUSIC)
#include <QuickTimeComponents.h>
#include "QuickTimeMusic.h"
--- 8,12 ----
#define DEVICE_NUM 0
! #ifdef __APPLE__CW
#include <QuickTimeComponents.h>
#include "QuickTimeMusic.h"
***************
*** 16,19 ****
--- 16,34 ----
NoteRequest simpleNoteRequest;
#endif
+
+ #ifdef WIN32
+ #include <winsock.h>
+ #elif defined(UNIX)
+ #include <sys/time.h>
+ #include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #endif
+
/* Roland to General Midi patch table. Still needs much work. */
Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/imuse.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** imuse.cpp 11 Mar 2002 04:37:06 -0000 1.12
--- imuse.cpp 14 Mar 2002 08:04:21 -0000 1.13
***************
*** 151,157 ****
byte *SoundEngine::findTag(int sound, char *tag, int index) {
! byte *ptr = _base_sounds[sound];
int32 size,pos;
if (ptr==NULL) {
debug(1, "SoundEngine::findTag completely failed finding sound %d", sound);
--- 151,160 ----
byte *SoundEngine::findTag(int sound, char *tag, int index) {
! byte *ptr = NULL;
int32 size,pos;
+ if (_base_sounds)
+ ptr = _base_sounds[sound];
+
if (ptr==NULL) {
debug(1, "SoundEngine::findTag completely failed finding sound %d", sound);
***************
*** 922,926 ****
_driver = (SOUND_DRIVER_TYPE*)driver;
!
_master_volume = 127;
if (_music_volume < 1) _music_volume = 60;
--- 925,929 ----
_driver = (SOUND_DRIVER_TYPE*)driver;
!
_master_volume = 127;
if (_music_volume < 1) _music_volume = 60;
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/sound gmidi.h,NONE,1.1 gmidi.cpp,1.4,1.5
- Next message: [Scummvm-cvs-logs] CVS: scummvm readme.txt,1.11,1.12 resource.cpp,1.50,1.51 scumm.h,1.80,1.81 scummvm.cpp,1.77,1.78 sdl.cpp,1.41,1.42 sound.cpp,1.26,1.27 sound.h,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list