diff options
author | David Runge <dave@sleepmap.de> | 2018-03-19 22:55:12 +0100 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2018-03-19 22:55:12 +0100 |
commit | d11d37ada865ae9579c5eb0de1875e7cd77a6e02 (patch) | |
tree | 8d61bfebdcd7e2705ddc8474fc20a5ff4b6b6d51 | |
parent | 48d9b39b92e072b09fe7110685ffed2ef97078b9 (diff) | |
download | usbmidiism-d11d37ada865ae9579c5eb0de1875e7cd77a6e02.tar.gz usbmidiism-d11d37ada865ae9579c5eb0de1875e7cd77a6e02.tar.bz2 usbmidiism-d11d37ada865ae9579c5eb0de1875e7cd77a6e02.tar.xz usbmidiism-d11d37ada865ae9579c5eb0de1875e7cd77a6e02.zip |
classes/MIDIStateManager.sc: Add verbose mode. Inserting linebreaks and passing on verbosity.
Calling takeOver() on recycled MIDIStates.
-rw-r--r-- | classes/MIDIStateManager.sc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/classes/MIDIStateManager.sc b/classes/MIDIStateManager.sc index ec4b53c..1566a58 100644 --- a/classes/MIDIStateManager.sc +++ b/classes/MIDIStateManager.sc @@ -1,9 +1,10 @@ MIDIStateManager{ - var <deviceStates; + var <>verbose, <deviceStates; *new{ - ^super.new.initManager(); + arg verbose; + ^super.newCopyArgs(verbose).initManager(); } initManager{ @@ -13,6 +14,7 @@ MIDIStateManager{ // request a state // if a stored and unconnected state is available return that, else return a // new MIDIState + // TODO: improve search algorithm requestState{ arg name, uid, inPortNum, outPortNum; var devicePosition = -1, stateAvailable = false; @@ -24,10 +26,11 @@ MIDIStateManager{ }); if(stateAvailable && (devicePosition >= 0),{ deviceStates[devicePosition].connected=true; + deviceStates[devicePosition].takeOver(); ^deviceStates[devicePosition]; },{ deviceStates = deviceStates.add( - MIDIState.new(name, uid, inPortNum, outPortNum) + MIDIState.new(name, uid, inPortNum, outPortNum, verbose) ); ^deviceStates[deviceStates.size-1]; }); @@ -35,7 +38,10 @@ MIDIStateManager{ listStates{ deviceStates.do({|state, i| - postln(i.asString++": ["++state.name++", "++state.uid++", "++state.inPortNum++", "++state.outPortNum++", "++state.connected++"]"); + postln(i.asString++": ["++state.name++", "++state.uid++", " + ++state.inPortNum++", "++state.outPortNum++", " + ++state.connected++"]"); }); } + } |