mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 23:09:26 -05:00
Provide AudioOutput::set_stream().
Assign when wanting to capture audio stream.
This commit is contained in:
parent
7436dea51a
commit
67eb62ec12
@ -96,8 +96,8 @@ void AudioOutput::fill_audio_buffer(const buffer_f32_t& audio, const bool send_t
|
|||||||
audio_buffer.p[i].left = audio_buffer.p[i].right = sample_saturated;
|
audio_buffer.p[i].left = audio_buffer.p[i].right = sample_saturated;
|
||||||
audio_int[i] = sample_saturated;
|
audio_int[i] = sample_saturated;
|
||||||
}
|
}
|
||||||
if( send_to_fifo ) {
|
if( stream && send_to_fifo ) {
|
||||||
stream.write(audio_int.data(), audio_buffer.count * sizeof(audio_int[0]));
|
stream->write(audio_int.data(), audio_buffer.count * sizeof(audio_int[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
feed_audio_stats(audio);
|
feed_audio_stats(audio);
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "audio_stats_collector.hpp"
|
#include "audio_stats_collector.hpp"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class AudioOutput {
|
class AudioOutput {
|
||||||
public:
|
public:
|
||||||
@ -44,6 +45,10 @@ public:
|
|||||||
void write(const buffer_s16_t& audio);
|
void write(const buffer_s16_t& audio);
|
||||||
void write(const buffer_f32_t& audio);
|
void write(const buffer_f32_t& audio);
|
||||||
|
|
||||||
|
void set_stream(std::unique_ptr<StreamInput> new_stream) {
|
||||||
|
stream = std::move(new_stream);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr float k = 32768.0f;
|
static constexpr float k = 32768.0f;
|
||||||
static constexpr float ki = 1.0f / k;
|
static constexpr float ki = 1.0f / k;
|
||||||
@ -54,7 +59,7 @@ private:
|
|||||||
IIRBiquadFilter deemph;
|
IIRBiquadFilter deemph;
|
||||||
FMSquelch squelch;
|
FMSquelch squelch;
|
||||||
|
|
||||||
StreamInput stream { 14 };
|
std::unique_ptr<StreamInput> stream;
|
||||||
|
|
||||||
AudioStatsCollector audio_stats;
|
AudioStatsCollector audio_stats;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user