View Issue Details

IDProjectCategoryView StatusLast Update
0000957OpenMPTlibopenmptpublic2017-05-25 08:13
Reporterwolfensg Assigned ToSaga Musix  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Product VersionOpenMPT 1.26.11.00 / libopenmpt 0.2-beta24 (upgrade first) 
Summary0000957: Some XM/MOD/S3M/IT files with subsongs appear to have only first subsong accessible
Description

I guess the following may be the case, i.e. it depends on the patterns used in the sequence in the module.

I mean the sequence of patterns in Beyond The Network may be like (example - not related to the real thing):
Pattern No. | Real Note Data of Song No.
1 | 1
2 | 1
3 | 1
4 | 2
5 | 2
etc.

While 02-world00 may have something like:
Pattern No. | Real Note Data of Song No.
1 | 1
2 | 1
3 | - no song data - empty or invalid pattern
4 | 2
5 | 2

It seem the libopenmpt library interprets the second scenario as end of the mod file despite that after the "divider" there are some other parts/subsongs.

Steps To Reproduce

Attached file does not work properly.

TagsNo tags attached.
Attached Files
02-world00.zip (293,116 bytes)
Has the bug occurred in previous versions?
Tested code revision (in case you know it)

Activities

Saga Musix

Saga Musix

2017-05-23 17:02

administrator   ~0003031

Last edited: 2017-05-23 17:02

If a module contains more than one song, you need to either explicitely set the song you want to play using openmpt::module::select_subsong with a parameter in the range 0...openmpt::module::get_num_subsongs(), or with the parameter -1 which plays all subsongs consecutively. Did you do that? libopenmpt generally does not care if there are "---" items between subsongs or not.

Saga Musix

Saga Musix

2017-05-23 17:13

administrator   ~0003032

Last edited: 2017-05-23 17:15

Note that all the subsongs in the example file you provided start with four silent patterns. libopenmpt does currently not strip any leading or trailing silence from modules, so you will have to skip about 20 seconds into the subsong to actually hear anything.
You could implement your own stripping mechanism by checking if the beginning of libopenmpt's decoded audio consists of nothing but 0 samples, and then decode another block until you find any audio data that is not 0.

Untested pseudocode which could achieve something like that:

bool first_decoded_block = true; // this needs to be some sort of global variable that is stored alongside the openmpt::module instance
...
do
{
    size_t num_rendered_frames = module.read(...)
    if(first_decoded_block)
    {
        for(size_t i = 0; i < num_rendered_frames * 2) // assuming stereo
        {
            if(buffer[i] != 0)
            {
                first_decoded_block = false;
                break;
            }
        }
    }
} while(first_decoded_block);
wolfensg

wolfensg

2017-05-23 18:04

reporter   ~0003033

Many thanks for your input. I understand the issue now.
I guess the developer of the app I am using would rather like to have this "fixed" in the library itself but anyway I will get back to him with this workaround.

Saga Musix

Saga Musix

2017-05-23 22:10

administrator   ~0003034

Silence trimming will probably not be implemented very soon, and once it's implemented it will be an optional feature.

Issue History

Date Modified Username Field Change
2017-05-23 16:55 wolfensg New Issue
2017-05-23 16:55 wolfensg File Added: 02-world00.zip
2017-05-23 17:02 Saga Musix Assigned To => Saga Musix
2017-05-23 17:02 Saga Musix Status new => feedback
2017-05-23 17:02 Saga Musix Note Added: 0003031
2017-05-23 17:02 Saga Musix Note Edited: 0003031
2017-05-23 17:13 Saga Musix Note Added: 0003032
2017-05-23 17:15 Saga Musix Note Edited: 0003032
2017-05-23 18:04 wolfensg Note Added: 0003033
2017-05-23 18:04 wolfensg Status feedback => assigned
2017-05-23 22:10 Saga Musix Note Added: 0003034
2017-05-25 08:13 Saga Musix Status assigned => closed
2017-05-25 08:13 Saga Musix Resolution open => no change required