Author Topic: Get Mod Channels Names  (Read 141 times)

Baby

  • Posts: 36
Get Mod Channels Names
« on: 5 May '21 - 13:41 »
I recently discovered that you can name channels in OpenMPT. So instead of 'Channel 1' you can name channels to, e.g. 'Drums' and so on.
It would be great  to read the channel names from the mod. Maybe something around  BASS_MusicGetChannelNames( HMUSIC handle, ...); or 
char* BASS_MusicGetChannelName(HMUSIC handle, int channelIndex);

Thanks and keep on the good work!

Ian @ un4seen

  • Administrator
  • Posts: 23640
Re: Get Mod Channels Names
« Reply #1 on: 5 May '21 - 15:38 »
I think it would be possible to add support for that via new BASS_TAG_MUSIC_CHAN tags (similar to the existing BASS_TAG_MUSIC_INST/SAMPLE tags). I'll look into it.

Ian @ un4seen

  • Administrator
  • Posts: 23640
Re: Get Mod Channels Names
« Reply #2 on: 10 May '21 - 15:05 »
Here's something for you to try:

   www.un4seen.com/stuff/bass.zip

It adds the mentioned BASS_TAG_MUSIC_CHAN tag option, which you would use something like this:

Code: [Select]
for (int a = 0;; a++) {
const char *name = BASS_ChannelGetTags(chan, BASS_TAG_MUSIC_CHAN + a);
if (!name) break;
printf("chan %d = %s\n", a + 1, name);
}

Let me know if you have any trouble with it.

Baby

  • Posts: 36
Re: Get Mod Channels Names
« Reply #3 on: 11 May '21 - 09:05 »
Thank you!
I was forced offline since Sunday, so sorry for not answering. I'll try.

Baby

  • Posts: 36
Re: Get Mod Channels Names
« Reply #4 on: 11 May '21 - 11:01 »
Sorry, always gives a NULL- pointer.
I also tried BASS_TAG_MUSIC_SAMPLE, which seems to work fine.

BASS_ErrorGetCode() returns BASS_ERROR_NOTAVAIL.
« Last Edit: 11 May '21 - 12:04 by Baby »

Ian @ un4seen

  • Administrator
  • Posts: 23640
Re: Get Mod Channels Names
« Reply #5 on: 11 May '21 - 16:16 »
That's strange. Are you sure the file contains channel names, eg. you see them in OpenMPT? If so, please upload the file to have a look at here:

   ftp.un4seen.com/incoming/

Baby

  • Posts: 36
Re: Get Mod Channels Names
« Reply #6 on: 11 May '21 - 16:47 »
Was my fault. I used a mo3 compressed mod. Works like a charm now (at least in C++, the rest is my beer).
Thank you very much!

Baby

  • Posts: 36
Re: Get Mod Channels Names
« Reply #7 on: 11 May '21 - 18:06 »
One little problem.
If called with an mo3 compressed mod (channel names are available and shown in OpenMPT)  BASS_ChannelGetTags() returns NULL.
But it works with uncompressed mods, at least with the ones I tested.

I'll upload the mod in question:  WastelandTunesMO3.bytes
« Last Edit: 11 May '21 - 18:11 by Baby »

Ian @ un4seen

  • Administrator
  • Posts: 23640
Re: Get Mod Channels Names
« Reply #8 on: 12 May '21 - 13:46 »
Oh yes, indeed channel names weren't being read from MO3 files. Here's another update to fix that:

   www.un4seen.com/stuff/bass.zip

Baby

  • Posts: 36
Re: Get Mod Channels Names
« Reply #9 on: 12 May '21 - 16:10 »
Works perfectly. Thanks again.