mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-19 00:04:04 +01:00
fix for borked ADP decoding upon playback
till now, Ongakukan ADPCM decoder worked by "samples filled" and "samples consumed" var from ongakukan_adp_decoder.c ("decoder code" henceforth) get values from ongakukan-adp_lib.c ("decoder lib code" henceforth). samples done was also not initialized to 0 in decoder code, which led to "stuttery" playback with ADP files when decoded sound data from those same files would endlessly repeat by about half-a-second till it reached duration. this commit fixes this; ADP files are now decoded from beginning-to-end, and you'll be getting no "repeating" sounds literally every second. instead you'll be getting the sound data the way you'd listen to them in-game.
This commit is contained in:
parent
1d2ab676ec
commit
2eef6b4535
@ -207,6 +207,11 @@ void decode_ongakukan_adp_data(ongakukan_adp_t* handle)
|
||||
{
|
||||
/* set samples_filled to 0 and have our decoder go through every sample that exists in the sound data.*/
|
||||
handle->samples_filled = 0;
|
||||
if (handle->sample_pair_is_decoded == 0)
|
||||
{
|
||||
handle->samples_filled = 0;
|
||||
handle->samples_consumed = 0;
|
||||
}
|
||||
decode_ongakukan_adpcm_sample(handle, handle->sample_hist);
|
||||
/* if setup is established for further decoding, switch gears and have the decoder use that setup for as long as possible. */
|
||||
if (handle->sample_has_base_setup_from_the_start == 1)
|
||||
@ -220,7 +225,6 @@ void decode_ongakukan_adp_data(ongakukan_adp_t* handle)
|
||||
handle->data_offset++;
|
||||
handle->alt_sample_work1 += 2;
|
||||
handle->alt_sample_work2 -= 2;
|
||||
handle->samples_consumed = 0;
|
||||
handle->samples_filled = 2;
|
||||
handle->sample_pair_is_decoded = 0;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ ongakukan_adp_data* init_ongakukan_adp(STREAMFILE* sf, int32_t data_offset, int3
|
||||
sample_needs_setup, sample_has_base_setup_from_the_start);
|
||||
if (!data->handle) goto fail;
|
||||
|
||||
printf(" return data; \n");
|
||||
return data;
|
||||
fail:
|
||||
free_ongakukan_adp(data);
|
||||
@ -38,8 +39,9 @@ void decode_ongakukan_adp(VGMSTREAM* vgmstream, sample_t* outbuf, int32_t sample
|
||||
{
|
||||
ongakukan_adp_data* data = vgmstream->codec_data;
|
||||
|
||||
data->samples_filled = (int32_t)grab_samples_filled_from_ongakukan_adp(data->handle);
|
||||
data->samples_consumed = (int32_t)grab_samples_consumed_from_ongakukan_adp(data->handle);
|
||||
data->samples_done = 0;
|
||||
data->samples_filled = 0;
|
||||
data->samples_consumed = 0;
|
||||
data->samples = (int16_t*)grab_sample_hist_from_ongakukan_adp(data->handle); /* this'll return a pointer from the handle containing the samples themselves. */
|
||||
while (data->samples_done < samples_to_do)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user