# mimo's MidiOut

(rather call it "MidiOut for ASIO":)
type: Effect
$Revision: 1.9 $
author: mimo@restoel.net
home: restoel.net/mimo

[usage] [hints] [limitations][programming][what's new]

## why another MidiOut?

there are already some machines around which do the same but better-they didnt work on my machine. I dont know the reason why.

## usage

MidiOut comes together with MidiGen which is used as the midi generator (yes!). If you dont have MidiGen yet, get the latest version from www.buzzmachines.com, otherwise MidiOut is useless. Use MidiGen to generate MidiSignals and route them into MidiOut (=connect it to MidiOut). Look up the device number in MidiOut's Midi-Info (right-button menu) or set it through the buzz-double-click menu. In Midi-Info you will see a list of all midi-devices that m$win found in your system, on the left you'll see the number (for later use in MidiGen) followed by one of these symbols:

| | the output is in use by some other application-check view|preferences|midi output and disable the device if you want to use it in MidiOut
- | the device is free and can be wired to MidiOut
~ | the device is wired to MidiOut and may be used by multiple tracks
! | the device is "bogus"-m$win couldnt query its capabilities (haven't had this one yet)

Edit the pattern in MidiGen - you will need to set a device and a channel even if you selected one already in MidiOut - otherwise you want hear anything (the device you set in MidiOut will override all other device selections you make in MidiGen). You dont have to set the device or channel in MidiGen, use MidiOut for device and channel selection. You may connect one MidiGen to multiple MidiOut and vice versa - multiple MidiGens to one MidiOut.

## hints

- if you dont know why a certain device is not available you can check m$win debug output in Midi-Info|Midi System Messages. The list is being updated in one second intervals - realtime error monitoring! when you press "Update"
- use one device per track. If you change the device within a track the last note on the previous device will be muted-you might as well like this behavior.
- use one channel per track. Same effect as with devices applies to changing the channel. I do kind of like this behaviour.
- playing a different note on the same track will mute (turn off) the last note played. If you want to play chords use multiple tracks and set them to the same device and channel.
- if you're a machine developer dont ever try to write documentation for your machine

## limitations

- dont change the volume on the connection between MidiGen or MidiOut - otherwise you'll see a lot of messages in Midi-Info. Leave it at maximum.
- the delay button doesnt work yet (help! please!)
- you may use several MidiOut machines at the same time, but you can only access a certain MidiOut device with one of them. I'm hoping to solve this in future versions but couldnt find out how to "communicate" with another loaded instance of MidiOut in buzz. maybe someone can give me a hint in this cause.
- timing works for me. I'm using a seperate soundcard which does nothing else but playing midi. if you use directx for waveout on the same card you may get timing problems. there's no special timing mechanism being used by MidiOut. It plays a note whenever a new buzz-tick arrives. I'll probably have to solve this in a future version. On the other hand cpu usage is very low with this technique. It rises when I use the directx driver for waveout on the same soundcard but I prefer using the asio-driver which gives lower latency and less cpu usage.
2001-05-01:
There are still problems with timing, especially when the directx driver is used. waveform audio is more acurate now, asio works as good as ever. You can use the Delay-slider if you're using higher audio latency. If midi is completely out of sync you better stop/start buzz again. Midi will be resyncd again.
2001-05-21: changed timing method completely due to clicks & pops I got using a thread based method. Timing ist still okay for ASIO but doesnt seem to be with anything else on my machine. If you remark different behaviour please tell me so I know my machine is too blame.
- the number of tracks is limited to 32. If you need more tracks for any reason whatsoever tell me.
- the number of midi devices is limited to 32. I couldnt find a way to change the machines parameter after initialisation of the machine. maybe someone around knows a solution to the matter
- at the time given, you can only use one MidiGen per MidiOut. Maybe I'll change this in the future but I didnt really see a point in doing all that work...
2001-05-01
- you can connect a MidiGen only once to a MidiOut - otherwise buzz crashes. dont know why...

## programming

yes, you can develop your own midi generators sendig data to a MidiOut. Create a header file with the following content:

    typedef enum {
     c0_Nothing,
     c0_FirstDevice = 128, //meaning not more than 120 devices possible
     c0_LastPossibleValue=128+32
    }ECommand0;

    typedef enum {
     c1_FirstChannel=0,
     c1_LastChannel=15,
     c1_NoChannel,
     c1_OmniChannel,
     c1_OpenDevice = 128,
     c1_CloseDevice,
     c1_LastPossibleValue
    }ECommand1;

MidiOut accepts commands with this syntax sent to its Work-method (MidiOut is a mono-machine, the float * is converted to an unsigned char * ):

    unsigned char ucDevice,ucChannel,ucMidiStatus,ucMidiData1,ucMidiData2;  == 5 Bytes

ucDevice: ECommand0 (see above):128+device number
ucChannel:ECommand1(see above):channel(0-15),or Open/Close Device; rest is not implemented yet
ucMidiStatus: Midi Status Byte: 0x8 for Note Off; 0x9 for Note On, ...
ucMidiData1: Midi Data Byte 1 (eg .Note)
ucMidiData2: Midi Data Byte 2 (eg. Velocity)

## what's new

2001-05-21: fixed some nasty bugs, e.g. you couldnt start buzz a 2nd time without restarting win$, everything looks quite stable at the moment
2001-05-01: Check the limitations section for new features and bugs fixed

$Log: mimo's\040MidiOut.html,v $

Revision 1.9 2001-05-21 20:09:36+02 mimo

timing in MDKWork, no thread->ASIO okay, rest is shit

fixed MidiSubsys::Unregister bug

no Open/Close-Device needed

removed Dialog timer (no need for->Update button)

multiple connections are okay

fixed some memory leaks and access bugs

Revision 1.8 2001-05-01 22:44:57+02 mimo

2nd release (still in beta)

Revision 1.7 2001-05-01 20:36:01+02 mimo fixed rcs-tags in documentation Revision 1.6 2001-05-01 20:32:01+02 mimo <>
Revision 1.2 2001-05-01 19:32:11+02 mimo
now have a central midisubsys/engine
fixed some bugs
delay is working
timinig is improved but far from being good (ASIO is okay) mechanism using tick and play to get knowledge about when an event should be played

Revision 1.1 2001-05-01 19:27:43+02 mimo
Initial revision

(C) mimo@restoel.net. MidiOut is of course donationware on a voluntary basis.
$Id: mimo's\040MidiOut.html,v 1.3 2001-05-01 19:32:10+02 mimo Exp mimo $