FMOD Community Project

BlitzMax Forums/BlitzMax Programming/FMOD Community Project

Dear community,

The time has come for us to plug a hole in blitzmax and offer 100% ROBUST FMOD support! With FMOD (which is free to use unless you're selling your game, then it's a paltry $100)

Why FMOD? well it gives us OXM, which none of the other sound libraries are actually able to do, this is absolutely essential for any indie/shareware developer! you're looking at the highest quality with the smallest download size - and cross platform. Thats just for starters!

With FMOD all of us can use the industry quality OXM format which is also used in the nintendo DS! With FMOD we're able to apply a wide range of absolutely WICKED sound effects from echoes and more!

Need I remind you it's totally cross platform and bug free? It's also far higher performance than max's native sound (not criticising simon as this is heavily optimised)

All we need to do is get together and do it! I know once we get started it'll be another feather in Blitzmax's CAP!

To start us off:
http://www.fmod.org/ << find fmod and dll's here
http://drago-tech.net/FmodWin32.zip << drago's windows fmod
http://drago-tech.net/FmodLinux.tar.gz << drago's linux fmod

But no mac fmod yet guys and the above ones are complete.

Also we've got a contribution from Tea Virus - a full set of structs. He says: "Mostly untested but all the commands/consts/structs are there." :
Module pub.fmod

Import "libfmod.a"

'FSOUND_CAPS
Const FSOUND_CAPS_HARDWARE	=$1 ' This driver supports hardware accelerated 3d sound.  
Const FSOUND_CAPS_EAX2		=$2 ' This driver supports EAX 2 reverb.
Const FSOUND_CAPS_EAX3		=$10 ' This driver supports EAX 3 reverb.

'FSOUND_CDPLAYMODES
Const FSOUND_CD_PLAYCONTINUOUS	=0 ' Starts from the current track And plays To End of CD.   
Const FSOUND_CD_PLAYONCE		=1 ' Plays the specified track Then stops. 
Const FSOUND_CD_PLAYLOOPED		=2 ' Plays the specified track looped, Forever Until stopped manually. 
Const FSOUND_CD_PLAYRANDOM		=3 ' Plays tracks in random order 

'FSOUND_DSP_PRIORITIES
Const FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT		=0 ' DSP CLEAR unit - done first 
Const FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT		=100 ' DSP SFX unit - done second 
Const FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT		=200 ' DSP MUSIC unit - done third 
Const FSOUND_DSP_DEFAULTPRIORITY_USER			=300 ' User priority, use this as reference For your own DSP units 
Const FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT		=900 ' This reads data For FSOUND_DSP_GetSpectrum, so it comes after user units 
Const FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT	=1000 ' DSP CLIP And COPY unit - last 

'FSOUND_MODES
Const FSOUND_LOOP_OFF			=$00000001 ' For non looping samples. 
Const FSOUND_LOOP_NORMAL		=$00000002 ' For forward looping samples. 
Const FSOUND_LOOP_BIDI			=$00000004 ' For bidirectional looping samples. (no effect If in hardware). 
Const FSOUND_8BITS			=$00000008 ' For 8 bit samples. 
Const FSOUND_16BITS			=$00000010 ' For 16 bit samples. 
Const FSOUND_MONO				=$00000020 ' For mono samples. 
Const FSOUND_STEREO			=$00000040 ' For stereo samples. 
Const FSOUND_UNSIGNED			=$00000080 ' For user created source data containing unsigned samples. 
Const FSOUND_SIGNED			=$00000100 ' For user created source data containing signed data. 
Const FSOUND_DELTA			=$00000200 ' For user created source data stored as delta values. 
Const FSOUND_IT214			=$00000400 ' For user created source data stored using IT214 compression. 
Const FSOUND_IT215			=$00000800 ' For user created source data stored using IT215 compression. 
Const FSOUND_HW3D				=$00001000 ' Attempts To make samples use 3d hardware acceleration. (If the card supports it) 
Const FSOUND_2D				=$00002000 ' Tells software (Not hardware) based sample Not To be included in 3d processing. 
Const FSOUND_STREAMABLE		=$00004000 ' For a streamimg sound where you feed the data To it. 
Const FSOUND_LOADMEMORY		=$00008000 ' "name" will be interpreted as a pointer To data For streaming And samples. 
Const FSOUND_LOADRAW			=$00010000 ' Will ignore file format And treat as raw pcm. 
Const FSOUND_MPEGACCURATE		=$00020000 ' For FSOUND_Stream_Open - For accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUND_Stream_Open For inital opening time performance issues. 
Const FSOUND_FORCEMONO			=$00040000 ' For forcing stereo streams And samples To be mono - needed If using FSOUND_HW3D And stereo data - incurs a small speed hit For streams 
Const FSOUND_HW2D				=$00080000 ' 2D hardware sounds. allows hardware specific effects 
Const FSOUND_ENABLEFX			=$00100000 ' Allows DX8 FX To be played back on a sound. Requires DirectX 8 - Note these sounds cannot be played more than once, be 8 bit, be less than a certain size, Or have a changing frequency 
Const FSOUND_MPEGHALFRATE		=$00200000 ' For FMODCE only - decodes mpeg streams using a Lower quality decode, but faster execution 
Const FSOUND_IMAADPCM			=$00400000 ' Contents are stored compressed as IMA ADPCM 
Const FSOUND_VAG				=$00800000 ' For PS2 only - Contents are compressed as Sony VAG format 
Const FSOUND_NONBLOCKING		=$01000000 ' For FSOUND_Stream_Open/FMUSIC_LoadSong - Causes stream Or music To open in the background And Not block the foreground app. See FSOUND_Stream_GetOpenState Or FMUSIC_GetOpenState To determine when it IS ready. 
Const FSOUND_GCADPCM			=$02000000 ' For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format 
Const FSOUND_MULTICHANNEL		=$04000000 ' For PS2 And Gamecube only - Contents are interleaved into a multi-channel (more than stereo) format 
Const FSOUND_USECORE0			=$08000000 ' For PS2 only - Sample/Stream is forced To use hardware voices 00-23 
Const FSOUND_USECORE1			=$10000000 ' For PS2 only - Sample/Stream is forced To use hardware voices 24-47 
Const FSOUND_LOADMEMORYIOP		=$20000000 ' For PS2 only - "name" will be interpreted as a pointer To data For streaming And samples. The address provided will be an IOP address 
Const FSOUND_IGNORETAGS		=$40000000 ' Skips id3v2 etc tag checks when opening a stream, To reduce seek/read overhead when opening files (helps with CD performance) 
Const FSOUND_STREAM_NET		=$80000000 ' Specifies an internet stream */  
Const FSOUND_NORMAL			=(FSOUND_16BITS | FSOUND_SIGNED | FSOUND_MONO)  

Rem
FSOUND_REVERB_PRESETS
FSOUND_PRESET_OFF {0, 7.5f, 1.00f, -10000, -10000, 0, 1.00f, 1.00f, 1.0f, -2602, 0.007f, { 0.0f,0.0f,0.0f }, 200, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 0.0f, 0.0f, 0x33f }  
FSOUND_PRESET_GENERIC {0, 7.5f, 1.00f, -1000, -100, 0, 1.49f, 0.83f, 1.0f, -2602, 0.007f, { 0.0f,0.0f,0.0f }, 200, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_PADDEDCELL {1, 1.4f, 1.00f, -1000, -6000, 0, 0.17f, 0.10f, 1.0f, -1204, 0.001f, { 0.0f,0.0f,0.0f }, 207, 0.002f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_ROOM {2, 1.9f, 1.00f, -1000, -454, 0, 0.40f, 0.83f, 1.0f, -1646, 0.002f, { 0.0f,0.0f,0.0f }, 53, 0.003f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_BATHROOM {3, 1.4f, 1.00f, -1000, -1200, 0, 1.49f, 0.54f, 1.0f, -370, 0.007f, { 0.0f,0.0f,0.0f }, 1030, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 60.0f, 0x3f }  
FSOUND_PRESET_LIVINGROOM {4, 2.5f, 1.00f, -1000, -6000, 0, 0.50f, 0.10f, 1.0f, -1376, 0.003f, { 0.0f,0.0f,0.0f }, -1104, 0.004f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_STONEROOM {5, 11.6f, 1.00f, -1000, -300, 0, 2.31f, 0.64f, 1.0f, -711, 0.012f, { 0.0f,0.0f,0.0f }, 83, 0.017f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_AUDITORIUM {6, 21.6f, 1.00f, -1000, -476, 0, 4.32f, 0.59f, 1.0f, -789, 0.020f, { 0.0f,0.0f,0.0f }, -289, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_CONCERTHALL {7, 19.6f, 1.00f, -1000, -500, 0, 3.92f, 0.70f, 1.0f, -1230, 0.020f, { 0.0f,0.0f,0.0f }, -2, 0.029f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_CAVE {8, 14.6f, 1.00f, -1000, 0, 0, 2.91f, 1.30f, 1.0f, -602, 0.015f, { 0.0f,0.0f,0.0f }, -302, 0.022f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f }  
FSOUND_PRESET_ARENA {9, 36.2f, 1.00f, -1000, -698, 0, 7.24f, 0.33f, 1.0f, -1166, 0.020f, { 0.0f,0.0f,0.0f }, 16, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_HANGAR {10, 50.3f, 1.00f, -1000, -1000, 0, 10.05f, 0.23f, 1.0f, -602, 0.020f, { 0.0f,0.0f,0.0f }, 198, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_CARPETTEDHALLWAY {11, 1.9f, 1.00f, -1000, -4000, 0, 0.30f, 0.10f, 1.0f, -1831, 0.002f, { 0.0f,0.0f,0.0f }, -1630, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_HALLWAY {12, 1.8f, 1.00f, -1000, -300, 0, 1.49f, 0.59f, 1.0f, -1219, 0.007f, { 0.0f,0.0f,0.0f }, 441, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_STONECORRIDOR {13, 13.5f, 1.00f, -1000, -237, 0, 2.70f, 0.79f, 1.0f, -1214, 0.013f, { 0.0f,0.0f,0.0f }, 395, 0.020f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_ALLEY {14, 7.5f, 0.30f, -1000, -270, 0, 1.49f, 0.86f, 1.0f, -1204, 0.007f, { 0.0f,0.0f,0.0f }, -4, 0.011f, { 0.0f,0.0f,0.0f }, 0.125f, 0.95f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_FOREST {15, 38.0f, 0.30f, -1000, -3300, 0, 1.49f, 0.54f, 1.0f, -2560, 0.162f, { 0.0f,0.0f,0.0f }, -229, 0.088f, { 0.0f,0.0f,0.0f }, 0.125f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 79.0f, 100.0f, 0x3f }  
FSOUND_PRESET_CITY {16, 7.5f, 0.50f, -1000, -800, 0, 1.49f, 0.67f, 1.0f, -2273, 0.007f, { 0.0f,0.0f,0.0f }, -1691, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 50.0f, 100.0f, 0x3f }  
FSOUND_PRESET_MOUNTAINS {17, 100.0f, 0.27f, -1000, -2500, 0, 1.49f, 0.21f, 1.0f, -2780, 0.300f, { 0.0f,0.0f,0.0f }, -1434, 0.100f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 27.0f, 100.0f, 0x1f }  
FSOUND_PRESET_QUARRY {18, 17.5f, 1.00f, -1000, -1000, 0, 1.49f, 0.83f, 1.0f, -10000, 0.061f, { 0.0f,0.0f,0.0f }, 500, 0.025f, { 0.0f,0.0f,0.0f }, 0.125f, 0.70f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_PLAIN {19, 42.5f, 0.21f, -1000, -2000, 0, 1.49f, 0.50f, 1.0f, -2466, 0.179f, { 0.0f,0.0f,0.0f }, -1926, 0.100f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 21.0f, 100.0f, 0x3f }  
FSOUND_PRESET_PARKINGLOT {20, 8.3f, 1.00f, -1000, 0, 0, 1.65f, 1.50f, 1.0f, -1363, 0.008f, { 0.0f,0.0f,0.0f }, -1153, 0.012f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f }  
FSOUND_PRESET_SEWERPIPE {21, 1.7f, 0.80f, -1000, -1000, 0, 2.81f, 0.14f, 1.0f, 429, 0.014f, { 0.0f,0.0f,0.0f }, 1023, 0.021f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 80.0f, 60.0f, 0x3f }  
FSOUND_PRESET_UNDERWATER {22, 1.8f, 1.00f, -1000, -4000, 0, 1.49f, 0.10f, 1.0f, -449, 0.007f, { 0.0f,0.0f,0.0f }, 1700, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 1.18f, 0.348f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f }  
FSOUND_PRESET_DRUGGED {23, 1.9f, 0.50f, -1000, 0, 0, 8.39f, 1.39f, 1.0f, -115, 0.002f, { 0.0f,0.0f,0.0f }, 985, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f }  
FSOUND_PRESET_DIZZY {24, 1.8f, 0.60f, -1000, -400, 0, 17.23f, 0.56f, 1.0f, -1713, 0.020f, { 0.0f,0.0f,0.0f }, -613, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.81f, 0.310f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f }  
FSOUND_PRESET_PSYCHOTIC {25, 1.0f, 0.50f, -1000, -151, 0, 7.56f, 0.91f, 1.0f, -626, 0.020f, { 0.0f,0.0f,0.0f }, 774, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 4.00f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f }  
FSOUND_PRESET_PS2_ROOM {1, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f }  
FSOUND_PRESET_PS2_STUDIO_A {2, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f }  
FSOUND_PRESET_PS2_STUDIO_B {3, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f }  
FSOUND_PRESET_PS2_STUDIO_C {4, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f }  
FSOUND_PRESET_PS2_HALL {5, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f }  
FSOUND_PRESET_PS2_SPACE {6, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f }  
FSOUND_PRESET_PS2_ECHO {7, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f }  
FSOUND_PRESET_PS2_DELAY {8, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f }  
FSOUND_PRESET_PS2_PIPE {9, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f }  
End Rem

Type FSOUND_REVERB_PROPERTIES
	Field Environment 			' 0 , 25 , 0 , sets all listener properties (WIN32/PS2 only) 
	Field EnvSize:Float 			' 1.0 , 100.0 , 7.5 , environment size in meters (WIN32 only) 
	Field EnvDiffusion:Float 		' 0.0 , 1.0 , 1.0 , environment diffusion (WIN32/XBOX) 
	Field Room 					' -10000, 0 , -1000 , room effect level (at Mid frequencies) (WIN32/XBOX/PS2) 
	Field RoomHF 					' -10000, 0 , -100 , relative room effect level at high frequencies (WIN32/XBOX) 
	Field RoomLF 					' -10000, 0 , 0 , relative room effect level at low frequencies (WIN32 only) 
	Field DecayTime:Float 			' 0.1 , 20.0 , 1.49 , reverberation decay time at Mid frequencies (WIN32/XBOX) 
	Field DecayHFRatio:Float 		' 0.1 , 2.0 , 0.83 , high-frequency To Mid-frequency decay time ratio (WIN32/XBOX) 
	Field DecayLFRatio:Float 		' 0.1 , 2.0 , 1.0 , low-frequency To Mid-frequency decay time ratio (WIN32 only) 
	Field Reflections 			' -10000, 1000 , -2602 , early reflections level relative To room effect (WIN32/XBOX) 
	Field ReflectionsDelay:Float 	' 0.0 , 0.3 , 0.007 , initial reflection Delay time (WIN32/XBOX) 
	Field ReflectionsPan:Float[3] 	' , , [0,0,0], early reflections panning vector (WIN32 only) 
	Field Reverb 					' -10000, 2000 , 200 , late reverberation level relative To room effect (WIN32/XBOX) 
	Field ReverbDelay:Float 		' 0.0 , 0.1 , 0.011 , late reverberation Delay time relative To initial reflection (WIN32/XBOX) 
	Field ReverbPan:Float[3] 		' , , [0,0,0], late reverberation panning vector (WIN32 only) 
	Field EchoTime:Float 			' .075 , 0.25 , 0.25 , echo time (WIN32/PS2 only. PS2 = Delay time For ECHO/Delay modes only) 
	Field EchoDepth:Float 			' 0.0 , 1.0 , 0.0 , echo depth (WIN32/PS2 only. PS2 = Feedback level For ECHO mode only) 
	Field ModulationTime:Float 	' 0.04 , 4.0 , 0.25 , modulation time (WIN32 only) 
	Field ModulationDepth:Float 	' 0.0 , 1.0 , 0.0 , modulation depth (WIN32 only) 
	Field AirAbsorptionHF:Float 	' -100 , 0.0 , -5.0 , change in level per meter at high frequencies (WIN32 only) 
	Field HFReference:Float 		' 1000.0, 20000 , 5000.0 , reference high frequency (hz) (WIN32/XBOX) 
	Field LFReference:Float 		' 20.0 , 1000.0, 250.0 , reference low frequency (hz) (WIN32 only) 
	Field RoomRolloffFactor:Float 	' 0.0 , 10.0 , 0.0 , like FSOUND_3D_SetRolloffFactor but For room effect (WIN32/XBOX) 
	Field Diffusion:Float 			' 0.0 , 100.0 , 100.0 , Value that controls the echo density in the late reverberation decay. (XBOX only) 
	Field Density:Float 			' 0.0 , 100.0 , 100.0 , Value that controls the modal density in the late reverberation decay (XBOX only) 
	Field Flags 					' FSOUND_REVERB_FLAGS - modifies the behavior of above properties (WIN32/PS2 only) 
End Type

Type FSOUND_REVERB_CHANNELPROPERTIES
	Field Direct 						' -10000, 1000, 0, direct path level (at low And Mid frequencies) (WIN32/XBOX)
	Field DirectHF 					' -10000, 0, 0, relative direct path level at high frequencies (WIN32/XBOX)
	Field Room 						' -10000, 1000, 0, room effect level (at low And Mid frequencies) (WIN32/XBOX/PS2)
	Field RoomHF 						' -10000, 0, 0, relative room effect level at high frequencies (WIN32/XBOX)
	Field Obstruction 				' -10000, 0, 0, main obstruction control (attenuation at high frequencies) (WIN32/XBOX)
	Field ObstructionLFRatio:Float 		' 0.0, 1.0, 0.0, obstruction low-frequency level re. main control (WIN32/XBOX)
	Field Occlusion 					' -10000, 0, 0, main occlusion control (attenuation at high frequencies) (WIN32/XBOX)
	Field OcclusionLFRatio:Float 		' 0.0, 1.0, 0.25, occlusion low-frequency level re. main control (WIN32/XBOX)
	Field OcclusionRoomRatio:Float 		' 0.0, 10.0, 1.5, relative occlusion control For room effect (WIN32)
	Field OcclusionDirectRatio:Float 	' 0.0, 10.0, 1.0, relative occlusion control For direct path (WIN32)
	Field Exclusion 					' -10000, 0, 0, main exlusion control (attenuation at high frequencies) (WIN32)
	Field ExclusionLFRatio:Float 		' 0.0, 1.0, 1.0, exclusion low-frequency level re. main control (WIN32)
	Field OutsideVolumeHF 				' -10000, 0, 0, outside sound cone level at high frequencies (WIN32)
	Field DopplerFactor:Float 			' 0.0, 10.0, 0.0, like DS3D flDopplerFactor but per source (WIN32)
	Field RolloffFactor:Float 			' 0.0, 10.0, 0.0, like DS3D flRolloffFactor but per source (WIN32)
	Field RoomRolloffFactor:Float 		' 0.0, 10.0, 0.0, like DS3D flRolloffFactor but For room effect (WIN32/XBOX)
	Field AirAbsorptionFactor:Float 	' 0.0, 10.0, 1.0, multiplies AirAbsorptionHF member of FSOUND_REVERB_PROPERTIES (WIN32)
	Field Flags 						' FSOUND_REVERB_CHANNELFLAGS - modifies the behavior of properties (WIN32)
End Type

Type FSOUND_TOC_TAG
	Field name[4] 	' The String "TOC", just in Case this structure is accidentally treated as a String */
	Field numtracks 	' The number of tracks on the CD
	Field minoff[100] ' The start offset of each track in minutes
	Field sec[100] 	' The start offset of each track in seconds
	Field frame[100] 	' The start offset of each track in frames
End Type

'FSOUND_MISC_VALUES
Const FSOUND_FREE 		=-1 ' value To play on any free channel, Or To allocate a sample in a free sample slot. 
Const FSOUND_UNMANAGED		=-2 ' value To allocate a sample that is Not managed by FSOUND Or placed in a sample slot. 
Const FSOUND_ALL			=-3 ' For a channel index , this flag will affect ALL channels available! Not supported by every function. 
Const FSOUND_STEREOPAN		=-1 ' value For FSOUND_SetPan so that stereo sounds are Not played at half volume. See FSOUND_SetPan For more on this. 
Const FSOUND_SYSTEMCHANNEL	=-1000 ' special 'channel' ID for all channel based functions that want to alter the global FSOUND software mixing output channel 
Const FSOUND_SYSTEMSAMPLE	=-1000 ' special 'sample' ID for all sample based functions that want to alter the global FSOUND software mixing output sample 

'FSOUND_MIXERTYPES
Const FSOUND_MIXER_AUTODETECT			=1 ' CE/PS2/GC Only - Non interpolating/low quality mixer. 
Const FSOUND_MIXER_BLENDMODE			=2 ' Removed / obsolete. 
Const FSOUND_MIXER_MMXP5				=3 ' Removed / obsolete. 
Const FSOUND_MIXER_MMXP6				=4 ' Removed / obsolete. 
Const FSOUND_MIXER_QUALITY_AUTODETECT	=5
Const FSOUND_MIXER_QUALITY_FPU			=6 ' Win32/Linux only - Interpolating/volume ramping FPU mixer. 
Const FSOUND_MIXER_QUALITY_MMXP5		=7 ' Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. 
Const FSOUND_MIXER_QUALITY_MMXP6		=8 ' Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. 
Const FSOUND_MIXER_MONO				=9 ' CE/PS2/GC only - MONO non interpolating/low quality mixer. For speed
Const FSOUND_MIXER_QUALITY_MONO			=10 ' CE/PS2/GC only - MONO Interpolating mixer. For speed 
Const FSOUND_MIXER_MAX					=11

'FSOUND_OUTPUTTYPES
Const FSOUND_OUTPUT_NOSOUND			=1 ' NoSound driver, all calls To this succeed but do nothing. 
Const FSOUND_OUTPUT_WINMM				=2 ' Windows Multimedia driver. 
Const FSOUND_OUTPUT_DSOUND				=3 ' DirectSound driver. You need this To get EAX2 Or EAX3 support, Or FX api support. 
Const FSOUND_OUTPUT_A3D				=4 ' A3D driver. 
Const FSOUND_OUTPUT_OSS				=5 ' Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. 
Const FSOUND_OUTPUT_ESD				=6 ' Linux/Unix ESD (Enlightment Sound Daemon) driver. 
Const FSOUND_OUTPUT_ALSA				=7 ' Linux Alsa driver. 
Const FSOUND_OUTPUT_ASIO				=8 ' Low latency ASIO driver 
Const FSOUND_OUTPUT_XBOX				=9 ' Xbox driver 
Const FSOUND_OUTPUT_PS2				=10 ' PlayStation 2 driver 
Const FSOUND_OUTPUT_MAC				=11 ' Mac SoundManager driver 
Const FSOUND_OUTPUT_GC					=12 ' Gamecube driver 
Const FSOUND_OUTPUT_NOSOUND_NONREALTIME	=13 ' This is the same as nosound, but the sound generation is driven by FSOUND_Update 

Extern "win32"
	'Pre Initialization/Initialization/Enumeration Functions
	Function FSOUND_Init( mixrate,maxsoftwarechannels,flags ) = "FSOUND_Init@12"
	Function FSOUND_Close() = "FSOUND_Close@0"
	Function FSOUND_File_SetCallbacks( useropen,userclose,userread,userseek,usertell ) = "FSOUND_File_SetCallbacks@20"
	Function FSOUND_SetBufferSize( len_ms ) = "FSOUND_SetBufferSize@4"
	Function FSOUND_SetDriver( driver ) = "FSOUND_SetDriver@4"
	Function FSOUND_SetHWND( hwnd:Byte Ptr ) = "FSOUND_SetHWND@4"
	Function FSOUND_SetMaxHardwareChannels( maxchn ) = "FSOUND_SetMaxHardwareChannels@4"
	Function FSOUND_SetMemorySystem( poolmem:Byte Ptr,poollen,useralloc,userrealloc,userfree ) = "FSOUND_SetMemorySystem@20"
	Function FSOUND_SetMinHardwareChannels( minchn ) = "FSOUND_SetMinHardwareChannels@4"
	Function FSOUND_SetMixer( mixer ) = "FSOUND_SetMixer@4"
	Function FSOUND_SetOutput( outputtype ) = "FSOUND_SetOutput@4"

	'Global run-time update functions
	Function FSOUND_SetPanSeperation( pansep ) = "FSOUND_SetPanSeperation@4"
	Function FSOUND_SetSFXMasterVolume( volume ) = "FSOUND_SetSFXMasterVolume@4"
	Function FSOUND_SetSpeakerMode( speakermode ) = "FSOUND_SetSpeakerMode@4"
	Function FSOUND_Update() = "FSOUND_Update@0"

	'Global run-time information functions
	Function FSOUND_GetCPUUsage:Float() = "FSOUND_GetCPUUsage@0"
	Function FSOUND_GetChannelsPlaying() = "GetChannelsPlaying@0"
	Function FSOUND_GetDriver() = "FSOUND_GetDriver@0"
	Function FSOUND_GetDriverCaps( id,caps:Byte Ptr ) = "FSOUND_GetDriverCaps@8"
	Function FSOUND_GetDriverName( id ) = "FSOUND_GetDriverName@4"
	Function FSOUND_GetMaxSamples() = "FSOUND_GetMaxSamples@0"
	Function FSOUND_GetMaxChannels() = "FSOUND_GetMaxChannels@0"
	Function FSOUND_GetMemoryStats( currentalloced:Byte Ptr,maxalloced:Byte Ptr ) = "FSOUND_GetMemoryStats@8"
	Function FSOUND_GetNumDrivers() = "FSOUND_GetNumDrivers@0"
	Function FSOUND_GetNumHWChannels( num2d:Byte Ptr,num3d:Byte Ptr,total:Byte Ptr ) = "FSOUND_GetNumHWChannels@12"
	Function FSOUND_GetOutput() = "FSOUND_GetOutput@0"
	Function FSOUND_GetOutputHandle:Byte Ptr() = "FSOUND_GetOutputHandle@0"
	Function FSOUND_GetOutputRate() = "FSOUND_GetOutputRate@0"
	Function FSOUND_GetSFXMasterVolume() = "FSOUND_GetSFXMasterVolume@0"
	Function FSOUND_GetVersion:Float() = "FSOUND_GetVersion@0"
	Function FSOUND_GetError() = "FSOUND_GetError@0"
	
	'Sample Functions
	Function FSOUND_Sample_Alloc:Byte Ptr( index,length,mode,deffreq,defvol,defpan,defpri ) = "FSOUND_Sample_Alloc@28"
	Function FSOUND_Sample_Free( sptr:Byte Ptr ) = "FSOUND_Sample_Free@4"
	Function FSOUND_Sample_Get:Byte Ptr( sampno ) = "FSOUND_Sample_Get@4"
	Function FSOUND_Sample_GetDefaults( sptr:Byte Ptr,deffreq:Byte Ptr,defvol:Byte Ptr,defpan:Byte Ptr,defpri:Byte Ptr ) = "FSOUND_Sample_GetDefaults@20"
	Function FSOUND_Sample_GetDefaultsEx( sptr:Byte Ptr,deffreq:Byte Ptr,defvol:Byte Ptr,defpan:Byte Ptr,defpri:Byte Ptr,varfreq:Byte Ptr,varvol:Byte Ptr,varpan:Byte Ptr ) = "FSOUND_Sample_GetDefaultsEx@32"
	Function FSOUND_Sample_GetLength( sptr:Byte Ptr ) = "FSOUND_Sample_GetLength@4"
	Function FSOUND_Sample_GetLoopPoints( sptr:Byte Ptr,loopstart:Byte Ptr,loopend:Byte Ptr )
	Function FSOUND_Sample_GetMinMaxDistance( sptr:Byte Ptr, minval:Byte Ptr,maxval:Byte Ptr ) = "FSOUND_Sample_GetMinMaxDistance@12"
	Function FSOUND_Sample_GetMode( sptr:Byte Ptr ) = "FSOUND_Sample_GetMode@4"
	Function FSOUND_Sample_GetName( sptr:Byte Ptr ) = "FSOUND_Sample_GetName@4"
	Function FSOUND_Sample_Load( index,name_or_data:Byte Ptr,inputmode,offset,length ) = "FSOUND_Sample_Load@20"
	Function FSOUND_Sample_Lock( sptr:Byte Ptr,offset,length,ptr1:Byte Ptr,ptr2:Byte Ptr,len1:Byte Ptr,len2:Byte Ptr ) = "FSOUND_Sample_Lock@28"
	Function FSOUND_Sample_SetDefaults( sptr:Byte Ptr,deffreq,defvol,defpan,defpri ) = "FSOUND_Sample_SetDefaults@20"
	Function FSOUND_Sample_SetDefaultsEx( sptr:Byte Ptr,deffreq,defvol,defpan,defpri,varfreq,varvol,varpan ) = "FSOUND_Sample_SetDefaultsEx@32"
	Function FSOUND_Sample_SetMaxPlaybacks( sptr:Byte Ptr,maxval ) = "FSOUND_Sample_SetMaxPlaybacks@8"
	Function FSOUND_Sample_SetMinMaxDistance( sptr:Byte Ptr,minval:Float,maxval:Float ) = "FSOUND_Sample_SetMinMaxDistance@12"
	Function FSOUND_Sample_SetMode( sptr:Byte Ptr,mode ) = "FSOUND_Sample_SetMode@8"
	Function FSOUND_Sample_SetLoopPoints( sptr:Byte Ptr,loopstart,loopend ) = "FSOUND_Sample_SetLoopPoints@12"
	Function FSOUND_Sample_Unlock( sptr:Byte Ptr,ptr1:Byte Ptr,ptr2:Byte Ptr,len1,len2 ) = "FSOUND_Sample_Unlock@20"
	Function FSOUND_Sample_Upload( sptr:Byte Ptr,srcdata:Byte Ptr,mode_in ) = "FSOUND_Sample_Upload@12"

	'Channel Functions
	Function FSOUND_PlaySound( channel,sptr:Byte Ptr ) = "FSOUND_PlaySound@8"
	Function FSOUND_PlaySoundEx( channel,sptr:Byte Ptr,dspunit:Byte Ptr,startpaused ) = "FSOUND_PlaySoundEx@16"
	Function FSOUND_StopSound( channel ) = "FSOUND_StopSound@4"
	Function FSOUND_SetFrequency( channel,freq ) = "FSOUND_SetFrequency@8"
	Function FSOUND_SetLevels( channel,frontleft,center,frontright,backleft,backright,lfe ) = "FSOUND_SetLevels@24"
	Function FSOUND_SetLoopMode( channel,loopmode ) = "FSOUND_SetLoopMode@8"
	Function FSOUND_SetMute( channel,mute ) = "FSOUND_SetMute@8"
	Function FSOUND_SetPan( channel,pan ) = "FSOUND_SetPan@8"
	Function FSOUND_SetPaused( channel,paused ) = "FSOUND_SetPaused@8"
	Function FSOUND_SetPriority( channel,priority ) = "FSOUND_SetPriority@8"
	Function FSOUND_SetReserved( channel,reserved ) = "FSOUND_SetReserved@8"
	Function FSOUND_SetSurround( channel,surround ) = "FSOUND_SetSurround@8"
	Function FSOUND_SetVolume( channel,vol ) = "FSOUND_SetVolume@8"
	Function FSOUND_SetVolumeAbsolute( channel,vol ) = "FSOUND_SetVolumeAbsolute@8"
	Function FSOUND_GetVolume( channel ) = "FSOUND_GetVolume@4"
	Function FSOUND_GetAmplitude( channel ) = "FSOUND_GetAmplitude@4"
	Function FSOUND_3D_SetAttributes( channel,pos:Byte Ptr,vel:Byte Ptr ) = "FSOUND_3D_SetAttributes@12"
	Function FSOUND_3D_SetMinMaxDistance( channel,minval,maxval ) = "FSOUND_3D_SetMinMaxDistance@12"
	Function FSOUND_SetCurrentPosition( channel,pos ) = "FSOUND_SetCurrentPosition@8"
	Function FSOUND_GetCurrentPosition( channel ) = "FSOUND_GetCurrentPosition@4"
	Function FSOUND_GetCurrentSample:Byte Ptr( channel ) = "FSOUND_GetCurrentSample@4"
	Function FSOUND_GetCurrentLevels( channel,l:Byte Ptr,r:Byte Ptr ) = "FSOUND_GetCurrentLevels@12"
	Function FSOUND_GetFrequency( channel ) = "FSOUND_GetFrequency@4"
	Function FSOUND_GetLoopMode( channel ) = "FSOUND_GetLoopMode@4"
	Function FSOUND_GetMixer() = "FSOUND_GetMixer@0"
	Function FSOUND_GetMute( channel ) = "FSOUND_GetMute@4"
	Function FSOUND_GetNumSubChannels( channel ) = "FSOUND_GetNumSubChannels@4"
	Function FSOUND_GetPan( channel ) = "FSOUND_GetPan@4"
	Function FSOUND_GetPaused( channel ) = "FSOUND_GetPaused@4"
	Function FSOUND_GetPriority( channel ) = "FSOUND_GetPriority@4"
	Function FSOUND_GetReserved( channel ) = "FSOUND_GetReserved@4"
	Function FSOUND_GetSubChannel( channel,subchannel ) = "FSOUND_GetSubChannel@8"
	Function FSOUND_GetSurround( channel ) = "FSOUND_GetSurround@4"
	Function FSOUND_IsPlaying( channel ) = "FSOUND_IsPlaying@8"
	Function FSOUND_3D_GetAttributes( channel,pos:Byte Ptr,vel:Byte Ptr ) = "FSOUND_3D_GetAttributes@12"
	Function FSOUND_3D_GetMinMaxDistance( channel,mindistance:Byte Ptr,maxdistance:Byte Ptr ) = "FSOUND_3D_GetMinMaxDistance@12"

	'3D Sound Functions
	Function FSOUND_3D_Listener_GetAttributes( pos:Byte Ptr,vel:Byte Ptr,fx:Byte Ptr,fy:Byte Ptr,fz:Byte Ptr,tx:Byte Ptr,ty:Byte Ptr,tz:Byte Ptr ) = "FSOUND_3D_Listener_GetAttributes@32"
	Function FSOUND_3D_Listener_SetAttributes( pos:Byte Ptr,vel:Byte Ptr,fx:Byte Ptr,fy:Byte Ptr,fz:Byte Ptr,tx:Byte Ptr,ty:Byte Ptr,tz:Byte Ptr ) = "FSOUND_3D_Listener_SetAttributes@32"
	Function FSOUND_3D_Listener_SetCurrent( current,numlisteners ) = "FSOUND_3D_Listener_SetCurrent@8"
	Function FSOUND_3D_SetDistanceFactor( factor ) = "FSOUND_3D_SetDistanceFactor@4"
	Function FSOUND_3D_SetDopplerFactor( scale ) = "FSOUND_3D_SetDopplerFactor@4"
	Function FSOUND_3D_SetRolloffFactor( factor ) = "FSOUND_3D_SetRolloffFactor@4"

	'Stream Functions
	Function FSOUND_Stream_AddSyncPoint:Byte Ptr( stream:Byte Ptr,pcmoffset,name:Byte Ptr ) = "FSOUND_Stream_AddSyncPoint@12"
	Function FSOUND_Stream_Close( stream:Byte Ptr ) = "FSOUND_Stream_Close@4"
	Function FSOUND_Stream_Create:Byte Ptr( callback,lenbytes,mode,samplerate,userdata:Byte Ptr ) = "FSOUND_Stream_Create@20"
	Function FSOUND_Stream_CreateDSP:Byte Ptr( stream:Byte Ptr,callback,priority,userdata:Byte Ptr ) = "FSOUND_Stream_CreateDSP@16"
	Function FSOUND_Stream_DeleteSyncPoint( point:Byte Ptr ) = "FSOUND_Stream_DeleteSyncPoint@4"
	Function FSOUND_Stream_FindTagField( stream:Byte Ptr,fieldtype,name:Byte Ptr,value:Byte Ptr,length:Byte Ptr ) = "FSOUND_Stream_FindTagField@20"
	Function FSOUND_Stream_GetLength( stream:Byte Ptr ) = "FSOUND_Stream_GetLength@4"
	Function FSOUND_Stream_GetLengthMs( stream:Byte Ptr ) = "FSOUND_Stream_GetLengthMs@4"
	Function FSOUND_Stream_GetMode( stream:Byte Ptr ) = "FSOUND_Stream_GetMode@4"
	Function FSOUND_Stream_GetNumSubStreams( stream:Byte Ptr ) = "FSOUND_Stream_GetNumSubStreams@4"
	Function FSOUND_Stream_GetNumSyncPoints( stream:Byte Ptr ) = "FSOUND_Stream_GetNumSyncPoints@4"
	Function FSOUND_Stream_GetNumTagFields( stream:Byte Ptr,num:Byte Ptr ) = "FSOUND_Stream_GetNumTagFields@8"
	Function FSOUND_Stream_GetOpenState( stream:Byte Ptr ) = "FSOUND_Stream_GetOpenState@4"
	Function FSOUND_Stream_GetPosition( stream:Byte Ptr ) = "FSOUND_Stream_GetPosition@4"
	Function FSOUND_Stream_GetSample( stream:Byte Ptr ) = "FSOUND_STREAM@4"
	Function FSOUND_Stream_GetSyncPoint:Byte Ptr( stream:Byte Ptr,index ) = "FSOUND_Stream_GetSyncPoint@8"
	Function FSOUND_Stream_GetSyncPointInfo:Byte Ptr( point:Byte Ptr,pcmoffset:Byte Ptr ) = "FSOUND_Stream_GetSyncPointInfo@8"
	Function FSOUND_Stream_GetTagField( stream:Byte Ptr,num,tagtype:Byte Ptr,name:Byte Ptr,value:Byte Ptr,length:Byte Ptr ) = "FSOUND_Stream_GetTagField@24"
	Function FSOUND_Stream_GetTime( stream:Byte Ptr ) = "FSOUND_Stream_GetTime@4"
	Function FSOUND_Stream_Net_GetBufferProperties( buffersize:Byte Ptr,prebuffer_percent:Byte Ptr,rebuffer_percent:Byte Ptr ) = "FSOUND_Stream_Net_GetBufferProperties@12"
	Function FSOUND_Stream_Net_GetLastServerStatus( ) = "FSOUND_Stream_Net_GetLastServerStatus@0"
	Function FSOUND_Stream_Net_GetStatus( stream:Byte Ptr,status:Byte Ptr,bufferused:Byte Ptr,bitrate:Byte Ptr,flags:Byte Ptr ) = "FSOUND_Stream_Net_GetStatus@20"
	Function FSOUND_Stream_Net_SetBufferProperties( buffersize,prebuffer_percent,rebuffer_percent ) = "FSOUND_Stream_Net_SetBufferProperties@12"
	Function FSOUND_Stream_Net_SetMetadataCallback( stream:Byte Ptr,callback,userdata:Byte Ptr ) = "FSOUND_Stream_Net_SetMetadataCallback@12"
	Function FSOUND_Stream_Net_SetProxy( proxy:Byte Ptr ) = "FSOUND_Stream_Net_SetProxy@4"
	Function FSOUND_Stream_Open:Byte Ptr( name_or_data:Byte Ptr,mode,offset,length ) = "FSOUND_Stream_Open@16"
	Function FSOUND_Stream_Play( channel,stream:Byte Ptr ) = "FSOUND_Stream_Play@8"
	Function FSOUND_Stream_PlayEx( channel,stream:Byte Ptr,dspunit:Byte Ptr,paused ) = "FSOUND_Stream_PlayEx@16"
	Function FSOUND_Stream_SetBufferSize( ms ) = "FSOUND_Stream_SetBufferSize@4"
	Function FSOUND_Stream_SetEndCallback( stream,callback,userdata:Byte Ptr ) = "FSOUND_Stream_SetEndCallback@12"
	Function FSOUND_Stream_SetLoopCount( stream:Byte Ptr,count ) = "FSOUND_Stream_SetLoopCount@8"
	Function FSOUND_Stream_SetLoopPoints( stream:Byte Ptr,loopstart,loopend ) = "FSOUND_Stream_SetLoopPoints@12"
	Function FSOUND_Stream_SetMode( stream:Byte Ptr,mode ) = "FSOUND_Stream_SetMode@8"
	Function FSOUND_Stream_SetPosition( stream:Byte Ptr,position ) = "FSOUND_Stream_SetPosition@8"
	Function FSOUND_Stream_SetSubStream( stream:Byte Ptr,index ) = "FSOUND_Stream_SetSubStream@8"
	Function FSOUND_Stream_SetSubStreamSentence( stream:Byte Ptr,sentencelist:Byte Ptr,numitems ) = "FSOUND_Stream_SetSubStreamSentence@12"
	Function FSOUND_Stream_SetSyncCallback( stream:Byte Ptr,callback,userdata:Byte Ptr ) = "FSOUND_Stream_SetSyncCallback@12"
	Function FSOUND_Stream_SetTime( stream:Byte Ptr,ms ) = "FSOUND_Stream_SetTime@8"
	Function FSOUND_Stream_Stop( stream:Byte Ptr ) = "FSOUND_Stream_Stop@4"

	'CD Functions
	Function FSOUND_CD_GetNumTracks( drive ) = "FSOUND_CD_GetNumTracks@4"
	Function FSOUND_CD_GetPaused( drive ) = "FSOUND_CD_GetPaused@4"
	Function FSOUND_CD_GetTrack( drive ) = "FSOUND_CD_GetTrack@4"
	Function FSOUND_CD_GetTrackLength( drive,track ) = "FSOUND_CD_GetTrackLength@8"
	Function FSOUND_CD_GetTrackTime( drive ) = "FSOUND_CD_GetTrackTime@4"
	Function FSOUND_CD_OpenTray( drive,open ) = "FSOUND_CD_OpenTray@8"
	Function FSOUND_CD_Play( drive,track ) = "FSOUND_CD_Play@8"
	Function FSOUND_CD_SetPaused( drive,paused ) = "FSOUND_CD_SetPaused@8"
	Function FSOUND_CD_SetPlayMode( drive,mode ) = "FSOUND_CD_SetPlayMode@8"
	Function FSOUND_CD_SetTrackTime( drive,ms ) = "FSOUND_CD_SetTrackTime@8"
	Function FSOUND_CD_SetVolume( drive,volume ) = "FSOUND_CD_SetVolume@8"
	Function FSOUND_CD_Stop( drive ) = "FSOUND_CD_Stop@4"

	'DSP Functions
	Function FSOUND_DSP_ClearMixBuffer( ) = "FSOUND_DSP_ClearMixBuffer@0"
	Function FSOUND_DSP_Create:Byte Ptr( callback,priority,userdata:Byte Ptr ) = "FSOUND_DSP_Create@12"
	Function FSOUND_DSP_Free( unit:Byte Ptr ) = "FSOUND_DSP_Free@4"
	Function FSOUND_DSP_SetActive( unit:Byte Ptr,active ) = "FSOUND_DSP_SetActive@8"
	Function FSOUND_DSP_GetActive( unit:Byte Ptr ) = "FSOUND_DSP_GetActive@4"
	Function FSOUND_DSP_GetBufferLength( ) = "FSOUND_DSP_GetBufferLength@0"
	Function FSOUND_DSP_GetBufferLengthTotal( ) = "FSOUND_DSP_GetBufferLengthTotal@0"
	Function FSOUND_DSP_SetPriority( unit:Byte Ptr,priority ) = "FSOUND_DSP_SetPriority@8"
	Function FSOUND_DSP_GetPriority( unit:Byte Ptr ) = "FSOUND_DSP_GetPriority@4"
	Function FSOUND_DSP_GetClearUnit:Byte Ptr( ) = "FSOUND_DSP_GetClearUnit@0"
	Function FSOUND_DSP_GetClipAndCopyUnit:Byte Ptr( ) = "FSOUND_DSP_GetClipAndCopyUnit@0"
	Function FSOUND_DSP_GetMusicUnit:Byte Ptr( ) = "FSOUND_DSP_GetMusicUnit@0"
	Function FSOUND_DSP_GetSFXUnit:Byte Ptr( ) = "FSOUND_DSP_GetSFXUnit@0"
	Function FSOUND_DSP_GetFFTUnit:Byte Ptr( ) = "FSOUND_DSP_GetFFTUnit@0"
	Function FSOUND_DSP_GetSpectrum:Byte Ptr( ) = "FSOUND_DSP_GetSpectrum@0"
	Function FSOUND_DSP_MixBuffers( destbuffer:Byte Ptr,srcbuffer:Byte Ptr,buflen,freq,vol,pan,mode ) = "FSOUND_DSP_MixBuffers@28"

	'FX Functions
	Function FSOUND_FX_Disable( channel ) = "FSOUND_FX_Disable@4"
	Function FSOUND_FX_Enable( channel,fxtype ) = "FSOUND_FX_Enable@8"
	Function FSOUND_FX_SetChorus( fxid,WetDryMix,Depth,Feedback,Frequency,Waveform,FXDelay,Phase ) = "FSOUND_FX_SetChorus@32"
	Function FSOUND_FX_SetCompressor( fxid,Gain,Attack,FXRelease,Threshold,Ratio,Predelay ) = "FSOUND_FX_SetCompressor@28"
	Function FSOUND_FX_SetDistortion( fxid,Gain,Edge,PostEQCenterFrequency,PostEQBandwidth,PreLowpassCutoff ) = "FSOUND_FX_SetDistortion@24"
	Function FSOUND_FX_SetEcho( fxid,WetDryMix,Feedback,LeftDelay,RightDelay,PanDelay ) = "FSOUND_FX_SetEcho@24"
	Function FSOUND_FX_SetFlanger( fxid,WetDryMix,Depth,Feedback,Frequency,Waveform,FXDelay,Phase ) = "FSOUND_FX_SetFlanger@32"
	Function FSOUND_FX_SetGargle( fxid,RateHz,WaveShape ) = "FSOUND_FX_SetGargle@12"
	Function FSOUND_FX_SetI3DL2Reverb( fxid,Room,RoomHF,RoomRolloffFactor,DecayTime,DecayHFRatio,Reflections,ReflectionsDelay,Reverb,ReverbDelay,Diffusion,Density,HFReference ) = "FSOUND_FX_SetI3DL2Reverb@52"
	Function FSOUND_FX_SetParamEQ( fxid,Center,Bandwidth,Gain ) = "FSOUND_FX_SetParamEQ@16"
	Function FSOUND_FX_SetWavesReverb( fxid,InGain,ReverbMix,ReverbTime,HighFreqRTRatio ) = "FSOUND_FX_SetWavesReverb@20"

	'Recording Functions
	Function FSOUND_Record_GetDriver( ) = "FSOUND_Record_GetDriver@0"
	Function FSOUND_Record_GetDriverName:Byte Ptr( id ) = "FSOUND_Record_GetDriverName@4"
	Function FSOUND_Record_GetNumDrivers( ) = "FSOUND_Record_GetNumDrivers@0"
	Function FSOUND_Record_GetPosition( ) = "FSOUND_Record_GetPosition@0"
	Function FSOUND_Record_SetDriver( driver ) = "FSOUND_Record_SetDriver@4"
	Function FSOUND_Record_StartSample( sptr:Byte Ptr,loop ) = "FSOUND_Record_StartSample@8"
	Function FSOUND_Record_Stop( ) = "FSOUND_Record_Stop@4"

	'Reverb Functions
	Function FSOUND_Reverb_SetProperties( props:Byte Ptr ) = "FSOUND_Reverb_SetProperties@4"
	Function FSOUND_Reverb_GetProperties( props:Byte Ptr ) = "FSOUND_Reverb_GetProperties@4"
	Function FSOUND_Reverb_SetChannelProperties( channel,prop:Byte Ptr ) = "FSOUND_Reverb_SetChannelProperties@8"
	Function FSOUND_Reverb_GetChannelProperties( channel,prop:Byte Ptr ) = "FSOUND_Reverb_GetChannelProperties@8"
EndExtern

'FMOD Errors
Const FMOD_ERR_NONE			=1
Const FMOD_ERR_BUSY			=2
Const FMOD_ERR_UNINITIALIZED	=3
Const FMOD_ERR_INIT			=4
Const FMOD_ERR_ALLOCATED		=5
Const FMOD_ERR_PLAY			=6
Const FMOD_ERR_OUTPUT_FORMAT	=7
Const FMOD_ERR_COOPERATIVELEVEL=8
Const FMOD_ERR_CREATEBUFFER	=9
Const FMOD_ERR_FILE_NOTFOUND	=10
Const FMOD_ERR_FILE_FORMAT		=11
Const FMOD_ERR_FILE_BAD		=12
Const FMOD_ERR_MEMORY			=13
Const FMOD_ERR_VERSION			=14
Const FMOD_ERR_INVALID_PARAM	=15
Const FMOD_ERR_NO_EAX			=16
Const FMOD_ERR_CHANNEL_ALLOC	=17
Const FMOD_ERR_RECORD			=18
Const FMOD_ERR_MEDIAPLAYER		=19
Const FMOD_ERR_CDDEVICE		=20

Function FMOD_ErrorString:String(errcode)
	Select errcode
		Case FMOD_ERR_NONE
			Return "No errors"
		Case FMOD_ERR_BUSY
			Return "Cannot call this command after FSOUND_Init.  Call FSOUND_Close first."
		Case FMOD_ERR_UNINITIALIZED
			Return "This command failed because FSOUND_Init was not called"
		Case FMOD_ERR_PLAY
			Return "Playing the sound failed."
		Case FMOD_ERR_INIT
			Return "Error initializing output device."
		Case FMOD_ERR_ALLOCATED
			Return "The output device is already in use and cannot be reused."
		Case FMOD_ERR_OUTPUT_FORMAT
			Return "Soundcard does not support the features needed for this soundsystem (16bit stereo output)"
		Case FMOD_ERR_COOPERATIVELEVEL
			Return "Error setting cooperative level for hardware."
		Case FMOD_ERR_CREATEBUFFER
			Return "Error creating hardware sound buffer."
		Case FMOD_ERR_FILE_NOTFOUND
			Return "File not found"
		Case FMOD_ERR_FILE_FORMAT
			Return "Unknown file format"
		Case FMOD_ERR_FILE_BAD
			Return "Error loading file"
		Case FMOD_ERR_MEMORY
			Return "Not enough memory "
		Case FMOD_ERR_VERSION
			Return "The version number of this file format is not supported"
		Case FMOD_ERR_INVALID_PARAM
			Return "An invalid parameter was passed to this function"
		Case FMOD_ERR_NO_EAX
			Return "Tried to use an EAX command on a non EAX enabled channel or output."
		Case FMOD_ERR_CHANNEL_ALLOC
			Return "Failed to allocate a new channel"
		Case FMOD_ERR_RECORD
			Return "Recording not supported on this device"
		Case FMOD_ERR_MEDIAPLAYER
			Return "Required Mediaplayer codec is not installed"
		Default
			Return "Unknown error"
	End Select
End Function


Like the SDL thread, this community project is designed for the whole community to benefit from. Hopefully we'll see help from a couple of guys including BRL if they can - as they have experience using FMOD too!

Good luck everyone!

Tangentially related for those in the know about these things (not me), is there any chance that portaudio (portaudio.com) will be made accessible to Blitzmax? The benefit is that it is free for what it offers.

Didn't BRL have an FMOD implementation and pulled cuz of license issues?

Might be quite possible as the license fees are quite high with 1000-2000$ per title per plattform for non-freeware.

It's $100 shareware license and free if non commerical. Please keep license discussion OUT of this thread. Have respect and keep non-FMOD development discussions OUT of this thread. This thread is for development of FMOD in max, not discussion of licensing.

More code to come! We welcome any contributors to this community project, therefore have to politely ask people who wish to discuss licensing issues or other SDK's to post elsewhere.

Thank you.

My "tangential" post had nothing to do with "lack of respect' so I politely request that you pay close attention to the language used when negatively characterizing others. I apologize for asking about another SDK.

Have included the missing commands from Drago.
Tested some of the functions. Seems to work...:)

Strict

Rem
bbdoc: FMod
End Rem
Module Pub.FMod

ModuleInfo "Version: 1.00"
ModuleInfo "License: HTTP://www.fmod.org"
ModuleInfo "Modserver: BRL"

Import "-lfmod"

Extern "Os"
	
	' const
	Const FSOUND_INIT_ACCURATEVULEVELS =$0008 ' This latency adjusts FSOUND_GetCurrentLevels, but incurs a small cpu and memory hit '  
	Const FSOUND_INIT_DONTLATENCYADJUST =$0080 ' Callbacks are not latency adjusted, and are called at mix time. Also information functions are immediate '  
	Const FSOUND_INIT_STREAM_FROM_MAIN_THREAD =$0200 ' Turns off fmod streamer thread, and makes streaming update from FSOUN
	Const FSOUND_INIT_USEDEFAULTMIDISYNTH=$0001 ' Win32 only - Causes MIDI playback to force software decoding. '  
	Const FSOUND_INIT_GLOBALFOCUS =$0002 ' Win32 only - For DirectSound output - sound is not muted when window is out of focus. '  
	Const FSOUND_INIT_ENABLESYSTEMCHANNELFX =$0004 ' Win32 only - For DirectSound output - Allows FSOUND_FX api to be used on global software mixer output! (use FSOUND_SYSTEMCHANNEL as channel id) '  
	Const FSOUND_INIT_DSOUND_DEFERRED =$0800 ' Win32 only - For DirectSound output. 3D commands are batched together and executed at FSOUND_Update. '  
	Const FSOUND_INIT_DSOUND_HRTF_LIGHT =$1000 ' Win32 only - For DirectSound output. FSOUND_HW3D buffers use a slightly higher quality algorithm when 3d hardware acceleration is not present. '  
	Const FSOUND_INIT_DSOUND_HRTF_FULL =$2000 ' Win32 only - For DirectSound output. FSOUND_HW3D buffers use full quality 3d playback when 3d hardware acceleration is not present. '  


	'mixer types
	Const FSOUND_MIXER_BLENDMODE =1  ' Removed / obsolete. ' 
	Const FSOUND_MIXER_MMXP5 =2 ' Removed / obsolete. ' 
	Const FSOUND_MIXER_MMXP6 =3 ' Removed / obsolete. ' 
	Const FSOUND_MIXER_QUALITY_AUTODETECT =4 
	Const FSOUND_MIXER_MAX   =8
	Const FSOUND_MIXER_QUALITY_FPU =5' Win32/Linux only - Interpolating/volume ramping FPU mixer. 
	Const FSOUND_MIXER_QUALITY_MMXP5 =6  ' Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. ' 
	Const FSOUND_MIXER_QUALITY_MMXP6 =7 ' Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. '

	
	'output types
	Const FSOUND_OUTPUT_NOSOUND  =0 ' NoSound driver, all calls to this succeed but do nothing. ' 
	Const FSOUND_OUTPUT_ASIO =7' Low latency ASIO driver ' 
	Const FSOUND_OUTPUT_NOSOUND_NONREALTIME =11 ' This is the same as nosound, but the sound generation is driven by FSOUND_Update '
	Const FSOUND_OUTPUT_WINMM =1' Windows Multimedia driver. ' 
	Const FSOUND_OUTPUT_DSOUND =2 ' DirectSound driver. You need this to get EAX2 or EAX3 support, or FX api support. ' 
	Const FSOUND_OUTPUT_A3D =3'  A3D driver. '	
	
	'caps const
	Const FSOUND_CAPS_HARDWARE = $1
	Const FSOUND_CAPS_EAX2 = $2
	Const FSOUND_CAPS_EAX3 = $10
	
	'cd const
	Const FSOUND_CD_PLAYCONTINUOUS = 0
	Const FSOUND_CD_PLAYONCE = 1
	Const FSOUND_CD_PLAYLOOPED = 2
	Const FSOUND_CD_PLAYRANDOM = 3
	
	'dsp const
	Const FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT = $0
	Const FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT = 100
	Const FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT = 200
	Const FSOUND_DSP_DEFAULTPRIORITY_USER = 300
	Const FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT = 900
	Const FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT = 1000
	
	'modes
	Const FSOUND_LOOP_OFF =$00000001 ' For non looping samples. '  
	Const FSOUND_LOOP_NORMAL =$00000002 ' For forward looping samples. '  
	Const FSOUND_LOOP_BIDI =$00000004 ' For bidirectional looping samples. (no effect if in hardware). '  
	Const FSOUND_8BITS =$00000008 ' For 8 bit samples. '  
	Const FSOUND_16BITS =$00000010 ' For 16 bit samples. '  
	Const FSOUND_MONO =$00000020 ' For mono samples. '  
	Const FSOUND_STEREO =$00000040 ' For stereo samples. '  
	Const FSOUND_UNSIGNED =$00000080 ' For user created source data containing unsigned samples. '  
	Const FSOUND_SIGNED =$00000100 ' For user created source data containing signed data. '  
	Const FSOUND_DELTA =$00000200 ' For user created source data stored as delta values. '  
	Const FSOUND_IT214 =$00000400 ' For user created source data stored using IT214 compression. '  
	Const FSOUND_IT215 =$00000800 ' For user created source data stored using IT215 compression. '  
	Const FSOUND_HW3D =$00001000 ' Attempts to make samples use 3d hardware acceleration. (if the card supports it) '  
	Const FSOUND_2D =$00002000 ' Tells software (not hardware) based sample not to be included in 3d processing. '  
	Const FSOUND_STREAMABLE =$00004000 ' For a streamimg sound where you feed the data to it. '  
	Const FSOUND_LOADMEMORY =$00008000 ' "name" will be interpreted as a pointer to data for streaming and samples. '  
	Const FSOUND_LOADRAW =$00010000 ' Will ignore file format and treat as raw pcm. '  
	Const FSOUND_MPEGACCURATE =$00020000 ' For FSOUND_Stream_Open - for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUND_Stream_Open for inital opening time performance issues. '  
	Const FSOUND_FORCEMONO =$00040000 ' For forcing stereo streams and samples to be mono - needed if using FSOUND_HW3D and stereo data - incurs a small speed hit for streams '  
	Const FSOUND_HW2D =$00080000 ' 2D hardware sounds. allows hardware specific effects '  
	Const FSOUND_ENABLEFX =$00100000 ' Allows DX8 FX to be played back on a sound. Requires DirectX 8 - Note these sounds cannot be played more than once, be 8 bit, be less than a certain size, or have a changing frequency '  
	Const FSOUND_MPEGHALFRATE =$00200000 ' For FMODCE only - decodes mpeg streams using a lower quality decode, but faster execution '  
	Const FSOUND_IMAADPCM =$00400000 ' Contents are stored compressed as IMA ADPCM '  
	Const FSOUND_VAG =$00800000 ' For PS2 only - Contents are compressed as Sony VAG format '  
	Const FSOUND_NONBLOCKING =$01000000 ' For FSOUND_Stream_Open/FMUSIC_LoadSong - Causes stream or music to open in the background and not block the foreground app. See FSOUND_Stream_GetOpenState or FMUSIC_GetOpenState to determine when it IS ready. '  
	Const FSOUND_GCADPCM =$02000000 ' For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format '  
	Const FSOUND_MULTICHANNEL =$04000000 ' For PS2 and Gamecube only - Contents are interleaved into a multi-channel (more than stereo) format '  
	Const FSOUND_USECORE0 =$08000000 ' For PS2 only - Sample/Stream is forced to use hardware voices 00-23 '  
	Const FSOUND_USECORE1 =$10000000 ' For PS2 only - Sample/Stream is forced to use hardware voices 24-47 '  
	Const FSOUND_LOADMEMORYIOP =$20000000 ' For PS2 only - "name" will be interpreted as a pointer to data for streaming and samples. The address provided will be an IOP address '  
	Const FSOUND_IGNORETAGS =$40000000 ' Skips id3v2 etc tag checks when opening a stream, to reduce seek/read overhead when opening files (helps with CD performance) '  
	Const FSOUND_STREAM_NET =$80000000 ' Specifies an internet stream '  
	Const FSOUND_NORMAL =FSOUND_16BITS | FSOUND_SIGNED | FSOUND_MONO
	
	'misc
	Const FSOUND_FREE =-1 ' value to play on any free channel, or to allocate a sample in a free sample slot. '  
	Const FSOUND_UNMANAGED =-2 ' value to allocate a sample that is NOT managed by FSOUND or placed in a sample slot. '  
	Const FSOUND_ALL =-3 ' for a channel index , this flag will affect ALL channels available! Not supported by every function. '  
	Const FSOUND_STEREOPAN =-1 ' value for FSOUND_SetPan so that stereo sounds are not played at half volume. See FSOUND_SetPan for more on this. '  
	Const FSOUND_SYSTEMCHANNEL =-1000 ' special 'channel' ID for all channel based functions that want to alter the global FSOUND software mixing output channel '  
	Const FSOUND_SYSTEMSAMPLE =-1000 ' special 'sample' ID for all sample based functions that want to alter the global FSOUND software mixing output sample '  

	
	' functions
	'Pre Init
	Function FSOUND_Close()
	Function FSOUND_File_SetCallbacks(OpenCallback:Int,CloseCallback:Int,ReadCallback:Int,SeekCallback:Int,TellCallback:Int)
	Function FSOUND_Init:Byte(mixrate:Int,maxsoftwarechannels:Int,flags:Int)
	Function FSOUND_SetBufferSize:Byte(len_ms:Int)
	Function FSOUND_SetDriver:Byte(Driver:Int)
	Function FSOUND_SetHWND:Byte(HWND:Int)
	Function FSOUND_SetMaxHardwareChannels:Byte(max_:Int)
	Function FSOUND_SetMemorySystem:Byte(poolmem:Int Ptr,poollen:Int,useralloc:Int Ptr,userrealloc:Int Ptr,userfree:Int Ptr)
	Function FSOUND_SetMinHardwareChannels:Byte(Channels:Int)
	Function FSOUND_SetMixer:Byte(mixer:Int)
	Function FSOUND_SetOutput:Byte(outputtype:Int)
	
	'Global Runtime Update Funcs
	Function FSOUND_SetPanSeperation(pansep:Int)
	Function FSOUND_SetSFXMasterVolume(Volume:Int)
	Function FSOUND_SetSpeakerMode(speakermode:Int)
	Function FSOUND_Update()
	
	'Global Run-time Info Funcs
	Function FSOUND_GetCPUUsage:Float()
	Function FSOUND_GetChannelsPlaying:Int()
	Function FSOUND_GetDriver:Int()
	Function FSOUND_GetDriverCaps:Byte(id:Int,Caps:Int Ptr)
	Function FSOUND_GetDriverName:Byte Ptr(id:Int)
	Function FSOUND_GetError:Int()
	Function FSOUND_GetMaxSamples:Int()
	Function FSOUND_GetMaxChannels:Int()
	Function FSOUND_GetMemoryStats(currentalloced:Int Ptr,maxAlloced:Int Ptr)
	Function FSOUND_GetNumDrivers:Int()
	Function FSOUND_GetNumHWChannels(num2d:Int Ptr,num3d:Int Ptr,total:Int Ptr)
	Function FSOUND_GetOutput:Int()
	Function FSOUND_GetOutputHandle:Int()
	Function FSOUND_GetOutputRate:Int()
	Function FSOUND_GetSFXMasterVolume:Int()
	Function FSOUND_GetVersion:Float()
	
	'Sample Funcs
	Function FSOUND_Sample_Alloc:Int(index:Int,length:Int,mode:Int,deffreq:Int,defvol:Int,defpan:Int,defpri:Int)
	Function FSOUND_Sample_Free(Sample:Int)
	Function FSOUND_Sample_Get:Int(poolID:Int)
	Function FSOUND_Sample_GetDefaults(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr)
	Function FSOUND_Sample_GetDefaultsEx(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr,varfreq:Int Ptr,varvol:Int Ptr,varpan:Int Ptr)
	Function FSOUND_Sample_GetLength:Int(sptr:Int)
	Function FSOUND_Sample_GetLoopPoints(sptr:Int,loopstart:Int Ptr,loopend:Int Ptr)
	Function FSOUND_Sample_GetMinMaxDistance(sptr:Int,min_:Float Ptr,max_:Float Ptr)
	Function FSOUND_Sample_GetMode:Int(sptr:Int)
	Function FSOUND_Sample_GetName:Byte Ptr(sptr:Int)
	Function FSOUND_Sample_Load:Int(index:Int,filename:Byte Ptr,inputmode:Int,offset:Int,length:Int)
	Function FSOUND_Sample_Lock:Byte(sptr:Int,offset:Int,length:Int,ptr1:Int,ptr2:Int,len1:Int Ptr,len2:Int Ptr)
	Function FSOUND_Sample_SetDefaults:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri)
	Function FSOUND_Sample_SetDefaultsEx:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr,varfreq:Int Ptr,varvol:Int Ptr,varpan:Int Ptr)
	Function FSOUND_Sample_SetMaxPlaybacks:Byte(sptr:Int,max_:Int)
	Function FSOUND_Sample_SetMinMaxDistance:Byte(sptr:Int,min_:Float,max_:Float)
	Function FSOUND_Sample_SetMode:Byte(sptr:Int,mode:Int)
	Function FSOUND_Sample_SetLoopPoints:Byte(sptr:Int,loopstart:Int,loopend:Int)
	Function FSOUND_Sample_Unlock:Byte(sptr:Int,ptr1:Int Ptr,ptr2:Int Ptr,len1:Int,len2:Int)
	Function FSOUND_Sample_Upload:Byte(sptr:Int,ptr1,srcdata:Int Ptr,mode_in:Int)
	
	'Channel Funcs
	Function FSOUND_PlaySound:Int(channel:Int,sptr:Int)
	Function FSOUND_PlaySoundEx:Int(channel:Int,sptr:Int,dspunitLint,startpaused:Byte)
	Function FSOUND_StopSound:Byte(channel:Int)
	Function FSOUND_SetFrequency:Byte(channel:Int,Freq:Int)
	Function FSOUND_SetLevels:Byte(channel:Int,frontleft:Int,center:Int,frontright:Int,backleft:Int,backright:Int,lfe:Int)
	Function FSOUND_SetLoopMode:Byte(channel:Int,loopmode:Int)
	Function FSOUND_SetMute:Byte(channel:Int,Mute:Byte)
	Function FSOUND_SetPan:Byte(channel:Int,Pan:Int)
	Function FSOUND_SetPaused:Byte(channel:Int,Pause:Byte)
	Function FSOUND_SetPriority:Byte(channel:Int,Priority:Int)	
	Function FSOUND_SetReserved:Byte(channel:Int,Reserved:Byte)
	Function FSOUND_SetSurround:Byte(channel:Int,Surround:Byte)
	Function FSOUND_SetVolume:Byte(channel:Int,Volume :Int)	
	Function FSOUND_SetVolumeAbsolute:Byte(channel:Int,Volume :Int)	
	Function FSOUND_GetVolume:Int(channel:Int)
	Function FSOUND_GetAmplitude:Int(channel:Int)
	Function FSOUND_3D_SetAttributes:Byte(channel:Int,pos:Float Ptr,vel:Float Ptr)
	Function FSOUND_3D_SetMinMaxDistance:Byte(channel:Int,min_:Float,max_:Float)
	Function FSOUND_SetCurrentPosition:Byte(channel:Int,pos:Int)
	Function FSOUND_GetCurrentPosition:Int(channel:Int)
	Function FSOUND_GetCurrentSample:Int(channel:Int)
	Function FSOUND_GetCurrentLevels:Byte(channel:Int,l:Float Ptr,r:Float Ptr)
	Function FSOUND_GetFrequency:Int(channel:Int)
	Function FSOUND_GetLoopMode:Int(channel:Int)
	Function FSOUND_GetMixer:Int()
	Function FSOUND_GetMute:Byte(channel:Int)
	Function FSOUND_GetNumSubChannels:Int(channels:Int)
	Function FSOUND_GetPan:Int(channel:Int)
	Function FSOUND_GetPaused:Byte(channel:Int)
	Function FSOUND_GetPriority:Int(channel:Int)	
	Function FSOUND_GetReserved:Byte(channel:Int)
	Function FSOUND_GetSubChannel:Int(channels:Int,subchannels:Int)
	Function FSOUND_GetSurround:Byte(channel:Int)
	Function FSOUND_GetIsPlaying:Byte(channel:Int)
	Function FSOUND_3D_GetAttributes:Byte(channel:Int,pos:Float Ptr,vel:Float Ptr)
	Function FSOUND_3D_GetMinMaxDistance:Byte(channel:Int,min_:Float Ptr,max_:Float Ptr)

	'3D Sound Funcs
	Function FSOUND_3D_Listener_GetAttributes:Byte(pos:Float Ptr,vel:Float Ptr,fx:Float Ptr,fy:Float Ptr,fz:Float Ptr,tx:Float Ptr,ty:Float Ptr,tz:Float Ptr)
	Function FSOUND_3D_Listener_SetAttributes:Byte(pos:Float Ptr,vel:Float Ptr,fx:Float Ptr,fy:Float Ptr,fz:Float Ptr,tx:Float Ptr,ty:Float Ptr,tz:Float Ptr)
	Function FSOUND_3D_Listener_SetCurrent:Byte(current:Int ,numlisteners:Int)
	Function FSOUND_3D_SetDistanceFactor(Factor:Float)
	Function FSOUND_3D_SetDropplerFactor(Distance:Float)
	Function FSOUND_3D_SetRolloffFactor(Factor:Float)

	'Stream Funcs
	Function FSOUND_Stream_AddSyncPoint:Byte(stream:Int,pcmoffset:Int,name:String)
	Function FSOUND_Stream_Close:Byte(stream:Int)
	Function FSOUND_Stream_Create:Byte(callback:Int,lenbytes:Int,mode:Int,samplerate:Int,userdate:Int)
	Function FSOUND_Stream_CreateDSP:Byte(stream:Int,callback:Int,priority:Int,param:Int)
	Function FSOUND_Stream_DeleteSyncPoint:Byte(point:Int)
	Function FSOUND_Stream_FindTagField:Byte(stream:Int,ttype:Int,name:String,value:Int,lenght:Int)
	Function FSOUND_Stream_GetLength:Int(stream:Int)
	Function FSOUND_Stream_GetLengthMs:Int(stream:Int)
	Function FSOUND_Stream_GetMode(stream:Int)
	Function FSOUND_Stream_GetNumSubStreams:Int(stream:Int)
	Function FSOUND_Stream_GetNumSyncPoints:Int(stream:Int)
	Function FSOUND_Stream_GetNumTagFields:Byte(stream:Int,num:Int)
	Function FSOUND_Stream_GetOpenState:Int(stream:Int)
	Function FSOUND_Stream_GetPosition:Int(stream:Int)
	Function FSOUND_Stream_GetSample:Int(stream:Int)
	Function FSOUND_Stream_GetSyncPoint:Int(stream:Int,index:Int)
	Function FSOUND_Stream_GetSyncPointInfo:Int(point:Int,pcmoffset:Int)
	Function FSOUND_Stream_GetTagField:Byte(stream:Int,ttype:Int,name:String,value:Int,lenght:Int)
	Function FSOUND_Stream_GetTime:Int(stream:Int)
	Function FSOUND_Stream_Net_GetBufferProperties:Byte(buffersize:Int,prebuffer_percent:Int,rebuffer_percent:Int)
	Function FSOUND_Stream_Net_GetLastServerStatus:Int()
	Function FSOUND_Stream_Net_GetStatus:Byte(stream:Int,status:Int,bufferused:Int,bitrate:Int,flags:Int)
	Function FSOUND_Stream_Net_SetBufferProperties:Byte(buffersize:Int,prebuffer_percent:Int,rebuffer_precent:Int)
	Function FSOUND_Stream_Net_SetMetadataCallback:Byte(stream:Int,callback:Int,userdata:Int)
	Function FSOUND_Stream_Net_SetProxy:Byte(proxy:String)
	Function FSOUND_Stream_Open:Int(name_or_data:String,mode:Int,offset:Int,lenght:Int)
	Function FSOUND_Stream_Play:Int(channel:Int,stream:Int)
	Function FSOUND_Stream_PlayEx:Int(channel:Int,stream:Int,dspunit:Int,paused:Int)
	Function FSOUND_Stream_SetBufferSize:Byte(ms:Int)
	Function FSOUND_Stream_SetEndCallback:Byte(stream:Int,callback:Int,userdata:Int)
	Function FSOUND_Stream_SetLoopCount:Byte(stream:Int,count:Int)
	Function FSOUND_Stream_SetLoopPoints:Byte(stream:Int,loopstart:Int,loopend:Int)
	Function FSOUND_Stream_SetMode:Byte(stream:Int,mode:Int)
	Function FSOUND_Stream_SetPosition:Byte(stream:Int,position:Int)
	Function FSOUND_Stream_SetSubStream:Byte(stream:Int,index:Int)
	Function FSOUND_Stream_SetSubStreamSentence:Byte(stream:Int,sentencelist:Int,numitems:Int)
	Function FSOUND_Stream_SetSyncCallback:Byte(stream:Int,callback:Int,userdata:Int)
	Function FSOUND_Stream_SetTime:Byte(stream:Int,ms:Int)
	Function FSOUND_Stream_Stop:Byte(stream:Int)
	
	'CD funcs
	Function FSOUND_CD_GetNumTracks:Int(drive:String)
	Function FSOUND_CD_GetPaused:Byte(drive:String)
	Function FSOUND_CD_GetTrack:Int(drive:String)
	Function FSOUND_CD_GetTrackLength:Int(drive:String,track:Int)
	Function FSOUND_CD_GetTrackTime:Int(drive:String)
	Function FSOUND_CD_OpenTray:Byte(drive:String,open:Byte)
	Function FSOUND_CD_Play:Byte(drive:String,track:Int)
	Function FSOUND_CD_SetPaused:Byte(drive:String,paused:Byte)
	Function FSOUND_CD_SetPlayMode(drive:String,mode:Int)
	Function FSOUND_CD_SetTrackTime:Byte(drive:String,ms:Int)
	Function FSOUND_CD_SetVolume:Byte(drive:String,volume:Byte)
	Function FSOUND_CD_Stop:Byte(drive:String)
	
	'DSP funcs
	Function FSOUND_DSP_ClearMixBuffer()
	Function FSOUND_DSP_Create:Int(callback:Int,priority:Int,param:Int)
	Function FSOUND_DSP_Free(unit:Int)
	Function FSOUND_DSP_SetActive(unti:Int,active:Byte)
	Function FSOUND_DSP_GetActive:Byte(unit:Int)
	Function FSOUND_DSP_GetBufferLength:Int()
	Function FSOUND_DSP_GetBufferLengthTotal:Int()
	Function FSOUND_DSP_SetPriority(unit:Int,priority:Int)
	Function FSOUND_DSP_GetPriority:Int(unit:Int)
	Function FSOUND_DSP_GetClearUnit:Int()
	Function FSOUND_DSP_GetClipAndCopyUnit:Int()
	Function FSOUND_DSP_GetMusicUnit:Int()
	Function FSOUND_DSP_GetSFXUnit:Int()
	Function FSOUND_DSP_GetFFTUnit:Int()
	Function FSOUND_DSP_GetSpectrum:Int()
	Function FSOUND_DSP_MixBuffers:Byte(destbuffer:Int,srcbuffer:Int,le:Int,freq:Int,vol:Int,pan:Int,mode:Int)
	
	'FX Funcs
	Function FSOUND_FX_Disable:Byte(Channel:Int)
	Function FSOUND_FX_Enable:Int(channel:Int,fxtype:Int)
	Function FSOUND_FX_SetChorus:Byte(fxid:Int,wetdrymix:Float,depth:Float,feedback:Float,frequency:Int,waveform:Int,Delay:Float,phase:Int)
	Function FSOUND_FX_SetCompressor:Byte(fxid:Int,gain:Float,attack:Float,Releas:Float,threshold:Float,ratio:Float,predelay:Float)
	Function FSOUND_FX_SetDistortion:Byte(fxid:Int,gain:Float,edge:Float,posteqcenterfrequency:Float,posteqbandwidth:Float,prelowpasscutoff:Float)
	Function FSOUND_FX_SetEcho:Byte(fxid:Int,wetdrymix:Float,feedback:Float,leftback:Float,rightdelay:Float,pandelay:Int)
	Function FSOUND_FX_SetFlanger:Byte(fxid:Int,wetdrymix:Float,depth:Float,feedback:Float,frequency:Float,waveform:Int,DDelay:Float,phase:Int)
	Function FSOUND_FX_SetGargle:Byte(fxid:Int,ratehz:Int,waveshape:Int)
	Function FSOUND_FX_SetI3DL2Reverb:Byte(fxid:Int,room:Int,roomhf:Int,roomrollofffactor:Float,decaytime:Float,decayhfratio:Float,reflection:Int,reflectiondelay:Float,reverb:Int,reverbdelay:Float,diffusion:Float,density:Float,hfreference:Float)
	Function FSOUND_FX_SetParamEQ:Byte(fxid:Int,center:Float,bandwidth:Float,gain:Float)
	Function FSOUND_FX_SetWavesReverb:Byte(fxid:Int,ingain:Float,reverbmix:Float,reverbtime:Float,highfreqrtration:Float)
	
	'Rec Funcs
	Function FSOUND_Record_GetDriver:Int()
	Function FSOUND_Record_GetDriverName:Int(id:Int)
	Function FSOUND_Record_GetNumDrivers:Int()
	Function FSOUND_Record_GetPosition:Int()
	Function FSOUND_Record_SetDriver:Byte(driver:Int)
	Function FSOUND_Record_StartSample:Byte(sptr:Int,loop:Byte)
	Function FSOUND_Record_Stop:Byte()
	
	'Reverb Funcs
	Function FSOUND_Reverb_SetProperties:Byte(props:Int)
	Function FSOUND_Reverb_GetProperties:Byte(props:Int)
	Function FSOUND_Reverb_SetChannelProperties:Byte(channel:Int,prop:Int)
	Function FSOUND_Reverb_GetChannelProperties:Byte(channel:Int,prop:Int)
	
	
	' FMUSIC
	Const FMUSIC_TYPE_NONE =0  
	Const FMUSIC_TYPE_MOD =1' Protracker / Fasttracker ' 
	Const FMUSIC_TYPE_S3M =2' ScreamTracker 3 ' 
	Const FMUSIC_TYPE_XM =3' FastTracker 2 ' 
	Const FMUSIC_TYPE_IT=4 ' Impulse Tracker. ' 
	Const FMUSIC_TYPE_MIDI=5 ' MIDI file ' 
	Const FMUSIC_TYPE_FSB =6' FMOD Sample Bank file '
	
	'music funcs
	Function FMUSIC_FreeSong:Byte(Module_:Int)
	Function FMUSIC_LoadSong:Int(Name:Byte Ptr)
	Function FMUSIC_LoadSongEx:Int(Name:Byte Ptr,offset:Int,length:Int,mode:Int,samplelist:Int Ptr,samplelistnum:Int)
	Function FMUSIC_OptimizeChannels:Byte(Module_:Int,Maxchannels:Int,minvolume:Int)
	Function FMUSIC_PlaySong:Byte(Mod_:Int)
	Function FMUSIC_SetInstCallback:Byte(Modul:Int,callback:Int,instrument:Int)
	Function FMUSIC_SetLooping:Byte(Mod_:Int,Looping:Byte)
	Function FMUSIC_SetMasterSpeed:Byte(Mod_:Int,Speed:Float)
	Function FMUSIC_SetMasterVolume:Byte(Mod_:Int,Volume:Int)
	Function FMUSIC_SetOrder:Byte(Mod_:Int,Order:Int)
	Function FMUSIC_SetOrderCallback:Byte(modul:Int,callback:Int,orderstep:Int)
	Function FMUSIC_SetPanSeperation:Byte(Mod_:Int,Pan:Float)
	Function FMUSIC_SetPaused:Byte(Mod_:Int,Pause:Byte)
	Function FMUSIC_SetReverb:Byte(Mod_:Int,Pause:Byte)
	Function FMUSIC_SetRowCallback:Byte(modul:Int,callback:Int,rowstep:Int)
	Function FMUSIC_SetSample:Byte(Mod_int,sampno:Int,sptr:Int)
	Function FMUSIC_SetUserData:Byte(modul:Int,userdata:Int)
	Function FMUSIC_SetZxxCallback:Byte(modul:Int,callback:Int)
	Function FMUSIC_StopAllSongs()
	Function FMUSIC_StopSong(Mod_:Int)
	
	'Info Funcs
	Function FMUSIC_GetBPM:Int(mod_:Int)
	Function FMUSIC_GetGlobalVolume:Int(mod_:Int)
	Function FMUSIC_GetMasterVolume:Int(mod_:Int)
	Function FMUSIC_GetName:Int(modul:Int)
	Function FMUSIC_GetNumChannels:Int(mod_:Int)
	Function FMUSIC_GetNumInstruments:Int(mod_:Int)
	Function FMUSIC_GetNumOrders:Int(mod_:Int)
	Function FMUSIC_GetNumPatterns:Int(mod_:Int)
	Function FMUSIC_GetNumSamples:Int(mod_:Int)
	Function FMUSIC_GetOpenState:Int(mod_:Int)
	Function FMUSIC_GetOrder:Int(mod_:Int)
	Function FMUSIC_GetPattern:Int(mod_:Int)
	Function FMUSIC_GetPatternLength:Int(mod_:Int,OrderNo:Int)
	Function FMUSIC_GetPaused:Int(mod_:Int)
	Function FMUSIC_GetRealChannel:Int(mod_:Int,channel:Int)
	Function FMUSIC_GetRow:Int(mod_:Int)
	Function FMUSIC_GetSample:Int(mod_:Int,SampleNo:Int)
	Function FMUSIC_GetSpeed:Int(mod_:Int)
	Function FMUSIC_GetTime:Int(mod_:Int)
	Function FMUSIC_GetType:Int(mod_:Int)
	Function FMUSIC_GetUserData:Int(mod_:Int)
	Function FMUSIC_IsFinished:Byte(mod_:Int)
	Function FMUSIC_IsPlaying:Byte(mod_:Int)	
End Extern


Function cstr:Byte Ptr(str:String)
	Return str.ToCString()
	
End Function


Regards
Sveinung

VERY impressive work Sveinung - does this also work with the mac?

Is this the complete module we need to use, or do we have to combine this with drago's? Nice work :)

If you have the time, will you be able to supply an example please? just a simple one :)

All the streaming stuff as well, many thanks.

Steve.

This is the complete module (I hope...;) ).
It should do. Just read the fmod doc to confirm what commands that are supported on your os.

I hope someone find this module usefull, like I do.

Download complete lib here

Regards
Sveinung

BIG THANK YOU TO SVEINUNG
and DRAGO for the first one

This is sufficient for anyone. Don't forget everyone, that FMOD 4.0 (not this version) but the one on the fmod site, has similar dynamic content to Direct Music in DX9 - that is you can change the "mood" as you play.

Very nice! can this be added to official pub.mods?

Anyone got it working on a Mac yet?

Shame it's too expensive to use on commerical titles.

The commercial download license is $100.
The commercial hardcopy retail license is $2000.

I take it geom isn't going to be sold hardcopy retail alongside Quake4 ?

If you're selling retail commercial, $2,000 is *penuts* else why are you selling retail commercial if you don't expect to sell even close to that amount? I don't think it's much of a problem to be honest :)

I would of made a mac version, if I had a mac to test it on :), so if anyone wants to donate a mac my way ;) hehe.
I'm glade someone got around to finishing this, work has been keeping me to busy to do any programming on the weekends. (since I program at work it is the last thing on my mind to do on weekends.)

Thanks Drago :)

Now do any aussies have any mac mini's spare? :D

Fmod sounds good but I dont think I'll be using it.

I dont think most people will notice the difference between max sounds and fmod sounds. I also dont think most people have the hardware to really tell the diff..

So until this changes I think I'll stick with Max Sounds.

Unless some one wants to create a sample, that plays a set of sounds using max sounds and then the same set of sounds using fmod.

Well the reason for FMOD isn't just the snazzy sound effects. FMOD is very reliable, very fast and plays a lot more formats, in particular it has XM support which is desirable for people selling games online (to keep file sizes minimal).

The Market as it is, I dont think the licnse fee of 100$ is really worth what little extra it provides, only a few indie titles will go on to have good sales, most sell only a handfull per year which means that initial payment puts them at a loss for a while. and thats even if the title sells at all.

Dont get me wrong I think Fmod support in MAx is awsome, I think there will be a lot of people that will benefit from it. those of us lucky enough to have a publisher sitting wish cash in hand will be the ones to benefit more id say cos they will make their fee's back on sale if you know what I mean.

As a development tool I think Fmod is really good, I think its going to be a good addition to Max, I only hope that it does not end up as a replacement for Max's current sound system..

On Topic I think I have some code that might help this project, I am working from my laptop just now cos my main PC is on the blink so I'll have a look for it, if its not lost then ill add it here.

Thanks Yavin. The above FMOD code is complete, it just doesn't work with the mac at the moment as we don't have anyone with a mac or linux and an interest in FMOD.

$100 is five sales for most people.

Managed to get it working on the Mac, with a few minor changes.

I'll upload an example once I tidy it up a bit.

Steve.

Here it is : -

http://www.xmystik.co.uk/macfmod.zip

copy the fmod.mod directory to your mods\pub.mod\ directory on the mac. It will look like this then

blitzmax\mod\pub.mod\fmod.mod\

It didn't seem to like it when I used the above module and the libmod.a installed in the libs directory. This worked fine on the PC though. So I placed it in the fmod.mod directory as well and it seems to work ok.

You will also need to add a title.ogg song for the demo to stream.


There are a couple of things to note in the example.

1) I had a problem with the brl.oggloader conflicting with the fmod.mod which is why I've used a framework. Any ideas how to get around that?


2) FSOUND_SetOutput(FSOUND_OUTPUT_MAC)
to specify the Mac sound system.

The rest is the same as on the PC

Steve.

Hi Mystik,
Great work ! I'm having problems on my Powerbook though :(

- I moved your fmod.mod directory to /Applications/BlitzMax/mod/pub.mod/.
- I saved the example code you posted to my regular BlitzMax folder.
- In the demo bmx file I specified the correct path to the title.ogg file I want to play.
- I then compiled but got this :

Compiling:mod.bmx
Compile Error: realpath failed for /Applications/BlitzMax/mod/pub.mod/fmod.mod/libfmod.a
[/Applications/Development/BlitzMax/mod/pub.mod/fmod.mod/fmod.debug.macos.i;5;1]
Build Error: failed to compile /Users/dasddaa/Documents/Code/BlitzMax/mod.bmx


libfmod.a is where it should be.Any suggestions as to why the example won't compile for me ?

did you do a full build all with modules?

thanks for the reply Fish.When you say full build do you mean BlitzMax ? I have the full version (not demo) and all the BllitzMax modules are upto date.

DannyD. You can't use quick build. Uncheck the Quick Build in your program menu. Then select build modules in the same menu. Then it sholud work.

Regards
Sveinung

You could try putting the libfmod.a file in your lib directory. That is where it is supposed to go. I got an error on my powerbook with the file in there though. That is why I placed it in the fmod.mod directory.

I could be that my blitzmax isn't installed correctly. I'll try reinstalling it later.

Steve.

Thanks Sveinung and Mystik.I turned off quick build and then built the modules.It works for .ogg files but not for amiga .mods :( I get the following when replacing the filename from title.ogg to title.mod :
Compiling:mod.bmx
Linking:mod
Executing:mod
Stream Error Unknown file format


Is there a problem with the .mod file ? I tried two different ones. Perhaps I need to use a different fmod API command to play mod files ?
If I compile an application and include INCBIN a mod/ogg file, do I need to package any libraries or is that included in the application.app ?

The demo shows just the streaming feature of FMOD and I'm not sure it can stream mods or xm.

FMUSIC does the following formats:-

- .MOD (protracker/fasttracker modules)
- .S3M (screamtracker 3 modules)
- .XM (fasttracker 2 modules)
- .IT (impulse tracker modules)
- .MID (MIDI files)
- .RMI (MIDI files)
- .SGT (DirectMusic segment files)
- .FSB (FMOD Sample Bank files)

FSOUND does the wav,ogg type formats and can stream them.

Could be wrong on that as I'm not too experienced with Fmod.

Steve.

Here is a quick test for playing mods. No error checking though.

Framework brl.glmax2d
'----------------------
Import brl.retro
Import brl.blitz
Import brl.freeaudioaudio
'Import brl.oggloader   'causes probs with fmod on mac, thats why I had to use framework. Any help?
Import brl.system	
Import pub.fmod




	Graphics 800,600,0,50

	FSOUND_SetOutput(FSOUND_OUTPUT_MAC) ' Ensure you use FSOUND_OUTPUT_MAC 
	
	FSOUND_SetDriver(0)
	
	If Not FSOUND_Init(44100, 32, FSOUND_INIT_USEDEFAULTMIDISYNTH)

		RuntimeError "Init Error "
	Else
		
		Mod_:Int = FMUSIC_LoadSong(cstr("an-path.xm"))
		FMUSIC_SetLooping(Mod_, False)
		FMUSIC_PlaySong(Mod_);

				While Not KeyHit(KEY_ESCAPE)
					Cls
					DrawText "Fmod Mac Test - Press ESCAPE to sxit",0,0
					Flip
				Wend
	
			
		
	EndIf
	
	
	End
	



Yes.It's working !Brilliant stuff.

Sorry for dumb question, but... how does this work? I always get a "Function not found"-Error although I copied the module in the pub.mod folder. How2Install?

How to install:
1. Copy the libfmod.a to the lib folder
2. Copy the folder fmod.mod to the mod/pub.mod/ folder
3. Choose Build Modules from the Progam-menu in BlitzMax
4. Have Fun!!!

Rember to uncheck Quick Build.

Regards
Sveinung

Thanks, I didn't thought about copying the lib :)

Sorry, but I really don't get it. I don't have any file named "libfmod.a" here and The button to recompile alle modules is grey so I can't click on it.

Rebuild all modules. The sample work's fine, but if i want to
insert the player in my own source file i get many error's.
I hope Mark can make a module with my source files i have found in Net.

Sorry, but I really don't get it. I don't have any file named "libfmod.a" here and The button to recompile alle modules is grey so I can't click on it.



The file named libfmod.a comes with FMOD when you download it. Normally you would copy that to the blitzmax\lib\ directory. But for some reason on my Mac version of blitzmax it did not like it there. So I placed it in the mod.fmod directory instead.

You will need the developer tools installed for OSX to rebuild the modules. It should be on your OSX disk.

Steve.

Did you read my text or did you understand that i have written:

It work's fine if i use the Player , but then i use the code in my source it
does not work!

Did you read my text or did you understand that i have written:

It work's fine if i use the Player , but then i use the code in my source it
does not work!


Perhaps I was replying to the post before you.

I have edited my post to save any further confusion ;)

As you have not posted your source file, it's kind of hard to see what the problem may be....

Steve.

Ok Mystik! Sorry! It was my mistake.
I have problem's to make my source as a framework.Should be another method to get it working under MacOS X.
Or can some one tell me how i can make my code as a framework!

Just had a play with this and it works a treat.

Thanks guys, will come in very useful for my current project. :)

Muttley

Glad you could use it!
Guess I'll start looking at version 4.00

Sveinung

Started on the docs. Eta late september.
Just in case someone are interested.

Sveinung

I'm trying to make an FSound stream. I've got it to apparently pass a pointer to a (blitz) callback function to createstream, and it seems to call it OK - once. Then there is a memory error. Does anyone know why?

New update
Thanks to all that reported bugs for this update
Added sample.

FMOD

Sveinung

Where is FMOD mod ?

All your link are broken :/

Here : http://www.sherrox.com/Fmod3_74_BlitzMax.rar

Congratulations and thanx to everyone who contributed to this. Works a treat on my Mac.

Is it possible to synthesize sounds on the fly whilst replaying them in FMOD? If anyone has a demo or can tell me what commands to investigate to do this, I would appreciate it.

EDIT - I see you can set up oscillators etc in FMOD which kind of does what I want, but I would rather create the samples with max and have FMOD play them.

Hi, Is there a repository for examples using FMOD? more example code please. My requirement is to sample the mic port and send the data to the headphone output ie: to create a piece of wire! The data should be streamed I guess as I will eventually want to process the audio input before sendimg it back to the headphone socket!

This thread seems a bit dead, Nigel. Take a look at www.fmod.org.

Error:

Function FSOUND_Record_GetDriverName:Int(id:Int)

in fmod.bmx should read:

Function FSOUND_Record_GetDriverName:Byte Ptr(id:Int)

Any news on the documentation? :)

Great work on this mod, guys.

Nomen: "Is it possible to synthesize sounds on the fly whilst replaying them in FMOD?" That's what I'm trying to do. As I understand it you need to use FSound_Stream_Create and pass it the pointer to a callback function, which should then send a pointer to your audio sample data to FMOD. But I can't get it to work.

Denzilquixode-

Hmm - maybe we could combine forces.

I've since seen some demo code in C that is included with the FMOD api - but it uses stuff that isn't available in Blitz at the mo - I tried to reproduce the required stuff in Blitz but can't find some of the structures required in the C headers.

You seem to be trying a different method to me - can you post what you have so far, and I'll see if I can add anything?

It's super to see someone else taking care of this module. Due to me getting a new job, the time avil for updating this is close to none. I'v started on the documentation... :)

Sveinung

"Hmm - maybe we could combine forces."

Good idea. Well, first of all the definition of FSOUND_Stream_Create in fmod.bmx seems to be wrong, it's currently
Function FSOUND_Stream_Create:Byte(callback:Int,lenbytes:Int,mode:Int,samplerate:Int,userdate:Int)
...when I'm pretty sure callback and userdata should be pointers not ints, and it should also return one instead of a byte, so:
Function FSOUND_Stream_Create:Byte Ptr(callback:Byte Ptr,lenbytes:Int,mode:Int,samplerate:Int,userdata:Byte Ptr)
The callback function definition in the FMOD API is:

signed char F_CALLBACKAPI FSOUND_STREAMCALLBACK(
FSOUND_STREAM *stream,
void *buff,
int len,
void *userdata
);

So I attempted a Blitz version of it:
Function FMOD_Stream_Callback:Byte(stream:Byte Ptr, buff:Byte Ptr, length:Int, userdata:Byte Ptr)
	' ...
End Function
According to the API, this function should return FALSE if the stream should be stopped and TRUE otherwise. At this stage, all I want to do is to pass this callback function to FMOD, make sure it's calling the function OK, and then close the stream without actually giving it anything.

So, the full piece of code I've got is:
Function FMOD_Stream_Callback:Byte(stream:Byte Ptr, buff:Byte Ptr, length:Int, userdata:Byte Ptr)
	Print "Hello"
	Return 0
End Function

Local CallbackPtr:Byte Ptr = FMOD_Stream_Callback

FSOUND_SetDriver(0)
If Not FSOUND_Init(44100, 32, FSOUND_INIT_USEDEFAULTMIDISYNTH)
	Print "error"
End If
Local NSFStream:Byte Ptr = FSOUND_Stream_Create(CallbackPtr, 100, FSOUND_NORMAL, 1, Null)
FSOUND_Stream_Play(FSOUND_FREE, NSFStream)

Repeat
Until KeyHit(KEY_ESCAPE)

End
...which gives the following output:
Hello

[CRASH: "Unhandled Exception: Unhandled Memory Exception Error"
on line "FSOUND_Stream_Play(FSOUND_FREE, NSFStream)"]
So the callback function IS actually called, since it printed Hello, but it then still has a memory exception.

OK thanks for sharing - I may not get around to it for a couple of days, but if I make any progrss, you'll hear about it.

Wel I'm not getting memory exceptions now, but I'm not getting sound. I need documentation on FMOD functions, but there doesnt seem to be any (apart from some example code) with my download. Help anyone?

There's the online docs: http://www.fmod.org/docs/HTML/

I also have a .chm file (compiled HTML help file) which has all the docs, but if you're not on Windows that might be useless.

Yeah found those eventually - not that explanatory IMO. Are you basing your stuff on one of the Demos? If so which one.

I've got to the point where the callback is repeatedly called (I'm returning a 1 each time) and FMOD doesn't fall over - can't remember what I did, but it's hardly any different to your version. Will post it when I get home tonight. What the docs don't tell me is what I have to do in the callback. Is it just a case of writing <length> shorts (the sound!) to stream or buff?

Excellent, good to know I was almost there then. The callback stuff is in http://www.fmod.org/docs/HTML/FSOUND_STREAMCALLBACK.html - "buff" is where you have to write the data to, "stream" is the pointer to FMOD's stream definition object, what FSOUND_Stream_Create returns - I don't think that we should actually need to do anything with this yet - and length is the length of the buffer in bytes.

As I understand it the buffer can be quite small (e.g. 1000 bytes, for 250 4-byte samples) and the callback is required to exactly fill this amount, and then is called again when those samples have almost been played and the next buffer needs to be filled.

'Function FSOUND_Stream_Create:Int(callback:Byte Ptr,lenbytes:Int,mode:Int,samplerate:Int,userdata:Byte Ptr)

Framework brl.glmax2d
'----------------------
Import brl.retro
Import brl.blitz
Import brl.freeaudioaudio
'Import brl.oggloader   'causes probs with fmod on mac, thats why I had to use framework. Any help?
Import brl.system	
Import pub.fmod
Import brl.keycodes
Import brl.standardio


Global sample
sample=0

Function FMOD_Stream_Callback(stream:Byte Ptr, buff:Byte Ptr, length:Int, userdata:Byte Ptr)
	'Print "Hello"
	Print length
	Local snd_ptr:Short Ptr=Short Ptr(buff)
	'Print "going to loop"
	For n=0 To (length/4)-1
		snd_ptr[n]=Short(Rand(1,65536))
		sample:+1
	Next
	Return 1
End Function

Local CallbackPtr:Byte Ptr = FMOD_Stream_Callback

FSOUND_SetDriver(0)
If Not FSOUND_Init(44100, 32, FSOUND_INIT_USEDEFAULTMIDISYNTH)
	Print "error"
End If
Local NSFStream:Int = FSOUND_Stream_Create(CallbackPtr, 512, FSOUND_NORMAL, 1, Null)

FSOUND_Stream_Play(FSOUND_FREE, NSFStream)

FlushKeys()
Repeat
	Print sample
Until KeyHit(KEY_ESCAPE)

End


Here's what I have so far - see the opening comment for the definition of FSOUND_stream_create I'm using in FMOD.bmx. This actually produced some sound which is encouraging- unfortunately it is a low frequency rumble (I was expecting white noise) and has regular breaks - I'm not sure if the sound is changing at all between buffer reads. Max only has unsigned shorts - I'm assuming we need signed ones so will have to work around eventually. You won't need the framework stuff unless you're on a Mac like me.

Let me know how you get on.

Aw, man. I still get a memory exception error at the FSOUND_Stream_Play line. Must be some Mac/Windows thing somehow?

Edit: Duh, just thought of catching the exception:

Try
	FSOUND_Stream_Play(FSOUND_FREE, NSFStream)
Catch ex:Object
	' ... ?
End Try
...but it doesn't help that much - all I get is 512 printed once, then 128 printed repeatedly. Clearly, the callback function is still only being called once, despite it returning 1 when it's called the first time. Is there any way I can get information about the exception? I don't really understand that stuff yet.

Has anyone managed to use the FSOUND_Sample_Lock()?

Example:
FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND);
FSOUND_Init(44100,32,FSOUND_INIT_USEDEFAULTMIDISYNTH)

Global FileNameA:String = "justsomefile.wav"
Global Chan1:Int = 1

Global smp1:Int = FSOUND_Sample_Load(Chan1,cstr(FileNameA),FSOUND_16BITS,0,0)
Global smp1Len:Int = FSOUND_SAMPLE_GETLENGTH(smp1)

Global ptr1:Int 
Global ptr2:Int
Global len1:Int Ptr
Global len2:Int Ptr

Global isLocked:Byte = FSOUND_Sample_Lock:Byte(sptr,0,smp1Len,ptr1,ptr2,len1,len2)


I get a memory exeption (this is on win) when running this code. Any ideas?

Other than that, FMOD is working great for me!

Soz Petbom, not looked at that, but on a different note...

Framework brl.glmax2d
'----------------------
Import brl.retro
Import brl.blitz
Import brl.freeaudioaudio
'Import brl.oggloader   'causes probs with fmod on mac, thats why I had to use framework. Any help?
Import brl.system	
Import pub.fmod
Import brl.keycodes
Import brl.standardio

Global sample
sample=0

Function makesignedshort:Short(float_num#)
	x=Long(float_num)
	val_bits:Short=Short(x&%0111111111111111)
	sign_bit:Short=Short((x Shr 16)&%1000000000000000)
	short_val:Short=Short(sign_bit|val_bits)
	Return short_val
End Function
	
Function FMOD_Stream_Callback(stream:Byte Ptr, buff:Byte Ptr, length:Int, userdata:Byte Ptr)
	'Print "Hello"
	Print "callback!"
	Print length
	
	Local snd_ptr:Short Ptr=Short Ptr(buff)
	'Print "going to loop"
	'1942
	'2183
	
	For n=0 To (length/4)-1
		'Print n
		snd_ptr[0]=makesignedshort(32767.0*Sin(Float(sample)))		'Left speaker
		snd_ptr[1]=makesignedshort(32767.0*Sin(1.5*Float(sample)))	'Right speaker
		snd_ptr:+2
		sample:+1
	Next
	
	Return 1
End Function

Local CallbackPtr:Byte Ptr = FMOD_Stream_Callback

?Mac
FSOUND_SetOutput(FSOUND_OUTPUT_MAC)
?

FSOUND_SetDriver(0)
If Not FSOUND_Init(44100, 16, 0)
	Print "error"
EndIf

Local stream:Int = FSOUND_Stream_Create(CallbackPtr, 6*2048, FSOUND_NORMAL|FSOUND_16BITS|FSOUND_STEREO, 44100, Null)
FSOUND_Stream_Play(FSOUND_FREE, stream)

If (FSOUND_Stream_Play(FSOUND_FREE, NSFStream) = -1)
	Print("Error!")
EndIf

WaitKey()

FSOUND_Stream_Close(stream)
FSOUND_Close()

End

Finally got a streaming sound working with FMOD - ever taken absolute ages to get something working, and then forget why it was such a hassle? I did with this. Plays a different (streamed) tone through each speaker. Works fine on my Mac mini, untested on PC.

Same memory error here. Could some other PC people try it? Maybe it's a problem with my memory. I'd really like to get to the bottom of this...

Hmmm.. do you need to do some sort of FSOUND_SetOutput for the PC? Should my ?Mac directive be ?MacOs ? Can't remember. I would download the original decls file in case there was anything you changed in it. Make sure you have FMOD 3.7.4 installed - I accidentally installed a later version initially - even when you click on the older version, there are downloads of the newer on right there. I don't know if it's backwards compatible or not. The code is roughly copied from one of the stream examples, but there are bits missing, like the option to set sound output device - you could try adding these to see if another option works. Try taking the memory writes out of the stream callback - still get a memory error?

Yeah, I got the same error when all the callback did was print a string, or even just return 1 without doing anything. I definitely have 3.7.4. I'd guess this has something to do with Windows memory management, and how FMOD allocates it. But the problem arises when the callback function returns - maybe it doesn't know where to return "to" or something?

Im confused, is this working on mac. Perhaps Jack could update the top post if so?

Well there are 2 Mac examples including mine if you read down the thread - so at least some of the functions are proven to work on it.

The original fmod code by Mystik used to work fine but can't be included in any other code and must be run standalone.The problem is that the libfmod.a use a same statement as another module blitzmax.mod. Anyone know how to fix this ? I think it needs to be coded NOT as a framework.

I tried Nomen luni code above. I rebuilt all Modules and compiled:
Compiling:mod.bmx
Compile Error: Can't find interface for module 'pub.fmod'

What gives ? I turned off quick build, rebuild all modules but still keep getting this ?

Danny - have you tried all the suggestions I gave to Denzil a couple of posts up? I would love to get a version of this that would work for everyone. You have saved Sveinung's pub.fmod to your public mods folder?

Just bumping this question:
Has anyone managed to use the FSOUND_Sample_Lock()?
See above for details

Found and fixed a couple of bugs:

Changed:

Function FSOUND_Stream_Open:Int(name_or_data:String,mode:Int,offset:Int,lenght:Int)
Function FSOUND_Stream_Play:Int(channel:Int,stream:Byte Ptr)
Function FSOUND_Stream_PlayEx:Int(channel:Int,stream:Byte Ptr,dspunit:Int,paused:Int)

To:

Function FSOUND_Stream_Open:Int(name_or_data:Byte Ptr,mode:Int,offset:Int,length:Int)
Function FSOUND_Stream_Play:Int(channel:Int,stream:Int)
Function FSOUND_Stream_PlayEx:Int(channel:Int,stream:Int,dspunit:Int,paused:Int)

Not sure if this is 100% correct, but it fixed the problems I was having loading and playing streams.

Muttley

Sorry, but where can one download the "current" win32 sources?

The links given to Drago's webspace are dead.

I second that. I've noticed a couple bug fixes posted above. Is anyone keeping the BMax mod up-to-date? Perhaps this would make a nice Wiki entry, with sample code and links to the latest mod?

I don't think there's anyone coordinating this any more, which is a shame.

Updated to run under Max 1.12.

Download

Sveinung

I had to re-fix the stream opening again, could you make these changes to your master copy?

250,252c250,252
<       Function FSOUND_Stream_Open:Int(name_or_data:String,mode:Int,offset:Int,lenght:Int)
<       Function FSOUND_Stream_Play:Int(channel:Int,stream:Byte Ptr)
<       Function FSOUND_Stream_PlayEx:Int(channel:Int,stream:Byte Ptr,dspunit:Int,paused:Int)
---
>       Function FSOUND_Stream_Open:Int(name_or_data:Byte Ptr,mode:Int,offset:Int,length:Int)
>       Function FSOUND_Stream_Play:Int(channel:Int,stream:Int)
>       Function FSOUND_Stream_PlayEx:Int(channel:Int,stream:Int,dspunit:Int,paused:Int)
386d385
<


Cheers

Muttley

Thanks Muttley. Its done...
Plus some more fixes

Sveinung

Thanks mate,

Actually, I've just added this to return the relevant error code strings (pulled out of the FMOD docs) referenced by FSOUND_GetError(). Seems to work OK.

'errors
Const FMOD_ERR_NONE:String = "No errors"
Const FMOD_ERR_BUSY:String = "Cannot call this command after FSOUND_Init. Call FSOUND_Close first."
Const FMOD_ERR_UNINITIALIZED:String = "This command failed because FSOUND_Init Or FSOUND_SetOutput was Not called"
Const FMOD_ERR_INIT:String = "Error initializing output device."
Const FMOD_ERR_ALLOCATED:String = "Error initializing output device, but more specifically, the output device is already in use And cannot be reused."
Const FMOD_ERR_PLAY:String = "Playing the sound failed."
Const FMOD_ERR_OUTPUT_FORMAT:String = "Soundcard does Not support the features needed For this soundsystem (16bit stereo output)"
Const FMOD_ERR_COOPERATIVELEVEL:String = "Error setting cooperative level For hardware."
Const FMOD_ERR_CREATEBUFFER:String = "Error creating hardware sound buffer."
Const FMOD_ERR_FILE_NOTFOUND:String = "File Not found"
Const FMOD_ERR_FILE_FORMAT:String = "Unknown file format"
Const FMOD_ERR_FILE_BAD:String = "Error loading file"
Const FMOD_ERR_MEMORY:String = "Not enough memory Or resources"
Const FMOD_ERR_VERSION:String = "The version number of this file format is Not supported"
Const FMOD_ERR_INVALID_PARAM:String = "An invalid parameter was passed To this Function"
Const FMOD_ERR_NO_EAX:String = "Tried To use an EAX command on a non EAX enabled channel Or output."
Const FMOD_ERR_CHANNEL_ALLOC:String = "Failed To allocate a New channel"
Const FMOD_ERR_RECORD:String = "Recording is Not supported on this machine"
Const FMOD_ERR_MEDIAPLAYER:String = "Windows Media Player Not installed so cannot play wma Or use internet streaming."
Const FMOD_ERR_CDDEVICE:String = "An error occured trying To open the specified CD device" 

Rem
bbdoc: Function to interperate FMOD error codes returned by FSOUND_GetError()
returns: String containing the error message
End Rem
Function FMOD_GetError:String()
	Select FSOUND_GetError()
		Case 0
			Return FMOD_ERR_NONE
		Case 1
			Return FMOD_ERR_BUSY
		Case 2
			Return FMOD_ERR_UNINITIALIZED
		Case 3
			Return FMOD_ERR_INIT
		Case 4
			Return FMOD_ERR_ALLOCATED
		Case 5
			Return FMOD_ERR_PLAY
		Case 6
			Return FMOD_ERR_OUTPUT_FORMAT
		Case 7
			Return FMOD_ERR_COOPERATIVELEVEL
		Case 8
			Return FMOD_ERR_CREATEBUFFER
		Case 9
			Return FMOD_ERR_FILE_NOTFOUND
		Case 10
			Return FMOD_ERR_FILE_FORMAT
		Case 11
			Return FMOD_ERR_FILE_BAD
		Case 12
			Return FMOD_ERR_MEMORY
		Case 13
			Return FMOD_ERR_VERSION
		Case 14
			Return FMOD_ERR_INVALID_PARAM
		Case 15
			Return FMOD_ERR_NO_EAX
		Case 16
			Return FMOD_ERR_CHANNEL_ALLOC
		Case 17
			Return FMOD_ERR_RECORD
		Case 18
			Return FMOD_ERR_MEDIAPLAYER
		Case 19
			Return FMOD_ERR_CDDEVICE
		Default
			Return "Unknown Error"
	End Select
End Function


Muttley

Hi guys. Does anyone have an examples of streaming oggs and use of the effects? Also, I'd prefer to use the loadMusic functions, does anyone know a decent site for xm's, it'sm etc other than modarchive.com

Any help is appreciated. Good work on the lib, everyone.

Thanks again Muttley. Your updates are now in.
New version on the server....

I'm now working on the linux version

Sveinung

Here ya go Rimmsy:

Strict

FSOUND_SetOutput(FSOUND_OUTPUT_WINMM)
FSOUND_Init(44100, 32, 0 )
FSOUND_Stream_SetBufferSize(1000)
FSOUND_SetDriver(0)

Local oggStream:Int = FSOUND_Stream_Open( "Driller.ogg".ToCString(), FSOUND_LOOP_NORMAL, 0, 0 )

If oggStream = Null Then
	RuntimeError "Stream Error "+FSOUND_GetError()
Else
	FSOUND_Stream_Play(FSOUND_FREE, oggStream)
EndIf

While Not KeyHit( KEY_ESCAPE )

Wend

FSOUND_Close()


HTH

Muttley

That is awesome. Thank you very much. I thought there was so much more to it and it was hideously complicated. Again, thank you!

Hm. I feel a bit silly. I basically copy/pasted your code and run it with some changes to reflect my needs. I get an "unable to convert from 'byte ptr' to 'string'" error at the toCString line. So I change this to just the file (because I read somewhere that you don't need to do that anymore)

Anyway, it runs but the stream handle is always null and FMOD returns a file not found error when I'm positive the file is there.

Anyway help muttley? Also.. do that laugh. You know the one.

@Rimmsy
Think you got an old version of the module. Please try to download it again. I think that will solw your problem.

Regards
Sveinung

I downloaded the module from above, overwrote all the files then rebuilt all modules. I get some weird errors that I've highlighted in another thread. I think it gets to this error and stops so doesn't get a chance to compile the fmode lib. When I have the compile error sorted I think it'll work like you said, sveinung. Thanks for your help.

Hi,

I can't get this to work on osx 10.3.9 using bmax 1.12
I get these errors when I compile anything trying to use fmod:
ld: Undefined symbols:
_FMUSIC_LoadSong
_FMUSIC_PlaySong
_FMUSIC_SetLooping
_FSOUND_Init
_FSOUND_SetDriver
_FSOUND_SetOutput
_FSOUND_GetError

Looks like it can't find libfmod.a

Everything seem to be fine when I build the modules.
I downloaded the file at http://www.sherrox.com/Fmod3_74_BlitzMax.zip
and also the mac 3.74 libfmod.a file from the fmod page.
I placed the libfmod.a file in blitzmax/lib and in blitzmax/mod/pub.mod/fmod.mod

Anyone know why this doesn't work?

I haven't got a Mac to try it I'm afraid. :(

Muttley

@deps
The Libfmod.a file in that packed is for win32. Download the fomod api from www.fmod.org. That should dom the trick I think.

Regards
Sveinung

I have the libfmod.a for macintosh. At least that's what the .sit file said.

Please remove "strict" from the fmod.bmx source, when runnign 1.14!
Will solve this later.

Sveinung

Has anyone had any luck using the stream callback with FSOUND_Stream_SetSyncCallback()?

I've been playing around with different datatypes in the callback function and various other permutations of this thing all evening with no luck. When FMOD hits the syncpoint that I've set 2 seconds into the song, it calls the callback (it actually prints "!The Syncpoint!") and then it locks up. Here's the code I've been working on:

SuperStrict

Import pub.fmod

Const ASTREAM_FREQ:Int=44100
Const ASTREAM_CHANNELS:Int=8

If Not FSOUND_Init(ASTREAM_FREQ, ASTREAM_CHANNELS, FSOUND_INIT_GLOBALFOCUS)
	Notify("FMOD init failed!",True)
	FSOUND_Close()
	End
EndIf

Type TAStream
	Field location:String
	Field stream:Int
	Field channel:Int
	
	Function Create:TAStream(file:String, paused:Byte=True)
		Local this:TAStream=New TAStream
		
		this.location=file
		this.stream=FSOUND_Stream_Open(file.ToCString(), FSOUND_2D, 0, 0)
		FSOUND_Stream_SetSyncCallback(this.stream, TAStream.SyncCallback, Null)

		this.channel=FSOUND_Stream_PlayEx(FSOUND_FREE, this.stream, Null, paused)

		Return this
	End Function

	Method Paused(pause:Byte=True)
		FSOUND_SetPaused(channel, pause)
	End Method

	Method Close()
		FSOUND_Stream_Close(stream)
	End Method
	
	Function SyncCallback:Byte(stream:Byte Ptr, buff:Byte Ptr, length:Int, param:Byte Ptr)
		Print "SyncCallback() "+string.FromCString(buff)
	End Function

End Type

Local song1:String="C:\Documents and Settings\Bryan\Desktop\cdex_151\my music\Dismantled\Breed To Death\01-Breed To Death (Original Mix by Dismantled).mp3"
Local song2:String="C:\Documents and Settings\Bryan\Desktop\cdex_151\my music\God Module\Viscera\01-The Source.mp3"

Local song:TAStream=TAStream.Create(song1)

Local sp:Int=FSOUND_Stream_AddSyncPoint(song.stream, ASTREAM_FREQ*2, "!The Syncpoint!".ToCString())

song.Paused(False)

Input()

song.Close()
FSOUND_Close()

End


If someone could give this a try and possibly point out what I'm doing wrong I'd really appreciate it!!

http://www.fmod.org/docs/HTML/FSOUND_STREAMCALLBACK.html

http://www.fmod.org/docs/HTML/FSOUND_Stream_SetSyncCallback.html

-Bryan

Hi All,

Im trying to get XM tracks to run in a freeware game involving groups of 4 blocks falling down the screen ;o), My first game.

It looks like FMOD which I have downloaded (along with MinGW which I will need to compile to module) and installed should be able to play XM. Unfortunatly I'm unable to download any of the linked bmx zip/rar files to obtain the relevant module files!

Any help or guidance would be greatly appreciated?

Thank You

You have downloaded the www.sherrox.com/Fmod3_74_BlitzMax.zip ???

If you are running on a win32 platform...you will find all you need in that zipfile.

Put the libfmod.a in your blitmax/lib/ folder
Put the fmod.mod in your blitzmax mod/pub.mod/ folder
Put the fmod.dll in your projectfolder(or system32 folder)

Start the blizmaxide and press Ctrl-D(Build modules).
And now you are ready to go!

I have updated the lib and it's now working perfectly under 1.14

Regards
Sveinung

Nice one Sveinung you are a real trooper.

Excellent it's all working fine now cheers Sveinung, the problem was my firewall silly think kept blocking the download! Sorted now cheers, now off to complete Candy Cascade!

Hi Sveinung. I tried the updated version that you've uploaded and still no luck. The stream callback gets called (the print command works) but then fmod locks up. Have you been able to get any of the callbacks working?

Nomen luni - Any tips on how you got the stream callback working with FSOUND_Stream_Create? I tried the code that you have posted earlier in this thread and I have the same problem when the callback is called.

Tea-

I seem to be the only person who can run my code without a crash. I tested it on my Mac Mini, but I'm going to try it on my PC. I did fiddle with some of the function declarations but I'm pretty sure they all turned out to be right in the first place and I put them back.

I'll get back to you soon.

Just a quick thanks to you guys for doing this. Really is a top mod.

Hi, Excellent work, but how would I load the file from an IncBin, I noticed that it was mentioned in this thread but I can't find a simple example?

Thank You

I seem to be the only person who can run my code without a crash. I tested it on my Mac Mini, but I'm going to try it on my PC. I did fiddle with some of the function declarations but I'm pretty sure they all turned out to be right in the first place and I put them back.

I'll get back to you soon.

I've still had no luck on this or any other way of streaming my own sound (OpenAL? Hacking FreeSound?). It'd be fantastic if you could crack it...

Hi,

No problem I think I've got it...

		If fsound_init(22000,256,0) =  True
			DebugLog "Sound initialized."
		Else
			DebugLog "FMOD Sound failed to initialize."
		EndIf
		
		FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(),True)
		Local ofile:String = "incbin::salvation.xm"
		
		' play music
		'Local music=fmusic_loadsong(ofile.ToCString())
		Local xmPtr:Byte Ptr = IncBinPtr("media/sfx/salvation.xm")
		Local music=fmusic_loadsongex(xmPtr, 0, IncbinLen("media/sfx/salvation.xm"), FSOUND_LOADMEMORY, Null, 0)
		If music > 0 Then
			fmusic_playsong(music)
			FMUSIC_SetMasterVolume(music,200)
			DebugLog "Music playing. "'+sname.FromCString(FMUSIC_GetName(music))
		Else 
			DebugLog "Music failed to load. FSOUND_ERROR :"+FMOD_GetError()
			DebugLog "IncbinLen : "+IncbinLen("media/sfx/salvation.xm")
		EndIf


FMUSIC_LoadSongEx was the key!

Cheers

Does it hurt anything if I were to call FSOUND_Close() when I have not initialized using FSOUND_Init(44100, 32, 0 )? The reason I ask if because I looking for an easy way to shut of the sound. I could monitor the channel by it is set to auto allocate.

@Sean: One of these should sort you out if I understand you correctly:

FSOUND_StopSound(FSOUND_ALL)
FMUSIC_StopAllSongs()

Really I was just wondering if a call to FSOUND_Close() causes any problems when you have not itialized anything?

Try it and see ;)

Muttley

The answer to your question is...no it doesn't hurt, but it will not turn off all sound either. You just get a FALSE returned from the FSOUND_Close().


Sveinung

Thanks,

It does seem to stop the song? I will have to take a closer look.

1.
Does this work with bmx1.14 too?
As I can't get the xm player example running? :(

2.
Is there a way to incbin the fmod.dll, so that one can distribute single exe files?

@Grisu

1. You need the MaxGui module for the xm player. And yes, it run's on 1.14( at least I mine do...;) )

2. I think you then must save the fmod.dll back to disk, before initing the fmod module. Don't think or have never seen it run from memory.

Sveinung

Thanks Sveinung.

Do you know how can I writeback the dll to the hdd out of the exefile?

I think you have to load the fmod.dll as a standard dll withe the lib = LoadLibraryA ("fmod.dll")

Something like this...
If FileSize("fmod.dll") = -1

	Incbin "data/fmod.dll"
	
	Local fmodptr:Byte Ptr=IncbinPtr("data/fmod.dll")
	Local fmodlen:Int=IncbinLen("data/fmod.dll")
	
	sfile=WriteFile("fmod.dll")
	WriteLine(sfile,string.frombytes(fmodptr,fmodlen))
	CloseStream sfile

EndIf

Incbin "data/4k.xm"

lib = LoadLibraryA ("fmod.dll")

Local initsong(p1:Int,p2:Int,p3:Int) "win32"
Local closesong() "win32"
Local loadsong(song:Byte Ptr,offset:Int,songlen:Int,mode:Int,par1:Int,par2:Int) "win32"
Local playsong(songptr:Int) "win32"

initsong = GetProcAddress (lib,"_FSOUND_Init@12")
closesong = GetProcAddress (lib,"_FSOUND_Close@0")
loadsong = GetProcAddress (lib,"_FMUSIC_LoadSongEx@24")
playsong = GetProcAddress (lib,"_FMUSIC_PlaySong@4")

initsong(22000,265,0)


Local music=loadsong(IncbinPtr("data/4k.xm"),0,IncbinLen("data/4k.xm"),FSOUND_LOADMEMORY,0,0)
playsong(music)

Input("Press any key...")

closesong()
End


P.S remember to turn off "Build Gui App" for this code!

Sveinung

The code does not work, if you compile it and place the exe into an empty dir (without fmod.dll).

The problem is I have to store the memory address while compiling inside the exe. So the fmod.dll can be read out from that position later, when the app starts.

You'r right...forgot that i hade a fomd.dll in my system32.
Sorry

Sveinung

Has anyone had any luck using the stream callbacks under Windows? Were you able to do your testing Nomen luni? I spent a few hours working on this again today and haven't been able to make any progress. If it looks like this can't be made to work in BMax then I might see if I can get BASS.dll working instead since it supports the same type of stream callbacks.

When I check out the FMOD license, I find that it costs thousands of dollars, not $100! Sorry, but I don't think Blitz users will pay that kind of license. Or, if I am wrong, where's that $100 statement?

U don't need to pay if you don't charge any thing for your application.

Nice for Sceners ;)

Sveinung

Jeroen, look on their license page in the "Shareware, hobbyist agreement" section. It clearly states the $100 per title license details.

Muttley

Is there anyone who's used FMOD with C++ around? If you could give me a basic .cpp file that successfully plays a MOD file using FMOD, that I can import in a BlitzMax application, I'd be very grateful. (Still trying to get streaming working on Windows, so I want to try doing it in C++ rather than BlitzMax and then just import it in, but I'm having real problems just getting the functions out of the DLL and stuff - bluffing my way in C++ really.)

Regarding the license, has anyone had a look at 'porting' minifmod or DUMB? DUMB's license is very free, except you aren't allowed to feed your dog at 5pm whilst using it or something..

Thanks for the great module!

Do FX currently work with Blitzmax? If so how do you get them to work?
Whenever I call FSOUND_ENABLEFX the sound stops...
There is supposedly a tutorial on the fmod website but I can't find it.

Thanks in advance.

There is some tutorials in the fmod doc file. I think you will find the "DX8 FX support" interesting :)

Sveinung

Aha! I've got it working now. Thanks
I swear i had done exactly what the tutorial said, but it didn't work before...ah well, it works now so that is all that matters :D

Are there still plans to add support for the latest version of Fmod?

I created a Blitz Audio driver from the mod Sveinung posted tonight... it's pretty straight forward. Needs a tweak to the official mods to work, though. But it's a 100% replacement for FreeAudio, just use the native Blitz functions - LoadSound, PlaySound, AllocChannel, etc etc.

Version 3.75 will be avail next week.

Sveinung

Version 3.75 is ready. Added some more examples.

Download here

Sveinung

First of all, I'd like to say that this is fantastic work and something I will definitely be using in the future.

However, I am having problems getting this to work on a Mac. The latest version (in the above post) works very well under Windows. What I need to know is, what do I need to do to get this to work on a Mac under OS X 10.4.4? I am a complete newbie when it comes to the Mac, so bear with me.

- Do I need to download additional files from fmod.org (as seems to be suggested in other posts)?

- Under Windows I need to include the DLL in the same folder as the program. Is there something similar I need to be doing on the Mac?

Currently, I get undefined label errors - even when I'm trying to compile a program that doesn't use it. I know I can get around that with Framework, but that's not practical on WIPs.

If someone could answer these questions that would be great.

On another note, will this be updated for version 4?

Version 4 of fmod is a completely different product...

@JazzieB

You need to exchange the libfmod.a file to the libfmod.a file you download from www.fmod.org (Mac version). That should bee all the change you have to make.

Here is some code from Mystic thats work on Mac
Framework brl.glmax2d
'----------------------
Import brl.retro
Import brl.blitz
Import brl.freeaudioaudio
'Import brl.oggloader   'causes probs with fmod on mac, thats why I had to use framework. Any help?
Import brl.system	
Import pub.fmod




	Graphics 800,600,0,50

	FSOUND_SetOutput(FSOUND_OUTPUT_MAC) ' Ensure you use FSOUND_OUTPUT_MAC 
	
	FSOUND_SetDriver(0)
	
	If Not FSOUND_Init(44100, 32, FSOUND_INIT_USEDEFAULTMIDISYNTH)

		RuntimeError "Init Error "
	Else
		
		Mod_:Int = FMUSIC_LoadSong(cstr("an-path.xm"))
		FMUSIC_SetLooping(Mod_, False)
		FMUSIC_PlaySong(Mod_);

				While Not KeyHit(KEY_ESCAPE)
					Cls
					DrawText "Fmod Mac Test - Press ESCAPE to sxit",0,0
					Flip
				Wend
	
			
		
	EndIf
	
	
	End


Sveinung

I've already placed the Mac version of libfmod.a in both the mod/fmod folder and the lib folder. I did forget to recompile the modules, but I get the same thing after doing this, i.e. a list of undefined symbols during linking.

The example above produces the same results and it's as though BlitzMax isn't including Fmod during compilation even though it does rebeuild them during a rebuild. Here's what I get from the example above.

Building untitled1
Compiling:untitled1.bmx
Linking:untitled1
ld: Undefined symbols:
_FMUSIC_LoadSong
_FMUSIC_PlaySong
_FMUSIC_SetLooping
_FSOUND_Init
_FSOUND_SetDriver
_FSOUND_SetOutput
_FSOUND_GetError
Build Error: Failed to link /Applications/BlitzMax/tmp/untitled1.app/Contents/MacOS/untitled1
Process complete

Any ideas what I could be missing here, as I believe I've done all I need to after trying to piece it together from this very long thread?

What I've done so far is as follows.

1. Download the latest BlitzMax mod and FMOD from the link a few posts up for v3.75 of FMOD.

2. Copied the mod folder to mod/pub.

3. Downloaded FMOD 3.75 from fmod.org and install libfmod.a to the lib and mod/pub/fmod folders of BlitzMax.

4. Re-compiled all modules.

As far as I can tell, this is all I need to do. The only thing that hasn't been done is do anything with the DLL, as this is Windows only. Is there anything similar for the Mac I should be using?

hmm win32

i testet Function FMUSIC_IsFinished:Byte(mod_:Int)

to test if i can play the next song but it will not work

anyone?

I have the same problem with FSOUND_IsPlaying:Byte(). It should return True/False, but it doesn't.

Here sound work around code:

'gets the value that should be zero
song_done = FSound_IsPlaying()
Play Song

if FSound_IsPlaying() = song_done then
load next song
Play next song
end if

@Panno & HCow33

You are right FSOUND_IsPlaying(channel) does not return 0 or 1. I get a 8 char long number, with 0 or 1 at the end. So it do work in a strange way. Don't know why it does that. Thanks for letting me know.

Here is what i tested it on
Graphics 300,150,0

FSOUND_Init(22000,256,0)

music = FSOUND_Sample_Load(1,"dreams_inc.mp3",0,0,0)
FSOUND_PlaySound(1,music)

Repeat
	
	Cls()
	DrawText(FSOUND_IsPlaying(1),10,20)
	
	If KeyHit(KEY_SPACE)
		
		ll=1-ll
		If ll=1 Then FSOUND_StopSound(1)
		If ll=0 Then FSOUND_PlaySound(1,music)
		
	EndIf
	
	Flip()
	
Until KeyHit(KEY_ESCAPE) Or id=259

FSOUND_StopSound(1)
fsound_Close()

End

Sveinung

The most accurate way to perform an action at the end of a stream is to define a callback using FSOUND_Stream_SetEndCallback(). This is what I'd like to do but I was never able to get any of the callbacks working. I'll give it another try tonight since Max has been updated but I'm not getting my hopes up. =(

Has anyone had any luck getting the callbacks working on win32?

How do you get the artist and song name from an internet radio stream? I cant get FSOUND_Stream_Net_SetMetadataCallback to work.

Any ideas?

HCow33
Thanks to a tip from Korolis in another thread I finally got the callbacks working last night!! The function used as a callback needs to be defined using "Win32". For example:

Function StreamEndCallback(stream:byte ptr, data:byte ptr, usr:byte ptr) "Win32"


New Update and a new example.

Demo of how to use incbin with FMUSIC commands

Regards
Sveinung

Hello,

I downloaded fmod_3_75_module.zip and I'm using BlitzMax 1.16. I place the fmod.mod folder and the fmod.a file where told.

Still the "Build Modules" and "Rebuild All Modules" options in BLitzIDE are all grey and therefore unusable.

I think I need a little hep :)
Thank you.

Nino

Hello ninomojo

You need to turn of the "Quick Build" option under "Build Options" in the "Program" menu.

That should be it...

Regards
Sveinung

Actually Ninomojo, you need to install MinGW before you can compile modules. There's a sticky topic around here somewhere that explains how to install it.

Arghhh. Is there anyone who has got this working under BlitzMax 1.18 under Macos 10.4.5? I'm getting an error on this line: Mod_:Int = FMUSIC_LoadSong(cstr("../music/dirt.mod"))
The mod file exists but the compiler has an error with cstr .. Identifier cstr not found. :(

Don't need to use the cstring for Fmusic_loadsong.
Just use FMUSIC_LOADSONG("../music/dirt.mod")
(FMUSIC_LOADSONGEX still needs the cstring )

Regards
Sveinung

Sveinung.. Just want to confirm the file I need is Fmod3_74_BlitzMax.rar from http://www.sherrox.com/Fmod3_74_BlitzMax.zip ? Even better could someone add instructions to the BlitzMax wiki at http://blitzwiki.org/index.php/Fmod_%28Mac_Os_X_only%29 or post them here and I'll modify the wiki page. Thanks.

Building modDemo
Compiling:modDemo.bmx
Linking:modDemo.debug
ld: Undefined symbols:
_FMUSIC_GetNumOrders
_FMUSIC_GetOrder
_FMUSIC_GetPatternLength
_FMUSIC_GetRow
_FMUSIC_GetTime
_FMUSIC_LoadSong
_FMUSIC_PlaySong
_FMUSIC_SetLooping
_FSOUND_GetCPUUsage
_FSOUND_GetChannelsPlaying
_FSOUND_GetCurrentLevels
_FSOUND_Init
_FSOUND_SetDriver
_FSOUND_SetOutput
_FSOUND_GetError
Build Error: Failed to link /Users/danny/Desktop/Mod/modDemo.debug.app/Contents/MacOS/modDemo.debug
Process complete

:(

Same link error as JazzieB got above.

Mac users.

Remeber to download the fmod lib from fmod.org

Sveinung

Graphics 300,150,0

FSOUND_Init(22000,256,0)

music = FSOUND_Sample_Load(1,"dreams_inc.mp3",0,0,0)
FSOUND_PlaySound(1,music)

Repeat
	
	Cls()
	DrawText(FSOUND_IsPlaying(1),10,20)
	
	If KeyHit(KEY_SPACE)
		
		ll=1-ll
		If ll=1 Then FSOUND_StopSound(1)
		If ll=0 Then FSOUND_PlaySound(1,music)
		
	EndIf
	
	Flip()
	
Until KeyHit(KEY_ESCAPE) Or id=259

FSOUND_StopSound(1)
fsound_Close()

End

isn't working

Hehe...a little bug
But here is the workaround

Make a base value for the channel. That works

Graphics 300,150,0

FSOUND_Init(22000,256,0)

music = FSOUND_Sample_Load(1,"dreams_inc.mp3",0,0,0)

Local baseCh0:Int = FSOUND_IsPlaying(0)

FSOUND_PlaySound(0,music)

Repeat
	
	Cls()
	Local isp:Int = FSOUND_IsPlaying(0) - baseCh0
	DrawText(isp,10,40)

	If KeyHit(KEY_SPACE)
		
		ll=1-ll
		If ll=1 Then FSOUND_StopSound(0)
		If ll=0 Then FSOUND_PlaySound(0,music)
		
	EndIf
	
	Flip()
	
Until KeyHit(KEY_ESCAPE) Or id=259

FSOUND_StopSound(1)
fsound_Close()

End


Sveinung

Sveinung, have you found a way how one can incbin the fmod.dll and still use it?

I found that in order to do this you must have an exe that depack your dll and your main exe, then runs your main exe.
Not what you wanted, I know :(

Sveinung

Ouch... now that's ugly.. :(

I thought BMX was advanced in these issues.
Hopefully we will get some native mp3/mod support as it was in bp/b3d. These workarounds are pure pain (tm)...

Anyone got this running on an intel mac?

well I cooked up a fmod sample. VERY crappy I think.
Framework brl.glmax2d
Import Pub.Fmod
Import Brl.Blitz
Import Brl.System
Import Pub.Win32

?Win32
'Import "mp.o"
?
	Extern "win32" ' Crazy WinAPI stuff
	Function GetActiveWindow%()
End Extern


AppTitle$ = "Mp3 Player by Jon Basniak a.k.a triforce guardian"
					
Graphics 800,200,0,60
SetGraphicsDriver GLMax2DDriver()

Global Volume = 300
Global Mode = FSOUND_Streamable
Global hWnd% = GetActiveWindow() ' Save current Window handle
	enableMinimize( hwnd% )
	enableMaximize( hwnd% )

		FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND)
	FSOUND_Init(44100, 32, FSOUND_INIT_DSOUND_HRTF_FULL)
	FSOUND_Stream_SetBufferSize(2000)
	FSOUND_SetDriver(2)

While Not (KeyHit(Key_Escape) Or AppTerminate())

If KeyHit(Key_Space)
	FSOUND_Stream_Stop(oggStream)
	    filter$="Music Files: mp3;All Files:*"
             filename$=RequestFile( "Select a music file to open =]",filter$ )
					oggStream:Int = FSOUND_Stream_Open( filename.ToCString(), Mode, 0, 0 )
					FSOUND_SetSFXMasterVolume(Volume)
							FSOUND_Stream_Play(FSOUND_FREE, oggStream)
	Else
	
			EndIf
			Cls
			SetColor 60,100,200		
   If oggStream = Null Then
   DrawText "This is a MP3 player by Jon Basniak aka Triforce Guardian",0,0
   DrawText "No Song Is Playing Please hit space to load your song",0,10
   DrawText "This may have poped up because your song has just ended.",0,30
						Else
						

						FSOUND_SetSFXMasterVolume(Volume)
						If KeyHit(Key_Up) Then Volume:+10
						If KeyHit(Key_Down) Then Volume:-10
						
			If KeyHit(Key_S) Then FSOUND_Stream_Stop(oggStream)
			
			If KeyHit(Key_R) Then Mode = FSOUND_LOOP_NORMAL
			If KeyHit(Key_E) Then Mode = FSOUND_STREAMABLE
			
			If KeyHit(Key_A) Then FSOUND_Stream_Play(FSOUND_FREE,oggStream)
If Mode = FSOUND_LOOP_NORMAL Then DrawText "Repeat is on!",0,165	
If Mode = FSOUND_STREAMBABLE Then DrawText "Repeat is off!",0,165	

	
	DrawText "This is a MP3 player by Jon Basniak aka Triforce Guardian",0,0
	DrawText "Currently Playing: "+Filename,0,20
	DrawText "Memory Used(KB): "+GCMemAlloced(),0,40
	DrawText "CPU used: "+FSOUND_GetCPUUsage(),0,50
 	DrawText "Song Length: "+(FSOUND_Stream_GetTime(oggStream)/1000)+" / "+FSOUND_Stream_GetLengthMs(oggStream)/1000,0,60
	DrawText "Volume: "+Volume,0,70
	DrawText "Hit 'R' to repeat. NOTE: YOU WILL NEED TO RELOAD THE SONG IN ORDER FOR IT TO WORK!!!",0,135
	DrawText "Hit 'E' to disable repeat and the case is the same as above.",0,155
	DrawText "Hit 'S' to stop the song, Hit 'A' to reload the song from the beginning.",0,110
	DrawText "Hit 'Up' or 'Down' to control your volume.",0,120
EndIf

Flip ; Cls
GCCollect()
Wend

Function enableMaximize(hWnd:Long)
' Adds the Maximize Button "[]"
	Local tmp:Int = GetWindowLongA( hWnd, GWL_STYLE )
	tmp = tmp | WS_MAXIMIZEBOX
	SetWindowLongA( hWnd, GWL_STYLE, tmp )
	DrawMenuBar( hWnd )
End Function

Function enableMinimize(hWnd:Long)
' Adds the Minimize Button "_"
	Local tmp:Long = GetWindowLongA( hWnd, GWL_STYLE )
	tmp = tmp | WS_MINIMIZEBOX
	SetWindowLongA( hWnd,GWL_STYLE, tmp )
	DrawMenuBar( hWnd )
End Function
FSOUND_Close()
End


this should help people get an idea on how to use this

EDIT: winapi was taken from a example from this forum...I forgot who made it. Just remove the winapi code if you want to modify it for mac and linux

Add
    Function FSOUND_DSPCallBack(orginalbuffer:Byte Ptr,newbuffer:Byte Ptr,length:Int,param:Byte Ptr)


and you got another command

A general question:
Does Fmod use less resources (Cpu/Ram) when playing files than the bmx native sound output?

for me its about the same

Another newbie question:

Is it possible to stream ogg/mp3 files with it?

So the app doesn't have to load the full file into memory at startup?

Yes ogg/mp3's are streamable

Could you give me a small example source code?
(i.e. how to play an ogg file and make fmod to stream it)

@Grisu
You could use my streaming example from the modulepack.
Streaming.bmx...;)

Sveinung

Will have a look. Didn't notice that. Thanks.

*solved*

Ahm, can I detect if a file is playing when streaming it?

FSOUND_IsPlaying:Byte(channel:Int) doesn't seem to work... :(

You are right FSOUND_IsPlaying(channel) does not return 0 or 1. I get a 8 char long number, with 0 or 1 at the end. So it do work in a strange way. Don't know why it does that. Thanks for letting me know.

from earlier in the thread.

Thanks for pointing that out.
All quite confusing... :/

Another one from me... :/

Is it possible to display a graphical visualisation of the channels playing while streaming an ogg file. Same as in the xmplayer example.

I managed to cut it down to this:

Strict

Framework BRL.D3D7Max2D
Import BRL.Basic
Import BRL.System
Import Pub.Fmod

Incbin "an-path.xm"

Const GFX_WIDTH = 1024, GFX_HEIGHT = 768, BIT_DEPTH = 32, HERTZ = 60
Graphics GFX_WIDTH, GFX_HEIGHT, BIT_DEPTH
SeedRnd MilliSecs()

FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND);
FSOUND_SetDriver(0)
If Not FSOUND_Init(44100, 32, FSOUND_INIT_USEDEFAULTMIDISYNTH)
 Print "error"
End If

Global Left_:Float, Right_:Float
Global xmPtr:Byte Ptr = IncbinPtr("an-path.xm")
Global Mod_=fmusic_loadsongex(xmPtr, 0, IncbinLen("an-path.xm"), FSOUND_LOADMEMORY, Null,0) 

FMUSIC_PlaySong(Mod_);


Repeat
    	Cls

		For Local i:Int = 0 To FSOUND_GetChannelsPlaying()-1           
			SetColor (i*32,i*16,(128)+i*2)
			FSOUND_GetCurrentLevels(i,Varptr(left_),Varptr(right_))
			DrawRect 180+(12*i),100,4,-(left_*130.0)
			DrawRect 180+(12*i)+6,100,4,-(right_*130.0)
	    Next

        SetBlend ALPHABLEND
		SetColor 255, 255, 255
		DrawText "Usage: " + GCMemAlloced() / 1024 + "MB  ", 10, 60
        DrawRect 180,105,180+340,1
 
        Flip

Until KeyDown(KEY_ESCAPE) Or MouseHit(1) Or AppTerminate() 


My problem, I need to have such an output field while streaming! random ogg's from the hdd.

Any hints?

Yes it's possible. You can use the spectrum. Check out the xmplayer example, there you will see how it's setup.

regards
Sveinung

Thanks, I was completely on the wrong track with counting channels... :)

I've noticed that with all the examples, when compiled and run as a stand-alone program (without the IDE), the black console window opens along with the main app, even if there is no output sent to the console. Is it something I am doing wrong? Has anyone made a Windowed GUI app using FMOD that doesn't cause the console to open along with it?

If this is something that "just happens" with FMOD, then it's a showkiller for me.

Inside the bmx gui enable "build" -> "build GUI APP" and they're gone.

Me again.

Can someone change the module structure, so that fmod is only included when I use a framework for it and not by default?

What I dislike is that now every app without a framework needs the fmod.dll inside the folder! I'd like to test a simple "hello world" => compile error, fmod.dll not found?!?

This is highly annoying!

Anyone had a look at Fmod EX 4.04? The features list is impressive ...

You can put the fmod.dll in your system32 folder and you won't need it to test small apps. Just make sure you include it in final builds, obviously.

BUT, what I REALLY want to know is, does it work on a Mac yet?

@LAB
The FMod BM module hasn't been that popular, so you may have to do that your self. Sorry!
I have started on this, so if you want what I got I can send it to you.

Cheers
Sveinung

I'm going to work on FMOD ex...or at least attempt =P.

Good luck! looking forward to try it :)

Sveinung

JazzieB,
Fraid not. Fmod worked on the mac back in BM1.14 but since then it has stopped. I would be more than happy to test if you can provide instructions.

Here is a mac fmod wiki page I wrote:
http://blitzwiki.org/index.php/Fmod_%28Mac_Os_X_only%29

We need to chase people who ported it previously. Mystik and Nomen luni both got it working previously.

Nomen luni/Mystik fancy compiling and testing it under BlitzMax 1.20 ? Please post to this thread if interested:http://blitzbasic.com/Community/posts.php?topic=57975

Hello again.

I'm using stream_play for playing ogg files.
FSOUND_Stream_Play(1,shorttrailer)

I'd love having a small player panel.

Does someone know how I can get:

1. the total length of the ogg file in h:mins:seconds?
2. the current playtime ^
3. and how to jump inside the stream (forward / backwards)?

Thanks.

There are
Function FSOUND_Stream_GetPosition:Int(stream:Int)
Function FSOUND_Stream_SetPosition:Int(stream:Int)
for instance, but I don't understand how to use them without crashing.

Found Fmod3_74_BlitzMax.rar, but is this for win32 only? Cant find the linux version, since the first post is broken.

I've looked at the win32 FMOD module source code and it might work with linux. I'm not sure of it but it wouldn't hurt to give it a shot.

EDIT:

Grisu (Posted 2 days ago)
Hello again.

I'm using stream_play for playing ogg files.
FSOUND_Stream_Play(1,shorttrailer)

There are
Function FSOUND_Stream_GetPosition:Int(stream:Int)
Function FSOUND_Stream_SetPosition:Int(stream:Int)
for instance, but I don't understand how to use them without crashing.



I'll try and see if I can get that to work. Also, it's FSOUND_Stream_SetPosition:Int(stream:Int,Position:Int).

If you download the 3.75 zip file. That works... at least with ubuntu 6.06. :)

Regards
Sveinung

@Triforce: Thanks a lot for looking into this!

^^Any luck so far?

@Grisu:

You should check what you're doing, I don't crash.

case butn[1]
	pos = FSOUND_Stream_GetPosition(stream)
			pos:+ 3211
	FSOUND_Stream_SetPosition(stream,pos)


My problem is that I want to create a MagGUI winamp like slider, so that the user can "jump" around while playing a file.

But I can't get the slider accurate and at the end of a track the system complete breaks down.


My Function to transform the length into "h:m:s" or "m:s"
Function Get_TrailerTime:String(Length:Long,show_hour:Byte)
' show_hour = 00:00:00 or 00:00 digit format
Local minutes:Int=0, hours:Int=0, seconds:Int=0  
Local minstr:String="", hourstr:String="", secondstr:String=""
Local timestring:String 

length=length/1000 ' Seconds only

If show_hour=0 Then 

	minutes=length/60
	If minutes < 10 Then minstr="0"+String(minutes) Else minstr=String(minutes)

	seconds=length-minutes*60
	If seconds < 10 Then secondstr="0"+String(seconds) Else secondstr=String(seconds)

	timestring=minstr+":"+secondstr

Else 

	hours=length/60/60
	If hours < 10 Then hourstr="0"+String(hours) Else hourstr=String(hours)

	minutes=(length/60)-(hours*60)
	If minutes < 10 Then minstr="0"+String(minutes) Else minstr=String(minutes)

	seconds=length-(hours*60+minutes)*60
	If seconds < 10 Then secondstr="0"+String(seconds) Else secondstr=String(seconds)

	timestring=hourstr+":"+minstr+":"+secondstr
EndIf 
Return timestring
End Function


StartPlay function:
Function Play_TrailerNOW()
        TrailerSliderReset=0
        FSOUND_Stream_Close(shorttrailer)
        Local spec:Byte Ptr = FSOUND_DSP_GetSpectrum()
        Select cfg_dfamode 
          Case 0
				shorttrailer=FSOUND_Stream_Open("Trailer/"+MyArray[Current_Folge].trailer,0,0,0)
          Case 1
				shorttrailer=FSOUND_Stream_Open("Trailer/"+MyKidsArray[Current_Folge].trailer,0,0,0)
        End Select 

        Local length:Long=FSOUND_Stream_GetLengthMS(shorttrailer)
        TrailerLength:Long=FSOUND_Stream_GetLength(shorttrailer)/8442-1
        If length < 3600000 Then 
	        TrailerMaxtime:String=Get_TrailerTime(length,0)
            show_hour=False
        Else 
	        TrailerMaxtime:String=Get_TrailerTime(length,1)
            show_hour=True
        EndIf 
        Select cfg_dfamode 
          Case 0
                SetGadgetText (TrailerLabel," Trailer: "+Mid(MyArray[Current_Folge].name,10,Len(MyArray[Current_Folge].name)))
          Case 1
                SetGadgetText (TrailerLabel," Trailer: "+Mid(MyKidsArray[Current_Folge].name,10,Len(MyKidsArray[Current_Folge].name)))
        End Select 

        SetSliderRange TrailerPosSlider:TGadget,1,(FSOUND_Stream_GetLength(shorttrailer)/8442)
        FSOUND_Stream_Play(1,shorttrailer)
        FSOUND_SetSFXMasterVolume(cfg_volume)
        snd_startplay=False 
End Function 


Here's a tip, use FSOUND_MPEGACCURATE. Your code seems OK to me, but I'll toy around with it and see what I can do.

It seems like one second is missing with all my ogg-files (from my time output). FSOUND_MPEGACCURATE doesn't help.
Was worth a try.

You sure you used FSOUND_MPEGACCURATE correctly?
Psuedo Code.
music=FSOUND_Stream_Open(song.ToCString(),FSOUND_MPEGACCURATE, 0, 0)


hmm.. I believe thats what you did wrong. But prehaps it's a problem within FMOD, which I highly doubt.

It's mostly bug called user error... ;)

Think I have it now. I switched from real positions to positions given in millisecs and it works fine.

Though I have some other issues:

1.
Is it possible to pause and resume a streamed file? Couldn't find functions for that under stream. Need that for doíng a "pause" button.

2.
I currently use a SCROLLBAR for displaying the "progress".

As I dislike having "arrows" at both ends: Do you know a way how I could use a TRACKBAR or other slidertype instead? A TRACKBAR looks cooler for the purpose, but I have to "shrink" it somehow to fit into 180 pixel width on my panel.

To put it short: I need a SLIDER_TRACKBAR with a proportional size knob.

Well.... you can use a canvas or an progress bar. I've got pause to work with FSOUND_Stream. It's simple really... I'll post some pseudo code.

Case file_pause	
  pause = true
	FSOUND_SetPaused(FSOUND_ALL,pause)

		If pause = True
				pause = False
		 FSOUND_GetPaused(FSOUND_ALL)
				FSOUND_SetPaused(FSOUND_ALL,pause)
endif


There ya go =P. Simple pause code.

Thanks for the bit of code. Will test it asap and report back.

Slowly my player looks like one.. :)



I have tried using a canvas already, but due to the fact that the scale has to be proportional my code didn't work out well so far.

It's so simple if you know how:

          If trailerpaused=False Then
			trailerpaused=True
            FSOUND_SetPaused(FSOUND_ALL,trailerpaused)
          Else
			trailerpaused=False
            FSOUND_GetPaused(FSOUND_ALL)
            FSOUND_SetPaused(FSOUND_ALL,trailerpaused)
          EndIf 


Up and working... :D

yep! You got it figured out =D. Now time to continue FMODex port.

Hi :)

I'm trying to make some spectrum analyser test with FMOD but this example
seem don't work correctly ? :) any idea ? :)

Graphics 800,600,0

FSOUND_Init(44100, 32,FSOUND_INIT_ACCURATEVULEVELS)


FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), True)

music=FSOUND_Stream_Open("http://64.202.98.91:8066",FSOUND_LOOP,0,0)
FSOUND_Stream_Play(FSOUND_FREE,music)

Global TempVU:Byte Ptr

Repeat
	
	Cls()
	

	
	For Local i:Int = 0 To 512
		SetColor i*12,i*16,(128)+i*2
		TempVU = FSOUND_DSP_GetSpectrum()
		DrawRect 10+(4*i),300,4,-TempVU[I]
	Next
	
	
	
	If KeyHit(KEY_SPACE)
		
		DrawText(FSOUND_Stream_Stop(music),10,30)
		
	EndIf
	
	'DrawText TempVU,10,10
	Flip()
	
Until KeyHit(KEY_ESCAPE) Or id=259

FSOUND_Stream_Close(music)
fsound_Close()

End


With the module, there are a few examples within the ZIP file. modDemo.bmx, and XMPlayer.BMX has a spectrum analyzer.

yes but it work only for mods ! whith mp3 you need to use
another commands

@Fliax:

Just call 0800-Grisu... :)))))))))))))

Function Call_0800_Grisu()
Local spec:Byte Ptr= FSOUND_DSP_GetSpectrum()
            Local bnk:TBank =Null
        	bnk:TBank = CreateStaticBank(spec,512*4)
            SetBlend Alphablend
			SetAlpha 0.6
			For Local x:Int=0 To 253 'Step 2
					Local yp:Int=(PeekFloat(bnk,x*4)*500)
					SetColor (x/8*32,x/8*16,(128)+x/8*2)
                    yp=yp*4 
                    If yp>60 Then yp=60
					DrawLine 40+x,274+60-yp,40+x,274+60
			Next
			SetAlpha 1.0
            SetColor 255,255,255
End Function  


Yeahh !! that cool :) many thanks !

still nobdy got the Mac version working?

still nobdy got the Mac version working?


I'm beginning to think nobody is ever going to answer that one, becauae I've asked it in this thread somewhere, plus another couple of threads I started specifically to answer this question and the last answer I got was "it broke from v1.14 of BlitzMax".

If the answer is yes, then I will go through all the trouble of re-installing all the libs and stuff, and then ask questions when something doesn't work right. I don't want to do all this only to later find that it still hasn't been fixed.

So, somebody please, does it now work on the Mac? If so, how do we install it, as it's a bit different to Windows?

Sorry...Don't have a Mac.

Sveinung

How about someone with a mac giving Sveinung or someone access to a mac via vnc ? Who has a mac , broadband connection and is willing ?

Perhaps someone can even donate an old mac for testing purposes? ;)

I only have a PC, sorry.

How can i load a module from a bank? (not incbin)
Is there anyone with a little code? Only load a *mod to a Bank and give it with a pointer to LoadSongEx.(so what i want to do is play a mod from the memory.

thanks.

Here you go....

Strict

Framework BRL.RamStream
Import Pub.FMod
Import BRL.PolledInput

Local data:TBank=CreateBank(FileSize("an-path.xm"))
data=LoadBank("an-path.xm")
Local length=BankSize(data)

fsound_init(22000,256,0)

Local music:Int=FMUSIC_LoadSongEx(BankBuf(data),0,length,FSOUND_LOADMEMORY,Null,Null)

FMUSIC_PlaySong(music)

WaitKey

fsound_close()


Sveinung

thx Sveinung.

That is exactly what i need. :)

bye

does fmod allow real time (or modestly redarded) spectral analysis of microphone input?
and if yes, can someone help with hints?
(I understand that any subsequent graphical display of frequencies is on the programmer's side)

thank you
allos

@allos

Yes i does.
I'll make a demo...just need to get hold off a mic :)

Sveinung

How do you get the fmod source?

FMod is a comercial product, so I don't think they will give you the source.

Sveinung

Sveinung is probably right... ;)

Will Fmod still be updated? Or is 3.75 the final release?

I will try to keep it updated. But it will only be the 3.xx. I've looked at the version 4, but I do not have time for that just now. I still have the 3.75 doc to write :(

Sveinung

For XM only play, use uFMOD

http://ufmod.sf.net

The problem is to find a tracker...

You can use Skale Tracker

Sveinung

Perhaps someone can even donate an old mac for testing purposes? ;)

I only have a PC, sorry.


I heard there's an OSX version that's intel based (x86), any news on that?

Heres the text to append to the commands.txt in docmods to make the fmod module appear as proper functions with quick help and detailed help. I dont know if it is a copyright infringment, it shouldnt be, as this is just meant for learning etc. You need to get the help htmls from fmod website and put them into the correct place indicated in the text below.(If there is an official way to add commands for highlighting/quickhelp etc, please tell me). Thanks

Marc Specter

FMUSIC_PlaySong:Byte(Mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_PlaySong.html
FMUSIC_FreeSong:Byte(Module_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_FreeSong.html
FMUSIC_LoadSong:Int(Name:Byte Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_LoadSong.html
FMUSIC_LoadSongEx:Int(Name:Byte Ptr,offset:Int,length:Int,mode:Int,samplelist:Int Ptr,samplelistnum:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_LoadSongEx.html
FMUSIC_OptimizeChannels:Byte(Module_:Int,Maxchannels:Int,minvolume:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_OptimizeChannels.html
FMUSIC_PlaySong:Byte(Mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_PlaySong.html
FMUSIC_SetInstCallback:Byte(Modul:Int,callback:Int,instrument:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetInstCallback.html
FMUSIC_SetLooping:Byte(Mod_:Int,Looping:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetLooping.html
FMUSIC_SetMasterSpeed:Byte(Mod_:Int,Speed:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetMasterSpeed.html
FMUSIC_SetMasterVolume:Byte(Mod_:Int,Volume:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetMasterVolume.html
FMUSIC_SetOrder:Byte(Mod_:Int,Order:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetOrder.html
FMUSIC_SetOrderCallback:Byte(modul:Int,callback:Int,orderstep:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetOrderCallback.html
FMUSIC_SetPanSeperation:Byte(Mod_:Int,Pan:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetPanSeperation.html
FMUSIC_SetPaused:Byte(Mod_:Int,Pause:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetPaused.html
FMUSIC_SetReverb:Byte(Mod_:Int,Pause:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetReverb.html
FMUSIC_SetRowCallback:Byte(modul:Int,callback:Int,rowstep:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetRowCallback.html
FMUSIC_SetSample:Byte(Mod_int,sampno:Int,sptr:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetSample.html
FMUSIC_SetUserData:Byte(modul:Int,userdata:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetUserData.html
FMUSIC_SetZxxCallback:Byte(modul:Int,callback:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_SetZxxCallback.html
FMUSIC_StopAllSongs()|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_StopAllSongs.html
FMUSIC_StopSong(Mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_StopSong.html
FMUSIC_GetBPM:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetBPM.html
FMUSIC_GetGlobalVolume:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetGlobalVolume.html
FMUSIC_GetMasterVolume:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetMasterVolume.html
FMUSIC_GetName:Byte Ptr(modul:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetName.html
FMUSIC_GetNumChannels:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetNumChannels.html
FMUSIC_GetNumInstruments:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetNumInstruments.html
FMUSIC_GetNumOrders:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetNumOrders.html
FMUSIC_GetNumPatterns:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetNumPatterns.html
FMUSIC_GetNumSamples:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetNumSamples.html
FMUSIC_GetOpenState:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetOpenState.html
FMUSIC_GetOrder:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetOrder.html
FMUSIC_GetPattern:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetPattern.html
FMUSIC_GetPatternLength:Int(mod_:Int,OrderNo:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetPatternLength.html
FMUSIC_GetPaused:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetPaused.html
FMUSIC_GetRealChannel:Int(mod_:Int,channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetRealChannel.html
FMUSIC_GetRow:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetRow.html
FMUSIC_GetSample:Int(mod_:Int,SampleNo:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetSample.html
FMUSIC_GetSpeed:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetSpeed.html
FMUSIC_GetTime:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetTime.html
FMUSIC_GetType:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetType.html
FMUSIC_GetUserData:Int(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_GetUserData.html
FMUSIC_IsFinished:Byte(mod_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_IsFinished.html
FMUSIC_IsPlaying:Byte(mod_:Int)| /Mod/pub.mod/fmod.mod/doc/HTML/FMUSIC_IsPlaying.html
FSOUND_Close()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Close.html
FSOUND_File_SetCallbacks(OpenCallback:Int,CloseCallback:Int,ReadCallback:Int,SeekCallback:Int,TellCallback:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_File_SetCallbacks.html
FSOUND_Init:Byte(mixrate:Int,maxsoftwarechannels:Int,flags:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Init.html
FSOUND_SetDriver:Byte(Driver:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetDriver.html
FSOUND_SetMaxHardwareChannels:Byte(max_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetMaxHardwareChannels.html
FSOUND_SetMemorySystem:Byte(poolmem:Int Ptr,poollen:Int,useralloc:Int Ptr,userrealloc:Int Ptr,userfree:Int Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetMemorySystem.html
FSOUND_SetMinHardwareChannels:Byte(Channels:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetMinHardwareChannels.html
FSOUND_SetMixer:Byte(mixer:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetMixer.html
FSOUND_SetOutput:Byte(outputtype:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetOutput.html
FSOUND_SetPanSeperation:Byte(pansep:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetPanSeperation.html
FSOUND_SetSFXMasterVolume:Byte(Volume:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetSFXMasterVolume.html
FSOUND_SetSpeakerMode:Byte(speakermode:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetSpeakerMode.html
FSOUND_Update:Byte()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Update.html
FSOUND_GetCPUUsage:Float()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetCPUUsage.html
FSOUND_GetChannelsPlaying:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetChannelsPlaying.html
FSOUND_GetDriver:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetDriver.html
FSOUND_GetDriverCaps:Byte(id:Int,Caps:Int Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetDriverCaps.html
FSOUND_GetDriverName:Byte Ptr(id:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetDriverName.html
FSOUND_GetError:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetError.html
FSOUND_GetMaxSamples:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetMaxSamples.html
FSOUND_GetMaxChannels:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetMaxChannels.html
FSOUND_GetMemoryStats(currentalloced:Int Ptr,maxAlloced:Int Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetMemoryStats.html
FSOUND_GetNumDrivers:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetNumDrivers.html
FSOUND_GetNumHWChannels:Int(num2d:Int Ptr,num3d:Int Ptr,total:Int Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetNumHWChannels.html
FSOUND_GetOutput:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetOutput.html
FSOUND_GetOutputHandle:Byte Ptr()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetOutputHandle.html
FSOUND_GetOutputRate:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetOutputRate.html
FSOUND_GetSFXMasterVolume:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetSFXMasterVolume.html
FSOUND_GetVersion:Float()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetVersion.html
FSOUND_Sample_Alloc:Int(index:Int,length:Int,mode:Int,deffreq:Int,defvol:Int,defpan:Int,defpri:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_Alloc.html
FSOUND_Sample_Free(Sample:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_Free.html
FSOUND_Sample_Get:Byte Ptr(poolID:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_Get.html
FSOUND_Sample_GetDefaults:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_GetDefaults.html
FSOUND_Sample_GetDefaultsEx:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr,varfreq:Int Ptr,varvol:Int Ptr,varpan:Int Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_GetDefaultsEx.html
FSOUND_Sample_GetLength:Int(sptr:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_GetLength.html
FSOUND_Sample_GetLoopPoints:Byte(sptr:Int,loopstart:Int Ptr,loopend:Int Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_GetLoopPoints.html
FSOUND_Sample_GetMinMaxDistance:Byte(sptr:Int,min_:Float Ptr,max_:Float Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_GetMinMaxDistance.html
FSOUND_Sample_GetMode:Byte(sptr:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_GetMode.html
FSOUND_Sample_GetName:Byte Ptr(sptr:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_GetName.html
FSOUND_Sample_Load:Int(index:Int,filename:Byte Ptr,inputmode:Int,offset:Int,length:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_Load.html
FSOUND_Sample_Lock:Byte(sptr:Int,offset:Int,length:Int,ptr1:Byte Ptr,ptr2:Byte Ptr,len1:Int Ptr,len2:Int Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_Lock.html
FSOUND_Sample_SetDefaults:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_SetDefaults.html
FSOUND_Sample_SetDefaultsEx:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr,varfreq:Int Ptr,varvol:Int Ptr,varpan:Int Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_SetDefaultsEx.html
FSOUND_Sample_SetMaxPlaybacks:Byte(sptr:Int,max_:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_SetMaxPlaybacks.html
FSOUND_Sample_SetMinMaxDistance:Byte(sptr:Int,min_:Float,max_:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_SetMinMaxDistance.html
FSOUND_Sample_SetMode:Byte(sptr:Int,mode:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_SetMode.html
FSOUND_Sample_SetLoopPoints:Byte(sptr:Int,loopstart:Int,loopend:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_SetLoopPoints.html
FSOUND_Sample_Unlock:Byte(sptr:Int,ptr1:Int Ptr,ptr2:Int Ptr,len1:Int,len2:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_Unlock.html
FSOUND_Sample_Upload:Byte(sptr:Int,srcdata:Int Ptr,mode_in:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Sample_Upload.html
FSOUND_PlaySound:Int(channel:Int,sptr:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_PlaySound.html
FSOUND_PlaySoundEx:Int(channel:Int,sptr:Int,dspunitLint,startpaused:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_PlaySoundEx.html
FSOUND_StopSound:Byte(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_StopSound.html
FSOUND_SetFrequency:Byte(channel:Int,Freq:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetFrequency.html
FSOUND_SetLevels:Byte(channel:Int,frontleft:Int,center:Int,frontright:Int,backleft:Int,backright:Int,lfe:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetLevels.html
FSOUND_SetLoopMode:Byte(channel:Int,loopmode:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetLoopMode.html
FSOUND_SetMute:Byte(channel:Int,Mute:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetMute.html
FSOUND_SetPan:Byte(channel:Int,Pan:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetPan.html
FSOUND_SetPaused:Byte(channel:Int,Pause:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetPaused.html
FSOUND_SetPriority:Byte(channel:Int,Priority:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetPriority.html
FSOUND_SetReserved:Byte(channel:Int,Reserved:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetReserved.html
FSOUND_SetSurround:Byte(channel:Int,Surround:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetSurround.html
FSOUND_SetVolume:Byte(channel:Int,Volume :Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetVolume.html
FSOUND_SetVolumeAbsolute:Byte(channel:Int,Volume :Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetVolumeAbsolute.html
FSOUND_GetVolume:Int(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetVolume.html
FSOUND_GetAmplitude:Int(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetAmplitude.html
FSOUND_3D_SetAttributes:Byte(channel:Int,pos:Float Ptr,vel:Float Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_3D_SetAttributes.html
FSOUND_3D_SetMinMaxDistance:Byte(channel:Int,min_:Float,max_:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_3D_SetMinMaxDistance.html
FSOUND_SetCurrentPosition:Byte(channel:Int,pos:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_SetCurrentPosition.html
FSOUND_GetCurrentPosition:Int(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetCurrentPosition.html
FSOUND_GetCurrentSample:Int(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetCurrentSample.html
FSOUND_GetCurrentLevels:Byte(channel:Int,l:Float Ptr,r:Float Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetCurrentLevels.html
FSOUND_GetFrequency:Int(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetFrequency.html
FSOUND_GetLoopMode:Int(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetLoopMode.html
FSOUND_GetMixer:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetMixer.html
FSOUND_GetMute:Byte(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetMute.html
FSOUND_GetNumSubChannels:Int(channels:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetNumSubChannels.html
FSOUND_GetPan:Int(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetPan.html
FSOUND_GetPaused:Byte(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetPaused.html
FSOUND_GetPriority:Int(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetPriority.html
FSOUND_GetReserved:Byte(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetReserved.html
FSOUND_GetSubChannel:Int(channels:Int,subchannels:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetSubChannel.html
FSOUND_GetSurround:Byte(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_GetSurround.html
FSOUND_IsPlaying:Byte(channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_IsPlaying.html
FSOUND_3D_GetAttributes:Byte(channel:Int,pos:Float Ptr,vel:Float Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_3D_GetAttributes.html
FSOUND_3D_GetMinMaxDistance:Byte(channel:Int,min_:Float Ptr,max_:Float Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_3D_GetMinMaxDistance.html
FSOUND_3D_Listener_GetAttributes:Byte(pos:Float Ptr,vel:Float Ptr,fx:Float Ptr,fy:Float Ptr,fz:Float Ptr,tx:Float Ptr,ty:Float Ptr,tz:Float Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_3D_Listener_GetAttributes.html
FSOUND_3D_Listener_SetAttributes:Byte(pos:Float Ptr,vel:Float Ptr,fx:Float Ptr,fy:Float Ptr,fz:Float Ptr,tx:Float Ptr,ty:Float Ptr,tz:Float Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_3D_Listener_SetAttributes.html
FSOUND_3D_Listener_SetCurrent:Byte(current:Int ,numlisteners:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_3D_Listener_SetCurrent.html
FSOUND_3D_SetDistanceFactor(Factor:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_3D_SetDistanceFactor.html
FSOUND_3D_SetDropplerFactor(Distance:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_3D_SetDropplerFactor.html
FSOUND_3D_SetRolloffFactor(Factor:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_3D_SetRolloffFactor.html
FSOUND_Stream_AddSyncPoint:Byte(stream:Int,pcmoffset:Int,name:Byte Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_AddSyncPoint.html
FSOUND_Stream_Close:Byte(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Close.html
FSOUND_Stream_Create:Byte(callback:Int,lenbytes:Int,mode:Int,samplerate:Int,userdate:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Create.html
FSOUND_Stream_CreateDSP:Byte(stream:Int,callback:Int,priority:Int,param:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_CreateDSP.html
FSOUND_Stream_DeleteSyncPoint:Byte(point:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_DeleteSyncPoint.html
FSOUND_Stream_FindTagField:Byte(stream:Int,ttype:Int,name:String,value:Int,lenght:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_FindTagField.html
FSOUND_Stream_GetLength:Int(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetLength.html
FSOUND_Stream_GetLengthMs:Int(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetLengthMs.html
FSOUND_Stream_GetMode(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetMode.html
FSOUND_Stream_GetNumSubStreams:Int(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetNumSubStreams.html
FSOUND_Stream_GetNumSyncPoints:Int(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetNumSyncPoints.html
FSOUND_Stream_GetNumTagFields:Byte(stream:Int,num:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetNumTagFields.html
FSOUND_Stream_GetOpenState:Int(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetOpenState.html
FSOUND_Stream_GetPosition:Int(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetPosition.html
FSOUND_Stream_GetSample:Int(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetSample.html
FSOUND_Stream_GetSyncPoint:Int(stream:Int,index:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetSyncPoint.html
FSOUND_Stream_GetSyncPointInfo:Int(point:Int,pcmoffset:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetSyncPointInfo.html
FSOUND_Stream_GetTagField:Byte(stream:Int,ttype:Int,name:Byte Ptr,value:Int,lenght:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetTagField.html
FSOUND_Stream_GetTime:Int(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_GetTime.html
FSOUND_Stream_Net_GetBufferProperties:Byte(buffersize:Int,prebuffer_percent:Int,rebuffer_percent:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Net_GetBufferProperties.html
FSOUND_Stream_Net_GetLastServerStatus:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Net_GetLastServerStatus.html
FSOUND_Stream_Net_GetStatus:Byte(stream:Int,status:Int,bufferused:Int,bitrate:Int,flags:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Net_GetStatus.html
FSOUND_Stream_Net_SetBufferProperties:Byte(buffersize:Int,prebuffer_percent:Int,rebuffer_precent:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Net_SetBufferProperties.html
FSOUND_Stream_Net_SetMetadataCallback:Byte(stream:Int,callback:Int,userdata:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Net_SetMetadataCallback.html
FSOUND_Stream_Net_SetProxy:Byte(proxy:Byte Ptr)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Net_SetProxy.html
FSOUND_Stream_Open:Int(name_or_data:Byte Ptr,mode:Int,offset:Int,lenght:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Open.html
FSOUND_Stream_Play:Int(channel:Int,stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Play.html
FSOUND_Stream_PlayEx:Int(channel:Int,stream:Int,dspunit:Int,paused:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_PlayEx.html
FSOUND_Stream_SetBufferSize:Byte(ms:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_SetBufferSize.html
FSOUND_Stream_SetEndCallback:Byte(stream:Int,callback:Int,userdata:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_SetEndCallback.html
FSOUND_Stream_SetLoopCount:Byte(stream:Int,count:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_SetLoopCount.html
FSOUND_Stream_SetLoopPoints:Byte(stream:Int,loopstart:Int,loopend:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_SetLoopPoints.html
FSOUND_Stream_SetMode:Byte(stream:Int,mode:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_SetMode.html
FSOUND_Stream_SetPosition:Byte(stream:Int,position:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_SetPosition.html
FSOUND_Stream_SetSubStream:Byte(stream:Int,index:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_SetSubStream.html
FSOUND_Stream_SetSubStreamSentence:Byte(stream:Int,sentencelist:Int,numitems:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_SetSubStreamSentence.html
FSOUND_Stream_SetSyncCallback:Byte(stream:Int,callback:Int,userdata:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_SetSyncCallback.html
FSOUND_Stream_SetTime:Byte(stream:Int,ms:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_SetTime.html
FSOUND_Stream_Stop:Byte(stream:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Stream_Stop.html
FSOUND_CD_GetNumTracks:Int(drive:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_GetNumTracks.html
FSOUND_CD_GetPaused:Byte(drive:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_GetPaused.html
FSOUND_CD_GetTrack:Int(drive:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_GetTrack.html
FSOUND_CD_GetTrackLength:Int(drive:Int,track:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_GetTrackLength.html
FSOUND_CD_GetTrackTime:Int(drive:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_GetTrackTime.html
FSOUND_CD_OpenTray:Byte(drive:Int,open:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_OpenTray.html
FSOUND_CD_Play:Byte(drive:Int,track:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_Play.html
FSOUND_CD_SetPaused:Byte(drive:Int,paused:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_SetPaused.html
FSOUND_CD_SetPlayMode(drive:Int,mode:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_SetPlayMode.html
FSOUND_CD_SetTrackTime:Byte(drive:Int,ms:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_SetTrackTime.html
FSOUND_CD_SetVolume:Byte(drive:Int,volume:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_SetVolume.html
FSOUND_CD_Stop:Byte(drive:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_CD_Stop.html
FSOUND_DSP_ClearMixBuffer()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_ClearMixBuffer.html
FSOUND_DSP_Create:Int(callback:Int,priority:Int,param:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_Create.html
FSOUND_DSP_Free(unit:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_Free.html
FSOUND_DSP_SetActive(unti:Int,active:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_SetActive.html
FSOUND_DSP_GetActive:Byte(unit:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_GetActive.html
FSOUND_DSP_GetBufferLength:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_GetBufferLength.html
FSOUND_DSP_GetBufferLengthTotal:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_GetBufferLengthTotal.html
FSOUND_DSP_SetPriority(unit:Int,priority:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_SetPriority.html
FSOUND_DSP_GetPriority:Int(unit:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_GetPriority.html
FSOUND_DSP_GetClearUnit:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_GetClearUnit.html
FSOUND_DSP_GetClipAndCopyUnit:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_GetClipAndCopyUnit.html
FSOUND_DSP_GetMusicUnit:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_GetMusicUnit.html
FSOUND_DSP_GetSFXUnit:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_GetSFXUnit.html
FSOUND_DSP_GetFFTUnit:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_GetFFTUnit.html
FSOUND_DSP_GetSpectrum:Byte Ptr()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_GetSpectrum.html
FSOUND_DSP_MixBuffers:Byte(destbuffer:Int,srcbuffer:Int,le:Int,freq:Int,vol:Int,pan:Int,mode:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_DSP_MixBuffers.html
FSOUND_FX_Disable:Byte(Channel:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_Disable.html
FSOUND_FX_Enable:Int(channel:Int,fxtype:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_Enable.html
FSOUND_FX_SetChorus:Byte(fxid:Int,wetdrymix:Float,depth:Float,feedback:Float,frequency:Int,waveform:Int,Delay:Float,phase:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_SetChorus.html
FSOUND_FX_SetCompressor:Byte(fxid:Int,gain:Float,attack:Float,Releas:Float,threshold:Float,ratio:Float,predelay:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_SetCompressor.html
FSOUND_FX_SetDistortion:Byte(fxid:Int,gain:Float,edge:Float,posteqcenterfrequency:Float,posteqbandwidth:Float,prelowpasscutoff:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_SetDistortion.html
FSOUND_FX_SetEcho:Byte(fxid:Int,wetdrymix:Float,feedback:Float,leftback:Float,rightdelay:Float,pandelay:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_SetEcho.html
FSOUND_FX_SetFlanger:Byte(fxid:Int,wetdrymix:Float,depth:Float,feedback:Float,frequency:Float,waveform:Int,DDelay:Float,phase:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_SetFlanger.html
FSOUND_FX_SetGargle:Byte(fxid:Int,ratehz:Int,waveshape:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_SetGargle.html
FSOUND_FX_SetI3DL2Reverb:Byte(fxid:Int,room:Int,roomhf:Int,roomrollofffactor:Float,dectime:Float,dechfratio:Float,ref:Int,refdelay:Float,reverb:Int,revdelay:Float,diff:Float,dens:Float,hfref:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_SetI3DL2Reverb.html
FSOUND_FX_SetParamEQ:Byte(fxid:Int,center:Float,bandwidth:Float,gain:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_SetParamEQ.html
FSOUND_FX_SetWavesReverb:Byte(fxid:Int,ingain:Float,reverbmix:Float,reverbtime:Float,hfreqrtration:Float)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_FX_SetWavesReverb.html
FSOUND_Record_GetDriver:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_GetDriver.html
FSOUND_Record_GetDriverName:Int(id:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_GetDriverName.html
FSOUND_Record_GetNumDrivers:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_GetNumDrivers.html
FSOUND_Record_GetPosition:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_GetPosition.html
FSOUND_Record_SetDriver:Byte(driver:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_SetDriver.html
FSOUND_Record_StartSample:Byte(sptr:Int,loop:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_StartSample.html
FSOUND_Record_Stop:Byte()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_Stop.html
FSOUND_Reverb_SetProperties:Byte(props:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Reverb_SetProperties.html
FSOUND_Reverb_GetProperties:Byte(props:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Reverb_GetProperties.html
FSOUND_Reverb_SetChannelProperties:Byte(channel:Int,prop:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Reverb_SetChannelProperties.html
FSOUND_Reverb_GetChannelProperties:Byte(channel:Int,prop:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Reverb_GetChannelProperties.html
od/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_GetDriver.html
FSOUND_Record_GetDriverName:Int(id:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_GetDriverName.html
FSOUND_Record_GetNumDrivers:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_GetNumDrivers.html
FSOUND_Record_GetPosition:Int()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_GetPosition.html
FSOUND_Record_SetDriver:Byte(driver:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_SetDriver.html
FSOUND_Record_StartSample:Byte(sptr:Int,loop:Byte)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_StartSample.html
FSOUND_Record_Stop:Byte()|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Record_Stop.html
FSOUND_Reverb_SetProperties:Byte(props:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Reverb_SetProperties.html
FSOUND_Reverb_GetProperties:Byte(props:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Reverb_GetProperties.html
FSOUND_Reverb_SetChannelProperties:Byte(channel:Int,prop:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Reverb_SetChannelProperties.html
FSOUND_Reverb_GetChannelProperties:Byte(channel:Int,prop:Int)|/Mod/pub.mod/fmod.mod/doc/HTML/FSOUND_Reverb_GetChannelProperties.html

do you have to have the fmod lib for the code to work?

http://www.sherrox.com/fmod_3_75_module.zip

is down.

has anybody the File?

[EDIT]
it is online again.

Is not down....just a little powerfailure. :D

Sveinung

Got this when I tried to build:
Building modDemo
Linking:modDemo.exe
C:/Program Files/BlitzMax/bin/ld.exe: cannot find -lfmod
Build Error: Failed to link C:/Program Files/BlitzMax/fmod_3_75_module/Samples/modDemo.exe
Process complete


I know I need to put the lib/dll somewhere, just, where?

nevermind, figured it out! Stupid me, all I had to do was put it in the lib directory :P

I've just created the beginning of what I believe to be a useful module. Basically, it provides a much easier to use interface for FMod that is ideal for developing video games. You get the amazing sound quality of FMod, and pretty damn close to the simplicity of use that you get with BlitzMax native sound. I mean really, check it out. I'm kinda proud. :D

Rem
bbdoc: Game Development Sound and Music Module
about:
This module creates an easy to use, feature rich interface for
FMod Sound Library.  Unlike the pure FMod function set, which is designed
for many purposes, this creates an environment much more specifically
focused on video game development by creating functions which utilize the
lower-level pure sound functions in commonly used combinations.<br>
<br>
Incedentally, the supported formats at the moment are *.MOD, *.S3M, *.XM,
*.IT, *.MID, *.OGG, *.WAV, *.RAW, *.MP2, *.MP3, *.EAX1, *.EAX2.<br>
<br>
*.MOD, *.S3M, *.XM, *.IT,and *.MID are all audio sequence files, and they must
be loaded as music. All others must be loaded as audio samples.<br>
<br>
Obtain fmod license at <a href="http://www.fmod.org/">FMod Home Page</a>
Do not distribute end product commercially without first purchasing a license<br>
<br>
The extern's and import's blitzmax source code is from FMod community project
at <a href="http://www.blitzbasic.com/community/">The Blitz Max Community Forum</a>.
Thanks to the blitzmax community for making this possible.
End Rem
Module Pub.FModGameEx
ModuleInfo "Author: Bill Whitacre (ninjarat)"
ModuleInfo "Important: Uses FMod Sound Library, for which a license must be purcased before it can be used commercially."
ModuleInfo "Obtain License At: http://www.fmod.org/"
ModuleInfo "Description: Extends and utilizes FMod to create a powerful sound output module for video games."

Import BRL.Blitz
Import BRL.LinkedList
Import BRL.Bank

'THIS IS THE FMOD LIB STUFF FROM THE MAX FMOD PROJECT

?MacOS
Private
Extern "MacOS"
	Const FSOUND_OUTPUT_MAC  =10' Mac SoundManager driver
End Extern
?Win32
Import "-lfmod"
Private
Extern "Win32"

	Const FSOUND_MIXER_QUALITY_FPU =5' Win32/Linux only - Interpolating/volume ramping FPU mixer. ' 
	Const FSOUND_MIXER_QUALITY_MMXP5 =6  ' Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. ' 
	Const FSOUND_MIXER_QUALITY_MMXP6 =7 ' Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. '

	Const FSOUND_INIT_USEDEFAULTMIDISYNTH=$0001 ' Win32 only - Causes MIDI playback to force software decoding. '  
	Const FSOUND_INIT_GLOBALFOCUS =$0002 ' Win32 only - For DirectSound output - sound is not muted when window is out of focus. '  
	Const FSOUND_INIT_ENABLESYSTEMCHANNELFX =$0004 ' Win32 only - For DirectSound output - Allows FSOUND_FX api to be used on global software mixer output! (use FSOUND_SYSTEMCHANNEL as channel id) '  
	Const FSOUND_INIT_DSOUND_DEFERRED =$0800 ' Win32 only - For DirectSound output. 3D commands are batched together and executed at FSOUND_Update. '  
	Const FSOUND_INIT_DSOUND_HRTF_LIGHT =$1000 ' Win32 only - For DirectSound output. FSOUND_HW3D buffers use a slightly higher quality algorithm when 3d hardware acceleration is not present. '  
	Const FSOUND_INIT_DSOUND_HRTF_FULL =$2000 ' Win32 only - For DirectSound output. FSOUND_HW3D buffers use full quality 3d playback when 3d hardware acceleration is not present. '  
	Const FSOUND_OUTPUT_WINMM =1' Windows Multimedia driver. ' 
	Const FSOUND_OUTPUT_DSOUND =2 ' DirectSound driver. You need this to get EAX2 or EAX3 support, or FX api support. ' 
	Const FSOUND_OUTPUT_A3D =3'  A3D driver. '
	
	Function FSOUND_SetBufferSize(len_ms:Int)
	Function FSOUND_SetHWND(hwnd:Int Ptr)
End Extern

?Linux
Import "-lfmod-3.74.1"
Private
Extern "Linux"
	
	Const FSOUND_MIXER_QUALITY_FPU =5' Win32/Linux only - Interpolating/volume ramping FPU mixer. ' 
	Const FSOUND_MIXER_QUALITY_MMXP5 =6 ' Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. ' 
	Const FSOUND_MIXER_QUALITY_MMXP6 =7  ' Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. '
	Const FSOUND_OUTPUT_OSS =3' Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. ' 
	Const FSOUND_OUTPUT_ESD =4' Linux/Unix ESD (Enlightment Sound Daemon) driver. ' 
	Const FSOUND_OUTPUT_ALSA=5 ' Linux Alsa driver. ' 

	Function FSOUND_SetBufferSize(len_ms:Int)
End Extern
?

Extern "Os"
	'errors
	Const FMOD_ERR_NONE:String = "No errors"
	Const FMOD_ERR_BUSY:String = "Cannot call this command after FSOUND_Init. Call FSOUND_Close first."
	Const FMOD_ERR_UNINITIALIZED:String = "This command failed because FSOUND_Init Or FSOUND_SetOutput was Not called"
	Const FMOD_ERR_INIT:String = "Error initializing output device."
	Const FMOD_ERR_ALLOCATED:String = "Error initializing output device, but more specifically, the output device is already in use And cannot be reused."
	Const FMOD_ERR_PLAY:String = "Playing the sound failed."
	Const FMOD_ERR_OUTPUT_FORMAT:String = "Soundcard does Not support the features needed For this soundsystem (16bit stereo output)"
	Const FMOD_ERR_COOPERATIVELEVEL:String = "Error setting cooperative level For hardware."
	Const FMOD_ERR_CREATEBUFFER:String = "Error creating hardware sound buffer."
	Const FMOD_ERR_FILE_NOTFOUND:String = "File Not found"
	Const FMOD_ERR_FILE_FORMAT:String = "Unknown file format"
	Const FMOD_ERR_FILE_BAD:String = "Error loading file"
	Const FMOD_ERR_MEMORY:String = "Not enough memory Or resources"
	Const FMOD_ERR_VERSION:String = "The version number of this file format is Not supported"
	Const FMOD_ERR_INVALID_PARAM:String = "An invalid parameter was passed To this Function"
	Const FMOD_ERR_NO_EAX:String = "Tried To use an EAX command on a non EAX enabled channel Or output."
	Const FMOD_ERR_CHANNEL_ALLOC:String = "Failed To allocate a New channel"
	Const FMOD_ERR_RECORD:String = "Recording is Not supported on this machine"
	Const FMOD_ERR_MEDIAPLAYER:String = "Windows Media Player Not installed so cannot play wma Or use internet streaming."
	Const FMOD_ERR_CDDEVICE:String = "An error occured trying To open the specified CD device" 
		
	' const
	Const FSOUND_INIT_ACCURATEVULEVELS =$0008 ' This latency adjusts FSOUND_GetCurrentLevels, but incurs a small cpu and memory hit '  
	Const FSOUND_INIT_DONTLATENCYADJUST =$0080 ' Callbacks are not latency adjusted, and are called at mix time. Also information functions are immediate '  
	Const FSOUND_INIT_STREAM_FROM_MAIN_THREAD =$0200 ' Turns off fmod streamer thread, and makes streaming update from FSOUN

	'mixer types
	Const FSOUND_MIXER_BLENDMODE =1  ' Removed / obsolete. ' 
	Const FSOUND_MIXER_MMXP5 =2 ' Removed / obsolete. ' 
	Const FSOUND_MIXER_MMXP6 =3 ' Removed / obsolete. ' 
	Const FSOUND_MIXER_QUALITY_AUTODETECT =4 
	Const FSOUND_MIXER_MAX   =8
	
	'output types
	Const FSOUND_OUTPUT_NOSOUND  =0 ' NoSound driver, all calls to this succeed but do nothing. ' 
	Const FSOUND_OUTPUT_ASIO =7' Low latency ASIO driver ' 
	Const FSOUND_OUTPUT_NOSOUND_NONREALTIME =11 ' This is the same as nosound, but the sound generation is driven by FSOUND_Update '
	

	'caps const
	Const FSOUND_CAPS_HARDWARE = $1
	Const FSOUND_CAPS_EAX2 = $2
	Const FSOUND_CAPS_EAX3 = $10
	
	'cd const
'	Const FSOUND_CD_PLAYCONTINUOUS = 0
'	Const FSOUND_CD_PLAYONCE = 1
'	Const FSOUND_CD_PLAYLOOPED = 2
'	Const FSOUND_CD_PLAYRANDOM = 3
	
	'dsp const
	Const FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT = $0
	Const FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT = 100
	Const FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT = 200
	Const FSOUND_DSP_DEFAULTPRIORITY_USER = 300
	Const FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT = 900
	Const FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT = 1000
	
	'modes
	Const FSOUND_LOOP_OFF =$00000001 ' For non looping samples. '  
	Const FSOUND_LOOP_NORMAL =$00000002 ' For forward looping samples. '  
	Const FSOUND_LOOP_BIDI =$00000004 ' For bidirectional looping samples. (no effect if in hardware). '  
	Const FSOUND_8BITS =$00000008 ' For 8 bit samples. '  
	Const FSOUND_16BITS =$00000010 ' For 16 bit samples. '  
	Const FSOUND_MONO =$00000020 ' For mono samples. '  
	Const FSOUND_STEREO =$00000040 ' For stereo samples. '  
	Const FSOUND_UNSIGNED =$00000080 ' For user created source data containing unsigned samples. '  
	Const FSOUND_SIGNED =$00000100 ' For user created source data containing signed data. '  
	Const FSOUND_DELTA =$00000200 ' For user created source data stored as delta values. '  
	Const FSOUND_IT214 =$00000400 ' For user created source data stored using IT214 compression. '  
	Const FSOUND_IT215 =$00000800 ' For user created source data stored using IT215 compression. '  
	Const FSOUND_HW3D =$00001000 ' Attempts to make samples use 3d hardware acceleration. (if the card supports it) '  
	Const FSOUND_2D =$00002000 ' Tells software (not hardware) based sample not to be included in 3d processing. '  
	Const FSOUND_STREAMABLE =$00004000 ' For a streamimg sound where you feed the data to it. '  
	Const FSOUND_LOADMEMORY =$00008000 ' "name" will be interpreted as a pointer to data for streaming and samples. '  
	Const FSOUND_LOADRAW =$00010000 ' Will ignore file format and treat as raw pcm. '  
	Const FSOUND_MPEGACCURATE =$00020000 ' For FSOUND_Stream_Open - for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUND_Stream_Open for inital opening time performance issues. '  
	Const FSOUND_FORCEMONO =$00040000 ' For forcing stereo streams and samples to be mono - needed if using FSOUND_HW3D and stereo data - incurs a small speed hit for streams '  
	Const FSOUND_HW2D =$00080000 ' 2D hardware sounds. allows hardware specific effects '  
	Const FSOUND_ENABLEFX =$00100000 ' Allows DX8 FX to be played back on a sound. Requires DirectX 8 - Note these sounds cannot be played more than once, be 8 bit, be less than a certain size, or have a changing frequency '  
	Const FSOUND_MPEGHALFRATE =$00200000 ' For FMODCE only - decodes mpeg streams using a lower quality decode, but faster execution '  
	Const FSOUND_IMAADPCM =$00400000 ' Contents are stored compressed as IMA ADPCM '  
	Const FSOUND_VAG =$00800000 ' For PS2 only - Contents are compressed as Sony VAG format '  
	Const FSOUND_NONBLOCKING =$01000000 ' For FSOUND_Stream_Open/FMUSIC_LoadSong - Causes stream or music to open in the background and not block the foreground app. See FSOUND_Stream_GetOpenState or FMUSIC_GetOpenState to determine when it IS ready. '  
	Const FSOUND_GCADPCM =$02000000 ' For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format '  
	Const FSOUND_MULTICHANNEL =$04000000 ' For PS2 and Gamecube only - Contents are interleaved into a multi-channel (more than stereo) format '  
	Const FSOUND_USECORE0 =$08000000 ' For PS2 only - Sample/Stream is forced to use hardware voices 00-23 '  
	Const FSOUND_USECORE1 =$10000000 ' For PS2 only - Sample/Stream is forced to use hardware voices 24-47 '  
	Const FSOUND_LOADMEMORYIOP =$20000000 ' For PS2 only - "name" will be interpreted as a pointer to data for streaming and samples. The address provided will be an IOP address '  
	Const FSOUND_IGNORETAGS =$40000000 ' Skips id3v2 etc tag checks when opening a stream, to reduce seek/read overhead when opening files (helps with CD performance) '  
	Const FSOUND_STREAM_NET =$80000000 ' Specifies an internet stream '  
	Const FSOUND_NORMAL =FSOUND_16BITS | FSOUND_SIGNED | FSOUND_MONO
	
	'misc
	Const FSOUND_FREE =-1 ' value to play on any free channel, or to allocate a sample in a free sample slot. '  
	Const FSOUND_UNMANAGED =-2 ' value to allocate a sample that is NOT managed by FSOUND or placed in a sample slot. '  
	Const FSOUND_ALL =-3 ' for a channel index , this flag will affect ALL channels available! Not supported by every function. '  
	Const FSOUND_STEREOPAN =-1 ' value for FSOUND_SetPan so that stereo sounds are not played at half volume. See FSOUND_SetPan for more on this. '  
	Const FSOUND_SYSTEMCHANNEL =-1000 ' special 'channel' ID for all channel based functions that want to alter the global FSOUND software mixing output channel '  
	Const FSOUND_SYSTEMSAMPLE =-1000 ' special 'sample' ID for all sample based functions that want to alter the global FSOUND software mixing output sample '  

	
	' functions
	'Pre Init
	Function FSOUND_Close()
	Function FSOUND_File_SetCallbacks(OpenCallback:Int,CloseCallback:Int,ReadCallback:Int,SeekCallback:Int,TellCallback:Int)
	Function FSOUND_Init:Byte(mixrate:Int,maxsoftwarechannels:Int,flags:Int)
	Function FSOUND_SetDriver:Byte(Driver:Int)
	Function FSOUND_SetMaxHardwareChannels:Byte(max_:Int)
	Function FSOUND_SetMemorySystem:Byte(poolmem:Int Ptr,poollen:Int,useralloc:Int Ptr,userrealloc:Int Ptr,userfree:Int Ptr)
	Function FSOUND_SetMinHardwareChannels:Byte(Channels:Int)
	Function FSOUND_SetMixer:Byte(mixer:Int)
	Function FSOUND_SetOutput:Byte(outputtype:Int)
	
	'Global Runtime Update Funcs
	Function FSOUND_SetPanSeperation:Byte(pansep:Int)
	Function FSOUND_SetSFXMasterVolume:Byte(Volume:Int)
	Function FSOUND_SetSpeakerMode:Byte(speakermode:Int)
	Function FSOUND_Update:Byte()
	
	'Global Run-time Info Funcs
	Function FSOUND_GetCPUUsage:Float()
	Function FSOUND_GetChannelsPlaying:Int()
	Function FSOUND_GetDriver:Int()
	Function FSOUND_GetDriverCaps:Byte(id:Int,Caps:Int Ptr)
	Function FSOUND_GetDriverName:Byte Ptr(id:Int)
	Function FSOUND_GetError:Int()
	Function FSOUND_GetMaxSamples:Int()
	Function FSOUND_GetMaxChannels:Int()
	Function FSOUND_GetMemoryStats(currentalloced:Int Ptr,maxAlloced:Int Ptr)
	Function FSOUND_GetNumDrivers:Int()
	Function FSOUND_GetNumHWChannels:Int(num2d:Int Ptr,num3d:Int Ptr,total:Int Ptr)
	Function FSOUND_GetOutput:Int()
	Function FSOUND_GetOutputHandle:Byte Ptr()
	Function FSOUND_GetOutputRate:Int()
	Function FSOUND_GetSFXMasterVolume:Int()
	Function FSOUND_GetVersion:Float()
	
	'Sample Funcs
	Function FSOUND_Sample_Alloc:Int(index:Int,length:Int,mode:Int,deffreq:Int,defvol:Int,defpan:Int,defpri:Int)
	Function FSOUND_Sample_Free(Sample:Int)
	Function FSOUND_Sample_Get:Byte Ptr(poolID:Int)
	Function FSOUND_Sample_GetDefaults:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr)
	Function FSOUND_Sample_GetDefaultsEx:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr,varfreq:Int Ptr,varvol:Int Ptr,varpan:Int Ptr)
	Function FSOUND_Sample_GetLength:Int(sptr:Int)
	Function FSOUND_Sample_GetLoopPoints:Byte(sptr:Int,loopstart:Int Ptr,loopend:Int Ptr)
	Function FSOUND_Sample_GetMinMaxDistance:Byte(sptr:Int,min_:Float Ptr,max_:Float Ptr)
	Function FSOUND_Sample_GetMode:Byte(sptr:Int)
	Function FSOUND_Sample_GetName:Byte Ptr(sptr:Int)
	Function FSOUND_Sample_Load:Int(index:Int,filename$z,inputmode:Int,offset:Int,length:Int)
	Function FSOUND_Sample_Lock:Byte(sptr:Int,offset:Int,length:Int,ptr1:Byte Ptr,ptr2:Byte Ptr,len1:Int Ptr,len2:Int Ptr)
	Function FSOUND_Sample_SetDefaults:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri)
	Function FSOUND_Sample_SetDefaultsEx:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr,varfreq:Int Ptr,varvol:Int Ptr,varpan:Int Ptr)
	Function FSOUND_Sample_SetMaxPlaybacks:Byte(sptr:Int,max_:Int)
	Function FSOUND_Sample_SetMinMaxDistance:Byte(sptr:Int,min_:Float,max_:Float)
	Function FSOUND_Sample_SetMode:Byte(sptr:Int,mode:Int)
	Function FSOUND_Sample_SetLoopPoints:Byte(sptr:Int,loopstart:Int,loopend:Int)
	Function FSOUND_Sample_Unlock:Byte(sptr:Int,ptr1:Int Ptr,ptr2:Int Ptr,len1:Int,len2:Int)
	Function FSOUND_Sample_Upload:Byte(sptr:Int,srcdata:Int Ptr,mode_in:Int)
	
	'Channel Funcs
	Function FSOUND_PlaySound:Int(channel:Int,sptr:Int)
	Function FSOUND_PlaySoundEx:Int(channel:Int,sptr:Int,dspunitLint,startpaused:Byte)
	Function FSOUND_StopSound:Byte(channel:Int)
	Function FSOUND_SetFrequency:Byte(channel:Int,Freq:Int)
	Function FSOUND_SetLevels:Byte(channel:Int,frontleft:Int,center:Int,frontright:Int,backleft:Int,backright:Int,lfe:Int)
	Function FSOUND_SetLoopMode:Byte(channel:Int,loopmode:Int)
	Function FSOUND_SetMute:Byte(channel:Int,Mute:Byte)
	Function FSOUND_SetPan:Byte(channel:Int,Pan:Int)
	Function FSOUND_SetPaused:Byte(channel:Int,Pause:Byte)
	Function FSOUND_SetPriority:Byte(channel:Int,Priority:Int)	
	Function FSOUND_SetReserved:Byte(channel:Int,Reserved:Byte)
	Function FSOUND_SetSurround:Byte(channel:Int,Surround:Byte)
	Function FSOUND_SetVolume:Byte(channel:Int,Volume :Int)	
	Function FSOUND_SetVolumeAbsolute:Byte(channel:Int,Volume :Int)		
	Function FSOUND_GetVolume:Int(channel:Int)
	Function FSOUND_GetAmplitude:Int(channel:Int)
	Function FSOUND_3D_SetAttributes:Byte(channel:Int,pos:Float Ptr,vel:Float Ptr)
	Function FSOUND_3D_SetMinMaxDistance:Byte(channel:Int,min_:Float,max_:Float)
	Function FSOUND_SetCurrentPosition:Byte(channel:Int,pos:Int)
	Function FSOUND_GetCurrentPosition:Int(channel:Int)
	Function FSOUND_GetCurrentSample:Int(channel:Int)
	Function FSOUND_GetCurrentLevels:Byte(channel:Int,l:Float Ptr,r:Float Ptr)
	Function FSOUND_GetFrequency:Int(channel:Int)
	Function FSOUND_GetLoopMode:Int(channel:Int)
	Function FSOUND_GetMixer:Int()
	Function FSOUND_GetMute:Byte(channel:Int)
	Function FSOUND_GetNumSubChannels:Int(channels:Int)
	Function FSOUND_GetPan:Int(channel:Int)
	Function FSOUND_GetPaused:Byte(channel:Int)
	Function FSOUND_GetPriority:Int(channel:Int)	
	Function FSOUND_GetReserved:Byte(channel:Int)
	Function FSOUND_GetSubChannel:Int(channels:Int,subchannels:Int)
	Function FSOUND_GetSurround:Byte(channel:Int)
	Function FSOUND_IsPlaying:Byte(channel:Int)
	Function FSOUND_3D_GetAttributes:Byte(channel:Int,pos:Float Ptr,vel:Float Ptr)
	Function FSOUND_3D_GetMinMaxDistance:Byte(channel:Int,min_:Float Ptr,max_:Float Ptr)

	'3D Sound Funcs
	Function FSOUND_3D_Listener_GetAttributes:Byte(pos:Float Ptr,vel:Float Ptr,fx:Float Ptr,fy:Float Ptr,fz:Float Ptr,tx:Float Ptr,ty:Float Ptr,tz:Float Ptr)
	Function FSOUND_3D_Listener_SetAttributes:Byte(pos:Float Ptr,vel:Float Ptr,fx:Float Ptr,fy:Float Ptr,fz:Float Ptr,tx:Float Ptr,ty:Float Ptr,tz:Float Ptr)
	Function FSOUND_3D_Listener_SetCurrent:Byte(current:Int ,numlisteners:Int)
	Function FSOUND_3D_SetDistanceFactor(Factor:Float)
	Function FSOUND_3D_SetDropplerFactor(Distance:Float)
	Function FSOUND_3D_SetRolloffFactor(Factor:Float)

	'Stream Funcs
	Function FSOUND_Stream_AddSyncPoint:Byte(stream:Int,pcmoffset:Int,name$z)
	Function FSOUND_Stream_Close:Byte(stream:Int)
	Function FSOUND_Stream_Create:Byte(callback:Byte Ptr,lenbytes:Int,mode:Int,samplerate:Int,userdate:Byte Ptr)
	Function FSOUND_Stream_CreateDSP:Byte(stream:Int,callback:Int,priority:Int,param:Int)
	Function FSOUND_Stream_DeleteSyncPoint:Byte(point:Int)
	Function FSOUND_Stream_FindTagField:Byte(stream:Int,ttype:Int,name:String,value:Int,lenght:Int)
	Function FSOUND_Stream_GetLength:Int(stream:Int)
	Function FSOUND_Stream_GetLengthMs:Int(stream:Int)
	Function FSOUND_Stream_GetMode(stream:Int)
	Function FSOUND_Stream_GetNumSubStreams:Int(stream:Int)
	Function FSOUND_Stream_GetNumSyncPoints:Int(stream:Int)
	Function FSOUND_Stream_GetNumTagFields:Byte(stream:Int,num:Int)
	Function FSOUND_Stream_GetOpenState:Int(stream:Int)
	Function FSOUND_Stream_GetPosition:Int(stream:Int)
	Function FSOUND_Stream_GetSample:Int(stream:Int)
	Function FSOUND_Stream_GetSyncPoint:Int(stream:Int,index:Int)
	Function FSOUND_Stream_GetSyncPointInfo:Int(point:Int,pcmoffset:Int)
	Function FSOUND_Stream_GetTagField:Byte(stream:Int,ttype:Int,name$z,value:Int,lenght:Int)
	Function FSOUND_Stream_GetTime:Int(stream:Int)
	Function FSOUND_Stream_Net_GetBufferProperties:Byte(buffersize:Int,prebuffer_percent:Int,rebuffer_percent:Int)
	Function FSOUND_Stream_Net_GetLastServerStatus:Int()
	Function FSOUND_Stream_Net_GetStatus:Byte(stream:Int,status:Int,bufferused:Int,bitrate:Int,flags:Int)
	Function FSOUND_Stream_Net_SetBufferProperties:Byte(buffersize:Int,prebuffer_percent:Int,rebuffer_precent:Int)
	Function FSOUND_Stream_Net_SetMetadataCallback:Byte(stream:Int,callback:Int,userdata:Int)
	Function FSOUND_Stream_Net_SetProxy:Byte(proxy$z)
	Function FSOUND_Stream_Open:Int(name_or_data$z,mode:Int,offset:Int,lenght:Int)
	Function FSOUND_Stream_Play:Int(channel:Int,stream:Int)
	Function FSOUND_Stream_PlayEx:Int(channel:Int,stream:Int,dspunit:Int,paused:Int)
	Function FSOUND_Stream_SetBufferSize:Byte(ms:Int)
	Function FSOUND_Stream_SetEndCallback:Byte(stream:Int,callback:Int,userdata:Int)
	Function FSOUND_Stream_SetLoopCount:Byte(stream:Int,count:Int)
	Function FSOUND_Stream_SetLoopPoints:Byte(stream:Int,loopstart:Int,loopend:Int)
	Function FSOUND_Stream_SetMode:Byte(stream:Int,mode:Int)
	Function FSOUND_Stream_SetPosition:Byte(stream:Int,position:Int)
	Function FSOUND_Stream_SetSubStream:Byte(stream:Int,index:Int)
	Function FSOUND_Stream_SetSubStreamSentence:Byte(stream:Int,sentencelist:Int,numitems:Int)
	Function FSOUND_Stream_SetSyncCallback:Byte(stream:Int,callback:Int,userdata:Int)
	Function FSOUND_Stream_SetTime:Byte(stream:Int,ms:Int)
	Function FSOUND_Stream_Stop:Byte(stream:Int)
	
	'CD funcs
'	Function FSOUND_CD_GetNumTracks:Int(drive:Int)
'	Function FSOUND_CD_GetPaused:Byte(drive:Int)
'	Function FSOUND_CD_GetTrack:Int(drive:Int)
'	Function FSOUND_CD_GetTrackLength:Int(drive:Int,track:Int)
'	Function FSOUND_CD_GetTrackTime:Int(drive:Int)
'	Function FSOUND_CD_GetVolume:Int(drive:Int)
'	Function FSOUND_CD_OpenTray:Byte(drive:Int,open:Int)
'	Function FSOUND_CD_Play:Byte(drive:Int,track:Int)
'	Function FSOUND_CD_SetPaused:Byte(drive:Int,paused:Byte)
'	Function FSOUND_CD_SetPlayMode(drive:Int,mode:Int)
'	Function FSOUND_CD_SetTrackTime:Byte(drive:Int,ms:Int)
'	Function FSOUND_CD_SetVolume:Byte(drive:Int,volume:Byte)
'	Function FSOUND_CD_Stop:Byte(drive:Int)
	
	'DSP funcs
	Function FSOUND_DSP_ClearMixBuffer()
	Function FSOUND_DSP_Create:Int(callback:Int,priority:Int,param:Int)
	Function FSOUND_DSP_Free(unit:Int)
	Function FSOUND_DSP_SetActive(unti:Int,active:Byte)
	Function FSOUND_DSP_GetActive:Byte(unit:Int)
	Function FSOUND_DSP_GetBufferLength:Int()
	Function FSOUND_DSP_GetBufferLengthTotal:Int()
	Function FSOUND_DSP_SetPriority(unit:Int,priority:Int)
	Function FSOUND_DSP_GetPriority:Int(unit:Int)
	Function FSOUND_DSP_GetClearUnit:Int()
	Function FSOUND_DSP_GetClipAndCopyUnit:Int()
	Function FSOUND_DSP_GetMusicUnit:Int()
	Function FSOUND_DSP_GetSFXUnit:Int()
	Function FSOUND_DSP_GetFFTUnit:Int()
	Function FSOUND_DSP_GetSpectrum:Byte Ptr()
	Function FSOUND_DSP_MixBuffers:Byte(destbuffer:Int,srcbuffer:Int,le:Int,freq:Int,vol:Int,pan:Int,mode:Int)
	
	'FX Funcs
	Function FSOUND_FX_Disable:Byte(Channel:Int)
	Function FSOUND_FX_Enable:Int(channel:Int,fxtype:Int)
	Function FSOUND_FX_SetChorus:Byte(fxid:Int,wetdrymix:Float,depth:Float,feedback:Float,frequency:Int,waveform:Int,Delay:Float,phase:Int)
	Function FSOUND_FX_SetCompressor:Byte(fxid:Int,gain:Float,attack:Float,Releas:Float,threshold:Float,ratio:Float,predelay:Float)
	Function FSOUND_FX_SetDistortion:Byte(fxid:Int,gain:Float,edge:Float,posteqcenterfrequency:Float,posteqbandwidth:Float,prelowpasscutoff:Float)
	Function FSOUND_FX_SetEcho:Byte(fxid:Int,wetdrymix:Float,feedback:Float,leftback:Float,rightdelay:Float,pandelay:Int)
	Function FSOUND_FX_SetFlanger:Byte(fxid:Int,wetdrymix:Float,depth:Float,feedback:Float,frequency:Float,waveform:Int,DDelay:Float,phase:Int)
	Function FSOUND_FX_SetGargle:Byte(fxid:Int,ratehz:Int,waveshape:Int)
	Function FSOUND_FX_SetI3DL2Reverb:Byte(fxid:Int,room:Int,roomhf:Int,roomrollofffactor:Float,decaytime:Float,decayhfratio:Float,reflection:Int,reflectiondelay:Float,reverb:Int,reverbdelay:Float,diffusion:Float,density:Float,hfreference:Float)
	Function FSOUND_FX_SetParamEQ:Byte(fxid:Int,center:Float,bandwidth:Float,gain:Float)
	Function FSOUND_FX_SetWavesReverb:Byte(fxid:Int,ingain:Float,reverbmix:Float,reverbtime:Float,highfreqrtration:Float)
	
	'Rec Funcs
	Function FSOUND_Record_GetDriver:Int()
	Function FSOUND_Record_GetDriverName:Int(id:Int)
	Function FSOUND_Record_GetNumDrivers:Int()
	Function FSOUND_Record_GetPosition:Int()
	Function FSOUND_Record_SetDriver:Byte(driver:Int)
	Function FSOUND_Record_StartSample:Byte(sptr:Int,loop:Byte)
	Function FSOUND_Record_Stop:Byte()
	
	'Reverb Funcs
	Function FSOUND_Reverb_SetProperties:Byte(props:Int)
	Function FSOUND_Reverb_GetProperties:Byte(props:Int)
	Function FSOUND_Reverb_SetChannelProperties:Byte(channel:Int,prop:Int)
	Function FSOUND_Reverb_GetChannelProperties:Byte(channel:Int,prop:Int)
	
	
	' FMUSIC
	Const FMUSIC_TYPE_NONE =0  
	Const FMUSIC_TYPE_MOD =1' Protracker / Fasttracker ' 
	Const FMUSIC_TYPE_S3M =2' ScreamTracker 3 ' 
	Const FMUSIC_TYPE_XM =3' FastTracker 2 ' 
	Const FMUSIC_TYPE_IT=4 ' Impulse Tracker. ' 
	Const FMUSIC_TYPE_MIDI=5 ' MIDI file ' 
	Const FMUSIC_TYPE_FSB =6' FMOD Sample Bank file '
	
	'music funcs
	Function FMUSIC_FreeSong:Byte(Module_:Int)
	Function FMUSIC_LoadSong:Int(Name$z)
	Function FMUSIC_LoadSongEx:Int(Name:Byte Ptr,offset:Int,length:Int,mode:Int,samplelist:Int Ptr,samplelistnum:Int)
	Function FMUSIC_OptimizeChannels:Byte(Module_:Int,Maxchannels:Int,minvolume:Int)
	Function FMUSIC_PlaySong:Byte(Mod_:Int)
	Function FMUSIC_SetInstCallback:Byte(Modul:Int,callback:Int,instrument:Int)
	Function FMUSIC_SetLooping:Byte(Mod_:Int,Looping:Byte)
	Function FMUSIC_SetMasterSpeed:Byte(Mod_:Int,Speed:Float)
	Function FMUSIC_SetMasterVolume:Byte(Mod_:Int,Volume:Int)
	Function FMUSIC_SetOrder:Byte(Mod_:Int,Order:Int)
	Function FMUSIC_SetOrderCallback:Byte(modul:Int,callback:Int,orderstep:Int)
	Function FMUSIC_SetPanSeperation:Byte(Mod_:Int,Pan:Float)
	Function FMUSIC_SetPaused:Byte(Mod_:Int,Pause:Byte)
	Function FMUSIC_SetReverb:Byte(Mod_:Int,Pause:Byte)
	Function FMUSIC_SetRowCallback:Byte(modul:Int,callback:Int,rowstep:Int)
	Function FMUSIC_SetSample:Byte(Mod_int,sampno:Int,sptr:Int)
	Function FMUSIC_SetUserData:Byte(modul:Int,userdata:Int)
	Function FMUSIC_SetZxxCallback:Byte(modul:Int,callback:Int)
	Function FMUSIC_StopAllSongs()
	Function FMUSIC_StopSong(Mod_:Int)
	
	'Info Funcs
	Function FMUSIC_GetBPM:Int(mod_:Int)
	Function FMUSIC_GetGlobalVolume:Int(mod_:Int)
	Function FMUSIC_GetMasterVolume:Int(mod_:Int)
	Function FMUSIC_GetName:Byte Ptr(modul:Int)
	Function FMUSIC_GetNumChannels:Int(mod_:Int)
	Function FMUSIC_GetNumInstruments:Int(mod_:Int)
	Function FMUSIC_GetNumOrders:Int(mod_:Int)
	Function FMUSIC_GetNumPatterns:Int(mod_:Int)
	Function FMUSIC_GetNumSamples:Int(mod_:Int)
	Function FMUSIC_GetOpenState:Int(mod_:Int)
	Function FMUSIC_GetOrder:Int(mod_:Int)
	Function FMUSIC_GetPattern:Int(mod_:Int)
	Function FMUSIC_GetPatternLength:Int(mod_:Int,OrderNo:Int)
	Function FMUSIC_GetPaused:Int(mod_:Int)
	Function FMUSIC_GetRealChannel:Int(mod_:Int,channel:Int)
	Function FMUSIC_GetRow:Int(mod_:Int)
	Function FMUSIC_GetSample:Int(mod_:Int,SampleNo:Int)
	Function FMUSIC_GetSpeed:Int(mod_:Int)
	Function FMUSIC_GetTime:Int(mod_:Int)
	Function FMUSIC_GetType:Int(mod_:Int)
	Function FMUSIC_GetUserData:Int(mod_:Int)
	Function FMUSIC_IsFinished:Byte(mod_:Int)
	Function FMUSIC_IsPlaying:Byte(mod_:Int)	
End Extern

Function FMOD_GetError:String()
	Select FSOUND_GetError()
		Case 0  Return FMOD_ERR_NONE
		Case 1  Return FMOD_ERR_BUSY
		Case 2  Return FMOD_ERR_UNINITIALIZED
		Case 3  Return FMOD_ERR_INIT
		Case 4  Return FMOD_ERR_ALLOCATED
		Case 5  Return FMOD_ERR_PLAY
		Case 6  Return FMOD_ERR_OUTPUT_FORMAT
		Case 7  Return FMOD_ERR_COOPERATIVELEVEL
		Case 8  Return FMOD_ERR_CREATEBUFFER
		Case 9  Return FMOD_ERR_FILE_NOTFOUND
		Case 10 Return FMOD_ERR_FILE_FORMAT
		Case 11 Return FMOD_ERR_FILE_BAD
		Case 12 Return FMOD_ERR_MEMORY
		Case 13 Return FMOD_ERR_VERSION
		Case 14 Return FMOD_ERR_INVALID_PARAM
		Case 15 Return FMOD_ERR_NO_EAX
		Case 16 Return FMOD_ERR_CHANNEL_ALLOC
		Case 17 Return FMOD_ERR_RECORD
		Case 18 Return FMOD_ERR_MEDIAPLAYER
		Case 19 Return FMOD_ERR_CDDEVICE
		Default Return "Unknown Error"
	End Select
End Function

'THIS MARKS THE BEGINNING OF MY CODE

Global adrv:CAudioDriver=New CAudioDriver
Type CAudioDriver
	Field areweinit=False
	Field outdvc,dspfeedback=False,is3dsound=False 'device/driver info
	Field music,musicpause:Byte,musicvolume:Byte,musicrate#=1# 'music info
	Field sounds:TList
End Type

Function adrv_init(freq,chans,out)
	If dvc>-2 And adrv.areweinit=False Then
		fsound_close()
		
		adrv.outdvc=out
		If Not fsound_setoutput(adrv.outdvc) Then DebugLog "fsound object failed to set output dvcice!!!"
		If Not fsound_init(freq,chans,0) Then DebugLog "fsound object failed to initialize sound!!!"
		dsp_activate()
		
		fsound_setdriver 0
		adrv.areweinit=True
		
		If adrv.outdvc=FSOUND_OUTPUT_A3D Then ..
		 adrv.is3dsound=True Else adrv.is3dsound=False
		If is3dsound Then
			DebugLog "3d sound not currently supported"
			End
		End If
	End If
End Function

Function init_status()
	Return adrv.areweinit
End Function

Function dsp_activate()
	adrv.dspfeedback=True
	fsound_dsp_setactive fsound_dsp_getfftunit(),adrv.dspfeedback
End Function

Function dsp_deactivate()
	adrv.dspfeedback=False
	fsound_dsp_setactive fsound_dsp_getfftunit(),adrv.dspfeedback
End Function

Function dsp_toggle_state()
	adrv.dspfeedback=(adrv.dspfeedback=False)
	fsound_dsp_setactive fsound_dsp_getfftunit(),adrv.dspfeedback
End Function

Function dsp_get_spect:Byte Ptr()
	Return fsound_dsp_getspectrum()
End Function

Function get_out()
	Return fsound_getoutput()
End Function

Function get_out_name$()
	tout=fsound_getoutput()
	Select tout
?Win32
		Case FSOUND_OUTPUT_WINMM   Return "WinMM"
		Case FSOUND_OUTPUT_DSOUND  Return "DirectSound"
		Case FSOUND_OUTPUT_A3D     Return "A3D"
?Linux
		Case FSOUND_OUTPUT_ALSA    Return "ALSA"
		Case FSOUND_OUTPUT_ESD     Return "ESD"
		Case FSOUND_OUTPUT_OSS     Return "OSS"
?MacOS
		Case FSOUND_OUTPUT_MAC     Return "Mac Audio"
?
		Case FSOUND_OUTPUT_NOSOUND Return "No Sound"
		Default Return "???"
	End Select
End Function

'sound samples
Function load_sample(data$,loopmode=FMG_NOLOOP)
	sptr=fsound_sample_load(FSOUND_FREE,data,0,0,0)
	Select loopmode
	Case FMG_LOOPNORMAL
		sm=FSOUND_LOOP_NORMAL
	Case FMG_NOLOOP
		sm=FSOUND_LOOP_OFF
	Case FMG_LOOPBIDI
		sm=FSOUND_LOOP_BIDI
	End Select
	fsound_sample_setmode sptr,sm
	Return sptr
End Function

Function sample_loop(sptr,loopmode)
	Select loopmode
	Case FMG_LOOPNORMAL
		sm=FSOUND_LOOP_NORMAL
	Case FMG_NOLOOP
		sm=FSOUND_LOOP_OFF
	Case FMG_LOOPBIDI
		sm=FSOUND_LOOP_BIDI
	End Select
	fsound_sample_setmode sptr,sm
End Function

Function sample_play(sptr,freq=44000,pan=0)
	pan:+127
	If pan<0 Then pan=0
	If pan>255 Then pan=255
	chan=fsound_playsoundex(FSOUND_FREE,sptr,Null,True)
	fsound_setfrequency chan,freq
	fsound_setpan chan,pan
	fsound_setpaused chan,False
	Return chan
End Function

Function channel_setpause(chan,state:Byte)
	fsound_setpaused chan,state
End Function

Function setpause_all_channels(state:Byte)
	fsound_setpaused FSOUND_ALL,state
End Function

Function channel_stop(chan)
	fsound_stopsound chan
End Function

Function channel_pause_state(chan)
	Return fsound_getpaused(chan)
End Function

'music sequences
Function is_music()
	If adrv.music>0 Then Return True Else Return False
End Function

Function update()
	If adrv.is3dsound Then fsound_update
End Function

Function load_music(data$)
	fmusic_stopsong adrv.music
	adrv.music=fmusic_loadsong(data)
	
	If Not adrv.music Then DebugLog "fmusic object failed to load music file!!!"
End Function

Function play_music()
	fmusic_playsong adrv.music
	adrv.musicvolume=128
	fmusic_setmastervolume adrv.music,adrv.musicvolume
End Function

Function set_music_volume(vol:Byte)
	adrv.musicvolume=vol
	fmusic_setmastervolume adrv.music,adrv.musicvolume
End Function

Function get_music_volume()
	Return adrv.musicvolume
End Function

Function set_music_rate(rate#)
	adrv.musicrate=rate
	fmusic_setmasterspeed adrv.music,adrv.musicrate
End Function

Function get_music_rate#()
	Return adrv.musicrate
End Function

Function stop_music()
	fmusic_stopsong adrv.music
End Function

Function release_music()
	adrv.music=0
End Function

Function toggle_pause_music()
	adrv.musicpause=(adrv.musicpause=False)
	fmusic_setpaused adrv.music,adrv.musicpause
End Function

Function pause_music()
	adrv.musicpause=True
	fmusic_setpaused adrv.music,adrv.musicpause
End Function

Function unpause_music()
	adrv.musicpause=False
	fmusic_setpaused adrv.music,adrv.musicpause
End Function

Function is_paused()
	Return adrv.musicpause
End Function

Function beginsnd(freq=44000,chans=256,out=1)
	endsnd
	adrv_init freq,chans,out
	adrv.areweinit=True
End Function

Function endsnd()
	If init_status() Then
		adrv=New CAudioDriver
		dsp_deactivate
		fsound_close
	End If
End Function
Public

'THESE CONSTANTS ARE MINE
?Win32
Rem
bbdoc: DirectSound Driver
about:
Identifies the DirectSound WinCE device.  On win32 DirectSound is emulated by
WinMM, so it will be sub-par unless you have a winCE system
End Rem
Const FMG_DSOUND=FSOUND_OUTPUT_DSOUND
Rem
bbdoc: Win32 Multimedia
about:
Identifies the WinMM driver, part of win32 standard libs.
End Rem
Const FMG_WINMM=FSOUND_OUTPUT_WINMM
?Linux
Rem
bbdoc: Advanced Linux Sound API
about:
Identifies ALSA, the standard Linux audio system.
End Rem
Const FMG_ALSA=FSOUND_OUTPUT_ALSA
Rem
bbdoc: Enlightment Sound Daemon
about:
Identifies ESD, a good sound daemon for Linux
End Rem
Const FMG_ESD=FSOUND_OUTPUT_ESD
Rem
bbdoc: Open Sound System
about: 
Identifies OSS, the biggest open source sound system for Linux.
End Rem
Const FMG_OSS=FSOUND_OUTPUT_OSS
?MacOS
Rem
bbdoc: Mac Sound Out
about:
Identifies Mac Sound Out, the sound output system for MacOS.
End Rem
Const FMG_MACSOUND=FSOUND_OUTPUT_MAC
?
Rem
bbdoc: Audio 3D Device
about:
Identifies the 3D audio driver, which can vary.  Usually the native FMod
3D sound driver is used.
End Rem
Const FMG_A3D=FSOUND_OUTPUT_A3D
Rem
bbdoc: No Sound
about:
Identifies a driver that has no sound output.
End Rem
Const FMG_NOSOUND=FSOUND_OUTPUT_NOSOUND
Rem
bbdoc: Auto Select
about:
Use this in the place of an output device to have it
automatically select one for you.
End Rem
Const FMG_AUTODRIVER=-1
Rem
bbdoc: Normal Looping
about:
Sets a sound sample to normal looping mode.
End Rem
Const FMG_LOOPNORMAL=1
Rem
bbdoc: Play Once
about:
Sets a sound sample to play once mode.
End Rem
Const FMG_NOLOOP=0
Rem
bbdoc: Bidirectional Loop Flag
about:
Sets a sound sample to bidirectional looping mode.  Disregarded if sample file
is not a bidirectional format.
End Rem
Const FMG_LOOPBIDI=-1

Rem
bbdoc: Initialize
about:
Initialize the Sound Object.  If the Sound Object is already initialized, it
reinitializes.  Do with caution, because all sound data will be flushed out of
memory, and without freeing it first!  So be CAREFUL or you could create
memory leaks and maybe even crash your system.  If you reinitialixe then make
sure you release all the memory first with #FMGReleaseAll.
End Rem
Function FMGInit(freq=44000,chans=256,dvr=-1)
	beginsnd freq,chans,dvr
End Function

Rem
bbdoc: Release All
about:
Release all objects, and clean the memory; should be the last thing you do
with the sound object.
End Rem
Function FMGReleaseAll()
	endsnd
	GCCollect
End Function

Rem
bbdoc: Get Audio Spectrum
about:
Get the audio spectrum.  Returns a float array with 286 cells; each cell represents
one frequency.  Spectrum is ordered from longest to shortest.
End Rem
Function FMGAudioSpectrum#[]()
	Local spect#[286]
	If is_music() Then
		Local bnk:TBank=CreateStaticBank(dsp_get_spect(),512*4)
		For j=0 To 285
			spect[j]=PeekFloat(bnk,j*4)
		Next
	EndIf
	Return spect
End Function

Rem
bbdoc: Get Debug Values
about:
Excellent if you're getting unhandled memory exception errors, this will
expose any memory leaks, cpu overload, etc.
End Rem
Function FMGDebugDump(curchans Var,maxchans Var,outdvr$ Var,outdvrnum Var,cpu# Var)
	curchans=fsound_getchannelsplaying()
	maxchans=fsound_getmaxchannels()
	outdvr=get_out_name()
	outdvrnum=get_out()
	cpu=fsound_getcpuusage()
End Function

Rem
bbdoc: Load Audio Sample
about:
Load an audio sample in to memory.  Returns sample ID.
End Rem
Function FMGLoadSample(data$,loopmode)
	sampleid=load_sample(data,loopmode)
	Return sampleid
End Function

Rem
bbdoc: Play Audio Sample
about:
Play loaded sample: sampleid .  Returns audio channel.
End Rem
Function FMGPlaySample(sampleid,freq=44000,pan=0)
	channelid=sample_play(sampleid,freq,pan)
	Return channelid
End Function

Rem
bbdoc: Pause Channel
about:
Pauses audio channel: channelid .  If channel is already paused, there is no effect.
End Rem
Function FMGPauseChannel(channelid)
	channel_setpause chan,True
End Function

Rem
bbdoc: UnPause Channel
about:
Resumes audio channel: channelid .  If channel is already playing,
there is no effect.
End Rem
Function FMGUnPauseChannel(channelid)
	channel_setpause chan,False
End Function

Rem
bbdoc: Toggle Pause Channel
about:
Toggles the audio channel "channelid"'s pause state.
End Rem
Function FMGTogglePauseChannel(channelid)
	channel_setpause chan,(fsound_getpaused(channelid)=False)
End Function

Rem
bbdoc: Pause All Channels
about:
Pauses all audio channels.  If channel is already paused, there is no effect.
End Rem
Function FMGPauseAllChannels(channelid)
	setpause_all_channels True
End Function

Rem
bbdoc: UnPause All Channels
about:
Resumes all audio channels.  If channel is already playing,
there is no effect.
End Rem
Function FMGUnPauseAllChannels(channelid)
	setpause_all_channels False
End Function

Rem
bbdoc: Get Channel Pause State
about:
Returns current pause state of a channel.
End Rem
Function FMGChannelPauseState(channelid)
	Return channel_pause_state(channelid)
End Function

Rem
bbdoc: Set Master Volume
about:
Set the master volume level.  All sound channels volume is relative to this.
End Rem
Function FMGSetMasterVolume(vol)
	If vol>255 Then vol=255
	If vol<0 Then vol=0
	fsound_setsfxmastervolume vol
End Function

Rem
bbdoc: Set Channel Volume
about:
Set the volume for one channel.  Volume is relative to the Master Volume.
End Rem
Function FMGSetChannelVolume(channelid,vol)
	If vol>255 Then vol=255
	If vol<0 Then vol=0
	fsound_setvolume channelid,vol
End Function

Rem
bbdoc: Set Channel Volume Absolute
about:
Set the volume for one channel.  This command overrides the master volume.
End Rem
Function FMGSetChannelVolumeAbsolute(channelid,vol)
	If vol>255 Then vol=255
	If vol<0 Then vol=0
	fsound_setvolumeabsolute channelid,vol
End Function

Rem
bbdoc: Get Master Volume
about:
Get the master volume level.  All sound channels volume is relative to this.
End Rem
Function FMGGetMasterVolume()
	Return fsound_getsfxmastervolume()
End Function

Rem
bbdoc: Get Channel Volume
about:
Get the volume for one channel, relative to the master volume.
End Rem
Function FMGGetChannelVolume(channelid)
	Return fsound_getvolume(channelid)
End Function

Rem
bbdoc: Get Channel Amplitude
about:
Get the amplitude for one channel.  The amplitude is the result volume after all
additional modifications, including the master volume, have been factored in.
End Rem
Function FMGGetChannelAmplitude(channelid)
	Return fsound_getamplitude(channelid)
End Function

Rem
bbdoc: Stop Audio Channel
about:
Stop audio channel: channelid .
End Rem
Function FMGStopChannel(channelid)
	channel_stop channelid
End Function

Rem
bbdoc: Load Music File
about:
Loads a music sequence file, supported formats are *.MOD, *.S3M, *.XM, *.IT, *.MID
End Rem
Function FMGLoadMusic(data$)
	load_music data$
End Function

Rem
bbdoc: Start Music Playback
about:
Play the currently loaded music file.
End Rem
Function FMGPlayMusic()
	play_music
End Function

Rem
bbdoc: Pause Music
about:
Pause the music playback.
End Rem
Function FMGPauseMusic()
	pause_music
End Function

Rem
bbdoc: UnPause Music
about:
Unpause the music playback.
End Rem
Function FMGUnPauseMusic()
	unpause_music
End Function

Rem
bbdoc: Toggle Music Pause State
about:
Toggle the pause state of the music playback.
End Rem
Function FMGTogglePauseMusic()
	toggle_pause_music
End Function

Rem
bbdoc: Get Pause State
about:
Get the pause state of the music.  True is paused and False is playing.
End Rem
Function FMGMusicPauseState()
	Return is_paused()
End Function

Rem
bbdoc: Set Music Volume
about:
Set the music volume.  The argument is an integer, but that's just to make
the clipping work properly.  The end product is actually a byte, so it has
to be a value between 0 and 255.  Out-of-bounds values will be clipped to
range.
End Rem
Function FMGSetMusicVolume(vol)
	If vol>255 Then vol=255
	If vol<0 Then vol=0
	set_music_volume vol
End Function

Rem
bbdoc: Get Music Volume
about:
Get the current music volume.  Will return a Byte with volume being all the way from
0 to 255.
End Rem
Function FMGGetMusicVolume:Byte()
	Return get_music_volume()
End Function

Rem
bbdoc: Adjust Music Volume
about:
Adjust the current music volume by the given argument.  If the volume goes out of
bounds, it is clipped to range, (0 to 255,) so don't worry about that.
End Rem
Function FMGAdjustMusicVolume(inc)
	newvol=get_music_volume()+inc
	If newvol>255 Then newvol=255
	If newvol<0 Then newvol=0
	set_music_volume newvol
End Function

Rem
bbdoc: Set Music Playback Rate
about:
Set the music playback rate.  If the volume goes out of
bounds, it is clipped to range, 0-stop 1-normal 10-max.
End Rem
Function FMGSetMusicRate(rate#)
	If rate>10 Then rate=10
	If rate<0 Then rate=0
	set_music_rate rate
End Function

Rem
bbdoc: Get Music Playback Rate
about:
Get the current music playback rate.  If the volume goes out of
bounds, it is clipped to range, 0-stop 1-normal 10-max.
End Rem
Function FMGGetMusicRate#()
	Return get_music_rate()
End Function

Rem
bbdoc: Adjust Music Playback Rate
about:
Adjust the music playback rate by the given argument.  If the volume goes out of
bounds, it is clipped to range, 0-stop 1-normal 10-max.
End Rem
Function FMGAdjustMusicRate(rate#)
	newrate#=rate+adrv.musicrate
	If newrate>10 Then newrate=10
	If newrate<0 Then newrate=0
	set_music_rate newrate
End Function

Rem
bbdoc: Stop Music Playback
about:
Stop music playback and revert to start.
End Rem
Function FMGStopMusic()
	stop_music
End Function

Rem
bbdoc: Release Music File
about:
Release the music handle, and the clean the memory.
End Rem
Function FMGReleaseMusic()
	release_music
	GCCollect
End Function


Music Example:
?Win32
Framework BRL.Win32MaxGUI
?Linux
Framework BRL.FLTKMaxGUI
?MacOS
Framework BRL.CocoaMaxGUI
?
Import BRL.Timer
Import BRL.D3D7Max2D
Import Pub.FModGameEx

OnEnd ReleaseAll

AppTitle="FMod Game Extension Test"
Global w:TGadget=CreateWindow(AppTitle,..
 Desktop().ClientWidth()/2-225,Desktop().ClientHeight()/2-150,560,400,..
  Null,WINDOW_TITLEBAR)
Global c:TGadget=CreateCanvas(0,0,w.clientwidth(),w.ClientHeight(),w,0)
SetGadgetLayout c,1,1,1,1

Global menu:TGadget=CreateMenu("&Menu",0,WindowMenu(w))
CreateMenu "&About",1,menu,KEY_A,MODIFIER_COMMAND
CreateMenu "E&xit",2,menu,KEY_X,MODIFIER_CONTROL

panel:TGadget=CreatePanel(0,0,w.clientwidth(),w.ClientHeight(),w,PANEL_ACTIVE)
SetGadgetLayout panel,1,1,1,1
UpdateWindowMenu w

CreateTimer 30

Global cnt#,spect#[286]

FMGInit 44100,64,FMG_AUTODRIVER

FMGLoadMusic "anvil1.xm"
FMGPlayMusic

SetGraphics CanvasGraphics(c)
SetClsColor 0,64,0

Repeat
	ActivateGadget panel
	WaitEvent
	Select CurrentEvent.ID
		Case EVENT_WINDOWCLOSE End
	Case EVENT_TIMERTICK
		spect=FMGAudioSpectrum()
		FMGDebugDump curchans,maxchans,outdvr$,outdvrnum,cpuuse#
		RedrawGadget c
	Case EVENT_KEYREPEAT
		Select CurrentEvent.Data
			Case KEY_UP    FMGAdjustMusicVolume 1
			Case KEY_DOWN  FMGAdjustMusicVolume -1
			Case KEY_RIGHT FMGAdjustMusicRate .01
			Case KEY_LEFT  FMGAdjustMusicRate -.01
		End Select
		Continue
	Case EVENT_KEYDOWN
		Select CurrentEvent.Data
			Case KEY_UP    FMGAdjustMusicVolume 1
			Case KEY_DOWN  FMGAdjustMusicVolume -1
			Case KEY_RIGHT FMGAdjustMusicRate .01
			Case KEY_LEFT  FMGAdjustMusicRate -.01
			Case KEY_P     FMGTogglePauseMusic
			Case KEY_ESCAPE
		End Select
	Case EVENT_MENUACTION
		Select CurrentEvent.Data
			Case 1 Notify "This is a test of the FMod~nGame Extension Module"
			Case 2 End
		End Select
	Case EVENT_GADGETPAINT
		SetGraphics CanvasGraphics(c)
		Cls
		
		SetColor 255,255,255
		DrawText "FMod Game Extension Test",5,5
		DrawText "Press ~qP~q to toggle pause state.  Paused="+..
		 FMGMusicPauseState(),5,21
		DrawText "Press UP and DOWN to change volume.  Volume="+..
		 ((FMGGetMusicVolume()/255#)*100#)+"%",5,37
		DrawText "Press LEFT and RIGHT to change playback rate.  Rate="+..
		 FMGGetMusicRate(),5,53
		DrawText "Channel="+curchans+"/"+maxchans,5,69
		DrawText "CPUUse="+cpuuse,150,69
		DrawText "Output Driver: num="+outdvrnum+" name="+outdvr,5,85
		
		SetScale 1.5+Sin(cnt)/3,1.5-Sin(cnt)/3
		DrawText "Streaming Audio Sequencer...",5,101
		cnt:+1.25
		SetScale 1,1
		
		DrawSpectrograph()
		Flip
	EndSelect
Forever

End

Function DrawSpectroGraph()
	For x=20 To spect.length-1
		yp=spect[x]*1000
		If yp>128 Then yp=128
		SetColor (x/8*32,x/8*16,(128)+x/8*2)
		DrawLine x-15,190-yp/2,x-15,190+yp/2
	Next
End Function

Function ReleaseAll()
	FreeGadget c
	FreeGadget w
	FMGStopMusic
	FMGReleaseAll
End Function


Audio Sample Example:
?Win32
Framework BRL.Win32MaxGUI
?Linux
Framework BRL.FLTKMaxGUI
?MacOS
Framework BRL.CocoaMaxGUI
?
Import BRL.Timer
Import BRL.D3D7Max2D
Import Pub.FModGameEx

OnEnd ReleaseAll

AppTitle="FMod Game Extension Test"
Global w:TGadget=CreateWindow(AppTitle,..
 Desktop().ClientWidth()/2-225,Desktop().ClientHeight()/2-150,560,400,..
  Null,WINDOW_TITLEBAR)
Global c:TGadget=CreateCanvas(0,0,w.clientwidth(),w.ClientHeight(),w,0)
SetGadgetLayout c,1,1,1,1

Global menu:TGadget=CreateMenu("&Menu",0,WindowMenu(w))
CreateMenu "&About",1,menu,KEY_A,MODIFIER_COMMAND
CreateMenu "E&xit",2,menu,KEY_X,MODIFIER_CONTROL

panel:TGadget=CreatePanel(0,0,w.clientwidth(),w.ClientHeight(),w,PANEL_ACTIVE)
SetGadgetLayout panel,1,1,1,1
UpdateWindowMenu w

CreateTimer 60

Global cnt#

FMGInit 44000,64,FMG_AUTODRIVER

Global music=FMGLoadSample("dreams_inc.mp3",FMG_LOOPNORMAL)
Global channel=FMGPlaySample(music,44000)

SetGraphics CanvasGraphics(c)
SetClsColor 0,64,0

Repeat
	ActivateGadget panel
	WaitEvent
	Select CurrentEvent.ID
		Case EVENT_WINDOWCLOSE End
	Case EVENT_TIMERTICK
		FMGDebugDump curchans,maxchans,outdvr$,outdvrnum,cpuuse#
		RedrawGadget c
	Case EVENT_KEYREPEAT
'		Select CurrentEvent.Data
'		End Select
		Continue
	Case EVENT_KEYDOWN
		Select CurrentEvent.Data
			Case KEY_P      FMGTogglePauseChannel channel
			Case KEY_ESCAPE End
		End Select
	Case EVENT_MENUACTION
		Select CurrentEvent.Data
			Case 1 Notify "This is a test of the FMod~nGame Extension Module"
			Case 2 End
		End Select
	Case EVENT_GADGETPAINT
		SetGraphics CanvasGraphics(c)
		Cls
		
		SetColor 255,255,255
		DrawText "FMod Game Extension Test",5,5
		DrawText "Press ~qP~q to toggle pause state.  Paused="+..
		 FMGChannelPauseState(channel),5,21
		'DrawText "Press UP and DOWN to change volume.  Volume="+..
		 '((FMGGetMusicVolume()/255#)*100#)+"%",5,37
		'DrawText "Press LEFT and RIGHT to change playback rate.  Rate="+..
		 'FMGGetMusicRate(),5,53
		DrawText "Channel="+curchans+"/"+maxchans,5,69
		DrawText "CPUUse="+cpuuse,150,69
		DrawText "Output Driver: num="+outdvrnum+" name="+outdvr,5,85
		
		SetScale 1.5+Sin(cnt)/3,1.5-Sin(cnt)/3
		DrawText "Streaming Audio Sample...",5,101
		cnt:+1.25
		SetScale 1,1
		
		Flip
	EndSelect
Forever

End

Function ReleaseAll()
	FreeGadget c
	FreeGadget w
	FMGStopChannel channel
	FMGReleaseAll
End Function


I'm kinda proud. :D

You should be :D

Sveinung

Check out this bad-boy! Can now handle panning and frequency in a pinch! 8)

Module Pub.FModGameEx
ModuleInfo "Author: Bill Whitacre (ninjarat)"
ModuleInfo "Important: Powered by FMod Sound Library, for which a license must be purcased before it can be used commercially."
ModuleInfo "Description: A powerful sound output module for video games."

Import BRL.Blitz
Import BRL.LinkedList
Import BRL.Bank

'THIS IS THE FMOD LIB STUFF FROM THE MAX FMOD PROJECT

?MacOS
Private
Extern "MacOS"
	Const FSOUND_OUTPUT_MAC  =10' Mac SoundManager driver
End Extern
?Win32
Import "-lfmod"
Private
Extern "Win32"

	Const FSOUND_MIXER_QUALITY_FPU =5' Win32/Linux only - Interpolating/volume ramping FPU mixer. ' 
	Const FSOUND_MIXER_QUALITY_MMXP5 =6  ' Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. ' 
	Const FSOUND_MIXER_QUALITY_MMXP6 =7 ' Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. '

	Const FSOUND_INIT_USEDEFAULTMIDISYNTH=$0001 ' Win32 only - Causes MIDI playback to force software decoding. '  
	Const FSOUND_INIT_GLOBALFOCUS =$0002 ' Win32 only - For DirectSound output - sound is not muted when window is out of focus. '  
	Const FSOUND_INIT_ENABLESYSTEMCHANNELFX =$0004 ' Win32 only - For DirectSound output - Allows FSOUND_FX api to be used on global software mixer output! (use FSOUND_SYSTEMCHANNEL as channel id) '  
	Const FSOUND_INIT_DSOUND_DEFERRED =$0800 ' Win32 only - For DirectSound output. 3D commands are batched together and executed at FSOUND_Update. '  
	Const FSOUND_INIT_DSOUND_HRTF_LIGHT =$1000 ' Win32 only - For DirectSound output. FSOUND_HW3D buffers use a slightly higher quality algorithm when 3d hardware acceleration is not present. '  
	Const FSOUND_INIT_DSOUND_HRTF_FULL =$2000 ' Win32 only - For DirectSound output. FSOUND_HW3D buffers use full quality 3d playback when 3d hardware acceleration is not present. '  
	Const FSOUND_OUTPUT_WINMM =1' Windows Multimedia driver. ' 
	Const FSOUND_OUTPUT_DSOUND =2 ' DirectSound driver. You need this to get EAX2 or EAX3 support, or FX api support. ' 
	Const FSOUND_OUTPUT_A3D =3'  A3D driver. '
	
	Function FSOUND_SetBufferSize(len_ms:Int)
	Function FSOUND_SetHWND(hwnd:Int Ptr)
End Extern

?Linux
Import "-lfmod-3.74.1"
Private
Extern "Linux"
	
	Const FSOUND_MIXER_QUALITY_FPU =5' Win32/Linux only - Interpolating/volume ramping FPU mixer. ' 
	Const FSOUND_MIXER_QUALITY_MMXP5 =6 ' Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. ' 
	Const FSOUND_MIXER_QUALITY_MMXP6 =7  ' Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. '
	Const FSOUND_OUTPUT_OSS =3' Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. ' 
	Const FSOUND_OUTPUT_ESD =4' Linux/Unix ESD (Enlightment Sound Daemon) driver. ' 
	Const FSOUND_OUTPUT_ALSA=5 ' Linux Alsa driver. ' 

	Function FSOUND_SetBufferSize(len_ms:Int)
End Extern
?

Extern "Os"
	'errors
	Const FMOD_ERR_NONE:String = "No errors"
	Const FMOD_ERR_BUSY:String = "Cannot call this command after FSOUND_Init. Call FSOUND_Close first."
	Const FMOD_ERR_UNINITIALIZED:String = "This command failed because FSOUND_Init Or FSOUND_SetOutput was Not called"
	Const FMOD_ERR_INIT:String = "Error initializing output device."
	Const FMOD_ERR_ALLOCATED:String = "Error initializing output device, but more specifically, the output device is already in use And cannot be reused."
	Const FMOD_ERR_PLAY:String = "Playing the sound failed."
	Const FMOD_ERR_OUTPUT_FORMAT:String = "Soundcard does Not support the features needed For this soundsystem (16bit stereo output)"
	Const FMOD_ERR_COOPERATIVELEVEL:String = "Error setting cooperative level For hardware."
	Const FMOD_ERR_CREATEBUFFER:String = "Error creating hardware sound buffer."
	Const FMOD_ERR_FILE_NOTFOUND:String = "File Not found"
	Const FMOD_ERR_FILE_FORMAT:String = "Unknown file format"
	Const FMOD_ERR_FILE_BAD:String = "Error loading file"
	Const FMOD_ERR_MEMORY:String = "Not enough memory Or resources"
	Const FMOD_ERR_VERSION:String = "The version number of this file format is Not supported"
	Const FMOD_ERR_INVALID_PARAM:String = "An invalid parameter was passed To this Function"
	Const FMOD_ERR_NO_EAX:String = "Tried To use an EAX command on a non EAX enabled channel Or output."
	Const FMOD_ERR_CHANNEL_ALLOC:String = "Failed To allocate a New channel"
	Const FMOD_ERR_RECORD:String = "Recording is Not supported on this machine"
	Const FMOD_ERR_MEDIAPLAYER:String = "Windows Media Player Not installed so cannot play wma Or use internet streaming."
	Const FMOD_ERR_CDDEVICE:String = "An error occured trying To open the specified CD device" 
		
	' const
	Const FSOUND_INIT_ACCURATEVULEVELS =$0008 ' This latency adjusts FSOUND_GetCurrentLevels, but incurs a small cpu and memory hit '  
	Const FSOUND_INIT_DONTLATENCYADJUST =$0080 ' Callbacks are not latency adjusted, and are called at mix time. Also information functions are immediate '  
	Const FSOUND_INIT_STREAM_FROM_MAIN_THREAD =$0200 ' Turns off fmod streamer thread, and makes streaming update from FSOUN

	'mixer types
	Const FSOUND_MIXER_BLENDMODE =1  ' Removed / obsolete. ' 
	Const FSOUND_MIXER_MMXP5 =2 ' Removed / obsolete. ' 
	Const FSOUND_MIXER_MMXP6 =3 ' Removed / obsolete. ' 
	Const FSOUND_MIXER_QUALITY_AUTODETECT =4 
	Const FSOUND_MIXER_MAX   =8
	
	'output types
	Const FSOUND_OUTPUT_NOSOUND  =0 ' NoSound driver, all calls to this succeed but do nothing. ' 
	Const FSOUND_OUTPUT_ASIO =7' Low latency ASIO driver ' 
	Const FSOUND_OUTPUT_NOSOUND_NONREALTIME =11 ' This is the same as nosound, but the sound generation is driven by FSOUND_Update '
	

	'caps const
	Const FSOUND_CAPS_HARDWARE = $1
	Const FSOUND_CAPS_EAX2 = $2
	Const FSOUND_CAPS_EAX3 = $10
	
	'cd const
'	Const FSOUND_CD_PLAYCONTINUOUS = 0
'	Const FSOUND_CD_PLAYONCE = 1
'	Const FSOUND_CD_PLAYLOOPED = 2
'	Const FSOUND_CD_PLAYRANDOM = 3
	
	'dsp const
	Const FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT = $0
	Const FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT = 100
	Const FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT = 200
	Const FSOUND_DSP_DEFAULTPRIORITY_USER = 300
	Const FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT = 900
	Const FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT = 1000
	
	'modes
	Const FSOUND_LOOP_OFF =$00000001 ' For non looping samples. '  
	Const FSOUND_LOOP_NORMAL =$00000002 ' For forward looping samples. '  
	Const FSOUND_LOOP_BIDI =$00000004 ' For bidirectional looping samples. (no effect if in hardware). '  
	Const FSOUND_8BITS =$00000008 ' For 8 bit samples. '  
	Const FSOUND_16BITS =$00000010 ' For 16 bit samples. '  
	Const FSOUND_MONO =$00000020 ' For mono samples. '  
	Const FSOUND_STEREO =$00000040 ' For stereo samples. '  
	Const FSOUND_UNSIGNED =$00000080 ' For user created source data containing unsigned samples. '  
	Const FSOUND_SIGNED =$00000100 ' For user created source data containing signed data. '  
	Const FSOUND_DELTA =$00000200 ' For user created source data stored as delta values. '  
	Const FSOUND_IT214 =$00000400 ' For user created source data stored using IT214 compression. '  
	Const FSOUND_IT215 =$00000800 ' For user created source data stored using IT215 compression. '  
	Const FSOUND_HW3D =$00001000 ' Attempts to make samples use 3d hardware acceleration. (if the card supports it) '  
	Const FSOUND_2D =$00002000 ' Tells software (not hardware) based sample not to be included in 3d processing. '  
	Const FSOUND_STREAMABLE =$00004000 ' For a streamimg sound where you feed the data to it. '  
	Const FSOUND_LOADMEMORY =$00008000 ' "name" will be interpreted as a pointer to data for streaming and samples. '  
	Const FSOUND_LOADRAW =$00010000 ' Will ignore file format and treat as raw pcm. '  
	Const FSOUND_MPEGACCURATE =$00020000 ' For FSOUND_Stream_Open - for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUND_Stream_Open for inital opening time performance issues. '  
	Const FSOUND_FORCEMONO =$00040000 ' For forcing stereo streams and samples to be mono - needed if using FSOUND_HW3D and stereo data - incurs a small speed hit for streams '  
	Const FSOUND_HW2D =$00080000 ' 2D hardware sounds. allows hardware specific effects '  
	Const FSOUND_ENABLEFX =$00100000 ' Allows DX8 FX to be played back on a sound. Requires DirectX 8 - Note these sounds cannot be played more than once, be 8 bit, be less than a certain size, or have a changing frequency '  
	Const FSOUND_MPEGHALFRATE =$00200000 ' For FMODCE only - decodes mpeg streams using a lower quality decode, but faster execution '  
	Const FSOUND_IMAADPCM =$00400000 ' Contents are stored compressed as IMA ADPCM '  
	Const FSOUND_VAG =$00800000 ' For PS2 only - Contents are compressed as Sony VAG format '  
	Const FSOUND_NONBLOCKING =$01000000 ' For FSOUND_Stream_Open/FMUSIC_LoadSong - Causes stream or music to open in the background and not block the foreground app. See FSOUND_Stream_GetOpenState or FMUSIC_GetOpenState to determine when it IS ready. '  
	Const FSOUND_GCADPCM =$02000000 ' For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format '  
	Const FSOUND_MULTICHANNEL =$04000000 ' For PS2 and Gamecube only - Contents are interleaved into a multi-channel (more than stereo) format '  
	Const FSOUND_USECORE0 =$08000000 ' For PS2 only - Sample/Stream is forced to use hardware voices 00-23 '  
	Const FSOUND_USECORE1 =$10000000 ' For PS2 only - Sample/Stream is forced to use hardware voices 24-47 '  
	Const FSOUND_LOADMEMORYIOP =$20000000 ' For PS2 only - "name" will be interpreted as a pointer to data for streaming and samples. The address provided will be an IOP address '  
	Const FSOUND_IGNORETAGS =$40000000 ' Skips id3v2 etc tag checks when opening a stream, to reduce seek/read overhead when opening files (helps with CD performance) '  
	Const FSOUND_STREAM_NET =$80000000 ' Specifies an internet stream '  
	Const FSOUND_NORMAL =FSOUND_16BITS | FSOUND_SIGNED | FSOUND_MONO
	
	'misc
	Const FSOUND_FREE =-1 ' value to play on any free channel, or to allocate a sample in a free sample slot. '  
	Const FSOUND_UNMANAGED =-2 ' value to allocate a sample that is NOT managed by FSOUND or placed in a sample slot. '  
	Const FSOUND_ALL =-3 ' for a channel index , this flag will affect ALL channels available! Not supported by every function. '  
	Const FSOUND_STEREOPAN =-1 ' value for FSOUND_SetPan so that stereo sounds are not played at half volume. See FSOUND_SetPan for more on this. '  
	Const FSOUND_SYSTEMCHANNEL =-1000 ' special 'channel' ID for all channel based functions that want to alter the global FSOUND software mixing output channel '  
	Const FSOUND_SYSTEMSAMPLE =-1000 ' special 'sample' ID for all sample based functions that want to alter the global FSOUND software mixing output sample '  

	
	' functions
	'Pre Init
	Function FSOUND_Close()
	Function FSOUND_File_SetCallbacks(OpenCallback:Int,CloseCallback:Int,ReadCallback:Int,SeekCallback:Int,TellCallback:Int)
	Function FSOUND_Init:Byte(mixrate:Int,maxsoftwarechannels:Int,flags:Int)
	Function FSOUND_SetDriver:Byte(Driver:Int)
	Function FSOUND_SetMaxHardwareChannels:Byte(max_:Int)
	Function FSOUND_SetMemorySystem:Byte(poolmem:Int Ptr,poollen:Int,useralloc:Int Ptr,userrealloc:Int Ptr,userfree:Int Ptr)
	Function FSOUND_SetMinHardwareChannels:Byte(Channels:Int)
	Function FSOUND_SetMixer:Byte(mixer:Int)
	Function FSOUND_SetOutput:Byte(outputtype:Int)
	
	'Global Runtime Update Funcs
	Function FSOUND_SetPanSeperation:Byte(pansep:Int)
	Function FSOUND_SetSFXMasterVolume:Byte(Volume:Int)
	Function FSOUND_SetSpeakerMode:Byte(speakermode:Int)
	Function FSOUND_Update:Byte()
	
	'Global Run-time Info Funcs
	Function FSOUND_GetCPUUsage:Float()
	Function FSOUND_GetChannelsPlaying:Int()
	Function FSOUND_GetDriver:Int()
	Function FSOUND_GetDriverCaps:Byte(id:Int,Caps:Int Ptr)
	Function FSOUND_GetDriverName:Byte Ptr(id:Int)
	Function FSOUND_GetError:Int()
	Function FSOUND_GetMaxSamples:Int()
	Function FSOUND_GetMaxChannels:Int()
	Function FSOUND_GetMemoryStats(currentalloced:Int Ptr,maxAlloced:Int Ptr)
	Function FSOUND_GetNumDrivers:Int()
	Function FSOUND_GetNumHWChannels:Int(num2d:Int Ptr,num3d:Int Ptr,total:Int Ptr)
	Function FSOUND_GetOutput:Int()
	Function FSOUND_GetOutputHandle:Byte Ptr()
	Function FSOUND_GetOutputRate:Int()
	Function FSOUND_GetSFXMasterVolume:Int()
	Function FSOUND_GetVersion:Float()
	
	'Sample Funcs
	Function FSOUND_Sample_Alloc:Int(index:Int,length:Int,mode:Int,deffreq:Int,defvol:Int,defpan:Int,defpri:Int)
	Function FSOUND_Sample_Free(Sample:Int)
	Function FSOUND_Sample_Get:Byte Ptr(poolID:Int)
	Function FSOUND_Sample_GetDefaults:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr)
	Function FSOUND_Sample_GetDefaultsEx:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr,varfreq:Int Ptr,varvol:Int Ptr,varpan:Int Ptr)
	Function FSOUND_Sample_GetLength:Int(sptr:Int)
	Function FSOUND_Sample_GetLoopPoints:Byte(sptr:Int,loopstart:Int Ptr,loopend:Int Ptr)
	Function FSOUND_Sample_GetMinMaxDistance:Byte(sptr:Int,min_:Float Ptr,max_:Float Ptr)
	Function FSOUND_Sample_GetMode:Byte(sptr:Int)
	Function FSOUND_Sample_GetName:Byte Ptr(sptr:Int)
	Function FSOUND_Sample_Load:Int(index:Int,filename$z,inputmode:Int,offset:Int,length:Int)
	Function FSOUND_Sample_Lock:Byte(sptr:Int,offset:Int,length:Int,ptr1:Byte Ptr,ptr2:Byte Ptr,len1:Int Ptr,len2:Int Ptr)
	Function FSOUND_Sample_SetDefaults:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri)
	Function FSOUND_Sample_SetDefaultsEx:Byte(sptr:Int,deffreq:Int Ptr,defvol:Int Ptr,defpan:Int Ptr,defpri:Int Ptr,varfreq:Int Ptr,varvol:Int Ptr,varpan:Int Ptr)
	Function FSOUND_Sample_SetMaxPlaybacks:Byte(sptr:Int,max_:Int)
	Function FSOUND_Sample_SetMinMaxDistance:Byte(sptr:Int,min_:Float,max_:Float)
	Function FSOUND_Sample_SetMode:Byte(sptr:Int,mode:Int)
	Function FSOUND_Sample_SetLoopPoints:Byte(sptr:Int,loopstart:Int,loopend:Int)
	Function FSOUND_Sample_Unlock:Byte(sptr:Int,ptr1:Int Ptr,ptr2:Int Ptr,len1:Int,len2:Int)
	Function FSOUND_Sample_Upload:Byte(sptr:Int,srcdata:Int Ptr,mode_in:Int)
	
	'Channel Funcs
	Function FSOUND_PlaySound:Int(channel:Int,sptr:Int)
	Function FSOUND_PlaySoundEx:Int(channel:Int,sptr:Int,dspunitLint,startpaused:Byte)
	Function FSOUND_StopSound:Byte(channel:Int)
	Function FSOUND_SetFrequency:Byte(channel:Int,Freq:Int)
	Function FSOUND_SetLevels:Byte(channel:Int,frontleft:Int,center:Int,frontright:Int,backleft:Int,backright:Int,lfe:Int)
	Function FSOUND_SetLoopMode:Byte(channel:Int,loopmode:Int)
	Function FSOUND_SetMute:Byte(channel:Int,Mute:Byte)
	Function FSOUND_SetPan:Byte(channel:Int,Pan:Int)
	Function FSOUND_SetPaused:Byte(channel:Int,Pause:Byte)
	Function FSOUND_SetPriority:Byte(channel:Int,Priority:Int)	
	Function FSOUND_SetReserved:Byte(channel:Int,Reserved:Byte)
	Function FSOUND_SetSurround:Byte(channel:Int,Surround:Byte)
	Function FSOUND_SetVolume:Byte(channel:Int,Volume :Int)	
	Function FSOUND_SetVolumeAbsolute:Byte(channel:Int,Volume :Int)		
	Function FSOUND_GetVolume:Int(channel:Int)
	Function FSOUND_GetAmplitude:Int(channel:Int)
	Function FSOUND_3D_SetAttributes:Byte(channel:Int,pos:Float Ptr,vel:Float Ptr)
	Function FSOUND_3D_SetMinMaxDistance:Byte(channel:Int,min_:Float,max_:Float)
	Function FSOUND_SetCurrentPosition:Byte(channel:Int,pos:Int)
	Function FSOUND_GetCurrentPosition:Int(channel:Int)
	Function FSOUND_GetCurrentSample:Int(channel:Int)
	Function FSOUND_GetCurrentLevels:Byte(channel:Int,l:Float Ptr,r:Float Ptr)
	Function FSOUND_GetFrequency:Int(channel:Int)
	Function FSOUND_GetLoopMode:Int(channel:Int)
	Function FSOUND_GetMixer:Int()
	Function FSOUND_GetMute:Byte(channel:Int)
	Function FSOUND_GetNumSubChannels:Int(channels:Int)
	Function FSOUND_GetPan:Int(channel:Int)
	Function FSOUND_GetPaused:Byte(channel:Int)
	Function FSOUND_GetPriority:Int(channel:Int)	
	Function FSOUND_GetReserved:Byte(channel:Int)
	Function FSOUND_GetSubChannel:Int(channels:Int,subchannels:Int)
	Function FSOUND_GetSurround:Byte(channel:Int)
	Function FSOUND_IsPlaying:Byte(channel:Int)
	Function FSOUND_3D_GetAttributes:Byte(channel:Int,pos:Float Ptr,vel:Float Ptr)
	Function FSOUND_3D_GetMinMaxDistance:Byte(channel:Int,min_:Float Ptr,max_:Float Ptr)

	'3D Sound Funcs
	Function FSOUND_3D_Listener_GetAttributes:Byte(pos:Float Ptr,vel:Float Ptr,fx:Float Ptr,fy:Float Ptr,fz:Float Ptr,tx:Float Ptr,ty:Float Ptr,tz:Float Ptr)
	Function FSOUND_3D_Listener_SetAttributes:Byte(pos:Float Ptr,vel:Float Ptr,fx:Float Ptr,fy:Float Ptr,fz:Float Ptr,tx:Float Ptr,ty:Float Ptr,tz:Float Ptr)
	Function FSOUND_3D_Listener_SetCurrent:Byte(current:Int ,numlisteners:Int)
	Function FSOUND_3D_SetDistanceFactor(Factor:Float)
	Function FSOUND_3D_SetDropplerFactor(Distance:Float)
	Function FSOUND_3D_SetRolloffFactor(Factor:Float)

	'Stream Funcs
	Function FSOUND_Stream_AddSyncPoint:Byte(stream:Int,pcmoffset:Int,name$z)
	Function FSOUND_Stream_Close:Byte(stream:Int)
	Function FSOUND_Stream_Create:Byte(callback:Byte Ptr,lenbytes:Int,mode:Int,samplerate:Int,userdate:Byte Ptr)
	Function FSOUND_Stream_CreateDSP:Byte(stream:Int,callback:Int,priority:Int,param:Int)
	Function FSOUND_Stream_DeleteSyncPoint:Byte(point:Int)
	Function FSOUND_Stream_FindTagField:Byte(stream:Int,ttype:Int,name:String,value:Int,lenght:Int)
	Function FSOUND_Stream_GetLength:Int(stream:Int)
	Function FSOUND_Stream_GetLengthMs:Int(stream:Int)
	Function FSOUND_Stream_GetMode(stream:Int)
	Function FSOUND_Stream_GetNumSubStreams:Int(stream:Int)
	Function FSOUND_Stream_GetNumSyncPoints:Int(stream:Int)
	Function FSOUND_Stream_GetNumTagFields:Byte(stream:Int,num:Int)
	Function FSOUND_Stream_GetOpenState:Int(stream:Int)
	Function FSOUND_Stream_GetPosition:Int(stream:Int)
	Function FSOUND_Stream_GetSample:Int(stream:Int)
	Function FSOUND_Stream_GetSyncPoint:Int(stream:Int,index:Int)
	Function FSOUND_Stream_GetSyncPointInfo:Int(point:Int,pcmoffset:Int)
	Function FSOUND_Stream_GetTagField:Byte(stream:Int,ttype:Int,name$z,value:Int,lenght:Int)
	Function FSOUND_Stream_GetTime:Int(stream:Int)
	Function FSOUND_Stream_Net_GetBufferProperties:Byte(buffersize:Int,prebuffer_percent:Int,rebuffer_percent:Int)
	Function FSOUND_Stream_Net_GetLastServerStatus:Int()
	Function FSOUND_Stream_Net_GetStatus:Byte(stream:Int,status:Int,bufferused:Int,bitrate:Int,flags:Int)
	Function FSOUND_Stream_Net_SetBufferProperties:Byte(buffersize:Int,prebuffer_percent:Int,rebuffer_precent:Int)
	Function FSOUND_Stream_Net_SetMetadataCallback:Byte(stream:Int,callback:Int,userdata:Int)
	Function FSOUND_Stream_Net_SetProxy:Byte(proxy$z)
	Function FSOUND_Stream_Open:Int(name_or_data$z,mode:Int,offset:Int,lenght:Int)
	Function FSOUND_Stream_Play:Int(channel:Int,stream:Int)
	Function FSOUND_Stream_PlayEx:Int(channel:Int,stream:Int,dspunit:Int,paused:Int)
	Function FSOUND_Stream_SetBufferSize:Byte(ms:Int)
	Function FSOUND_Stream_SetEndCallback:Byte(stream:Int,callback:Int,userdata:Int)
	Function FSOUND_Stream_SetLoopCount:Byte(stream:Int,count:Int)
	Function FSOUND_Stream_SetLoopPoints:Byte(stream:Int,loopstart:Int,loopend:Int)
	Function FSOUND_Stream_SetMode:Byte(stream:Int,mode:Int)
	Function FSOUND_Stream_SetPosition:Byte(stream:Int,position:Int)
	Function FSOUND_Stream_SetSubStream:Byte(stream:Int,index:Int)
	Function FSOUND_Stream_SetSubStreamSentence:Byte(stream:Int,sentencelist:Int,numitems:Int)
	Function FSOUND_Stream_SetSyncCallback:Byte(stream:Int,callback:Int,userdata:Int)
	Function FSOUND_Stream_SetTime:Byte(stream:Int,ms:Int)
	Function FSOUND_Stream_Stop:Byte(stream:Int)
	
	'CD funcs
'	Function FSOUND_CD_GetNumTracks:Int(drive:Int)
'	Function FSOUND_CD_GetPaused:Byte(drive:Int)
'	Function FSOUND_CD_GetTrack:Int(drive:Int)
'	Function FSOUND_CD_GetTrackLength:Int(drive:Int,track:Int)
'	Function FSOUND_CD_GetTrackTime:Int(drive:Int)
'	Function FSOUND_CD_GetVolume:Int(drive:Int)
'	Function FSOUND_CD_OpenTray:Byte(drive:Int,open:Int)
'	Function FSOUND_CD_Play:Byte(drive:Int,track:Int)
'	Function FSOUND_CD_SetPaused:Byte(drive:Int,paused:Byte)
'	Function FSOUND_CD_SetPlayMode(drive:Int,mode:Int)
'	Function FSOUND_CD_SetTrackTime:Byte(drive:Int,ms:Int)
'	Function FSOUND_CD_SetVolume:Byte(drive:Int,volume:Byte)
'	Function FSOUND_CD_Stop:Byte(drive:Int)
	
	'DSP funcs
	Function FSOUND_DSP_ClearMixBuffer()
	Function FSOUND_DSP_Create:Int(callback:Int,priority:Int,param:Int)
	Function FSOUND_DSP_Free(unit:Int)
	Function FSOUND_DSP_SetActive(unti:Int,active:Byte)
	Function FSOUND_DSP_GetActive:Byte(unit:Int)
	Function FSOUND_DSP_GetBufferLength:Int()
	Function FSOUND_DSP_GetBufferLengthTotal:Int()
	Function FSOUND_DSP_SetPriority(unit:Int,priority:Int)
	Function FSOUND_DSP_GetPriority:Int(unit:Int)
	Function FSOUND_DSP_GetClearUnit:Int()
	Function FSOUND_DSP_GetClipAndCopyUnit:Int()
	Function FSOUND_DSP_GetMusicUnit:Int()
	Function FSOUND_DSP_GetSFXUnit:Int()
	Function FSOUND_DSP_GetFFTUnit:Int()
	Function FSOUND_DSP_GetSpectrum:Byte Ptr()
	Function FSOUND_DSP_MixBuffers:Byte(destbuffer:Int,srcbuffer:Int,le:Int,freq:Int,vol:Int,pan:Int,mode:Int)
	
	'FX Funcs
	Function FSOUND_FX_Disable:Byte(Channel:Int)
	Function FSOUND_FX_Enable:Int(channel:Int,fxtype:Int)
	Function FSOUND_FX_SetChorus:Byte(fxid:Int,wetdrymix:Float,depth:Float,feedback:Float,frequency:Int,waveform:Int,Delay:Float,phase:Int)
	Function FSOUND_FX_SetCompressor:Byte(fxid:Int,gain:Float,attack:Float,Releas:Float,threshold:Float,ratio:Float,predelay:Float)
	Function FSOUND_FX_SetDistortion:Byte(fxid:Int,gain:Float,edge:Float,posteqcenterfrequency:Float,posteqbandwidth:Float,prelowpasscutoff:Float)
	Function FSOUND_FX_SetEcho:Byte(fxid:Int,wetdrymix:Float,feedback:Float,leftback:Float,rightdelay:Float,pandelay:Int)
	Function FSOUND_FX_SetFlanger:Byte(fxid:Int,wetdrymix:Float,depth:Float,feedback:Float,frequency:Float,waveform:Int,DDelay:Float,phase:Int)
	Function FSOUND_FX_SetGargle:Byte(fxid:Int,ratehz:Int,waveshape:Int)
	Function FSOUND_FX_SetI3DL2Reverb:Byte(fxid:Int,room:Int,roomhf:Int,roomrollofffactor:Float,decaytime:Float,decayhfratio:Float,reflection:Int,reflectiondelay:Float,reverb:Int,reverbdelay:Float,diffusion:Float,density:Float,hfreference:Float)
	Function FSOUND_FX_SetParamEQ:Byte(fxid:Int,center:Float,bandwidth:Float,gain:Float)
	Function FSOUND_FX_SetWavesReverb:Byte(fxid:Int,ingain:Float,reverbmix:Float,reverbtime:Float,highfreqrtration:Float)
	
	'Rec Funcs
	Function FSOUND_Record_GetDriver:Int()
	Function FSOUND_Record_GetDriverName:Int(id:Int)
	Function FSOUND_Record_GetNumDrivers:Int()
	Function FSOUND_Record_GetPosition:Int()
	Function FSOUND_Record_SetDriver:Byte(driver:Int)
	Function FSOUND_Record_StartSample:Byte(sptr:Int,loop:Byte)
	Function FSOUND_Record_Stop:Byte()
	
	'Reverb Funcs
	Function FSOUND_Reverb_SetProperties:Byte(props:Int)
	Function FSOUND_Reverb_GetProperties:Byte(props:Int)
	Function FSOUND_Reverb_SetChannelProperties:Byte(channel:Int,prop:Int)
	Function FSOUND_Reverb_GetChannelProperties:Byte(channel:Int,prop:Int)
	
	
	' FMUSIC
	Const FMUSIC_TYPE_NONE =0  
	Const FMUSIC_TYPE_MOD =1' Protracker / Fasttracker ' 
	Const FMUSIC_TYPE_S3M =2' ScreamTracker 3 ' 
	Const FMUSIC_TYPE_XM =3' FastTracker 2 ' 
	Const FMUSIC_TYPE_IT=4 ' Impulse Tracker. ' 
	Const FMUSIC_TYPE_MIDI=5 ' MIDI file ' 
	Const FMUSIC_TYPE_FSB =6' FMOD Sample Bank file '
	
	'music funcs
	Function FMUSIC_FreeSong:Byte(Module_:Int)
	Function FMUSIC_LoadSong:Int(Name$z)
	Function FMUSIC_LoadSongEx:Int(Name:Byte Ptr,offset:Int,length:Int,mode:Int,samplelist:Int Ptr,samplelistnum:Int)
	Function FMUSIC_OptimizeChannels:Byte(Module_:Int,Maxchannels:Int,minvolume:Int)
	Function FMUSIC_PlaySong:Byte(Mod_:Int)
	Function FMUSIC_SetInstCallback:Byte(Modul:Int,callback:Int,instrument:Int)
	Function FMUSIC_SetLooping:Byte(Mod_:Int,Looping:Byte)
	Function FMUSIC_SetMasterSpeed:Byte(Mod_:Int,Speed:Float)
	Function FMUSIC_SetMasterVolume:Byte(Mod_:Int,Volume:Int)
	Function FMUSIC_SetOrder:Byte(Mod_:Int,Order:Int)
	Function FMUSIC_SetOrderCallback:Byte(modul:Int,callback:Int,orderstep:Int)
	Function FMUSIC_SetPanSeperation:Byte(Mod_:Int,Pan:Float)
	Function FMUSIC_SetPaused:Byte(Mod_:Int,Pause:Byte)
	Function FMUSIC_SetReverb:Byte(Mod_:Int,Pause:Byte)
	Function FMUSIC_SetRowCallback:Byte(modul:Int,callback:Int,rowstep:Int)
	Function FMUSIC_SetSample:Byte(Mod_int,sampno:Int,sptr:Int)
	Function FMUSIC_SetUserData:Byte(modul:Int,userdata:Int)
	Function FMUSIC_SetZxxCallback:Byte(modul:Int,callback:Int)
	Function FMUSIC_StopAllSongs()
	Function FMUSIC_StopSong(Mod_:Int)
	
	'Info Funcs
	Function FMUSIC_GetBPM:Int(mod_:Int)
	Function FMUSIC_GetGlobalVolume:Int(mod_:Int)
	Function FMUSIC_GetMasterVolume:Int(mod_:Int)
	Function FMUSIC_GetName:Byte Ptr(modul:Int)
	Function FMUSIC_GetNumChannels:Int(mod_:Int)
	Function FMUSIC_GetNumInstruments:Int(mod_:Int)
	Function FMUSIC_GetNumOrders:Int(mod_:Int)
	Function FMUSIC_GetNumPatterns:Int(mod_:Int)
	Function FMUSIC_GetNumSamples:Int(mod_:Int)
	Function FMUSIC_GetOpenState:Int(mod_:Int)
	Function FMUSIC_GetOrder:Int(mod_:Int)
	Function FMUSIC_GetPattern:Int(mod_:Int)
	Function FMUSIC_GetPatternLength:Int(mod_:Int,OrderNo:Int)
	Function FMUSIC_GetPaused:Int(mod_:Int)
	Function FMUSIC_GetRealChannel:Int(mod_:Int,channel:Int)
	Function FMUSIC_GetRow:Int(mod_:Int)
	Function FMUSIC_GetSample:Int(mod_:Int,SampleNo:Int)
	Function FMUSIC_GetSpeed:Int(mod_:Int)
	Function FMUSIC_GetTime:Int(mod_:Int)
	Function FMUSIC_GetType:Int(mod_:Int)
	Function FMUSIC_GetUserData:Int(mod_:Int)
	Function FMUSIC_IsFinished:Byte(mod_:Int)
	Function FMUSIC_IsPlaying:Byte(mod_:Int)	
End Extern

Function FMOD_GetError:String()
	Select FSOUND_GetError()
		Case 0  Return "NONE"
		Case 1  Return "BUSY"
		Case 2  Return "UNINITIALIZED"
		Case 3  Return "INIT"
		Case 4  Return "ALLOCATED"
		Case 5  Return "PLAY"
		Case 6  Return "OUTPUT_FORMAT"
		Case 7  Return "COOPERATIVELEVEL"
		Case 8  Return "CREATEBUFFER"
		Case 9  Return "FILE_NOTFOUND"
		Case 10 Return "FILE_FORMAT"
		Case 11 Return "FILE_BAD"
		Case 12 Return "MEMORY"
		Case 13 Return "VERSION"
		Case 14 Return "INVALID_PARAM"
		Case 15 Return "NO_EAX"
		Case 16 Return "CHANNEL_ALLOC"
		Case 17 Return "RECORD"
		Case 18 Return "MEDIAPLAYER"
		Case 19 Return "CDDEVICE"
		Default Return "Unknown Error"
	End Select
End Function

'THIS MARKS THE BEGINNING OF MY CODE

Global adrv:CAudioDriver=New CAudioDriver
Type CAudioDriver
	Field areweinit=False
	Field outdvc,dspfeedback=False,is3dsound=False 'device/driver info
	Field music,musicpause:Byte,musicvolume:Byte,musicrate#=1# 'music info
	Field sounds:TList
End Type

Function adrv_init(freq,chans,out)
	If dvc>-2 And adrv.areweinit=False Then
		fsound_close()
		
		adrv.outdvc=out
		If Not fsound_setoutput(adrv.outdvc) Then DebugLog "fsound object failed to set output dvcice!!!"
		If Not fsound_init(freq,chans,0) Then DebugLog "fsound object failed to initialize sound!!!"
		dsp_activate()
		
		fsound_setdriver 0
		adrv.areweinit=True
		
		If adrv.outdvc=FSOUND_OUTPUT_A3D Then ..
		 adrv.is3dsound=True Else adrv.is3dsound=False
		If is3dsound Then
			DebugLog "3d sound not currently supported"
			End
		End If
	End If
End Function

Function init_status()
	Return adrv.areweinit
End Function

Function dsp_activate()
	adrv.dspfeedback=True
	fsound_dsp_setactive fsound_dsp_getfftunit(),adrv.dspfeedback
End Function

Function dsp_deactivate()
	adrv.dspfeedback=False
	fsound_dsp_setactive fsound_dsp_getfftunit(),adrv.dspfeedback
End Function

Function dsp_toggle_state()
	adrv.dspfeedback=(adrv.dspfeedback=False)
	fsound_dsp_setactive fsound_dsp_getfftunit(),adrv.dspfeedback
End Function

Function dsp_get_spect:Byte Ptr()
	Return fsound_dsp_getspectrum()
End Function

Function get_out()
	Return fsound_getoutput()
End Function

Function get_out_name$()
	tout=fsound_getoutput()
	Select tout
?Win32
		Case FSOUND_OUTPUT_WINMM   Return "WinMM"
		Case FSOUND_OUTPUT_DSOUND  Return "DirectSound"
		Case FSOUND_OUTPUT_A3D     Return "A3D"
?Linux
		Case FSOUND_OUTPUT_ALSA    Return "ALSA"
		Case FSOUND_OUTPUT_ESD     Return "ESD"
		Case FSOUND_OUTPUT_OSS     Return "OSS"
?MacOS
		Case FSOUND_OUTPUT_MAC     Return "Mac Audio"
?
		Case FSOUND_OUTPUT_NOSOUND Return "No Sound"
		Default Return "???"
	End Select
End Function

'sound samples
Function load_sample(data$,loopmode=FMG_NOLOOP)
	sptr=fsound_sample_load(FSOUND_FREE,data,0,0,0)
	Select loopmode
	Case FMG_LOOPNORMAL
		sm=FSOUND_LOOP_NORMAL
	Case FMG_NOLOOP
		sm=FSOUND_LOOP_OFF
	Case FMG_LOOPBIDI
		sm=FSOUND_LOOP_BIDI
	End Select
	fsound_sample_setmode sptr,sm|FSOUND_2D

	Return sptr
End Function

Function sample_loop(sptr,loopmode)
	Select loopmode
	Case FMG_LOOPNORMAL
		sm=FSOUND_LOOP_NORMAL
	Case FMG_NOLOOP
		sm=FSOUND_LOOP_OFF
	Case FMG_LOOPBIDI
		sm=FSOUND_LOOP_BIDI
	End Select
	fsound_sample_setmode sptr,sm
End Function

Function sample_play(sptr,freq=0,pan=0,paused=False)
	pan=get_byte_pan(pan)
	chan=fsound_playsoundex(FSOUND_FREE,sptr,fsound_dsp_getsfxunit(),True)
	fsound_setfrequency chan,clip_freq_rng(freq)
	fsound_setpan chan,pan
	If Not paused Then fsound_setpaused chan,False
	Return chan
End Function

Function channel_setpause(chan,state:Byte)
	fsound_setpaused chan,state
End Function

Function setpause_all_channels(state:Byte)
	fsound_setpaused FSOUND_ALL,state
End Function

Function channel_stop(chan)
	fsound_stopsound chan
End Function

Function channel_pause_state(chan)
	Return fsound_getpaused(chan)
End Function

Function get_byte_pan(pan)
	pan:+127
	If pan<0 Then pan=0
	If pan>255 Then pan=255
	Return pan
End Function

Function get_int_pan(pan)
	pan:-127
	If pan<-128 Then pan=-128
	If pan>128 Then pan=128
	Return pan
End Function

Function clip_freq_rng(freq)
	Select Sgn(freq)
	Case 0
		freq=44000
	Case 1
		If freq<100 Then freq=100
		If freq>705600 Then freq=705600
	Case -1
		If freq>-100 Then freq=-100
		If freq<-705600 Then freq=-705600
	End Select
	
	Return freq
End Function

'music sequences
Function is_music()
	If adrv.music>0 Then Return True Else Return False
End Function

Function update()
	If adrv.is3dsound Then fsound_update
End Function

Function load_music(data$)
	fmusic_stopsong adrv.music
	adrv.music=fmusic_loadsong(data)
	
	If Not adrv.music Then DebugLog "fmusic object failed to load music file!!!"
End Function

Function play_music()
	fmusic_playsong adrv.music
	adrv.musicvolume=128
	fmusic_setmastervolume adrv.music,adrv.musicvolume
End Function

Function set_music_volume(vol:Byte)
	adrv.musicvolume=vol
	fmusic_setmastervolume adrv.music,adrv.musicvolume
End Function

Function get_music_volume()
	Return adrv.musicvolume
End Function

Function set_music_rate(rate#)
	adrv.musicrate=rate
	fmusic_setmasterspeed adrv.music,adrv.musicrate
End Function

Function get_music_rate#()
	Return adrv.musicrate
End Function

Function stop_music()
	fmusic_stopsong adrv.music
End Function

Function release_music()
	adrv.music=0
End Function

Function toggle_pause_music()
	adrv.musicpause=(adrv.musicpause=False)
	fmusic_setpaused adrv.music,adrv.musicpause
End Function

Function pause_music()
	adrv.musicpause=True
	fmusic_setpaused adrv.music,adrv.musicpause
End Function

Function unpause_music()
	adrv.musicpause=False
	fmusic_setpaused adrv.music,adrv.musicpause
End Function

Function is_paused()
	Return adrv.musicpause
End Function

Function beginsnd(freq=44000,chans=256,out=1)
	endsnd
	adrv_init freq,chans,out
	adrv.areweinit=True
End Function

Function endsnd()
	If init_status() Then
		adrv=New CAudioDriver
		dsp_deactivate
		fsound_close
	End If
End Function
Public

'THESE CONSTANTS ARE MINE
?Win32
Rem
bbdoc: DirectSound Driver
about:
Identifies the DirectSound WinCE device.  On win32 DirectSound is emulated by
WinMM, so it will be sub-par unless you have a winCE system
End Rem
Const FMG_DSOUND=FSOUND_OUTPUT_DSOUND
Rem
bbdoc: Win32 Multimedia
about:
Identifies the WinMM driver, part of win32 standard libs.
End Rem
Const FMG_WINMM=FSOUND_OUTPUT_WINMM
?Linux
Rem
bbdoc: Advanced Linux Sound API
about:
Identifies ALSA, the standard Linux audio system.
End Rem
Const FMG_ALSA=FSOUND_OUTPUT_ALSA
Rem
bbdoc: Enlightment Sound Daemon
about:
Identifies ESD, a good sound daemon for Linux
End Rem
Const FMG_ESD=FSOUND_OUTPUT_ESD
Rem
bbdoc: Open Sound System
about: 
Identifies OSS, the biggest open source sound system for Linux.
End Rem
Const FMG_OSS=FSOUND_OUTPUT_OSS
?MacOS
Rem
bbdoc: Mac Sound Out
about:
Identifies Mac Sound Out, the sound output system for MacOS.
End Rem
Const FMG_MACSOUND=FSOUND_OUTPUT_MAC
?
Rem
bbdoc: Audio 3D Device
about:
Identifies the 3D audio driver, which can vary.  Usually the native FMod
3D sound driver is used.
End Rem
Const FMG_A3D=FSOUND_OUTPUT_A3D
Rem
bbdoc: No Sound
about:
Identifies a driver that has no sound output.
End Rem
Const FMG_NOSOUND=FSOUND_OUTPUT_NOSOUND
Rem
bbdoc: Auto Select
about:
Use this in the place of an output device to have it
automatically select one for you.
End Rem
Const FMG_AUTODRIVER=-1
Rem
bbdoc: Normal Looping
about:
Sets a sound sample to normal looping mode.
End Rem
Const FMG_LOOPNORMAL=1
Rem
bbdoc: Play Once
about:
Sets a sound sample to play once mode.
End Rem
Const FMG_NOLOOP=0
Rem
bbdoc: Bidirectional Looping
about:
Sets a sound sample to bidirectional looping mode.  Disregarded if sample file
is not a bidirectional format.
End Rem
Const FMG_LOOPBIDI=-1

Rem
bbdoc: Initialize
about:
Initialize the Sound Object.  If the Sound Object is already initialized, it
reinitializes.  Do with caution, because all sound data will be flushed out of
memory, and without freeing it first!  So be CAREFUL or you could create
memory leaks and maybe even crash your system.  If you reinitialize then make
sure you release all the memory first with #FMGReleaseAll.
End Rem
Function FMGInit(freq=44000,chans=256,dvr=-1)
	beginsnd freq,chans,dvr
End Function

Rem
bbdoc: Release All
about:
Release all objects, and clean the memory; should be the last thing you do
with the sound object.
End Rem
Function FMGReleaseAll()
	endsnd
	GCCollect
End Function

Rem
bbdoc: Get Audio Spectrum
about:
Get the audio spectrum.  Returns a float array with 286 cells; each cell represents
one frequency.  Spectrum is ordered from longest to shortest.
End Rem
Function FMGAudioSpectrum#[]()
	Local spect#[286]
	If is_music() Then
		Local bnk:TBank=CreateStaticBank(dsp_get_spect(),512*4)
		For j=0 To 285
			spect[j]=PeekFloat(bnk,j*4)
		Next
	EndIf
	Return spect
End Function

Rem
bbdoc: Get Debug Values
about:
Excellent if you're getting unhandled memory exception errors, this will
expose any memory leaks, cpu overload, etc.
End Rem
Function FMGDebugDump(curchans Var,maxchans Var,outdvr$ Var,outdvrnum Var,cpu# Var)
	curchans=fsound_getchannelsplaying()
	maxchans=fsound_getmaxchannels()
	outdvr=get_out_name()
	outdvrnum=get_out()
	cpu=fsound_getcpuusage()
End Function

Rem
bbdoc: Load Audio Sample
about:
Load an audio sample in to memory.  Returns sample ID.
End Rem
Function FMGLoadSample(data$,loopmode=FMG_NOLOOP)
	sampleid=load_sample(data,loopmode)
	Return sampleid
End Function

Rem
bbdoc: Play Audio Sample
about:
Play a sample.  Frequency (freq), Stereo Panning (pan), Is Paused (ispaused), and
Use Special FX (usefx) all optional.  The default frequency is 44000, so
if the audio sample you are playing is a different frequency, then be sure to
set it properly.  Returns the channel allocated for the output.
End Rem
Function FMGPlaySample(sampleid,freq=44000,pan=0,ispaused=False)
	channelid=sample_play(sampleid,freq,pan,ispaused)
	Return channelid
End Function

Rem
bbdoc: Release Audio Sample
about:
Releases audio sample memory.
End Rem
Function FMGReleaseSample(sampleid)
	fsound_sample_free sampleid
	GCCollect
End Function

Rem
bbdoc: Pause Channel
about:
Pauses audio channel: channelid .  If channel is already paused, there is no effect.
End Rem
Function FMGPauseChannel(channelid)
	channel_setpause channelid,True
End Function

Rem
bbdoc: UnPause Channel
about:
Resumes audio channel: channelid .  If channel is already playing,
there is no effect.
End Rem
Function FMGUnPauseChannel(channelid)
	channel_setpause channelid,False
End Function

Rem
bbdoc: Toggle Pause Channel
about:
Toggles the audio channel "channelid"'s pause state.
End Rem
Function FMGTogglePauseChannel(channelid)
	channel_setpause channelid,(fsound_getpaused(channelid)=False)
End Function

Rem
bbdoc: Pause All Channels
about:
Pauses all audio channels.  If channel is already paused, there is no effect.
End Rem
Function FMGPauseAllChannels(channelid)
	setpause_all_channels True
End Function

Rem
bbdoc: UnPause All Channels
about:
Resumes all audio channels.  If channel is already playing,
there is no effect.
End Rem
Function FMGUnPauseAllChannels(channelid)
	setpause_all_channels False
End Function

Rem
bbdoc: Get Channel Pause State
about:
Returns current pause state of a channel.
End Rem
Function FMGChannelPauseState(channelid)
	Return channel_pause_state(channelid)
End Function

Rem
bbdoc: Set Master Volume
about:
Set the master volume level.  All sound channels volume is relative to this.
End Rem
Function FMGSetMasterVolume(vol)
	If vol>255 Then vol=255
	If vol<0 Then vol=0
	fsound_setsfxmastervolume vol
End Function

Rem
bbdoc: Set Channel Volume
about:
Set the volume for one channel.  Volume is relative to the Master Volume.
End Rem
Function FMGSetChannelVolume(channelid,vol)
	If vol>255 Then vol=255
	If vol<0 Then vol=0
	fsound_setvolume channelid,vol
End Function

Rem
bbdoc: Adjust Master Volume
about:
Adjust the master volume level.  All sound channels volume is relative to this.
End Rem
Function FMGAdjustMasterVolume(inc)
	newvol=FMGGetMasterVolume()+inc
	If newvol>255 Then newvol=255
	If newvol<0 Then newvol=0
	fsound_setsfxmastervolume newvol
End Function

Rem
bbdoc: Adjust Channel Volume
about:
Adjust the volume for one channel.  Volume is relative to the Master Volume.
End Rem
Function FMGAdjustChannelVolume(channelid,inc)
	newvol=FMGGetChannelVolume(channelid)+inc
	If newvol>255 Then newvol=255
	If newvol<0 Then newvol=0
	fsound_setvolume channelid,newvol
End Function

Rem
bbdoc: Set Channel Volume Absolute
about:
Set the volume for one channel.  This command overrides the master volume.
End Rem
Function FMGSetChannelVolumeAbsolute(channelid,vol)
	If vol>255 Then vol=255
	If vol<0 Then vol=0
	fsound_setvolumeabsolute channelid,vol
End Function

Rem
bbdoc: Get Master Volume
about:
Get the master volume level.  All sound channels volume is relative to this.
End Rem
Function FMGGetMasterVolume:Byte()
	Return fsound_getsfxmastervolume()
End Function

Rem
bbdoc: Get Channel Volume
about:
Get the volume for one channel, relative to the master volume.
End Rem
Function FMGGetChannelVolume:Byte(channelid)
	Return fsound_getvolume(channelid)
End Function

Rem
bbdoc: Get Channel Amplitude
about:
Get the amplitude for one channel.  The amplitude is the result volume after all
additional modifications, including the master volume, have been factored in.
End Rem
Function FMGGetChannelAmplitude:Byte(channelid)
	Return fsound_getamplitude(channelid)
End Function

Rem
bbdoc: Set Channel Stereo Panning
about:
Sets the stereo panning position for a given channel.  Range -128(full left) to
128(full right)
End Rem
Function FMGSetChannelPan(channelid,pan)
	fsound_setpan channelid,get_byte_pan(pan)
End Function

Rem
bbdoc: Get Channel Stereo Panning
about:
Gets the stereo panning position for a given channel.  Range -128(full left) to
128(full right)
End Rem
Function FMGGetChannelPan(channelid)
	Return get_int_pan(fsound_getpan(channelid))
End Function

Rem
bbdoc: Adjust Channel Stereo Panning
about:
Adjusts the stereo panning position for a given channel.  Range
-128(full left) to 128(full right)
End Rem
Function FMGAdjustChannelPan(channelid,inc)
	newpan=fsound_getpan(channelid)+inc
	If newpan<0 Then newpan=0
	If newpan>255 Then newpan=255
	fsound_setpan channelid,newpan
End Function

Rem
bbdoc: Set Channel Frequency
about:
Sets the sampling rate (frequency) of a given channel.  Invalid values are
clipped to range.<br><br>
Valid ranges:<br>
100 to 705,600 BPS (bytes per second)<br>
-705,600 to -100 BPS (bytes per second)
End Rem
Function FMGSetChannelFreq(channelid,freq)
	freq=clip_freq_rng(freq)
	fsound_setfrequency channelid,freq
End Function

Rem
bbdoc: Get Channel Frequency
about:
Gets the sampling rate (frequency) of a given channel.
End Rem
Function FMGGetChannelFreq(channelid)
	Return fsound_getfrequency(channelid)
End Function

Rem
bbdoc: Adjust Channel Frequency
about:
Adjusts the sampling rate (frequency) of a given channel.  Invalid values are
clipped to range.<br><br>
Valid ranges:<br>
100 to 705,600 BPS (bytes per second)<br>
-705,600 to -100 BPS (bytes per second)
End Rem
Function FMGAdjustChannelFreq(channelid,inc)
	fsound_setfrequency channelid,..
	 clip_freq_rng(fsound_getfrequency(channelid)+inc)
End Function

Rem
bbdoc: Get Channel Current Sample
about:
Get the sample currently assigned to a given channel.  Note that #FMGGetChannelSample
does not return null, nan, inf, or zero if sample has finished playback.
End Rem
Function FMGGetChannelCurrentSample(channelid)
	Return fsound_getcurrentsample(channelid)
End Function



Rem
bbdoc: Is Channel Playing
about:
Returns True if the channel is playing (or paused) and False if it is stopped or
doesn't exist.
End Rem
Function FMGIsChannelPlaying(channelid)
	Return fsound_isplaying(channelid)
End Function

Rem
bbdoc: Stop Audio Channel
about:
Stop audio channel: channelid .
End Rem
Function FMGStopChannel(channelid)
	channel_stop channelid
End Function

Rem
bbdoc: Load Music File
about:
Loads a music sequence file, supported formats are *.MOD, *.S3M, *.XM, *.IT, *.MID
End Rem
Function FMGLoadMusic(data$)
	load_music data$
End Function

Rem
bbdoc: Start Music Playback
about:
Play the currently loaded music file.
End Rem
Function FMGPlayMusic()
	play_music
End Function

Rem
bbdoc: Pause Music
about:
Pause the music playback.
End Rem
Function FMGPauseMusic()
	pause_music
End Function

Rem
bbdoc: UnPause Music
about:
Unpause the music playback.
End Rem
Function FMGUnPauseMusic()
	unpause_music
End Function

Rem
bbdoc: Toggle Music Pause State
about:
Toggle the pause state of the music playback.
End Rem
Function FMGTogglePauseMusic()
	toggle_pause_music
End Function

Rem
bbdoc: Get Music Pause State
about:
Get the pause state of the music.  True is paused and False is playing.
End Rem
Function FMGMusicPauseState()
	Return is_paused()
End Function

Rem
bbdoc: Set Music Volume
about:
Set the music volume.  The argument is an integer, but that's just to make
the clipping work properly.  The end product is actually a byte, so it has
to be a value between 0 and 255.  Out-of-bounds values will be clipped to
range.
End Rem
Function FMGSetMusicVolume(vol)
	If vol>255 Then vol=255
	If vol<0 Then vol=0
	set_music_volume vol
End Function

Rem
bbdoc: Get Music Volume
about:
Get the current music volume.  Will return a Byte with volume being all the way from
0 to 255.
End Rem
Function FMGGetMusicVolume:Byte()
	Return get_music_volume()
End Function

Rem
bbdoc: Adjust Music Volume
about:
Adjust the current music volume by the given argument.  If the volume goes out of
bounds, it is clipped to range, (0 to 255,) so don't worry about that.
End Rem
Function FMGAdjustMusicVolume(inc)
	newvol=get_music_volume()+inc
	If newvol>255 Then newvol=255
	If newvol<0 Then newvol=0
	set_music_volume newvol
End Function

Rem
bbdoc: Set Music Playback Rate
about:
Set the music playback rate.  If the volume goes out of
bounds, it is clipped to range, 0-stop 1-normal 10-max.
End Rem
Function FMGSetMusicRate(rate#)
	If rate>10 Then rate=10
	If rate<0 Then rate=0
	set_music_rate rate
End Function

Rem
bbdoc: Get Music Playback Rate
about:
Get the current music playback rate.  If the volume goes out of
bounds, it is clipped to range, 0-stop 1-normal 10-max.
End Rem
Function FMGGetMusicRate#()
	Return get_music_rate()
End Function

Rem
bbdoc: Adjust Music Playback Rate
about:
Adjust the music playback rate by the given argument.  If the volume goes out of
bounds, it is clipped to range, 0-stop 1-normal 10-max.
End Rem
Function FMGAdjustMusicRate(rate#)
	newrate#=rate+adrv.musicrate
	If newrate>10 Then newrate=10
	If newrate<0 Then newrate=0
	set_music_rate newrate
End Function

Rem
bbdoc: Stop Music Playback
about:
Stop music playback and revert to start.
End Rem
Function FMGStopMusic()
	stop_music
End Function

Rem
bbdoc: Release Music File
about:
Release the music handle, and the clean the memory.
End Rem
Function FMGReleaseMusic()
	release_music
	GCCollect
End Function


?Win32
Framework BRL.Win32MaxGUI
?Linux
Framework BRL.FLTKMaxGUI
?MacOS
Framework BRL.CocoaMaxGUI
?
Import BRL.Timer
Import BRL.D3D7Max2D
Import Pub.FModGameEx

OnEnd ReleaseAll

AppTitle="FMod Game Extension Audio Sample Test"
Global w:TGadget=CreateWindow(AppTitle,..
 Desktop().ClientWidth()/2-225,Desktop().ClientHeight()/2-150,560,400,..
  Null,WINDOW_TITLEBAR)
Global c:TGadget=CreateCanvas(0,0,w.clientwidth(),w.ClientHeight(),w,0)
SetGadgetLayout c,1,1,1,1

Global menu:TGadget=CreateMenu("&Menu",0,WindowMenu(w))
CreateMenu "&About",1,menu,KEY_A,MODIFIER_COMMAND
CreateMenu "E&xit",2,menu,KEY_X,MODIFIER_CONTROL

panel:TGadget=CreatePanel(0,0,w.clientwidth(),w.ClientHeight(),w,PANEL_ACTIVE)
SetGadgetLayout panel,1,1,1,1
UpdateWindowMenu w

CreateTimer 30

Global cnt#

?Win32
FMGInit 44000,128,FMG_WINMM
?Linux
FMGInit 44000,128,FMG_AUTODRIVER
?MacOS
FMGInit 44000,128,FMG_MACSOUND
?

Global music=FMGLoadSample("dreams_inc.mp3",FMG_LOOPNORMAL)
Global shot=FMGLoadSample("shot.ogg")
Global hit=FMGLoadSample("hit.ogg")
Global channel=FMGPlaySample(music,44000)

SetGraphics CanvasGraphics(c)
SetClsColor 0,64,0

Repeat
	ActivateGadget panel
	Local cev:TEvent=CurrentEvent
	PollEvent
	Select cev.id
		Case EVENT_WINDOWCLOSE End
	Case EVENT_TIMERTICK
		FMGDebugDump curchans,maxchans,outdvr$,outdvrnum,cpuuse#
		RedrawGadget c
	Case EVENT_KEYREPEAT
		Select cev.data
			Case KEY_LEFT  FMGAdjustChannelPan channel,-1
			Case KEY_RIGHT FMGAdjustChannelPan channel,1
			Case KEY_UP    FMGAdjustChannelVolume channel,1
			Case KEY_DOWN  FMGAdjustChannelVolume channel,-1
			Case KEY_Z     FMGAdjustChannelFreq channel,-50
			Case KEY_X     FMGAdjustChannelFreq channel,50
		End Select
	Case EVENT_KEYDOWN
		Select cev.data
			Case KEY_LEFT   FMGAdjustChannelPan channel,-1
			Case KEY_RIGHT  FMGAdjustChannelPan channel,1
			Case KEY_UP     FMGAdjustChannelVolume channel,1
			Case KEY_DOWN   FMGAdjustChannelVolume channel,-1
			Case KEY_Z      FMGAdjustChannelFreq channel,-50
			Case KEY_X      FMGAdjustChannelFreq channel,50
		End Select
	Case EVENT_KEYUP
		If cev.data=KEY_P      Then FMGTogglePauseChannel channel
		If cev.data=KEY_ESCAPE Then End
	Case EVENT_MOUSEDOWN
		shotchan=FMGPlaySample(shot,44000)
	Case EVENT_MOUSEUP
		hitchan=FMGPlaySample(hit,44000)
	Case EVENT_MENUACTION
		Select cev.data
			Case 1 Notify "This is a test of the FMod~nGame Extension Module"
			Case 2 End
		End Select
	Case EVENT_GADGETPAINT
		SetGraphics CanvasGraphics(c)
		Cls
		
		SetColor 255,255,255
		DrawText "FMod Game Extension Test",5,5
		DrawText "Press ~qP~q to toggle pause state.  Paused="+..
		 FMGChannelPauseState(channel),5,21
		DrawText "Press UP and DOWN to change volume.  Volume="+..
		 ((FMGGetChannelVolume(channel)/255#)*100#)+"%",5,37
		DrawText "Press LEFT and RIGHT to move stereo panning.  Pan="+..
		 FMGGetChannelPan(channel),5,53
		DrawText "Press Z and X to change frequency.  Frequency="+..
		 FMGGetChannelFreq(channel),5,69
		DrawText "Channel="+curchans+"/"+maxchans,5,85
		DrawText "CPUUse="+cpuuse,150,85
		DrawText "Output Driver: num="+outdvrnum+" name="+outdvr,5,101
		
		SetScale 1.5+Sin(cnt)/3,1.5-Sin(cnt)/3
		DrawText "Streaming Audio Sample...",5,117
		cnt:+1.25
		SetScale 1,1
		
		Flip
	EndSelect
Forever

End

Function ReleaseAll()
	FreeGadget c
	FreeGadget w
	FMGStopChannel channel
	FMGReleaseSample shot
	FMGReleaseSample hit
	FMGReleaseSample music
	FMGReleaseAll
End Function


Has anyone experimented the 3D sound functions in fmod 3.75? Seems most of the improvements of fmod 4/EX are focused on this feature.

How does it compare to OpenAL or Bass?

Which leads to the question... will there be ever fmod4.0 support... ;)

FMod is higher sound quality, but OpenAL is much easier to use, especially the 3D sound and special effects, so it's a bit of a toss up.

I'm using OpenAL at the moment, because of it's ease of use, and because it supports all the effects and features I want. But FMod has more features, for you uber-developers out there.

Is there an OpenAL mod? (and some example?) The only one I could find has been released 3 days ago by vertex and there is only one "minimal" example.

Thanks

That was the mod I was talking about. If you want more examples, (that you'll have to port unfortunately,) you should download the OpenAL SDK.

I installed Max 1.24 and FMod broke. I tried to replace the DLL with 3.75 and the Fmod.mod directory; but I get the following error:


Compile Error: Identifier 'FSOUND_SetOutput' not found

What am I doing wrong?

Thanks

EDIT: I think I got it to work, I forgot to replace the lib.

The link at the top of the page for FMod Windows seems to be broken?

where can I find the latest release of the library?

Thanks.

Here

Regards
Sveinung

Thanks

Hi guys... I have followed the setup procedures but my program still won't recognise any of the fmod commands. I think the problem is that it won't build fmod... at least there are no files apart from the max file in libfmod directory after i rebuild modules. Any ideas what the prob could be?

My bad - for some reason MaxGUI won't build and this caused the process to bomb before it got to fmod. Ripping MaxGUI out for the time being solved the prob.

Check it out. I've created a simple multi-track streaming class that can do ram, file, and network streams. Have a look. :)

Const FMOD_SAMPLE=1
Const FMOD_STREAM=2

Const TAS_PLAYMODE_ALL=True
Const TAS_PLAYMODE_ONE=False
Const TAS_LOOPMODE_ON =True
Const TAS_LOOPMODE_OFF=False

Type TAudioRamStreamer
	Field msp:Byte Ptr[]
	Field msl[]
	Field aChan,aStream,aTrack,aTrackCount
	Field playMode,loopMode,isPlaying
	
	Function create:TAudioRamStreamer(sampleimgs:Byte Ptr[],samplelengths[])
		Local tracker:TAudioRamStreamer=New TAudioRamStreamer
		tracker.aChan=channel
		tracker.aTrack=0
		
		tracker.playMode=TAS_PLAYMODE_ALL
		tracker.loopMode=TAS_LOOPMODE_ON
		
		If Not tracker.Init(sampleimgs,samplelengths) Then
			Print "Failed to get audio samples for streaming!"
			tracker=Null
		End If
		
		Return tracker
	End Function
	
	Method Init(sampleimgs:Byte Ptr[],samplelengths[])
		If sampleimgs.length<>samplelengths.length Then
			If sampleimgs.length<samplelengths.length Then
				Print "Audio sample image array smaller than sample length array!"
			Else
				Print "Sample length array smaller than audio sample image array!"
			End If
			Return False
		End If
		aTrackCount=sampleimgs.length
		
		msp=sampleimgs
		msl=samplelengths
		
		Return True
	End Method
	
	Method Play()
		If isPlaying Then Close
		isPlaying=True
		aStream=..
		 fsound_stream_open(msp[aTrack],FSOUND_HW2D|FSOUND_LOADMEMORY,..
		  0,msl[aTrack])
		aChan=fsound_stream_play(FSOUND_FREE,aStream)
	End Method
	
	Method Update()
		If isPlaying Then
			Select loopMode
			Case TAS_LOOPMODE_ON
				Select playMode
				Case TAS_PLAYMODE_ALL
					If Not fsound_isplaying(aChan) Then
						If aTrack=aTrackCount-1 Then SetTrack(0) Else SkipFwd()
					End If
				Case TAS_PLAYMODE_ONE
					If Not fsound_isplaying(aChan) Then
						Play
					End If
				End Select
			Case TAS_LOOPMODE_OFF
				Select playMode
				Case TAS_PLAYMODE_ALL
					If Not fsound_isplaying(aChan) Then
						If aTrack=aTrackCount-1 Then Close() Else SkipFwd()
					End If
				Case TAS_PLAYMODE_ONE
					If Not fsound_isplaying(aChan) Then
						Close
					End If
				End Select
			End Select
		End If
	End Method
	
	Method Stop()
		isPlaying=False
		Return fsound_stream_stop(aStream)
	End Method
	
	Method Close()
		Stop
		Return fsound_stream_close(aStream)
	End Method
	
	Method SkipFwd()
		aTrack:+1
		If aTrack>aTrackCount-1 Then aTrack=0
		If aTrack<0 Then aTrack=aTrackCount-1
		Play
	End Method
	
	Method SkipBack()
		If aTrack>aTrackCount-1 Then aTrack=0
		If aTrack<0 Then aTrack=aTrackCount-1
		Play
	End Method
	
	Method SetTrack(track)
		If aTrack<>track Then
			aTrack=track
			If aTrack>aTrackCount-1 Then aTrack=aTrackCount-1
			If aTrack<0 Then aTrack=0
			Play
		End If
	End Method
	
	Method GetTrack()
		Return aTrack
	End Method
	
	Method GetCurrTrackLengthInSize()
		Return fsound_stream_getlength(aStream)
	End Method
	
	Method GetCurrTrackPosInSize()
		Return fsound_stream_getposition(aStream)
	End Method
	
	Method GetCurrTrackLengthInTime()
		Return fsound_stream_getlengthms(aStream)
	End Method
	
	Method GetCurrTrackPosInTime()
		Return fsound_stream_gettime(aStream)
	End Method
	
	Method GetTrackID3Tag$()
		Return FModGetSongName(aStream,FMOD_STREAM)
	End Method
	
	Method Free()
		Close
		msp=Null;msl=Null
		aChan=Null
		aStream=Null
		aTrack=Null
		aTrackCount=Null
		playMode=Null
		loopMode=Null
	End Method
End Type

Type TAudioFileStreamer
	Field msp:Byte Ptr[]
	Field aChan,aStream,aTrack,aTrackCount
	Field playMode,loopMode,isPlaying
	
	Function create:TAudioFileStreamer(names$[])
		Local tracker:TAudioFileStreamer=New TAudioFileStreamer
		tracker.aChan=channel
		tracker.aTrack=0
		
		tracker.playMode=TAS_PLAYMODE_ALL
		tracker.loopMode=TAS_LOOPMODE_ON
		
		If Not tracker.Init(names) Then
			Print "Failed to get audio samples for streaming!"
			tracker=Null
		End If
		
		Return tracker
	End Function
	
	Method Init(names$[])
		aTrackCount=names.length
		For tk=0 To aTrackCount-1
			msp[tk]=names[tk].ToCString()
		Next
		
		Return True
	End Method
	
	Method Play()
		If isPlaying Then Close
		isPlaying=True
		aStream=..
		 fsound_stream_open(msp[aTrack],FSOUND_HW2D,..
		  0,0)
		aChan=fsound_stream_play(FSOUND_FREE,aStream)
	End Method
	
	Method Update()
		If isPlaying Then
			Select loopMode
			Case TAS_LOOPMODE_ON
				Select playMode
				Case TAS_PLAYMODE_ALL
					If Not fsound_isplaying(aChan) Then
						If aTrack=aTrackCount-1 Then SetTrack(0) Else SkipFwd()
					End If
				Case TAS_PLAYMODE_ONE
					If Not fsound_isplaying(aChan) Then
						Play
					End If
				End Select
			Case TAS_LOOPMODE_OFF
				Select playMode
				Case TAS_PLAYMODE_ALL
					If Not fsound_isplaying(aChan) Then
						If aTrack=aTrackCount-1 Then Close() Else SkipFwd()
					End If
				Case TAS_PLAYMODE_ONE
					If Not fsound_isplaying(aChan) Then
						Close
					End If
				End Select
			End Select
		End If
	End Method
	
	Method Stop()
		isPlaying=False
		Return fsound_stream_stop(aStream)
	End Method
	
	Method Close()
		Stop
		Return fsound_stream_close(aStream)
	End Method
	
	Method SkipFwd()
		aTrack:+1
		If aTrack>aTrackCount-1 Then aTrack=0
		If aTrack<0 Then aTrack=aTrackCount-1
		Play
	End Method
	
	Method SkipBack()
		If aTrack>aTrackCount-1 Then aTrack=0
		If aTrack<0 Then aTrack=aTrackCount-1
		Play
	End Method
	
	Method SetTrack(track)
		If aTrack<>track Then
			aTrack=track
			If aTrack>aTrackCount-1 Then aTrack=aTrackCount-1
			If aTrack<0 Then aTrack=0
			Play
		End If
	End Method
	
	Method GetTrack()
		Return aTrack
	End Method
	
	Method GetCurrTrackLengthInSize()
		Return fsound_stream_getlength(aStream)
	End Method
	
	Method GetCurrTrackPosInSize()
		Return fsound_stream_getposition(aStream)
	End Method
	
	Method GetCurrTrackLengthInTime()
		Return fsound_stream_getlengthms(aStream)
	End Method
	
	Method GetCurrTrackPosInTime()
		Return fsound_stream_gettime(aStream)
	End Method
	
	Method GetTrackID3Tag$()
		Return FModGetSongName(aStream,FMOD_STREAM)
	End Method
	
	Method Free()
		Close
		msp=Null;msl=Null
		aChan=Null
		aStream=Null
		aTrack=Null
		aTrackCount=Null
		playMode=Null
		loopMode=Null
	End Method
End Type

Function FModGetSongName$(stream_or_sptr,mode=FMOD_SAMPLE)
	If mode=FMOD_STREAM Then
		sptr=fsound_stream_getsample(stream_or_sptr)
	Else If mode=FMOD_SAMPLE
		sptr=stream_or_sptr
	Else
		Return ""
	End If
	Return FmCStr(fsound_sample_getname(sptr))
End Function


Should be self explanitory enough. See what you can do with it! ;)

Does anyone know how to work the reverb stuff? I'd like to include it in my game.

Hey, trying to get this working on Linux (Ubuntu, I read further up that it works), but Im stupid so am struggling. Fresh install of Blitzmax, copied fmod.mod (3.75) to pub.mod, quick build turned off, build modules, but when i try to compile my program I get...
Building modDemo
Compiling:modDemo.bmx
flat assembler  version 1.64
3 passes, 6366 bytes.
Linking:modDemo
/usr/bin/ld: cannot find -lfmod-3.74.1
collect2: ld returned 1 exit status
Build Error: Failed to link /home/chris/Fmod/Samples/modDemo
Process complete

Is it wierd it talks about 3.74? Should I be expecting a linux equiv of fmod.dll? Anyone? ta! :)

Have you downloaded the lib from fmod.org? The lib in the zip is for win32.

I have not tested this mod on Linux. I can make some test next week if you need help.

Sveinung

Hey thanks for the reply. I don't think I've downloaded the lib, but then again I am not entirely sure what I am doing here. I've had a look through the fmod downloads but can't really see what I need

"Linux users - link with libfmod-3.75.so (i.e. gcc file.c -lfmod-3.75)"
looks like the biggest clue but again, im stupid and dont really know what that means ;)

Thanks

Just to clarify everything I've done...

$ wget http://www.fmod.org/files/fmodapi375linux.tar.gz
$ tar -xvzf fmodapi375linux.tar.gz
# cp fmodapi375linux/api/libfmod-3.75.so /usr/lib/libfmod.so

downloaded http://www.sherrox.com/fmod_3_75_module.zip and copied fmod.mod to pub.mod

opened (a fresh install of) blitzmax updated to 1.24, Build Modules, tried compiling the program and thats when i get the error.

EDIT> Good lord I think I got it working :o

Hello guys, the mod sounds really nice and I'd like to try this mod, but hmm I do not even know how to build modules XD They are unselectable (the option is in grey). If I try the hot key (Ctrl+D) it tries to build blitz_app.c even if the fmod.bmx has the focus.

Anyway, how do I build modules :/

I got my files from the above link.

Sorry for asking a repetitive question, but what's the status of this module for using FMod 3.75 on Macs with BMax 1.24? The last direct mention of this was 7 months ago by JazzieB...

I'm probably being blind or stupid (or perhaps both), but after trying out most of the tips and instructions in this thread, between myself and a friend of mine who is helping with Mac porting, we still can't get FMod to work on OSX.

Sadly neither of us are able to do the required work ourselves. Any advice would be much appreciated!

My problem is that I don't have a Mac. I'll try to lend me one.

Sveinung

I have an intel mac if I can be of assistance.

@DannyD
Just bought me a mac. But if you can help me debug...most appreciated :D

Sveinung

Great news!

I'm cheering both of you on from the sidelines... :)

Has anyone ran extensive Fmod tests on win98/ME/2000/XP/Vista to check that it works well on them all in BMax?

What's the status of the module? Do you need to use special commands or has it been made to work like the standard BlitzMax commands?

Thanks.

E:/BlitzMax/bin/ld.exe: cannot find E:/BlitzMax/mod/pub.mod/fmod.mod/fmod.debug.win32.x86.a

whats ths?

That means you haven't built the module yet. Build modules and try again.

Building Modules
Compiling:blitz_app.c
Build Error: failed to compile E:/BlitzMax/mod/brl.mod/blitz.mod/blitz_app.c
Process complete


i have to press CTRL+D cos the menu isn't hilighting!

Lots of hits all pointing to this .
If you're using Vista then you might need this
The search function is really good.

Has anyone tried to do V4 of FMOD yet (especially for the Mac) - I have tried to start, but unfortunately the import libraries are now DYLIB, which BlitzMax wont import.

I have started on the C code (the idea originally being that the libraries could be imported), and an interface to the C code could be setup in BlitzMax.

Support of 4.0 would be great. Sveinung stated a year ago that he would look into this.

It should be easy enough to do - unfortunately, though FMOD comes in two versions for oSX, which might pose a few problems.

I was going to do it myself, but I'm more used to BASS (plus that has makes it easy to get hold of the music info).

I've got the most of the 4 wrap ready.Sorry got no time to complete it. If anyone want the source, just e-mail me.

Regards
Sveinung

It doesn't seem to be possible to use this FMod-Module with Linux as it crashes completely trying to load .ogg-files and isn't able to stream at all.

Crash (MAlloc) at:
(with sParFile as some .ogg-file-path, I *think* it crashes in Stream_Open)
<...>
mscTemp.iFModSoundID = FSOUND_Stream_Open(sParFile, 0, 0, 0)
FSOUND_Sample_GetDefaults(FSOUND_Stream_GetSample(mscTemp.iFModSoundID), Varptr mscTemp.iDefFreq, Null, Null, Null)
FSOUND_Stream_Close(mscTemp.iFModSoundID)
mscTemp.iFModSoundID = -1
<...>


Simply doesn't play anything:
(modified Streaming-sample)
Graphics 300,150,0

FSOUND_Init(22000,256,0)

music=FSOUND_Stream_Open("dreams_inc.mp3",0,0,0)
FSOUND_Stream_Play(FSOUND_FREE,music)

ang:Float=0

Repeat
	
	Cls()
	
	'id=PollEvent()
	ang=ang+4.8
	SetColor(255,255,0)
	For i=0 To 100 Step 10
		DrawLine((Sin(ang+i)*20)+50,(Cos(ang+i*1.3)*25)+75,(Sin(ang+i*1.5)*30)+250,(Cos(ang+i*1.2)*45)+75)
	Next
	
	SetColor(255,255,255)
	DrawText("Streamsample",10,10)
	DrawText(FSOUND_IsPlaying(0),10,20)
	
	If KeyHit(KEY_SPACE)
		
		DrawText(FSOUND_Stream_Stop(music),10,30)
		
	EndIf
	
	Flip()
	
Until KeyHit(KEY_ESCAPE) Or id=259

FSOUND_Stream_Close(music)
fsound_Close()

End



In both cases I can run the exact same code in Windows perfectly without any error or glitch.

Another thing: I'm getting an FMod Errorcode 2 - "This command failed because FSOUND_Init Or FSOUND_SetOutput was Not called" - on FSOUND_Close() with having both FSOUND_Init (returning true) and FSOUND_SetOutput (No Error) called!

Also, it seems to be not reproduceable. I want to call FSOUND_Close followed by another Initialization in Order to completely reset FMOD. I HAVE closed all the streams and without resetting FMod, it will crash anyway some not predictable time later on.

This appears to be related to:
http://www.blitzbasic.com/Community/posts.php?topic=71579

@Sveinung:
Sadly. I'm not good enough at porting.
Which parts are missing? Could you release a wip for testing purposes?

Ok. I'll post some code here soon.

Sveinung

I'm working on a FMOD interface system (with the latest version of FMOD) which is working okay so far.

The only problem I've found really is that only one sample can be played at a time - at the moment, I've no idea how to solve that.

Okay, this is the C interface code - At the moment, Windows and Linux is up and running - just need to do Mac next :

#define WIN32
//#define MACOS
//#define LINUX

#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "math.h"

#define FFT_SIZE	1024

#ifdef WIN32
	// Windows	
	#include "windows.h"
	#include "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\inc\fmod.h"
#endif

#ifdef MACOS
	// OSX Version
	#include "/Developer/bass23-osx/bass.h"
#endif

#ifdef LINUX
	// Linx
	#include "/home/nicholas/Desktop/fmodapi40623linux/api/inc/fmod.h"
#endif

#ifndef DWORD
#define DWORD	int
#endif

FMOD_SYSTEM *FMODSystem=NULL;
FMOD_CREATESOUNDEXINFO extraInfo;

int diff[4];


//----------System
void FMOD_ClearDiff(void)
{
	memset(&diff,(char) 0,sizeof(diff));
}

char FMOD_Initialise(void)
{
FMOD_RESULT result;

	result = FMOD_System_Create(&FMODSystem);
	if (result==FMOD_OK)
	{
		result = FMOD_System_Init(FMODSystem,1024, FMOD_INIT_NORMAL, 0);
		if (result==FMOD_OK)
		{			
		}
	}

	return (result==FMOD_OK ? (char) 1 : (char) 0);
}

void FMOD_Close(void)
{
	FMOD_System_Close(FMODSystem);
	FMODSystem=NULL;
}

void FMOD_Release(void)
{
	FMOD_System_Release(FMODSystem);
	FMODSystem=NULL;
}

DWORD FMOD_CreateStream(char *fileName,int mode)
{
FMOD_SOUND	*FMODSound;

	if (FMOD_System_CreateStream(FMODSystem,fileName,mode,NULL,&FMODSound)==FMOD_OK) // For some reason, getting the extra information generates a 37 error
	{
		return (DWORD) FMODSound;
	}

	return 0;
}

DWORD FMOD_PlaySound(DWORD channelID,DWORD handle,char paused)
{
FMOD_CHANNEL *FMODChannel;

	if (FMOD_System_PlaySound(FMODSystem,channelID,(FMOD_SOUND *) handle,paused,&FMODChannel)==FMOD_OK)
	{
		return (DWORD) FMODChannel;
	}

	return 0;
}

DWORD FMOD_GetChannelPosition(DWORD channel,DWORD type)
{
unsigned int pos;

	if (FMOD_Channel_GetPosition((FMOD_CHANNEL *) channel,&pos,type)==FMOD_OK)
	{
		return pos;
	}

	return 0;
}

char FMOD_ChannelSetPosition(DWORD channel,DWORD position,DWORD type)
{
	return FMOD_Channel_SetPosition((FMOD_CHANNEL *) channel,position,type);
}

char FMOD_ChannelIsPlaying(DWORD channel)
{
int playing;

	if (FMOD_Channel_IsPlaying(channel,&playing)==FMOD_OK)
	{
		return (playing ? 1 : 0);
	}

	return 0;
}

char FMOD_SetVolume(DWORD channel,DWORD volume)
{
	return FMOD_Channel_SetVolume(channel,(float) ((float) volume/(float) 100.0));
}

DWORD FMOD_CreateSound(char *fileName,int mode)
{
FMOD_SOUND *sound;
int error;

	error=FMOD_System_CreateSound(FMODSystem,fileName,mode,NULL,&sound);
	if (error==FMOD_OK)
	{
		return (DWORD) sound;
	}
	
	return 0;
}

char FMOD_Stop(DWORD channel)
{
	return FMOD_Channel_Stop(channel);
}

char FMOD_Pause(DWORD channel,char paused)
{
	return FMOD_Channel_SetPaused(channel,paused);
}

DWORD FMOD_GetLength(DWORD sound,DWORD timeLength)
{
unsigned int length;

	if (FMOD_Sound_GetLength((FMOD_SOUND *) sound,&length,timeLength)==FMOD_OK)
	{
		return (DWORD) length;
	}

	return 0;
}

char FMOD_SetStreamBufferSize(DWORD bufferSize,DWORD sizeType)
{
	return FMOD_System_SetStreamBufferSize(FMODSystem,bufferSize,sizeType);
}

char FMOD_Update()
{
	return FMOD_System_Update(FMODSystem);
}

DWORD FMOD_GetFrequency(DWORD channel)
{
float freq;
	
	if (FMOD_Channel_GetFrequency((FMOD_CHANNEL *) channel,&freq)!=FMOD_OK)
	{
		freq=(float) 0.0;
	}

	return (DWORD) freq;
}

DWORD FMOD_Spectrograph5(DWORD channel,DWORD diffValue,char *storeSpec,DWORD SPECHEIGHT,DWORD BANDS)
{
register int b0,x,sc,b1,y,loop;
float fft[3][FFT_SIZE];
//float fft[1024];
float sum;
DWORD	result;

	result=0;
	if (FMOD_Channel_GetSpectrum((FMOD_CHANNEL *) channel,&fft[0][0],FFT_SIZE,0,FMOD_DSP_FFT_WINDOW_TRIANGLE)==FMOD_OK &&
		FMOD_Channel_GetSpectrum((FMOD_CHANNEL *) channel,&fft[1][0],FFT_SIZE,1,FMOD_DSP_FFT_WINDOW_TRIANGLE)==FMOD_OK)
	{
		for (x=0; x<FFT_SIZE; x++)
		{
			fft[2][x]=(fft[0][x]+fft[1][x])/2.0;
		}

		b0=0;
		for (x=0;x<BANDS;x++) 
		{
			sum=0.0;
			
			b1=pow(2,x*10.0/(BANDS-1));
			if (b1>=FFT_SIZE) 
			{
				b1=FFT_SIZE-1;
			}
			
			if (b1<=b0) 
			{
				b1=b0+1; // make sure it uses at least 1 FFT bin
			}
			
			sc=10+b1-b0;
			for (;b0<b1;b0++) 
			{
				sum+=fft[2][1+b0];
			}
			
			y=(int) ((sqrt(sum/log10(sc))*1.7*SPECHEIGHT)-4.0); // scale it
			y=(y>SPECHEIGHT ? SPECHEIGHT : \
				y<0 ? 0 : y); 
			
			*(storeSpec+x)=(char) y;
			
			if (labs(diff[x]-y)>diffValue)
			{
				diff[x]=y;
				result=(x==0 ? result | 1 : \
						x==1 ? result | 2 : \
						x==2 ? result | 4 : result | 8);
			}
		}
	}

	return result;
}


void BASS_Spectrograph1(DWORD channel,DWORD SPECWIDTH,DWORD SPECHEIGHT,char *specBuff)
{
register int c,x,v,y,channels,loop;
float *buf;
float fft[FFT_SIZE];

	if (specBuff==NULL)	return;

	memset(specBuff,(char) 0,SPECWIDTH*SPECHEIGHT);
	if (FMOD_System_GetSoftwareFormat(FMODSystem,NULL,NULL,&channels,NULL,NULL,NULL)==FMOD_OK)
	{
		for (loop=0; loop<2; loop++)
		{
			if (FMOD_System_GetWaveData(FMODSystem,&fft,FFT_SIZE,loop)==FMOD_OK)
			{
				for (x=0; x<SPECWIDTH; x++)
				{
					v=(1-fft[x])*SPECHEIGHT/2;

					if (v<0)
					{
						v=0;
					}
					else
					if (v>SPECHEIGHT)
					{
						v=SPECHEIGHT;
					}

					if (!x) 
					{
						y=v;
					}
					
					do { // draw line from previous sample...
						if (y<v) 
						{
							y++;
						}
						else 
						if (y>v) 
						{
							y--;
						}
							
						specBuff[y*SPECWIDTH+x]=(loop==0 ? 127 : 1); 
					} while (y!=v);
				}
			}
		}
	}
}


As you can see, the spectrograph code has been more or less retained from the BASS system.

This is the set of externs - its not complete.

Extern
	Function FMOD_Initialise()
	Function FMOD_Close()
	Function FMOD_Release()
	Function FMOD_CreateStream(fileName:Byte Ptr,mode:Int)
	Function FMOD_PlaySound(channelID:Int,handle:Int,paused:Byte)
	Function FMOD_GetChannelPosition(channel:Int,timeType:Int)
	Function FMOD_SetVolume(channel:Int,volume:Int)
	Function FMOD_CreateSound(fileName:Byte Ptr,mode:Int)
	Function FMOD_ChannelIsPlaying(channel:Int)
	Function FMOD_Stop(channel:Int)
	Function FMOD_Pause(channel:Int,paused:Byte)
	Function FMOD_GetLength(sound:Int,timeLength:Int)
	Function FMOD_SetStreamBufferSize(bufferSize:Int,sizeType:Int)
	Function FMOD_ChannelSetPosition(channel:Int,position:Int,sizeType:Int)
	Function FMOD_Update()
	Function FMOD_GetFrequency(channel:Int)
	Function FMOD_Spectrograph5(channel:Int,diffValue:Int,storeSpec:Byte Ptr,SPECHEIGHT:Int,BANDS:Int)
	Function BASS_Spectrograph1(channel:Int,SPECWIDTH:Int,SPECHEIGHT:Int,specBuff:Byte Ptr)
	Function FMOD_ClearDiff()
EndExtern


And the constants :

' Timing constants
Const FMOD_TIMEUNIT_MS:Int=  				$1
Const FMOD_TIMEUNIT_PCM:Int=  				$2
Const FMOD_TIMEUNIT_PCMBYTES:Int=  			$4
Const FMOD_TIMEUNIT_RAWBYTES:Int=  			$8
Const FMOD_TIMEUNIT_MODORDER:Int=  			$100
Const FMOD_TIMEUNIT_MODROW:Int=  			$200
Const FMOD_TIMEUNIT_MODPATTERN:Int=  		$400
Const FMOD_TIMEUNIT_SENTENCE_MS:Int=  		$10000
Const FMOD_TIMEUNIT_SENTENCE_PCM:Int=  		$20000
Const FMOD_TIMEUNIT_SENTENCE_PCMBYTES:Int=  $40000
Const FMOD_TIMEUNIT_SENTENCE:Int=  			$80000
Const FMOD_TIMEUNIT_SENTENCE_SUBSOUND:Int=  $100000
Const FMOD_TIMEUNIT_BUFFERED:Int=  			$10000000

Const FMOD_CHANNEL_FREE:Int=-1
Const FMOD_CHANNEL_REUSE:Int=-2

Const FMOD_DEFAULT:Int= 			£0
Const FMOD_LOOP_OFF:Int=  			$1
Const FMOD_LOOP_NORMAL:Int=  		$2
Const FMOD_LOOP_BIDI:Int=  			$4
Const FMOD_2D:Int=  				$8
Const FMOD_3D:Int=  				$10
Const FMOD_HARDWARE:Int=  			$20
Const FMOD_SOFTWARE:Int=  			$40
Const FMOD_CREATESTREAM_:Int=  		$80
Const FMOD_CREATESAMPLE:Int=  		$100
Const FMOD_CREATECOMPRESSEDSAMPLE:Int=$200
Const FMOD_OPENUSER:Int=  			$400
Const FMOD_OPENMEMORY:Int=  		$800
Const FMOD_OPENMEMORY_POINT:Int=  	$10000000
Const FMOD_OPENRAW:Int=  			$1000
Const FMOD_OPENONLY:Int=  			$2000
Const FMOD_ACCURATETIME:Int=  		$4000
Const FMOD_MPEGSEARCH :Int= 		$8000
Const FMOD_NONBLOCKING:Int=  		$10000
Const FMOD_UNIQUE:Int=  			$20000
Const FMOD_3D_HEADRELATIVE:Int=  	$40000
Const FMOD_3D_WORLDRELATIVE:Int=  	$80000
Const FMOD_3D_LOGROLLOFF:Int=  		$100000
Const FMOD_3D_LINEARROLLOFF:Int=  	$200000
Const FMOD_3D_CUSTOMROLLOFF:Int=  	$4000000
Const FMOD_3D_IGNOREGEOMETRY:Int=  	$40000000
Const FMOD_CDDA_FORCEASPI:Int=  	$400000
Const FMOD_CDDA_JITTERCORRECT:Int=  $800000
Const FMOD_UNICODE:Int=  			$1000000
Const FMOD_IGNORETAGS:Int=  		$2000000
Const FMOD_LOWMEM:Int=  			$8000000
Const FMOD_LOADSECONDARYRAM:Int=  	$20000000

' Error nunbers
Const FMOD_OK:Int=0
Const FMOD_ERR_ALREADYLOCKED:Int=1
Const FMOD_ERR_BADCOMMAND:Int=2
Const FMOD_ERR_CDDA_DRIVERS:Int=3
Const FMOD_ERR_CDDA_INIT:Int=4
Const FMOD_ERR_CDDA_INVALID_DEVICE:Int=5
Const FMOD_ERR_CDDA_NOAUDIO:Int=6
Const FMOD_ERR_CDDA_NODEVICES:Int=7
Const FMOD_ERR_CDDA_NODISC:Int=8
Const FMOD_ERR_CDDA_READ:Int=9
Const FMOD_ERR_CHANNEL_ALLOC:Int=10
Const FMOD_ERR_CHANNEL_STOLEN:Int=11
Const FMOD_ERR_COM:Int=12
Const FMOD_ERR_DMA:Int=13
Const FMOD_ERR_DSP_CONNECTION:Int=14
Const FMOD_ERR_DSP_FORMAT:Int=15
Const FMOD_ERR_DSP_NOTFOUND:Int=16
Const FMOD_ERR_DSP_RUNNING:Int=17
Const FMOD_ERR_DSP_TOOMANYCONNECTIONS:Int=18
Const FMOD_ERR_FILE_BAD:Int=19
Const FMOD_ERR_FILE_COULDNOTSEEK:Int=20
Const FMOD_ERR_FILE_DISKEJECTED:Int=21
Const FMOD_ERR_FILE_EOF:Int=22
Const FMOD_ERR_FILE_NOTFOUND:Int=23
Const FMOD_ERR_FILE_UNWANTED:Int=24
Const FMOD_ERR_FORMAT:Int=25
Const FMOD_ERR_HTTP:Int=26
Const FMOD_ERR_HTTP_ACCESS:Int=27
Const FMOD_ERR_HTTP_PROXY_AUTH:Int=28
Const FMOD_ERR_HTTP_SERVER_ERROR:Int=29
Const FMOD_ERR_HTTP_TIMEOUT:Int=30
Const FMOD_ERR_INITIALIZATION:Int=31
Const FMOD_ERR_INITIALIZED:Int=32
Const FMOD_ERR_INTERNAL:Int=33
Const FMOD_ERR_INVALID_ADDRESS:Int=34
Const FMOD_ERR_INVALID_FLOAT:Int=35
Const FMOD_ERR_INVALID_HANDLE:Int=36
Const FMOD_ERR_INVALID_PARAM:Int=37
Const FMOD_ERR_INVALID_SPEAKER:Int=38
Const FMOD_ERR_INVALID_VECTOR:Int=39
Const FMOD_ERR_IRX:Int=40
Const FMOD_ERR_MEMORY:Int=41
Const FMOD_ERR_MEMORY_IOP:Int=42
Const FMOD_ERR_MEMORY_SRAM:Int=43
Const FMOD_ERR_MEMORY_CANTPOINT:Int=44
Const FMOD_ERR_NEEDS2D:Int=45
Const FMOD_ERR_NEEDS3D:Int=46
Const FMOD_ERR_NEEDSHARDWARE:Int=47
Const FMOD_ERR_NEEDSSOFTWARE:Int=48
Const FMOD_ERR_NET_CONNECT:Int=49
Const FMOD_ERR_NET_SOCKET_ERROR:Int=50
Const FMOD_ERR_NET_URL:Int=51
Const FMOD_ERR_NOTREADY:Int=52
Const FMOD_ERR_OUTPUT_ALLOCATED:Int=53
Const FMOD_ERR_OUTPUT_CREATEBUFFER:Int=54
Const FMOD_ERR_OUTPUT_DRIVERCALL:Int=55
Const FMOD_ERR_OUTPUT_FORMAT:Int=56
Const FMOD_ERR_OUTPUT_INIT:Int=57
Const FMOD_ERR_OUTPUT_NOHARDWARE:Int=58
Const FMOD_ERR_OUTPUT_NOSOFTWARE:Int=59
Const FMOD_ERR_PAN:Int=60
Const FMOD_ERR_PLUGIN:Int=61
Const FMOD_ERR_PLUGIN_MISSING:Int=62
Const FMOD_ERR_PLUGIN_RESOURCE:Int=63
Const FMOD_ERR_RECORD:Int=64
Const FMOD_ERR_REVERB_INSTANCE:Int=65
Const FMOD_ERR_SUBSOUNDS:Int=66
Const FMOD_ERR_SUBSOUND_ALLOCATED:Int=67
Const FMOD_ERR_TAGNOTFOUND:Int=68
Const FMOD_ERR_TOOMANYCHANNELS:Int=69
Const FMOD_ERR_UNIMPLEMENTED:Int=70
Const FMOD_ERR_UNINITIALIZED:Int=71
Const FMOD_ERR_UNSUPPORTED:Int=72
Const FMOD_ERR_UPDATE:Int=73
Const FMOD_ERR_VERSION:Int=74
Const FMOD_ERR_EVENT_FAILED:Int=75
Const FMOD_ERR_EVENT_INTERNAL:Int=76
Const FMOD_ERR_EVENT_INFOONLY:Int=77
Const FMOD_ERR_EVENT_MAXSTREAMS:Int=78
Const FMOD_ERR_EVENT_MISMATCH:Int=79
Const FMOD_ERR_EVENT_NAMECONFLICT:Int=80
Const FMOD_ERR_EVENT_NOTFOUND:Int=81


Some test code (you'll need a modified BMK to compile it) :

Import "-LC:\BlitzMax\FightTune"
Import "-lfmodex"
'Import "-lz"

Import "FMod.c"

Extern
	Function FMOD_Initialise()
	Function FMOD_Close()
	Function FMOD_CreateStream(fileName:Byte Ptr,mode:Int)
	Function FMOD_PlaySound(channelID:Int,handle:Int,paused:Byte)
	Function FMOD_GetChannelPosition(channel:Int,timeType:Int)
	Function FMOD_SetVolume(channel:Int,volume:Int)
	Function FMOD_CreateSound(fileName:Byte Ptr,mode:Int)
	Function FMOD_Update()
EndExtern

Local handle:Int
Local handl2:Int
Local channel:Int
Local channel2:Int
Local sound:Int
Local sound2:Int

Print "FMod Initialise:"+FMOD_Initialise()
'handle=FMOD_CreateStream("LEVELS\Test\End Of Century [No. 9].mp3",0)
'handle2=FMOD_CreateStream("LEVELS\Test\End Of Century [No. 9].mp3",0)

sound=FMOD_CreateSound("LEVELS\Test\End Of Century [No. 9].mp3",0)
sound2=FMOD_CreateSound("LEVELS\Test\End Of Century [No. 9].mp3",0)

Print "Stream Handle :"+sound
Print "Stream Handle 2:"+sound2
channel=FMOD_PlaySound(1,sound,False)
FMOD_Update()
WaitKey
'WaitKey
'Print "Stream Handle 2:"+sound2
channel2=FMOD_PlaySound(2,sound2,False)
FMOD_Update()
Print "Channel Handle :"+channel
Print "Channel Handle 2:"+channel2

While Not KeyHit(KEY_ESCAPE)
	FMOD_Update()
	'Print FMOD_GetChannelPosition(channel,1)
EndWhile

WaitKey
FMOD_Close()
End


So far I haven't had a problem with the Linux version of FMOD, especially after working out how to get more than one sound to play at a time.

By the way, "-L", doesn't like spaces in the path...

can you use a guide, how to install and what I need to do in the BlitzMax Tutorials forum?

It nice to see I got some good timing, since I just have installed Linux and got most of my app (MultiJuke, a jukebox application) converted, but its still missing the soundpart (do actuelly only need one music file playing at the same time).

I like to have Linux (I use BASS on Windows) version to work, so how do I with the C file and what is modified in the BMK?

For the best, please write a guide in the guide forum.

... and no I do not need all these effect things yet.

Got a guide up and running...

Good going, MrTAToad :) If you can get the mod music file functionality to work in Mac, I'd definitely make use of it.

Hope it goes well...

MOD music should usable as is.

Anyone verify this works on a mac ?

Do you mean FMOD or MOD ?

I hope you don't mind, but I added two commands and made this into a module. Thanks a lot , MrTAToad for bringing this to blitzmax. http://www.savefile.com/files/1042676

Thats okay - dont forget to make sure it works across all three OS's :)

I'm pretty sure it will. If it worked before on the other OS's, then there shouldn't be a problem. I commented the "#define Linux" out because I didn't exactly know what they were for =\. Now I do, but it shouldn't be too much of an issue. Again, thanks a million for porting this to Blitz.

No problem...

Me again! :)

I've been away from coding for a while and am setting up a fresh installation of Blitz. I didn't take proper time to set FMod up before, and now I'm struggling to understand exactly how to get it to work. I've browsed the "FMod - The use and application of..." thread but nothing there really helped.

So far I've:
* Installed BlitzMax and updated to v1.28
* Installed MinGW 3.1.0 and can compile C / build modules
* Installed the latest version of FMod Ex
* Copied MrTAToad's fmod.c / fmodconstants.bmx files to my test project folder
* Edited fmod.c with the correct install path of fmod.h

My quick 'n' dirty test program:
Import "-LG:\Programming\BlitzWork\fmodtest"
Import "-lfmodex"
'Import "-lz"

Import "fmod.c"
Import "fmodconstants.bmx"

Extern
	Function FMOD_Initialise()
	Function FMOD_Close()
EndExtern

Print "Initialising FMod..."
Print FMOD_Initialise()

FMOD_Close()

End

Trying to compile this program gives this error:
Building test
Compiling:fmod.c
Compiling:fmodconstants.bmx
flat assembler  version 1.66
3 passes, 14005 bytes.
Compiling:test.bmx
flat assembler  version 1.66
3 passes, 13498 bytes.
Linking:test.debug.exe
G:/Programming/BlitzMax/bin/ld.exe: cannot find -lfmodex
Build Error: Failed to link G:/Programming/BlitzWork/fmodtest/test.debug.exe
Process complete

Could someone please help put me out of my misery? :(

This thread is just getting ridiculously long now!

Someone really needs to start a new thread with details and downloads of all the latest source/mods and how exactly to get them to work on each of the OS's.

I did get the Windows version working a while ago, but never did get it to work on OS X (PPC or Intel). The thought of reading a 270-odd post thread to figure out the details just puts me off, so I now just put up with the built-in audio system, which is not exactly ideal :o(

Prospero, change import "-lfmodex" to import "fmodex.a". And make sure fmodex.a is in your lib folder.

Cheers, that seemed to do the trick! (although for the benefit of any other folks reading this thread, the file needed is "libfmodex.a" not "fmodex.a" :)

the compiler cannot find the following...

fmod.release.win32.x86.a

Can anyone please help me, thanks.
Jeff.

Is your pathing correct ?

For Fight Tune, I used :

?Win32
Import "-Lx:\programming\BlitzMax\FightTune"
Import "-lfmodex"
Import "FMod.c"
?MacOs
Import "-L/Users/nicholaskingsley/Documents/BlitzMax/FightTune"
Import "-lfmodex"
Import "-lz"
Import "/Users/nicholaskingsley/Documents/BlitzMax/FightTune/FMod.c"
?Linux
Import "-L/home/nicholas/Desktop/fmodapi40623linux/api/lib/"
Import "-lfmodex"
'Import "-lz"
Import "/home/nicholas/Desktop/BlitzMax/FightTune/FMOD.c"


I know this thread is dead, but maybe some fmod3.75 zombies still move around? ;)

Has anyone ever streamed an internet radio stream (e.g. http://194.158.114.68:5000) and detected the meta data (such as server name, station name, current title) sent with it?

There's a FSOUND_Stream_GetTagField command in the docs, but I'm not sure how to make use of it.

Graphics 800,600,0
FSOUND_Init(44100, 32,FSOUND_INIT_ACCURATEVULEVELS)

Global url:String="http://194.158.114.68:5000"
music=FSOUND_Stream_Open(url,FSOUND_STREAM_NET,0,0)
FSOUND_Stream_Play(FSOUND_FREE,music)

Repeat
	Cls()	
	DrawText "Streaming radio @ "+url,10,10	
	If KeyHit(KEY_SPACE)	
		DrawText(FSOUND_Stream_Stop(music),10,30)		
	EndIf
	Flip()	
Until KeyHit(KEY_ESCAPE) Or id=259

FSOUND_Stream_Close(music)
FSOUND_Close()

End


Why is this thread no longer sticky btw?

Anyone here? :o)

Alot of threads got unstickied (even the "Threaded BlitzMax!" thread!!)