Skip to content

Commit

Permalink
Adding a way to store using index and name
Browse files Browse the repository at this point in the history
  • Loading branch information
theod committed Sep 9, 2013
1 parent 854a5c5 commit a8f5b48
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
23 changes: 20 additions & 3 deletions Modular/library/PeerObject/TTCueManager.cpp
Expand Up @@ -362,13 +362,19 @@ TTErr TTCueManager::Clear()
TTErr TTCueManager::Store(const TTValue& inputValue, TTValue& outputValue)
{
TTAddressItemPtr aNamespace;
TTValue v, args;
TTValue v, args, out;
TTErr err;

// get cue name
if (inputValue.size() == 1)
if (inputValue[0].type() == kTypeSymbol)
mCurrent = inputValue[0];


// get cue position and name
if (inputValue.size() == 2)
if (inputValue[1].type() == kTypeSymbol)
mCurrent = inputValue[1];

if (mCurrent == kTTSymEmpty)
return kTTErrGeneric;

Expand Down Expand Up @@ -401,7 +407,18 @@ TTErr TTCueManager::Store(const TTValue& inputValue, TTValue& outputValue)
if (!aNamespace) aNamespace = mDefaultNamespace;

v = TTValue((TTPtr)aNamespace);
return mCurrentCue->sendMessage(TTSymbol("Store"), v, kTTValNONE);
err = mCurrentCue->sendMessage(TTSymbol("Store"), v, out);

// Move the cue at position
if (inputValue.size() == 2) {

v = mCurrent;
v.append(inputValue[0]);

err = Move(v, out);
}

return err;
}

TTErr TTCueManager::Append(const TTValue& inputValue, TTValue& outputValue)
Expand Down
25 changes: 20 additions & 5 deletions Modular/library/PeerObject/TTPresetManager.cpp
Expand Up @@ -184,12 +184,18 @@ TTErr TTPresetManager::Clear()

TTErr TTPresetManager::Store(const TTValue& inputValue, TTValue& outputValue)
{
TTValue v, args;
TTValue v, args, out;
TTErr err;

// get preset name
if (inputValue.size() == 1)
if (inputValue[0].type() == kTypeSymbol)
mCurrent = inputValue[0];

// get preset position and name
if (inputValue.size() == 2)
if (inputValue[1].type() == kTypeSymbol)
mCurrent = inputValue[1];

if (mCurrent == kTTSymEmpty)
return kTTErrGeneric;
Expand Down Expand Up @@ -221,9 +227,18 @@ TTErr TTPresetManager::Store(const TTValue& inputValue, TTValue& outputValue)
mCurrentPreset->sendMessage(TTSymbol("Clear"));
}

mCurrentPreset->sendMessage(TTSymbol("Store"));
err = mCurrentPreset->sendMessage(TTSymbol("Store"));

// Move the preset at position
if (inputValue.size() == 2) {

v = mCurrent;
v.append(inputValue[0]);

err = Move(v, out);
}

return kTTErrNone;
return err;
}

TTErr TTPresetManager::Recall(const TTValue& inputValue, TTValue& outputValue)
Expand Down Expand Up @@ -344,7 +359,7 @@ TTErr TTPresetManager::Interpolate(const TTValue& inputValue, TTValue& outputVal
{
TTValue v1, v2;
TTInt32 i1, i2;
TTSymbol name1, name2;
TTSymbol name1, name2;
TTPresetPtr preset1, preset2;
TTFloat32 position;

Expand Down Expand Up @@ -434,7 +449,7 @@ TTErr TTPresetManager::Mix(const TTValue& inputValue, TTValue& outputValue)
TTErr TTPresetManager::Move(const TTValue& inputValue, TTValue& outputValue)
{
TTList temp;
TTSymbol name;
TTSymbol name;
TTUInt32 i, newPosition;
TTValue v;

Expand Down

0 comments on commit a8f5b48

Please sign in to comment.