mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-12 11:42:13 -04:00
Added Soundboard
file.cpp: scan_root_files proc_audiotx.cpp: bandwidth setting ui_widget.cpp: button on_focus
This commit is contained in:
parent
5de6349199
commit
f7e0f36bd9
19 changed files with 462 additions and 121 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
|
@ -19,19 +20,17 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __UI_SOUNDBOARD_H__
|
||||
#define __UI_SOUNDBOARD_H__
|
||||
|
||||
#include "ui.hpp"
|
||||
#include "ui_widget.hpp"
|
||||
#include "ui_painter.hpp"
|
||||
#include "ui_menu.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
#include "ui_font_fixed_8x16.hpp"
|
||||
#include "clock_manager.hpp"
|
||||
#include "message.hpp"
|
||||
#include "rf_path.hpp"
|
||||
#include "max2837.hpp"
|
||||
#include "volume.hpp"
|
||||
#include "baseband_api.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
#include "ui_receiver.hpp"
|
||||
#include "transmitter_model.hpp"
|
||||
#include "message.hpp"
|
||||
#include "file.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
||||
|
@ -40,27 +39,81 @@ public:
|
|||
SoundBoardView(NavigationView& nav);
|
||||
~SoundBoardView();
|
||||
|
||||
std::string title() const;
|
||||
void on_show() override;
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Soundboard"; };
|
||||
|
||||
private:
|
||||
enum tx_modes {
|
||||
NORMAL = 0,
|
||||
RANDOM
|
||||
};
|
||||
|
||||
tx_modes tx_mode = NORMAL;
|
||||
|
||||
struct sound {
|
||||
std::string filename;
|
||||
std::string shortname;
|
||||
uint8_t min;
|
||||
uint8_t sec;
|
||||
bool stereo;
|
||||
bool sixteenbit;
|
||||
uint32_t sample_rate;
|
||||
uint32_t size;
|
||||
uint32_t sample_duration;
|
||||
uint32_t ms_duration;
|
||||
};
|
||||
|
||||
sound sounds[12];
|
||||
uint32_t cnt;
|
||||
uint32_t sample_duration;
|
||||
uint8_t page = 0;
|
||||
|
||||
File file;
|
||||
|
||||
uint16_t lfsr = 0x1337u;
|
||||
|
||||
sound sounds[100];
|
||||
uint8_t max_sound;
|
||||
uint8_t max_page;
|
||||
|
||||
std::array<Button, 12> buttons;
|
||||
void on_button(Button& button);
|
||||
int8_t audio_buffer[1024];
|
||||
|
||||
Style style_a {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = { 255, 51, 153 }
|
||||
};
|
||||
Style style_b {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = { 153, 204, 0 }
|
||||
};
|
||||
Style style_c {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = { 51, 204, 204 }
|
||||
};
|
||||
Style style_d {
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = { 153, 102, 255 }
|
||||
};
|
||||
|
||||
std::array<Button, 21> buttons;
|
||||
const Style * styles[4] = { &style_a, &style_b, &style_c, &style_d };
|
||||
|
||||
void on_tuning_frequency_changed(rf::Frequency f);
|
||||
|
||||
Text text_test {
|
||||
{ 120, 4, 64, 16 }
|
||||
void do_random();
|
||||
uint16_t shitty_rand();
|
||||
void show_infos(uint16_t id);
|
||||
void change_page(Button& button, const KeyEvent key);
|
||||
void refresh_buttons(uint16_t id);
|
||||
void play_sound(uint16_t id);
|
||||
void prepare_audio();
|
||||
uint16_t fb_to_uint16(const std::string& fb);
|
||||
uint32_t fb_to_uint32(const std::string& fb);
|
||||
|
||||
Text text_duration {
|
||||
{ 16, 236, 5 * 8, 16 }
|
||||
};
|
||||
|
||||
FrequencyField field_frequency {
|
||||
|
@ -68,26 +121,54 @@ private:
|
|||
};
|
||||
|
||||
NumberField number_bw {
|
||||
{ 16 * 8, 4 },
|
||||
5,
|
||||
{1000, 50000},
|
||||
500,
|
||||
{ 14 * 8, 4 },
|
||||
2,
|
||||
{1, 50},
|
||||
1,
|
||||
' '
|
||||
};
|
||||
|
||||
ProgressBar pbar_test {
|
||||
{ 45, 236, 150, 16 }
|
||||
Text text_kHz {
|
||||
{ 16 * 8, 4, 3 * 8, 16 },
|
||||
"kHz"
|
||||
};
|
||||
|
||||
Button button_load {
|
||||
{ 8, 270, 64, 32 },
|
||||
"Load"
|
||||
Text text_page {
|
||||
{ 22 * 8, 4, 3 * 8, 16 },
|
||||
"-/-"
|
||||
};
|
||||
|
||||
ProgressBar pbar {
|
||||
{ 72, 236, 150, 16 }
|
||||
};
|
||||
|
||||
Checkbox check_loop {
|
||||
{ 16, 274 },
|
||||
4,
|
||||
"Loop"
|
||||
};
|
||||
|
||||
Button button_random {
|
||||
{ 80, 270, 72, 32 },
|
||||
"Random"
|
||||
};
|
||||
|
||||
Button button_exit {
|
||||
{ 96, 270, 64, 32 },
|
||||
{ 160, 270, 64, 32 },
|
||||
"Exit"
|
||||
};
|
||||
|
||||
MessageHandlerRegistration message_handler_fifo_signal {
|
||||
Message::ID::FIFOSignal,
|
||||
[this](const Message* const p) {
|
||||
const auto message = static_cast<const FIFOSignalMessage*>(p);
|
||||
if (message->signaltype == 1) {
|
||||
this->prepare_audio();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
#endif/*__UI_SOUNDBOARD_H__*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue