mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-23 22:07:44 +00:00
Added Soundboard
file.cpp: scan_root_files proc_audiotx.cpp: bandwidth setting ui_widget.cpp: button on_focus
This commit is contained in:
@@ -106,7 +106,8 @@ void AFSKProcessor::execute(const buffer_c8_t& buffer) {
|
||||
|
||||
// FM
|
||||
// 1<<18 = 262144
|
||||
// m = (262144 * BW) / 2280000 (* 115, see ui_lcr afsk_bw setting)
|
||||
// m = (262144 * a) / 2280000
|
||||
// a = 262144 / 2280000 (*1000 = 115, see ui_lcr afsk_bw setting)
|
||||
frq = tone_sample * afsk_bw;
|
||||
|
||||
phase = (phase + frq);
|
||||
|
@@ -38,8 +38,8 @@ void AudioTXProcessor::execute(const buffer_c8_t& buffer){
|
||||
for (size_t i = 0; i<buffer.count; i++) {
|
||||
|
||||
// Audio preview sample generation: 1536000/48000 = 32
|
||||
if (as >= 31) {
|
||||
as = 0;
|
||||
if (!as) {
|
||||
as = 32;
|
||||
audio_fifo.out(sample);
|
||||
//preview_audio_buffer.p[ai++] = sample << 8;
|
||||
|
||||
@@ -50,11 +50,11 @@ void AudioTXProcessor::execute(const buffer_c8_t& buffer){
|
||||
asked = true;
|
||||
}
|
||||
} else {
|
||||
as++;
|
||||
as--;
|
||||
}
|
||||
|
||||
// FM
|
||||
frq = sample * 8000;
|
||||
frq = sample * bw;
|
||||
|
||||
phase = (phase + frq);
|
||||
sphase = phase + (64 << 18);
|
||||
@@ -69,9 +69,17 @@ void AudioTXProcessor::execute(const buffer_c8_t& buffer){
|
||||
}
|
||||
|
||||
void AudioTXProcessor::on_message(const Message* const msg) {
|
||||
const auto message = static_cast<const AudioTXConfigMessage*>(msg);
|
||||
|
||||
switch(msg->id) {
|
||||
case Message::ID::AudioTXConfig:
|
||||
//const auto message = static_cast<const AudioTXConfigMessage*>(msg);
|
||||
|
||||
// 1<<18 = 262144
|
||||
// m = (262144 * a) / 1536000
|
||||
// a = 262144 / 1536000 (*1000 = 171)
|
||||
bw = 171 * (message->bw);
|
||||
as = 0;
|
||||
|
||||
configured = true;
|
||||
break;
|
||||
|
||||
|
@@ -41,6 +41,7 @@ private:
|
||||
int8_t audio_fifo_data[2048];
|
||||
FIFO<int8_t> audio_fifo = { audio_fifo_data, 11 }; // 43ms @ 48000Hz
|
||||
|
||||
uint32_t bw;
|
||||
uint8_t as = 0, ai;
|
||||
int8_t re, im;
|
||||
int8_t sample;
|
||||
|
@@ -94,7 +94,7 @@ void POCSAGProcessor::execute(const buffer_c8_t& buffer) {
|
||||
last_rx_data = rx_data;
|
||||
rx_state = SYNC;
|
||||
} else if (rx_data == POCSAG_IDLE) {
|
||||
//rx_state = WAITING;
|
||||
rx_state = WAITING;
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -106,6 +106,7 @@ void POCSAGProcessor::execute(const buffer_c8_t& buffer) {
|
||||
if (msg_timeout < 600) {
|
||||
msg_timeout++;
|
||||
rx_bit++;
|
||||
|
||||
if (rx_bit >= 32) {
|
||||
rx_bit = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user