mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-02-03 10:00:12 -05:00
Pass CaptureConfig to StreamInput as pointer.
This commit is contained in:
parent
ca5dadab93
commit
3e08318012
@ -100,7 +100,7 @@ void NarrowbandAMAudio::configure(const AMConfigureMessage& message) {
|
||||
|
||||
void NarrowbandAMAudio::capture_config(const CaptureConfigMessage& message) {
|
||||
if( message.config ) {
|
||||
audio_output.set_stream(std::make_unique<StreamInput>(*message.config));
|
||||
audio_output.set_stream(std::make_unique<StreamInput>(message.config));
|
||||
} else {
|
||||
audio_output.set_stream(nullptr);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ void CaptureProcessor::on_message(const Message* const message) {
|
||||
|
||||
void CaptureProcessor::capture_config(const CaptureConfigMessage& message) {
|
||||
if( message.config ) {
|
||||
stream = std::make_unique<StreamInput>(*message.config);
|
||||
stream = std::make_unique<StreamInput>(message.config);
|
||||
} else {
|
||||
stream.reset();
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ void NarrowbandFMAudio::configure(const NBFMConfigureMessage& message) {
|
||||
|
||||
void NarrowbandFMAudio::capture_config(const CaptureConfigMessage& message) {
|
||||
if( message.config ) {
|
||||
audio_output.set_stream(std::make_unique<StreamInput>(*message.config));
|
||||
audio_output.set_stream(std::make_unique<StreamInput>(message.config));
|
||||
} else {
|
||||
audio_output.set_stream(nullptr);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ void WidebandFMAudio::configure(const WFMConfigureMessage& message) {
|
||||
|
||||
void WidebandFMAudio::capture_config(const CaptureConfigMessage& message) {
|
||||
if( message.config ) {
|
||||
audio_output.set_stream(std::make_unique<StreamInput>(*message.config));
|
||||
audio_output.set_stream(std::make_unique<StreamInput>(message.config));
|
||||
} else {
|
||||
audio_output.set_stream(nullptr);
|
||||
}
|
||||
|
@ -34,13 +34,13 @@ using namespace lpc43xx;
|
||||
|
||||
class StreamInput {
|
||||
public:
|
||||
StreamInput(CaptureConfig& config) :
|
||||
K { config.write_size_log2 + config.buffer_count_log2 },
|
||||
event_bytes_mask { (1UL << config.write_size_log2) - 1 },
|
||||
StreamInput(CaptureConfig* const config) :
|
||||
K { config->write_size_log2 + config->buffer_count_log2 },
|
||||
event_bytes_mask { (1UL << config->write_size_log2) - 1 },
|
||||
data { std::make_unique<uint8_t[]>(1UL << K) },
|
||||
fifo { data.get(), K }
|
||||
{
|
||||
config.fifo = &fifo;
|
||||
config->fifo = &fifo;
|
||||
}
|
||||
|
||||
size_t write(const void* const data, const size_t length) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user