naudio / NAudio

Audio and MIDI library for .NET
MIT License
5.54k stars 1.1k forks source link

Send MIDI CC, chanel 9 or Undifined chanel. #433

Open taurojo opened 5 years ago

taurojo commented 5 years ago

Hi,

In WindowsForm, I need send MIDI Control Change Messages (CC) : To 9 (undifined)

I send whit: var cce = new ControlChangeEvent(0, 11, MidiController.BankSelect, 0);

But in


public enum MidiController : byte
    {
        //
        // Resumen:
        //     Bank Select (MSB)
        BankSelect = 0,
        //
        // Resumen:
        //     Modulation (MSB)
        Modulation = 1,

}....

Not view, all chanels 4,5,9,.. etc

¿How to send value to this Control Chanel number?

ThanKs!!

markheath commented 5 years ago

I'm not sure exactly what you're asking here, but the channel number is the second parameter in the ControlChangeEvent constructor

taurojo commented 5 years ago

I'v a external MIDI Xtouch Mini., and i need send value to CC . The Chanel Midi number its Ok, but i need launch to CC specific. Launch whit the MidiController.

midiOut = new MidiOut(comboBoxMidiOutDevices.SelectedIndex);
var cce = new ControlChangeEvent(0, 11, MidiController.Modulation , 0); 
midiOut.Send(cce.GetAsShortMessage());

Modulation (=1) its ok, but i need launch value to CC 9. or 5. The MidiController.Modulation = 1, but not exist MidiController.XXX= XXX, example MidiControler.Undefinied5 =5

I need created in public enum MidiController : byte { BankSelect = 0, Modulation = 1, BreathController = 2, // // Resumen: // Undifined Undifined3 = 3, FootController = 4, // // Resumen: // Undifined Undifined5 = 5,

...

And compile new Naudio.dll for my

Do not exist alter way?

markheath commented 5 years ago

You can just cast an integer - it doesn't need a special name in the enum

var cce = new ControlChangeEvent(0, 11, (MidiController)5, 0); 
taurojo commented 5 years ago

Perfect!