@@ -35,10 +35,11 @@ std::string to_timestamp(int64_t t) {
35
35
36
36
// command-line parameters
37
37
struct whisper_params {
38
- int32_t seed = -1 ; // RNG seed, not used currently
39
- int32_t n_threads = std::min(4 , (int32_t ) std::thread::hardware_concurrency());
40
- int32_t step_ms = 3000 ;
41
- int32_t length_ms = 10000 ;
38
+ int32_t seed = -1 ; // RNG seed, not used currently
39
+ int32_t n_threads = std::min(4 , (int32_t ) std::thread::hardware_concurrency());
40
+ int32_t step_ms = 3000 ;
41
+ int32_t length_ms = 10000 ;
42
+ int32_t capture_id = -1 ;
42
43
43
44
bool verbose = false ;
44
45
bool translate = false ;
@@ -65,6 +66,8 @@ bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
65
66
params.step_ms = std::stoi (argv[++i]);
66
67
} else if (arg == " --length" ) {
67
68
params.length_ms = std::stoi (argv[++i]);
69
+ } else if (arg == " -c" || arg == " --capture" ) {
70
+ params.capture_id = std::stoi (argv[++i]);
68
71
} else if (arg == " -v" || arg == " --verbose" ) {
69
72
params.verbose = true ;
70
73
} else if (arg == " --translate" ) {
@@ -109,6 +112,7 @@ void whisper_print_usage(int argc, char ** argv, const whisper_params & params)
109
112
fprintf (stderr, " -t N, --threads N number of threads to use during computation (default: %d)\n " , params.n_threads );
110
113
fprintf (stderr, " --step N audio step size in milliseconds (default: %d)\n " , params.step_ms );
111
114
fprintf (stderr, " --length N audio length in milliseconds (default: %d)\n " , params.length_ms );
115
+ fprintf (stderr, " -c ID, --capture ID capture device ID (default: -1)\n " );
112
116
fprintf (stderr, " -v, --verbose verbose output\n " );
113
117
fprintf (stderr, " --translate translate from source language to english\n " );
114
118
fprintf (stderr, " -kc, --keep-context keep text context from earlier audio (default: false)\n " );
@@ -201,7 +205,7 @@ int main(int argc, char ** argv) {
201
205
202
206
// init audio
203
207
204
- if (!audio_sdl_init (- 1 )) {
208
+ if (!audio_sdl_init (params. capture_id )) {
205
209
fprintf (stderr, " %s: audio_sdl_init() failed!\n " , __func__);
206
210
return 1 ;
207
211
}
0 commit comments