Skip to content

Commit

Permalink
Added config reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-glb committed Oct 4, 2021
1 parent c2ef374 commit 29552ba
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 28 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ Use [configs/MacroButtons-Midi-keybow.xml](configs/MacroButtons-Midi-keybow.xml)

### Key mapping:

┌─┬────────────┬─┬───────────┬──┬────────────────┬──┬──────────────┐
│3│Google Meet │7│Previous │11│Next │15│Play/Pause │
│ │Mute Toggle │ │ │ │ │ │ │
├─┼────────────┼─┼───────────┼──┼────────────────┼──┼──────────────┤
│2│Teams │6│MIDI Cable │10│MIDI Headphones │14│Speakers │
│ │Mute Toggle │ │Volume Up │ │Volume Up │ │Volume Up │
├─┼────────────┼─┼───────────┼──┼────────────────┼──┼──────────────┤
│1│ │5│MIDI Cable │ 9│MIDI Headphones │13│Speakers │
│ | │ │Volume Down │ │Volume Down │ │Volume Down │
├─┼────────────┼─┼───────────┼──┼────────────────┼──┼──────────────┤
│0│MIDI Mic │4│MIDI Cable │ 8│MIDI Headphones │12│Speakers │
│ │Mute Toggle │ │Mute Toggle │ │Mute Toggle │ │Mute Toggle
└─┴────────────┴─┴───────────┴──┴────────────────┴──┴──────────────┘
┌─┬────────────┬─┬───────────┬──┬────────────────┬──┬──────────────┐
│3│Google Meet │7│Previous │11│Next │15│Play/Pause │
│ │Mute │ │ │ │ │ │ │
├─┼────────────┼─┼───────────┼──┼────────────────┼──┼──────────────┤
│2│Teams │6│MIDI Cable │10│MIDI Headphones │14│Speakers │
│ │Mute │ │Volume Up │ │Volume Up │ │Volume Up │
├─┼────────────┼─┼───────────┼──┼────────────────┼──┼──────────────┤
│1│Reset Voice │5│MIDI Cable │ 9│MIDI Headphones │13│Speakers │
│ |Meeter conf │ │Volume Down│ │Volume Down │ │Volume Down │
├─┼────────────┼─┼───────────┼──┼────────────────┼──┼──────────────┤
│0│MIDI Mic │4│MIDI Cable │ 8│MIDI Headphones │12│Speakers │
│ │Mute │ │Mute │ │Mute │ │Mute
└─┴────────────┴─┴───────────┴──┴────────────────┴──┴──────────────┘
59 changes: 45 additions & 14 deletions code.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@
│2│Teams │6│MIDI Cable │10│MIDI Headphones │14│Speakers │
│ │Mute │ │Volume Up │ │Volume Up │ │Volume Up │
├─┼────────────┼─┼───────────┼──┼────────────────┼──┼──────────────┤
│1│ │5│MIDI Cable │ 9│MIDI Headphones │13│Speakers │
│ | │ │Volume Down│ │Volume Down │ │Volume Down │
│1│Reset Voice │5│MIDI Cable │ 9│MIDI Headphones │13│Speakers │
│ |Meeter conf │ │Volume Down│ │Volume Down │ │Volume Down │
├─┼────────────┼─┼───────────┼──┼────────────────┼──┼──────────────┤
│0│MIDI Mic │4│MIDI Cable │ 8│MIDI Headphones │12│Speakers │
│ │Mute │ │Mute │ │Mute │ │Mute │
└─┴────────────┴─┴───────────┴──┴────────────────┴──┴──────────────┘
""")

# Keys categories
blank = [1]
blank = []
reset = [1]
mic = [0]
teams = [2]
meet = [3]
Expand All @@ -67,9 +68,10 @@
control = [7,11]
playpause = [15]


# Sleep mode for keys
keybow.led_sleep_enabled = True
keybow.led_sleep_time = 600
keybow.led_sleep_time = 900

# Colors
black = (0,0,0)
Expand All @@ -85,15 +87,18 @@
green = (0,255,0)
weak_purple = (42,0,42)
purple = (128,0,128)
weak_yellow = (128,128,0)
yellow = (255,255,0)



#mic_muted = True
#cable_muted = False
#speakers_muted = False
#headphones_muted = True

# mute led status when starting (need to config things accordingly...)
mic_muted = True
cable_muted = False
speakers_muted = False
headphones_muted = True

# bolean to get the mic key blinking when mic is unmuted
mic_blink = False
#mic_blink = False

# Function for send Midi keypress
def midi_send(key):
Expand All @@ -103,6 +108,22 @@ def midi_send(key):
midi.send(NoteOn(note, velocity))
midi.send(NoteOff(note, 0))

def reset_config():
# mute led status when starting (need to config things accordingly...)
global mic_muted
global cable_muted
global speakers_muted
global headphones_muted
# bolean to get the mic key blinking when mic is unmuted
global mic_blink
# Values at boot time
mic_muted = True
cable_muted = False
speakers_muted = False
headphones_muted = True
mic_blink = False
# Reset Voice Meeter config
midi_send(1)

# Small animation when starting
keybow.set_all(*black)
Expand All @@ -112,6 +133,8 @@ def midi_send(key):
for key in keys:
key.set_led(*white)

reset_config()

while True:
keybow.update()

Expand All @@ -135,6 +158,9 @@ def midi_send(key):
for i in playpause:
keybow.keys[i].set_led(*weak_green)

for i in reset:
keybow.keys[i].set_led(*weak_yellow)

for i in mic:
if mic_muted:
keybow.keys[i].set_led(*weak_red)
Expand Down Expand Up @@ -171,8 +197,13 @@ def midi_send(key):
time.sleep(0.2)
mic_muted = not mic_muted

elif keys[1].pressed:
pass
elif keys[1].held:
print('Reset Voice Meeter Banana Config key pressed')
keybow.keys[1].set_led(*yellow)
midi_send(1)
reset_config()
time.sleep(0.5)
keyboard.release_all()

elif keys[2].pressed:
print('Teams Mute key pressed')
Expand Down Expand Up @@ -264,4 +295,4 @@ def midi_send(key):
keybow.keys[15].set_led(*green)
consumer.send(ConsumerControlCode.PLAY_PAUSE)
keyboard.release_all()
time.sleep(0.1)
time.sleep(0.1)
31 changes: 30 additions & 1 deletion configs/MacroButtons-Midi-keybow.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<VBAudioVoicemeeterMacroButtonMap>
<MacroButtonConfiguration x0='300' y0='756' dx='320' dy='305' />
<MacroButtonConfiguration x0='-1520' y0='784' dx='528' dy='305' />
<MacroButton index='1' type='0' color='0' key='0' ctrl='0' shift='0' alt='0' anyway='0' exclusive='0' trigger='0' xinput='0'>
<MB_MIDI b1='90' b2='2A' b3='7F' b4='00' b5='00' b6='00' />
<MB_TRIGGER tchannel='0' tin='0.0' tout='0.0' tmsHold='100' tafterMute='0' />
Expand All @@ -21,6 +21,35 @@
<MB_OnRequest>Bus(1).gain+=4.0;</MB_OnRequest>
<MB_OffRequest></MB_OffRequest>
</MacroButton>
<MacroButton index='3' type='0' color='0' key='0' ctrl='0' shift='0' alt='0' anyway='0' exclusive='0' trigger='0' xinput='0'>
<MB_MIDI b1='90' b2='25' b3='7F' b4='00' b5='00' b6='00' />
<MB_TRIGGER tchannel='0' tin='-20.0' tout='-20.0' tmsHold='1000' tafterMute='0' />
<MB_XINPUT nctrl='0' nbutton='0' />
<MB_Name>reset config</MB_Name>
<MB_Subname></MB_Subname>
<MB_InitRequest></MB_InitRequest>
<MB_OnRequest>Strip(0).Mute=1;
Strip(0).Gain=0;
Strip(1).Mute=1;
Strip(1).Gain=-60;
Strip(2).Mute=0;
Strip(2).Gain=-20;
Strip(3).Mute=0;
Strip(3).Gain=0;
Strip(4).Mute=0;
Strip(4).Gain=0;
Bus[0].Mute=0;
Bus[0].Gain=-8;
Bus[1].Mute=1;
Bus[1].Gain=0;
Bus[2].Mute=1;
Bus[2].Gain=0;
Bus[3].Mute=0;
Bus[3].Gain=0;
Bus[4].Mute=1;
Bus[4].Gain=0;</MB_OnRequest>
<MB_OffRequest></MB_OffRequest>
</MacroButton>
<MacroButton index='11' type='0' color='0' key='0' ctrl='0' shift='0' alt='0' anyway='0' exclusive='0' trigger='0' xinput='0'>
<MB_MIDI b1='90' b2='29' b3='7F' b4='00' b5='00' b6='00' />
<MB_TRIGGER tchannel='0' tin='0.0' tout='0.0' tmsHold='100' tafterMute='0' />
Expand Down

0 comments on commit 29552ba

Please sign in to comment.