summaryrefslogtreecommitdiffstats
path: root/GUI
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-06-24 18:39:43 -0700
committeryum <yum.food.vr@gmail.com>2023-06-24 18:39:43 -0700
commite35abb6b9a04c6bebd6875901dbf0671f5cd860d (patch)
treeb01ad098057ad6d2a61abe4e457a5922929b189f /GUI
parentf7efe5d591500f14395de23b1cfd69697d9ed178 (diff)
Remove window duration field
No longer needed with new commit logic (8d0add86f66db532). Assign it to 5 minutes. Assuming 4 bytes per sample @ 16 kHz, this buffer maxes out at 19.2 megabytes of memory usage.
Diffstat (limited to 'GUI')
-rw-r--r--GUI/GUI/GUI/Config.cpp3
-rw-r--r--GUI/GUI/GUI/Config.h1
-rw-r--r--GUI/GUI/GUI/Frame.cpp40
-rw-r--r--GUI/GUI/GUI/Frame.h1
-rw-r--r--GUI/GUI/GUI/PythonWrapper.cpp4
5 files changed, 9 insertions, 40 deletions
diff --git a/GUI/GUI/GUI/Config.cpp b/GUI/GUI/GUI/Config.cpp
index 2bf17cf..bfc55d6 100644
--- a/GUI/GUI/GUI/Config.cpp
+++ b/GUI/GUI/GUI/Config.cpp
@@ -68,7 +68,6 @@ AppConfig::AppConfig(wxTextCtrl* out)
model("base.en"),
model_translation("nllb-200-distilled-600M"),
button("left joystick"),
- window_duration("15"),
enable_local_beep(true),
use_cpu(false),
@@ -118,7 +117,6 @@ bool AppConfig::Serialize(const std::filesystem::path& path) {
cm.Set("model", model);
cm.Set("model_translation", model_translation);
cm.Set("button", button);
- cm.Set("window_duration", window_duration);
cm.Set("enable_local_beep", enable_local_beep);
cm.Set("use_cpu", use_cpu);
@@ -181,7 +179,6 @@ bool AppConfig::Deserialize(const std::filesystem::path& path) {
cm.Get("model", c.model);
cm.Get("model_translation", c.model_translation);
cm.Get("button", c.button);
- cm.Get("window_duration", c.window_duration);
cm.Get("enable_local_beep", c.enable_local_beep);
cm.Get("use_cpu", c.use_cpu);
diff --git a/GUI/GUI/GUI/Config.h b/GUI/GUI/GUI/Config.h
index bf714bc..fc99935 100644
--- a/GUI/GUI/GUI/Config.h
+++ b/GUI/GUI/GUI/Config.h
@@ -54,7 +54,6 @@ public:
std::string model;
std::string model_translation;
std::string button;
- std::string window_duration;
bool enable_local_beep;
bool use_cpu;
diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp
index 5044b9f..6bce67e 100644
--- a/GUI/GUI/GUI/Frame.cpp
+++ b/GUI/GUI/GUI/Frame.cpp
@@ -47,7 +47,6 @@ namespace {
ID_PY_APP_ENABLE_LOWERCASE_FILTER,
ID_PY_APP_ROWS,
ID_PY_APP_COLS,
- ID_PY_APP_WINDOW_DURATION,
ID_PY_APP_GPU_IDX,
ID_PY_APP_KEYBIND,
ID_UNITY_PANEL,
@@ -713,19 +712,6 @@ Frame::Frame()
"The number of columns on the text box.");
py_app_cols_ = py_app_cols;
- auto* py_app_window_duration = new wxTextCtrl(
- py_app_config_panel_pairs, ID_PY_APP_WINDOW_DURATION,
- app_c_->window_duration, wxDefaultPosition,
- wxDefaultSize, /*style=*/0);
- py_app_window_duration->SetToolTip(
- "This controls how long the slice of audio that "
- "we feed the transcription algorithm is, in seconds. "
- "Shorter values (as low as 10 seconds) can be transcribed "
- "more quickly, but are less accurate. Longer values "
- "(as high as 28 seconds) take longer to transcribe, "
- "but are far more accurate.");
- py_app_window_duration_ = py_app_window_duration;
-
auto* py_app_gpu_idx = new wxTextCtrl(
py_app_config_panel_pairs, ID_PY_APP_GPU_IDX,
std::to_string(app_c_->gpu_idx), wxDefaultPosition,
@@ -805,11 +791,6 @@ Frame::Frame()
/*flags=*/wxEXPAND);
sizer->Add(new wxStaticText(py_app_config_panel_pairs,
- wxID_ANY, /*label=*/"Window duration (s):"));
- sizer->Add(py_app_window_duration, /*proportion=*/0,
- /*flags=*/wxEXPAND);
-
- sizer->Add(new wxStaticText(py_app_config_panel_pairs,
wxID_ANY, /*label=*/"GPU index:"));
sizer->Add(py_app_gpu_idx, /*proportion=*/0,
/*flags=*/wxEXPAND);
@@ -1996,52 +1977,44 @@ void Frame::OnAppStart(wxCommandEvent& event) {
kCharsPerSync[chars_per_sync_idx].ToStdString();
std::string bytes_per_char_str =
kBytesPerChar[bytes_per_char_idx].ToStdString();
- std::string window_duration_str =
- py_app_window_duration_->GetValue().ToStdString();
std::string gpu_idx_str =
py_app_gpu_idx_->GetValue().ToStdString();
std::string keybind =
py_app_keybind_->GetValue().ToStdString();
- int rows, cols, chars_per_sync, bytes_per_char, window_duration, gpu_idx;
+ int rows, cols, chars_per_sync, bytes_per_char, gpu_idx;
try {
rows = std::stoi(rows_str);
cols = std::stoi(cols_str);
chars_per_sync = std::stoi(chars_per_sync_str);
bytes_per_char = std::stoi(bytes_per_char_str);
- window_duration = std::stoi(window_duration_str);
gpu_idx = std::stoi(gpu_idx_str);
}
catch (const std::invalid_argument&) {
Log(transcribe_out_, "Could not parse rows \"{}\", cols \"{}\", chars "
- "per sync \"{}\", bytes per char \"{}\" window duration \"{}\" "
+ "per sync \"{}\", bytes per char \"{}\" "
"or gpu_idx \"{}\""
"as an integer\n", rows_str, cols_str, chars_per_sync_str,
- bytes_per_char_str, window_duration_str, gpu_idx_str);
+ bytes_per_char_str, gpu_idx_str);
return;
}
catch (const std::out_of_range&) {
Log(transcribe_out_, "Rows \"{}\", cols \"{}\", chars per sync "
- "\"{}\", bytes per char \"{}\" or window duration \"{}\" are out "
+ "\"{}\", bytes per char \"{}\" or \"{}\" are out "
"of range\n", rows_str, cols_str, chars_per_sync_str,
- bytes_per_char_str, window_duration_str);
+ bytes_per_char_str);
return;
}
const int max_rows = 10;
const int max_cols = 240;
- const int min_window_duration_s = 10;
- const int max_window_duration_s = 300;
const int min_gpu_idx = 0;
const int max_gpu_idx = 10;
if (rows < 0 || rows > max_rows ||
cols < 0 || cols > max_cols ||
- window_duration < min_window_duration_s ||
- window_duration > max_window_duration_s ||
gpu_idx < min_gpu_idx || gpu_idx > max_gpu_idx) {
Log(transcribe_out_, "Rows not on [{},{}] or cols not on [{},{}] or "
- "window_duration not on [{},{}] or gpu_idx not on [{}, {}]\n",
+ "gpu_idx not on [{}, {}]\n",
0, max_rows,
0, max_cols,
- min_window_duration_s, max_window_duration_s,
min_gpu_idx, max_gpu_idx);
return;
}
@@ -2056,7 +2029,6 @@ void Frame::OnAppStart(wxCommandEvent& event) {
app_c_->button = kButton[button_idx].ToStdString();
app_c_->rows = rows;
app_c_->cols = cols;
- app_c_->window_duration = std::to_string(window_duration);
app_c_->enable_local_beep = enable_local_beep;
app_c_->use_cpu = use_cpu;
app_c_->use_builtin = use_builtin;
diff --git a/GUI/GUI/GUI/Frame.h b/GUI/GUI/GUI/Frame.h
index bc3d208..94f2a68 100644
--- a/GUI/GUI/GUI/Frame.h
+++ b/GUI/GUI/GUI/Frame.h
@@ -38,7 +38,6 @@ private:
wxTextCtrl* py_app_rows_;
wxTextCtrl* py_app_cols_;
- wxTextCtrl* py_app_window_duration_;
wxTextCtrl* py_app_gpu_idx_;
wxTextCtrl* py_app_keybind_;
wxTextCtrl* unity_rows_;
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp
index 2172ac4..a061e34 100644
--- a/GUI/GUI/GUI/PythonWrapper.cpp
+++ b/GUI/GUI/GUI/PythonWrapper.cpp
@@ -472,7 +472,9 @@ std::future<bool> PythonWrapper::StartApp(
"--enable_local_beep", config.enable_local_beep ? "1" : "0",
"--rows", std::to_string(config.rows),
"--cols", std::to_string(config.cols),
- "--window_duration_s", config.window_duration,
+ // this is the max length of the audio buffer. 5 minutes
+ // is a reasonable approximation of infinity.
+ "--window_duration_s", "300",
"--cpu", config.use_cpu ? "1" : "0",
"--use_builtin", config.use_builtin ? "1" : "0",
"--enable_uwu_filter", config.enable_uwu_filter ? "1" : "0",