
#This file defines the keybindings for Radium.
#Radium parses this file, and sometime use parts of it to make a new generated file named
#"keybindings_generated.py", which again is loaded into Radium

# By default, this file is placed in the "bin" folder of Radium.
#
# If you want to, however, you can copy this file into the .radium/ folder in your home path,
# and Radium will use that file instead.


*
import radium as ra
*


####################################################################
?out ********** Computer Keyboard Note Playing/Editing ************
####################################################################

?define POLYSWITCH SHIFT_L
?define DOWNPLAY                  ra.keyDownPlay
?define DOWNPOLYPLAY POLYSWITCH : ra.polyKeyDownPlay
?define UPPLAY UP POLYSWITCH    : ra.keyUpPlay
?define UPPOLYPLAY UP           : ra.keyUpPlay

?define(a) KEYHANDLE DOWNPLAY a ?n DOWNPOLYPLAY a ?n UPPLAY a ?n UPPOLYPLAY a

QWERTY_Z   :	KEYHANDLE 0
QWERTY_S   :	KEYHANDLE 1
QWERTY_X   :	KEYHANDLE 2
QWERTY_D   :	KEYHANDLE 3
QWERTY_C   :	KEYHANDLE 4
QWERTY_V   :	KEYHANDLE 5
QWERTY_G   :	KEYHANDLE 6
QWERTY_B   :	KEYHANDLE 7
QWERTY_H   :	KEYHANDLE 8
QWERTY_N   :	KEYHANDLE 9
QWERTY_J   :   KEYHANDLE 10
QWERTY_M   :   KEYHANDLE 11
MR1 :   KEYHANDLE 12
QWERTY_L   :   KEYHANDLE 13
MR2 :   KEYHANDLE 14
LR1 :   KEYHANDLE 15
MR3 :   KEYHANDLE 16
LR3 :   KEYHANDLE 18

QWERTY_Q   :   KEYHANDLE 12
QWERTY_2   :   KEYHANDLE 13
QWERTY_W   :   KEYHANDLE 14
QWERTY_3   :   KEYHANDLE 15
QWERTY_E   :   KEYHANDLE 16
QWERTY_R   :   KEYHANDLE 17
QWERTY_5   :   KEYHANDLE 18
QWERTY_T   :   KEYHANDLE 19
QWERTY_6   :   KEYHANDLE 20
QWERTY_Y   :   KEYHANDLE 21
QWERTY_7   :   KEYHANDLE 22
QWERTY_U   :   KEYHANDLE 23
QWERTY_I   :   KEYHANDLE 24
QWERTY_9   :   KEYHANDLE 25
QWERTY_O   :   KEYHANDLE 26
QWERTY_0   :   KEYHANDLE 27
QWERTY_P   :   KEYHANDLE 28
PR1 :   KEYHANDLE 29
0R2 :   KEYHANDLE 30
PR2 :   KEYHANDLE 31
0R3 :   KEYHANDLE 32


F1: ra.decKeyAdd 12
F2: ra.incKeyAdd 12


#F3: ra.setKeyAdd 24
#F4: ra.setKeyAdd 72
#F5: ra.setKeyAdd 96

#TAB         : ra.incKeyAdd 24
#    SHIFT_L : ra.decKeyAdd 24

TAB: ra.switchWindowConfiguration

ESC: ra.switchEditOnOff

1           : ra.unsplitLine
1L1         : ra.splitLine 2
    CTRL_L  : ra.switchScrollPlayOnOff
    ALT_L   : ra.switchSoundScrollOnOff



####################################################################
?out *** Navigating / Expand line / Track on/off / Note volumes / Various ****
####################################################################

PAGE_DOWN   : ra.cursorDown 32
PAGE_UP     : ra.cursorUp 32

HOME        : ra.cursorPercentLine 0
END         : ra.cursorPercentLine 100

DOWNARROW   : ra.cursorDown 1
    SHIFT_L CTRL_L : ra.evalScheme "(line-zoom-out-exponentially)"
    SHIFT_L EXTRA_L : ra.evalScheme "(line-zoom-out-exponentially)"
    SHIFT_R : ra.cursorDown 8
    ALT_R   : ra.cursorNextSomething
    SHIFT_L : ra.lineZoomBlock 1
    ALT_L   : ra.insertLines 1

