Opened 15 years ago

Closed 13 years ago

Last modified 17 months ago

#7424 closed enhancement

(ALL) Support selecting MIDI device in OS X

Reported by: SF/fancia Owned by: fingolfin
Priority: normal Component: Port: Mac OS X
Keywords: MIDI Cc:
Game:

Description

Currently, in OS X, although "CoreAudio" is selectable, only the default software synthesizer will be used. There is no way to use other devices, which prevents users like me from using external MIDI devices and rendering the CoreAudio option unfortunately useless. Adding a way to select other devices would be very greatly apprerciated.

Ticket imported from: #1187552. Ticket imported from: feature-requests/240.

Attachments (2)

mi2.mp3 (244.1 KB ) - added by SF/fancia 14 years ago.
Monkey Island 2
bass.mp3 (197.1 KB ) - added by SF/fancia 14 years ago.
Beneath a Steel Sky

Download all attachments as: .zip

Change History (27)

comment:1 by fingolfin, 15 years ago

Since I have no external MIDI device, I can't really work on this. Looking at the CoreAudio MIDI specs, it's also unclear to me how we could allow the user to specify an alternate MIDI device; if I had hardware to work with, I am sure I could pretty easily find out, but working blind wouldn't be fun (and frankly I'd rather spend my time on working on more worthwhile efforts instead of doing a lengthy trial & error process to get this working with the help of remote testers).

If anybody feels like donating suitable HW to me (like a USB MIDI interface plus a suitable MIDI synth, maybe even a MT32 :-), though, I'll certainly implement this :-)

comment:2 by SF/fancia, 15 years ago

As you can imagine I'm certainly not keen on giving away my precious, er, MT-32, and haven't the money to buy you one, but if a loan would be acceptable I'd be willing to lend you either my MT-32 or SC-88Pro and my RoMI/O USB MIDI cable so you could test this. Contact me at mdemeo at dalNOSPAM.ca, and we can work out how it should be sent, and so on.

comment:3 by fingolfin, 15 years ago

Owner: set to SF/ender

comment:4 by fingolfin, 15 years ago

Thanks for the offer, fancia, but I think shipping this bunch of HW back and forth between CA is already so expensive (not to mention the risk of HW getting damaged or lost on the way) that it hardly makes sense to do this :-/

But maybe you can give me a pointer to what HW exactly is needed to attach e.g. an MT32, then I can search for it on ebay... and point people who are interested in buying this to the stuff.

Or maybe we can use some of the money people donated for ScummVM. I have absolutely no idea how much we got, as Ender manages that money completely on his own... Ender?

comment:5 by SF/fancia, 15 years ago

A USB MIDI cable of some sort (I use a 2-out RoMI/O cable, but there are many others) is what's required... CoreAudio will detect each port and they are selectable by their names in software. (The default appears to be the QuickTime softsynth, and no other default is configuratable.)

comment:6 by fingolfin, 15 years ago

Owner: SF/ender removed

comment:7 by fingolfin, 15 years ago

I have done MIDI in the past, but never via USB (when I say past I mean it -- my good old Atari ST had MIDI ports, and I had a MIDI<->Gameport (?) adapter in the PC, IIRC).

So, any suggestions regarding USB<->MIDI adapters/cable are welcome. In particular, if you could name brands/companies/product names, or even point me at web sites of manufacturers, that'd be welcome. I am currently looking on ebay.de for an affordable MT-32 or CM-32L or similar, but it'll be useless w/o a MIDI port :-)

comment:8 by SF/fancia, 15 years ago

If you can find one, a RoMI/O is a nice little thing for its two out ports (if you need that), and runs about the same price, or a bit lower, as a one- port unit from Roland or M-Audio. You can get one at Compumusic http://www.compumusic.com/p531.htm, which seems to be the cheapest price in the US. MTLC (who I bought mine from) have it for a similar price here: http://www.mtlc.net/index.php? PHPSESSID=05177fecfda24a658704e958e0a662b8&page=Product&se archvalue=romi%2Fo&pid=1093

The Roland and &c. units are probably more expensive, unless you pick them up on eBay - search for "USB MIDI." You'll want to make sure that the photo doesn't show a box with MIDI ports - it's more convenient to get a unit with the MIDI in and out cables built-in, because otherwise you'll have to buy another MIDI cable to attach the USB device and the MT-32.

comment:9 by fingolfin, 15 years ago

Small status update, I do have a MT32 and an USB MIDI adapter now. CVS contains a hack that makes it possible to use the MT32 as output device. However, there is no good way to access it from the GUI at this point. I still have to think about how to implement this. I could probably just use a mac specific hack, but ideally I'd like to enhance our midi driver system to make it possible for a MIDI device to have additional options. For example the Windows device driver also would benefit from some extra settings, which would allow selecting alternate MIDI devices (right now it always uses the default device, AFAIK).

comment:10 by SF/fancia, 14 years ago

I'm very sorry to bother you, but any progress on this? If not, could I ask how to use the hack you mentioned awhile back, if it's still in CVS? I'd be interested in using it, and I'm comfortable with the commandline.

comment:11 by fingolfin, 14 years ago

Owner: set to fingolfin

comment:12 by fingolfin, 14 years ago

Hehe, good timing. I just commited yet another change. There is now a new OS X midi backend: CoreMIDI. I decided to remove the hack and move it to a new driver, since the CoreAudio Softsynth and the regular CoreMIDI output have to be programmed in a totally different way anyway...

