Overview (FMOD)
Length1
LengthMs
New1 (FMOD)
Play
PlayLoop
Position (FMOD)
Stop (FMOD)
Overview (FMOD) Top
FMOD is a wrapper that allows working with Firelight Technologies FMOD libraries.
These libraries support many audio file types including MP3, OGG, WAV and more.
The FMOD libraries can be used for free for noncommercial applications.
Before using these features you will need to download FMOD 3.75 Programmers API.
For the desktop download the Windows32 / 64 bit version and for the device download Windows CE version (version 3.75).
FMOD site: http://www.fmod.org
Inside the zip file, find fmod.dll (desktop) or fmodce.dll (device).
Copy the file to Basic4ppc folder.
On the desktop it is usually: c:\program files\Anywhere Software\Basic4ppc Desktop
On the device: \program files\Basic4ppc
When distributing your applications, this file should be copied together with the compiled file and the FMODDevice.dll or FMODDesktop.dll.
Example:
'Add an FMOD object named fmod first.
Sub Globals
End Sub
Sub App_Start
form1.show
fmod.New1
if OpenDialog1.Show <> cCancel then
fmod.Play(OpenDialog1.File)
end if
End Sub
Length1 Top
Returns the size of the loaded audio file.
Syntax: Length
Example:
In this example we combine Position and Length1 to show the music progress.
'Add an FMOD object named fmod first.
Sub Globals
End Sub
Sub App_Start
form1.show
fmod.New1
Timer1.Interval = 1000
if OpenDialog1.Show <> cCancel then
fmod.Play(OpenDialog1.File)
Timer1.Enabled = true
end if
End Sub
Sub Timer1_Tick
Form1.Text = Format(fmod.Position / fmod.Length1 * 100,"n0") & "%"
End Sub
LengthMs Top
Returns the song's length (in milliseconds).
Syntax: LengthMs
New1 (FMOD) Top
Initializes the FMOD object.
Syntax: New1
Play Top
Plays an audio file.
Syntax: Play (FileName As String)
The path should be absolute path.
Example:
fmod.Play (AppPath & "\music.mp3")
PlayLoop Top
Plays an audio file repeatedly.
Syntax: PlayLoop (FileName As String)
The path should be absolute path.
Example:
fmod.PlayLoop (AppPath & "\music.mp3")
Position (FMOD) Top
Gets or sets the position inside the audio file.
Syntax: Position
Example:
This example starts playing from the middle of the file.
'Add an FMOD object named fmod first.
Sub Globals
End Sub
Sub App_Start
form1.show
fmod.New1
Timer1.Interval = 1000
if OpenDialog1.Show <> cCancel then
fmod.Play(OpenDialog1.File)
fmod.Position = 0.5 * fmod.Length1
Timer1.Enabled = true
end if
End Sub
Sub Timer1_Tick
Form1.Text = Format(fmod.Position / fmod.Length1 * 100,"n0") &
"%"
End Sub
Stop (FMOD) Top
Stops the audio play.
Syntax: Stop