UPARROW     : ra.cursorUp 1
    SHIFT_L CTRL_L : ra.evalScheme "(line-zoom-in-exponentially)"
    SHIFT_L EXTRA_L : ra.evalScheme "(line-zoom-in-exponentially)"
    SHIFT_R : ra.cursorUp 8
    ALT_R   : ra.cursorPrevSomething
    SHIFT_L : ra.lineZoomBlock -1
    ALT_L   : ra.insertLines -1

RIGHTARROW  : ra.cursorRight
    SHIFT_R   : ra.cursorNextTrack
    ALT_R : ra.incNoteVolume 1
    SHIFT_R ALT_R : ra.incNoteVolume 10
    SHIFT_L : ra.expandLine 1

LEFTARROW   : ra.cursorLeft
    SHIFT_R   : ra.cursorPrevTrack
    ALT_R : ra.incNoteVolume -1
    SHIFT_R ALT_R : ra.incNoteVolume -10
    SHIFT_L : ra.expandLine -1


J:
   CTRL_L    : ra.cursorUserInputBeat
   CTRL_R    : ra.cursorUserInputBeat
#F6  : ra.cursorPercentLine    0
#F7  : ra.cursorPercentLine   25
#F8  : ra.cursorPercentLine   50
#F9  : ra.cursorPercentLine   75
#F10 : ra.cursorPercentLine  100

QWERTY_A:
    CTRL_L    : ra.selectPrevBlock 

QWERTY_F:
    CTRL_L    : ra.selectNextBlock 
#    SHIFT_R : ra.selectNextPlaylistBlock
    SHIFT_L  : ra.appendBlock    
    ALT_L   : ra.appendTrack

#QWERTY_A:            ra.selectPrevBlock 
#    SHIFT_R : ra.selectPrevPlaylistBlock




?define KP_CTRL_L CTRL_L : ra.selectTrack
?define KP_CAPS CAPS : ra.selectTrack
?define KP_CTRL_L_CAPS CTRL_L CAPS : ra.selectTrack

?define KP_CTRL_L_SW SHIFT_L CTRL_L : ra.switchTrackOn 
?define KP_CAPS_SW SHIFT_L CAPS : ra.switchTrackOn
?define KP_CTRL_L_CAPS_SW SHIFT_L CTRL_L CAPS : ra.switchTrackOn

?define KP_CTRL_L_SO ALT_L CTRL_L : ra.switchSoloTrack
?define KP_CAPS_SO ALT_L CAPS : ra.switchSoloTrack 
?define KP_CTRL_L_CAPS_SO ALT_L CTRL_L CAPS : ra.switchSoloTrack 

?define(a) KEYPAD_NAV ra.selectTrack a ?n KP_CTRL_L a +10 ?n KP_CAPS a +20 ?n KP_CTRL_L_CAPS a +30 ?n SHIFT_L : ra.switchTrackOn a ?n KP_CTRL_L_SW a +10 ?n KP_CAPS_SW a +20 ?n KP_CTRL_L_CAPS_SW a +30 ?n ALT_L : ra.switchSoloTrack a ?n KP_CTRL_L_SO a +10 ?n KP_CAPS_SO a +20 ?n KP_CTRL_L_CAPS_SO a +30

#################


KP_0	: KEYPAD_NAV 0
KP_1	: KEYPAD_NAV 1
KP_2	: KEYPAD_NAV 2
KP_3	: KEYPAD_NAV 3
KP_4	: KEYPAD_NAV 4
KP_5	: KEYPAD_NAV 5
KP_6	: KEYPAD_NAV 6
KP_7	: KEYPAD_NAV 7
KP_8	: KEYPAD_NAV 8
KP_9	: KEYPAD_NAV 9

KP_ENTER	:	ra.switchTrackOn
	CTRL_L	:	ra.allTracksOn
	SHIFT_L	:	ra.switchSoloTrack


####################################################################
?out ************************* Zoom ********************************
####################################################################

KP_SUB:                   ra.zoom -1
	CTRL_L		: ra.zoom -4
	CTRL_R		: ra.zoom -8

