mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 15:54:05 +01:00
Fix foobar not disabling loop forever when needed
This commit is contained in:
parent
e723ca7cf7
commit
6345c3e6ea
@ -248,7 +248,6 @@ t_filestats input_vgmstream::get_file_stats(abort_callback & p_abort) {
|
||||
|
||||
// called right before actually playing (decoding) a song/subsong
|
||||
void input_vgmstream::decode_initialize(t_uint32 p_subsong, unsigned p_flags, abort_callback & p_abort) {
|
||||
force_ignore_loop = !!(p_flags & input_flag_no_looping);
|
||||
|
||||
// if subsong changes recreate vgmstream
|
||||
if (subsong != p_subsong && !direct_subsong) {
|
||||
@ -256,7 +255,13 @@ void input_vgmstream::decode_initialize(t_uint32 p_subsong, unsigned p_flags, ab
|
||||
setup_vgmstream(p_abort);
|
||||
}
|
||||
|
||||
decode_seek( 0, p_abort );
|
||||
// "don't loop forever" flag (set when converting to file, scanning for replaygain, etc)
|
||||
// flag is set *after* loading vgmstream + applying config so manually disable
|
||||
bool force_ignore_loop = !!(p_flags & input_flag_no_looping);
|
||||
if (force_ignore_loop) // could always set but vgmstream is re-created on play start
|
||||
vgmstream_set_play_forever(vgmstream, 0);
|
||||
|
||||
decode_seek(0, p_abort);
|
||||
};
|
||||
|
||||
// called when audio buffer needs to be filled
|
||||
|
@ -58,7 +58,6 @@ class input_vgmstream : public input_stubs {
|
||||
double fade_delay_seconds;
|
||||
double loop_count;
|
||||
bool loop_forever;
|
||||
bool force_ignore_loop;
|
||||
int ignore_loop;
|
||||
bool disable_subsongs;
|
||||
|
||||
|
@ -80,9 +80,9 @@ static void load_default_config(play_config_t* def, play_config_t* tcfg) {
|
||||
def->ignore_loop = 0;
|
||||
}
|
||||
if (tcfg->loop_count_set) {
|
||||
def->ignore_loop = 0;
|
||||
def->loop_count = tcfg->loop_count;
|
||||
def->loop_count_set = 1;
|
||||
def->ignore_loop = 0;
|
||||
if (!tcfg->play_forever)
|
||||
def->play_forever = 0;
|
||||
}
|
||||
@ -93,9 +93,11 @@ static void load_default_config(play_config_t* def, play_config_t* tcfg) {
|
||||
}
|
||||
if (tcfg->fade_delay_set) {
|
||||
def->fade_delay = tcfg->fade_delay;
|
||||
def->fade_delay_set = 1;
|
||||
}
|
||||
if (tcfg->fade_time_set) {
|
||||
def->fade_time = tcfg->fade_time;
|
||||
def->fade_time_set = 1;
|
||||
}
|
||||
|
||||
/* loop priority: #i > #e > #E */
|
||||
|
@ -65,6 +65,7 @@ typedef struct {
|
||||
void vgmstream_apply_config(VGMSTREAM* vgmstream, vgmstream_cfg_t* pcfg);
|
||||
int32_t vgmstream_get_samples(VGMSTREAM* vgmstream);
|
||||
int vgmstream_get_play_forever(VGMSTREAM* vgmstream);
|
||||
void vgmstream_set_play_forever(VGMSTREAM* vgmstream, int enabled);
|
||||
|
||||
|
||||
|
||||
|
@ -52,6 +52,13 @@ int vgmstream_get_play_forever(VGMSTREAM* vgmstream) {
|
||||
return vgmstream->config.play_forever;
|
||||
}
|
||||
|
||||
void vgmstream_set_play_forever(VGMSTREAM* vgmstream, int enabled) {
|
||||
/* sometimes we need to enable/disable right before playback
|
||||
* (play config is left untouched, should mix ok as this flag is only used during
|
||||
* render, while config is always prepared as if play forever wasn't enabled) */
|
||||
vgmstream->config.play_forever = enabled;
|
||||
}
|
||||
|
||||
int32_t vgmstream_get_samples(VGMSTREAM* vgmstream) {
|
||||
if (!vgmstream->config_enabled || !vgmstream->config.config_set)
|
||||
return vgmstream->num_samples;
|
||||
|
Loading…
x
Reference in New Issue
Block a user