Skip to content

Commit

Permalink
Bind window test and improvements (#77)
Browse files Browse the repository at this point in the history
* test for running action from bind window

* wrong action picked in bind win

* bump version
  • Loading branch information
myrrc authored Aug 11, 2024
1 parent 11b474d commit fa1f664
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Scripts/install-reaper-keys.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- @description reaper-keys: map keystroke combinations to actions like in vim
-- @version 2.0.0-a5
-- @version 2.0.0-a6
-- @author gwatcha
-- @links
-- GitHub repository https://github.com/gwatcha/reaper-keys
Expand Down
10 changes: 4 additions & 6 deletions internal/command/meta_command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,10 @@ local meta_commands = {
new_state['key_sequence'] = ""
return new_state
end,
-- TODO make me accessible from any state
["ShowBindingList"] = function(state, command)
local new_state = state
new_state['key_sequence'] = ""
local list = binding_list.open(new_state)
return new_state
ShowBindingList = function(state, _)
state.key_sequence = ""
binding_list.open(state)
return state
end
}

Expand Down
4 changes: 0 additions & 4 deletions internal/gui/binding_list/controller.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
local log = require('utils.log')
local format = require('utils.format')

local definitions = require('utils.definitions')
local BindingListView = require('gui.binding_list.View')
local getPossibleFutureEntries = require('command.completer')
Expand Down Expand Up @@ -62,7 +59,6 @@ function getElementValues(view)
local action_type_i, action_type = view.elements.action_type_filter:val()
return {
binding_list_box = view.elements.binding_list_box:val(),
query = view.elements.query:val(),
state_filter_active = view.elements.state_filter_active:val(nil, true),
context_filter_active = view.elements.context_filter_active:val(nil, true),
context = context,
Expand Down
4 changes: 1 addition & 3 deletions internal/gui/feedback/controller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ function feedback.displayMessage(message)
end

function feedback.displayState(state)
local right_text = state.macro_recording
and string_util.format("(rec %s..)", state['macro_register'])
or ""
local right_text = state.macro_recording and ("(rec %s..)"):format(state.macro_register) or ""
model.setKeys({ right_text = right_text, mode = state['mode'] })
feedback.update()
end
Expand Down
6 changes: 3 additions & 3 deletions internal/state_machine/state_machine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local handleCommand = require('command.handler')
local getPossibleFutureEntries = require('command.completer')
local config = require 'definitions.config'.general
local actions = require 'definitions.actions'
local log = require('utils.log')
local log = require 'utils.log'
local format = require('utils.format')
local feedback = require('gui.feedback.controller')

Expand Down Expand Up @@ -45,10 +45,10 @@ local function step(state, key_press)
return new_state
end

log.info("New key sequence: " .. new_state.key_sequence)
log.info("New key sequence: ", new_state.key_sequence)
local command = buildCommand(new_state)
if command then
log.trace("Command built: " .. format.block(command))
log.trace("Command built: ", format.block(command))
new_state, message = handleCommand(new_state, command)
feedback.displayMessage(message)
return new_state
Expand Down
156 changes: 156 additions & 0 deletions tests/run-action-from-binding-win.RPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<REAPER_PROJECT 0.1 "7.18/linux-x86_64" 1723400603
<NOTES 0 2
>
RIPPLE 0
GROUPOVERRIDE 0 0 0
AUTOXFADE 1
ENVATTACH 3
POOLEDENVATTACH 0
MIXERUIFLAGS 11 48
ENVFADESZ10 40
PEAKGAIN 1
FEEDBACK 0
PANLAW 1
PROJOFFS 0 0 0
MAXPROJLEN 0 0
GRID 3199 8 1 8 1 0 0 0
TIMEMODE 1 5 -1 30 0 0 -1
VIDEO_CONFIG 0 0 256
PANMODE 3
PANLAWFLAGS 3
CURSOR 2
ZOOM 100 0 0
VZOOMEX 6 0
USE_REC_CFG 0
RECMODE 1
SMPTESYNC 0 30 100 40 1000 300 0 0 1 0 0
LOOP 0
LOOPGRAN 0 4
RECORD_PATH "Media" ""
<RECORD_CFG
ZXZhdxgAAQ==
>
<APPLYFX_CFG
>
RENDER_FILE ""
RENDER_PATTERN ""
RENDER_FMT 0 2 0
RENDER_1X 0
RENDER_RANGE 1 0 0 18 1000
RENDER_RESAMPLE 3 0 1
RENDER_ADDTOPROJ 0
RENDER_STEMS 0
RENDER_DITHER 0
TIMELOCKMODE 1
TEMPOENVLOCKMODE 1
ITEMMIX 1
DEFPITCHMODE 589824 0
TAKELANE 1
SAMPLERATE 44100 0 0
<RENDER_CFG
ZXZhdxgAAQ==
>
LOCK 1
<METRONOME 6 2
VOL 0.25 0.125
FREQ 800 1600 1
BEATLEN 4
SAMPLES "" ""
PATTERN 2863311530 2863311529
MULT 1
>
GLOBAL_AUTO -1
TEMPO 120 4 4
PLAYRATE 1 0 0.25 4
SELECTION 0 0
SELECTION2 0 0
MASTERAUTOMODE 0
MASTERTRACKHEIGHT 0 0
MASTERPEAKCOL 16576
MASTERMUTESOLO 0
MASTERTRACKVIEW 0 0.6667 0.5 0.5 0 0 0 0 0 0 0 0 0 0
MASTERHWOUT 0 0 1 0 0 0 0 -1
MASTER_NCH 2 2
MASTER_VOLUME 1 0 -1 -1 1
MASTER_PANMODE 3
MASTER_PANLAWFLAGS 3
MASTER_FX 1
MASTER_SEL 0
<MASTERPLAYSPEEDENV
EGUID {3E49D794-0BF6-BE85-B408-9C053EECE4E3}
ACT 0 -1
VIS 0 1 1
LANEHEIGHT 0 0
ARM 0
DEFSHAPE 0 -1 -1
>
<TEMPOENVEX
EGUID {FBDB5121-6E1C-D3FE-54D0-9357D6EF22AB}
ACT 1 -1
VIS 1 0 1
LANEHEIGHT 0 0
ARM 0
DEFSHAPE 1 -1 -1
>
<PROJBAY
>
<TRACK {5DDFBDBF-1A1F-CE14-B880-6B2B17F41EF5}
NAME test
PEAKCOL 16576
BEAT -1
AUTOMODE 0
PANLAWFLAGS 3
VOLPAN 1 0 -1 -1 1
MUTESOLO 0 0 0
IPHASE 0
PLAYOFFS 0 1
ISBUS 0 0
BUSCOMP 0 0 0 0 0
SHOWINMIX 1 0.6667 0.5 1 0.5 0 0 0
FIXEDLANES 9 0 0 0 0
SEL 1
REC 0 0 1 0 0 0 0 0
VU 2
TRACKHEIGHT 0 0 0 0 0 0 0
INQ 0 0 0 0.5 100 0 0 100
NCHAN 2
FX 1
TRACKID {5DDFBDBF-1A1F-CE14-B880-6B2B17F41EF5}
PERF 0
MIDIOUT -1
MAINSEND 1 0
<ITEM
POSITION 0
SNAPOFFS 0
LENGTH 2
LOOP 1
ALLTAKES 0
FADEIN 1 0 0 1 0 0 0
FADEOUT 1 0 0 1 0 0 0
MUTE 0 0
SEL 1
IGUID {001B7931-B125-7D89-555C-748F32F4D715}
IID 1
NAME 01-test-MIDI
VOLPAN 1 0 1 -1
SOFFS 0 0
PLAYRATE 1 1 0 -1 0 0.0025
CHANMODE 0
GUID {00C04099-EBCA-73D3-2976-CCC634848438}
<SOURCE MIDI
HASDATA 1 960 QN
CCINTERP 32
POOLEDEVTS {62263D9D-4BB4-5570-2F4B-CA7AF961718E}
E 3840 b0 7b 00
CCINTERP 32
CHASE_CC_TAKEOFFS 1
GUID {0EFC6413-3D51-390E-487C-26B63EB73569}
IGNTEMPO 0 120 4 4
SRCCOLOR 0
VELLANE -1 9 0 0 1
>
>
>
<EXTENSIONS
>
>
3 changes: 3 additions & 0 deletions tests/run-action-from-binding-win.rks
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
otest &Return "limitation of tester - feedback must be opened before bind win
&ctrl+alt+x "open bindings window
insertmi &Down &Return "run insert-midi-item action
10 changes: 3 additions & 7 deletions tests/test
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#!/bin/sh
ret=0; out=out.RPP; reaper="./reaper/reaper -new -nosplash"
if [ $# -eq 0 ]; then
tests="*.rks"; timeout 6 $reaper 1>/dev/null 2>&1 # still evaluating
else
tests=$@
fi
ret=0; out="out.RPP"; reaper="./reaper/reaper -new -nosplash"
[ $# -eq 0 ] && timeout 6 $reaper 1>/dev/null 2>&1 # still evaluating

for test in $tests; do
for test in ${@:-*.rks}; do
echo "Running $test"

$reaper -saveas $out 1>/dev/null 2>&1 &
Expand Down

0 comments on commit fa1f664

Please sign in to comment.