mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 15:00:11 +01:00
Add TXTP "loop_mode = auto" to simplify looping last segment
This commit is contained in:
parent
1a7891828f
commit
337e2d3922
12
doc/TXTP.md
12
doc/TXTP.md
@ -38,6 +38,16 @@ loop_start_segment = 2 # 2nd file start
|
||||
loop_end_segment = 2 # optional, default is last
|
||||
mode = segments # optional, default is segments
|
||||
```
|
||||
You can also set looping to the last segment like this:
|
||||
```
|
||||
BGM01_BEGIN.VAG
|
||||
BGM01_LOOPED.VAG
|
||||
|
||||
# equivalent to loop_start_segment = 2, loop_end_segment = 2
|
||||
# (only for multiple segments, to repeat a single file use #E)
|
||||
loop_mode = auto
|
||||
```
|
||||
|
||||
|
||||
If your loop segment has proper loops you want to keep, you can use:
|
||||
```
|
||||
@ -166,7 +176,7 @@ loop_mode = keep
|
||||
|
||||
|
||||
## TXTP COMMANDS
|
||||
You can set file commands by adding multiple `#(command)` after the name. `# (anything)` is considered a comment and ignored, as well as any command not understood.
|
||||
You can set file commands by adding multiple `#(command)` after the name. `#(space)(anything)` is considered a comment and ignored, as well as any command not understood.
|
||||
|
||||
### Subsong selection for bank formats
|
||||
**`#(number)` or `#s(number)`**: set subsong (number)
|
||||
|
@ -123,6 +123,7 @@ typedef struct {
|
||||
uint32_t loop_start_segment;
|
||||
uint32_t loop_end_segment;
|
||||
int is_loop_keep;
|
||||
int is_loop_auto;
|
||||
|
||||
txtp_entry default_entry;
|
||||
int default_entry_set;
|
||||
@ -313,8 +314,13 @@ static int make_group_segment(txtp_header* txtp, int position, int count) {
|
||||
|
||||
/* loop settings only make sense if this group becomes final vgmstream */
|
||||
if (position == 0 && txtp->vgmstream_count == count) {
|
||||
if (txtp->loop_start_segment && !txtp->loop_end_segment)
|
||||
if (txtp->loop_start_segment && !txtp->loop_end_segment) {
|
||||
txtp->loop_end_segment = count;
|
||||
}
|
||||
else if (txtp->is_loop_auto) { /* auto set to last segment */
|
||||
txtp->loop_start_segment = count;
|
||||
txtp->loop_end_segment = count;
|
||||
}
|
||||
loop_flag = (txtp->loop_start_segment > 0 && txtp->loop_start_segment <= count);
|
||||
}
|
||||
|
||||
@ -1389,6 +1395,9 @@ static int parse_keyval(txtp_header * txtp, const char * key, const char * val)
|
||||
if (is_substring(val,"keep")) {
|
||||
txtp->is_loop_keep = 1;
|
||||
}
|
||||
else if (is_substring(val,"auto")) {
|
||||
txtp->is_loop_auto = 1;
|
||||
}
|
||||
else {
|
||||
goto fail;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user