Adjust some settings

This commit is contained in:
bnnm 2020-07-23 21:10:55 +02:00
parent 48a9836828
commit d0f1b85d59
2 changed files with 13 additions and 10 deletions

View File

@ -28,11 +28,10 @@ static void setup_state_vgmstream(VGMSTREAM* vgmstream) {
pc->trim_begin = pc->trim_begin_s * sample_rate;
if (pc->trim_end_s)
pc->trim_end = pc->trim_end_s * sample_rate;
if (pc->target_time_s)
pc->target_time = pc->target_time_s * sample_rate;
if (pc->body_time_s)
pc->body_time = pc->body_time_s * sample_rate;
//todo fade time also set to samples
/* samples before all decode */
ps->pad_begin_left = pc->pad_begin;
@ -41,8 +40,8 @@ static void setup_state_vgmstream(VGMSTREAM* vgmstream) {
/* main samples part */
ps->body_left = 0;
if (pc->target_time) {
ps->body_left += pc->target_time; /* whether it loops or not */
if (pc->body_time) {
ps->body_left += pc->body_time; /* whether it loops or not */
}
else if (vgmstream->loop_flag) {
ps->body_left += vgmstream->loop_start_sample;
@ -165,7 +164,7 @@ static void load_internal_config(VGMSTREAM* vgmstream, play_config_t* def, play_
copy_time(&def->pad_end_set, &def->pad_end, &def->pad_end_s, &tcfg->pad_end_set, &tcfg->pad_end, &tcfg->pad_end_s);
copy_time(&def->trim_begin_set, &def->trim_begin, &def->trim_begin_s, &tcfg->trim_begin_set, &tcfg->trim_begin, &tcfg->trim_begin_s);
copy_time(&def->trim_end_set, &def->trim_end, &def->trim_end_s, &tcfg->trim_end_set, &tcfg->trim_end, &tcfg->trim_end_s);
copy_time(&def->target_time_set,&def->target_time, &def->target_time_s, &tcfg->target_time_set, &tcfg->target_time, &tcfg->target_time_s);
copy_time(&def->body_time_set, &def->body_time, &def->body_time_s, &tcfg->body_time_set, &tcfg->body_time, &tcfg->body_time_s);
}

View File

@ -791,7 +791,7 @@ typedef struct {
double loop_count;
int32_t pad_begin;
int32_t trim_begin;
int32_t target_time;
int32_t body_time;
int32_t trim_end;
double fade_delay; /* not in samples for backwards compatibility */
double fade_time;
@ -799,7 +799,7 @@ typedef struct {
double pad_begin_s;
double trim_begin_s;
double target_time_s;
double body_time_s;
double trim_end_s;
//double fade_delay_s;
//double fade_time_s;
@ -808,7 +808,7 @@ typedef struct {
/* internal flags */
int pad_begin_set;
int trim_begin_set;
int target_time_set;
int body_time_set;
int loop_count_set;
int trim_end_set;
int fade_delay_set;
@ -964,11 +964,15 @@ typedef struct {
/* play config/state */
int config_set; /* current config */
int config_set; /* config can be used */
play_config_t config; /* player config (applied over decoding) */
play_state_t pstate; /* player state (applied over decoding) */
int loop_count; /* counter of complete loops (1=looped once) */
int loop_target; /* max loops before continuing with the stream end (loops forever if not set) */
/* config must be set/allowed by the player, otherwise vgmstream behaves like a simple lib decoder
* (could always apply some config like begin trim/padding + modify get_vgmstream_samples, but
* external caller may read loops/samples manually and wouldn't expect this changed output),
* also segment/layer layouts may behave differently wheter set or not */
} VGMSTREAM;