diff --git a/include/PianoRoll.h b/include/PianoRoll.h index 8421392c3..5859594f6 100644 --- a/include/PianoRoll.h +++ b/include/PianoRoll.h @@ -283,6 +283,7 @@ private: QList m_markedSemiTones; QMenu * m_semiToneMarkerMenu; // when you right click on the key area + int m_pianoKeySelected; PianoRoll(); PianoRoll( const PianoRoll & ); diff --git a/plugins/Amplifier/Amplifier.cpp b/plugins/Amplifier/Amplifier.cpp index d90ea55b3..cc2a63304 100644 --- a/plugins/Amplifier/Amplifier.cpp +++ b/plugins/Amplifier/Amplifier.cpp @@ -83,7 +83,6 @@ bool AmplifierEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) for( fpp_t f = 0; f < frames; ++f ) { // qDebug( "offset %d, value %f", f, m_ampControls.m_volumeModel.value( f ) ); - outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1]; sample_t s[2] = { buf[f][0], buf[f][1] }; @@ -123,6 +122,7 @@ bool AmplifierEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) buf[f][0] = d * buf[f][0] + w * s[0]; buf[f][1] = d * buf[f][1] + w * s[1]; + outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1]; } checkGate( outSum / frames ); diff --git a/plugins/BassBooster/BassBooster.cpp b/plugins/BassBooster/BassBooster.cpp index 6fdb1671c..535834aae 100644 --- a/plugins/BassBooster/BassBooster.cpp +++ b/plugins/BassBooster/BassBooster.cpp @@ -100,13 +100,13 @@ bool BassBoosterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames //float gain = gainBuffer ? gainBuffer[f] : gain; m_bbFX.leftFX().setGain( gain ); m_bbFX.rightFX().setGain( gain); - outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1]; sample_t s[2] = { buf[f][0], buf[f][1] }; m_bbFX.nextSample( s[0], s[1] ); buf[f][0] = d * buf[f][0] + w * s[0]; buf[f][1] = d * buf[f][1] + w * s[1]; + outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1]; } checkGate( outSum / frames ); diff --git a/plugins/CrossoverEQ/CrossoverEQ.cpp b/plugins/CrossoverEQ/CrossoverEQ.cpp index e7d3dce7d..e2090980a 100644 --- a/plugins/CrossoverEQ/CrossoverEQ.cpp +++ b/plugins/CrossoverEQ/CrossoverEQ.cpp @@ -191,12 +191,12 @@ bool CrossoverEQEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames double outSum = 0.0; for( int f = 0; f < frames; ++f ) { - outSum = buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1]; buf[f][0] = d * buf[f][0] + w * m_work[f][0]; buf[f][1] = d * buf[f][1] + w * m_work[f][1]; + outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1]; } - checkGate( outSum ); + checkGate( outSum / frames ); return isRunning(); } diff --git a/plugins/DualFilter/DualFilter.cpp b/plugins/DualFilter/DualFilter.cpp index 5b8b7a622..b4e11ccb3 100644 --- a/plugins/DualFilter/DualFilter.cpp +++ b/plugins/DualFilter/DualFilter.cpp @@ -193,11 +193,11 @@ bool DualFilterEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames s[0] += ( s2[0] * mix2 ); s[1] += ( s2[1] * mix2 ); } - outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1]; // do another mix with dry signal buf[f][0] = d * buf[f][0] + w * s[0]; buf[f][1] = d * buf[f][1] + w * s[1]; + outSum += buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1]; //increment pointers cut1Ptr += cut1Inc; diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index 7a6eb66ac..c8850392e 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -253,17 +253,16 @@ void audioFileProcessor::loadSettings( const QDomElement & _this ) m_loopModel.loadSettings( _this, "looped" ); m_ampModel.loadSettings( _this, "amp" ); m_endPointModel.loadSettings( _this, "eframe" ); + m_startPointModel.loadSettings( _this, "sframe" ); // compat code for not having a separate loopback point - if( _this.hasAttribute( "lframe" ) ) + if (_this.hasAttribute("lframe") || !(_this.firstChildElement("lframe").isNull())) { m_loopPointModel.loadSettings( _this, "lframe" ); - m_startPointModel.loadSettings( _this, "sframe" ); } else { m_loopPointModel.loadSettings( _this, "sframe" ); - m_startPointModel.setValue( m_loopPointModel.value() ); } m_reverseModel.loadSettings( _this, "reversed" ); diff --git a/plugins/dynamics_processor/dynamics_processor.cpp b/plugins/dynamics_processor/dynamics_processor.cpp index 8c02b827d..9bf7d9b3c 100644 --- a/plugins/dynamics_processor/dynamics_processor.cpp +++ b/plugins/dynamics_processor/dynamics_processor.cpp @@ -215,10 +215,10 @@ bool dynProcEffect::processAudioBuffer( sampleFrame * _buf, s[0] *= outputGain; s[1] *= outputGain; - out_sum += _buf[f][0]*_buf[f][0] + _buf[f][1]*_buf[f][1]; // mix wet/dry signals _buf[f][0] = d * _buf[f][0] + w * s[0]; _buf[f][1] = d * _buf[f][1] + w * s[1]; + out_sum += _buf[f][0] * _buf[f][0] + _buf[f][1] * _buf[f][1]; } checkGate( out_sum / _frames ); diff --git a/plugins/waveshaper/waveshaper.cpp b/plugins/waveshaper/waveshaper.cpp index 3f9d3e19f..a3bf2ddfb 100644 --- a/plugins/waveshaper/waveshaper.cpp +++ b/plugins/waveshaper/waveshaper.cpp @@ -140,10 +140,10 @@ bool waveShaperEffect::processAudioBuffer( sampleFrame * _buf, s[0] *= *outputPtr; s[1] *= *outputPtr; - out_sum += _buf[f][0]*_buf[f][0] + _buf[f][1]*_buf[f][1]; // mix wet/dry signals _buf[f][0] = d * _buf[f][0] + w * s[0]; _buf[f][1] = d * _buf[f][1] + w * s[1]; + out_sum += _buf[f][0] * _buf[f][0] + _buf[f][1] * _buf[f][1]; outputPtr += outputInc; inputPtr += inputInc; diff --git a/src/3rdparty/CMakeLists.txt b/src/3rdparty/CMakeLists.txt index bdc4a4d86..808298e79 100644 --- a/src/3rdparty/CMakeLists.txt +++ b/src/3rdparty/CMakeLists.txt @@ -1,8 +1,3 @@ -set(CMAKE_C_FLAGS "") -set(CMAKE_CXX_FLAGS "") -set(CMAKE_C_FLAGS_DEBUG "") -set(CMAKE_CXX_FLAGS_DEBUG "") - IF(LMMS_BUILD_LINUX AND WANT_VST) set(BUILD_SHARED_LIBS OFF) add_subdirectory(qt5-x11embed) diff --git a/src/3rdparty/rpmalloc/CMakeLists.txt b/src/3rdparty/rpmalloc/CMakeLists.txt index 23d1551c2..da6e7223e 100644 --- a/src/3rdparty/rpmalloc/CMakeLists.txt +++ b/src/3rdparty/rpmalloc/CMakeLists.txt @@ -1,4 +1,4 @@ -set(CMAKE_C_FLAGS "-std=c11") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -Wno-unused-variable") add_library(rpmalloc STATIC rpmalloc/rpmalloc/rpmalloc.c diff --git a/src/core/DrumSynth.cpp b/src/core/DrumSynth.cpp index c41de1fd4..859fe403f 100644 --- a/src/core/DrumSynth.cpp +++ b/src/core/DrumSynth.cpp @@ -325,6 +325,8 @@ int DrumSynth::GetDSFileSamples(QString dsfile, int16_t *&wave, int channels, sa timestretch = .01f * mem_time * GetPrivateProfileFloat(sec,"Stretch",100.0,dsfile); if(timestretch<0.2f) timestretch=0.2f; if(timestretch>10.f) timestretch=10.f; + // the unit of envelope lengths is a sample in 44100Hz sample rate, so correct it + timestretch *= Fs / 44100.f; DGain = 1.0f; //leave this here! DGain = (float)powf(10.0, 0.05 * GetPrivateProfileFloat(sec,"Level",0,dsfile)); diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 0eb5df163..4682b3f20 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -521,7 +521,7 @@ void PianoRoll::changeNoteEditMode( int i ) void PianoRoll::markSemiTone( int i ) { - const int key = getKey( mapFromGlobal( m_semiToneMarkerMenu->pos() ).y() ); + const int key = m_pianoKeySelected; const InstrumentFunctionNoteStacking::Chord * chord = nullptr; switch( static_cast( i ) ) @@ -1868,6 +1868,7 @@ void PianoRoll::mousePressEvent(QMouseEvent * me ) if( me->buttons() == Qt::RightButton ) { // right click - tone marker contextual menu + m_pianoKeySelected = getKey( me->y() ); m_semiToneMarkerMenu->popup( mapToGlobal( QPoint( me->x(), me->y() ) ) ); } else if( me->buttons() == Qt::LeftButton ) @@ -1938,8 +1939,9 @@ void PianoRoll::mouseDoubleClickEvent(QMouseEvent * me ) { const Note * closest = NULL; int closest_dist = 9999999; - // if we caught multiple notes, find the closest... - if( nv.size() > 1 ) + // if we caught multiple notes and we're not editing a + // selection, find the closest... + if( nv.size() > 1 && !isSelection() ) { for ( const Note * i : nv ) { @@ -2870,7 +2872,12 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) break; } // start drawing at the bottom - int key_line_y = keyAreaBottom() - 1; + int key_line_y = qMin(keyAreaBottom() - 1, m_keyLineHeight * NumKeys); + // we need to set m_notesEditHeight here because it needs to fill in the + // rest of the window if key_line_y is bound to m_keyLineHeight * NumKeys + if (key_line_y == m_keyLineHeight * NumKeys) { + m_notesEditHeight = height() - (PR_TOP_MARGIN + m_keyLineHeight * NumKeys); + } // used for aligning black-keys later int first_white_key_height = m_whiteKeySmallHeight; // key-counter - only needed for finding out whether the processed @@ -2996,9 +3003,10 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) key = m_startKey; keys_processed = 0; int white_cnt = 0; + key_line_y = qMin(keyAreaBottom(), m_keyLineHeight * NumKeys); // and go! - for( int y = keyAreaBottom() + y_offset; + for( int y = key_line_y + y_offset; y > PR_TOP_MARGIN; ++keys_processed ) { // check for black key that is only half visible on the bottom @@ -3064,16 +3072,16 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) // erase the area below the piano, because there might be keys that // should be only half-visible - p.fillRect( QRect( 0, keyAreaBottom(), - WHITE_KEY_WIDTH, noteEditBottom() - keyAreaBottom() ), bgColor ); + p.fillRect( QRect( 0, key_line_y, + WHITE_KEY_WIDTH, noteEditBottom() - key_line_y ), bgColor ); // display note editing info QFont f = p.font(); f.setBold( false ); p.setFont( pointSize<10>( f ) ); p.setPen( noteModeColor() ); - p.drawText( QRect( 0, keyAreaBottom(), - WHITE_KEY_WIDTH, noteEditBottom() - keyAreaBottom() ), + p.drawText( QRect( 0, key_line_y, + WHITE_KEY_WIDTH, noteEditBottom() - key_line_y ), Qt::AlignCenter | Qt::TextWordWrap, m_nemStr.at( m_noteEditMode ) + ":" ); @@ -3114,7 +3122,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) // Draw horizontal lines key = m_startKey; - for( int y = keyAreaBottom() - 1; y > PR_TOP_MARGIN; + for( int y = key_line_y - 1; y > PR_TOP_MARGIN; y -= m_keyLineHeight ) { if( static_cast( key % KeysPerOctave ) == Key_C ) @@ -3173,10 +3181,10 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) for( int i = 0; i < m_markedSemiTones.size(); i++ ) { const int key_num = m_markedSemiTones.at( i ); - const int y = keyAreaBottom() + 5 + const int y = key_line_y + 5 - m_keyLineHeight * ( key_num - m_startKey + 1 ); - if( y > keyAreaBottom() ) + if( y > key_line_y ) { break; } @@ -3204,14 +3212,14 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) qSwap( sel_key_start, sel_key_end ); } - int y_base = keyAreaBottom() - 1; + int y_base = key_line_y - 1; if( hasValidPattern() ) { p.setClipRect( WHITE_KEY_WIDTH, PR_TOP_MARGIN, width() - WHITE_KEY_WIDTH, height() - PR_TOP_MARGIN ); - const int visible_keys = ( keyAreaBottom()-keyAreaTop() ) / + const int visible_keys = ( key_line_y-keyAreaTop() ) / m_keyLineHeight + 2; QPolygonF editHandles; @@ -3438,13 +3446,13 @@ void PianoRoll::paintEvent(QPaintEvent * pe ) if( hasValidPattern() ) { int key_num = getKey( mapFromGlobal( QCursor::pos() ).y() ); - p.fillRect( 10, keyAreaBottom() + 3 - m_keyLineHeight * + p.fillRect( 10, key_line_y + 3 - m_keyLineHeight * ( key_num - m_startKey + 1 ), width() - 10, m_keyLineHeight - 7, currentKeyCol ); } // bar to resize note edit area p.setClipRect( 0, 0, width(), height() ); - p.fillRect( QRect( 0, keyAreaBottom(), + p.fillRect( QRect( 0, key_line_y, width()-PR_RIGHT_MARGIN, NOTE_EDIT_RESIZE_BAR ), editAreaCol ); const QPixmap * cursor = NULL;