2018-12-18 11:25:21 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
* Copyright (C) 2016 Furrtek
|
|
|
|
*
|
|
|
|
* This file is part of PortaPack.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UI_SOUNDBOARD_H__
|
|
|
|
#define __UI_SOUNDBOARD_H__
|
|
|
|
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_transmitter.hpp"
|
|
|
|
#include "replay_thread.hpp"
|
|
|
|
#include "baseband_api.hpp"
|
|
|
|
#include "lfsr_random.hpp"
|
|
|
|
#include "io_wave.hpp"
|
|
|
|
#include "tone_key.hpp"
|
2022-05-13 08:38:04 -04:00
|
|
|
#include "app_settings.hpp"
|
2018-12-18 11:25:21 -05:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class SoundBoardView : public View {
|
|
|
|
public:
|
|
|
|
SoundBoardView(NavigationView& nav);
|
|
|
|
~SoundBoardView();
|
|
|
|
|
|
|
|
SoundBoardView(const SoundBoardView&) = delete;
|
|
|
|
SoundBoardView(SoundBoardView&&) = delete;
|
|
|
|
SoundBoardView& operator=(const SoundBoardView&) = delete;
|
|
|
|
SoundBoardView& operator=(SoundBoardView&&) = delete;
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
2023-03-22 03:46:58 -04:00
|
|
|
std::string title() const override { return "Soundbrd TX"; };
|
2018-12-18 11:25:21 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
NavigationView& nav_;
|
2022-05-13 08:38:04 -04:00
|
|
|
|
|
|
|
// app save settings
|
|
|
|
std::app_settings settings { };
|
|
|
|
std::app_settings::AppSettings app_settings { };
|
2018-12-18 11:25:21 -05:00
|
|
|
|
|
|
|
enum tx_modes {
|
|
|
|
NORMAL = 0,
|
|
|
|
RANDOM
|
|
|
|
};
|
|
|
|
|
|
|
|
tx_modes tx_mode = NORMAL;
|
|
|
|
|
|
|
|
uint32_t playing_id { };
|
2020-08-28 14:47:56 -04:00
|
|
|
uint32_t page = 1;
|
2020-08-28 16:59:33 -04:00
|
|
|
uint32_t c_page = 1;
|
2018-12-18 11:25:21 -05:00
|
|
|
|
|
|
|
std::vector<std::filesystem::path> file_list { };
|
|
|
|
|
|
|
|
const size_t read_size { 2048 }; // Less ?
|
|
|
|
const size_t buffer_count { 3 };
|
|
|
|
std::unique_ptr<ReplayThread> replay_thread { };
|
|
|
|
bool ready_signal { false };
|
|
|
|
lfsr_word_t lfsr_v = 1;
|
|
|
|
|
|
|
|
//void show_infos();
|
|
|
|
void start_tx(const uint32_t id);
|
|
|
|
//void on_ctcss_changed(uint32_t v);
|
|
|
|
void stop();
|
|
|
|
bool is_active() const;
|
|
|
|
void set_ready();
|
|
|
|
void handle_replay_thread_done(const uint32_t return_code);
|
|
|
|
void file_error();
|
|
|
|
void on_tx_progress(const uint32_t progress);
|
|
|
|
void refresh_list();
|
|
|
|
void on_select_entry();
|
|
|
|
|
|
|
|
Labels labels {
|
2020-05-24 17:34:49 -04:00
|
|
|
//{ { 0, 20 * 8 + 4 }, "Title:", Color::light_grey() },
|
|
|
|
{ { 0, 180 }, "Key:", Color::light_grey() }
|
2018-12-18 11:25:21 -05:00
|
|
|
};
|
2020-08-28 14:47:56 -04:00
|
|
|
|
|
|
|
Button button_next_page {
|
2020-08-28 16:59:33 -04:00
|
|
|
{ 30 * 7, 25 * 8, 10 * 3, 2 * 14 },
|
2020-08-28 14:47:56 -04:00
|
|
|
"=>"
|
|
|
|
};
|
|
|
|
|
2020-08-28 16:59:33 -04:00
|
|
|
Button button_prev_page {
|
|
|
|
{ 17 * 10, 25 * 8, 10 * 3, 2 * 14 },
|
|
|
|
"<="
|
|
|
|
};
|
|
|
|
|
2020-08-28 14:47:56 -04:00
|
|
|
Text page_info {
|
|
|
|
{ 0, 30 * 8 - 4, 30 * 8, 16 }
|
|
|
|
};
|
|
|
|
|
2018-12-18 11:25:21 -05:00
|
|
|
MenuView menu_view {
|
2020-05-24 17:34:49 -04:00
|
|
|
{ 0, 0, 240, 175 },
|
2018-12-18 11:25:21 -05:00
|
|
|
true
|
|
|
|
};
|
|
|
|
Text text_empty {
|
|
|
|
{ 7 * 8, 12 * 8, 16 * 8, 16 },
|
|
|
|
"Empty directory !",
|
|
|
|
};
|
|
|
|
|
2020-05-24 17:34:49 -04:00
|
|
|
/*Text text_title {
|
2018-12-18 11:25:21 -05:00
|
|
|
{ 6 * 8, 20 * 8 + 4, 15 * 8, 16 }
|
2020-05-24 17:34:49 -04:00
|
|
|
};*/
|
2018-12-18 11:25:21 -05:00
|
|
|
|
2020-05-24 17:34:49 -04:00
|
|
|
/*Text text_duration {
|
2018-12-18 11:25:21 -05:00
|
|
|
{ 22 * 8, 20 * 8 + 4, 6 * 8, 16 }
|
2020-05-24 17:34:49 -04:00
|
|
|
};*/
|
2018-12-18 11:25:21 -05:00
|
|
|
|
|
|
|
OptionsField options_tone_key {
|
2020-05-24 17:34:49 -04:00
|
|
|
{ 32 , 180 },
|
2018-12-18 11:25:21 -05:00
|
|
|
18,
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
Checkbox check_loop {
|
2020-05-24 17:34:49 -04:00
|
|
|
{ 0, 25 * 8 + 4 },
|
2018-12-18 11:25:21 -05:00
|
|
|
4,
|
|
|
|
"Loop"
|
|
|
|
};
|
|
|
|
|
|
|
|
Checkbox check_random {
|
2020-08-28 16:59:33 -04:00
|
|
|
{ 10 * 7, 25 * 8 + 4 },
|
2018-12-18 11:25:21 -05:00
|
|
|
6,
|
|
|
|
"Random"
|
|
|
|
};
|
|
|
|
|
2020-08-28 14:47:56 -04:00
|
|
|
//ProgressBar progressbar {
|
|
|
|
// { 0 * 8, 30 * 8 - 4, 30 * 8, 16 }
|
|
|
|
//};
|
2018-12-18 11:25:21 -05:00
|
|
|
|
|
|
|
TransmitterView tx_view {
|
|
|
|
16 * 16,
|
|
|
|
5000,
|
|
|
|
12
|
|
|
|
};
|
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_replay_thread_error {
|
|
|
|
Message::ID::ReplayThreadDone,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = *reinterpret_cast<const ReplayThreadDoneMessage*>(p);
|
|
|
|
this->handle_replay_thread_done(message.return_code);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_fifo_signal {
|
|
|
|
Message::ID::RequestSignal,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = static_cast<const RequestSignalMessage*>(p);
|
|
|
|
if (message->signal == RequestSignalMessage::Signal::FillRequest) {
|
|
|
|
this->set_ready();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_tx_progress {
|
|
|
|
Message::ID::TXProgress,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = *reinterpret_cast<const TXProgressMessage*>(p);
|
|
|
|
this->on_tx_progress(message.progress);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
|
|
|
#endif/*__UI_SOUNDBOARD_H__*/
|