mirror of
https://github.com/nishiowo/nishbox
synced 2025-04-21 20:24:39 +00:00
fix xm
This commit is contained in:
parent
1ba0281d33
commit
2fd9609d46
18
engine/external/jar/jar_xm.h
vendored
18
engine/external/jar/jar_xm.h
vendored
@ -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
|
||||
@ -2487,13 +2487,15 @@ void jar_xm_reset(jar_xm_context_t* ctx) {
|
||||
for(i = 0; i < jar_xm_get_number_of_channels(ctx); i++) {
|
||||
jar_xm_cut_note(&ctx->channels[i]);
|
||||
}
|
||||
ctx->generated_samples = 0;
|
||||
ctx->current_row = 0;
|
||||
ctx->current_table_index = 0;
|
||||
ctx->current_tick = 0;
|
||||
ctx->tempo = ctx->default_tempo;
|
||||
ctx->bpm = ctx->default_bpm;
|
||||
ctx->global_volume = ctx->default_global_volume;
|
||||
ctx->generated_samples = 0;
|
||||
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;
|
||||
}
|
||||
|
||||
/*--------------------------------------------*/
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user