mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-10 16:49:36 +00:00
Testing external clock detection and auto-switch
Simplified audio spectrum computation and transfer ACARS RX in debug mode Disabled ABI warnings Updated binary
This commit is contained in:
@@ -74,9 +74,9 @@ void AudioSpectrumView::paint(Painter& painter) {
|
||||
);
|
||||
}
|
||||
|
||||
void AudioSpectrumView::on_audio_spectrum(const AudioSpectrum& spectrum) {
|
||||
for (size_t i = 0; i < spectrum.db.size(); i++)
|
||||
audio_spectrum[i] = ((int16_t)spectrum.db[i] - 127) * 256;
|
||||
void AudioSpectrumView::on_audio_spectrum(const AudioSpectrum* spectrum) {
|
||||
for (size_t i = 0; i < spectrum->db.size(); i++)
|
||||
audio_spectrum[i] = ((int16_t)spectrum->db[i] - 127) * 256;
|
||||
waveform.set_dirty();
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ void WaterfallWidget::show_audio_spectrum_view(const bool show) {
|
||||
add_child(audio_spectrum_view.get());
|
||||
update_widgets_rect();
|
||||
} else {
|
||||
audio_fifo = nullptr;
|
||||
audio_spectrum_update = false;
|
||||
remove_child(audio_spectrum_view.get());
|
||||
audio_spectrum_view.reset();
|
||||
update_widgets_rect();
|
||||
@@ -395,8 +395,8 @@ void WaterfallWidget::on_channel_spectrum(const ChannelSpectrum& spectrum) {
|
||||
);
|
||||
}
|
||||
|
||||
void WaterfallWidget::on_audio_spectrum(const AudioSpectrum& spectrum) {
|
||||
audio_spectrum_view->on_audio_spectrum(spectrum);
|
||||
void WaterfallWidget::on_audio_spectrum() {
|
||||
audio_spectrum_view->on_audio_spectrum(audio_spectrum_data);
|
||||
}
|
||||
|
||||
} /* namespace spectrum */
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
void on_audio_spectrum(const AudioSpectrum& spectrum);
|
||||
void on_audio_spectrum(const AudioSpectrum* spectrum);
|
||||
|
||||
private:
|
||||
static constexpr int cursor_band_height = 4;
|
||||
@@ -150,7 +150,8 @@ private:
|
||||
FrequencyScale frequency_scale { };
|
||||
|
||||
ChannelSpectrumFIFO* channel_fifo { nullptr };
|
||||
AudioSpectrumFIFO* audio_fifo { nullptr };
|
||||
AudioSpectrum* audio_spectrum_data { nullptr };
|
||||
bool audio_spectrum_update { false };
|
||||
|
||||
std::unique_ptr<AudioSpectrumView> audio_spectrum_view { };
|
||||
|
||||
@@ -166,11 +167,12 @@ private:
|
||||
this->channel_fifo = message.fifo;
|
||||
}
|
||||
};
|
||||
MessageHandlerRegistration message_handler_audio_spectrum_config {
|
||||
Message::ID::AudioSpectrumConfig,
|
||||
MessageHandlerRegistration message_handler_audio_spectrum {
|
||||
Message::ID::AudioSpectrum,
|
||||
[this](const Message* const p) {
|
||||
const auto message = *reinterpret_cast<const AudioSpectrumConfigMessage*>(p);
|
||||
this->audio_fifo = message.fifo;
|
||||
const auto message = *reinterpret_cast<const AudioSpectrumMessage*>(p);
|
||||
this->audio_spectrum_data = message.data;
|
||||
this->audio_spectrum_update = true;
|
||||
}
|
||||
};
|
||||
MessageHandlerRegistration message_handler_frame_sync {
|
||||
@@ -182,18 +184,15 @@ private:
|
||||
this->on_channel_spectrum(channel_spectrum);
|
||||
}
|
||||
}
|
||||
if( this->audio_fifo ) {
|
||||
AudioSpectrum audio_spectrum;
|
||||
while( audio_fifo->out(audio_spectrum) ) {
|
||||
// Unstack everything available and only use last buffer (should only be one max. ready per frame)
|
||||
}
|
||||
this->on_audio_spectrum(audio_spectrum);
|
||||
if (this->audio_spectrum_update) {
|
||||
this->audio_spectrum_update = false;
|
||||
this->on_audio_spectrum();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void on_channel_spectrum(const ChannelSpectrum& spectrum);
|
||||
void on_audio_spectrum(const AudioSpectrum& spectrum);
|
||||
void on_audio_spectrum();
|
||||
};
|
||||
|
||||
} /* namespace spectrum */
|
||||
|
||||
Reference in New Issue
Block a user