[gd_scene load_steps=4 format=3 uid="uid://chynesmvg3dl5"] [ext_resource type="Texture2D" uid="uid://pa6jmogeid3x" path="res://art/turn.PNG" id="1_58q2i"] [ext_resource type="Texture2D" uid="uid://f8ibqo4nbqqk" path="res://art/bark.PNG" id="3_grsrk"] [sub_resource type="GDScript" id="GDScript_grk35"] script/source = "extends Node2D # https://docs.godotengine.org/en/stable/classes/class_inputeventmidi.html # https://docs.godotengine.org/en/stable/classes/class_%40globalscope.html#enum-globalscope-midimessage var midi_beat: bool = false var midi_jog: bool = false var midi_turnleft: bool = false var midi_turnright: bool = false var debug := false # Called when the node enters the scene tree for the first time. func _ready(): OS.open_midi_inputs() print(OS.get_connected_midi_inputs()) func _unhandled_input(input_event): if input_event is InputEventKey: if input_event.keycode == KEY_ESCAPE: get_tree().quit() if input_event is InputEventMIDI: if debug: _print_midi_info(input_event) if input_event.channel == 2 and input_event.message == 9: pass func _input(input_event): if input_event is InputEventMIDI: if input_event.channel == 2 and (input_event.message == 9 or input_event.message == 11): midi_beat = true if input_event.channel == 1 and (input_event.message == 9 or input_event.message == 11): midi_jog = true if input_event.channel == 1 and input_event.controller_value == 127: midi_turnleft = true if input_event.channel == 1 and input_event.controller_value == 1: midi_turnright = true func _print_midi_info(midi_event: InputEventMIDI): print(midi_event) print(\"Channel \" + str(midi_event.channel)) print(\"Message \" + str(midi_event.message)) print(\"Pitch \" + str(midi_event.pitch)) print(\"Velocity \" + str(midi_event.velocity)) print(\"Instrument \" + str(midi_event.instrument)) print(\"Pressure \" + str(midi_event.pressure)) print(\"Controller number: \" + str(midi_event.controller_number)) print(\"Controller value: \" + str(midi_event.controller_value)) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(_delta): if !debug: # process inputs if Input.is_action_pressed(\"quit\"): # exit the software get_tree().quit() if Input.is_action_pressed(\"left\") or midi_beat: # trigger the left controller print(\"left\") if Input.is_action_pressed(\"right\") or midi_jog: # trigger the right controller print(\"right\") if midi_turnleft: # trigger the left controller print(\"turn left\") if midi_turnright: # trigger the right controller print(\"turn right\") # reset inputs midi_beat = false midi_jog = false midi_turnleft= false midi_turnright = false " [node name="Node2D" type="Node2D"] script = SubResource("GDScript_grk35") [node name="left_turn" type="Sprite2D" parent="."] position = Vector2(270, 284) scale = Vector2(0.22, 0.22) texture = ExtResource("1_58q2i") [node name="right_turn" type="Sprite2D" parent="."] position = Vector2(1625, 269) scale = Vector2(0.22, 0.22) texture = ExtResource("1_58q2i") script = SubResource("GDScript_grk35") [node name="left_bark" type="Sprite2D" parent="."] position = Vector2(137, 307) rotation = -1.29154 scale = Vector2(0.5, 0.5) texture = ExtResource("3_grsrk") [node name="right_bark" type="Sprite2D" parent="."] position = Vector2(1688, 342) rotation = 4.43314 scale = Vector2(0.5, 0.5) texture = ExtResource("3_grsrk") flip_v = true