Replace XML codeblock spaces with tabs
This commit is contained in:
@@ -10,50 +10,50 @@
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
func _ready():
|
||||
OS.open_midi_inputs()
|
||||
print(OS.get_connected_midi_inputs())
|
||||
OS.open_midi_inputs()
|
||||
print(OS.get_connected_midi_inputs())
|
||||
|
||||
func _input(input_event):
|
||||
if input_event is InputEventMIDI:
|
||||
_print_midi_info(input_event)
|
||||
if input_event is InputEventMIDI:
|
||||
_print_midi_info(input_event)
|
||||
|
||||
func _print_midi_info(midi_event):
|
||||
print(midi_event)
|
||||
print("Channel ", midi_event.channel)
|
||||
print("Message ", midi_event.message)
|
||||
print("Pitch ", midi_event.pitch)
|
||||
print("Velocity ", midi_event.velocity)
|
||||
print("Instrument ", midi_event.instrument)
|
||||
print("Pressure ", midi_event.pressure)
|
||||
print("Controller number: ", midi_event.controller_number)
|
||||
print("Controller value: ", midi_event.controller_value)
|
||||
print(midi_event)
|
||||
print("Channel ", midi_event.channel)
|
||||
print("Message ", midi_event.message)
|
||||
print("Pitch ", midi_event.pitch)
|
||||
print("Velocity ", midi_event.velocity)
|
||||
print("Instrument ", midi_event.instrument)
|
||||
print("Pressure ", midi_event.pressure)
|
||||
print("Controller number: ", midi_event.controller_number)
|
||||
print("Controller value: ", midi_event.controller_value)
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
public override void _Ready()
|
||||
{
|
||||
OS.OpenMidiInputs();
|
||||
GD.Print(OS.GetConnectedMidiInputs());
|
||||
OS.OpenMidiInputs();
|
||||
GD.Print(OS.GetConnectedMidiInputs());
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent inputEvent)
|
||||
{
|
||||
if (inputEvent is InputEventMidi midiEvent)
|
||||
{
|
||||
PrintMIDIInfo(midiEvent);
|
||||
}
|
||||
if (inputEvent is InputEventMidi midiEvent)
|
||||
{
|
||||
PrintMIDIInfo(midiEvent);
|
||||
}
|
||||
}
|
||||
|
||||
private void PrintMIDIInfo(InputEventMidi midiEvent)
|
||||
{
|
||||
GD.Print(midiEvent);
|
||||
GD.Print($"Channel {midiEvent.Channel}");
|
||||
GD.Print($"Message {midiEvent.Message}");
|
||||
GD.Print($"Pitch {midiEvent.Pitch}");
|
||||
GD.Print($"Velocity {midiEvent.Velocity}");
|
||||
GD.Print($"Instrument {midiEvent.Instrument}");
|
||||
GD.Print($"Pressure {midiEvent.Pressure}");
|
||||
GD.Print($"Controller number: {midiEvent.ControllerNumber}");
|
||||
GD.Print($"Controller value: {midiEvent.ControllerValue}");
|
||||
GD.Print(midiEvent);
|
||||
GD.Print($"Channel {midiEvent.Channel}");
|
||||
GD.Print($"Message {midiEvent.Message}");
|
||||
GD.Print($"Pitch {midiEvent.Pitch}");
|
||||
GD.Print($"Velocity {midiEvent.Velocity}");
|
||||
GD.Print($"Instrument {midiEvent.Instrument}");
|
||||
GD.Print($"Pressure {midiEvent.Pressure}");
|
||||
GD.Print($"Controller number: {midiEvent.ControllerNumber}");
|
||||
GD.Print($"Controller value: {midiEvent.ControllerValue}");
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@@ -96,9 +96,9 @@
|
||||
[b]Note:[/b] Some MIDI devices may send a [constant MIDI_MESSAGE_NOTE_ON] message with [code]0[/code] velocity and expect it to be treated the same as a [constant MIDI_MESSAGE_NOTE_OFF] message. If necessary, this can be handled with a few lines of code:
|
||||
[codeblock]
|
||||
func _input(event):
|
||||
if event is InputEventMIDI:
|
||||
if event.message == MIDI_MESSAGE_NOTE_ON and event.velocity > 0:
|
||||
print("Note pressed!")
|
||||
if event is InputEventMIDI:
|
||||
if event.message == MIDI_MESSAGE_NOTE_ON and event.velocity > 0:
|
||||
print("Note pressed!")
|
||||
[/codeblock]
|
||||
</member>
|
||||
</members>
|
||||
|
||||
Reference in New Issue
Block a user