diff --git a/src/core/source/AudioSourceClipSeries.cpp b/src/core/source/AudioSourceClipSeries.cpp index ecf2396..69f7184 100644 --- a/src/core/source/AudioSourceClipSeries.cpp +++ b/src/core/source/AudioSourceClipSeries.cpp @@ -94,6 +94,7 @@ namespace talcs { bool AudioSourceClipSeries::open(qint64 bufferSize, double sampleRate) { Q_D(AudioSourceClipSeries); QMutexLocker locker(&d->mutex); + AudioSource::close(); if (d->openAllClips(bufferSize, sampleRate)) return AudioSource::open(bufferSize, sampleRate); return false; diff --git a/src/core/source/BufferingAudioSource.cpp b/src/core/source/BufferingAudioSource.cpp index b91d547..944c743 100644 --- a/src/core/source/BufferingAudioSource.cpp +++ b/src/core/source/BufferingAudioSource.cpp @@ -132,6 +132,7 @@ namespace talcs { bool BufferingAudioSource::open(qint64 bufferSize, double sampleRate) { Q_D(BufferingAudioSource); QMutexLocker locker(&d->mutex); + AudioSource::close(); flush(); if (!d->src->open(bufferSize, sampleRate)) return false; diff --git a/src/core/source/FutureAudioSource.cpp b/src/core/source/FutureAudioSource.cpp index d551252..5799b87 100644 --- a/src/core/source/FutureAudioSource.cpp +++ b/src/core/source/FutureAudioSource.cpp @@ -174,6 +174,7 @@ namespace talcs { bool FutureAudioSource::open(qint64 bufferSize, double sampleRate) { Q_D(FutureAudioSource); QMutexLocker locker(&d->mutex); + AudioSource::close(); switch (status()) { case Running: case Paused: diff --git a/src/core/source/FutureAudioSourceClipSeries.cpp b/src/core/source/FutureAudioSourceClipSeries.cpp index 396628e..38070f0 100644 --- a/src/core/source/FutureAudioSourceClipSeries.cpp +++ b/src/core/source/FutureAudioSourceClipSeries.cpp @@ -164,6 +164,7 @@ namespace talcs { bool FutureAudioSourceClipSeries::open(qint64 bufferSize, double sampleRate) { Q_D(FutureAudioSourceClipSeries); QMutexLocker locker(&d->mutex); + AudioSource::close(); if (d->openAllClips(bufferSize, sampleRate)) return AudioSource::open(bufferSize, sampleRate); return false; diff --git a/src/core/source/MetronomeAudioSource.cpp b/src/core/source/MetronomeAudioSource.cpp index 60368a5..47b475f 100644 --- a/src/core/source/MetronomeAudioSource.cpp +++ b/src/core/source/MetronomeAudioSource.cpp @@ -79,6 +79,7 @@ namespace talcs { bool MetronomeAudioSource::open(qint64 bufferSize, double sampleRate) { Q_D(MetronomeAudioSource); QMutexLocker locker(&d->mutex); + AudioSource::close(); if (d->majorBeatSource) if (!d->majorBeatSource->open(bufferSize, sampleRate)) return false; diff --git a/src/core/source/MixerAudioSource.cpp b/src/core/source/MixerAudioSource.cpp index 6943709..48f61e2 100644 --- a/src/core/source/MixerAudioSource.cpp +++ b/src/core/source/MixerAudioSource.cpp @@ -60,6 +60,7 @@ namespace talcs { bool MixerAudioSource::open(qint64 bufferSize, double sampleRate) { Q_D(MixerAudioSource); QMutexLocker locker(&d->mutex); + AudioSource::close(); if (d->start(bufferSize, sampleRate)) { return AudioSource::open(bufferSize, sampleRate); } else { diff --git a/src/core/source/NoteSynthesizer.cpp b/src/core/source/NoteSynthesizer.cpp index f14672f..12e46d2 100644 --- a/src/core/source/NoteSynthesizer.cpp +++ b/src/core/source/NoteSynthesizer.cpp @@ -339,6 +339,7 @@ namespace talcs { bool NoteSynthesizer::open(qint64 bufferSize, double sampleRate) { Q_D(NoteSynthesizer); + AudioSource::close(); flush(true); return AudioSource::open(bufferSize, sampleRate); } diff --git a/src/core/source/PositionableMixerAudioSource.cpp b/src/core/source/PositionableMixerAudioSource.cpp index b261023..7c49cbc 100644 --- a/src/core/source/PositionableMixerAudioSource.cpp +++ b/src/core/source/PositionableMixerAudioSource.cpp @@ -61,6 +61,7 @@ namespace talcs { Q_D(PositionableMixerAudioSource); QMutexLocker locker(&d->mutex); d->stop(); + AudioSource::close(); if (d->start(bufferSize, sampleRate)) { d->setNextReadPositionToAll(d->position); return PositionableAudioSource::open(bufferSize, sampleRate); diff --git a/src/core/source/SineWaveAudioSource.cpp b/src/core/source/SineWaveAudioSource.cpp index 1dc9e0c..0e59ce0 100644 --- a/src/core/source/SineWaveAudioSource.cpp +++ b/src/core/source/SineWaveAudioSource.cpp @@ -49,10 +49,6 @@ namespace talcs { setFrequency(frequencyIntegration); } - bool SineWaveAudioSource::open(qint64 bufferSize, double sampleRate) { - return AudioSource::open(bufferSize, sampleRate); - } - qint64 SineWaveAudioSource::processReading(const AudioSourceReadData &readData) { Q_D(SineWaveAudioSource); QMutexLocker locker(&d->mutex); diff --git a/src/core/source/SineWaveAudioSource.h b/src/core/source/SineWaveAudioSource.h index 4483c13..080d48c 100644 --- a/src/core/source/SineWaveAudioSource.h +++ b/src/core/source/SineWaveAudioSource.h @@ -35,7 +35,6 @@ namespace talcs { explicit SineWaveAudioSource(const std::function &frequencyIntegration); ~SineWaveAudioSource() override = default; - bool open(qint64 bufferSize, double sampleRate) override; qint64 length() const override; void setFrequency(double frequency); diff --git a/src/core/source/TransportAudioSource.cpp b/src/core/source/TransportAudioSource.cpp index 42464d4..514565d 100644 --- a/src/core/source/TransportAudioSource.cpp +++ b/src/core/source/TransportAudioSource.cpp @@ -122,6 +122,7 @@ namespace talcs { bool TransportAudioSource::open(qint64 bufferSize, double sampleRate) { Q_D(TransportAudioSource); QMutexLocker locker(&d->mutex); + AudioSource::close(); d->playbackStatus = Paused; if (d->src && !d->src->open(bufferSize, sampleRate)) { return false; diff --git a/src/format/source/AudioFormatInputSource.cpp b/src/format/source/AudioFormatInputSource.cpp index d133ad8..e7b90c9 100644 --- a/src/format/source/AudioFormatInputSource.cpp +++ b/src/format/source/AudioFormatInputSource.cpp @@ -117,6 +117,7 @@ namespace talcs { bool AudioFormatInputSource::open(qint64 bufferSize, double sampleRate) { Q_D(AudioFormatInputSource); QMutexLocker locker(&d->mutex); + AudioSource::close(); if (!d->io) return false; if (d->io->open(AbstractAudioFormatIO::Read)) { diff --git a/src/midi/integrator/AbstractMidiMessageIntegrator.cpp b/src/midi/integrator/AbstractMidiMessageIntegrator.cpp index a1c39b3..db75e86 100644 --- a/src/midi/integrator/AbstractMidiMessageIntegrator.cpp +++ b/src/midi/integrator/AbstractMidiMessageIntegrator.cpp @@ -35,6 +35,7 @@ namespace talcs { bool AbstractMidiMessageIntegrator::open(qint64 bufferSize, double sampleRate) { Q_D(AbstractMidiMessageIntegrator); QMutexLocker locker(&d->mutex); + AudioSource::close(); if (d->stream && !d->stream->open(bufferSize, sampleRate)) return false; return AudioSource::open(bufferSize, sampleRate); diff --git a/src/midi/integrator/AudioMidiStream.cpp b/src/midi/integrator/AudioMidiStream.cpp index 4b141fe..a197006 100644 --- a/src/midi/integrator/AudioMidiStream.cpp +++ b/src/midi/integrator/AudioMidiStream.cpp @@ -32,6 +32,7 @@ namespace talcs { bool AudioMidiStream::open(qint64 bufferSize, double sampleRate) { Q_D(AudioMidiStream); QMutexLocker locker(&d->filterMutex); + AudioStreamBase::close(); if (d->filter.loadRelaxed() && !d->filter.loadRelaxed()->open(bufferSize, sampleRate)) { return false; }