File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 8
8
#include < SDL.h>
9
9
#include < SDL_audio.h>
10
10
11
+ #include < atomic>
11
12
#include < cassert>
12
13
#include < cstdio>
13
14
#include < string>
@@ -144,8 +145,8 @@ class audio_async {
144
145
int m_len_ms = 0 ;
145
146
int m_sample_rate = 0 ;
146
147
147
- bool m_running = false ;
148
- std::mutex m_mutex;
148
+ std::atomic_bool m_running;
149
+ std::mutex m_mutex;
149
150
150
151
std::vector<float > m_audio;
151
152
std::vector<float > m_audio_new;
@@ -155,6 +156,8 @@ class audio_async {
155
156
156
157
audio_async::audio_async (int len_ms) {
157
158
m_len_ms = len_ms;
159
+
160
+ m_running = false ;
158
161
}
159
162
160
163
audio_async::~audio_async () {
@@ -427,10 +430,10 @@ int main(int argc, char ** argv) {
427
430
const int n_samples_keep = (params.keep_ms *1e-3 )*WHISPER_SAMPLE_RATE;
428
431
const int n_samples_30s = (30000 *1e-3 )*WHISPER_SAMPLE_RATE;
429
432
430
- const int n_new_line = params.length_ms / params.step_ms - 1 ; // number of steps to print new line
431
-
432
433
const bool use_vad = n_samples_step <= 0 ; // sliding window mode uses VAD
433
434
435
+ const int n_new_line = !use_vad ? params.length_ms / params.step_ms - 1 : 1 ; // number of steps to print new line
436
+
434
437
params.no_timestamps = !use_vad;
435
438
params.no_context = use_vad;
436
439
params.max_tokens = 0 ;
You can’t perform that action at this time.
0 commit comments