Exemple #1
0
bool resample_drain(struct processstate *process) {
	size_t odone;
	size_t clip_cnt;
		
	soxr_error_t error = SOXR(r, process, r->resampler, NULL, 0, NULL, process->outbuf, process->max_out_frames, &odone);
	if (error) {
		LOG_INFO("soxr_process error: %s", soxr_strerror(error));
		return true;
	}
	
	process->out_frames = odone;
	process->total_out += odone;
	
	clip_cnt = *(SOXR(r, num_clips, r->resampler));
	if (clip_cnt - r->old_clips) {
		LOG_DEBUG("resampling clips: %u", (unsigned)(clip_cnt - r->old_clips));
		r->old_clips = clip_cnt;
	}
	
	if (odone == 0) {

		LOG_INFO("resample track complete - total track clips: %u", r->old_clips);

		SOXR(r, delete, r->resampler);
		r->resampler = NULL;

		return true;

	} else {
Exemple #2
0
void resample_samples(struct thread_ctx_s *ctx) {
	struct soxr *r = ctx->decode.process_handle;
	size_t idone, odone;
	size_t clip_cnt;

	soxr_error_t error =
		SOXR(&gr, process, r->resampler, ctx->process.inbuf, ctx->process.in_frames, &idone, ctx->process.outbuf, ctx->process.max_out_frames, &odone);
	if (error) {
		LOG_INFO("[%p]: soxr_process error: %s", ctx, soxr_strerror(error));
		return;
	}

	if (idone != ctx->process.in_frames) {
		// should not get here if buffers are big enough...
		LOG_ERROR("[%p]: should not get here - partial sox process: %u of %u processed %u of %u out",
				  ctx, (unsigned)idone, ctx->process.in_frames, (unsigned)odone, ctx->process.max_out_frames);
	}
	
	ctx->process.out_frames = odone;
	ctx->process.total_in  += idone;
	ctx->process.total_out += odone;

	clip_cnt = *(SOXR(&gr, num_clips, r->resampler));
	if (clip_cnt - r->old_clips) {
		LOG_SDEBUG("[%p]: resampling clips: %u", ctx, (unsigned)(clip_cnt - r->old_clips));
		r->old_clips = clip_cnt;
	}
}
Exemple #3
0
void resample_samples(struct processstate *process) {
	size_t idone, odone;
	size_t clip_cnt;
	
	soxr_error_t error =
		SOXR(r, process, r->resampler, process->inbuf, process->in_frames, &idone, process->outbuf, process->max_out_frames, &odone);
	if (error) {
		LOG_INFO("soxr_process error: %s", soxr_strerror(error));
		return;
	}
	
	if (idone != process->in_frames) {
		// should not get here if buffers are big enough...
		LOG_ERROR("should not get here - partial sox process: %u of %u processed %u of %u out",
				  (unsigned)idone, process->in_frames, (unsigned)odone, process->max_out_frames);
	}
	
	process->out_frames = odone;
	process->total_in  += idone;
	process->total_out += odone;
	
	clip_cnt = *(SOXR(r, num_clips, r->resampler));
	if (clip_cnt - r->old_clips) {
		LOG_SDEBUG("resampling clips: %u", (unsigned)(clip_cnt - r->old_clips));
		r->old_clips = clip_cnt;
	}
}
Exemple #4
0
bool resample_drain(struct thread_ctx_s *ctx) {
	struct soxr *r = ctx->decode.process_handle;
	size_t odone;
	size_t clip_cnt;
		
	soxr_error_t error = SOXR(&gr, process, r->resampler, NULL, 0, NULL, ctx->process.outbuf, ctx->process.max_out_frames, &odone);
	if (error) {
		LOG_INFO("[%p]: soxr_process error: %s", ctx, soxr_strerror(error));
		return true;
	}
	
	ctx->process.out_frames = odone;
	ctx->process.total_out += odone;

	clip_cnt = *(SOXR(&gr, num_clips, r->resampler));
	if (clip_cnt - r->old_clips) {
		LOG_DEBUG("[%p]: resampling clips: %u", ctx, (unsigned)(clip_cnt - r->old_clips));
		r->old_clips = clip_cnt;
	}
	
	if (odone == 0) {

		LOG_INFO("[%]: resample track complete - total track clips: %u", ctx, r->old_clips);

		SOXR(&gr, delete, r->resampler);
		r->resampler = NULL;

		return true;

	} else {