KP_ADD:                   ra.zoom 1
	CTRL_L		: ra.zoom 4
	CTRL_R		: ra.zoom 8

KP_MUL: ra.unzoom


####################################################################
?out ******** Extra keybindings for keyboards without keypad *******
####################################################################
F3:                     ra.switchTrackOn
       CTRL_L         : ra.allTracksOn

F4:                     ra.switchSoloTrack
       CTRL_L         : ra.allTracksOn

F5:                     ra.zoom -1
       CTRL_L         : ra.zoom -4
       CTRL_R         : ra.zoom -8
       SHIFT_L        : ra.unzoom

F6:                     ra.zoom 1
       CTRL_L         : ra.zoom 4
       CTRL_R         : ra.zoom 8

1 SHIFT_R : ra.selectTrack 1
2 SHIFT_R : ra.selectTrack 2
3 SHIFT_R : ra.selectTrack 3
4 SHIFT_R : ra.selectTrack 4
5 SHIFT_R : ra.selectTrack 5
6 SHIFT_R : ra.selectTrack 6
7 SHIFT_R : ra.selectTrack 7
8 SHIFT_R : ra.selectTrack 8
9 SHIFT_R : ra.selectTrack 9
0 SHIFT_R : ra.selectTrack 0

1 CTRL_R : ra.switchTrackOn 1
2 CTRL_R : ra.switchTrackOn 2
3 CTRL_R : ra.switchTrackOn 3
4 CTRL_R : ra.switchTrackOn 4
5 CTRL_R : ra.switchTrackOn 5
6 CTRL_R : ra.switchTrackOn 6
7 CTRL_R : ra.switchTrackOn 7
8 CTRL_R : ra.switchTrackOn 8
9 CTRL_R : ra.switchTrackOn 9
0 CTRL_R : ra.switchTrackOn 0


# Free keys:
# * W


####################################################################
?out *********** Note manipulation / Undo / Various ****************
####################################################################

U:
	CTRL_L		: ra.transposeBlock 1
	CTRL_L	SHIFT_L	: ra.transposeBlock 12
	ALT_L		: ra.transposeTrack 1
	ALT_L	SHIFT_L	: ra.transposeTrack 12
	EXTRA_L		: ra.transposeRange 1
	EXTRA_L	SHIFT_L	: ra.transposeRange 12
	ALT_R		: ra.transposeNote 1
	ALT_R	SHIFT_L	: ra.transposeNote 12

#	EXTRA_R	ALT_R		: ra.setMaxUndos

Z:
	CTRL_R  	: ra.undo
	CTRL_R	SHIFT_R	: ra.redo
	CTRL_R	SHIFT_L	: ra.redo
	CTRL_L  	: ra.undo
	CTRL_L	SHIFT_R	: ra.redo
	CTRL_L	SHIFT_L	: ra.redo

D:
	CTRL_L		: ra.transposeBlock -1
	CTRL_L	SHIFT_L	: ra.transposeBlock -12
	ALT_L		: ra.transposeTrack -1
	ALT_L	SHIFT_L	: ra.transposeTrack -12
	EXTRA_L		: ra.transposeRange -1
	EXTRA_L	SHIFT_L	: ra.transposeRange -12
	ALT_R		: ra.transposeNote -1
	ALT_R	SHIFT_L	: ra.transposeNote -12

G:
	ALT_R		: ra.glissando

Q:
	CTRL_L		: ra.quantitizeBlock
	ALT_L		: ra.quantitizeTrack
	EXTRA_L		: ra.quantitizeRange
        SHIFT_R         : ra.configQuantitize
#	EXTRA_R		: ra.quit

8:
	CTRL_L		: ra.invertBlock
	ALT_L		: ra.invertTrack
	EXTRA_L		: ra.invertRange

9:
	CTRL_L		: ra.backwardsBlock
	ALT_L		: ra.backwardsTrack
        EXTRA_L		: ra.backwardsRange

6:
	CTRL_L		: ra.pexpandBlock
	ALT_L		: ra.pexpandTrack
	EXTRA_L		: ra.pexpandRange

