-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
supernova: include argument names in queryTree #3221
supernova: include argument names in queryTree #3221
Conversation
Sorry, this is not ready yet... further tests revealed server crashing with larger messages. I'll keep you posted. |
Seems working now. |
sorry this has been decaying. i will try to find some time to look at it soon. seems decent at first glance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works, thanks so much! Logic can be cleaned up though
if(name_of_slot) | ||
p << name_of_slot; | ||
else | ||
p << osc::int32(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified to a single branch:
if (i < scsynth.number_of_slots())
p << scsynth.name_of_slot(i);
else
p << osc::int32(i);
also style note - put a space after if
and not after the open paren
[WIP] |
The mappings seem now to be properly reported in response to queryTree for both control and audio buses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also noticed that when dumping node tree with controls (to the std out, not through OSC - in IDE on mac shortcut cmd-shift-t), mappings are also omitted in supernova. I made a commend next to the line where I think this happens... I'm not sure I'll be able to track this down anytime soon, is it reasonable to open an issue about it separately?
@@ -1589,7 +1604,7 @@ void dump_controls(rt_string_stream & stream, abstract_synth const & synth, int | |||
} else | |||
stream << ", "; | |||
|
|||
stream << synth.get(control_index); | |||
stream << synth.get(control_index); /*FIXME: this seems not to check for mapped controls*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT this seems to be the place where controls are printed, but omitting the mappings.
9b113ad
to
077d79a
Compare
I cleaned up commit history, and also added mapped controls when dumping the node tree. I'd appreciate if someone can look this over, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Here are my comments
} else { | ||
bus = (scsynth.mMapControls[i]) - (scsynth.mNode.mWorld->mControlBus); | ||
sprintf(str, "%c%d", 'c', bus); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this not also be a call to getMappedSymbol?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also extra semicolon
@@ -1575,6 +1588,7 @@ void dump_controls(rt_string_stream & stream, abstract_synth const & synth, int | |||
const size_t number_of_slots = synth.number_of_slots(); | |||
|
|||
bool eol_pending = false; | |||
char str[10]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
declare this closer to use please
server/supernova/sc/sc_synth.cpp
Outdated
{ | ||
bool isMapped = mMapControls[slot_index] != mControls+slot_index; | ||
if (isMapped) { | ||
int bus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
declare this separately in each branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also use 4 spaces for indentation, your second level of indentation is 6 instead of 8 I think
server/supernova/sc/sc_synth.cpp
Outdated
} else { | ||
bus = mMapControls[slot_index] - mNode.mWorld->mControlBus; | ||
sprintf(str, "%c%d", 'c', bus); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra semicolon
|
||
if (scsynth.mControlRates[i] == 2) { | ||
bus = (scsynth.mMapControls[i]) - (scsynth.mNode.mWorld->mAudioBus); | ||
bus = (int)((float)bus / scsynth.mNode.mWorld->mBufLength); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the purpose of these casts? if you are expecting truncation that already happens with integer division in C++.
server/supernova/sc/sc_synth.cpp
Outdated
if (mControlRates[slot_index] == 2) { | ||
bus = mMapControls[slot_index] - mNode.mWorld->mAudioBus; | ||
bus = (int)((float)bus / mNode.mWorld->mBufLength); | ||
sprintf(str, "%c%d", 'a', bus); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearer to move the character into the format string since it is known at compile time - "a%d", then "c%d" below
server/supernova/server/synth.hpp
Outdated
@@ -100,6 +100,8 @@ class abstract_synth: | |||
|
|||
virtual float get(slot_index_t slot_id) const = 0; | |||
|
|||
virtual bool getMappedSymbol(slot_index_t slot_id, char * str) const = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a brief comment to explain the meaning of the return value would be nice
server/supernova/server/synth.hpp
Outdated
@@ -100,6 +100,8 @@ class abstract_synth: | |||
|
|||
virtual float get(slot_index_t slot_id) const = 0; | |||
|
|||
virtual bool getMappedSymbol(slot_index_t slot_id, char * str) const = 0; //returns true (and writes characters to *str) if the control at slot_id is indeed mapped, otherwise returns false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please use a javadoc comment (/** ... */ or ///) on the line above? this matches the documentation style of supernova and also keeps text at a reasonable width
server/supernova/sc/sc_synth.cpp
Outdated
sprintf(str, "a%d", bus); | ||
} else { | ||
int bus; | ||
bus = mMapControls[slot_index] - mNode.mWorld->mControlBus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine, for future reference you can declare while initializing (int bus = ...), this will save space and reduce visual noise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably know that already, just stating my preference :)
Thank you Brian for the feedback! I made the requested corrections. I can also |
Thanks for being so quick to respond @dyfer. I think the whole thing can be squashed on merge, it's a small enough PR in terms of LoC |
a3e4b20
to
e21e35a
Compare
Hey @brianlheim, does this PR need more changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for your patience and I apologize for how long it took to review this.
As noted in #3210, scsynth and supernova respond differently to the the queryTree request. This changes the behavior of supernova to match the behavior of scsynth - controls's names are being reported in the reply message.