1
Freebasic / Re: uFmod + Freebasic
« on: August 09, 2006 »
Lo guys, first post here. I was a member on the last forum too. Didn't post too much tho 
I like this uFMOD thing! Playback isn't perfect, but it's free, and doesn't have any silly license (I think).
Any ideas?

I like this uFMOD thing! Playback isn't perfect, but it's free, and doesn't have any silly license (I think).
Quote
What I love about this is that it will make synching to music really easy, also the function to give L+R volume is very cool.I had a go on synching a counter to a 60bpm/120bpm module, but failed. I've attached the xm I made to test this. My code went a little something like this (it's rbraz' example, slightly modified):
Code: [Select]
ChDir ExePath
Option Explicit
#include "windows.bi"
#include "ufmod.bi"
Dim hWave As HWAVEOUT
Dim title_ptr as zstring ptr
Dim buffer As Zstring * 512
buffer="kim3.xm"
title_ptr = allocate(50)
dim ctr as double
dim ctr2 as double
dim test1 as double 'this variable is meant to make up for any delay (if any, I think there is) upon loading the module...
hWave = uFMOD_PlaySong(@buffer,0,XM_FILE)
ctr=uFMOD_GetTime()
test1=ctr
title_ptr = uFMOD_GetTitle()
uFMOD_SetVolume(64)
print test1
print "Playing ... "; *title_ptr
ctr2=1
While Inkey$() <> Chr$(27)
if uFMOD_GetTime >= ctr + (500-test1) then
ctr=uFMOD_GetTime
ctr2=ctr2+1
if ctr2>4 then ctr2=1
endif
locate 5,2
print ctr2; " " ; ctr ; " " ; uFMOD_GetTime()
Wend
uFMOD_StopSong()
Any ideas?