Skip to content

Commit

Permalink
fix(ios): sliceNSamples not reseted on prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jan 24, 2024
1 parent 7109406 commit ce1dae7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ios/RNWhisperContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ - (void)prepareRealtime:(int)jobId options:(NSDictionary *)options {
self->recordState.transcribeSliceIndex = 0;
self->recordState.nSamplesTranscribing = 0;

self->recordState.sliceNSamples.clear();
self->recordState.sliceNSamples.push_back(0);

self->recordState.job = rnwhisper::job_new(jobId, [self createParams:options jobId:jobId]);
Expand Down Expand Up @@ -202,7 +203,7 @@ void AudioInputCallback(void * inUserData,
state->sliceNSamples.push_back(0);
}

NSLog(@"[RNWhisper] Slice %d has %d samples", state->sliceIndex, nSamples);
NSLog(@"[RNWhisper] Slice %d has %d samples, put %d samples", state->sliceIndex, nSamples, n);

state->job->put_pcm_data((short*) inBuffer->mAudioData, state->sliceIndex, nSamples, n);

Expand Down

0 comments on commit ce1dae7

Please sign in to comment.