Skip to content

Commit

Permalink
Revert to the old 25% preamp setting, improve warning message in case…
Browse files Browse the repository at this point in the history
… of clipping.
  • Loading branch information
Artefact2 committed Feb 22, 2015
1 parent 496046b commit 821c826
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int xm_create_context_safe(xm_context_t** ctxp, const char* moddata, size_t modd
mempool += ctx->module.num_channels * sizeof(xm_channel_context_t);

ctx->global_volume = 1.f;
ctx->amplification = 1.f / (float)ctx->module.num_channels;
ctx->amplification = .25f; /* XXX: some bad modules may still clip. Find out something better. */
ctx->volume_ramp = (1.f / 128.f);
ctx->panning_ramp = (1.f / 128.f);

Expand Down
9 changes: 4 additions & 5 deletions src/play.c
Original file line number Diff line number Diff line change
Expand Up @@ -1346,12 +1346,11 @@ static void xm_sample(xm_context_t* ctx, float* left, float* right) {
*left *= fgvol;
*right *= fgvol;

if(XM_DEBUG && (*left > 1 || *left < -1)) {
DEBUG("clipping sample: %f, this is a bug", *left);
}
if(XM_DEBUG && (*right > 1 || *right < -1)) {
DEBUG("clipping sample: %f, this is a bug", *right);
#if XM_DEBUG
if(fabs(*left) > 1 || fabs(*right) > 1) {
DEBUG("clipping frame: %f %f, this is a bad module or a libxm bug", *left, *right);
}
#endif
}

void xm_generate_samples(xm_context_t* ctx, float* output, size_t numsamples) {
Expand Down

0 comments on commit 821c826

Please sign in to comment.