Author Topic: Calculate time from start of mod to specified order if row is 0?  (Read 673 times)

Ketil

  • Posts: 4
According to the docs, setting the position in orders and rows resets the channel's byte position (as reported by BASS_ChannelGetPosition) because it is not possible to get the byte position of an order/row position.

I assume it would be possible to calculate the time it should take for any mod player - BASS based or not - to reach the first row of an order that is used in a mod?

Anybody already done this? Like in assembler? Like first get that time, then use BASS_ChannelSeconds2Bytes to get the byte address and then seek using BASS_POS_BYTE instead of using BASS_POS_MUSIC_ORDER just to avoid having BASS choke itself? I want to create a music player that allows me to navigate a mod using the orders, not just for getting control over sub songs but because it is a feature of BASS and I do not want to have to code it in such a way that all the time statistics has to be hidden when that part of the player is used.

saga

  • Posts: 2181
Quote
I assume it would be possible to calculate the time it should take for any mod player - BASS based or not - to reach the first row of an order that is used in a mod?
As the BASS documentation says, this is not possible in the general case, as you may end up in an infinite loop (thanks to some nasty bugs in pattern loop commands that need to be emulated) and there is no way to find out if that is the case. Most module players and trackers have code to estimate the play time associated with a given position, but it should always be taken with a grain of salt.
Quote
Anybody already done this? Like in assembler? Like first get that time, then use BASS_ChannelSeconds2Bytes to get the byte address and then seek using BASS_POS_BYTE instead of using BASS_POS_MUSIC_ORDER just to avoid having BASS choke itself? I want to create a music player that allows me to navigate a mod using the orders, not just for getting control over sub songs but because it is a feature of BASS and I do not want to have to code it in such a way that all the time statistics has to be hidden when that part of the player is used.
Maybe I didn't understand correctly but to me it sounds like you want to use BASS_ChannelSetPosition with the BASS_POS_MUSIC_ORDER flag? You don't need to calculate the exact order position in seconds for that.

Ketil

  • Posts: 4
Annoying that XMPlay can calculate the length of sub songs (and because of that the complete length of a module) when BASS can't even when XMPlay and BASS are made by the same people. If you can't get the length of those sub songs then you can't even create a simple trackbar to control what part of a module to play. XMPlay has such a trackbar. You can't even create a trackbar based on orders (like modtest.exe) because then you get no time stats at all. Not even from the first part of the file. There aren't any BASS_ChannelOrders2Seconds function. XMPlay has it.

The question is simple: How do you calculate the time? Has anybody done this already? Anybody created a BASS_ChannelOrders2Seconds function?

saga

  • Posts: 2181
You can't really do this with BASS, as this functionality is not exposed by its public interface. You could of course ask Ian to add subsong control - although it doesn't quite fit the overall library concept, I guess. If you really need full control over subsongs, I suggest taking a look at libopenmpt. There is a ready-made example for integrating libopenmpt with BASS (see contrib/libopenmpt folder), so you can easily plug it into your existing code.