mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-12 01:30:49 +01:00
Remove unnecessary seeking and decoding alignment, as there is only one broken decoder.
This commit is contained in:
parent
b5e6808afc
commit
c226522283
@ -59,8 +59,6 @@ class input_vgmstream {
|
||||
bool force_ignore_loop;
|
||||
int ignore_loop;
|
||||
int seek_pos_samples;
|
||||
int decode_step_size;
|
||||
int decode_discard;
|
||||
|
||||
t_filestats stats;
|
||||
|
||||
|
@ -94,7 +94,6 @@ void input_vgmstream::open(service_ptr_t<file> p_filehint,const char * p_path,t_
|
||||
decode_pos_samples = 0;
|
||||
paused = 0;
|
||||
stream_length_samples = get_vgmstream_play_samples(loop_count,fade_seconds,fade_delay_seconds,vgmstream);
|
||||
decode_step_size = get_vgmstream_samples_per_frame(vgmstream);
|
||||
|
||||
fade_samples = (int)(fade_seconds * vgmstream->sample_rate);
|
||||
|
||||
@ -203,12 +202,6 @@ bool input_vgmstream::decode_run(audio_chunk & p_chunk,abort_callback & p_abort)
|
||||
int l = 0, samples_to_do = max_buffer_samples, t= 0;
|
||||
|
||||
if(vgmstream) {
|
||||
if (max_buffer_samples % decode_step_size)
|
||||
{
|
||||
max_buffer_samples -= max_buffer_samples % decode_step_size;
|
||||
samples_to_do = max_buffer_samples;
|
||||
}
|
||||
|
||||
bool loop_okay = loop_forever && vgmstream->loop_flag && !ignore_loop && !force_ignore_loop;
|
||||
if (decode_pos_samples+max_buffer_samples>stream_length_samples && !loop_okay)
|
||||
samples_to_do=stream_length_samples-decode_pos_samples;
|
||||
@ -243,16 +236,7 @@ bool input_vgmstream::decode_run(audio_chunk & p_chunk,abort_callback & p_abort)
|
||||
}
|
||||
}
|
||||
|
||||
if (decode_discard)
|
||||
{
|
||||
decode_discard *= vgmstream->channels * 2;
|
||||
p_chunk.set_data_fixedpoint(((char*)sample_buffer) + decode_discard, l - decode_discard, vgmstream->sample_rate, vgmstream->channels, 16, audio_chunk::g_guess_channel_config(vgmstream->channels));
|
||||
decode_discard = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_chunk.set_data_fixedpoint((char*)sample_buffer, l, vgmstream->sample_rate, vgmstream->channels, 16, audio_chunk::g_guess_channel_config(vgmstream->channels));
|
||||
}
|
||||
p_chunk.set_data_fixedpoint((char*)sample_buffer, l, vgmstream->sample_rate, vgmstream->channels, 16, audio_chunk::g_guess_channel_config(vgmstream->channels));
|
||||
|
||||
decode_pos_samples+=samples_to_do;
|
||||
decode_pos_ms=decode_pos_samples*1000LL/vgmstream->sample_rate;
|
||||
@ -268,13 +252,6 @@ void input_vgmstream::decode_seek(double p_seconds,abort_callback & p_abort) {
|
||||
int max_buffer_samples = sizeof(sample_buffer)/sizeof(sample_buffer[0])/vgmstream->channels;
|
||||
bool loop_okay = loop_forever && vgmstream->loop_flag && !ignore_loop && !force_ignore_loop;
|
||||
|
||||
decode_discard = 0;
|
||||
|
||||
if (seek_pos_samples % decode_step_size) {
|
||||
decode_discard = seek_pos_samples % decode_step_size;
|
||||
seek_pos_samples -= decode_discard;
|
||||
}
|
||||
|
||||
int corrected_pos_samples = seek_pos_samples;
|
||||
|
||||
// adjust for correct position within loop
|
||||
|
Loading…
Reference in New Issue
Block a user