summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--classes/MIDIStateManager.sc14
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++"]");
});
}
+
}