/** * Dump a GL_KHR_debug/GL_EXT_debug_label object label. */ void dumpObjectLabel(JSONWriter &json, Context &context, GLenum identifier, GLuint name, const char *member) { char *label = getObjectLabel(context, identifier, name); if (!label) { return; } json.writeStringMember(member, label); free(label); }
void DspDivide::processMessage(int inletIndex, PdMessage *message) { if (inletIndex == 1) { if (message->isFloat(0)) { if (message->getFloat(0) == 0.0f) { constant = 1.0f; graph->printErr("%s received message which set divisor to zero. Divisor set to 1.0f.", getObjectLabel()); } else { constant = message->getFloat(0); } } } }
string DspDivide::toString() { const char *fmt = (constant == 0.0f) ? "%s" : "%s %g"; char str[snprintf(NULL, 0, fmt, getObjectLabel(), constant)+1]; snprintf(str, sizeof(str), fmt, getObjectLabel(), constant); return string(str); }
string DspSubtract::toString() { const char *fmt = (constant == 0.0f) ? "%s" : "%s %g"; char* str(static_cast<char*>(alloca(snprintf(NULL, 0, fmt, getObjectLabel(), constant) + 1))); snprintf(str, sizeof(str), fmt, getObjectLabel(), constant); return string(str); }
string DspClip::toString() { char str[snprintf(NULL, 0, "%s %g %g", getObjectLabel(), lowerBound, upperBound)+1]; snprintf(str, sizeof(str), "%s %g %g", getObjectLabel(), lowerBound, upperBound); return string(str); }
string MessageMetro::toString() { char str[snprintf(NULL, 0, "%s %g", getObjectLabel(), intervalInMs)+1]; snprintf(str, sizeof(str), "%s %g", getObjectLabel(), intervalInMs); return string(str); }