From f9692b76a1d23e26e9c7f5ac175f1cf2a3346c84 Mon Sep 17 00:00:00 2001 From: "michal.szwaj" Date: Sun, 25 Mar 2018 11:51:17 +0200 Subject: [PATCH] Revert last commit --- .../autoapp/Projection/RtAudioOutput.hpp | 1 - src/autoapp/Projection/RtAudioOutput.cpp | 17 +++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/include/f1x/openauto/autoapp/Projection/RtAudioOutput.hpp b/include/f1x/openauto/autoapp/Projection/RtAudioOutput.hpp index 4aae81b5..f3d69d5f 100644 --- a/include/f1x/openauto/autoapp/Projection/RtAudioOutput.hpp +++ b/include/f1x/openauto/autoapp/Projection/RtAudioOutput.hpp @@ -55,7 +55,6 @@ class RtAudioOutput: public IAudioOutput SequentialBuffer audioBuffer_; std::unique_ptr dac_; std::mutex mutex_; - bool playbackRequested_; }; } diff --git a/src/autoapp/Projection/RtAudioOutput.cpp b/src/autoapp/Projection/RtAudioOutput.cpp index 0da5cfb8..e0d70371 100644 --- a/src/autoapp/Projection/RtAudioOutput.cpp +++ b/src/autoapp/Projection/RtAudioOutput.cpp @@ -32,7 +32,6 @@ RtAudioOutput::RtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_ : channelCount_(channelCount) , sampleSize_(sampleSize) , sampleRate_(sampleRate) - , playbackRequested_(false) { std::vector apis; RtAudio::getCompiledApi(apis); @@ -55,7 +54,7 @@ bool RtAudioOutput::open() RtAudio::StreamOptions streamOptions; streamOptions.numberOfBuffers = 1; streamOptions.flags = RTAUDIO_MINIMIZE_LATENCY | RTAUDIO_SCHEDULE_REALTIME; - uint32_t bufferFrames = 256; + uint32_t bufferFrames = 64; dac_->openStream(¶meters, nullptr, RTAUDIO_SINT16, sampleRate_, &bufferFrames, &RtAudioOutput::audioBufferReadHandler, static_cast(this), &streamOptions); return audioBuffer_.open(QIODevice::ReadWrite); } @@ -75,10 +74,13 @@ bool RtAudioOutput::open() void RtAudioOutput::write(const aasdk::common::DataConstBuffer& buffer) { audioBuffer_.write(reinterpret_cast(buffer.cdata), buffer.size); +} +void RtAudioOutput::start() +{ std::lock_guard lock(mutex_); - if(playbackRequested_ && dac_->isStreamOpen() && !dac_->isStreamRunning()) + if(dac_->isStreamOpen() && !dac_->isStreamRunning()) { try { @@ -89,15 +91,6 @@ void RtAudioOutput::write(const aasdk::common::DataConstBuffer& buffer) OPENAUTO_LOG(error) << "[RtAudioOutput] Failed to start audio output, what: " << e.what(); } } - - playbackRequested_ = false; -} - -void RtAudioOutput::start() -{ - std::lock_guard lock(mutex_); - - playbackRequested_ = true; } void RtAudioOutput::stop()