functionnable midi proto
This commit is contained in:
parent
98d5e494b7
commit
931626c47d
4 changed files with 208 additions and 16 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -2,4 +2,4 @@
|
|||
.godot/
|
||||
|
||||
*.tmp
|
||||
*.exe
|
||||
exports
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -8,7 +8,7 @@ custom_features=""
|
|||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="./caneen.exe"
|
||||
export_path="exports/caneen.exe"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
|
|
@ -60,3 +60,148 @@ Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorActi
|
|||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="macOS"
|
||||
platform="macOS"
|
||||
runnable=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="exports/caneen.zip"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
export/distribution_type=1
|
||||
binary_format/architecture="universal"
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=1
|
||||
application/icon=""
|
||||
application/icon_interpolation=4
|
||||
application/bundle_identifier="eu.oniricorpe.caneen"
|
||||
application/signature=""
|
||||
application/app_category="Utilities"
|
||||
application/short_version=""
|
||||
application/version=""
|
||||
application/copyright=""
|
||||
application/copyright_localized={}
|
||||
application/min_macos_version="10.12"
|
||||
application/export_angle=0
|
||||
display/high_res=true
|
||||
xcode/platform_build="14C18"
|
||||
xcode/sdk_version="13.1"
|
||||
xcode/sdk_build="22C55"
|
||||
xcode/sdk_name="macosx13.1"
|
||||
xcode/xcode_version="1420"
|
||||
xcode/xcode_build="14C18"
|
||||
codesign/codesign=1
|
||||
codesign/installer_identity=""
|
||||
codesign/apple_team_id=""
|
||||
codesign/identity=""
|
||||
codesign/entitlements/custom_file=""
|
||||
codesign/entitlements/allow_jit_code_execution=false
|
||||
codesign/entitlements/allow_unsigned_executable_memory=false
|
||||
codesign/entitlements/allow_dyld_environment_variables=false
|
||||
codesign/entitlements/disable_library_validation=false
|
||||
codesign/entitlements/audio_input=false
|
||||
codesign/entitlements/camera=false
|
||||
codesign/entitlements/location=false
|
||||
codesign/entitlements/address_book=false
|
||||
codesign/entitlements/calendars=false
|
||||
codesign/entitlements/photos_library=false
|
||||
codesign/entitlements/apple_events=false
|
||||
codesign/entitlements/debugging=false
|
||||
codesign/entitlements/app_sandbox/enabled=false
|
||||
codesign/entitlements/app_sandbox/network_server=false
|
||||
codesign/entitlements/app_sandbox/network_client=false
|
||||
codesign/entitlements/app_sandbox/device_usb=false
|
||||
codesign/entitlements/app_sandbox/device_bluetooth=false
|
||||
codesign/entitlements/app_sandbox/files_downloads=0
|
||||
codesign/entitlements/app_sandbox/files_pictures=0
|
||||
codesign/entitlements/app_sandbox/files_music=0
|
||||
codesign/entitlements/app_sandbox/files_movies=0
|
||||
codesign/entitlements/app_sandbox/files_user_selected=0
|
||||
codesign/entitlements/app_sandbox/helper_executables=[]
|
||||
codesign/custom_options=PackedStringArray()
|
||||
notarization/notarization=0
|
||||
privacy/microphone_usage_description=""
|
||||
privacy/microphone_usage_description_localized={}
|
||||
privacy/camera_usage_description=""
|
||||
privacy/camera_usage_description_localized={}
|
||||
privacy/location_usage_description=""
|
||||
privacy/location_usage_description_localized={}
|
||||
privacy/address_book_usage_description=""
|
||||
privacy/address_book_usage_description_localized={}
|
||||
privacy/calendar_usage_description=""
|
||||
privacy/calendar_usage_description_localized={}
|
||||
privacy/photos_library_usage_description=""
|
||||
privacy/photos_library_usage_description_localized={}
|
||||
privacy/desktop_folder_usage_description=""
|
||||
privacy/desktop_folder_usage_description_localized={}
|
||||
privacy/documents_folder_usage_description=""
|
||||
privacy/documents_folder_usage_description_localized={}
|
||||
privacy/downloads_folder_usage_description=""
|
||||
privacy/downloads_folder_usage_description_localized={}
|
||||
privacy/network_volumes_usage_description=""
|
||||
privacy/network_volumes_usage_description_localized={}
|
||||
privacy/removable_volumes_usage_description=""
|
||||
privacy/removable_volumes_usage_description_localized={}
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||
open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}"
|
||||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name}.app/Contents/MacOS/{exe_name} {cmd_args}\")
|
||||
rm -rf \"{temp_dir}\""
|
||||
|
||||
[preset.2]
|
||||
|
||||
name="Linux/X11"
|
||||
platform="Linux/X11"
|
||||
runnable=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="exports/caneen.x86_64"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
|
||||
[preset.2.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=1
|
||||
binary_format/embed_pck=true
|
||||
texture_format/bptc=true
|
||||
texture_format/s3tc=true
|
||||
texture_format/etc=false
|
||||
texture_format/etc2=false
|
||||
binary_format/architecture="x86_64"
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||
export DISPLAY=:0
|
||||
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
||||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||
rm -rf \"{temp_dir}\""
|
||||
|
|
|
|||
75
node_2d.tscn
75
node_2d.tscn
|
|
@ -9,6 +9,12 @@ 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():
|
||||
|
|
@ -16,25 +22,66 @@ func _ready():
|
|||
print(OS.get_connected_midi_inputs())
|
||||
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventKey:
|
||||
if event.keycode == KEY_ESCAPE:
|
||||
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):
|
||||
|
||||
# process inputs
|
||||
if Input.is_action_pressed(\"quit\"):
|
||||
# exit the software
|
||||
get_tree().quit()
|
||||
if Input.is_action_pressed(\"left\") or MIDIMessage.MIDI_MESSAGE_CONTROL_CHANGE == 1:
|
||||
# trigger the left controller
|
||||
print(\"left\")
|
||||
if Input.is_action_pressed(\"right\") or MIDIMessage.MIDI_MESSAGE_CONTROL_CHANGE == 1:
|
||||
# trigger the right controller
|
||||
print(\"right\")
|
||||
|
||||
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"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue