This commit is contained in:
NishiOwO 2025-04-21 19:24:00 +09:00
parent 1ba0281d33
commit 2fd9609d46
No known key found for this signature in database
GPG Key ID: 27EF69B208EB9343
2 changed files with 12 additions and 10 deletions

View File

@ -634,7 +634,7 @@ int jar_xm_create_context_safe(jar_xm_context_t** ctxp, const char* moddata, siz
mempool += ctx->module.num_channels * sizeof(jar_xm_channel_context_t);
ctx->default_global_volume = 1.f;
ctx->global_volume = 1.f;
ctx->global_volume = ctx->default_global_volume;
ctx->amplification = .25f; /* XXX: some bad modules may still clip. Find out something better. */
#if JAR_XM_RAMPING
@ -2491,6 +2491,8 @@ void jar_xm_reset(jar_xm_context_t* ctx) {
ctx->current_row = 0;
ctx->current_table_index = 0;
ctx->current_tick = 0;
ctx->extra_ticks = 0;
ctx->remaining_samples_in_tick = 0;
ctx->tempo = ctx->default_tempo;
ctx->bpm = ctx->default_bpm;
ctx->global_volume = ctx->default_global_volume;

View File

@ -55,7 +55,7 @@ void gf_audio_callback(ma_device* dev, void* output, const void* input, ma_uint3
int gotframe;
float* r = malloc(sizeof(*r) * frame * 2);
jar_xm_generate_samples(audio->decoder[i].xm, r, frame);
gotframe = audio->decoder[i].samples > (gf_audio_id_t)frame ? frame : audio->decoder[i].samples;
gotframe = audio->decoder[i].samples > (int)frame ? frame : audio->decoder[i].samples;
for(j = 0; j < gotframe; j++) {
tmp[2 * j + 0] += (double)r[2 * j + 0];
tmp[2 * j + 1] += (double)r[2 * j + 1];
@ -72,7 +72,7 @@ void gf_audio_callback(ma_device* dev, void* output, const void* input, ma_uint3
int gotframe;
ma_int16* r = malloc(sizeof(*r) * frame * 2);
jar_mod_fillbuffer(audio->decoder[i].mod, r, frame, NULL);
gotframe = audio->decoder[i].samples > (gf_audio_id_t)frame ? frame : audio->decoder[i].samples;
gotframe = audio->decoder[i].samples > (int)frame ? frame : audio->decoder[i].samples;
for(j = 0; j < gotframe; j++) {
tmp[2 * j + 0] += (double)r[2 * j + 0] / 32768.0;
tmp[2 * j + 1] += (double)r[2 * j + 1] / 32768.0;