Skip to content

Commit

Permalink
Fix TripleOscillator preset previewing due to nonexistent waveform files
Browse files Browse the repository at this point in the history
  • Loading branch information
PhysSong committed Oct 17, 2018
1 parent b243160 commit 2efd265
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/SampleBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class LMMS_EXPORT SampleBuffer : public QObject, public JournallingObject


public slots:
void setAudioFile( const QString & _audio_file );
void setAudioFile(const QString & audioFile , bool ignoreError = false);
void setStartFrame( const f_cnt_t _s );
void setEndFrame( const f_cnt_t _e );
void setAmplification( float _a );
Expand All @@ -335,7 +335,7 @@ public slots:
return const_cast<sampleFrame*>(ptr);
}

void changeAudioFile (QString audioFile);
void changeAudioFile (QString audioFile, bool ignoreError);

static DataVector convertIntToFloat(int_sample_t * & _ibuf, f_cnt_t _frames, int _channels);

Expand Down
2 changes: 1 addition & 1 deletion plugins/triple_oscillator/TripleOscillator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void TripleOscillator::loadSettings( const QDomElement & _this )
m_osc[i]->m_modulationAlgoModel.loadSettings( _this,
"modalgo" + QString::number( i+1 ) );
m_osc[i]->m_sampleBuffer->setAudioFile( _this.attribute(
"userwavefile" + is ) );
"userwavefile" + is ), true );
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/core/SampleBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ sample_rate_t SampleBuffer::mixerSampleRate()
return Engine::mixer ()->processingSampleRate ();
}

void SampleBuffer::changeAudioFile(QString audioFile)
void SampleBuffer::changeAudioFile(QString audioFile, bool ignoreError)
{
if (audioFile == "")
return;
Expand Down Expand Up @@ -214,7 +214,7 @@ void SampleBuffer::changeAudioFile(QString audioFile)

if (! fileLoadError) {
resetData (std::move(fileData), samplerate);
} else {
} else if (!ignoreError) {
QString title = tr( "Fail to open file" );
QString message = tr( "Audio files are limited to %1 MB "
"in size and %2 minutes of playing time"
Expand Down Expand Up @@ -1016,10 +1016,10 @@ QString & SampleBuffer::toBase64( QString & _dst ) const
}


void SampleBuffer::setAudioFile( const QString & _audio_file )
void SampleBuffer::setAudioFile(const QString & audioFile, bool ignoreError )
{
m_audioFile = tryToMakeRelative(_audio_file);
changeAudioFile (_audio_file);
m_audioFile = tryToMakeRelative(audioFile);
changeAudioFile (audioFile, ignoreError);
}


Expand Down

0 comments on commit 2efd265

Please sign in to comment.