Author Topic: Syncing With UFMod  (Read 6436 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Syncing With UFMod
« on: September 02, 2008 »
Hi all,

I've read from a few posts that syncing with UFmod is easy; I have used Bass in the past to sync effects with, and really would like to utilize UFmod; mostly as it's smaller. I have seen the few replies in the other UFmod topic.

How ever I am very stuck with this; and I'd love some help on achieving syncing with UFmod. And I have a small list of questions.

A/ Is it possible to sync to certain instruments / samples?
B/ Is getting Volume changes the only way of syncing?
C/ Can you get hold of the individual samples volumes for vu type effects, or is limited to just 2 over all volumes ( Left And Right ? )

Cheers and many thanks in advance,
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: Syncing With UFMod
« Reply #1 on: September 02, 2008 »
I haven't got any clue about FreeBasic nor uFMOD, but i exactly needed what you're asking for do sync this.
If you want to have a look at miniFMOD, it's pretty easy to look up all this information (note, sample-number, volume, effect+parameter of every channel) for the currently playing order/row (see FMUSIC_MODULE::pattern in music.h).
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Syncing With UFMod
« Reply #2 on: September 02, 2008 »
@Clyde:
Yeah. I also used fmod as sound engine for syncing. See my entry
for the scroll competition here:

http://dbfinteractive.com/forum/index.php?topic=1377.0

If you need the source - I will try to find it. Guess its on my old PC -
but I could search for it. I think I sync'd it to a certain sample.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Syncing With UFMod
« Reply #3 on: September 02, 2008 »
Thanks dudes - Will take a look. :)

btw- Benny, is it UFMod? reason being I dont want to have any external files / dlls.

I wonder if the answers to my first topic starter are mostly no you cant do that. If it would be possible to implement them into UFMod?

Cheers,
Clyde.
« Last Edit: September 02, 2008 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Syncing With UFMod
« Reply #4 on: September 02, 2008 »
@Clyde:

Sorry dude. I used that normal external dll in that production.
Don't know about UFMod and syncing. But I remember that I
looked at several sound engines and had the same problem like
you - that most of them which supports syncing came as
external DLLs.

But that was some years ago ...

Hmm .. but maybe its worth having a look at miniFmod which
Hellfire suggested. This lib sounds like it can be statically linked.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Syncing With UFMod
« Reply #5 on: September 02, 2008 »
I had a quick look at uFMOD and it basically looks like miniFMOD just that everything is written in assembly (and thus turns out a kilobyte smaller).
When I'm back home from work I will have a look at how to read the currently playing pattern-data. Should be pretty much the same though.

Quote
Is getting Volume changes the only way of syncing?
Another method is to put an unused effect+parameter into the tune which define certain "actions".
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Syncing With UFMod
« Reply #6 on: September 02, 2008 »
Cheers Hellfire 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: Syncing With UFMod
« Reply #7 on: September 03, 2008 »
uFMOD handles all its' memory internally, so you are not able to access the pattern-data without making changes to the library.
If you can afford to have a few additional kilobytes of code-size, it's far easier to use miniFMOD instead.

The following example is C-code but I guess it should be easy to convert; I also assume you know a bit about how .mod-files work:

FMUSIC_LoadSong loads a song and returns a structure that contains everything you might be interessted in:
Code: [Select]
FMUSIC_MODULE *mod= FMUSIC_LoadSong();(look at Music.h for a detailed description of FMUSIC_MODULE)

Get the currently playing row:
Code: [Select]
int row= FMUSIC_GetRow(mod);
Now get the currently playing order (an index into a list that defines the order of the patterns).
Code: [Select]
int order= FMUSIC_GetOrder(mod);
You can now fetch the playing pattern-number from the order-list (stored in FMUSIC_MODULE):
Code: [Select]
int patnum= mod->orderlist[order];
Now get the actual pattern from the pattern-list (also in FMUSIC_MODULE):
Code: [Select]
FMUSIC_PATTERN *pattern= &mod->pattern[patnum];FMUSIC_PATTERN basically stores channels*rows notes (which also include volume, instrument-number & effects).

You get the number of channels:
Code: [Select]
int chan= mod->numchannels;
And look into the notes of the currently playing row:
Code: [Select]
// get a pointer to the note of the first channel of the currently playing row:
FMUSIC_NOTE *notes= &pattern->data[row*chan];
for (int c=0;c<chan;c++)
{
    // now you can access the "note" for each channel "c":
    notes[c].note
    notes[c].number
    notes[c].volume
    notes[c].effect
    notes[c].eparam
}
« Last Edit: September 03, 2008 by hellfire »
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Syncing With UFMod
« Reply #8 on: September 03, 2008 »
It looks very good and cheers for the reply dude.
« Last Edit: October 18, 2012 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline triggerHLM

  • ZX 81
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Syncing With UFMod
« Reply #9 on: October 18, 2012 »
I just tryed what Hellfire explained and got stuck:

You can now fetch the playing pattern-number from the order-list (stored in FMUSIC_MODULE):
Code: [Select]
int patnum= mod->orderlist[order];

As soon as i try to access the orderlist the compiler complains that on the left side of "orderlist" should be a pointer to a generic class/struct/union. It seems that VS2012 doesnt know the structure of the FMUSIC_MODULE type. I thought it could be solved by including:
Code: [Select]
#include "minifmod/music.h"

but after that the compiler complains that FSOUND_BufferSize was redefined in sound.h (179) and tells to look at sound.h(168). The funny thing is that there is no redefinition. Line 179 defines FSOUND_BufferSize while line 169 defines FSOUND_BufferSizeMS. Any clue what might be wrong?

Thanks in advance.
« Last Edit: October 18, 2012 by triggerHLM »

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2756
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Syncing With UFMod
« Reply #10 on: October 20, 2012 »
If I remember correctly I had to change "Fsound.c" and "sound.h" files to make it compile.

Check out the attached source, it might help you.
Challenge Trophies Won: