Tones bugfix, numbers station voice files search

This commit is contained in:
furrtek
2017-03-22 03:21:06 +00:00
parent ee099504c3
commit 089eeeafe4
24 changed files with 335 additions and 194 deletions
+32 -28
View File
@@ -33,6 +33,7 @@
#include "baseband_api.hpp"
#include "utility.hpp"
#include "message.hpp"
#include "file.hpp"
#include "io_wave.hpp"
namespace ui {
@@ -47,9 +48,12 @@ public:
std::string title() const override { return "Numbers station"; };
private:
NavigationView& nav_;
// Sequencing state machine
enum segments {
ANNOUNCE = 0,
IDLE = 0,
ANNOUNCE,
MESSAGE,
SIGNOFF
};
@@ -60,12 +64,16 @@ private:
.foreground = Color::red()
};
NavigationView& nav_;
struct voice_t {
std::string dir;
bool accent;
bool announce;
};
segments segment;
bool armed = false;
bool file_error = false;
uint32_t sound_sizes[11];
segments segment { IDLE };
bool armed { false };
bool file_error { false };
std::vector<voice_t> voices;
const std::vector<std::string> file_names = {
{ "0" },
@@ -84,16 +92,17 @@ private:
// const uint8_t month_table[12] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };
// const char * day_of_week[7] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
std::unique_ptr<WAVFileReader> reader;
std::unique_ptr<WAVFileReader> reader { };
uint8_t code_index, announce_loop;
uint32_t sample_counter;
uint32_t sample_duration;
int8_t audio_buffer[1024];
uint32_t pause = 0;
bool armed_blink;
SignalToken signal_token_tick_second;
bool armed_blink { false };
SignalToken signal_token_tick_second { };
void on_voice_changed(size_t index);
void on_tick_second();
void on_tuning_frequency_changed(rf::Frequency f);
void prepare_audio();
@@ -109,28 +118,23 @@ private:
// End
// Frequency list and sequence
Text text_title {
{ 1 * 8, 8 * 16, 11, 16 },
"Schedule:"
Labels labels {
{ { 2 * 8, 5 * 8 }, "Voice: Flags:", Color::light_grey() },
{ { 1 * 8, 8 * 8 }, "Code:", Color::light_grey() }
};
FrequencyField field_frequency {
{ 1 * 8, 4 },
OptionsField options_voices {
{ 8 * 8, 1 * 8 },
4,
{ }
};
NumberField number_bw {
{ 12 * 8, 4 },
3,
{1, 150},
1,
' '
};
Text text_code {
{ 20, 4 * 16, 5 * 8, 16 },
"Code:"
Text text_voice_flags {
{ 19 * 8, 1 * 8, 2 * 8, 16 },
""
};
SymField symfield_code {
{ 20, 5 * 16 },
{ 1 * 8, 10 * 8 },
25,
SymField::SYMFIELD_DEF
};
@@ -140,10 +144,10 @@ private:
5,
"Armed"
};
Button button_tx_now {
/*Button button_tx_now {
{ 18 * 8, 13 * 16, 10 * 8, 32 },
"TX now"
};
};*/
Button button_exit {
{ 21 * 8, 16 * 16, 64, 32 },
"Exit"