@@ -171,7 +171,7 @@ void whisper_print_segment_callback(struct whisper_context * ctx, struct whisper
171
171
const int s0 = n_segments - n_new;
172
172
173
173
if (s0 == 0 ) {
174
- printf (" \n " );
174
+ Rprintf (" \n " );
175
175
}
176
176
177
177
for (int i = s0; i < n_segments; i++) {
@@ -181,7 +181,7 @@ void whisper_print_segment_callback(struct whisper_context * ctx, struct whisper
181
181
}
182
182
183
183
if (!params.no_timestamps ) {
184
- printf (" [%s --> %s] " , to_timestamp (t0).c_str (), to_timestamp (t1).c_str ());
184
+ Rprintf (" [%s --> %s] " , to_timestamp (t0).c_str (), to_timestamp (t1).c_str ());
185
185
}
186
186
187
187
if (params.diarize && pcmf32s.size () == 2 ) {
@@ -202,26 +202,26 @@ void whisper_print_segment_callback(struct whisper_context * ctx, struct whisper
202
202
203
203
const int col = std::max (0 , std::min ((int ) k_colors.size () - 1 , (int ) (std::pow (p, 3 )*float (k_colors.size ()))));
204
204
205
- printf (" %s%s%s%s" , speaker.c_str (), k_colors[col].c_str (), text, " \033 [0m" );
205
+ Rprintf (" %s%s%s%s" , speaker.c_str (), k_colors[col].c_str (), text, " \033 [0m" );
206
206
}
207
207
} else {
208
208
const char * text = whisper_full_get_segment_text (ctx, i);
209
209
210
- printf (" %s%s" , speaker.c_str (), text);
210
+ Rprintf (" %s%s" , speaker.c_str (), text);
211
211
}
212
212
213
213
if (params.tinydiarize ) {
214
214
if (whisper_full_get_segment_speaker_turn_next (ctx, i)) {
215
- printf (" %s" , params.tdrz_speaker_turn .c_str ());
215
+ Rprintf (" %s" , params.tdrz_speaker_turn .c_str ());
216
216
}
217
217
}
218
218
219
219
// with timestamps or speakers: each segment on new line
220
220
if (!params.no_timestamps || params.diarize ) {
221
- printf (" \n " );
221
+ Rprintf (" \n " );
222
222
}
223
223
224
- fflush (stdout );
224
+ Rcpp::checkUserInterrupt ( );
225
225
}
226
226
}
227
227
0 commit comments