public static void SendNoteOn(MidiChannel channel, int noteNumber, float velocity) { int cn = Mathf.Clamp ((int)channel, 0, 15); noteNumber = Mathf.Clamp (noteNumber, 0, 127); velocity = Mathf.Clamp (127.0f * velocity, 0.0f, 127.0f); MidiBridge.instance.Send (0x90 + cn, noteNumber, (int)velocity); }
public static void SendPitchBend(MidiChannel channel, int lsb, int msb) { int cn = Mathf.Clamp ((int)channel, 0, 15); lsb = Mathf.Clamp (lsb, 0, 127); msb = Mathf.Clamp (msb, 0, 127); MidiBridge.instance.Send (0xE0 + cn, lsb, msb); }
void OnDestroy() { MidiChannel[] channels = new MidiChannel[16]{ MidiChannel.Ch1, MidiChannel.Ch2, MidiChannel.Ch3, MidiChannel.Ch4, MidiChannel.Ch5, MidiChannel.Ch6, MidiChannel.Ch7, MidiChannel.Ch8, MidiChannel.Ch9, MidiChannel.Ch10, MidiChannel.Ch11, MidiChannel.Ch12, MidiChannel.Ch13, MidiChannel.Ch14, MidiChannel.Ch15, MidiChannel.Ch16 }; for (int i=0; i<120; i++) { foreach(MidiChannel c in channels){ MidiOut.SendNoteOff(c,i); } } }
public static void SendControlChange(MidiChannel channel, int controlNumber, float value) { int cn = Mathf.Clamp ((int)channel, 0, 15); controlNumber = Mathf.Clamp (controlNumber, 0, 127); value = Mathf.Clamp (127.0f * value, 0.0f, 127.0f); MidiBridge.instance.Send (0xb0 + cn, controlNumber, (int)value); }
public int[] GetKnobNumbers(MidiChannel channel) { UpdateIfNeeded(); var cs = _channelArray[(int)channel]; var numbers = new int[cs._knobMap.Count]; cs._knobMap.Keys.CopyTo(numbers, 0); return numbers; }
public float GetKey(MidiChannel channel, int noteNumber) { UpdateIfNeeded(); var v = _channelArray[(int)channel]._noteArray[noteNumber]; if (v > 1) return v - 1; if (v > 0) return v; return 0.0f; }
// Returns the key state (on: velocity, off: zero). public static float GetKey (MidiChannel channel, int noteNumber) { var v = instance.channelArray [(int)channel].noteArray [noteNumber]; if (v > 1.0f) { return v - 1.0f; } else if (v > 0.0) { return v; } else { return 0.0f; } }
public bool GetKeyUp(MidiChannel channel, int noteNumber) { UpdateIfNeeded(); return(_channelArray[(int)channel]._noteArray[noteNumber] < 0); }
public static void SendNoteOff(uint deviceID, MidiChannel channel, int noteNumber, float velocity) { MidiDriver.Instance.SendNoteOff(deviceID, channel, noteNumber, velocity); }
// Returns the CC (knob) value. public static float GetKnob(MidiChannel channel, int knobNumber, float defaultValue = 0) { return(MidiDriver.Instance.GetKnob(channel, knobNumber, defaultValue)); }
// Returns true if the key was released in the current frame. public static bool GetKeyUp(MidiChannel channel, int noteNumber) { return(MidiDriver.Instance.GetKeyUp(channel, noteNumber)); }
void MidiKeyPress(MidiChannel channel, int note, float velocity) { timer = Time.time + timeUntilFadeIn; }
// Returns true if the key was released in the current frame. public static bool GetKeyUp(MidiChannel channel, int noteNumber) { return(instance.channelArray [(int)channel].noteArray [noteNumber] < 0.0f); }
// Returns the CC (knob) value. public static float GetKnob(MidiChannel channel, int knobNumber, float defaultValue = 0) { return MidiDriver.Instance.GetKnob(channel, knobNumber, defaultValue); }
void Knob(MidiChannel channel, int knobNumber, float knobValue) { Debug.Log("Knob: " + knobNumber + "," + knobValue); }
void NoteOff(MidiChannel channel, int note) { Debug.Log("NoteOff: " + channel + "," + note); }
// Returns true if the key was released in the current frame. public static bool GetKeyUp (MidiChannel channel, int noteNumber) { return instance.channelArray [(int)channel].noteArray [noteNumber] < 0.0f; }
// Get the CC (knob) value. public static float GetKnob (MidiChannel channel, int knobNumber, float defaultValue = 0.0f) { var cs = instance.channelArray [(int)channel]; if (cs.knobMap.ContainsKey (knobNumber)) { return cs.knobMap [knobNumber]; } else { return defaultValue; } }
void OnKnobUpdate(MidiChannel channel, int knobNumber, float knobValue) { // Do nothing if the setting doesn't match. if (_channel != MidiChannel.All && channel != _channel) return; if (_knobNumber != knobNumber) return; // Do the actual process. DoKnobUpdate(knobValue); }
void NoteOn(MidiChannel channel, int note, float velocity) { Debug.Log("NoteOn: " + channel + "," + note + "," + velocity); }
public static bool IsNotePitchGiven(MidiChannel channel) { var cs = instance.channelArray [(int)channel]; return cs.lastNote >= 0.0f; }
bool FilterNote(MidiChannel channel, int note) { if (_channel != MidiChannel.All && channel != _channel) return false; if (_noteFilter == NoteFilter.Off) return true; if (_noteFilter == NoteFilter.NoteName) return CompareNoteToName(note, _noteName); else // NoteFilter.Number return _lowestNote <= note && note <= _highestNote; }
private void OnNoteOff(MidiChannel channel, int note) { Log("[NoteOff] channel: " + channel.ToString() + " note: " + note); CheckNoteRange(note); luxKeys.OnKeyReleased(note); }
public static void SendNoteOff(MidiChannel channel, int noteNumber) { int cn = Mathf.Clamp ((int)channel, 0, 15); noteNumber = Mathf.Clamp (noteNumber, 0, 127); MidiBridge.instance.Send (0x80 + cn, noteNumber, 0); }
// Get the CC (knob) value. public static float GetKnob (MidiChannel channel, int knobNumber) { var cs = instance.channelArray [(int)channel]; if (cs.knobMap.ContainsKey (knobNumber)) { return cs.knobMap [knobNumber].filteredValue; } else { return 0.0f; } }
// Returns the key state (on: velocity, off: zero). public static float GetKey(MidiChannel channel, int noteNumber) { return MidiDriver.Instance.GetKey(channel, noteNumber); }
void PolyAfterTouch(MidiChannel channel, int note, float pressure) { Debug.Log("PolyAfterTouch: " + channel + "," + note + "," + pressure); }
public void SendSignal(int ccNumber, MidiChannel channel, float value) { signalValue = value; _SendSignal(channel, ccNumber, value); }
void ChannelAfterTouch(MidiChannel channel, float pressure) { Debug.Log("ChannelAfterTouch: " + channel + "," + pressure); }
void NoteOff(MidiChannel channel, int note) { // Debug.Log("NoteOff: " + channel + "," + note); }
void Bend(MidiChannel channel, float bend) { Debug.Log("Bend: " + bend); }
void MidiKeyOff(MidiChannel channel, int note) { //audioSource[note].Stop(); }
public void InjectNotePressure(int noteNumber, int value, MidiChannel channel = MidiChannel.Omni) { DelegateToListeners(l => l.HandleNotePressure(noteNumber, value, channel), channel); }
public bool GetKeyUp(MidiChannel channel, int noteNumber) { MidiDriver.Refresh(); return(_channelArray[(int)channel]._noteArray[noteNumber] < 0); }
public void InjectNoteOff(int noteNumber, int velocity, MidiChannel channel = MidiChannel.Omni) { DelegateToListeners(l => l.HandleNoteOff(noteNumber, velocity, channel), channel); }
// Returns the key state (on: velocity, off: zero). public static float GetKey(MidiChannel channel, int noteNumber) { return(MidiDriver.Instance.GetKey(channel, noteNumber)); }
public void InjectPitchWheel(int value, MidiChannel channel = MidiChannel.Omni) { DelegateToListeners(l => l.HandlePitchWheel(value, channel), channel); }
// Provides the CC (knob) list. public static int[] GetKnobNumbers(MidiChannel channel) { return(MidiDriver.Instance.GetKnobNumbers(channel)); }
public void InjectChannelPressure(int value, MidiChannel channel = MidiChannel.Omni) { DelegateToListeners(l => l.HandleChannelPressure(value, channel), channel); }
void onNoteUp(MidiChannel channel, int note) { PianoUI.instance.unpressKey(note); }
public void InjectControlChange(int controllerNumber, int value, MidiChannel channel = MidiChannel.Omni) { DelegateToListeners(l => l.HandleControlChange(controllerNumber, value, channel), channel); }
public static float GetNotePitch(MidiChannel channel) { var cs = instance.channelArray [(int)channel]; if( cs.lastNote < 0.0f ) { return 0.0f; } else { return ( cs.lastNote * 1.0f / 127.0f ); } }
public void InjectAllNotesOff(MidiChannel channel = MidiChannel.Omni) { DelegateToListeners(l => l.HandleAllNotesOff(channel), channel); }
// Get the CC (knob) value. public static bool DoesKnobExist(MidiChannel channel, int knobNumber) { var cs = instance.channelArray [(int)channel]; return (cs.knobMap.ContainsKey (knobNumber)); }
public void InjectResetControllers(MidiChannel channel = MidiChannel.Omni) { DelegateToListeners(l => l.HandleResetControllers(channel), channel); }
public bool GetKeyUp(MidiChannel channel, int noteNumber) { UpdateIfNeeded(); return _channelArray[(int)channel]._noteArray[noteNumber] < 0; }
private void HandleMidiMessageReceived(object sender, MidiInMessageEventArgs e) { MidiIn source = sender as MidiIn; if (source == null) { return; } if (e.MidiEvent == null) { return; } MidiChannel channel = (MidiChannel)e.MidiEvent.Channel; MidiCommandCode commandCode = e.MidiEvent.CommandCode; if (e.MidiEvent.CommandCode == MidiCommandCode.NoteOn && (e.MidiEvent as NoteEvent).Velocity == 0) { commandCode = MidiCommandCode.NoteOff; } if (commandCode == MidiCommandCode.NoteOff) { int noteNumber = (e.MidiEvent as NoteEvent).NoteNumber; int velocity = (e.MidiEvent as NoteEvent).Velocity; DelegateToListeners(listener => listener.HandleNoteOff(noteNumber, velocity, channel), channel); } else if (commandCode == MidiCommandCode.NoteOn) { int noteNumber = (e.MidiEvent as NoteEvent).NoteNumber; int velocity = (e.MidiEvent as NoteEvent).Velocity; DelegateToListeners(listener => listener.HandleNoteOn(noteNumber, velocity, channel), channel); } else if (commandCode == MidiCommandCode.KeyAfterTouch) { int noteNumber = (e.MidiEvent as NoteEvent).NoteNumber; int velocity = (e.MidiEvent as NoteEvent).Velocity; DelegateToListeners(listener => listener.HandleNotePressure(noteNumber, velocity, channel), channel); } else if (commandCode == MidiCommandCode.ControlChange) { MidiController controller = (e.MidiEvent as ControlChangeEvent).Controller; if (controller == MidiController.AllNotesOff) { DelegateToListeners(listener => listener.HandleAllNotesOff(channel), channel); } else if (controller == MidiController.ResetAllControllers) { DelegateToListeners(listener => listener.HandleResetControllers(channel), channel); } else { int controllerNumber = (int)controller; int value = (e.MidiEvent as ControlChangeEvent).ControllerValue; DelegateToListeners(listener => listener.HandleControlChange(controllerNumber, value, channel), channel); } } else if (commandCode == MidiCommandCode.ChannelAfterTouch) { int value = (e.MidiEvent as ChannelAfterTouchEvent).AfterTouchPressure; DelegateToListeners(listener => listener.HandleChannelPressure(value, channel), channel); } else if (commandCode == MidiCommandCode.PitchWheelChange) { int value = (e.MidiEvent as PitchWheelChangeEvent).Pitch; DelegateToListeners(listener => listener.HandlePitchWheel(value, channel), channel); } }
public float GetKnob(MidiChannel channel, int knobNumber, float defaultValue) { UpdateIfNeeded(); var cs = _channelArray[(int)channel]; if (cs._knobMap.ContainsKey(knobNumber)) return cs._knobMap[knobNumber]; return defaultValue; }
public MidiData(short[] tempo) { Tempo = tempo; for (int i = 0; i < Channels.Length; i++) { Channels[i] = new MidiChannel((byte)i); } }
// Returns the pitchbend value. public static float GetPitchBend(MidiChannel channel) { return(MidiDriver.Instance.GetPitchBend(channel)); }
public void Send(MidiChannel mc) { mc.SysExCustomInstrument(AdlibMidiDriver.ToType("SPK "), _instrument); }
// Provides the CC (knob) list. public static int[] GetKnobNumbers (MidiChannel channel) { var cs = instance.channelArray [(int)channel]; var numbers = new int[cs.knobMap.Count]; cs.knobMap.Keys.CopyTo (numbers, 0); return numbers; }
void KnobDelegate(MidiChannel channel, int knobnumber, float knobvalue) { var publishEvent = true; switch (knobnumber) { case 0x0D: m_State.SendA1 = knobvalue; break; case 0x0E: m_State.SendA2 = knobvalue; break; case 0x0F: m_State.SendA3 = knobvalue; break; case 0x10: m_State.SendA4 = knobvalue; break; case 0x11: m_State.SendA5 = knobvalue; break; case 0x12: m_State.SendA6 = knobvalue; break; case 0x13: m_State.SendA7 = knobvalue; break; case 0x14: m_State.SendA8 = knobvalue; break; case 0x1D: m_State.SendB1 = knobvalue; break; case 0x1E: m_State.SendB2 = knobvalue; break; case 0x1F: m_State.SendB3 = knobvalue; break; case 0x20: m_State.SendB4 = knobvalue; break; case 0x21: m_State.SendB5 = knobvalue; break; case 0x22: m_State.SendB6 = knobvalue; break; case 0x23: m_State.SendB7 = knobvalue; break; case 0x24: m_State.SendB8 = knobvalue; break; case 0x31: m_State.PanDevice1 = knobvalue; break; case 0x32: m_State.PanDevice2 = knobvalue; break; case 0x33: m_State.PanDevice3 = knobvalue; break; case 0x34: m_State.PanDevice4 = knobvalue; break; case 0x35: m_State.PanDevice5 = knobvalue; break; case 0x36: m_State.PanDevice6 = knobvalue; break; case 0x37: m_State.PanDevice7 = knobvalue; break; case 0x38: m_State.PanDevice8 = knobvalue; break; case 0x4D: m_State.Slider1 = knobvalue; break; case 0x4E: m_State.Slider2 = knobvalue; break; case 0x4F: m_State.Slider3 = knobvalue; break; case 0x50: m_State.Slider4 = knobvalue; break; case 0x51: m_State.Slider5 = knobvalue; break; case 0x52: m_State.Slider6 = knobvalue; break; case 0x53: m_State.Slider7 = knobvalue; break; case 0x54: m_State.Slider8 = knobvalue; break; default: publishEvent = false; break; } if (publishEvent) { InputSystem.QueueStateEvent(this, m_State); } }
// Returns true if the key was released in the current frame. public static bool GetKeyUp(MidiChannel channel, int noteNumber) { return MidiDriver.Instance.GetKeyUp(channel, noteNumber); }
void NoteOn(MidiChannel channel, int note, float velocity) { MidiNotes _note = (MidiNotes)note; switch (_note) { case MidiNotes.rayMarchNote: sceneController.EaseRaymarchObject(velocity); break; case MidiNotes.randomJump: sceneController.JumpCamera(); break; case MidiNotes.isolineToggle: sceneController.ToggleIsoline(); break; case MidiNotes.skyboxToggle: sceneController.ToggleSkyBox(); break; case MidiNotes.bpmTap: sceneController.SetBpm(); break; case MidiNotes.toggleCameraMove: sceneController.ToggleCameraMove(); break; case MidiNotes.toggleRadialMesh: sceneController.ToggleRadialMesh(); break; case MidiNotes.toggleTwist: sceneController.ToggleTwist(); break; case MidiNotes.toggleRandomSubdivisions: sceneController.ToggleRandomSubdivisions(); break; case MidiNotes.toggleVeda: sceneController.ToggleVeda(); break; case MidiNotes.toggleWaveStick: sceneController.ToggleWaveStick(); break; case MidiNotes.toggleBend: sceneController.ToggleBend(); break; case MidiNotes.toggleWorld: sceneController.ToggleWorldMarch(); break; case MidiNotes.toggleObject: sceneController.ToggleObjectMarch(); break; case MidiNotes.newColors: sceneController.NewColors(); break; case MidiNotes.toggleParticles: sceneController.ToggleParticles(); break; } }
// Provides the CC (knob) list. public static int[] GetKnobNumbers(MidiChannel channel) { return MidiDriver.Instance.GetKnobNumbers(channel); }
void NoteOn(MidiChannel channel, int note, float velocity) { // Debug.Log("NoteOn: " + channel + "," + note + "," + velocity); }
void _SendSignal(MidiChannel channel, int ccNumber, float value) { if(value != lastval) MidiOut.SendControlChange (channel, ccNumber, value); lastval = value; }
void NoteOn(MidiChannel channel, int note, float velocity) { if (!FilterNote(channel, note)) return; velocity = _velocityCurve.Evaluate(velocity); _noteOnEvent.Invoke(); _noteOnVelocityEvent.Invoke(velocity); _floatValue.targetValue = _onValue * velocity; }