Skip to content

Commit

Permalink
Fix issue with TDM creation from GUI++
Browse files Browse the repository at this point in the history
Fixes github issue #8. Also tidy up some potential warnings, and listObjects() in the demo
  • Loading branch information
h4yn0nnym0u5e committed Jan 30, 2022
1 parent 442625a commit 02a19d8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
4 changes: 1 addition & 3 deletions OSCAudioBase.cpp
Expand Up @@ -666,7 +666,7 @@ void OSCAudioBase::createObject(OSCMessage& msg, int addressOffset, OSCBundle& r
int objIdx;
int mixerSize = -1;
int ml = msg.size() - 1;
bool isRoot = ml<2;
bool isRoot = !(ml>1 && msg.isString(2)); // sss or sssi, but not ssi, are group creates

typ = getMessageString(msg,0,alloca(msg.getDataLength(0)));
objName = getMessageString(msg,1,alloca(msg.getDataLength(1)+1),true);
Expand All @@ -680,13 +680,11 @@ void OSCAudioBase::createObject(OSCMessage& msg, int addressOffset, OSCBundle& r
{
mixerSize = msg.getInt(ml); // get mixer width
objIdx = AUDIOMIXER_INDEX;
isRoot = ml<3;
}
else if (msg.isInt(ml) && 0 == strcmp(AudioMixerStereoName,typ)) // last parameter is an integer? variable width mixer?
{
mixerSize = msg.getInt(ml); // get mixer width
objIdx = AUDIOMIXERSTEREO_INDEX;
isRoot = ml<3;
}
}

Expand Down
8 changes: 8 additions & 0 deletions OSCAudioBase.h
Expand Up @@ -43,7 +43,14 @@


#define noOSC_DEBUG_PRINT
#if !defined(DEBUG_SER)
#if defined(OSC_DEBUG_PRINT)
// might have previous "no debug" definition
#undef OSC_SPRT
#undef OSC_SPLN
#undef OSC_SPTF
#undef OSC_SFSH
#undef OSC_DBGP
#define DEBUG_SER Serial
#define OSC_SPRT(...) DEBUG_SER.print(__VA_ARGS__)
#define OSC_SPLN(...) DEBUG_SER.println(__VA_ARGS__)
Expand All @@ -57,6 +64,7 @@
#define OSC_SFSH(...)
#define OSC_DBGP(...)
#endif // defined(OSC_DEBUG_PRINT)
#endif // !defined(DEBUG_SER)

extern void listObjects(void);

Expand Down
10 changes: 9 additions & 1 deletion OSCUtils.h
Expand Up @@ -38,7 +38,14 @@


#define noOSC_DEBUG_PRINT
#if defined(OSC_DEBUG_PRINT) && !defined(DEBUG_SER)
#if !defined(DEBUG_SER)
#if defined(OSC_DEBUG_PRINT)
// might have previous "no debug" definition
#undef OSC_SPRT
#undef OSC_SPLN
#undef OSC_SPTF
#undef OSC_SFSH
#undef OSC_DBGP
#define DEBUG_SER Serial
#define OSC_SPRT(...) DEBUG_SER.print(__VA_ARGS__)
#define OSC_SPLN(...) DEBUG_SER.println(__VA_ARGS__)
Expand All @@ -52,6 +59,7 @@
#define OSC_SFSH(...)
#define OSC_DBGP(...)
#endif // defined(OSC_DEBUG_PRINT)
#endif // !defined(DEBUG_SER)


class OSCUtils
Expand Down
9 changes: 6 additions & 3 deletions examples/OSCAudioMIDIsubsFS/OSCAudioMIDIsubsFS.ino
Expand Up @@ -47,6 +47,9 @@
//#include "dynamic-util.h"
#include "OSCAudioBase.h"

#define LIST_OBJECTS true
void listObjects(void) {listObjects(LIST_OBJECTS);}

#define noOSC_USE_USB_SERIAL
#if defined(OSC_USE_USB_SERIAL)
// set this to the USB serial port you wish to use
Expand Down Expand Up @@ -88,7 +91,7 @@ void setup() {
AudioMemory(50); // no idea what we'll need, so allow plenty
//-------------------------------
//testSanitise();
listObjects();
listObjects(LIST_OBJECTS);
//listAllTypes();
}

Expand Down Expand Up @@ -278,15 +281,15 @@ void updateOSC()
{
processBundle(bndl,reply);
sendReply(reply);
listObjects();
listObjects(LIST_OBJECTS);
}
else
{
if ('/' == firstCh)
{
processMessage(&msg,reply);
sendReply(reply);
listObjects();
listObjects(LIST_OBJECTS);
}
}
Serial.println();
Expand Down
12 changes: 7 additions & 5 deletions examples/OSCAudioMIDIsubsFS/utils.ino
Expand Up @@ -74,17 +74,19 @@ void listObjects(OSCAudioBase* obj,int indent=0)
depth--;
if (0 == depth && !locked)
count = 0;
Serial.printf("Count: %d\n",count);
//Serial.printf("Count: %d\n",count);
}


void listObjectsx(void)
void listObjects(bool doit)
{
listObjects(OSCAudioBase::getFirst());
Serial.println("--------------\n");
if (doit)
{
listObjects(OSCAudioBase::getFirst());
Serial.println("--------------\n");
}
}

void listObjects(void){}

//=============================================================
void goFind(OSCMessage& msg,int o,int md,OSCAudioBase* ooi)
Expand Down

0 comments on commit 02a19d8

Please sign in to comment.