Author Topic: FMod for .WAV, .MP2, .MP3, .OGG, .RAW  (Read 15068 times)

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4977
  • O Rly?
    • View Profile
Update: 20.08.08
NOW: Version 1.0 !


Features:
  • load .WAV, .MP2, .MP3, .OGG, .RAW -files and play it.
  • get current time in minutes/seconds by BYREF ( FM_GetTime(Samplehandle, BYREF minutes, BYREF seconds)
  • get spectrum data ( FM_DSPGetSpectrum(spec[], num_Specs = 256)  // for mixrate 44100: DIM Spec[256] , num_specs = 256 !)
  • get songname
  • set volume
  • get IsPlaying ( FM_IsPlaying(Samplehandle) )
Next Features:
  • set loops
  • pause-function
  • set FX <---- thats a hard part !!!
  • Linux/Mac Support


Screenshot:



like this:


Code: GLBasic [Select]
SYSTEMPOINTER TRUE

LOCAL Init = FM_Init()


LOCAL Sample = FM_LoadSample("DHS - IK+ (Chemical Stadium Remix).mp3",FSOUND_NORMAL)
LOCAL Play = FM_PlaySound(Sample)
LOCAL FFT = FM_DSPGetFFTUnit()
FM_DSPSetActive(FFT)
       
LOCAL Spec[]
DIM Spec[256]

LOCAL Vol = 255





WHILE TRUE

LOCAL minutes, seconds,i

        INC Vol, MOUSEAXIS(2)*5
        IF Vol > 255 THEN Vol = 255
        IF Vol < 0 THEN Vol = 0
       
        FM_GetTime(Sample, minutes, seconds)

        PRINT "FMod-Wrapper v1.0, only for GLBasic.com!",10,10
        PRINT "by Schranz0r", 10,30
        PRINT "Songname: "+FM_GetName$(Sample),10,50
        PRINT "IsPlaying: "+FM_IsPlaying(Sample),10,70
        PRINT "Volume(use mouseweel): "+Vol,10,90
        PRINT "Samplelength: "+FM_GetLength(Sample),10,110
        PRINT "CurrentPos: "+FM_GetCurrentPosition(Sample),10,130
        PRINT "Song in Sec: "+FM_GetLengthInSeconds(Sample),10,150
        PRINT "Current Position in Sec: "+FM_GetCurrentPositionInSeconds(Sample),10,170
       
        IF seconds < 10
                PRINT "Time: "+ minutes+":0"+seconds, 10,190
        ELSE
                PRINT "Time: "+ minutes+":"+seconds, 10,190
        ENDIF
       
        FM_DSPGetSpectrum(Spec[])
       
        FOR i = 0 TO LEN(Spec[])-1
                IF Spec[i] > 0.5 THEN Spec[i] = 0.5
                IF Spec[i] < 0 THEN Spec[i] = 0
                DRAWLINE 100+i, 400, 100+i, 400-Spec[i]*500, RGB(i, 255-i, 0)
        NEXT
       
        FM_SetVolume(Sample,Vol)

        IF FM_IsPlaying(Sample) AND MOUSEAXIS(3) THEN FM_StopSound(Sample)
        IF FM_IsPlaying(Sample) = 0 AND MOUSEAXIS(4) THEN FM_PlaySound(Sample)


SHOWSCREEN
WEND
FM_Close()
END

You can see, thats very simple (thats the goal). My wrapper contains a channel, filename and soundfile handling!

Download it NOW

[attachment deleted by admin]
« Last Edit: 2008-Aug-20 by Schranz0r »
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 909
    • View Profile
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #1 on: 2008-Aug-15 »
Wow! Klasse Sache. ... I mean class thing  =D

Offline BumbleBee

  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 891
    • View Profile
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #2 on: 2008-Aug-15 »
Excellent.  :good:

Cheers
The day will come...

CPU Intel(R) Core(TM) i5-3570k, 3.4GHz, AMD Radeon 7800 , 8 GB RAM, Windows 10 Home 64Bit

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4977
  • O Rly?
    • View Profile
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #3 on: 2008-Aug-15 »
ist jetzt schon ein wenig weiter :)
evtl kommt morgen ein Update ;)
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Sebastian

  • Guest
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #4 on: 2008-Aug-18 »
Schranz0r, was planst dunoch für den Wrapper? Funktionen mit denen man diverse Aspekte der geladenen Musik auslesen und verwerten kann (Stichwort: Musikspiele) wären toll! Umso mehr, da z.B. auch Guitar Hero ja Fmod benutzt und demenstprechende Funktionen enthalten sein müssten. Ich hab mich schon an irrKlang versucht aber so viel OOP  :S

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4977
  • O Rly?
    • View Profile
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #5 on: 2008-Aug-18 »
Man kann wohl den Höhenausschlag abfragen stichwort Audiosurf :D
Muss mal gucken wie das genau geht:)

Bin schon ein wenig weiter, werde evtl morgen nochmal ein Update raufladen ;)
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Sebastian

  • Guest
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #6 on: 2008-Aug-18 »
Genau darauf wollte ich hinaus. Hab nämlich eine Idee für ein Musikspiel und da käme mir ein Fmod Wrapper natürlich grade recht  :whistle:

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1752
    • View Profile
    • Homepage
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #7 on: 2008-Aug-18 »
Looking good!
Will I be able to load an mp3 file and start playing at any location inside the mp3?

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4977
  • O Rly?
    • View Profile
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #8 on: 2008-Aug-18 »
yes ;)

You can set a start-endpoint for a loop
ect..
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1752
    • View Profile
    • Homepage
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #9 on: 2008-Aug-18 »
Great, I want an audiobook player than can remember where you were on quit. Is it running on GP2X? ;-)

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4977
  • O Rly?
    • View Profile
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #10 on: 2008-Aug-19 »
no, i wrapp the fmod.dll :/
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1752
    • View Profile
    • Homepage
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #11 on: 2008-Aug-19 »
ah, ok. Still interesting for listening to audiobooks on the PC but sadly not possible for GP2X then. Looking forward for the finnished version :-)

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4977
  • O Rly?
    • View Profile
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #12 on: 2008-Aug-20 »
UPDATE! See first Post ;)
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Sebastian

  • Guest
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #13 on: 2008-Aug-20 »
Schranz0r, wenn das auch noch auf dem Pandora läuft... gut, ein Held bist du eh schon, aber:  :nw:

Offline acristo

  • Mr. Drawsprite
  • **
  • Posts: 51
    • View Profile
Re: FMod for .WAV, .MP2, .MP3, .OGG, .RAW
« Reply #14 on: 2008-Aug-21 »
just awesome...   :S  :good: