Skip to content

Commit

Permalink
moving root_dir() def before import midi
Browse files Browse the repository at this point in the history
  • Loading branch information
bwhitman committed Jun 17, 2024
1 parent bfd749f commit b138d88
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tulip/shared/py/midi.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,16 @@ def arp_rng_next():
BUTTON_IDS = [96, 97, 98, 99, 100, 101, 102, 103, 104, 113, 114, 115, 116, 117, 118]

try:
import json
midi_cc_file = tulip.root_dir() + 'user/midi_cc_file.json'
data = json.loads(open(midi_cc_file, 'rt').read())
SLIDER_IDS = data['sliders']
KNOB_IDS = data['knobs']
BUTTON_IDS = data['buttons']
print('MIDI CC mappings read from', midi_cc_file)
except:
#print('MIDI CC mappings read from', midi_cc_file)
except Exception as e:
#import sys
#sys.print_exception(e)
pass

PITCH_WHEEL = 0 # Pitch wheel is a special case, hard-coded in juno.py.
Expand Down
9 changes: 9 additions & 0 deletions tulip/shared/py/tulip.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
import world
from upysh import cd, pwd
import amy

def root_dir():
try:
import uos
return uos.getenv("HOME")+"/Documents/tulipcc/"
except:
return "/"


import midi

from midi import music_map
Expand Down

0 comments on commit b138d88

Please sign in to comment.