Mercurial > hg > svcore
diff plugin/DSSIPluginInstance.cpp @ 687:06f13a3b9e9e debug-output
Convert many cerrs to DEBUGs
author | Chris Cannam |
---|---|
date | Mon, 16 May 2011 17:19:09 +0100 |
parents | 29efe322ab47 |
children | 1424aa29ae95 |
line wrap: on
line diff
--- a/plugin/DSSIPluginInstance.cpp Thu May 12 17:31:24 2011 +0100 +++ b/plugin/DSSIPluginInstance.cpp Mon May 16 17:19:09 2011 +0100 @@ -77,8 +77,8 @@ m_haveLastEventSendTime(false) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::DSSIPluginInstance(" << identifier << ")" - << std::endl; + DEBUG << "DSSIPluginInstance::DSSIPluginInstance(" << identifier << ")" + << endl; #endif init(); @@ -177,7 +177,7 @@ DSSIPluginInstance::getParameter(std::string id) const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getParameter(" << id << ")" << std::endl; + DEBUG << "DSSIPluginInstance::getParameter(" << id << ")" << endl; #endif for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { if (id == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) { @@ -186,7 +186,7 @@ #endif float v = getParameterValue(i); #ifdef DEBUG_DSSI - std::cerr << "Returning " << v << std::endl; + DEBUG << "Returning " << v << endl; #endif return v; } @@ -199,7 +199,7 @@ DSSIPluginInstance::setParameter(std::string id, float value) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::setParameter(" << id << ", " << value << ")" << std::endl; + DEBUG << "DSSIPluginInstance::setParameter(" << id << ", " << value << ")" << endl; #endif for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) { @@ -214,7 +214,7 @@ DSSIPluginInstance::init() { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::init" << std::endl; + DEBUG << "DSSIPluginInstance::init" << endl; #endif // Discover ports numbers and identities @@ -258,8 +258,8 @@ } #ifdef DEBUG_DSSI else - std::cerr << "DSSIPluginInstance::DSSIPluginInstance - " - << "unrecognised port type" << std::endl; + DEBUG << "DSSIPluginInstance::DSSIPluginInstance - " + << "unrecognised port type" << endl; #endif } @@ -272,7 +272,7 @@ size_t latency = 0; #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::getLatency(): m_latencyPort " << m_latencyPort << ", m_run " << m_run << std::endl; + DEBUG << "DSSIPluginInstance::getLatency(): m_latencyPort " << m_latencyPort << ", m_run " << m_run << endl; #endif if (m_latencyPort) { @@ -288,7 +288,7 @@ } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::getLatency(): latency is " << latency << std::endl; + DEBUG << "DSSIPluginInstance::getLatency(): latency is " << latency << endl; #endif return latency; @@ -313,8 +313,8 @@ DSSIPluginInstance::setIdealChannelCount(size_t channels) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::setIdealChannelCount: channel count " - << channels << " (was " << m_idealChannelCount << ")" << std::endl; + DEBUG << "DSSIPluginInstance::setIdealChannelCount: channel count " + << channels << " (was " << m_idealChannelCount << ")" << endl; #endif if (channels == m_idealChannelCount) { @@ -401,7 +401,7 @@ DSSIPluginInstance::~DSSIPluginInstance() { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::~DSSIPluginInstance" << std::endl; + DEBUG << "DSSIPluginInstance::~DSSIPluginInstance" << endl; #endif if (m_threads.find(m_instanceHandle) != m_threads.end()) { @@ -502,7 +502,7 @@ m_cachedPrograms.clear(); #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::checkProgramCache" << std::endl; + DEBUG << "DSSIPluginInstance::checkProgramCache" << endl; #endif if (!m_descriptor || !m_descriptor->get_program) { @@ -522,7 +522,7 @@ } #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::checkProgramCache: have " << m_cachedPrograms.size() << " programs" << std::endl; + DEBUG << "DSSIPluginInstance::checkProgramCache: have " << m_cachedPrograms.size() << " programs" << endl; #endif m_programCacheValid = true; @@ -532,7 +532,7 @@ DSSIPluginInstance::getPrograms() const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getPrograms" << std::endl; + DEBUG << "DSSIPluginInstance::getPrograms" << endl; #endif if (!m_descriptor) return ProgramList(); @@ -553,7 +553,7 @@ DSSIPluginInstance::getProgram(int bank, int program) const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getProgram(" << bank << "," << program << ")" << std::endl; + DEBUG << "DSSIPluginInstance::getProgram(" << bank << "," << program << ")" << endl; #endif if (!m_descriptor) return std::string(); @@ -572,7 +572,7 @@ DSSIPluginInstance::getProgram(std::string name) const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getProgram(" << name << ")" << std::endl; + DEBUG << "DSSIPluginInstance::getProgram(" << name << ")" << endl; #endif if (!m_descriptor) return 0; @@ -609,7 +609,7 @@ DSSIPluginInstance::selectProgramAux(std::string program, bool backupPortValues) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::selectProgram(" << program << ")" << std::endl; + DEBUG << "DSSIPluginInstance::selectProgram(" << program << ")" << endl; #endif if (!m_descriptor) return; @@ -631,7 +631,7 @@ found = true; #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::selectProgram(" << program << "): found at bank " << bankNo << ", program " << programNo << std::endl; + DEBUG << "DSSIPluginInstance::selectProgram(" << program << "): found at bank " << bankNo << ", program " << programNo << endl; #endif break; @@ -647,7 +647,7 @@ m_processLock.unlock(); #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::selectProgram(" << program << "): made select_program(" << bankNo << "," << programNo << ") call" << std::endl; + DEBUG << "DSSIPluginInstance::selectProgram(" << program << "): made select_program(" << bankNo << "," << programNo << ") call" << endl; #endif if (backupPortValues) { @@ -661,7 +661,7 @@ DSSIPluginInstance::activate() { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::activate" << std::endl; + DEBUG << "DSSIPluginInstance::activate" << endl; #endif if (!m_descriptor || !m_descriptor->LADSPA_Plugin->activate) return; @@ -669,14 +669,14 @@ if (m_program != "") { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::activate: restoring program " << m_program << std::endl; + DEBUG << "DSSIPluginInstance::activate: restoring program " << m_program << endl; #endif selectProgramAux(m_program, false); } for (size_t i = 0; i < m_backupControlPortsIn.size(); ++i) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::activate: setting port " << m_controlPortsIn[i].first << " to " << m_backupControlPortsIn[i] << std::endl; + DEBUG << "DSSIPluginInstance::activate: setting port " << m_controlPortsIn[i].first << " to " << m_backupControlPortsIn[i] << endl; #endif *m_controlPortsIn[i].second = m_backupControlPortsIn[i]; } @@ -687,9 +687,9 @@ { if (!m_descriptor || !m_descriptor->LADSPA_Plugin->connect_port) return; #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::connectPorts: " << m_audioPortsIn.size() + DEBUG << "DSSIPluginInstance::connectPorts: " << m_audioPortsIn.size() << " audio ports in, " << m_audioPortsOut.size() << " out, " - << m_outputBufferCount << " output buffers" << std::endl; + << m_outputBufferCount << " output buffers" << endl; #endif assert(sizeof(LADSPA_Data) == sizeof(float)); @@ -726,7 +726,7 @@ *m_controlPortsIn[i].second = defaultValue; m_backupControlPortsIn[i] = defaultValue; #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::connectPorts: set control port " << i << " to default value " << defaultValue << std::endl; + DEBUG << "DSSIPluginInstance::connectPorts: set control port " << i << " to default value " << defaultValue << endl; #endif } } @@ -749,7 +749,7 @@ DSSIPluginInstance::setParameterValue(unsigned int parameter, float value) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::setParameterValue(" << parameter << ") to " << value << std::endl; + DEBUG << "DSSIPluginInstance::setParameterValue(" << parameter << ") to " << value << endl; #endif if (parameter >= m_controlPortsIn.size()) return; @@ -773,7 +773,7 @@ DSSIPluginInstance::setPortValueFromController(unsigned int port, int cv) { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::setPortValueFromController(" << port << ") to " << cv << std::endl; + DEBUG << "DSSIPluginInstance::setPortValueFromController(" << port << ") to " << cv << endl; #endif const LADSPA_Descriptor *p = m_descriptor->LADSPA_Plugin; @@ -819,7 +819,7 @@ DSSIPluginInstance::getParameterValue(unsigned int parameter) const { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::getParameterValue(" << parameter << ")" << std::endl; + DEBUG << "DSSIPluginInstance::getParameterValue(" << parameter << ")" << endl; #endif if (parameter >= m_controlPortsIn.size()) return 0.0; return (*m_controlPortsIn[parameter].second); @@ -869,7 +869,7 @@ #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::configure(" << key << "," << value << ")" << std::endl; + DEBUG << "DSSIPluginInstance::configure(" << key << "," << value << ")" << endl; #endif char *message = m_descriptor->configure(m_instanceHandle, @@ -908,7 +908,7 @@ const void *e) { #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::sendEvent: last was " << m_lastEventSendTime << " (valid " << m_haveLastEventSendTime << "), this is " << eventTime << std::endl; + DEBUG << "DSSIPluginInstance::sendEvent: last was " << m_lastEventSendTime << " (valid " << m_haveLastEventSendTime << "), this is " << eventTime << endl; #endif // The process mechanism only works correctly if the events are @@ -926,7 +926,7 @@ snd_seq_event_t *event = (snd_seq_event_t *)e; #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::sendEvent at " << eventTime << std::endl; + DEBUG << "DSSIPluginInstance::sendEvent at " << eventTime << endl; #endif snd_seq_event_t ev(*event); @@ -955,7 +955,7 @@ int controller = ev->data.control.param; #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::handleController " << controller << std::endl; + DEBUG << "DSSIPluginInstance::handleController " << controller << endl; #endif if (controller == 0) { // bank select MSB @@ -1020,13 +1020,13 @@ } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::run(" << blockTime << ")" << std::endl; + DEBUG << "DSSIPluginInstance::run(" << blockTime << ")" << endl; #endif #ifdef DEBUG_DSSI_PROCESS if (m_eventBuffer.getReadSpace() > 0) { - std::cerr << "DSSIPluginInstance::run: event buffer has " - << m_eventBuffer.getReadSpace() << " event(s) in it" << std::endl; + DEBUG << "DSSIPluginInstance::run: event buffer has " + << m_eventBuffer.getReadSpace() << " event(s) in it" << endl; } #endif @@ -1044,8 +1044,8 @@ } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::run: evTime " << evTime << ", blockTime " << blockTime << ", frameOffset " << frameOffset - << ", blockSize " << m_blockSize << std::endl; + DEBUG << "DSSIPluginInstance::run: evTime " << evTime << ", blockTime " << blockTime << ", frameOffset " << frameOffset + << ", blockSize " << m_blockSize << endl; std::cerr << "Type: " << int(ev->type) << ", pitch: " << int(ev->data.note.note) << ", velocity: " << int(ev->data.note.velocity) << std::endl; #endif @@ -1079,20 +1079,20 @@ int bank = m_pending.lsb + 128 * m_pending.msb; #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::run: making select_program(" << bank << "," << program << ") call" << std::endl; + DEBUG << "DSSIPluginInstance::run: making select_program(" << bank << "," << program << ") call" << endl; #endif m_pending.lsb = m_pending.msb = m_pending.program = -1; m_descriptor->select_program(m_instanceHandle, bank, program); #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::run: made select_program(" << bank << "," << program << ") call" << std::endl; + DEBUG << "DSSIPluginInstance::run: made select_program(" << bank << "," << program << ") call" << endl; #endif } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::run: running with " << evCount << " events" - << std::endl; + DEBUG << "DSSIPluginInstance::run: running with " << evCount << " events" + << endl; #endif m_descriptor->run_synth(m_instanceHandle, count, @@ -1153,7 +1153,7 @@ PluginSet &s = m_groupMap[m_identifier]; #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped(" << blockTime << "): this is " << this << "; " << s.size() << " elements in m_groupMap[" << m_identifier << "]" << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): this is " << this << "; " << s.size() << " elements in m_groupMap[" << m_identifier << "]" << endl; #endif if (m_lastRunTime != blockTime) { @@ -1161,7 +1161,7 @@ DSSIPluginInstance *instance = *i; if (instance != this && instance->m_lastRunTime == blockTime) { #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped(" << blockTime << "): plugin " << instance << " has already been run" << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): plugin " << instance << " has already been run" << endl; #endif needRun = false; } @@ -1170,13 +1170,13 @@ if (!needRun) { #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped(" << blockTime << "): already run, returning" << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): already run, returning" << endl; #endif return; } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped(" << blockTime << "): I'm the first, running" << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): I'm the first, running" << endl; #endif size_t index = 0; @@ -1194,7 +1194,7 @@ instances[index] = instance->m_instanceHandle; #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped(" << blockTime << "): running " << instance << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped(" << blockTime << "): running " << instance << endl; #endif if (instance->m_pending.program >= 0 && @@ -1220,8 +1220,8 @@ } #ifdef DEBUG_DSSI_PROCESS - std::cerr << "DSSIPluginInstance::runGrouped: evTime " << evTime << ", frameOffset " << frameOffset - << ", block size " << m_blockSize << std::endl; + DEBUG << "DSSIPluginInstance::runGrouped: evTime " << evTime << ", frameOffset " << frameOffset + << ", block size " << m_blockSize << endl; #endif if (frameOffset >= int(m_blockSize)) break; @@ -1259,7 +1259,7 @@ { // This is called from a non-RT context (during instantiate) - std::cerr << "DSSIPluginInstance::requestMidiSend" << std::endl; + DEBUG << "DSSIPluginInstance::requestMidiSend" << endl; return 1; } @@ -1270,7 +1270,7 @@ { // This is likely to be called from an RT context - std::cerr << "DSSIPluginInstance::midiSend" << std::endl; + DEBUG << "DSSIPluginInstance::midiSend" << endl; } void @@ -1296,7 +1296,7 @@ DSSIPluginInstance::deactivate() { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::deactivate " << m_identifier << std::endl; + DEBUG << "DSSIPluginInstance::deactivate " << m_identifier << endl; #endif if (!m_descriptor || !m_descriptor->LADSPA_Plugin->deactivate) return; @@ -1306,7 +1306,7 @@ m_descriptor->LADSPA_Plugin->deactivate(m_instanceHandle); #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::deactivate " << m_identifier << " done" << std::endl; + DEBUG << "DSSIPluginInstance::deactivate " << m_identifier << " done" << endl; #endif m_bufferScavenger.scavenge(); @@ -1316,7 +1316,7 @@ DSSIPluginInstance::cleanup() { #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::cleanup " << m_identifier << std::endl; + DEBUG << "DSSIPluginInstance::cleanup " << m_identifier << endl; #endif if (!m_descriptor) return; @@ -1331,7 +1331,7 @@ m_descriptor->LADSPA_Plugin->cleanup(m_instanceHandle); m_instanceHandle = 0; #ifdef DEBUG_DSSI - std::cerr << "DSSIPluginInstance::cleanup " << m_identifier << " done" << std::endl; + DEBUG << "DSSIPluginInstance::cleanup " << m_identifier << " done" << endl; #endif }