Author Topic: [C/C++] Using FreeBasic-version of MiniFmod library  (Read 16836 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C/C++] Using FreeBasic-version of MiniFmod library
« Reply #20 on: December 09, 2009 »
Hellfire shows how to work out which note at which octave is playing.  You already know how to work out which sample is playing.
What else do you need?  Alternatively, what do you mean you're having a problem incorporating it?

Jim
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: [C/C++] Using FreeBasic-version of MiniFmod library
« Reply #21 on: December 09, 2009 »
So you want to compare a numeric xm-note with an textual representation as shown in a tracker ?

Try something like this:
Code: [Select]
int stringToXmNote(char *note)
{
   char map[7]={
      9, // A- A#
     11, // B-
      0, // C- C#
      2, // D- D#
      4, // E-
      5, // F- F#
      7  // G- G#
   };

   // map first character from [C,D,E,F,G,A,B] to [0,2,4,5,7,9,11]
   int n= map[note[0]-'A'];
   // half note: second character is '#'
   if (note[1]=='#') n++;
   // extract octave
   int o= note[2] - '0';
   // convert to note-number
   return (o*12)+n+1;
}

Use like this:
Code: [Select]
int xmnote= MiniFmod_GetSynch(channel) & 0xff;
if (xmnote == stringToXmNote("D#4"))
{
  ...
}

« Last Edit: December 09, 2009 by hellfire »
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C/C++] Using FreeBasic-version of MiniFmod library
« Reply #22 on: December 09, 2009 »
Thanks alot dude.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C/C++] Using FreeBasic-version of MiniFmod library
« Reply #23 on: September 30, 2010 »
I've got back to this, it looks brilliant the snippet above Dude, but it's not working with the stringToXMNote.

Code: [Select]
int xmnote= MiniFmod_GetSynch(5) & 0xff;
if (xmnote == stringToXmNote("D-6"))
{
 draw_box();
}

Huge thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: [C/C++] Using FreeBasic-version of MiniFmod library
« Reply #24 on: September 30, 2010 »
Quote
it looks brilliant the snippet above Dude, but it's not working
Yes, Dude, that's quite possible!
That's either because my code is crap or you're using it wrong, Dude.
Can you be more specific, Dude, or even post an example?
;D
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C/C++] Using FreeBasic-version of MiniFmod library
« Reply #25 on: September 30, 2010 »
Dude, it's just using your code above, and the bit I posted above dude.
 
you could try it out with the riseup module, if you wanted Hellfire dude.

Cheers Dude!
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: [C/C++] Using FreeBasic-version of MiniFmod library
« Reply #26 on: October 03, 2010 »
you could try it out with the riseup module
That's a 4-channel module, but you're reading the note from channel 5:
Quote
Code: [Select]
int xmnote= MiniFmod_GetSynch(5) & 0xff;

Try
Code: [Select]
int xmnote= MiniFmod_GetSynch(3) & 0xff;
if (xmnote == stringToXmNote("A-4")) ...
« Last Edit: October 03, 2010 by hellfire »
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C/C++] Using FreeBasic-version of MiniFmod library
« Reply #27 on: October 03, 2010 »
Ok thanks mate, I need to remember it's -1 for the channel / track.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won: