Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to properly retrieve the number of tracks in the song? #603

Closed
Wohlstand opened this issue Aug 10, 2022 · 5 comments
Closed

Comments

@Wohlstand
Copy link
Contributor

Wohlstand commented Aug 10, 2022

Hello!

At my library (where I use libXMP), I do use the music->fi.virt_channels field to retrieve a number of channels (I need that to pass into the UI of my player to allow the user to mute each track of the song individually). However, one of the users reported that there is an IT file with 16 tracks programmed, and reported 144 tracks. Should I use a different way to retrieve a number of tracks in the song to report them correctly?

The test file: pm-shiver-mountain.it.gz

@Wohlstand Wohlstand changed the title [Question] How to properly retrieve number of tracks in the song? [Question] How to properly retrieve the number of tracks in the song? Aug 10, 2022
@AliceLR
Copy link
Contributor

AliceLR commented Aug 10, 2022

The correct field should be xmp_module::chn—for IT modules, xmp_frame_info::virt_channels will report that number +128 because libxmp allocates 128 virtual channels to handle NNAs. Using the SMIX API can also affect that number IIRC.

@Wohlstand
Copy link
Contributor Author

Wohlstand commented Aug 10, 2022

I see, thanks for the note, but:

xmp_module::chn—for IT modules

Is this valid for all other modules too? Which way is universal?

EDIT: I tested the thing on various formats (which examples I had at me: IT, MOD, XM, S3M, PSM, AMF, IMF), and they work fine and report a proper number of channels. I am not sure if this way is valid for all formats, mainly because of your "for IT modules" phrase which expects "way for IT modules exclusively".

@AliceLR
Copy link
Contributor

AliceLR commented Aug 10, 2022

Ok, to rephrase: the correct field is xmp_module::chn.

For IT modules, and most likely for any module where SMIX has been enabled (not sure), xmp_frame_info::virt_channels is guaranteed to report the wrong number.

@sezero
Copy link
Collaborator

sezero commented Sep 26, 2022

I think this can be closed now. If there are still unclear points or further questions, then re-open.

@sezero sezero closed this as completed Sep 26, 2022
@Wohlstand
Copy link
Contributor Author

Ye, it's fine to close, the question was solved a while ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants