Author Topic: Playing subtunes (solved)  (Read 3317 times)

saga

  • Posts: 2298
Playing subtunes (solved)
« on: 8 Dec '08 - 13:29 »
Is there a way to locate subtunes in modules? Or do I have to set the MOD position manually to that pattern?
« Last Edit: 13 Dec '08 - 12:32 by saga »

Ian @ un4seen

  • Administrator
  • Posts: 21684
Re: Playing subtunes
« Reply #1 on: 8 Dec '08 - 17:28 »
BASS won't automatically locate subsongs, but I recall the question has come up before in the dim and distant past, and I'm pretty sure I posted a way to detect subsongs (by scanning the orders played via a MUSICPOS sync on a decoding channel). I think there were others, but the only post I can find right now is this one...

   www.un4seen.com/forum/?topic=2650.msg17705#msg17705

You will indeed have to set the position (via BASS_ChannelSetPosition) to the subsongs manually, however you locate them :)

saga

  • Posts: 2298
Re: Playing subtunes
« Reply #2 on: 8 Dec '08 - 18:22 »
heh, that looks a bit clumsy, but I'll try it nevertheless. :) how can i manage that the module is not played in realtime for this task?

Another idea: Is there a way to detect those "there is no pattern right here" patterns (i don't mean the "+++" placeholders which exist in s3m and it, but "---")? i'm using those as seperators for my subsongs right now, so that would actually be the best method.

saga

  • Posts: 2298
Re: Playing subtunes
« Reply #3 on: 8 Dec '08 - 19:43 »
hm, i see now that channelsetposition will return zero if there's a "---" order. i will use that as a subtune detector! :)

saga

  • Posts: 2298
Re: Playing subtunes
« Reply #4 on: 9 Dec '08 - 17:24 »
hm okay, obviously BASS doesn't distinguish between "+++" placeholders and "---" empty patterns.
I'm used to using placeholders for structuring my tunes, so I wonder whether it is possible to find out which of the two is actually at the current position...? For example by returning different error messages?  Another nice thing would be a function to read the order list...

Ian @ un4seen

  • Administrator
  • Posts: 21684
Re: Playing subtunes
« Reply #5 on: 10 Dec '08 - 17:42 »
heh, that looks a bit clumsy, but I'll try it nevertheless. :) how can i manage that the module is not played in realtime for this task?

In order to perform the task as quickly as possible, you would use a decoding channel (see the BASS_MUSIC_DECODE flag).

hm okay, obviously BASS doesn't distinguish between "+++" placeholders and "---" empty patterns.
I'm used to using placeholders for structuring my tunes, so I wonder whether it is possible to find out which of the two is actually at the current position...? For example by returning different error messages?  Another nice thing would be a function to read the order list...

Here's an update to try...

   www.un4seen.com/stuff/bass.dll

It adds the following BASS_ChannelGetTags option to retrieve the order list...

Code: [Select]
#define BASS_TAG_MUSIC_ORDERS 0x10002 // MOD order list : BYTE array of pattern numbers

Pattern number 254 is "+++" and 255 is "---". You can use BASS_ChannelGetLength (BASS_POS_MUSIC_ORDER) to get the length of the array.

This update should also allow seeking to "+++" positions (row 0 only), but not "---" positions.

saga

  • Posts: 2298
Re: Playing subtunes
« Reply #6 on: 10 Dec '08 - 18:22 »
that sounds pretty interesting. i've came up with the solution to use two invalid patterns instead of one, but this is far more nifty and I won't forget to add patterns that way. Ta! :)

saga

  • Posts: 2298
Re: Playing subtunes (solved)
« Reply #7 on: 26 Dec '08 - 11:34 »
Hmm.... Strange. Now I tested the whole thing (seeking through the orders to look for "---" items) in the linux version of my game, and strangely, it only finds the first tune in the module. Did you incorporate these changes into the latest linux beta as well?
EDIT: nvm, I can't recall having changed anything, but it's working again.
« Last Edit: 29 Dec '08 - 12:30 by saga »