####################################################################
?out ************************ Playing ******************************
####################################################################
#SPACE			: *
#        if ra.isPlaying():
#           ra.playStop()
#        else:
#           ra.playBlockFromStart()
#*
SPACE                   : ra.playStop
	EXTRA_R		: ra.playBlockFromStart
	ALT_R		: ra.playSongFromStart
	SHIFT_R		: ra.playBlockFromCurrent
	ALT_R SHIFT_R	: ra.playSongFromCurrent
	EXTRA_L		: ra.playRangeFromStart

#ALT_R: ra.playBlockFromStart

MENU:                     ra.configBlock
VOLUME_DOWN:              ra.volumeDown
VOLUME_UP:                ra.volumeUp
MUTE:                     ra.mute
PLAY:                     ra.playBlockFromStart
STOP:                     ra.playStop


####################################################################
?out *************** ClipBoard / Various ***************************
####################################################################

Z:
	EXTRA_L		: ra.cancelRange
X:
	EXTRA_L		: ra.cutRange
	ALT_L		: ra.cutTrack
C:
	EXTRA_L		: ra.copyRange
	ALT_L		: ra.copyTrack
	CTRL_L		: ra.copyBlock
	EXTRA_R		: ra.configWindow

V:
	EXTRA_L		: ra.pasteRange
	ALT_L		: ra.pasteTrack
	CTRL_L		: ra.pasteBlock
B:
	EXTRA_L		: ra.markRange
	EXTRA_R		: ra.configBlock


####################################################################
?out ************************ Various ******************************
####################################################################

1:
        CTRL_L		: ra.setNoteScrollLength 1

2:
        CTRL_L		: ra.setNoteScrollLength 2

3:
        CTRL_L		: ra.setNoteScrollLength 3

4:
        CTRL_L		: ra.setNoteScrollLength 4

5:
        CTRL_L		: ra.setNoteScrollLength 5


BACKSPACE		: ra.insertReallines -1
	ALT_L		: ra.insertReallines 1

DEL:			 ra.generalDelete
QWERTY_A:                ra.generalDelete

RETURN			: ra.generalReturn
	SHIFT_L		: ra.insertLines

F7                      : ra.showHideEditor
F8                      : ra.showHidePlaylist
F9                      : ra.showHideMixerWidget
F10                     : ra.showHideInstrumentWidget
F11			: ra.toggleFullScreen
F12                     : ra.selectInstrumentForTrack

S:
	ALT_L		: ra.swapTracks
	CTRL_L		: ra.save
	CTRL_R		: ra.save
#	CTRL_L		: ra.splitBlock
#       EXTRA_R	SHIFT_R	: ra.saveAs

N:
	ALT_L		: ra.showHideNoteTrack
	CTRL_L		: ra.showHideNoteTracksInBlock

W:
	ALT_L		: ra.changeTrackNoteAreaWidth
	CTRL_L		: ra.changeBlockNoteAreaWidth

M:
	ALT_L		: ra.minimizeTrack
	CTRL_L		: ra.minimizeBlockTracks

T:
	ALT_L		: ra.switchTrackNoteShowType
	CTRL_L		: ra.switchBlockNoteShowType

P:
        ALT_L           : ra.showHidePianoroll
        CTRL_L          : ra.showHidePianorollInBlock

Y:
        ALT_L           : ra.showHideVeltext
        CTRL_L          : ra.showHideVeltextInBlock

R:
	ALT_L		: ra.deleteTracks 1
	CTRL_L		: ra.deleteBlock

I:
	ALT_L		: ra.insertTracks 1
	CTRL_L		: ra.insertBlock

O:
	CTRL_L		: ra.load
	CTRL_R		: ra.load


####################################################################
?out ********************* Advanced (examples) *********************
####################################################################

# How to run scheme code from keyboard shortcut:
#O ALT_L : *
#        ra.evalScheme("(c-display 50000)(newline)")
#*

*
import bubble
*

#7: *
#	bubble.bubble()
#*
#7 ALT_L: *
#	reload(bubble)
#	bubble.bubble()
#*


#*
#import transpose4
#*
#
#6 ALT_L: *
#	reload(transpose4)
#	transpose4.transpose(1)
#*

