From 4a55e1c46a4c1599c5ed12a730bed532f83284b6 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Fri, 9 Jan 2015 20:17:07 +0100 Subject: [PATCH] Performance and other fixes --- include/MainWindow.h | 4 ++-- include/PlayHandle.h | 2 ++ plugins/LadspaEffect/LadspaControlDialog.cpp | 2 +- plugins/LadspaEffect/calf/src/organ.cpp | 2 +- plugins/LadspaEffect/calf/src/synth.cpp | 12 ++++++------ plugins/LadspaEffect/calf/src/utils.cpp | 2 +- plugins/ladspa_browser/ladspa_description.cpp | 2 +- src/core/AutomationPattern.cpp | 6 +++--- src/core/Ladspa2LMMS.cpp | 2 +- src/core/LadspaManager.cpp | 2 +- src/core/Track.cpp | 4 ++-- src/core/audio/AudioFileOgg.cpp | 1 + src/gui/MainWindow.cpp | 4 ++-- src/gui/PluginBrowser.cpp | 4 ++-- 14 files changed, 26 insertions(+), 23 deletions(-) diff --git a/include/MainWindow.h b/include/MainWindow.h index f82a5db02..dd12c05a7 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -98,9 +98,9 @@ public: static void restoreWidgetState( QWidget * _w, const QDomElement & _de ); void collectErrors( const QList* errors ); - void collectError( const QString error ); + void collectError( const QString & error ); void clearErrors(); - void showErrors( const QString reason ); + void showErrors( const QString & reason ); public slots: diff --git a/include/PlayHandle.h b/include/PlayHandle.h index b96ec55ad..ea66cc65c 100644 --- a/include/PlayHandle.h +++ b/include/PlayHandle.h @@ -55,6 +55,8 @@ public: m_type = p.m_type; m_offset = p.m_offset; m_affinity = p.m_affinity; + m_usesBuffer = p.m_usesBuffer; + m_audioPort = p.m_audioPort; return *this; } diff --git a/plugins/LadspaEffect/LadspaControlDialog.cpp b/plugins/LadspaEffect/LadspaControlDialog.cpp index b84fc9b0b..2ea15f1f7 100644 --- a/plugins/LadspaEffect/LadspaControlDialog.cpp +++ b/plugins/LadspaEffect/LadspaControlDialog.cpp @@ -107,7 +107,7 @@ void LadspaControlDialog::updateEffectView( LadspaControls * _ctl ) grouper->setAlignment( Qt::Vertical ); for( control_list_t::iterator it = controls.begin(); - it != controls.end(); it++ ) + it != controls.end(); ++it ) { if( (*it)->port()->proc == proc ) { diff --git a/plugins/LadspaEffect/calf/src/organ.cpp b/plugins/LadspaEffect/calf/src/organ.cpp index fad15edb5..c90fc50bd 100644 --- a/plugins/LadspaEffect/calf/src/organ.cpp +++ b/plugins/LadspaEffect/calf/src/organ.cpp @@ -983,7 +983,7 @@ bool drawbar_organ::check_percussion() { void drawbar_organ::pitch_bend(int amt) { parameters->pitch_bend = pow(2.0, (amt * parameters->pitch_bend_range) / (1200.0 * 8192.0)); - for (list::iterator i = active_voices.begin(); i != active_voices.end(); i++) + for (list::iterator i = active_voices.begin(); i != active_voices.end(); ++i) { organ_voice *v = dynamic_cast(*i); v->update_pitch(); diff --git a/plugins/LadspaEffect/calf/src/synth.cpp b/plugins/LadspaEffect/calf/src/synth.cpp index fcda18b22..d7074a7c3 100644 --- a/plugins/LadspaEffect/calf/src/synth.cpp +++ b/plugins/LadspaEffect/calf/src/synth.cpp @@ -25,7 +25,7 @@ using namespace std; void basic_synth::kill_note(int note, int vel, bool just_one) { - for (list::iterator it = active_voices.begin(); it != active_voices.end(); it++) { + for (list::iterator it = active_voices.begin(); it != active_voices.end(); ++it) { // preserve sostenuto notes if ((*it)->get_current_note() == note && !(sostenuto && (*it)->sostenuto)) { (*it)->note_off(vel); @@ -58,7 +58,7 @@ dsp::voice *basic_synth::steal_voice() std::list::iterator found = active_voices.end(); float priority = 10000; //int idx = 0; - for(std::list::iterator i = active_voices.begin(); i != active_voices.end(); i++) + for(std::list::iterator i = active_voices.begin(); i != active_voices.end(); ++i) { //printf("Voice %d priority %f at %p\n", idx++, (*i)->get_priority(), *i); if ((*i)->get_priority() < priority) @@ -79,7 +79,7 @@ void basic_synth::trim_voices() { // count stealable voices unsigned int count = 0; - for(std::list::iterator i = active_voices.begin(); i != active_voices.end(); i++) + for(std::list::iterator i = active_voices.begin(); i != active_voices.end(); ++i) { if ((*i)->get_priority() < 10000) count++; @@ -118,7 +118,7 @@ void basic_synth::note_off(int note, int vel) kill_note(note, vel, false); } -#define for_all_voices(iter) for (std::list::iterator iter = active_voices.begin(); iter != active_voices.end(); iter++) +#define for_all_voices(iter) for (std::list::iterator iter = active_voices.begin(); iter != active_voices.end(); ++iter) void basic_synth::on_pedal_release() { @@ -204,7 +204,7 @@ void basic_synth::render_to(float (*output)[2], int nsamples) unused_voices.push(v); continue; } - i++; + ++i; } } @@ -214,7 +214,7 @@ basic_synth::~basic_synth() delete unused_voices.top(); unused_voices.pop(); } - for (list::iterator i = active_voices.begin(); i != active_voices.end(); i++) + for (list::iterator i = active_voices.begin(); i != active_voices.end(); ++i) delete *i; } diff --git a/plugins/LadspaEffect/calf/src/utils.cpp b/plugins/LadspaEffect/calf/src/utils.cpp index c1c3eaff2..5d5f33b87 100644 --- a/plugins/LadspaEffect/calf/src/utils.cpp +++ b/plugins/LadspaEffect/calf/src/utils.cpp @@ -33,7 +33,7 @@ string encode_map(const dictionary &data) osctl::string_buffer sb; osc_stream str(sb); str << (uint32_t)data.size(); - for(dictionary::const_iterator i = data.begin(); i != data.end(); i++) + for(dictionary::const_iterator i = data.begin(); i != data.end(); ++i) { str << i->first << i->second; } diff --git a/plugins/ladspa_browser/ladspa_description.cpp b/plugins/ladspa_browser/ladspa_description.cpp index 76efcb182..fd00fb587 100644 --- a/plugins/ladspa_browser/ladspa_description.cpp +++ b/plugins/ladspa_browser/ladspa_description.cpp @@ -70,7 +70,7 @@ ladspaDescription::ladspaDescription( QWidget * _parent, QList pluginNames; for( l_sortable_plugin_t::iterator it = plugins.begin(); - it != plugins.end(); it++ ) + it != plugins.end(); ++it ) { if( _type != VALID || manager->getDescription( ( *it ).second )->inputChannels diff --git a/src/core/AutomationPattern.cpp b/src/core/AutomationPattern.cpp index 7420645e9..9185839a4 100644 --- a/src/core/AutomationPattern.cpp +++ b/src/core/AutomationPattern.cpp @@ -195,7 +195,7 @@ MidiTime AutomationPattern::putValue( const MidiTime & _time, timeMap::const_iterator it = m_timeMap.find( newTime ); if( it != m_timeMap.begin() ) { - it--; + --it; } generateTangents(it, 3); @@ -229,7 +229,7 @@ void AutomationPattern::removeValue( const MidiTime & _time, timeMap::const_iterator it = m_timeMap.lowerBound( newTime ); if( it != m_timeMap.begin() ) { - it--; + --it; } generateTangents(it, 3); @@ -271,7 +271,7 @@ MidiTime AutomationPattern::setDragValue( const MidiTime & _time, const float _v //Restore to the state before it the point were being dragged m_timeMap = m_oldTimeMap; - for( timeMap::const_iterator it = m_timeMap.begin(); it != m_timeMap.end(); it++ ) + for( timeMap::const_iterator it = m_timeMap.begin(); it != m_timeMap.end(); ++it ) { generateTangents(it, 3); } diff --git a/src/core/Ladspa2LMMS.cpp b/src/core/Ladspa2LMMS.cpp index 08489beff..7f8e4d67f 100644 --- a/src/core/Ladspa2LMMS.cpp +++ b/src/core/Ladspa2LMMS.cpp @@ -32,7 +32,7 @@ Ladspa2LMMS::Ladspa2LMMS() l_sortable_plugin_t plugins = getSortedPlugins(); for( l_sortable_plugin_t::iterator it = plugins.begin(); - it != plugins.end(); it++ ) + it != plugins.end(); ++it ) { ladspa_key_t key = (*it).second; ladspaManagerDescription * desc = getDescription( key ); diff --git a/src/core/LadspaManager.cpp b/src/core/LadspaManager.cpp index 50e791b9e..8dcb20158 100644 --- a/src/core/LadspaManager.cpp +++ b/src/core/LadspaManager.cpp @@ -96,7 +96,7 @@ LadspaManager::LadspaManager() l_ladspa_key_t keys = m_ladspaManagerMap.keys(); for( l_ladspa_key_t::iterator it = keys.begin(); - it != keys.end(); it++ ) + it != keys.end(); ++it ) { m_sortedPlugins.append( qMakePair( getName( *it ), *it ) ); } diff --git a/src/core/Track.cpp b/src/core/Track.cpp index 7ee6c1f59..63fe1729c 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -1774,7 +1774,7 @@ void TrackOperationsWidget::recordingOn() if( atv ) { const Track::tcoVector & tcov = atv->getTrack()->getTCOs(); - for( Track::tcoVector::const_iterator it = tcov.begin(); it != tcov.end(); it++ ) + for( Track::tcoVector::const_iterator it = tcov.begin(); it != tcov.end(); ++it ) { AutomationPattern * ap = dynamic_cast( *it ); if( ap ) { ap->setRecording( true ); } @@ -1790,7 +1790,7 @@ void TrackOperationsWidget::recordingOff() if( atv ) { const Track::tcoVector & tcov = atv->getTrack()->getTCOs(); - for( Track::tcoVector::const_iterator it = tcov.begin(); it != tcov.end(); it++ ) + for( Track::tcoVector::const_iterator it = tcov.begin(); it != tcov.end(); ++it ) { AutomationPattern * ap = dynamic_cast( *it ); if( ap ) { ap->setRecording( false ); } diff --git a/src/core/audio/AudioFileOgg.cpp b/src/core/audio/AudioFileOgg.cpp index 72efe883c..798418bf2 100644 --- a/src/core/audio/AudioFileOgg.cpp +++ b/src/core/audio/AudioFileOgg.cpp @@ -120,6 +120,7 @@ bool AudioFileOgg::startEncoding() printf( "Mode initialization failed: invalid parameters for " "bitrate\n" ); vorbis_info_clear( &m_vi ); + delete[] user_comments; return false; } diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index e5d00f35c..13f98d74b 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1211,7 +1211,7 @@ void MainWindow::collectErrors(const QList* errors ) -void MainWindow::collectError( const QString error ) +void MainWindow::collectError( const QString & error ) { m_errors->append( error ); } @@ -1225,7 +1225,7 @@ void MainWindow::clearErrors() -void MainWindow::showErrors( const QString message ) +void MainWindow::showErrors( const QString & message ) { if ( m_errors->length() != 0 ) { QString* errors = new QString(); diff --git a/src/gui/PluginBrowser.cpp b/src/gui/PluginBrowser.cpp index e87eac326..5c10dd368 100644 --- a/src/gui/PluginBrowser.cpp +++ b/src/gui/PluginBrowser.cpp @@ -99,8 +99,8 @@ PluginDescList::PluginDescList(QWidget *parent) : std::sort(m_pluginDescriptors.begin(), m_pluginDescriptors.end(), pluginBefore); - for(Plugin::DescriptorList::const_iterator it = m_pluginDescriptors.constBegin(); - it != m_pluginDescriptors.constEnd(); it++) + for( Plugin::DescriptorList::const_iterator it = m_pluginDescriptors.constBegin(); + it != m_pluginDescriptors.constEnd(); ++it ) { if( it->type == Plugin::Instrument ) {