VMM 1 2 0 0 beta[2007-01-11]
I am currently developing the Multiport feature, and I would like to propose what I have in mind. If you have any comment, please post them on the contact page.
The idea is that programming in VMM would allow you to access all available MIDI in and out ports in the same program.
Since VMM (currently) does not support strings, or any datatype other than 'number' it would be difficult to specify a port in VMM code.
So I created the concept of a 'mapped MIDI port', where you can assign numbers to a MIDI port and refer to that number in your VMM code. The management of those mappings should be done in the runtime program (not in the compiler), so that you do not need to recompile when you want to use another MIDI port.
As an example:
Let's say that you have 2 MIDI ports, one is connected a physical synthesizer and another to a software synthesiser (Reaktor, FM8, DiscoDSP,..).
In your code you could define 2 constants, one for the physical synth and one for the soft synth like this:
global const SYNTH_PORT = 1;
global const SOFT_SYNTH_PORT = 2;
In the VMM runtime you should match those numbers (1 and 2) to the MIDI ports. So your program does not know anything about MIDI ports, only about those numbers.
INPUT vs OUTPUT
Now how would you specify these ports in your program?
* Let's start with output
Basically, there are 2 options
1. extend the out method with another parameter where you specify the output port
2. call a method to specify the current port to use for all subsequent calls to 'out' on the current thread.
I favor the second solution because it would keep the 'out' method simple and keeps previous code compatible (currently overloading is not supported in VMM), and I do not want to introduce something like (out_extended).
Please note that you/we could also add extra functions to the stdMidi.VMM where the ports are parameters...
* It get's a bit more tricky with input.
I could go for a similar solution as output, but this would limit the progammer to 1 port per thread, so he'd have to start a thread for every MIDI port he want's to read from.
I want it to be more flexible than that, let's go for an array;
(Where InputPorts is an array of MIDI ports (mapped numbers remember?)
When you call in(), it will return if there is a message on any of the specified MIDI ports.
=> so now you have that input message, but not where it came from right?
The same two options:
1. Extend the 'in' method to contain the port as a ref parameter:
in(ref InputPort); // the input message is returned
2. Add another method that returns the MIDI port of that last read input message:
I favor the second solution for the same reasons I did for the output.
So if you have any comments, or are interested in testing unreleased versions of VMM containing this feature, we would like to hear from you.