So, now you can choose between these drivers: - qt (= QuickTime) - core / coreaudio - coremidi

At this point, the CoreMIDI driver will use the first available MIDI output device. I'll think about how to make it possible to specify a specific output device later. Of course it would be best if that was done via the options dialog. But note that you can't switch the output device while a game is running (for obvious reasons, if you are familiar with the MIDI spec: the 'new' output device wouldn't be in the wrong state).

Compiling HEAD CVS from scratch and using the "coremidi" engine should do the trick. If you want, I can provide you with a binary with this enabled.

comment:13 by SF/fancia, 14 years ago

I would appreciate that very much, thank you! I'd be glad to give it some testing, too, with the games I have.

comment:14 by fingolfin, 14 years ago

Please try out this snapshot: <http://www.scummvm.org/downloads/ ScummVM-snapshot.dmg>

Note: This is a snapshot build, and as such may contain serious bugs. Also it may create savegames incompatible with older ScummVM versions!

comment:15 by SF/fancia, 14 years ago

I've noticed a couple of bugs with this build; I've been testing with my RoMI/O USB MIDI cable (two outputs, and ScummVM is correctly using the first) and my SC-88ST Pro (GS module, with GM modes) and my MT-32.

First, all instruments on both modules are, for some reason, being sent as acoustic piano 1, the first MIDI instrument.

As well, would it be possible to add some pauses between the SysEx messages? At least in Beneath a Steel Sky, I'm getting a buffer overflow - a very common problem with some MT-32 models.

comment:16 by fingolfin, 14 years ago

Which game(s) are you testing with?

Make sure you are *not* using a Mac version -- those do not contain data for the MT-32.

I assume you have selected the CoreMIDI driver in the options, and chose the "True MT-32" setting?

As for the SysEx messages -- those are *not* an issue of the OS X MIDI drivers, but rather issues specific to the affected game, or possibly to the "high" level MIDI infrastructure in ScummVM.

comment:17 by SF/fancia, 14 years ago

I've tried the following games:

Beneath a Steel Sky (both GM and MT-32) Flight of the Amazon Queen (both GM and MT-32) Monkey Island 2 (MT-32)

When using my SC-88ST Pro, the "True MT-32" setting is off; when using the MT-32, it's on. I have selected the CoreMIDI driver, and I can see that MIDI messages are being sent, from the panels on my modules. It's just that each instrument is being defined as AcousticPiano1, which is the first MIDI instrument in both the GM and MT-32 map.

I think you're right about the SysEx; some games with smaller sets (Monkey Island 2, for instance) send their SysEx correctly. It's really a bug with the hardware MT-32 itself, which overflows extremely easily; it would probably be better if I submitted a request elsewhere for adding pauses between SysEx messages when transferring at the beginning of the game, which will work around it.

comment:18 by fingolfin, 14 years ago

Yes, please file a separate request regarding the sysex "breaks".

As for the "piano problem": I haven't performed any particular checks regarding which instruments are being used (how do you know, by the way? Using some software?). But when playing MI2 PC, it's very easy to hear (just by my good ol' plain Ears(TM) :-) that several different instruments, including stuff from the drum kit, are being used...

For MI2 (mac), that's not the case, however, it sounds just strange when used wiht my MT-32.

I haven't tried BASS / FOTAQ yet.

by SF/fancia, 14 years ago

Attachment: mi2.mp3 added

Monkey Island 2

comment:19 by SF/fancia, 14 years ago

I can tell by using the MT-32 panel buttons; by pressing the buttons corresponding to the various channels, I can see that there are only AcouPiano1 instruments on all channels, except occasionally LeshBass on channels 2 and 3. It's definitely wrong - I've attached a recording here (made from the DOS Monkey Island Madness version). You can compare it with the MP3 from here, which has the proper instruments: http://blaze.spicelab.net/ mt32/

The rhythm part does sound like drums, but that's because the rhythm channel is treated differently and can only play percussion instruments.

I'll also attach an MP3 of BASS; you can hear that the instruments are very wrong.

by SF/fancia, 14 years ago

Attachment: bass.mp3 added

Beneath a Steel Sky

comment:20 by fingolfin, 14 years ago

Yes you are indeed right, it sounds wrong and is wrong.

The strange thing (to me, at least), though, is that I *see* the program change messages being sent to the MT-32... for some reasons they have no effect. Very odd...

comment:21 by fingolfin, 14 years ago

Ah I found the problem. The MIDI packet length was fixed (always 3 bytes), but program changes (and monophonic aftertouch, though I have no idea if that is ever used) only take up two bytes. This caused stray 0 bytes to be inserted, which apparently broke things badly.

Fixed in CVS, and uploaded a new snapshot. Please give it a try :-)

comment:22 by SF/fancia, 14 years ago

You're right, that's fixed it quite nicely! Both MT-32 and GM playback are working well now in the games I've tested. Thank you very much for your help, and for implementing this!

comment:23 by fingolfin, 13 years ago

Status: newclosed

comment:24 by fingolfin, 13 years ago

Closing this in favor of FR #1107956 (see also <http://wiki.scummvm.org/index.php/OpenTasks#MIDI_device_configuration>).

comment:25 by digitall, 17 months ago

Component: Port: Mac OS X
Keywords: MIDI added
Note: See TracTickets for help on using tickets.