mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-05-17 18:58:18 +00: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) {
|
void NarrowbandAMAudio::capture_config(const CaptureConfigMessage& message) {
|
||||||
if( message.config ) {
|
if( message.config ) {
|
||||||
audio_output.set_stream(std::make_unique<StreamInput>(*message.config));
|
audio_output.set_stream(std::make_unique<StreamInput>(message.config));
|
||||||
} else {
|
} else {
|
||||||
audio_output.set_stream(nullptr);
|
audio_output.set_stream(nullptr);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ void CaptureProcessor::on_message(const Message* const message) {
|
|||||||
|
|
||||||
void CaptureProcessor::capture_config(const CaptureConfigMessage& message) {
|
void CaptureProcessor::capture_config(const CaptureConfigMessage& message) {
|
||||||
if( message.config ) {
|
if( message.config ) {
|
||||||
stream = std::make_unique<StreamInput>(*message.config);
|
stream = std::make_unique<StreamInput>(message.config);
|
||||||
} else {
|
} else {
|
||||||
stream.reset();
|
stream.reset();
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ void NarrowbandFMAudio::configure(const NBFMConfigureMessage& message) {
|
|||||||
|
|
||||||
void NarrowbandFMAudio::capture_config(const CaptureConfigMessage& message) {
|
void NarrowbandFMAudio::capture_config(const CaptureConfigMessage& message) {
|
||||||
if( message.config ) {
|
if( message.config ) {
|
||||||
audio_output.set_stream(std::make_unique<StreamInput>(*message.config));
|
audio_output.set_stream(std::make_unique<StreamInput>(message.config));
|
||||||
} else {
|
} else {
|
||||||
audio_output.set_stream(nullptr);
|
audio_output.set_stream(nullptr);
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ void WidebandFMAudio::configure(const WFMConfigureMessage& message) {
|
|||||||
|
|
||||||
void WidebandFMAudio::capture_config(const CaptureConfigMessage& message) {
|
void WidebandFMAudio::capture_config(const CaptureConfigMessage& message) {
|
||||||
if( message.config ) {
|
if( message.config ) {
|
||||||
audio_output.set_stream(std::make_unique<StreamInput>(*message.config));
|
audio_output.set_stream(std::make_unique<StreamInput>(message.config));
|
||||||
} else {
|
} else {
|
||||||
audio_output.set_stream(nullptr);
|
audio_output.set_stream(nullptr);
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,13 @@ using namespace lpc43xx;
|
|||||||
|
|
||||||
class StreamInput {
|
class StreamInput {
|
||||||
public:
|
public:
|
||||||
StreamInput(CaptureConfig& config) :
|
StreamInput(CaptureConfig* const config) :
|
||||||
K { config.write_size_log2 + config.buffer_count_log2 },
|
K { config->write_size_log2 + config->buffer_count_log2 },
|
||||||
event_bytes_mask { (1UL << config.write_size_log2) - 1 },
|
event_bytes_mask { (1UL << config->write_size_log2) - 1 },
|
||||||
data { std::make_unique<uint8_t[]>(1UL << K) },
|
data { std::make_unique<uint8_t[]>(1UL << K) },
|
||||||
fifo { data.get(), K }
|
fifo { data.get(), K }
|
||||||
{
|
{
|
||||||
config.fifo = &fifo;
|
config->fifo = &fifo;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t write(const void* const data, const size_t length) {
|
size_t write(const void* const data, const size_t length) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user