mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-19 00:04:04 +01:00
Show loop info even when disabling loops in plugin's config
This commit is contained in:
parent
98587ec8e7
commit
ba0345ceb6
@ -131,11 +131,11 @@ void input_vgmstream::get_info(t_uint32 p_subsong, file_info & p_info, abort_cal
|
|||||||
int length_in_ms=0, channels = 0, samplerate = 0;
|
int length_in_ms=0, channels = 0, samplerate = 0;
|
||||||
int total_samples = -1;
|
int total_samples = -1;
|
||||||
int bitrate = 0;
|
int bitrate = 0;
|
||||||
int loop_start = -1, loop_end = -1;
|
int loop_flag = -1, loop_start = -1, loop_end = -1;
|
||||||
pfc::string8 description;
|
pfc::string8 description;
|
||||||
pfc::string8_fast temp;
|
pfc::string8_fast temp;
|
||||||
|
|
||||||
get_subsong_info(p_subsong, temp, &length_in_ms, &total_samples, &loop_start, &loop_end, &samplerate, &channels, &bitrate, description, p_abort);
|
get_subsong_info(p_subsong, temp, &length_in_ms, &total_samples, &loop_flag, &loop_start, &loop_end, &samplerate, &channels, &bitrate, description, p_abort);
|
||||||
|
|
||||||
|
|
||||||
/* set tag info (metadata tab in file properties) */
|
/* set tag info (metadata tab in file properties) */
|
||||||
@ -193,7 +193,8 @@ void input_vgmstream::get_info(t_uint32 p_subsong, file_info & p_info, abort_cal
|
|||||||
p_info.info_set_bitrate(bitrate / 1000);
|
p_info.info_set_bitrate(bitrate / 1000);
|
||||||
if (total_samples > 0)
|
if (total_samples > 0)
|
||||||
p_info.info_set_int("stream_total_samples", total_samples);
|
p_info.info_set_int("stream_total_samples", total_samples);
|
||||||
if (loop_start >= 0 && loop_end >= loop_start) {
|
if (loop_start >= 0 && loop_end > loop_start) {
|
||||||
|
p_info.info_set("looping", loop_flag > 0 ? "enabled" : "disabled");
|
||||||
p_info.info_set_int("loop_start", loop_start);
|
p_info.info_set_int("loop_start", loop_start);
|
||||||
p_info.info_set_int("loop_end", loop_end);
|
p_info.info_set_int("loop_end", loop_end);
|
||||||
}
|
}
|
||||||
@ -440,7 +441,7 @@ void input_vgmstream::setup_vgmstream(abort_callback & p_abort) {
|
|||||||
fade_samples = (int)(config.song_fade_time * vgmstream->sample_rate);
|
fade_samples = (int)(config.song_fade_time * vgmstream->sample_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void input_vgmstream::get_subsong_info(t_uint32 p_subsong, pfc::string_base & title, int *length_in_ms, int *total_samples, int *loop_start, int *loop_end, int *sample_rate, int *channels, int *bitrate, pfc::string_base & description, abort_callback & p_abort) {
|
void input_vgmstream::get_subsong_info(t_uint32 p_subsong, pfc::string_base & title, int *length_in_ms, int *total_samples, int *loop_flag, int *loop_start, int *loop_end, int *sample_rate, int *channels, int *bitrate, pfc::string_base & description, abort_callback & p_abort) {
|
||||||
VGMSTREAM * infostream = NULL;
|
VGMSTREAM * infostream = NULL;
|
||||||
bool is_infostream = false;
|
bool is_infostream = false;
|
||||||
foobar_song_config infoconfig;
|
foobar_song_config infoconfig;
|
||||||
@ -473,10 +474,9 @@ void input_vgmstream::get_subsong_info(t_uint32 p_subsong, pfc::string_base & ti
|
|||||||
*channels = infostream->channels;
|
*channels = infostream->channels;
|
||||||
*total_samples = infostream->num_samples;
|
*total_samples = infostream->num_samples;
|
||||||
*bitrate = get_vgmstream_average_bitrate(infostream);
|
*bitrate = get_vgmstream_average_bitrate(infostream);
|
||||||
if (infostream->loop_flag) {
|
*loop_flag = infostream->loop_flag;
|
||||||
*loop_start = infostream->loop_start_sample;
|
*loop_start = infostream->loop_start_sample;
|
||||||
*loop_end = infostream->loop_end_sample;
|
*loop_end = infostream->loop_end_sample;
|
||||||
}
|
|
||||||
|
|
||||||
char temp[1024];
|
char temp[1024];
|
||||||
describe_vgmstream(infostream, temp, 1024);
|
describe_vgmstream(infostream, temp, 1024);
|
||||||
|
@ -85,7 +85,7 @@ class input_vgmstream : public input_stubs {
|
|||||||
VGMSTREAM * init_vgmstream_foo(t_uint32 p_subsong, const char * const filename, abort_callback & p_abort);
|
VGMSTREAM * init_vgmstream_foo(t_uint32 p_subsong, const char * const filename, abort_callback & p_abort);
|
||||||
void setup_vgmstream(abort_callback & p_abort);
|
void setup_vgmstream(abort_callback & p_abort);
|
||||||
void load_settings();
|
void load_settings();
|
||||||
void get_subsong_info(t_uint32 p_subsong, pfc::string_base & title, int *length_in_ms, int *total_samples, int *loop_start, int *loop_end, int *sample_rate, int *channels, int *bitrate, pfc::string_base & description, abort_callback & p_abort);
|
void get_subsong_info(t_uint32 p_subsong, pfc::string_base & title, int *length_in_ms, int *total_samples, int *loop_flag, int *loop_start, int *loop_end, int *sample_rate, int *channels, int *bitrate, pfc::string_base & description, abort_callback & p_abort);
|
||||||
bool get_description_tag(pfc::string_base & temp, pfc::string_base const& description, const char *tag, char delimiter = '\n');
|
bool get_description_tag(pfc::string_base & temp, pfc::string_base const& description, const char *tag, char delimiter = '\n');
|
||||||
void set_config_defaults(foobar_song_config *current);
|
void set_config_defaults(foobar_song_config *current);
|
||||||
void apply_config(VGMSTREAM * vgmstream, foobar_song_config *current);
|
void apply_config(VGMSTREAM * vgmstream, foobar_song_config *current);
|
||||||
|
@ -506,15 +506,17 @@ static VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile) {
|
|||||||
close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanify loops! */
|
/* sanify loops and remove bad metadata */
|
||||||
if (vgmstream->loop_flag) {
|
if (vgmstream->loop_flag) {
|
||||||
if (vgmstream->loop_end_sample <= vgmstream->loop_start_sample
|
if (vgmstream->loop_end_sample <= vgmstream->loop_start_sample
|
||||||
|| vgmstream->loop_end_sample > vgmstream->num_samples
|
|| vgmstream->loop_end_sample > vgmstream->num_samples
|
||||||
|| vgmstream->loop_start_sample < 0) {
|
|| vgmstream->loop_start_sample < 0) {
|
||||||
vgmstream->loop_flag = 0;
|
|
||||||
VGM_LOG("VGMSTREAM: wrong loops ignored (lss=%i, lse=%i, ns=%i)\n",
|
VGM_LOG("VGMSTREAM: wrong loops ignored (lss=%i, lse=%i, ns=%i)\n",
|
||||||
vgmstream->loop_start_sample, vgmstream->loop_end_sample, vgmstream->num_samples);
|
vgmstream->loop_start_sample, vgmstream->loop_end_sample, vgmstream->num_samples);
|
||||||
|
vgmstream->loop_flag = 0;
|
||||||
|
vgmstream->loop_start_sample = 0;
|
||||||
|
vgmstream->loop_end_sample = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,8 +544,9 @@ static VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile) {
|
|||||||
|
|
||||||
/* save info */
|
/* save info */
|
||||||
/* stream_index 0 may be used by plugins to signal "vgmstream default" (IOW don't force to 1) */
|
/* stream_index 0 may be used by plugins to signal "vgmstream default" (IOW don't force to 1) */
|
||||||
if (vgmstream->stream_index == 0)
|
if (vgmstream->stream_index == 0) {
|
||||||
vgmstream->stream_index = streamFile->stream_index;
|
vgmstream->stream_index = streamFile->stream_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
setup_vgmstream(vgmstream); /* final setup */
|
setup_vgmstream(vgmstream); /* final setup */
|
||||||
@ -958,11 +961,13 @@ void vgmstream_force_loop(VGMSTREAM* vgmstream, int loop_flag, int loop_start_sa
|
|||||||
if (loop_flag) {
|
if (loop_flag) {
|
||||||
vgmstream->loop_start_sample = loop_start_sample;
|
vgmstream->loop_start_sample = loop_start_sample;
|
||||||
vgmstream->loop_end_sample = loop_end_sample;
|
vgmstream->loop_end_sample = loop_end_sample;
|
||||||
} else {
|
}
|
||||||
|
#if 0 /* keep metadata as it's may be shown (with 'loop disabled' info) */
|
||||||
|
else {
|
||||||
vgmstream->loop_start_sample = 0;
|
vgmstream->loop_start_sample = 0;
|
||||||
vgmstream->loop_end_sample = 0;
|
vgmstream->loop_end_sample = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* propagate changes to layouts that need them */
|
/* propagate changes to layouts that need them */
|
||||||
if (vgmstream->layout_type == layout_layered) {
|
if (vgmstream->layout_type == layout_layered) {
|
||||||
@ -2275,10 +2280,12 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
|||||||
vgmstream->channels);
|
vgmstream->channels);
|
||||||
concatn(length,desc,temp);
|
concatn(length,desc,temp);
|
||||||
|
|
||||||
if (vgmstream->loop_flag) {
|
if (vgmstream->loop_start_sample >= 0 && vgmstream->loop_end_sample > vgmstream->loop_start_sample) {
|
||||||
snprintf(temp,TEMPSIZE,
|
snprintf(temp,TEMPSIZE,
|
||||||
|
"looping: %s\n"
|
||||||
"loop start: %d samples (%.4f seconds)\n"
|
"loop start: %d samples (%.4f seconds)\n"
|
||||||
"loop end: %d samples (%.4f seconds)\n",
|
"loop end: %d samples (%.4f seconds)\n",
|
||||||
|
vgmstream->loop_flag ? "enabled" : "disabled",
|
||||||
vgmstream->loop_start_sample,
|
vgmstream->loop_start_sample,
|
||||||
(double)vgmstream->loop_start_sample/vgmstream->sample_rate,
|
(double)vgmstream->loop_start_sample/vgmstream->sample_rate,
|
||||||
vgmstream->loop_end_sample,
|
vgmstream->loop_end_sample,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user