Fix plugins sometimes not showing proper time with looping disabled

Also make sure loops are disabled properly, and remove loop_target refs
in foobar, since it's not set automatically anymore.
This commit is contained in:
bnnm 2018-08-19 09:45:40 +02:00
parent 3b5be9d28a
commit e208e0c0ec
2 changed files with 23 additions and 10 deletions

View File

@ -296,8 +296,9 @@ void input_vgmstream::decode_seek(double p_seconds,abort_callback & p_abort) {
// Reset of backwards seek
else if(corrected_pos_samples < decode_pos_samples) {
reset_vgmstream(vgmstream);
vgmstream->loop_target = 0;
if (ignore_loop) vgmstream->loop_flag = 0;
if (ignore_loop) {
vgmstream_force_loop(vgmstream, 0, 0,0);
}
decode_pos_samples = 0;
}
@ -389,14 +390,14 @@ void input_vgmstream::setup_vgmstream(abort_callback & p_abort) {
subsong = 1;
if (ignore_loop)
vgmstream->loop_flag = 0;
if (ignore_loop) {
vgmstream_force_loop(vgmstream, 0, 0,0);
}
decode_pos_ms = 0;
decode_pos_samples = 0;
paused = 0;
stream_length_samples = get_vgmstream_play_samples(loop_count,fade_seconds,fade_delay_seconds,vgmstream);
vgmstream->loop_target = 0;
fade_samples = (int)(fade_seconds * vgmstream->sample_rate);
}
@ -410,6 +411,9 @@ void input_vgmstream::get_subsong_info(t_uint32 p_subsong, pfc::string_base & ti
// there is no need to recreate the infostream, there is only one subsong used
if (subsong != p_subsong && !direct_subsong) {
infostream = init_vgmstream_foo(p_subsong, filename, p_abort);
if (ignore_loop) {
vgmstream_force_loop(infostream, 0, 0,0);
}
} else {
// vgmstream ready as get_info is valid after open() with any reason
infostream = vgmstream;
@ -420,7 +424,6 @@ void input_vgmstream::get_subsong_info(t_uint32 p_subsong, pfc::string_base & ti
*length_in_ms = -1000;
if (infostream) {
*length_in_ms = get_vgmstream_play_samples(loop_count,fade_seconds,fade_delay_seconds,infostream)*1000LL/infostream->sample_rate;
infostream->loop_target = 0;
*sample_rate = infostream->sample_rate;
*channels = infostream->channels;
*total_samples = infostream->num_samples;

View File

@ -926,8 +926,9 @@ int winamp_Play(const in_char *fn) {
}
/* config */
if (config.ignore_loop)
vgmstream->loop_flag = 0;
if (config.ignore_loop) {
vgmstream_force_loop(vgmstream, 0, 0,0);
}
output_channels = vgmstream->channels;
if (config.downmix_channels > 0 && config.downmix_channels < vgmstream->channels)
@ -1067,6 +1068,10 @@ int winamp_InfoBox(const in_char *fn, HWND hwnd) {
if (!infostream)
return 0;
if (config.ignore_loop) {
vgmstream_force_loop(infostream, 0, 0,0);
}
describe_vgmstream(infostream,description,description_size);
close_vgmstream(infostream);
@ -1114,6 +1119,10 @@ void winamp_GetFileInfo(const in_char *fn, in_char *title, int *length_in_ms) {
infostream = init_vgmstream_winamp(filename, stream_index);
if (!infostream) return;
if (config.ignore_loop) {
vgmstream_force_loop(infostream, 0, 0,0);
}
if (title) {
get_title(title,GETFILEINFO_TITLE_LENGTH, fn, infostream);
}
@ -1156,8 +1165,9 @@ DWORD WINAPI __stdcall decode(void *arg) {
if (seek_needed_samples < decode_pos_samples) {
reset_vgmstream(vgmstream);
if (config.ignore_loop)
vgmstream->loop_flag = 0;
if (config.ignore_loop) {
vgmstream_force_loop(vgmstream, 0, 0,0);
}
decode_pos_samples = 0;
decode_pos_ms = 0;