zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 526e013e1656a18c87d6743fc57e39a485441a3f
parent 3c233820f5cf94c811d475a348e3bd045ffb95b3
Author: Daniel Winzen <[email protected]>
Date:   Sat, 10 Jan 2015 14:53:34 +0100

Various fixes

This adds va_end(va) to close va_lists, increases performance by removing unused variables and other fixes.

Diffstat:
MExternalPrograms/Controller/Controller.C | 2+-
MExternalPrograms/Spliter/Spliter.C | 4++--
Msrc/DSP/AnalogFilter.cpp | 2--
Msrc/Misc/Master.cpp | 5++++-
Msrc/Misc/MiddleWare.cpp | 11+++++++----
Msrc/Misc/PresetExtractor.cpp | 1+
Msrc/Misc/XMLwrapper.cpp | 3++-
Msrc/Nio/JackEngine.cpp | 3+--
Msrc/Synth/OscilGen.cpp | 2+-
Msrc/UI/Connection.cpp | 1+
Msrc/UI/Fl_Osc_Widget.cpp | 2++
11 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/ExternalPrograms/Controller/Controller.C b/ExternalPrograms/Controller/Controller.C @@ -27,7 +27,7 @@ Controller::Controller() { snd_seq_open(&midi_out, "default", SND_SEQ_OPEN_OUTPUT, 0); char portname[50]; sprintf(portname, "Controller"); - int alsaport = snd_seq_create_simple_port( + snd_seq_create_simple_port( midi_out, portname, SND_SEQ_PORT_CAP_READ diff --git a/ExternalPrograms/Spliter/Spliter.C b/ExternalPrograms/Spliter/Spliter.C @@ -20,14 +20,14 @@ Spliter::Spliter() { snd_seq_open(&midi_out, "default", SND_SEQ_OPEN_OUTPUT, 0); char portname[50]; sprintf(portname, "Spliter IN"); - int alsaport = snd_seq_create_simple_port( + snd_seq_create_simple_port( midi_in, portname, SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE, SND_SEQ_PORT_TYPE_SYNTH); sprintf(portname, "Spliter OUT"); - alsaport = snd_seq_create_simple_port( + snd_seq_create_simple_port( midi_out, portname, SND_SEQ_PORT_CAP_READ diff --git a/src/DSP/AnalogFilter.cpp b/src/DSP/AnalogFilter.cpp @@ -213,7 +213,6 @@ void AnalogFilter::computefiltercoefs(void) case 7: //Low Shelf - 2 poles if(!zerocoefs) { tmpq = sqrtf(tmpq); - alpha = sn / (2.0f * tmpq); beta = sqrtf(tmpgain) / tmpq; tmp = (tmpgain + 1.0f) + (tmpgain - 1.0f) * cs + beta * sn; @@ -239,7 +238,6 @@ void AnalogFilter::computefiltercoefs(void) case 8: //High Shelf - 2 poles if(!zerocoefs) { tmpq = sqrtf(tmpq); - alpha = sn / (2.0f * tmpq); beta = sqrtf(tmpgain) / tmpq; tmp = (tmpgain + 1.0f) - (tmpgain - 1.0f) * cs + beta * sn; diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp @@ -201,6 +201,7 @@ class DataObj:public rtosc::RtData char *buffer = bToU->buffer(); rtosc_vmessage(buffer,bToU->buffer_size(),path,args,va); reply(buffer); + va_end(va); } virtual void reply(const char *msg) { @@ -212,7 +213,9 @@ class DataObj:public rtosc::RtData reply("/broadcast"); char *buffer = bToU->buffer(); rtosc_vmessage(buffer,bToU->buffer_size(),path,args,va); - reply(buffer);} + reply(buffer); + va_end(va); + } virtual void broadcast(const char *msg) override { reply("/broadcast"); diff --git a/src/Misc/MiddleWare.cpp b/src/Misc/MiddleWare.cpp @@ -285,6 +285,7 @@ class DummyDataObj:public rtosc::RtData //printf("buffer = '%s'\n", buffer); reply(buffer); } + va_end(va); } virtual void reply(const char *msg) { @@ -357,7 +358,6 @@ struct NonRtObjStore { std::string base = "/part"+to_s(i)+"/kit"+to_s(j)+"/"; for(int k=0; k<NUM_VOICES; ++k) { - std::string base = "/part"+to_s(i)+"/kit"+to_s(j)+"/"; if(padpars) { objmap[base+"padpars/"] = padpars; objmap[base+"padpars/oscil/"] = padpars->oscilgen; @@ -1002,6 +1002,7 @@ void MiddleWareImpl::write(const char *path, const char *args, ...) va_list va; va_start(va, args); write(path, args, va); + va_end(va); } void MiddleWareImpl::write(const char *path, const char *args, va_list va) @@ -1048,6 +1049,7 @@ class UI_Interface:public Fl_Osc_Interface va_list va; va_start(va, args); impl->write(s.c_str(), args, va); + va_end(va); } void writeRaw(const char *msg) override @@ -1201,10 +1203,11 @@ class UI_Interface:public Fl_Osc_Interface void dumpLookupTable(void) { - if(map.size() != 0) + if(!map.empty()) { printf("Leaked controls:\n"); - for(auto i = map.begin(); i != map.end(); ++i) { - printf("Known control '%s' (%p)...\n", i->first.c_str(), i->second); + for(auto i = map.begin(); i != map.end(); ++i) { + printf("Known control '%s' (%p)...\n", i->first.c_str(), i->second); + } } } diff --git a/src/Misc/PresetExtractor.cpp b/src/Misc/PresetExtractor.cpp @@ -46,6 +46,7 @@ class Capture:public rtosc::RtData va_start(va,args); char *buffer = msgbuf; rtosc_vmessage(buffer,sizeof(msgbuf),path,args,va); + va_end(va); } char msgbuf[1024]; char locbuf[1024]; diff --git a/src/Misc/XMLwrapper.cpp b/src/Misc/XMLwrapper.cpp @@ -311,7 +311,7 @@ int XMLwrapper::loadXMLfile(const string &filename) mxmlDelete(tree); tree = NULL; - const char *xmldata = doloadfile(filename.c_str()); + const char *xmldata = doloadfile(filename); if(xmldata == NULL) return -1; //the file could not be loaded or uncompressed @@ -618,6 +618,7 @@ mxml_node_t *XMLwrapper::addparams(const char *name, unsigned int params, << ParamName << "=\"" << ParamValue << "\"" << endl; mxmlElementSetAttr(element, ParamName, ParamValue); } + va_end(variableList); } return element; } diff --git a/src/Nio/JackEngine.cpp b/src/Nio/JackEngine.cpp @@ -99,12 +99,11 @@ bool JackEngine::connectJack() connectServer(""); if(NULL != jackClient) { setBufferSize(jack_get_buffer_size(jackClient)); - int chk; jack_set_error_function(_errorCallback); jack_set_info_function(_infoCallback); if(jack_set_buffer_size_callback(jackClient, _bufferSizeCallback, this)) cerr << "Error setting the bufferSize callback" << endl; - if((chk = jack_set_xrun_callback(jackClient, _xrunCallback, this))) + if((jack_set_xrun_callback(jackClient, _xrunCallback, this))) cerr << "Error setting jack xrun callback" << endl; if(jack_set_process_callback(jackClient, _processCallback, this)) { cerr << "Error, JackEngine failed to set process callback" << endl; diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp @@ -1168,7 +1168,7 @@ void OscilGen::add2XML(XMLwrapper *xml) for(int i = 1; i < synth->oscilsize / 2; ++i) { float xc = basefuncFFTfreqs[i].real(); float xs = basefuncFFTfreqs[i].imag(); - if((fabs(xs) > 0.00001f) && (fabs(xs) > 0.00001f)) { + if((fabs(xs) > 0.00001f) && (fabs(xc) > 0.00001f)) { xml->beginbranch("BF_HARMONIC", i); xml->addparreal("cos", xc); xml->addparreal("sin", xs); diff --git a/src/UI/Connection.cpp b/src/UI/Connection.cpp @@ -158,6 +158,7 @@ void GUI::raiseUi(ui_handle_t gui, const char *dest, const char *args, ...) va_start(va,args); if(rtosc_vmessage(buffer,1024,dest,args,va)) raiseUi(gui, buffer); + va_end(va); } void GUI::tickUi(ui_handle_t) diff --git a/src/UI/Fl_Osc_Widget.cpp b/src/UI/Fl_Osc_Widget.cpp @@ -53,6 +53,8 @@ void Fl_Osc_Widget::oscWrite(std::string path, const char *args, ...) osc->writeRaw(buffer); else puts("Dangerous Event ommision"); + + va_end(va); ////Try to pretty print basic events //if(!strcmp(args, "c") || !strcmp(args, "i")) // printf("Args = ['%d']\n", rtosc_argument(buffer, 0).i);