mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-03-19 21:36:01 -04:00
Rename AudioThread -> CaptureThread.
...since it's doing baseband capturing too, and doesn't really know what kind of data it's moving.
This commit is contained in:
parent
b8196ee2be
commit
a6538bc48b
@ -184,7 +184,7 @@ CPPSRC = main.cpp \
|
||||
file.cpp \
|
||||
log_file.cpp \
|
||||
png_writer.cpp \
|
||||
audio_thread.cpp \
|
||||
capture_thread.cpp \
|
||||
manchester.cpp \
|
||||
string_format.cpp \
|
||||
temperature_logger.cpp \
|
||||
|
@ -281,7 +281,7 @@ void AnalogAudioView::on_headphone_volume_changed(int32_t v) {
|
||||
|
||||
void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) {
|
||||
audio::output::mute();
|
||||
audio_thread.reset();
|
||||
capture_thread.reset();
|
||||
|
||||
const auto is_wideband_spectrum_mode = (modulation == ReceiverModel::Mode::SpectrumAnalysis);
|
||||
receiver_model.set_baseband_configuration({
|
||||
@ -295,7 +295,7 @@ void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) {
|
||||
if( !is_wideband_spectrum_mode ) {
|
||||
const auto filename = next_filename_matching_pattern("AUD_????.S16");
|
||||
if( !filename.empty() ) {
|
||||
audio_thread = std::make_unique<AudioThread>(filename);
|
||||
capture_thread = std::make_unique<CaptureThread>(filename);
|
||||
}
|
||||
audio::output::unmute();
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "ui_receiver.hpp"
|
||||
#include "ui_spectrum.hpp"
|
||||
|
||||
#include "audio_thread.hpp"
|
||||
#include "capture_thread.hpp"
|
||||
|
||||
#include "ui_font_fixed_8x16.hpp"
|
||||
|
||||
@ -144,7 +144,7 @@ private:
|
||||
|
||||
spectrum::WaterfallWidget waterfall;
|
||||
|
||||
std::unique_ptr<AudioThread> audio_thread;
|
||||
std::unique_ptr<CaptureThread> capture_thread;
|
||||
|
||||
void on_tuning_frequency_changed(rf::Frequency f);
|
||||
void on_baseband_bandwidth_changed(uint32_t bandwidth_hz);
|
||||
|
@ -112,7 +112,7 @@ void CaptureAppView::on_record() {
|
||||
return;
|
||||
}
|
||||
|
||||
capture_thread = std::make_unique<AudioThread>(filename);
|
||||
capture_thread = std::make_unique<CaptureThread>(filename);
|
||||
button_record.set_bitmap(&bitmap_stop);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "bitmap.hpp"
|
||||
|
||||
#include "audio_thread.hpp"
|
||||
#include "capture_thread.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
@ -55,7 +55,7 @@ private:
|
||||
static constexpr uint32_t sampling_rate = 4000000;
|
||||
static constexpr uint32_t baseband_bandwidth = 2500000;
|
||||
|
||||
std::unique_ptr<AudioThread> capture_thread;
|
||||
std::unique_ptr<CaptureThread> capture_thread;
|
||||
|
||||
void on_record();
|
||||
|
||||
|
@ -19,6 +19,6 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "audio_thread.hpp"
|
||||
#include "capture_thread.hpp"
|
||||
|
||||
Thread* AudioThread::thread = nullptr;
|
||||
Thread* CaptureThread::thread = nullptr;
|
@ -19,8 +19,8 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __AUDIO_THREAD_H__
|
||||
#define __AUDIO_THREAD_H__
|
||||
#ifndef __CAPTURE_THREAD_H__
|
||||
#define __CAPTURE_THREAD_H__
|
||||
|
||||
#include "ch.h"
|
||||
|
||||
@ -55,18 +55,18 @@ private:
|
||||
FIFO<uint8_t>* const fifo;
|
||||
};
|
||||
|
||||
class AudioThread {
|
||||
class CaptureThread {
|
||||
public:
|
||||
AudioThread(
|
||||
CaptureThread(
|
||||
std::string file_path
|
||||
) : file_path { std::move(file_path) },
|
||||
write_buffer { std::make_unique<std::array<uint8_t, write_size>>() }
|
||||
{
|
||||
// Need significant stack for FATFS
|
||||
thread = chThdCreateFromHeap(NULL, 1024, NORMALPRIO + 10, AudioThread::static_fn, this);
|
||||
thread = chThdCreateFromHeap(NULL, 1024, NORMALPRIO + 10, CaptureThread::static_fn, this);
|
||||
}
|
||||
|
||||
~AudioThread() {
|
||||
~CaptureThread() {
|
||||
chThdTerminate(thread);
|
||||
chEvtSignal(thread, EVT_FIFO_HIGHWATER);
|
||||
const auto success = chThdWait(thread);
|
||||
@ -95,7 +95,7 @@ private:
|
||||
static Thread* thread;
|
||||
|
||||
static msg_t static_fn(void* arg) {
|
||||
auto obj = static_cast<AudioThread*>(arg);
|
||||
auto obj = static_cast<CaptureThread*>(arg);
|
||||
return obj->run();
|
||||
}
|
||||
|
||||
@ -142,4 +142,4 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
#endif/*__AUDIO_THREAD_H__*/
|
||||
#endif/*__CAPTURE_THREAD_H__*/
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include "irq_controls.hpp"
|
||||
|
||||
#include "audio_thread.hpp"
|
||||
#include "capture_thread.hpp"
|
||||
|
||||
#include "ch.h"
|
||||
|
||||
@ -46,7 +46,7 @@ CH_IRQ_HANDLER(M4Core_IRQHandler) {
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
chSysLockFromIsr();
|
||||
AudioThread::check_fifo_isr();
|
||||
CaptureThread::check_fifo_isr();
|
||||
EventDispatcher::events_flag_isr(EVT_MASK_APPLICATION);
|
||||
chSysUnlockFromIsr();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user