It is currently Mon Apr 12, 2021 1:48 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Ver #2 :Simple sound Player using BASS [Stereo & Mono Files]
PostPosted: Fri Jun 15, 2018 6:37 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3941
Based on :
The discussion forum by Martin Verlaan
https://www.purebasic.fr/english/viewtopic.php?f=13&t=70823
And code by :
Roger Hهgensen , Celtic88(c) & wilbert

You have To include :
1- "bass.pbi"
2- bass.dll
3- bassflac.dll
4- bass_ac3.dll
5- basswma.dll

Feel free to update or add new functions

Code:
UsePNGImageDecoder()
IncludeFile "bass.pbi"
DisableDebugger

Global chans

Structure Sample
  l.w
  r.w
EndStructure

Procedure UpdateWaveImage(PBImage, *SampleData.Sample, SampleCount)
  Protected.i Width, Height, X, VOffsetL, VOffsetR, Mul
  Protected.i SamplesPerPixel, Sample
  Protected.w MinL, MaxL, MinR, MaxR
  Protected.w MinL_, MaxL_, MinR_, MaxR_
  If *SampleData And SampleCount
    StartDrawing(ImageOutput(PBImage))
    Width = OutputWidth() : Height = OutputHeight()
    If chans = 1
      VOffsetL = Height >> 1
    Else
      VOffsetL = Height >> 2 : VOffsetR = VOffsetL + Height >> 1
    EndIf   
    Mul = (VOffsetL * $19999) >> 16
    If chans = 1
      Mul = (VOffsetL * $19999) >> 17
    EndIf
    Box(0, 0, Width, Height, $ffe0e0e0)
    Line(0, VOffsetL, Width, 1, $ffa0a0a0)
    If chans = 2
      Line(0, VOffsetR, Width, 1, $ffa0a0a0)
    EndIf
    SamplesPerPixel = (SampleCount + Width - 1) / Width
    MinL = $7fff : MaxL = $8000 : MinR = $7fff : MaxR = $8000
    MinL_ = $8000 : MaxL_ = $7fff : MinR_ = $8000 : MaxR_ = $7fff
    While SampleCount
      If *SampleData\l < MinL : MinL = *SampleData\l : ElseIf *SampleData\l > MaxL : MaxL = *SampleData\l : EndIf
      If chans = 2
        If *SampleData\r < MinR : MinR = *SampleData\r : ElseIf *SampleData\r > MaxR : MaxR = *SampleData\r : EndIf
      EndIf
      *SampleData + 4
      Sample + 1 : SampleCount - 1
      If Sample = SamplesPerPixel Or SampleCount = 0
        MinL = (MinL * Mul) >> 16 : MaxL = (MaxL * Mul) >> 16
        MinR = (MinR * Mul) >> 16 : MaxR = (MaxR * Mul) >> 16
        If MinL_ > MaxL : LineXY(X, VOffsetL - MinL_, X, VOffsetL - MaxL, $ffff8000) : EndIf
        If MaxL_ < MinL : LineXY(X, VOffsetL - MaxL_, X, VOffsetL - MinL, $ffff8000) : EndIf
        If chans = 2
          If MinR_ > MaxR : LineXY(X, VOffsetR - MinR_, X, VOffsetR - MaxR, $ffff8000) : EndIf
          If MaxR_ < MinR : LineXY(X, VOffsetR - MaxR_, X, VOffsetR - MinR, $ffff8000) : EndIf
        EndIf
        LineXY(X, VOffsetL - MinL, X, VOffsetL - MaxL, $ffff8000)
        If chans = 2
          LineXY(X, VOffsetR - MinR, X, VOffsetR - MaxR, $ffff8000)
        EndIf
        MinL_ = MinL : MaxL_ = MaxL : MinR_ = MinR : MaxR_ = MaxR
        MinL = $7fff : MaxL = $8000 : MinR = $7fff : MaxR = $8000
        X + 1 : Sample = 0
      EndIf
    Wend
    StopDrawing()
  EndIf
EndProcedure

Procedure sizeCB()
  ww = WindowWidth(0)
  hh = WindowHeight(0)
  ResizeGadget(0,10,10,ww-60,hh-70)
  ResizeGadget(2,ww-28,hh/2-270/2,18,200)
  ResizeGadget(3,10,hh-50,110,40)
  ResizeGadget(10,ww/2-100,hh-50,200,18)
EndProcedure

Procedure vsizeCB()
  vs = GetGadgetState(2)
  ResizeGadget(1,0,0,ww-60,hh-70)
  ResizeImage(WaveImage,#PB_Ignore,ImageHeight(WaveImage)*vs)
  SetGadgetState(1,ImageID(WaveImage))
EndProcedure

CatchImage(0,?open)
CatchImage(1,?play)
CatchImage(2,?pause)
CatchImage(3,?stop)

OpenWindow(0, 0, 0, 660, 370, "Waveform", #PB_Window_SystemMenu | #PB_Window_MaximizeGadget| #PB_Window_ScreenCentered|#PB_Window_SizeGadget)
WindowBounds(0,660,370,#PB_Ignore,#PB_Ignore)
WaveImage = CreateImage(#PB_Any, 8192, 275)

ScrollAreaGadget(0, 10, 10, 600, 300, ImageWidth(WaveImage), ImageHeight(WaveImage), 1, #PB_ScrollArea_Flat| #PB_ScrollArea_Center)
  ImageGadget(1, 0, 0, 600, 300, 0)
CloseGadgetList()

ScrollBarGadget  (2, 620, 50,  18, 200 ,1, 10, 2, #PB_ScrollBar_Vertical)

ContainerGadget(3,10,320,110,40,#PB_Container_Flat)
  ImageGadget  (4,5,5,40,20,ImageID(0))
  ImageGadget (5,40,5,40,20,ImageID(1))
  ImageGadget (6,75,5,40,20,ImageID(3))
CloseGadgetList()

ScrollBarGadget  (10, 250, 320, 200, 18 ,0, 200, 30)

BindEvent(#PB_Event_SizeWindow,@sizeCB())
BindGadgetEvent(2,@vsizeCB())

BASS_Init(-1, 44100, 0, 0, #Null)
BASS_PluginLoad("bassflac.dll", #BASS_UNICODE)
BASS_PluginLoad("bass_ac3.dll", #BASS_UNICODE)
BASS_PluginLoad("basswma.dll", #BASS_UNICODE)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      End
     
    Case #PB_Event_Timer
      If channel And BASS_ChannelIsActive(channel) = #BASS_ACTIVE_PLAYING
        pos.q = BASS_ChannelGetPosition(channel,#BASS_POS_BYTE)
        SetGadgetAttribute(0,#PB_ScrollArea_X,pos.q*8192/length.q)
        oldpos.q = pos.q
      ElseIf channel And pos = oldpos
        BASS_ChannelSetPosition(channel,0,#BASS_POS_BYTE)
        SetGadgetAttribute(0,#PB_ScrollArea_X,0)
        SetGadgetState(5,ImageID(1))
        pos.q = 0
      EndIf
     
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 0
          If channel
            If BASS_ChannelIsActive(channel) = #BASS_ACTIVE_PLAYING
              BASS_ChannelPause(channel)
              SetGadgetState(5,ImageID(1))
              play = 1
            EndIf
            x = GetGadgetAttribute(0,#PB_ScrollArea_X)
            pos.q = x*length/8192
            BASS_ChannelSetPosition(channel,pos,#BASS_POS_BYTE)
            If play = 1
              play = 0           
              SetGadgetState(5,ImageID(2))         
              BASS_ChannelPlay(channel, 0)
            EndIf
          EndIf
         
        Case 4
          Select EventType()
            Case #PB_EventType_LeftClick
              If BASS_ChannelIsActive(channel) = #BASS_ACTIVE_PLAYING
                RemoveWindowTimer(0,125)
                BASS_ChannelStop(channel)
                BASS_SampleFree(sample)
                SetGadgetAttribute(0,#PB_ScrollArea_X,0)
                SetGadgetState(5,ImageID(1))
                SetGadgetState(1,0)
                channel = 0
              EndIf                     
              filename.s = OpenFileRequester("","","*.*",0):If filename ="":End 1:EndIf
              sample = BASS_SampleLoad(0, @filename, 0, 0, 65535, #BASS_UNICODE| #BASS_SAMPLE_SOFTWARE)
              info.BASS_SAMPLE
              BASS_SampleGetInfo(sample, @info)
              chans = info\chans
              length.q = info\length
              If chans >= 2
                chans = 2
              EndIf
              Dim Buffer.Sample(Length >> chans)
              BASS_SampleGetData(sample,@buffer())
              UpdateWaveImage(WaveImage, @Buffer(), Length >> chans)
              SetGadgetState(1,ImageID(WaveImage))
              channel = BASS_SampleGetChannel(sample,1)
          EndSelect
         
        Case 5
          Select EventType()
            Case #PB_EventType_LeftClick
              If channel And GetGadgetState(5) = ImageID(1)
                AddWindowTimer(0,125,10)
                SetGadgetState(5,ImageID(2))         
                BASS_ChannelPlay(channel, 0)
              ElseIf channel And GetGadgetState(5) = ImageID(2)
                RemoveWindowTimer(0,125)
                BASS_ChannelPause(channel)
                SetGadgetState(5,ImageID(1))
              EndIf
          EndSelect         
         
        Case 6
          Select EventType()
            Case #PB_EventType_LeftClick
              If BASS_ChannelIsActive(channel) = #BASS_ACTIVE_PLAYING
                RemoveWindowTimer(0,125)
                BASS_ChannelStop(channel)
                BASS_SampleFree(sample)
                SetGadgetAttribute(0,#PB_ScrollArea_X,0)
                SetGadgetState(5,ImageID(1))
                SetGadgetState(1,0)
                channel = 0
              EndIf
          EndSelect
      EndSelect
  EndSelect
ForEver

DataSection
Open:
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
   Data.q $0E0000C40E000073,$00001B0E2B9501C4,$8948544144496104,$C61C5554506D95A5,$905605F770BD977F
   Data.q $B011406C1500D95D,$731A729517A657A4,$751B4A719CB26346,$C7473218A531D274,$E638D585943E3197
   Data.q $4D63A3A98D143698,$A4943A0CA6A6314D,$E0AEB6F10D812438,$7BDEE2C2EEC8BBB2,$BE7AB35972E612FA
   Data.q $9CF739EFCE7FF3DD,$E54D10421247BDFF,$0FCF7DFA371C9287,$C634D3C97B722886,$172B64AE04D08109
   Data.q $C8E93E35A4F9462D,$68D218D17C7B97A6,$813D5CD3E287E501,$C417E615166143ED,$48FBB48C88A53FDD
   Data.q $4AE1EE1BC34086C4,$5FD6D4D50D753D47,$DC4B48C93E151809,$D80BA41757A975B2,$DCE9F3AEBB152958
   Data.q $1815E1EF33189F27,$04A85C212B403208,$26661A428F103001,$9F541537D9F04011,$D73BC58D2333B5FE
   Data.q $4A91EC9406A31F89,$C61897176BBBC684,$A2FA613D4FD0265B,$CE9812762C40216E,$4A19547F94F38E85
   Data.q $BA57C437C3F0B077,$8720E0E2A5FBF580,$04283560D6B95ADF,$2C64A44F9FA20669,$654B6CA769E6D1E4
   Data.q $6A2A55DA9E04E268,$9CBAD292AC6C056F,$E9313ACF315D2E5C,$BC75398A8DB4825E,$5D2639C99974D49F
   Data.q $AA6B9C593309062D,$721C9CB6D9C77CA1,$CDDD700CA08A9577,$3293D358A78F59F6,$E78F403A4809D209
   Data.q $B0364C4938363B26,$068F4886CC2CDBF7,$7C280A730783F9F8,$D8137D49A9A32EA4,$BED376E1C3ED952C
   Data.q $063426133885ECB9,$9CCD25B5E0817074,$EB3B25FF3003F1AF,$E0240D2DF51C4DB7,$979DDAB2BE5939F2
   Data.q $D73F20B3F7ECBA4B,$FABF5C17FCC26712,$7ADCF09ECE2E9503,$1995916149DFBC3E,$891C7E2ABCEAC733
   Data.q $5B33F7F5B172F20E,$86859D939599040E,$C03DB5A13746208A,$F3B44685099B1B7B,$5566C42BAD1C8DAB
   Data.q $F1A417A654347374,$5A67E0394CE731F5,$A10E33AA811DAA6A,$AEA0DE7C7AE2FAF2,$EF645F97EB09D036
   Data.q $92A04C2C469087A1,$55934E701020E199,$1884431C63467195,$B6BE70B5B73B96D9,$A83B47F7D61F075B
   Data.q $6AE826CB459637DC,$D35976371E1C6B16,$08B8C6281D7D3CD0,$A25B9B153F5D4343,$1F933D5569B587C2
   Data.q $BDEE3118DB332418,$6B9376B2115546E1,$6110D62DA240BEBE,$3FFE6AE67137CEC8,$B91AAA0C4AC80006
   Data.q $B25C048480771EC5,$949299E5D5D0D0A2,$DBD10B5CF430896C,$6C14131C02AEF37D,$63715FBF6311B129
   Data.q $6A6C9C314B20D234,$EC308F4BC9CC2DF2,$1577C32FEA95BB7E,$E791A5A595836CB0,$2CB2E3898A075F50
   Data.q $267E9FF781B1A473,$5870B96EFE58B168,$5B11C35614D155DF,$539C65F347D1D5D4,$2359CC108491A9F3
   Data.q $ECE2D9EEB3E5E455,$705ADB1549DE86BB,$0CA1F151F3FB5939,$41639D3FAD863890,$FFFB2CA4FA4F4E56
   Data.q $0D3D52E5689CD782,$3F5DFB6E18F953D9,$D2DDF2F6F2CD2A57,$C13FF58F71C536D5,$3780F6C1F374372F
   Data.q $88968A554F478B33,$6EDEFCD225798000,$5373B25662582E0E,$76AA36A9DCFC15FE,$141ECF8A78EA4F0B
   Data.q $35DCE65775C78667,$40569AA93B5763D2,$1DF376C93B5CD146,$A3E17D8E3EF6CEC1,$4CF178B3329702F1
   Data.q $3FA5EA3EBDBE6895,$EBE652F3EE649567,$C0F3B2D8C9A4F565,$834D16213E226E91,$F8D10EB574837D1B
   Data.q $77852D9746FEB40B,$6862E7F4E7B124C6,$4578CD6180D46B24,$CCC0383D98068632,$21A1763F7EF920F0
   Data.q $C28A8B898A5C668C,$D44407B5350A710F,$1C61D0D2F54FE60F,$4900000000C89CFF,$826042AE444E45
Openend:

play:
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
   Data.q $0E0000C40E000073,$00001B0E2B9501C4,$8948544144498804,$871855536C7D959D,$75656ED76D2F4B9F
   Data.q $58C9B81B716BAB2B,$1884BE544A093207,$8BA1F2A250160120,$3326866858C09532,$43128822518B9980
   Data.q $90D10100C674C282,$C274420CB087CA28,$3E52B18C64D83714,$7BDED76BB6B1B74A,$F7F412DAD83703FC
   Data.q $EF39CF7F7DE73DDF,$553C4108495E737D,$082E77756F5B36EE,$0CAAA1C0E9EE9886,$CE2629DC0AA10217
   Data.q $EF79A25311F2F518,$6290F3C677AE4B3B,$FDD7DCDA27772A01,$A05F949C5E11BD15,$48E36D3274F4747D
   Data.q $CD3AE4474A811526,$5D6D483FAA9C756D,$792DA67B63AF5FB3,$A01450288EA286FD,$9CC760DF742A4ABC
   Data.q $1A39713B9B0F4FC9,$010A370842D0F402,$918186C3A2243400,$8F071360797C11F8,$ABCDD2C6D33975FD
   Data.q $52A4DBA501712FC5,$08CD52D2C961F2A1,$B8AE8447537443E3,$73C624858A180425,$D90AA93F2A37EDBA
   Data.q $05177C46B2DA2CAD,$CF641030A90BEB78,$804746931A25C5DB,$46325033FFFC40F3,$2ABEB6512F7AB41C
   Data.q $DA8A756CCF10F194,$D1776B64B579407E,$451E6194D73E5CE0,$B90CC8A822005680,$B273640C2410C42F
   Data.q $73735A278DCA86B1,$86E0190114EADBC9,$E6EC99A54F698A87,$342E0024065C022C,$169DCB2AEEBCD985
   Data.q $7C054027BC663FC6,$3F1E93016E42645C,$49D605ACA8D8D995,$AEB4B878F5639F65,$F4F4A809026D39EC
   Data.q $19AF3C500B9E3527,$95AD7D7892538980,$8490D209EE194787,$8E3D07C5ABC5D3BB,$3CFCC2C7CFB2EC3C
   Data.q $80D2E6BFC30136A3,$2F21ED400C387084,$8A01EF31997B0E27,$140262E9A5B1DAD7,$ED48F238AD93587C
   Data.q $372D300FECA666EE,$8ADEA83105151B27,$2EC0ED6034285080,$AC5782CABBEE3F37,$28C6D46CC0CCE6BC
   Data.q $77EFDF1B02F8C297,$5BA7A6C63EFD954D,$8304284281512810,$45CB6AA10663E8C1,$658324A8A368ECF6
   Data.q $28793BE4683132AB,$65635DFBF15A6564,$1097A5AF5EB86145,$E80D8E1C37B2DB83,$3F3B0379636104E3
   Data.q $9C582C390DEAC0BD,$B07AF1693467BFDE,$A7436AEDEA8AAAC8,$A255102F876ABE8F,$1F9C6A33D02DCA58
   Data.q $8A0F2DEE4EEDA06F,$FCBB3B5730D59082,$386A89513543A9C9,$26E34FAE9744A282,$DB84C71D9EFA5025
   Data.q $2927E3D7AC777C2D,$EEDEDF51D3ACB709,$1C70F3EE894E6D1D,$E4CEDF79AC066B73,$EFEE3A22C6DBE6D9
   Data.q $8434B2F53D7A0F66,$F61D728B9D8D8D23,$35ADF0191A88A0A8,$43492FE6548AAAC0,$DD494FF8944448D2
   Data.q $ECCB2CB3F025D029,$180D9E3347CF5B3D,$39DF091DBD81C68D,$F43625C591A752D9,$5FAE9A312A2A0D7A
   Data.q $2635C06F9C5D6DED,$D295ACC108491A9F,$0CE61767AB3E4726,$374EEDF1F7AA6C08,$D8E3914A6167946F
   Data.q $945DB84DBBD36B45,$BC1084916C4FBAFC,$4BE7F1715F252E50,$36FB96D991F6C945,$556D542DC39AA58A
   Data.q $A2EDA7F130C673EA,$75A694EF9EB9FFB7,$EB3AA915A287E4DC,$8D7F50DE65FFA683,$713CD9591DFC2B8F
   Data.q $B73381A0C1344AB4,$2E16BB1AF3779A54,$F993FED2F272E833,$E9BC267F54ADA3C9,$5BEF1C4BB13C2823
   Data.q $5E4F4A5673991A8F,$CFA73202D8F54CB9,$BAE9EBF7B96290B1,$9A7B393BAFFEC5D4,$38B578FE79B2B23F
   Data.q $4DEB3FA1CC7EF77F,$564DE75941D5D0C9,$ED58071CD4847C8C,$56E155450D262409,$0EFECE5E96F69057
   Data.q $6183E34D4F68E72D,$F60EF44AFB1DB666,$7D259794D3E8098A,$8246A61EC19987A8,$1BD08A84587CFBE4
   Data.q $4871D3A33812EB70,$E789111BF6A6A3AB,$67D0BBEC7ABC0FF1,$454900000000DF7C,$826042AE444E
playend:

pause:
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
   Data.q $0E0000C40E000073,$00001B0E2B9501C4,$8948544144496F04,$C61465536C7D959D,$B656C7EDEBBDB77F
   Data.q $FB26CC36036541D0,$0C4A017E25069942,$8B2446A251174C92,$304D4CB8B0212881,$310C511A07F64240
   Data.q $241218094E19288B,$4E24201610153826,$151B18E662264C98,$EFBBB6BB6B76BAE8,$119BBBACB463FD7D
   Data.q $E73CF39F79F77FCF,$C992948ABEE7379C,$F82870778E40E1A2,$86E500FF12CE2C5C,$D537C486912934C1
   Data.q $CCCEE63D5D9779CD,$699382372BEEF839,$F3CCC81C34191328,$B0B4BCE84B6C88DD,$E41425DCDF76D2A2
   Data.q $FA0306241E364BDD,$85BDB671B4F72E0D,$05DD8D7623976D53,$8C980CD6B65BD979,$4DDF6A949A9B064C
   Data.q $0B5529D1EC7F2CF6,$F1C45D30CA2560D6,$3C8D132560028821,$3BB7EF648221CC9C,$563C82D5DBF13968
   Data.q $6D41A934FE51B87D,$AAB0DBDE0D2B52A3,$D0DA218B35D33AD6,$C9720C80423A4D09,$E3E1A67E7AE73E62
   Data.q $94DF3B9597BE78A6,$8EA95CFEDE0C98DF,$6EAC1BB59DFAF8C6,$93F7E4C04B9446AB,$A15C0EE9CA2E2A1E
   Data.q $D89E2CF67C534B7E,$2B35360CA54F2755,$E5535BAC5C7DBD79,$A3FFBA5137739D9E,$3388A4E0A0B0EDF0
   Data.q $A4BBBA7FBC34AD9D,$DC02AA32755DB284,$F9DDD323F16DB3F4,$C400280AB9448539,$AECD001FA769A484
   Data.q $6E3B8D000F75FAB0,$60A0643D6A6B84A6,$164A9281E2FE6100,$05BC53B3A0B6783E,$73F7EBC33FEA566C
   Data.q $0C0E0736F3FD7365,$FBAA9D5183C95386,$BA7C3958E770013B,$EF9C521725458014,$2B6FA9AD5BB14A3A
   Data.q $C5B6B6BC7D82F859,$A2B30E1ABE465E5F,$AE25BCE07365CCA2,$00244890A2D2C8A4,$30031259D4D42448
   Data.q $BDB378C208E5A4B0,$1AA9621A19E19794,$810308B8A4B8B289,$3C7880C3573692C4,$01893CFB7E3C400E
   Data.q $7995F9821E731448,$99848D48B7D43E1C,$38BA61122E466337,$9B4E6991D1E1E180,$B0A0890F8C5A4B09
   Data.q $82154F37D2244BC0,$791371048DBB7669,$D2716E303A63E844,$9C5CD5848245D03B,$0C355727E0236DCB
   Data.q $91336ECD07A8408C,$6D7B7474689D2182,$0614801ED1020C8E,$B94C52E1C5EA1FD0,$08C6AA40847E8303
   Data.q $D5864F6C9143077F,$70D8C45C90421244,$86FDBB1D2B462102,$423F80DCE6108231,$EDEF68D3553E1656
   Data.q $749132EA99CDCC0D,$1E690838B1EB76E3,$FFC2C131906188C5,$58AABB4EDD8FD979,$9E52595C19D9D638
   Data.q $1741D4818C60EE6F,$511E61740C212566,$2AAAA0FC1CD059DB,$A2A7C9E0F9DA3B07,$57A440EF4B4B972E
   Data.q $C3C6085D03B9842C,$B4AFA45D2E213DBD,$D97FB2ADABF55682,$9F1B5D2DA3D3E57A,$6B0B766A234E2EAE
   Data.q $DFA0B766CE8E8CB6,$8532A8B00312511A,$B2F34C6B9EDF6327,$2F252915D4A348FD,$E5E171F5AFB2526E
   Data.q $2AA6B94539FCEC9A,$4BB4D1768F5A24EF,$32DDFBE0B29717B4,$1E2CA75B3F5DFA91,$BDE68F3ACD48E7E8
   Data.q $E75FB62FC4BFFDCB,$3A1E22C281916DA3,$554E0F7180FF24DE,$78AFF675FF4CF2AD,$F123BF4D9715A9D5
   Data.q $660644FE69BBC733,$8932797EF4FAA4CC,$AF8795EBE5CC9E9B,$964B05255E79A55D,$7DC2AFF9D73532E7
   Data.q $39C74832FA1C4257,$F2CD9385E22C2D7E,$6F65FD1F09F3D8D2,$D67EC1F500D0CE28,$F37839714F07B9CD
   Data.q $183018606566641D,$E817E3A095DBD18A,$C94FB674CF5E9DFA,$6B5E313217C4F1A1,$C7B15ABE3C648342
   Data.q $A31E91661B1A5987,$13BB481A57261C22,$4DA3F1A6BCE0E69F,$F1A64FA93ED4F5A3,$40E7F08C0FBBC50F
   Data.q $4E454900000000DC,$826042AE44
pauseend:

stop:
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
   Data.q $0E0000C40E000073,$00001B0E2B9501C4,$8948544144490604,$C71465536C6D95A5,$5B2B65F6F4BD777F
   Data.q $CA4E986C0742B2B6,$250C6F89518B21BA,$D11312538BA09706,$3532E2C084890310,$314E3507D96600C1
   Data.q $60C14474C97C4944,$82016105059898D0,$5B6399809904613A,$1DEDBDAC2FAE8CAD,$D2BAE93083F1F7BD
   Data.q $EFFF9CE4F76FFFA1,$2084248F39B9E739,$458CAEB916F6DA9B,$19F1860F2C6A489E,$B14082184084B306
   Data.q $5F91D07C8B765383,$3CD9224667D5EFB4,$81DDF37B6D00A9A4,$5697A78A78EB7891,$F7729CB858EF9AD7
   Data.q $8D4E106041290A62,$1C5DBD1387B06170,$EE507C28B710B9ED,$9403386D7DB6DC2E,$F32E043521D2D801
   Data.q $D7755CCFF703FD71,$802347E824A84C3A,$D8DC147C89800A8E,$D3B4DF27C11C4058,$DE6B3772A1D7F875
   Data.q $25DA680AC87E2CDE,$3269AD3637830935,$44521E8C63CFB5CD,$580A4E0660108EB3,$43B77B699FC1C9C2
   Data.q $ABE28BC77AB1732B,$926A0D491FCBC00C,$2930E4C9BF595E2F,$64BA4FDFB2039CA8,$5B65A45D0818F8EC
   Data.q $166CED0F1E7F3687,$B0F7253A5B002747,$17E63956EBCDB39F,$55FF8D34C0CA86DD,$A6EBEF1C3C36121E
   Data.q $3B552F5E0363CDED,$5AD20E5C032A859B,$9502A8ACA3A95F77,$0EEE548900424021,$C6200C2498B024F2
   Data.q $27DDE965ADE9DC1F,$52AD8097F4FAFBCA,$6D6E2E4182B887CB,$8002418AC56CD279,$804E5CF8BF53AEA4
   Data.q $BE272A07E7CCB673,$7D7E79F88810144D,$D18B1C994557D057,$335DB15B37655D58,$E64C9923C8300097
   Data.q $3A003513CDC6A404,$8C94557C2E855C31,$2B79D4AB8E42B18D,$051226F208E8183D,$4957920272D34D02
   Data.q $DD6A4B3A70E7FBAB,$A8C78E4CBFDFBD7C,$2A549F4089C73399,$74098CC89681D5A6,$591AFEE3C45DCA2A
   Data.q $E3471998B16599D7,$531224EBA532DFC6,$A6D5AE349A924F54,$0D94E20A1330EECB,$D398B1441D142303
   Data.q $027355551D711212,$0F11983A908A6A12,$CAB8D908EBA2095F,$298664B0BC68915F,$4E116CDCE865212D
   Data.q $10BC793EBA1A1200,$0A2B20202829C60A,$F6C54585A1C3C3BD,$68039A7230DD04B4,$2085FBF01322E81A
   Data.q $BEC1C794B2BD0B16,$03BD2CAFAF6AC8BE,$CF69D99E9480FA7D,$7D9965901CAC5009,$BB5447E1EB797A67
   Data.q $A6A9E641D0DCAEDD,$460F0D118C98A392,$25BA6AA2FF167739,$6ABEED4A372B0421,$D6E6C59950DA3F36
   Data.q $FD367E0279DAFED4,$64CE140321D8A5F4,$CA4778F469C78FFB,$FBFBBCCBFF9C7816,$F788B95BD0F74E7E
   Data.q $1754B378FD7586E1,$D7144A1BB5DBE51E,$897BDB3F327FC76C,$1CF70F0AE1E35A77,$9AAB0000D3E710EA
   Data.q $59F1A7B12F46C7A4,$C7E64B7A5559529B,$99CD089EF9D00D0F,$78F5C8E23DB1C34B,$CFF7BA51BF5993C6
   Data.q $EF5E5F296A6B3A21,$62FFB1A9BB69D8A4,$E9C9399C23BBFD94,$2B6914E91D4F0F0A,$2D920BE57F47CA78
   Data.q $B70586CA3225A61A,$FC95995703E95253,$1926895C06181982,$1BFFD02FCCE71FEE,$5D88B33EBCA525C3
   Data.q $04A6BD93E3153F87,$C12D1649CF83D75C,$B1D524A96582648A,$8A02362C20614E18,$EE856677C28A5395
   Data.q $01BF8F3654899FA3,$DAD8782809CBC4EA,$444E454900000000,$826042AE
stopend:
EndDataSection


Edit :Solved the problem for MONO Files
Edit 2 :Modified
Edit 3 :Modified

_________________
Egypt my love


Last edited by RASHAD on Wed Jun 20, 2018 6:28 pm, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Simple sound Player using BASS [Stereo & Mono Files]
PostPosted: Sat Jun 16, 2018 9:56 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Sep 17, 2015 3:39 pm
Posts: 147
is very good, I liked it :)

thank to you and wilbert (c).

_________________
interested in Cybersecurity..


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple sound Player using BASS [Stereo & Mono Files]
PostPosted: Sun Jun 17, 2018 12:36 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jun 24, 2006 3:29 am
Posts: 274
Location: Edinburgh, Scotland.
RASHAD wrote:
You have To include :
1- "bass.pbi"
2- bass.dll
3- bassflac.dll
4- bass_ac3.dll
5- basswma.dll


All in (source) root level...? I get:

Code:
[COMPILER] Line 105: BASS_Init() is not a function, array, list, map or macro.

_________________
Proud supporter of PB! * Musician * C64/6502 Freak


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple sound Player using BASS [Stereo & Mono Files]
PostPosted: Sun Jun 17, 2018 1:05 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3941
Hi CELTIC88
Thanks mate
UN4SEEN BASS is almost complete and complicated audio software
And this is the first time I been informed about it
Previous post updated

Hi oreopa
Download the proper BASS 2.4 from UN4SEEN
Also use the next "bass.pbi" file

"bass.pbi"
Code:
;   BASS 2.4 C/C++ header file
;   Copyright (c) 1999-2014 Un4seen Developments Ltd.
;
;   See the BASS.CHM file for more detailed documentation
;
;   BASS v2.4.11.x Windows include for PureBasic v5.31
;   C to PB adaption by Roger Hهgensen, 2015-03-23, http://forums.purebasic.com/
;
;   Changes from last update to the PB include files:
;   Things have been moved around some to make maintenance a little easier.
;   Some of the macros and assert stuff was a little broken, these have been fixed and moved into bass_test.pb
;   BASS_ChannelSetAttributeEx() and BASS_ChannelGetAttributeEx(), BASS_ChannelGetLevelEx() added.
;   BASS_MusicLoad() and BASS_SampleLoad() had the wrong number of parameters, missing freq.l and max.l respectively.
;   Several constants have been added.
;   Special wrappers, file/memory loading macros and prototypes have been removed, definitions/parameters should now match what is in the BASS manual.
;   All Unicode prototypes and compiler exceptions removed, this brings the include closer to the original BASS.h file.
;
;   General changes when porting from bass.h to bass.pbi:
;   As much of the non-Windows platform stuff is kept as possible (iOS, Windows CE, Linux, MacOS) even if PureBasic do not support all those platforms.
;   Windows spesific stuff has compiletime check and inclusion to make the include itself as neutral as possible and match BASS.h where possible.
;  MacOS and Linux alternatives are left where encountered, some fiddling around may be needed though.
;   Any callback definitions are retained but commented out so you can see how they should be made.
;   Some C stuff has been dropped when not needed or an alternative implementation added instead.

;C to PB porting hints:
;PureBasic has no direct match for C like typedefs, just treat these as longs instead.
;TRUE is 1 (#TRUE)
;FALSE is 0 (#FALSE)
;BYTE is a byte
;WORD is a word
;DWORD is a long
;QWORD is a quad
;BOOL is a long
;HMUSIC is a long,   MOD music handle
;HSAMPLE is a long,   sample handle
;HCHANNEL is a long,   playing sample's channel handle
;HSTREAM is a long,   sample stream handle
;HRECORD is a long,   recording handle
;HSYNC is a long,      synchronizer handle
;HDSP is a long,      DSP handle
;HFX is a long,      DX8 effect handle
;HPLUGIN is a long,   Plugin handle

;////////////////////////////////////
;          Modified by Celtic88(c)
;///////////////////////////////////

;- BASS version constants
#BASSVERSION      = $02040A00 ;BASS API version this include was made for.
#BASSVERSIONTEXT   = "2.4"

;- BASS Error codes returned by BASS_GetErrorCode
#BASS_OK               = 0   ;all is OK
#BASS_ERROR_MEM      = 1   ;memory error
#BASS_ERROR_FILEOPEN   = 2   ;can't open the file
#BASS_ERROR_DRIVER   = 3   ;can't find a free/valid driver
#BASS_ERROR_BUFLOST   = 4   ;the sample buffer was lost
#BASS_ERROR_HANDLE   = 5   ;invalid handle
#BASS_ERROR_FORMAT   = 6   ;unsupported sample format
#BASS_ERROR_POSITION   = 7   ;invalid playback position
#BASS_ERROR_INIT      = 8   ;BASS_Init has not been successfully called
#BASS_ERROR_START      = 9   ;BASS_Start has not been successfully called
#BASS_ERROR_ALREADY   = 14   ;already initialized
#BASS_ERROR_NOCHAN   = 18   ;can't get a free channel
#BASS_ERROR_ILLTYPE   = 19   ;an illegal type was specified
#BASS_ERROR_ILLPARAM   = 20   ;an illegal parameter was specified
#BASS_ERROR_NO3D      = 21   ;no 3D support
#BASS_ERROR_NOEAX      = 22   ;no EAX support
#BASS_ERROR_DEVICE   = 23   ;illegal device number
#BASS_ERROR_NOPLAY   = 24   ;not playing
#BASS_ERROR_FREQ      = 25   ;illegal sample rate
#BASS_ERROR_NOTFILE   = 27   ;the stream is not a file stream
#BASS_ERROR_NOHW      = 29   ;no hardware voices available
#BASS_ERROR_EMPTY      = 31   ;the MOD music has no sequence Data
#BASS_ERROR_NONET      = 32   ;no internet connection could be opened
#BASS_ERROR_CREATE   = 33   ;couldn't create the file
#BASS_ERROR_NOFX      = 34   ;effects are not available
#BASS_ERROR_NOTAVAIL   = 37   ;requested Data is not available
#BASS_ERROR_DECODE   = 38   ;the channel is/isn't a "decoding channel"
#BASS_ERROR_DX         = 39   ;a sufficient DirectX version is not installed
#BASS_ERROR_TIMEOUT   = 40   ;connection timedout
#BASS_ERROR_FILEFORM   = 41   ;unsupported file format
#BASS_ERROR_SPEAKER   = 42   ;unavailable speaker
#BASS_ERROR_VERSION   = 43   ;invalid BASS version (used by add-ons)
#BASS_ERROR_CODEC      = 44   ;codec is Not available/supported
#BASS_ERROR_ENDED      = 45   ;the channel/file has ended
#BASS_ERROR_BUSY      = 46   ;the device is busy
#BASS_ERROR_UNKNOWN   = -1   ;some other mystery error

;- BASS_SetConfig options
#BASS_CONFIG_BUFFER            = 0
#BASS_CONFIG_UPDATEPERIOD      = 1
#BASS_CONFIG_GVOL_SAMPLE      = 4
#BASS_CONFIG_GVOL_STREAM      = 5
#BASS_CONFIG_GVOL_MUSIC         = 6
#BASS_CONFIG_CURVE_VOL         = 7
#BASS_CONFIG_CURVE_PAN         = 8
#BASS_CONFIG_FLOATDSP         = 9
#BASS_CONFIG_3DALGORITHM      = 10
#BASS_CONFIG_NET_TIMEOUT      = 11
#BASS_CONFIG_NET_BUFFER         = 12
#BASS_CONFIG_PAUSE_NOPLAY      = 13
#BASS_CONFIG_NET_PREBUF         = 15
#BASS_CONFIG_NET_PASSIVE      = 18
#BASS_CONFIG_REC_BUFFER         = 19
#BASS_CONFIG_NET_PLAYLIST      = 21
#BASS_CONFIG_MUSIC_VIRTUAL      = 22
#BASS_CONFIG_VERIFY            = 23
#BASS_CONFIG_UPDATETHREADS      = 24
#BASS_CONFIG_DEV_BUFFER         = 27
#BASS_CONFIG_VISTA_TRUEPOS      = 30
#BASS_CONFIG_IOS_MIXAUDIO      = 34
#BASS_CONFIG_DEV_DEFAULT      = 36
#BASS_CONFIG_NET_READTIMEOUT   = 37
#BASS_CONFIG_VISTA_SPEAKERS   = 38
#BASS_CONFIG_IOS_SPEAKER      = 39
#BASS_CONFIG_MF_DISABLE         = 40
#BASS_CONFIG_HANDLES            = 41
#BASS_CONFIG_UNICODE            = 42
#BASS_CONFIG_SRC               = 43
#BASS_CONFIG_SRC_SAMPLE         = 44
#BASS_CONFIG_ASYNCFILE_BUFFER   = 45
#BASS_CONFIG_OGG_PRESCAN      = 47
#BASS_CONFIG_MF_VIDEO         = 48
#BASS_CONFIG_AIRPLAY            = 49
#BASS_CONFIG_DEV_NONSTOP      = 50
#BASS_CONFIG_IOS_NOCATEGORY   = 51
#BASS_CONFIG_VERIFY_NET         = 52

;- BASS_SetConfigPtr options
#BASS_CONFIG_NET_AGENT   = 16
#BASS_CONFIG_NET_PROXY   = 17
#BASS_CONFIG_IOS_NOTIFY   = 46

;- BASS_Init flags
#BASS_DEVICE_8BITS      = $1      ;use 8 bit resolution, else 16 bit
#BASS_DEVICE_MONO         = $2      ;use mono, else stereo
#BASS_DEVICE_3D         = $4      ;enable 3D functionality
#BASS_DEVICE_LATENCY      = $100   ;calculate device latency (BASS_INFO struct)
#BASS_DEVICE_CPSPEAKERS   = $400   ;detect speakers via Windows control panel
#BASS_DEVICE_SPEAKERS   = $800   ;force enabling of speaker assignment
#BASS_DEVICE_NOSPEAKER   = $1000   ;ignore speaker arrangement
#BASS_DEVICE_DMIX         = $2000   ;use ALSA "dmix" plugin
#BASS_DEVICE_FREQ         = $4000   ;set device sample rate

;- DirectSound interfaces (For use With BASS_GetDSoundObject)
#BASS_OBJECT_DS      = 1   ;IDirectSound
#BASS_OBJECT_DS3DL   = 2   ;IDirectSound3DListener

;- Device info structure
Structure BASS_DEVICEINFO
  *name   ;description
  *driver ;driver
  flags.l
EndStructure

;- BASS_DEVICEINFO flags
#BASS_DEVICE_ENABLED   = $1
#BASS_DEVICE_DEFAULT   = $2
#BASS_DEVICE_INIT      = $4

#BASS_DEVICE_TYPE_MASK         = $ff000000
#BASS_DEVICE_TYPE_NETWORK      = $01000000
#BASS_DEVICE_TYPE_SPEAKERS      = $02000000
#BASS_DEVICE_TYPE_LINE         = $03000000
#BASS_DEVICE_TYPE_HEADPHONES   = $04000000
#BASS_DEVICE_TYPE_MICROPHONE   = $05000000
#BASS_DEVICE_TYPE_HEADSET      = $06000000
#BASS_DEVICE_TYPE_HANDSET      = $07000000
#BASS_DEVICE_TYPE_DIGITAL      = $08000000
#BASS_DEVICE_TYPE_SPDIF         = $09000000
#BASS_DEVICE_TYPE_HDMI         = $0a000000
#BASS_DEVICE_TYPE_DISPLAYPORT   = $40000000

;- BASS_GetDeviceInfo flags
#BASS_DEVICES_AIRPLAY   = $1000000

Structure BASS_INFO
  flags.l     ;device capabilities (DSCAPS_xxx flags)
  hwsize.l      ;size of total device hardware memory
  hwfree.l      ;size of free device hardware memory
  freesam.l   ;number of free sample slots in the hardware
  free3d.l      ;number of free 3D sample slots in the hardware
  minrate.l   ;min sample rate supported by the hardware
  maxrate.l   ;max sample rate supported by the hardware
  eax.l         ;device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
  minbuf.l      ;recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY)
  dsver.l      ;DirectSound version
  latency.l   ;delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
  initflags.l   ;BASS_Init "flags" parameter
  speakers.l   ;number of speakers available
  freq.l      ;current output rate
EndStructure

;- BASS_INFO flags (from DSOUND.H)
#DSCAPS_CONTINUOUSRATE  = $00000010   ;supports all sample rates between min/maxrate
#DSCAPS_EMULDRIVER      = $00000020   ;device does NOT have hardware DirectSound support
#DSCAPS_CERTIFIED       = $00000040   ;device driver has been certified by Microsoft
#DSCAPS_SECONDARYMONO   = $00000100   ;mono
#DSCAPS_SECONDARYSTEREO = $00000200   ;stereo
#DSCAPS_SECONDARY8BIT   = $00000400   ;8 bit
#DSCAPS_SECONDARY16BIT  = $00000800   ;16 bit

;- Recording device info Structure
Structure BASS_RECORDINFO
  flags.l    ;device capabilities (DSCCAPS_xxx flags)
  formats.l  ;supported standard formats (WAVE_FORMAT_xxx flags)
  inputs.l     ;number of inputs
  singlein.l ;TRUE = only 1 input can be set at a time
  freq.l     ;current input rate
EndStructure

;- BASS_RECORDINFO flags (from DSOUND.H)
#DSCCAPS_EMULDRIVER = #DSCAPS_EMULDRIVER   ;device does NOT have hardware DirectSound recording support
#DSCCAPS_CERTIFIED  = #DSCAPS_CERTIFIED   ;device driver has been certified by Microsoft

;- defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H)
#WAVE_FORMAT_1M08 = $00000001 ;11.025 kHz, Mono,   8-bit
#WAVE_FORMAT_1S08 = $00000002   ;11.025 kHz, Stereo, 8-bit
#WAVE_FORMAT_1M16 = $00000004   ;11.025 kHz, Mono,   16-bit
#WAVE_FORMAT_1S16 = $00000008   ;11.025 kHz, Stereo, 16-bit
#WAVE_FORMAT_2M08 = $00000010   ;22.05  kHz, Mono,   8-bit
#WAVE_FORMAT_2S08 = $00000020   ;22.05  kHz, Stereo, 8-bit
#WAVE_FORMAT_2M16 = $00000040   ;22.05  kHz, Mono,   16-bit
#WAVE_FORMAT_2S16 = $00000080   ;22.05  kHz, Stereo, 16-bit
#WAVE_FORMAT_4M08 = $00000100   ;44.1   kHz, Mono,   8-bit
#WAVE_FORMAT_4S08 = $00000200   ;44.1   kHz, Stereo, 8-bit
#WAVE_FORMAT_4M16 = $00000400   ;44.1   kHz, Mono,   16-bit
#WAVE_FORMAT_4S16 = $00000800   ;44.1   kHz, Stereo, 16-bit

;- Sample info structure
Structure BASS_SAMPLE
  freq.l     ;default playback rate
  volume.f     ;default volume (0-1)
  pan.f        ;default pan (-1=left, 0=middle, 1=right)
  flags.l     ;BASS_SAMPLE_xxx flags
  length.l     ;length (in bytes)
  max.l        ;maximum simultaneous playbacks
  origres.l  ;original resolution bits
  chans.l     ;number of channels
  mingap.l     ;minimum gap (ms) between creating channels
  mode3d.l     ;BASS_3DMODE_xxx mode
  mindist.f  ;minimum distance
  maxdist.f  ;maximum distance
  iangle.l     ;angle of inside projection cone
  oangle.l     ;angle of outside projection cone
  outvol.f     ;delta-volume outside the projection cone
  vam.l        ;voice allocation/management flags (BASS_VAM_xxx)
  priority.l ;priority (0=lowest, 0xffffffff=highest)
EndStructure

;- SAMPLE flags
#BASS_SAMPLE_8BITS     = 1      ;8 bit
#BASS_SAMPLE_FLOAT     = 256     ;32-bit floating-point
#BASS_SAMPLE_MONO      = 2        ;mono
#BASS_SAMPLE_LOOP      = 4        ;looped
#BASS_SAMPLE_3D        = 8        ;3D functionality
#BASS_SAMPLE_SOFTWARE  = 16     ;not using hardware mixing
#BASS_SAMPLE_MUTEMAX   = 32     ;mute at max distance (3D only)
#BASS_SAMPLE_VAM       = 64     ;DX7 voice allocation & management
#BASS_SAMPLE_FX        = 128     ;old implementation of DX8 effects
#BASS_SAMPLE_OVER_VOL  = $10000 ;override lowest volume
#BASS_SAMPLE_OVER_POS  = $20000 ;override longest playing
#BASS_SAMPLE_OVER_DIST = $30000 ;override furthest from listener (3D only)

;- STREAM flags
#BASS_STREAM_PRESCAN  = $20000  ;enable pin-point seeking/length (MP3/MP2/MP1)
#BASS_MP3_SETPOS      = #BASS_STREAM_PRESCAN
#BASS_STREAM_AUTOFREE = $40000  ;automatically free the stream when it stop/ends
#BASS_STREAM_RESTRATE = $80000  ;restrict the download rate of internet file streams
#BASS_STREAM_BLOCK    = $100000 ;download/play internet file stream in small blocks
#BASS_STREAM_DECODE   = $200000 ;don't play the stream, only decode (BASS_ChannelGetData)
#BASS_STREAM_STATUS   = $800000 ;give server status info (HTTP/ICY tags) in DOWNLOADPROC

;- MUSIC flags
#BASS_MUSIC_FLOAT      = #BASS_SAMPLE_FLOAT
#BASS_MUSIC_MONO       = #BASS_SAMPLE_MONO
#BASS_MUSIC_LOOP       = #BASS_SAMPLE_LOOP
#BASS_MUSIC_3D         = #BASS_SAMPLE_3D
#BASS_MUSIC_FX         = #BASS_SAMPLE_FX
#BASS_MUSIC_AUTOFREE   = #BASS_STREAM_AUTOFREE
#BASS_MUSIC_DECODE     = #BASS_STREAM_DECODE
#BASS_MUSIC_PRESCAN    = #BASS_STREAM_PRESCAN ;calculate playback length
#BASS_MUSIC_CALCLEN    = #BASS_MUSIC_PRESCAN
#BASS_MUSIC_RAMP       = $200      ;normal ramping
#BASS_MUSIC_RAMPS      = $400      ;sensitive ramping
#BASS_MUSIC_SURROUND   = $800      ;surround sound
#BASS_MUSIC_SURROUND2  = $1000   ;surround sound (mode 2)
#BASS_MUSIC_FT2MOD     = $2000   ;play .MOD as FastTracker 2 does
#BASS_MUSIC_PT1MOD     = $4000   ;play .MOD as ProTracker 1 does
#BASS_MUSIC_NONINTER   = $10000   ;non-interpolated sample mixing
#BASS_MUSIC_SINCINTER  = $800000   ;sinc interpolated sample mixing
#BASS_MUSIC_POSRESET   = $8000   ;stop all notes when moving position
#BASS_MUSIC_POSRESETEX = $400000   ;stop all notes and reset bmp/etc when moving position
#BASS_MUSIC_STOPBACK   = $80000   ;stop the music on a backwards jump effect
#BASS_MUSIC_NOSAMPLE   = $100000   ;don't load the samples

;- SPEAKER assignment flags
#BASS_SPEAKER_FRONT      = $01000000            ;front speakers
#BASS_SPEAKER_REAR       = $02000000            ;rear/side speakers
#BASS_SPEAKER_CENLFE     = $03000000            ;center & LFE speakers (5.1)
#BASS_SPEAKER_REAR2      = $04000000            ;rear center speakers (7.1)
Macro BASS_SPEAKER_N(n)   :   (n<<24) :   EndMacro   ;n'th pair of speakers (max 15)
#BASS_SPEAKER_LEFT       = $10000000            ;modifier: left
#BASS_SPEAKER_RIGHT      = $20000000            ;modifier: right
#BASS_SPEAKER_FRONTLEFT  = #BASS_SPEAKER_FRONT | #BASS_SPEAKER_LEFT
#BASS_SPEAKER_FRONTRIGHT = #BASS_SPEAKER_FRONT | #BASS_SPEAKER_RIGHT
#BASS_SPEAKER_REARLEFT   = #BASS_SPEAKER_REAR | #BASS_SPEAKER_LEFT
#BASS_SPEAKER_REARRIGHT  = #BASS_SPEAKER_REAR | #BASS_SPEAKER_RIGHT
#BASS_SPEAKER_CENTER     = #BASS_SPEAKER_CENLFE | #BASS_SPEAKER_LEFT
#BASS_SPEAKER_LFE        = #BASS_SPEAKER_CENLFE | #BASS_SPEAKER_RIGHT
#BASS_SPEAKER_REAR2LEFT  = #BASS_SPEAKER_REAR2 | #BASS_SPEAKER_LEFT
#BASS_SPEAKER_REAR2RIGHT = #BASS_SPEAKER_REAR2 | #BASS_SPEAKER_RIGHT

;- FILE flags
#BASS_ASYNCFILE = $40000000
#BASS_UNICODE = $80000000

;- RECORD flags
#BASS_RECORD_PAUSE      = $8000 ;start recording paused
#BASS_RECORD_ECHOCANCEL   = $2000
#BASS_RECORD_AGC         = $4000

;- DX7 voice allocation & management flags
#BASS_VAM_HARDWARE  = 1
#BASS_VAM_SOFTWARE  = 2
#BASS_VAM_TERM_TIME = 4
#BASS_VAM_TERM_DIST = 8
#BASS_VAM_TERM_PRIO = 16

;- BASS Structures
Structure BASS_CHANNELINFO
  freq.l      ;default playback rate
  chans.l      ;channels
  flags.l      ;BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
  ctype.l      ;type of channel
  origres.l   ;original resolution
  plugin.l      ;plugin handle
  sample.l      ;sample
  *filename   ;filename
EndStructure

;- BASS_CHANNELINFO types
#BASS_CTYPE_SAMPLE            = 1
#BASS_CTYPE_RECORD            = 2
#BASS_CTYPE_STREAM            = $10000
#BASS_CTYPE_STREAM_OGG         = $10002
#BASS_CTYPE_STREAM_MP1         = $10003
#BASS_CTYPE_STREAM_MP2         = $10004
#BASS_CTYPE_STREAM_MP3         = $10005
#BASS_CTYPE_STREAM_AIFF         = $10006
#BASS_CTYPE_STREAM_CA         = $10007
#BASS_CTYPE_STREAM_MF         = $10008
#BASS_CTYPE_STREAM_WAV         = $40000 ;WAVE flag, LOWORD=codec
#BASS_CTYPE_STREAM_WAV_PCM      = $50001
#BASS_CTYPE_STREAM_WAV_FLOAT   = $50003
#BASS_CTYPE_MUSIC_MOD         = $20000
#BASS_CTYPE_MUSIC_MTM         = $20001
#BASS_CTYPE_MUSIC_S3M         = $20002
#BASS_CTYPE_MUSIC_XM            = $20003
#BASS_CTYPE_MUSIC_IT            = $20004
#BASS_CTYPE_MUSIC_MO3         = $00100 ;MO3 flag

Structure BASS_PLUGINFORM
  ctype.l ;channel type
  *name     ;format description
  *exts     ;file extension filter (*.ext1;*.ext2;etc...)
EndStructure

Structure BASS_PLUGININFO
  version.l ;version (same form as BASS_GetVersion)
  formatc.l ;number of formats
  *formats.BASS_PLUGINFORM ;the array of formats
EndStructure

;- 3D vector (For 3D positions/velocities/orientations)
Structure BASS_3DVECTOR
  x.f ;+=right, -=left
  y.f ;+=up, -=down
  z.f ;+=front, -=behind
EndStructure

;- 3D channel modes
#BASS_3DMODE_NORMAL      = 0 ;normal 3D processing
#BASS_3DMODE_RELATIVE   = 1 ;position is relative to the listener
#BASS_3DMODE_OFF         = 2 ;no 3D processing

;- software 3D mixing algorithms (used With BASS_CONFIG_3DALGORITHM)
#BASS_3DALG_DEFAULT   = 0
#BASS_3DALG_OFF      = 1
#BASS_3DALG_FULL      = 2
#BASS_3DALG_LIGHT      = 3

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  ;- EAX environments, use With BASS_SetEAXParameters
  Enumeration 0
    #EAX_ENVIRONMENT_GENERIC
    #EAX_ENVIRONMENT_PADDEDCELL
    #EAX_ENVIRONMENT_ROOM
    #EAX_ENVIRONMENT_BATHROOM
    #EAX_ENVIRONMENT_LIVINGROOM
    #EAX_ENVIRONMENT_STONEROOM
    #EAX_ENVIRONMENT_AUDITORIUM
    #EAX_ENVIRONMENT_CONCERTHALL
    #EAX_ENVIRONMENT_CAVE
    #EAX_ENVIRONMENT_ARENA
    #EAX_ENVIRONMENT_HANGAR
    #EAX_ENVIRONMENT_CARPETEDHALLWAY
    #EAX_ENVIRONMENT_HALLWAY
    #EAX_ENVIRONMENT_STONECORRIDOR
    #EAX_ENVIRONMENT_ALLEY
    #EAX_ENVIRONMENT_FOREST
    #EAX_ENVIRONMENT_CITY
    #EAX_ENVIRONMENT_MOUNTAINS
    #EAX_ENVIRONMENT_QUARRY
    #EAX_ENVIRONMENT_PLAIN
    #EAX_ENVIRONMENT_PARKINGLOT
    #EAX_ENVIRONMENT_SEWERPIPE
    #EAX_ENVIRONMENT_UNDERWATER
    #EAX_ENVIRONMENT_DRUGGED
    #EAX_ENVIRONMENT_DIZZY
    #EAX_ENVIRONMENT_PSYCHOTIC
   
    #EAX_ENVIRONMENT_COUNT         ;total number of environments
  EndEnumeration
 
  ;EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx)
  Macro EAX_PRESET_GENERIC         : #EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F : EndMacro
  Macro EAX_PRESET_PADDEDCELL      : #EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F : EndMacro
  Macro EAX_PRESET_ROOM            : #EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F : EndMacro
  Macro EAX_PRESET_BATHROOM        : #EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F : EndMacro
  Macro EAX_PRESET_LIVINGROOM      : #EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F : EndMacro
  Macro EAX_PRESET_STONEROOM       : #EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F : EndMacro
  Macro EAX_PRESET_AUDITORIUM      : #EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F : EndMacro
  Macro EAX_PRESET_CONCERTHALL     : #EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F : EndMacro
  Macro EAX_PRESET_CAVE            : #EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F : EndMacro
  Macro EAX_PRESET_ARENA           : #EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F : EndMacro
  Macro EAX_PRESET_HANGAR          : #EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F : EndMacro
  Macro EAX_PRESET_CARPETEDHALLWAY : #EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F : EndMacro
  Macro EAX_PRESET_HALLWAY         : #EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F : EndMacro
  Macro EAX_PRESET_STONECORRIDOR   : #EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F : EndMacro
  Macro EAX_PRESET_ALLEY           : #EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F : EndMacro
  Macro EAX_PRESET_FOREST          : #EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F : EndMacro
  Macro EAX_PRESET_CITY            : #EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F : EndMacro
  Macro EAX_PRESET_MOUNTAINS       : #EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F : EndMacro
  Macro EAX_PRESET_QUARRY          : #EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F : EndMacro
  Macro EAX_PRESET_PLAIN           : #EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F : EndMacro
  Macro EAX_PRESET_PARKINGLOT      : #EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F : EndMacro
  Macro EAX_PRESET_SEWERPIPE       : #EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F : EndMacro
  Macro EAX_PRESET_UNDERWATER      : #EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F : EndMacro
  Macro EAX_PRESET_DRUGGED         : #EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F : EndMacro
  Macro EAX_PRESET_DIZZY           : #EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F : EndMacro
  Macro EAX_PRESET_PSYCHOTIC       : #EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F : EndMacro
CompilerEndIf

;typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, void *user);
; User stream callback function. NOTE: A stream function should obviously be as quick
;as possible, other streams (and MOD musics) can't be mixed until it's finished.
;handle : The stream that needs writing
;buffer : Buffer to write the samples in
;length : Number of bytes to write
;user   : The 'user' parameter value given when calling BASS_StreamCreate
;RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end
;         the stream.

#BASS_STREAMPROC_END   = $80000000   ;end of user stream flag

;- special STREAMPROCs
;#STREAMPROC_DUMMY      (STREAMPROC*)0      // "dummy" stream
;#STREAMPROC_PUSH         (STREAMPROC*)-1      // push stream

;special STREAMPROCs
#STREAMPROC_DUMMY   = 0   ;"dummy" stream
#STREAMPROC_PUSH   = -1   ;push stream

;- BASS_StreamCreateFileUser file systems
#STREAMFILE_NOBUFFER      = 0
#STREAMFILE_BUFFER      = 1
#STREAMFILE_BUFFERPUSH   = 2

;- User file stream callback functions
;typedef void (CALLBACK FILECLOSEPROC)(void *user);
;typedef QWORD (CALLBACK FILELENPROC)(void *user);
;typedef DWORD (CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user);
;typedef BOOL (CALLBACK FILESEEKPROC)(QWORD offset, void *user);

Structure BASS_FILEPROCS
  *close
  *length
  *read
  *seek
EndStructure

;- BASS_StreamPutFileData options
#BASS_FILEDATA_END      = 0   ;end & close the file

;- BASS_StreamGetFilePosition modes
#BASS_FILEPOS_CURRENT   = 0
#BASS_FILEPOS_DECODE      = #BASS_FILEPOS_CURRENT
#BASS_FILEPOS_DOWNLOAD   = 1
#BASS_FILEPOS_END         = 2
#BASS_FILEPOS_START      = 3
#BASS_FILEPOS_CONNECTED   = 4
#BASS_FILEPOS_BUFFER      = 5
#BASS_FILEPOS_SOCKET      = 6
#BASS_FILEPOS_ASYNCBUF   = 7
#BASS_FILEPOS_SIZE      = 8

;typedef void (CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *user);
;/* Internet stream download callback function.
;buffer : Buffer containing the downloaded data... NULL=end of download
;length : Number of bytes in the buffer
;user   : The 'user' parameter value given when calling BASS_StreamCreateURL */

;- BASS_ChannelSetSync types
#BASS_SYNC_POS            = 0
#BASS_SYNC_END            = 2
#BASS_SYNC_META         = 4
#BASS_SYNC_SLIDE         = 5
#BASS_SYNC_STALL         = 6
#BASS_SYNC_DOWNLOAD      = 7
#BASS_SYNC_FREE         = 8
#BASS_SYNC_SETPOS         = 11
#BASS_SYNC_MUSICPOS      = 10
#BASS_SYNC_MUSICINST      = 1
#BASS_SYNC_MUSICFX      = 3
#BASS_SYNC_OGG_CHANGE   = 12
#BASS_SYNC_MIXTIME      = $40000000   ;FLAG: sync at mixtime, else at playtime
#BASS_SYNC_ONETIME      = $80000000   ;FLAG: sync only once, else continuously

;typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, void *user);
;Sync callback function. NOTE: a sync callback function should be very
;quick as other syncs can't be processed until it has finished. If the sync
;is a "mixtime" sync, then other streams and MOD musics can't be mixed until
;it's finished either.
;handle : The sync that has occured
;channel: Channel that the sync occured in
;data   : Additional data associated with the sync's occurance
;user   : The 'user' parameter given when calling BASS_ChannelSetSync */

;typedef void (CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user);
;/* DSP callback function. NOTE: A DSP function should obviously be as quick as
;possible... other DSP functions, streams and MOD musics can not be processed
;until it's finished.
;handle : The DSP handle
;channel: Channel that the DSP is being applied to
;buffer : Buffer to apply the DSP to
;length : Number of bytes in the buffer
;user   : The 'user' parameter given when calling BASS_ChannelSetDSP */

;typedef BOOL (CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, DWORD length, void *user);
;/* Recording callback function.
;handle : The recording handle
;buffer : Buffer containing the recorded sample data
;length : Number of bytes
;user   : The 'user' parameter value given when calling BASS_RecordStart
;RETURN : TRUE = continue recording, FALSE = stop */

;- BASS_ChannelIsActive Return values
#BASS_ACTIVE_STOPPED   = 0
#BASS_ACTIVE_PLAYING   = 1
#BASS_ACTIVE_STALLED   = 2
#BASS_ACTIVE_PAUSED   = 3

;- Channel attributes
#BASS_ATTRIB_FREQ               = 1
#BASS_ATTRIB_VOL               = 2
#BASS_ATTRIB_PAN               = 3
#BASS_ATTRIB_EAXMIX            = 4
#BASS_ATTRIB_NOBUFFER         = 5
#BASS_ATTRIB_VBR               = 6
#BASS_ATTRIB_CPU               = 7
#BASS_ATTRIB_SRC               = 8
#BASS_ATTRIB_NET_RESUME         = 9
#BASS_ATTRIB_SCANINFO         = 10
#BASS_ATTRIB_MUSIC_AMPLIFY      = $100
#BASS_ATTRIB_MUSIC_PANSEP      = $101
#BASS_ATTRIB_MUSIC_PSCALER      = $102
#BASS_ATTRIB_MUSIC_BPM         = $103
#BASS_ATTRIB_MUSIC_SPEED      = $104
#BASS_ATTRIB_MUSIC_VOL_GLOBAL   = $105
#BASS_ATTRIB_MUSIC_ACTIVE      = $106
#BASS_ATTRIB_MUSIC_VOL_CHAN   = $200   ;+ channel #
#BASS_ATTRIB_MUSIC_VOL_INST   = $300   ;+ instrument #

;- BASS_ChannelGetData flags
#BASS_DATA_AVAILABLE         = 0         ;query how much data is buffered
#BASS_DATA_FIXED            = $20000000   ;flag: return 8.24 fixed-point data
#BASS_DATA_FLOAT            = $40000000   ;flag: return floating-point sample data
#BASS_DATA_FFT256            = $80000000   ;256 sample FFT
#BASS_DATA_FFT512            = $80000001   ;512 FFT
#BASS_DATA_FFT1024         = $80000002   ;1024 FFT
#BASS_DATA_FFT2048         = $80000003   ;2048 FFT
#BASS_DATA_FFT4096         = $80000004   ;4096 FFT
#BASS_DATA_FFT8192         = $80000005   ;8192 FFT
#BASS_DATA_FFT16384         = $80000006   ;16384 FFT
#BASS_DATA_FFT_INDIVIDUAL   = $10         ;FFT flag: FFT for each channel, else all combined
#BASS_DATA_FFT_NOWINDOW      = $20         ;FFT flag: no Hanning window
#BASS_DATA_FFT_REMOVEDC      = $40         ;FFT flag: pre-remove DC bias
#BASS_DATA_FFT_COMPLEX      = $80         ;FFT flag: return complex data

;- BASS_ChannelGetTags types : what's returned
#BASS_TAG_ID3               = 0      ;ID3v1 tags : TAG_ID3 structure
#BASS_TAG_ID3V2            = 1      ;ID3v2 tags : variable length block
#BASS_TAG_OGG               = 2      ;OGG comments : series of null-terminated UTF-8 strings
#BASS_TAG_HTTP               = 3      ;HTTP headers : series of null-terminated ANSI strings
#BASS_TAG_ICY               = 4      ;ICY headers : series of null-terminated ANSI strings
#BASS_TAG_META               = 5      ;ICY metadata : ANSI string
#BASS_TAG_APE               = 6      ;APE tags : series of null-terminated UTF-8 strings
#BASS_TAG_MP4               = 7      ;MP4/iTunes metadata : series of null-terminated UTF-8 strings
#BASS_TAG_VENDOR            = 9      ;OGG encoder : UTF-8 string
#BASS_TAG_LYRICS3            = 10      ;Lyric3v2 tag : ASCII string
#BASS_TAG_CA_CODEC         = 11      ;CoreAudio codec info : TAG_CA_CODEC structure
#BASS_TAG_MF               = 13      ;Media Foundation tags : series of null-terminated UTF-8 strings
#BASS_TAG_WAVEFORMAT         = 14      ;WAVE format : WAVEFORMATEEX structure
#BASS_TAG_RIFF_INFO         = $100   ;RIFF "INFO" tags : series of null-terminated ANSI strings
#BASS_TAG_RIFF_BEXT         = $101   ;RIFF/BWF "bext" tags : TAG_BEXT structure
#BASS_TAG_RIFF_CART         = $102   ;RIFF/BWF "cart" tags : TAG_CART structure
#BASS_TAG_RIFF_DISP         = $103   ;RIFF "DISP" text tag : ANSI string
#BASS_TAG_APE_BINARY         = $1000   ;+ index #, binary APE tag : TAG_APE_BINARY structure
#BASS_TAG_MUSIC_NAME         = $10000   ;MOD music name : ANSI string
#BASS_TAG_MUSIC_MESSAGE      = $10001   ;MOD message : ANSI string
#BASS_TAG_MUSIC_ORDERS      = $10002   ;MOD order list : BYTE array of pattern numbers
#BASS_TAG_MUSIC_INST         = $10100   ;+ instrument #, MOD instrument name : ANSI string
#BASS_TAG_MUSIC_SAMPLE      = $10300   ;+ sample #, MOD sample name : ANSI string

;- ID3v1 tag structure
Structure TAG_ID3
  id.a[3]
  title.a[30]
  artist.a[30]
  album.a[30]
  year.a[4]
  comment.a[30]
  genre.b
EndStructure

;- Binary APE tag structure
Structure TAG_APE_BINARY
  *key
  *data
  length.l
EndStructure

;- BWF "bext" tag structure
Structure TAG_BEXT
  Description.a[256]         ;// description
  Originator.a[32]            ;// name of the originator
  OriginatorReference.a[32]   ;// reference of the originator
  OriginationDate.a[10]      ;// date of creation (yyyy-mm-dd)
  OriginationTime.a[8]         ;// time of creation (hh-mm-ss)
  TimeReference.q            ;// first sample count since midnight (little-endian)
  Version.w                  ;// BWF version (little-endian)
  UMID.b[64]                  ;// SMPTE UMID
  Reserved.b[190]
  CodingHistory.a[0]         ;// history
EndStructure

;- BWF "cart" tag structures
Structure TAG_CART_TIMER
  dwUsage.l ;FOURCC timer usage ID
  dwValue.l ;timer value in samples from head
EndStructure

Structure TAG_CART
  Version.a[4]            ;version of the data structure
  Title.a[64]               ;title of cart audio sequence
  Artist.a[64]            ;artist or creator name
  CutID.a[64]               ;cut number identification
  ClientID.a[64]            ;client identification
  Category.a[64]            ;category ID, PSA, NEWS, etc
  Classification.a[64]      ;classification or auxiliary key
  OutCue.a[64]            ;out cue text
  StartDate.a[10]         ;yyyy-mm-dd
  StartTime.a[8]            ;hh:mm:ss
  EndDate.a[10]            ;yyyy-mm-dd
  EndTime.a[8]            ;hh:mm:ss
  ProducerAppID.a[64]      ;name of vendor or application
  ProducerAppVersion.a[64];version of producer application
  UserDef.a[64]            ;user defined text
  dwLevelReference.l      ;sample value for 0 dB reference
  PostTimer.TAG_CART_TIMER[8]   ;8 time markers after head
  Reserved.a[276]
  URL.a[1024]               ;uniform resource locator
  TagText.a[0]            ;free form text for scripts or tags
EndStructure

;CoreAudio codec info structure
Structure TAG_CA_CODEC
  ftype.l               ;file format
  atype.l               ;audio format
  *name                  ;description
EndStructure

CompilerIf Defined(WAVEFORMATEX, #PB_Structure) = #False
  Structure WAVEFORMATEX
    wFormatTag.u
    nChannels.u
    nSamplesPerSec.l
    nAvgBytesPerSec.l
    nBlockAlign.u
    wBitsPerSample.u
    cbSize.u
  EndStructure
CompilerEndIf

;- BASS_ChannelGetLength/GetPosition/SetPosition modes
#BASS_POS_BYTE            = 0         ;byte position
#BASS_POS_MUSIC_ORDER   = 1         ;order.row position, MAKELONG(order,row)
#BASS_POS_OGG            = 3         ;OGG bitstream number
#BASS_POS_INEXACT         = $08000000   ;flag: allow seeking to inexact position
#BASS_POS_DECODE         = $10000000   ;flag: get the decoding (not playing) position
#BASS_POS_DECODETO      = $20000000   ;flag: decode to the position instead of seeking
#BASS_POS_SCAN            = $40000000   ;flag: scan to the position

;- BASS_RecordSetInput flags
#BASS_INPUT_OFF   = $10000
#BASS_INPUT_ON      = $20000

#BASS_INPUT_TYPE_MASK      = $ff000000
#BASS_INPUT_TYPE_UNDEF      = $00000000
#BASS_INPUT_TYPE_DIGITAL   = $01000000
#BASS_INPUT_TYPE_LINE      = $02000000
#BASS_INPUT_TYPE_MIC         = $03000000
#BASS_INPUT_TYPE_SYNTH      = $04000000
#BASS_INPUT_TYPE_CD         = $05000000
#BASS_INPUT_TYPE_PHONE      = $06000000
#BASS_INPUT_TYPE_SPEAKER   = $07000000
#BASS_INPUT_TYPE_WAVE      = $08000000
#BASS_INPUT_TYPE_AUX         = $09000000
#BASS_INPUT_TYPE_ANALOG      = $0a000000

;DX8 effect types, use with BASS_ChannelSetFX
Enumeration 0
  #BASS_FX_DX8_CHORUS
  #BASS_FX_DX8_COMPRESSOR
  #BASS_FX_DX8_DISTORTION
  #BASS_FX_DX8_ECHO
  #BASS_FX_DX8_FLANGER
  #BASS_FX_DX8_GARGLE
  #BASS_FX_DX8_I3DL2REVERB
  #BASS_FX_DX8_PARAMEQ
  #BASS_FX_DX8_REVERB
EndEnumeration

Structure BASS_DX8_CHORUS
  fWetDryMix.f
  fDepth.f
  fFeedback.f
  fFrequency.f
  lWaveform.l  ;0=triangle, 1=sine
  fDelay.f
  lPhase.l     ;BASS_DX8_PHASE_xxx
EndStructure

Structure BASS_DX8_COMPRESSOR
  fGain.f
  fAttack.f
  fRelease.f
  fThreshold.f
  fRatio.f
  fPredelay.f
EndStructure

Structure BASS_DX8_DISTORTION
  fGain.f
  fEdge.f
  fPostEQCenterFrequency.f
  fPostEQBandwidth.f
  fPreLowpassCutoff.f
EndStructure

Structure BASS_DX8_ECHO
  fWetDryMix.f
  fFeedback.f
  fLeftDelay.f
  fRightDelay.f
  lPanDelay.l
EndStructure

Structure BASS_DX8_FLANGER
  fWetDryMix.f
  fDepth.f
  fFeedback.f
  fFrequency.f
  lWaveform.l   ;0=triangle, 1=sine
  fDelay.f
  lPhase.l        ;BASS_DX8_PHASE_xxx
EndStructure

Structure BASS_DX8_GARGLE
  dwRateHz.l    ;Rate of modulation in hz
  dwWaveShape.l ;0=triangle, 1=square
EndStructure

Structure BASS_DX8_I3DL2REVERB
  lRoom.l               ;[-10000, 0]      default: -1000 mB
  lRoomHF.l             ;[-10000, 0]      default: 0 mB
  flRoomRolloffFactor.f ;[0.0, 10.0]      default: 0.0
  flDecayTime.f          ;[0.1, 20.0]      default: 1.49s
  flDecayHFRatio.f       ;[0.1, 2.0]      default: 0.83
  lReflections.l          ;[-10000, 1000]   default: -2602 mB
  flReflectionsDelay.f    ;[0.0, 0.3]      default: 0.007 s
  lReverb.l             ;[-10000, 2000]   default: 200 mB
  flReverbDelay.f       ;[0.0, 0.1]      default: 0.011 s
  flDiffusion.f          ;[0.0, 100.0]      default: 100.0 %
  flDensity.f             ;[0.0, 100.0]      default: 100.0 %
  flHFReference.f       ;[20.0, 20000.0]   default: 5000.0 Hz
EndStructure

Structure BASS_DX8_PARAMEQ
  fCenter.f
  fBandwidth.f
  fGain.f
EndStructure

Structure BASS_DX8_REVERB
  fInGain.f          ;[-96.0,0.0]      default: 0.0 dB
  fReverbMix.f       ;[-96.0,0.0]      default: 0.0 db
  fReverbTime.f       ;[0.001,3000.0]   default: 1000.0 ms
  fHighFreqRTRatio.f ;[0.001,0.999]   default: 0.001
EndStructure

#BASS_DX8_PHASE_NEG_180   = 0
#BASS_DX8_PHASE_NEG_90   = 1
#BASS_DX8_PHASE_ZERO      = 2
#BASS_DX8_PHASE_90      = 3
#BASS_DX8_PHASE_180      = 4

; typedef void (CALLBACK IOSNOTIFYPROC)(DWORD status);
; /* iOS notification callback function.
; status : The notification (BASS_IOSNOTIFY_xxx) */

#BASS_IOSNOTIFY_INTERRUPT      = 1   ;interruption started
#BASS_IOSNOTIFY_INTERRUPT_END   = 2   ;interruption ended

;- BASS Functions
Import "bass.lib"
  BASS_SetConfig(option.l, value.l)
  BASS_GetConfig(option.l)
  BASS_SetConfigPtr(option.l, *value)
  BASS_GetConfigPtr(option.l)
  BASS_GetVersion()
  BASS_ErrorGetCode()
  BASS_GetDeviceInfo(device.l, *info)
  BASS_Init(device.l, freq.l, flags.l, *win, *dsguid)
  BASS_SetDevice(device.l)
  BASS_GetDevice()
  BASS_Free()
  CompilerIf #PB_Compiler_OS = #PB_OS_Windows
    BASS_GetDSoundObject(object.l)
  CompilerEndIf
  BASS_GetInfo(*info)
  BASS_Update(length.l)
  BASS_GetCPU()
  BASS_Start()
  BASS_Stop()
  BASS_Pause()
  BASS_SetVolume(volume.f)
  BASS_GetVolume()
 
  BASS_PluginLoad(*file, flags.l)
  BASS_PluginFree(handle.l)
  BASS_PluginGetInfo(handle.l)
 
  BASS_Set3DFactors(distf.f, rollf.f, doppf.f)
  BASS_Get3DFactors(*distf, *rollf, *doppf)
  BASS_Set3DPosition(*pos, *vel, *front, *top)
  BASS_Get3DPosition(*pos, *vel, *front, *top)
  BASS_Apply3D()
  CompilerIf #PB_Compiler_OS = #PB_OS_Windows
    BASS_SetEAXParameters(env.l, vol.f, decay.f, damp.f)
    BASS_GetEAXParameters(*env, *vol, *decay, *damp)
  CompilerEndIf
 
  BASS_MusicLoad(mem.l, *file, offset.q, length.l, flags.l, freq.l)
  BASS_MusicFree(handle.l)
 
  BASS_SampleLoad(mem.l, *file, offset.q, length.l, max.l, flags.l)
  BASS_SampleCreate(length.l, freq.l, chans.l, max.l, flags.l)
  BASS_SampleFree(handle.l)
  BASS_SampleSetData(handle.l, *buffer)
  BASS_SampleGetData(handle.l, *buffer)
  BASS_SampleGetInfo(handle.l, *info)
  BASS_SampleSetInfo(handle.l, *info)
  BASS_SampleGetChannel(handle.l, onlynew.l)
  BASS_SampleGetChannels(handle.l, *channels)
  BASS_SampleStop(handle.l)
 
  BASS_StreamCreate(freq.l, chans.l, flags.l, *proc, *user)
  BASS_StreamCreateFile(mem.l, *file, offset.q, length.q, flags.l)
  BASS_StreamCreateURL(*url, offset.l, flags.l, *proc, *user)
  BASS_StreamCreateFileUser(system.l, flags.l, *proc, *user)
  BASS_StreamFree(handle.l)
  BASS_StreamGetFilePosition(handle.l, mode.l)
  BASS_StreamPutData(handle.l, *buffer, length.l)
  BASS_StreamPutFileData(handle.l, *buffer, length.l)
 
  BASS_RecordGetDeviceInfo(device.l, *info)
  BASS_RecordInit(device.l)
  BASS_RecordSetDevice(device.l)
  BASS_RecordGetDevice()
  BASS_RecordFree()
  BASS_RecordGetInfo(*info)
  BASS_RecordGetInputName(input.l)
  BASS_RecordSetInput(input.l, flags.l, volume.f)
  BASS_RecordGetInput(input.l, *volume)
  BASS_RecordStart(freq.l, chans.l, flags.l, *proc, *user)
 
  BASS_ChannelBytes2Seconds(handle.l, pos.q)
  BASS_ChannelSeconds2Bytes(handle.l, pos.d)
  BASS_ChannelGetDevice(handle.l)
  BASS_ChannelSetDevice(handle.l, device.l)
  BASS_ChannelIsActive(handle.l)
  BASS_ChannelGetInfo(handle.l, *info)
  BASS_ChannelGetTags(handle.l, tags.l)
  BASS_ChannelFlags(handle.l, flags.l, mask.l)
  BASS_ChannelUpdate(handle.l, length.l)
  BASS_ChannelLock(handle.l, lock.l)
  BASS_ChannelPlay(handle.l, restart.l)
  BASS_ChannelStop(handle.l)
  BASS_ChannelPause(handle.l)
  BASS_ChannelSetAttribute(handle.l, attrib.l, value.f)
  BASS_ChannelGetAttribute(handle.l, attrib.l, *value)
  BASS_ChannelSlideAttribute(handle.l, attrib.l, value.f, time.l)
  BASS_ChannelIsSliding(handle.l, attrib.l)
  BASS_ChannelSetAttributeEx(handle.l, attrib.l, *value, size.l)
  BASS_ChannelGetAttributeEx(handle.l, attrib.l, *value, size.l)
  BASS_ChannelSet3DAttributes(handle.l, mode.l, min.f, max.f, iangle.l, oangle.l, outvol.f)
  BASS_ChannelGet3DAttributes(handle.l, *mode, *min, *max, *iangle, *oangle, *outvol)
  BASS_ChannelSet3DPosition(handle.l, *pos, *orient, *vel)
  BASS_ChannelGet3DPosition(handle.l, *pos, *orient, *vel)
  BASS_ChannelGetLength(handle.l, mode.l)
  BASS_ChannelSetPosition(handle.l, pos.q, mode.l)
  BASS_ChannelGetPosition(handle.l, mode.l)
  BASS_ChannelGetLevel(handle.l)
  BASS_ChannelGetLevelEx(handle.l, *levels, length.f, flags.l)
  BASS_ChannelGetData(handle.l, *buffer, length.l)
  BASS_ChannelSetSync(handle.l, type.l, param.q, *proc, *user)
  BASS_ChannelRemoveSync(handle.l, sync.l)
  BASS_ChannelSetDSP(handle.l, *proc, *user, priority.l)
  BASS_ChannelRemoveDSP(handle.l, dsp.l)
  BASS_ChannelSetLink(handle.l, chan.l)
  BASS_ChannelRemoveLink(handle.l, chan.l)
  BASS_ChannelSetFX(handle.l, type.l, priority.l)
  BASS_ChannelRemoveFX(handle.l, fx.l)
 
  BASS_FXSetParameters(handle.l, *params)
  BASS_FXGetParameters(handle.l, *params)
  BASS_FXReset(handle.l)
EndImport


_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple sound Player using BASS [Stereo & Mono Files]
PostPosted: Sun Jun 17, 2018 1:10 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3941
I am not sure that I can handle the MIDI staff :P
For any one who can take it further

"bassmidi.pbi"

Code:
#BASS_CONFIG_MIDI_COMPACT   = $10400;
  #BASS_CONFIG_MIDI_VOICES    = $10401;
  #BASS_CONFIG_MIDI_AUTOFONT  = $10402;
  #BASS_CONFIG_MIDI_IN_PORTS  = $10404;

  ; Additional #BASS_SetConfigPtr options
  #BASS_CONFIG_MIDI_DEFFONT   = $10403;

  ; Additional sync types
  #BASS_SYNC_MIDI_MARK        = $10000;
  #BASS_SYNC_MIDI_MARKER      = $10000;
  #BASS_SYNC_MIDI_CUE         = $10001;
  #BASS_SYNC_MIDI_LYRIC       = $10002;
  #BASS_SYNC_MIDI_TEXT        = $10003;
  #BASS_SYNC_MIDI_EVENT       = $10004;
  #BASS_SYNC_MIDI_TICK        = $10005;
  #BASS_SYNC_MIDI_TIMESIG     = $10006;
  #BASS_SYNC_MIDI_KEYSIG      = $10007;

  ; Additional #BASS_MIDI_StreamCreateFile/etc flags
  #BASS_MIDI_NOSYSRESET       = $800;
  #BASS_MIDI_DECAYEND         = $1000;
  #BASS_MIDI_NOFX             = $2000;
  #BASS_MIDI_DECAYSEEK        = $4000;
  #BASS_MIDI_NOCROP           = $8000;
  #BASS_MIDI_NOTEOFF1         = $10000;
  #BASS_MIDI_SINCINTER        = $800000;

  ; #BASS_MIDI_FontInit flags
  #BASS_MIDI_FONT_MEM         = $10000;
  #BASS_MIDI_FONT_MMAP        = $20000;
  #BASS_MIDI_FONT_XGDRUMS     = $40000;

  ; #BASS_MIDI_StreamSet/GetFonts flag
  #BASS_MIDI_FONT_EX          = $1000000; // #BASS_MIDI_FONTEX

  ; Marker types
  #BASS_MIDI_MARK_MARKER      = 0; // marker events
  #BASS_MIDI_MARK_CUE         = 1; // cue events
  #BASS_MIDI_MARK_LYRIC       = 2; // lyric events
  #BASS_MIDI_MARK_TEXT        = 3; // text events
  #BASS_MIDI_MARK_TIMESIG     = 4; // time signature
  #BASS_MIDI_MARK_KEYSIG      = 5; // key signature
  #BASS_MIDI_MARK_COPY        = 6; // copyright notice
  #BASS_MIDI_MARK_TRACK       = 7; // track name
  #BASS_MIDI_MARK_INST        = 8; // instrument name
  #BASS_MIDI_MARK_TICK        = $10000; // FLAG: get position in ticks (otherwise bytes)

 ; // MIDI events
  #MIDI_EVENT_NOTE            = 1;
  #MIDI_EVENT_PROGRAM         = 2;
  #MIDI_EVENT_CHANPRES        = 3;
  #MIDI_EVENT_PITCH           = 4;
  #MIDI_EVENT_PITCHRANGE      = 5;
  #MIDI_EVENT_DRUMS           = 6;
  #MIDI_EVENT_FINETUNE        = 7;
  #MIDI_EVENT_COARSETUNE      = 8;
  #MIDI_EVENT_MASTERVOL       = 9;
  #MIDI_EVENT_BANK            = 10;
  #MIDI_EVENT_MODULATION      = 11;
  #MIDI_EVENT_VOLUME          = 12;
  #MIDI_EVENT_PAN             = 13;
  #MIDI_EVENT_EXPRESSION      = 14;
  #MIDI_EVENT_SUSTAIN         = 15;
  #MIDI_EVENT_SOUNDOFF        = 16;
  #MIDI_EVENT_RESET           = 17;
  #MIDI_EVENT_NOTESOFF        = 18;
  #MIDI_EVENT_PORTAMENTO      = 19;
  #MIDI_EVENT_PORTATIME       = 20;
  #MIDI_EVENT_PORTANOTE       = 21;
  #MIDI_EVENT_MODE            = 22;
  #MIDI_EVENT_REVERB          = 23;
  #MIDI_EVENT_CHORUS          = 24;
  #MIDI_EVENT_CUTOFF          = 25;
  #MIDI_EVENT_RESONANCE       = 26;
  #MIDI_EVENT_RELEASE         = 27;
  #MIDI_EVENT_ATTACK          = 28;
  #MIDI_EVENT_DECAY           = 29;
  #MIDI_EVENT_REVERB_MACRO    = 30;
  #MIDI_EVENT_CHORUS_MACRO    = 31;
  #MIDI_EVENT_REVERB_TIME     = 32;
  #MIDI_EVENT_REVERB_DELAY    = 33;
  #MIDI_EVENT_REVERB_LOCUTOFF = 34;
  #MIDI_EVENT_REVERB_HICUTOFF = 35;
  #MIDI_EVENT_REVERB_LEVEL    = 36;
  #MIDI_EVENT_CHORUS_DELAY    = 37;
  #MIDI_EVENT_CHORUS_DEPTH    = 38;
  #MIDI_EVENT_CHORUS_RATE     = 39;
  #MIDI_EVENT_CHORUS_FEEDBACK = 40;
  #MIDI_EVENT_CHORUS_LEVEL    = 41;
  #MIDI_EVENT_CHORUS_REVERB   = 42;
  #MIDI_EVENT_USERFX          = 43;
  #MIDI_EVENT_USERFX_LEVEL    = 44;
  #MIDI_EVENT_USERFX_REVERB   = 45;
  #MIDI_EVENT_USERFX_CHORUS   = 46;
  #MIDI_EVENT_DRUM_FINETUNE   = 50;
  #MIDI_EVENT_DRUM_COARSETUNE = 51;
  #MIDI_EVENT_DRUM_PAN        = 52;
  #MIDI_EVENT_DRUM_REVERB     = 53;
  #MIDI_EVENT_DRUM_CHORUS     = 54;
  #MIDI_EVENT_DRUM_CUTOFF     = 55;
  #MIDI_EVENT_DRUM_RESONANCE  = 56;
  #MIDI_EVENT_DRUM_LEVEL      = 57;
  #MIDI_EVENT_DRUM_USERFX     = 58;
  #MIDI_EVENT_SOFT            = 60;
  #MIDI_EVENT_SYSTEM          = 61;
  #MIDI_EVENT_TEMPO           = 62;
  #MIDI_EVENT_SCALETUNING     = 63;
  #MIDI_EVENT_CONTROL         = 64;
  #MIDI_EVENT_CHANPRES_VIBRATO = 65;
  #MIDI_EVENT_CHANPRES_PITCH  = 66;
  #MIDI_EVENT_CHANPRES_FILTER = 67;
  #MIDI_EVENT_CHANPRES_VOLUME = 68;
  #MIDI_EVENT_MODRANGE        = 69;
  #MIDI_EVENT_BANK_LSB        = 70;
  #MIDI_EVENT_KEYPRES         = 71;
  #MIDI_EVENT_KEYPRES_VIBRATO = 72;
  #MIDI_EVENT_KEYPRES_PITCH   = 73;
  #MIDI_EVENT_KEYPRES_FILTER  = 74;
  #MIDI_EVENT_KEYPRES_VOLUME  = 75;
  #MIDI_EVENT_MIXLEVEL        = $10000;
  #MIDI_EVENT_TRANSPOSE       = $10001;
  #MIDI_EVENT_SYSTEMEX        = $10002;

  #MIDI_EVENT_END             = 0;
  #MIDI_EVENT_END_TRACK       = $10003;

  #MIDI_SYSTEM_DEFAULT        = 0;
  #MIDI_SYSTEM_GM1            = 1;
  #MIDI_SYSTEM_GM2            = 2;
  #MIDI_SYSTEM_XG             = 3;
  #MIDI_SYSTEM_GS             = 4;

  ;// BASS_MIDI_StreamEvents modes
  #BASS_MIDI_EVENTS_STRUCT    = 0; // #BASS_MIDI_EVENT structures
  #BASS_MIDI_EVENTS_RAW       = $10000; // raw MIDI event data
  #BASS_MIDI_EVENTS_SYNC      = $1000000; // FLAG: trigger event syncs
  #BASS_MIDI_EVENTS_NORSTATUS = $2000000; // FLAG: no running status

  ;// #BASS_MIDI_StreamGetChannel special channels
  #BASS_MIDI_CHAN_CHORUS      = LongWord(-1);
  #BASS_MIDI_CHAN_REVERB      = LongWord(-2);
  #BASS_MIDI_CHAN_USERFX      = LongWord(-3);

  ;// #BASS_CHANNELINFO type
  #BASS_CTYPE_STREAM_MIDI     = $10d00;

  ;// Additional attributes
  #BASS_ATTRIB_MIDI_PPQN      = $12000;
  #BASS_ATTRIB_MIDI_CPU       = $12001;
  #BASS_ATTRIB_MIDI_CHANS     = $12002;
  #BASS_ATTRIB_MIDI_VOICES    = $12003;
  #BASS_ATTRIB_MIDI_VOICES_ACTIVE = $12004;
  #BASS_ATTRIB_MIDI_TRACK_VOL = $12100; // + track #

  ;// Additional tag type
  #BASS_TAG_MIDI_TRACK        = $11000; // + track #, track text : array of null-terminated ANSI strings

  ;// #BASS_ChannelGetLength/GetPosition/SetPosition mode
  #BASS_POS_MIDI_TICK         = 2; // tick position

  ;// #BASS_MIDI_FontPack flags
  #BASS_MIDI_PACK_NOHEAD      = 1; // don't send a WAV header to the encoder
  #BASS_MIDI_PACK_16BIT       = 2; // discard low 8 bits of 24-bit sample data
 
  Import "bassmidi.lib"
  BASS_MIDI_ConvertEvents(a.i, b.i, c.i, d.i, e.i) As "_BASS_MIDI_ConvertEvents@20"
  BASS_MIDI_FontCompact(a.i) As "_BASS_MIDI_FontCompact@4"
  BASS_MIDI_FontFree(a.i) As "_BASS_MIDI_FontFree@4"
  BASS_MIDI_FontGetInfo(a.i, b.i) As "_BASS_MIDI_FontGetInfo@8"
  BASS_MIDI_FontGetPreset(a.i, b.i, c.i) As "_BASS_MIDI_FontGetPreset@12"
  BASS_MIDI_FontGetPresets(a.i, b.i) As "_BASS_MIDI_FontGetPresets@8"
  BASS_MIDI_FontGetVolume(a.i) As "_BASS_MIDI_FontGetVolume@4"
  BASS_MIDI_FontInit(a.i, b.i) As "_BASS_MIDI_FontInit@8"
  BASS_MIDI_FontInitUser(a.i, b.i, c.i) As "_BASS_MIDI_FontInitUser@12"
  BASS_MIDI_FontLoad(a.i, b.i, c.i) As "_BASS_MIDI_FontLoad@12"
  BASS_MIDI_FontPack(a.i, b.i, c.i, d.i) As "_BASS_MIDI_FontPack@16"
  BASS_MIDI_FontSetVolume(a.i, b.i) As "_BASS_MIDI_FontSetVolume@8"
  BASS_MIDI_FontUnload(a.i, b.i, c.i) As "_BASS_MIDI_FontUnload@12"
  BASS_MIDI_FontUnpack(a.i, b.i, c.i) As "_BASS_MIDI_FontUnpack@12"
  BASS_MIDI_InFree(a.i) As "_BASS_MIDI_InFree@4"
  BASS_MIDI_InGetDeviceInfo(a.i, b.i) As "_BASS_MIDI_InGetDeviceInfo@8"
  BASS_MIDI_InInit(a.i, b.i, c.i) As "_BASS_MIDI_InInit@12"
  BASS_MIDI_InStart(a.i) As "_BASS_MIDI_InStart@4"
  BASS_MIDI_InStop(a.i) As "_BASS_MIDI_InStop@4"
  BASS_MIDI_StreamCreate(a.i, b.i, c.i) As "_BASS_MIDI_StreamCreate@12"
  BASS_MIDI_StreamCreateEvents(a.i, b.i, c.i, d.i) As "_BASS_MIDI_StreamCreateEvents@16"
  BASS_MIDI_StreamCreateFile(a.i, b.i, c.q, d.q, e.i, f.i) As "_BASS_MIDI_StreamCreateFile@32"
  BASS_MIDI_StreamCreateFileUser(a.i, b.i, c.i, d.i, e.i) As "_BASS_MIDI_StreamCreateFileUser@20"
  BASS_MIDI_StreamCreateURL(a.i, b.i, c.i, d.i, e.i, f.i) As "_BASS_MIDI_StreamCreateURL@24"
  BASS_MIDI_StreamEvent(a.i, b.i, c.i, d.i) As "_BASS_MIDI_StreamEvent@16"
  BASS_MIDI_StreamEvents(a.i, b.i, c.i, d.i) As "_BASS_MIDI_StreamEvents@16"
  BASS_MIDI_StreamGetChannel(a.i, b.i) As "_BASS_MIDI_StreamGetChannel@8"
  BASS_MIDI_StreamGetEvent(a.i, b.i, c.i) As "_BASS_MIDI_StreamGetEvent@12"
  BASS_MIDI_StreamGetEvents(a.i, b.i, c.i, d.i) As "_BASS_MIDI_StreamGetEvents@16"
  BASS_MIDI_StreamGetEventsEx(a.i, b.i, c.i, d.i, e.i, f.i) As "_BASS_MIDI_StreamGetEventsEx@24"
  BASS_MIDI_StreamGetFonts(a.i, b.i, c.i) As "_BASS_MIDI_StreamGetFonts@12"
  BASS_MIDI_StreamGetMark(a.i, b.i, c.i, d.i) As "_BASS_MIDI_StreamGetMark@16"
  BASS_MIDI_StreamGetMarks(a.i, b.i, c.i, d.i) As "_BASS_MIDI_StreamGetMarks@16"
  BASS_MIDI_StreamGetPreset(a.i, b.i, c.i) As "_BASS_MIDI_StreamGetPreset@12"
  BASS_MIDI_StreamLoadSamples(a.i) As "_BASS_MIDI_StreamLoadSamples@4"
  BASS_MIDI_StreamSetFilter(a.i, b.i, c.i, d.i) As "_BASS_MIDI_StreamSetFilter@16"
  BASS_MIDI_StreamSetFonts(a.i, b.i, c.i) As "_BASS_MIDI_StreamSetFonts@12"
  BASSplugin(a.i) As "_BASSplugin@4"
EndImport

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple sound Player using BASS [Stereo & Mono Files]
PostPosted: Sun Jun 17, 2018 1:19 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jun 24, 2006 3:29 am
Posts: 274
Location: Edinburgh, Scotland.
RASHAD: Thanx mate... your updated pbi fixes something... but now...

Code:
POLINK: fatal error: File not found: 'bass.lib'.


Win 7 x64, newest x86 PB beta, bass v2.4.13.8

... maybe its the PB beta? :D

_________________
Proud supporter of PB! * Musician * C64/6502 Freak


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple sound Player using BASS [Stereo & Mono Files]
PostPosted: Sun Jun 17, 2018 1:46 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3941
Hi again
UN4SEEN -- bass24.zip ---- c ---- bass.lib 24.39 KB
bass24.zip ----- bass.dll 121.15 KB
bass.pbi 37.03 KB

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple sound Player using BASS [Stereo & Mono Files]
PostPosted: Sun Jun 17, 2018 2:13 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jun 24, 2006 3:29 am
Posts: 274
Location: Edinburgh, Scotland.
Thanx very much RASHAD. I didn't realise the .lib was needed...

Works very nice, im grateful.

BASS is a great library... I had known about it for a long time... I like the demoscene... its often used in (shush) keygenerators in the warez scene afair for old school chipmusic... but it's the first time i played around with it... i will try to use the ASIO stuff soon. This is a great starting point...

Again thx for the help. :D

_________________
Proud supporter of PB! * Musician * C64/6502 Freak


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple sound Player using BASS [Stereo & Mono Files]
PostPosted: Sun Jun 17, 2018 2:27 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3941
You are welcome
From your signature it is obvious that we will get good additions and good help
Yees ? :P

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Simple sound Player using BASS [Stereo & Mono Files]
PostPosted: Sun Jun 17, 2018 4:29 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jun 24, 2006 3:29 am
Posts: 274
Location: Edinburgh, Scotland.
I will do my best :)

_________________
Proud supporter of PB! * Musician * C64/6502 Freak


Top
 Profile  
Reply with quote  
 Post subject: Re: Ver #2 :Simple sound Player using BASS [Stereo & Mono Fi
PostPosted: Wed Jun 20, 2018 6:33 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3941
Ver #2 :
Just for fun :wink:
Code:
; Based on :
; The discussion forum by Martin Verlaan
; https://www.purebasic.fr/english/viewtopic.php?f=13&t=70823
; And code by :
; Roger Hهgensen , Celtic88(c) & wilbert
;
; You have To include :
; 1- bass.dll
; 2- bassflac.dll
; 3- bass_ac3.dll
; 4- basswma.dll

UsePNGImageDecoder()
IncludeFile "bass.pbi"
DisableDebugger

Global chans,length.q,pos.q,ppos.q,oldpos.q,channel,wavecolor,wavespace,ww,hh

Structure Sample
  l.w
  r.w
EndStructure

Procedure tbCB()
  If BASS_ChannelIsActive(channel) = #BASS_ACTIVE_PLAYING
    BASS_SetVolume(GetGadgetState(8)/10)
  EndIf
EndProcedure

Procedure waveP(par)
  Repeat
    If channel And BASS_ChannelIsActive(channel) = #BASS_ACTIVE_PLAYING
      pos.q = BASS_ChannelGetPosition(channel,#BASS_POS_BYTE)
      ppos.q = pos.q*$2000/length.q
      SetScrollPos_(WindowID(2), #SB_HORZ,ppos.q,1)
      ResizeGadget(1,-ppos.q,hh/2-368/2,$2000, 275)
      oldpos.q = pos.q
    ElseIf channel And pos.q = oldpos.q
      BASS_ChannelSetPosition(channel,0,#BASS_POS_BYTE)
      SetScrollPos_(WindowID(2), #SB_HORZ,0,1)
      ResizeGadget(1,0,#PB_Ignore,$2000, 275)
      If GetGadgetState(5) = ImageID(2)
        SetGadgetState(5,ImageID(1))
      EndIf
    EndIf
    Delay(15)
  ForEver
EndProcedure

Procedure UpdateWaveImage(PBImage, *SampleData.Sample, SampleCount,Numchans)
  If *SampleData And SampleCount
    StartDrawing(ImageOutput(PBImage))
    Width = OutputWidth() : Height = OutputHeight()
    VOffsetL = Height >> Numchans : VOffsetR = VOffsetL + Height >> 1
    Box(0, 0, Width, Height, $00FF00)
    If Numchans = 1
      MUL = (VOffsetL * $19999) >> 15   
      Line(0, VOffsetL, Width, 1, wavecolor)
    Else
      MUL = (VOffsetL * $19999) >> 15
      Line(0, VOffsetR, Width, 1, wavecolor)
    EndIf
    SamplesPerPixel = (SampleCount + Width - 1) / Width
    SampleSize = Numchans * 2
    If SampleCount
      MinL = *SampleData\l : MinR = *SampleData\r : MaxL = MinL : MaxR = MinR     
      While SampleCount
        If *SampleData\l < MinL : MinL = *SampleData\l : ElseIf *SampleData\l > MaxL : MaxL = *SampleData\l : EndIf
        If *SampleData\r < MinR : MinR = *SampleData\r : ElseIf *SampleData\r > MaxR : MaxR = *SampleData\r : EndIf
        Sample + 1 : SampleCount - 1
        If Sample = SamplesPerPixel Or SampleCount = 0
          MinL = (MinL * MUL) >> 16 : MaxL = (MaxL * MUL) >> 16
          MinR = (MinR * MUL) >> 16 : MaxR = (MaxR * MUL) >> 16
          LineXY(X, VOffsetL - MinL, X, VOffsetL - MaxL, wavecolor)
          If Numchans = 2 :LineXY(X, VOffsetR - MinR, X, VOffsetR - MaxR, wavecolor):EndIf
          MinL = *SampleData\l : MinR = *SampleData\r : MaxL = MinL : MaxR = MinR
          X + 1 : Sample = 0
        EndIf
        *SampleData + SampleSize
      Wend
    EndIf
    StopDrawing()
  EndIf
EndProcedure

Procedure winCB(hwnd, uMsg, wParam, lParam)
  GetWindowRect_(WindowID(0),r0.RECT)
  xx = r0\left : yy = r0\top : ww = r0\right-r0\left : hh = r0\bottom-r0\top 
 result = #PB_ProcessPureBasicEvents

  Select uMsg
    Case #WM_NCACTIVATE
      Result = 1
   
    Case #WM_MOVE
      SmartWindowRefresh(0,0)
      MoveWindow_(WindowID(1),xx+45,yy+45, ww-65,hh-115,1)
      MoveWindow_(WindowID(2),xx+45,yy+45, ww-65,hh-115,1)
      SmartWindowRefresh(0,1)       
   
    Case #WM_SIZE
      SmartWindowRefresh(0,0)
      MoveWindow_(WindowID(1),xx+45,yy+45, ww-65,hh-115,1)
      MoveWindow_(WindowID(2),xx+45,yy+45, ww-65,hh-115,1)
      MoveWindow_(GadgetID(1),0,hh/2-185, $2000, 275,1)
      MoveWindow_(GadgetID(2),10,hh/2-145, 18,200,1)
      MoveWindow_(GadgetID(3),10,hh-90, ww-35,40,1)
      SmartWindowRefresh(0,1)     
         
    Case #WM_HSCROLL
      If hWnd = WindowID(2)
        Select wParam & $FFFF
          Case #SB_LINELEFT
               Result = GetScrollPos_(WindowID(2), #SB_HORZ)
               If Result >= 1
                  SetScrollPos_(WindowID(2), #SB_HORZ,Result-1,1)
                EndIf
     
          Case #SB_LINERIGHT
               Result = GetScrollPos_(WindowID(2), #SB_HORZ)
               If Result <= $2000
                  SetScrollPos_(WindowID(2), #SB_HORZ,Result+1,1)
               EndIf
               
          Case #SB_THUMBTRACK
              BASS_ChannelPause(channel)
              Result2 = GetScrollPos_(WindowID(2) , #SB_HORZ)
              Result = (wParam >> 16 & $FFFF)
              If Result >= 0
                SetScrollPos_(WindowID(2), #SB_HORZ,Result,1)
              ElseIf Result <= $2000
                SetScrollPos_(WindowID(2), #SB_HORZ,Result,1)
              EndIf
        EndSelect             
        pos.q = GetScrollPos_(WindowID(2) , #SB_HORZ)*length.q/$2000
        BASS_ChannelSetPosition(channel,pos.q,#BASS_POS_BYTE)
        ppos.q = pos.q*$2000/length.q
        ResizeGadget(1,-ppos.q,hh/2-368/2,$2000, 275)
        If GetGadgetState(5) = ImageID(2)
          SetGadgetState(5,ImageID(1))
        EndIf
      EndIf       
   EndSelect   
  ProcedureReturn result
EndProcedure

CatchImage(0,?open)
CatchImage(1,?play)
CatchImage(2,?pause)
CatchImage(3,?stop)
CatchImage(4,?high)
CatchImage(5,?mute)

wavecolor = $8EFE9C
pbcolor = $A0A0A1
plcolor = $C4C4C5

CreateImage(100,40,40,24,pbcolor)
StartDrawing(ImageOutput(100))
  For x = 0 To 40 Step 20
    LineXY(x,0,x,40,plcolor)
  Next
  For y = 0 To 40 Step 20
    LineXY(0,y,40,y,plcolor)
  Next
StopDrawing()

ihandle = CreatePatternBrush_(ImageID(100))

OpenWindow(0, 0, 0, 660, 370, "Waveform", #PB_Window_Invisible| #PB_Window_SystemMenu | #PB_Window_MaximizeGadget| #PB_Window_ScreenCentered|#PB_Window_SizeGadget)
SmartWindowRefresh(0,1)
ww = WindowWidth(0)
hh = WindowHeight(0)
SetWindowColor(0,$6F6F6F)
WindowBounds(0,660,370,#PB_Ignore,#PB_Ignore)
OpenWindow(1, WindowX(0,#PB_Window_InnerCoordinate)+40, WindowY(0,#PB_Window_InnerCoordinate)+10, 605, 300, "Waveform", #PB_Window_BorderLess ,WindowID(0))
SetClassLongPtr_(WindowID(1), #GCL_HBRBACKGROUND, ihandle)
InvalidateRect_(WindowID(1),0,1)
DisableWindow(1,1)
OpenWindow(2, WindowX(0,#PB_Window_InnerCoordinate)+40,WindowY(0,#PB_Window_InnerCoordinate)+10, 605, 300, "Waveform", #PB_Window_BorderLess | #WS_HSCROLL | #WS_BORDER ,WindowID(0))
SetWindowColor(2,$00FF00)
SetWindowLong_(WindowID(2),#GWL_EXSTYLE,#WS_EX_LAYERED)
SetLayeredWindowAttributes_(WindowID(2),$00FF00,0,#LWA_COLORKEY)
;SetParent_(WindowID(2),WindowID(1))
SetScrollRange_(WindowID(2),#SB_HORZ,0,$2000,1)
WaveImage = CreateImage(#PB_Any, $2000, 275)
UseGadgetList(WindowID(2))
ImageGadget(1, 0, 0, $2000, 275, 0)

UseGadgetList(WindowID(0))
ScrollBarGadget  (2, 10, 50,  18, 200 ,1, 10, 1, #PB_ScrollBar_Vertical)

ContainerGadget(3,10,320,640,40,#PB_Container_Flat)
SetGadgetColor(3,#PB_Gadget_BackColor,$94E7FE)
  ImageGadget  (4,5,5,40,20,ImageID(0))
  GadgetToolTip(4, "Load")
  ImageGadget (5,40,5,40,20,ImageID(1))
  GadgetToolTip(5, "Play/Pause")
  ImageGadget (6,75,5,40,20,ImageID(3))
  GadgetToolTip(6, "Stop")
  ImageGadget (7,110,5,40,20,ImageID(4))
  GadgetToolTip(7, "Mute On/Off")
  TrackBarGadget(8,145,8,100,20,1,10,#TBS_FIXEDLENGTH |#WS_BORDER)
  GadgetToolTip(8, "Volume")
  SendMessage_(GadgetID(8), #TBM_SETTHUMBLENGTH,18,0)
  SetGadgetState(8,5)
CloseGadgetList()

SetActiveWindow(0)
SetWindowCallback(@winCB())

BASS_Init(-1, 44100, 0, 0, #Null)
BASS_SetVolume(0.5)
BASS_PluginLoad("bassflac.dll", #BASS_UNICODE)
BASS_PluginLoad("bass_ac3.dll", #BASS_UNICODE)
BASS_PluginLoad("basswma.dll", #BASS_UNICODE)
HideWindow(0,0)
BindGadgetEvent(8,@tbCB())
Thread = CreateThread(@WaveP(),30)
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      If IsThread(Thread)
        KillThread(Thread)
      EndIf
      BASS_Free()
      End
     
    Case #PB_Event_Gadget
      Select EventGadget()
         
        Case 4
          Select EventType()
            Case #PB_EventType_LeftClick
              If BASS_ChannelIsActive(channel) = #BASS_ACTIVE_PLAYING
                BASS_ChannelStop(channel)
                BASS_SampleFree(sample)
                SetGadgetState(5,ImageID(1))
                SetGadgetState(1,0)
                channel = 0
              EndIf                     
              filename.s = OpenFileRequester("","","*.*",0):If filename ="":End 1:EndIf
              channel = 0
              SetScrollPos_(WindowID(1), #SB_HORZ,0,1)
              ScrollWindowEx_(WindowID(1),0,0,0,0,0,0,#SW_ERASE|#SW_INVALIDATE|#SW_SCROLLCHILDREN)
              SetGadgetState(1,0)
              sample = BASS_SampleLoad(0, @filename, 0, 0, 65535, #BASS_UNICODE| #BASS_SAMPLE_SOFTWARE)
              info.BASS_SAMPLE
              BASS_SampleGetInfo(sample, @info)
              chans = info\chans
              length = info\length
              If chans >= 2
                chans = 2
              EndIf
              Dim Buffer.Sample(Length >> chans)
              BASS_SampleGetData(sample,@buffer())
              UpdateWaveImage(WaveImage, @Buffer(), Length >> Info\chans,Info\chans)
              SetGadgetState(1,ImageID(WaveImage))
              channel = BASS_SampleGetChannel(sample,1)
          EndSelect
         
        Case 5
          Select EventType()
            Case #PB_EventType_LeftClick
              If channel And GetGadgetState(5) = ImageID(1)
                SetGadgetState(5,ImageID(2))
                BASS_ChannelPlay(channel, 0)
              ElseIf channel And GetGadgetState(5) = ImageID(2)
                pos.q = GetScrollPos_(WindowID(2) , #SB_HORZ)*length.q/$2000
                BASS_ChannelPause(channel)
                SetScrollPos_(WindowID(2), #SB_HORZ,ppos.q,1)                             
                BASS_ChannelSetPosition(channel,pos.q,#BASS_POS_BYTE)
                SetGadgetState(5,ImageID(1))
              EndIf
          EndSelect         
         
        Case 6
          Select EventType()
            Case #PB_EventType_LeftClick
              If BASS_ChannelIsActive(channel) = #BASS_ACTIVE_PLAYING
                BASS_ChannelStop(channel)
                BASS_SampleFree(sample)
                SetScrollPos_(WindowID(2), #SB_HORZ,0,1)
                SetGadgetState(5,ImageID(1))
                SetGadgetState(1,0)
                channel = 0
              EndIf
          EndSelect
         
        Case 7
          Select EventType()
            Case #PB_EventType_LeftClick
              If BASS_ChannelIsActive(channel) = #BASS_ACTIVE_PLAYING
                Run ! 1
                If Run = 1
                  BASS_SetVolume(0)
                  SetGadgetState(7,ImageID(5))
                Else
                  SetGadgetState(7,ImageID(4))
                  BASS_SetVolume(GetGadgetState(8)/10)
                EndIf
              EndIf
          EndSelect         

      EndSelect
  EndSelect
ForEver

DataSection
Open:
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
   Data.q $0E0000C40E000073,$00001B0E2B9501C4,$8948544144496104,$C61C5554506D95A5,$905605F770BD977F
   Data.q $B011406C1500D95D,$731A729517A657A4,$751B4A719CB26346,$C7473218A531D274,$E638D585943E3197
   Data.q $4D63A3A98D143698,$A4943A0CA6A6314D,$E0AEB6F10D812438,$7BDEE2C2EEC8BBB2,$BE7AB35972E612FA
   Data.q $9CF739EFCE7FF3DD,$E54D10421247BDFF,$0FCF7DFA371C9287,$C634D3C97B722886,$172B64AE04D08109
   Data.q $C8E93E35A4F9462D,$68D218D17C7B97A6,$813D5CD3E287E501,$C417E615166143ED,$48FBB48C88A53FDD
   Data.q $4AE1EE1BC34086C4,$5FD6D4D50D753D47,$DC4B48C93E151809,$D80BA41757A975B2,$DCE9F3AEBB152958
   Data.q $1815E1EF33189F27,$04A85C212B403208,$26661A428F103001,$9F541537D9F04011,$D73BC58D2333B5FE
   Data.q $4A91EC9406A31F89,$C61897176BBBC684,$A2FA613D4FD0265B,$CE9812762C40216E,$4A19547F94F38E85
   Data.q $BA57C437C3F0B077,$8720E0E2A5FBF580,$04283560D6B95ADF,$2C64A44F9FA20669,$654B6CA769E6D1E4
   Data.q $6A2A55DA9E04E268,$9CBAD292AC6C056F,$E9313ACF315D2E5C,$BC75398A8DB4825E,$5D2639C99974D49F
   Data.q $AA6B9C593309062D,$721C9CB6D9C77CA1,$CDDD700CA08A9577,$3293D358A78F59F6,$E78F403A4809D209
   Data.q $B0364C4938363B26,$068F4886CC2CDBF7,$7C280A730783F9F8,$D8137D49A9A32EA4,$BED376E1C3ED952C
   Data.q $063426133885ECB9,$9CCD25B5E0817074,$EB3B25FF3003F1AF,$E0240D2DF51C4DB7,$979DDAB2BE5939F2
   Data.q $D73F20B3F7ECBA4B,$FABF5C17FCC26712,$7ADCF09ECE2E9503,$1995916149DFBC3E,$891C7E2ABCEAC733
   Data.q $5B33F7F5B172F20E,$86859D939599040E,$C03DB5A13746208A,$F3B44685099B1B7B,$5566C42BAD1C8DAB
   Data.q $F1A417A654347374,$5A67E0394CE731F5,$A10E33AA811DAA6A,$AEA0DE7C7AE2FAF2,$EF645F97EB09D036
   Data.q $92A04C2C469087A1,$55934E701020E199,$1884431C63467195,$B6BE70B5B73B96D9,$A83B47F7D61F075B
   Data.q $6AE826CB459637DC,$D35976371E1C6B16,$08B8C6281D7D3CD0,$A25B9B153F5D4343,$1F933D5569B587C2
   Data.q $BDEE3118DB332418,$6B9376B2115546E1,$6110D62DA240BEBE,$3FFE6AE67137CEC8,$B91AAA0C4AC80006
   Data.q $B25C048480771EC5,$949299E5D5D0D0A2,$DBD10B5CF430896C,$6C14131C02AEF37D,$63715FBF6311B129
   Data.q $6A6C9C314B20D234,$EC308F4BC9CC2DF2,$1577C32FEA95BB7E,$E791A5A595836CB0,$2CB2E3898A075F50
   Data.q $267E9FF781B1A473,$5870B96EFE58B168,$5B11C35614D155DF,$539C65F347D1D5D4,$2359CC108491A9F3
   Data.q $ECE2D9EEB3E5E455,$705ADB1549DE86BB,$0CA1F151F3FB5939,$41639D3FAD863890,$FFFB2CA4FA4F4E56
   Data.q $0D3D52E5689CD782,$3F5DFB6E18F953D9,$D2DDF2F6F2CD2A57,$C13FF58F71C536D5,$3780F6C1F374372F
   Data.q $88968A554F478B33,$6EDEFCD225798000,$5373B25662582E0E,$76AA36A9DCFC15FE,$141ECF8A78EA4F0B
   Data.q $35DCE65775C78667,$40569AA93B5763D2,$1DF376C93B5CD146,$A3E17D8E3EF6CEC1,$4CF178B3329702F1
   Data.q $3FA5EA3EBDBE6895,$EBE652F3EE649567,$C0F3B2D8C9A4F565,$834D16213E226E91,$F8D10EB574837D1B
   Data.q $77852D9746FEB40B,$6862E7F4E7B124C6,$4578CD6180D46B24,$CCC0383D98068632,$21A1763F7EF920F0
   Data.q $C28A8B898A5C668C,$D44407B5350A710F,$1C61D0D2F54FE60F,$4900000000C89CFF,$826042AE444E45
Openend:

play:
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
   Data.q $0E0000C40E000073,$00001B0E2B9501C4,$8948544144498804,$871855536C7D959D,$75656ED76D2F4B9F
   Data.q $58C9B81B716BAB2B,$1884BE544A093207,$8BA1F2A250160120,$3326866858C09532,$43128822518B9980
   Data.q $90D10100C674C282,$C274420CB087CA28,$3E52B18C64D83714,$7BDED76BB6B1B74A,$F7F412DAD83703FC
   Data.q $EF39CF7F7DE73DDF,$553C4108495E737D,$082E77756F5B36EE,$0CAAA1C0E9EE9886,$CE2629DC0AA10217
   Data.q $EF79A25311F2F518,$6290F3C677AE4B3B,$FDD7DCDA27772A01,$A05F949C5E11BD15,$48E36D3274F4747D
   Data.q $CD3AE4474A811526,$5D6D483FAA9C756D,$792DA67B63AF5FB3,$A01450288EA286FD,$9CC760DF742A4ABC
   Data.q $1A39713B9B0F4FC9,$010A370842D0F402,$918186C3A2243400,$8F071360797C11F8,$ABCDD2C6D33975FD
   Data.q $52A4DBA501712FC5,$08CD52D2C961F2A1,$B8AE8447537443E3,$73C624858A180425,$D90AA93F2A37EDBA
   Data.q $05177C46B2DA2CAD,$CF641030A90BEB78,$804746931A25C5DB,$46325033FFFC40F3,$2ABEB6512F7AB41C
   Data.q $DA8A756CCF10F194,$D1776B64B579407E,$451E6194D73E5CE0,$B90CC8A822005680,$B273640C2410C42F
   Data.q $73735A278DCA86B1,$86E0190114EADBC9,$E6EC99A54F698A87,$342E0024065C022C,$169DCB2AEEBCD985
   Data.q $7C054027BC663FC6,$3F1E93016E42645C,$49D605ACA8D8D995,$AEB4B878F5639F65,$F4F4A809026D39EC
   Data.q $19AF3C500B9E3527,$95AD7D7892538980,$8490D209EE194787,$8E3D07C5ABC5D3BB,$3CFCC2C7CFB2EC3C
   Data.q $80D2E6BFC30136A3,$2F21ED400C387084,$8A01EF31997B0E27,$140262E9A5B1DAD7,$ED48F238AD93587C
   Data.q $372D300FECA666EE,$8ADEA83105151B27,$2EC0ED6034285080,$AC5782CABBEE3F37,$28C6D46CC0CCE6BC
   Data.q $77EFDF1B02F8C297,$5BA7A6C63EFD954D,$8304284281512810,$45CB6AA10663E8C1,$658324A8A368ECF6
   Data.q $28793BE4683132AB,$65635DFBF15A6564,$1097A5AF5EB86145,$E80D8E1C37B2DB83,$3F3B0379636104E3
   Data.q $9C582C390DEAC0BD,$B07AF1693467BFDE,$A7436AEDEA8AAAC8,$A255102F876ABE8F,$1F9C6A33D02DCA58
   Data.q $8A0F2DEE4EEDA06F,$FCBB3B5730D59082,$386A89513543A9C9,$26E34FAE9744A282,$DB84C71D9EFA5025
   Data.q $2927E3D7AC777C2D,$EEDEDF51D3ACB709,$1C70F3EE894E6D1D,$E4CEDF79AC066B73,$EFEE3A22C6DBE6D9
   Data.q $8434B2F53D7A0F66,$F61D728B9D8D8D23,$35ADF0191A88A0A8,$43492FE6548AAAC0,$DD494FF8944448D2
   Data.q $ECCB2CB3F025D029,$180D9E3347CF5B3D,$39DF091DBD81C68D,$F43625C591A752D9,$5FAE9A312A2A0D7A
   Data.q $2635C06F9C5D6DED,$D295ACC108491A9F,$0CE61767AB3E4726,$374EEDF1F7AA6C08,$D8E3914A6167946F
   Data.q $945DB84DBBD36B45,$BC1084916C4FBAFC,$4BE7F1715F252E50,$36FB96D991F6C945,$556D542DC39AA58A
   Data.q $A2EDA7F130C673EA,$75A694EF9EB9FFB7,$EB3AA915A287E4DC,$8D7F50DE65FFA683,$713CD9591DFC2B8F
   Data.q $B73381A0C1344AB4,$2E16BB1AF3779A54,$F993FED2F272E833,$E9BC267F54ADA3C9,$5BEF1C4BB13C2823
   Data.q $5E4F4A5673991A8F,$CFA73202D8F54CB9,$BAE9EBF7B96290B1,$9A7B393BAFFEC5D4,$38B578FE79B2B23F
   Data.q $4DEB3FA1CC7EF77F,$564DE75941D5D0C9,$ED58071CD4847C8C,$56E155450D262409,$0EFECE5E96F69057
   Data.q $6183E34D4F68E72D,$F60EF44AFB1DB666,$7D259794D3E8098A,$8246A61EC19987A8,$1BD08A84587CFBE4
   Data.q $4871D3A33812EB70,$E789111BF6A6A3AB,$67D0BBEC7ABC0FF1,$454900000000DF7C,$826042AE444E
playend:

pause:
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
   Data.q $0E0000C40E000073,$00001B0E2B9501C4,$8948544144496F04,$C61465536C7D959D,$B656C7EDEBBDB77F
   Data.q $FB26CC36036541D0,$0C4A017E25069942,$8B2446A251174C92,$304D4CB8B0212881,$310C511A07F64240
   Data.q $241218094E19288B,$4E24201610153826,$151B18E662264C98,$EFBBB6BB6B76BAE8,$119BBBACB463FD7D
   Data.q $E73CF39F79F77FCF,$C992948ABEE7379C,$F82870778E40E1A2,$86E500FF12CE2C5C,$D537C486912934C1
   Data.q $CCCEE63D5D9779CD,$699382372BEEF839,$F3CCC81C34191328,$B0B4BCE84B6C88DD,$E41425DCDF76D2A2
   Data.q $FA0306241E364BDD,$85BDB671B4F72E0D,$05DD8D7623976D53,$8C980CD6B65BD979,$4DDF6A949A9B064C
   Data.q $0B5529D1EC7F2CF6,$F1C45D30CA2560D6,$3C8D132560028821,$3BB7EF648221CC9C,$563C82D5DBF13968
   Data.q $6D41A934FE51B87D,$AAB0DBDE0D2B52A3,$D0DA218B35D33AD6,$C9720C80423A4D09,$E3E1A67E7AE73E62
   Data.q $94DF3B9597BE78A6,$8EA95CFEDE0C98DF,$6EAC1BB59DFAF8C6,$93F7E4C04B9446AB,$A15C0EE9CA2E2A1E
   Data.q $D89E2CF67C534B7E,$2B35360CA54F2755,$E5535BAC5C7DBD79,$A3FFBA5137739D9E,$3388A4E0A0B0EDF0
   Data.q $A4BBBA7FBC34AD9D,$DC02AA32755DB284,$F9DDD323F16DB3F4,$C400280AB9448539,$AECD001FA769A484
   Data.q $6E3B8D000F75FAB0,$60A0643D6A6B84A6,$164A9281E2FE6100,$05BC53B3A0B6783E,$73F7EBC33FEA566C
   Data.q $0C0E0736F3FD7365,$FBAA9D5183C95386,$BA7C3958E770013B,$EF9C521725458014,$2B6FA9AD5BB14A3A
   Data.q $C5B6B6BC7D82F859,$A2B30E1ABE465E5F,$AE25BCE07365CCA2,$00244890A2D2C8A4,$30031259D4D42448
   Data.q $BDB378C208E5A4B0,$1AA9621A19E19794,$810308B8A4B8B289,$3C7880C3573692C4,$01893CFB7E3C400E
   Data.q $7995F9821E731448,$99848D48B7D43E1C,$38BA61122E466337,$9B4E6991D1E1E180,$B0A0890F8C5A4B09
   Data.q $82154F37D2244BC0,$791371048DBB7669,$D2716E303A63E844,$9C5CD5848245D03B,$0C355727E0236DCB
   Data.q $91336ECD07A8408C,$6D7B7474689D2182,$0614801ED1020C8E,$B94C52E1C5EA1FD0,$08C6AA40847E8303
   Data.q $D5864F6C9143077F,$70D8C45C90421244,$86FDBB1D2B462102,$423F80DCE6108231,$EDEF68D3553E1656
   Data.q $749132EA99CDCC0D,$1E690838B1EB76E3,$FFC2C131906188C5,$58AABB4EDD8FD979,$9E52595C19D9D638
   Data.q $1741D4818C60EE6F,$511E61740C212566,$2AAAA0FC1CD059DB,$A2A7C9E0F9DA3B07,$57A440EF4B4B972E
   Data.q $C3C6085D03B9842C,$B4AFA45D2E213DBD,$D97FB2ADABF55682,$9F1B5D2DA3D3E57A,$6B0B766A234E2EAE
   Data.q $DFA0B766CE8E8CB6,$8532A8B00312511A,$B2F34C6B9EDF6327,$2F252915D4A348FD,$E5E171F5AFB2526E
   Data.q $2AA6B94539FCEC9A,$4BB4D1768F5A24EF,$32DDFBE0B29717B4,$1E2CA75B3F5DFA91,$BDE68F3ACD48E7E8
   Data.q $E75FB62FC4BFFDCB,$3A1E22C281916DA3,$554E0F7180FF24DE,$78AFF675FF4CF2AD,$F123BF4D9715A9D5
   Data.q $660644FE69BBC733,$8932797EF4FAA4CC,$AF8795EBE5CC9E9B,$964B05255E79A55D,$7DC2AFF9D73532E7
   Data.q $39C74832FA1C4257,$F2CD9385E22C2D7E,$6F65FD1F09F3D8D2,$D67EC1F500D0CE28,$F37839714F07B9CD
   Data.q $183018606566641D,$E817E3A095DBD18A,$C94FB674CF5E9DFA,$6B5E313217C4F1A1,$C7B15ABE3C648342
   Data.q $A31E91661B1A5987,$13BB481A57261C22,$4DA3F1A6BCE0E69F,$F1A64FA93ED4F5A3,$40E7F08C0FBBC50F
   Data.q $4E454900000000DC,$826042AE44
pauseend:

stop:
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
   Data.q $0E0000C40E000073,$00001B0E2B9501C4,$8948544144490604,$C71465536C6D95A5,$5B2B65F6F4BD777F
   Data.q $CA4E986C0742B2B6,$250C6F89518B21BA,$D11312538BA09706,$3532E2C084890310,$314E3507D96600C1
   Data.q $60C14474C97C4944,$82016105059898D0,$5B6399809904613A,$1DEDBDAC2FAE8CAD,$D2BAE93083F1F7BD
   Data.q $EFFF9CE4F76FFFA1,$2084248F39B9E739,$458CAEB916F6DA9B,$19F1860F2C6A489E,$B14082184084B306
   Data.q $5F91D07C8B765383,$3CD9224667D5EFB4,$81DDF37B6D00A9A4,$5697A78A78EB7891,$F7729CB858EF9AD7
   Data.q $8D4E106041290A62,$1C5DBD1387B06170,$EE507C28B710B9ED,$9403386D7DB6DC2E,$F32E043521D2D801
   Data.q $D7755CCFF703FD71,$802347E824A84C3A,$D8DC147C89800A8E,$D3B4DF27C11C4058,$DE6B3772A1D7F875
   Data.q $25DA680AC87E2CDE,$3269AD3637830935,$44521E8C63CFB5CD,$580A4E0660108EB3,$43B77B699FC1C9C2
   Data.q $ABE28BC77AB1732B,$926A0D491FCBC00C,$2930E4C9BF595E2F,$64BA4FDFB2039CA8,$5B65A45D0818F8EC
   Data.q $166CED0F1E7F3687,$B0F7253A5B002747,$17E63956EBCDB39F,$55FF8D34C0CA86DD,$A6EBEF1C3C36121E
   Data.q $3B552F5E0363CDED,$5AD20E5C032A859B,$9502A8ACA3A95F77,$0EEE548900424021,$C6200C2498B024F2
   Data.q $27DDE965ADE9DC1F,$52AD8097F4FAFBCA,$6D6E2E4182B887CB,$8002418AC56CD279,$804E5CF8BF53AEA4
   Data.q $BE272A07E7CCB673,$7D7E79F88810144D,$D18B1C994557D057,$335DB15B37655D58,$E64C9923C8300097
   Data.q $3A003513CDC6A404,$8C94557C2E855C31,$2B79D4AB8E42B18D,$051226F208E8183D,$4957920272D34D02
   Data.q $DD6A4B3A70E7FBAB,$A8C78E4CBFDFBD7C,$2A549F4089C73399,$74098CC89681D5A6,$591AFEE3C45DCA2A
   Data.q $E3471998B16599D7,$531224EBA532DFC6,$A6D5AE349A924F54,$0D94E20A1330EECB,$D398B1441D142303
   Data.q $027355551D711212,$0F11983A908A6A12,$CAB8D908EBA2095F,$298664B0BC68915F,$4E116CDCE865212D
   Data.q $10BC793EBA1A1200,$0A2B20202829C60A,$F6C54585A1C3C3BD,$68039A7230DD04B4,$2085FBF01322E81A
   Data.q $BEC1C794B2BD0B16,$03BD2CAFAF6AC8BE,$CF69D99E9480FA7D,$7D9965901CAC5009,$BB5447E1EB797A67
   Data.q $A6A9E641D0DCAEDD,$460F0D118C98A392,$25BA6AA2FF167739,$6ABEED4A372B0421,$D6E6C59950DA3F36
   Data.q $FD367E0279DAFED4,$64CE140321D8A5F4,$CA4778F469C78FFB,$FBFBBCCBFF9C7816,$F788B95BD0F74E7E
   Data.q $1754B378FD7586E1,$D7144A1BB5DBE51E,$897BDB3F327FC76C,$1CF70F0AE1E35A77,$9AAB0000D3E710EA
   Data.q $59F1A7B12F46C7A4,$C7E64B7A5559529B,$99CD089EF9D00D0F,$78F5C8E23DB1C34B,$CFF7BA51BF5993C6
   Data.q $EF5E5F296A6B3A21,$62FFB1A9BB69D8A4,$E9C9399C23BBFD94,$2B6914E91D4F0F0A,$2D920BE57F47CA78
   Data.q $B70586CA3225A61A,$FC95995703E95253,$1926895C06181982,$1BFFD02FCCE71FEE,$5D88B33EBCA525C3
   Data.q $04A6BD93E3153F87,$C12D1649CF83D75C,$B1D524A96582648A,$8A02362C20614E18,$EE856677C28A5395
   Data.q $01BF8F3654899FA3,$DAD8782809CBC4EA,$444E454900000000,$826042AE
stopend:

high:
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
   Data.q $0E0000C40E000073,$00001B0E2B9501C4,$8948544144491205,$C51465146C7B957D,$D2ECBBB6761DD37F
   Data.q $42D2B694B61616CA,$B148A82021A116E9,$D112121156821048,$8214055021208120,$4418A235135211E1
   Data.q $57C183041AD15012,$7942A404290DE10C,$6594296976948795,$28FF3E6774F7DD1F,$EE7326BF9CB76A14
   Data.q $1257B9BEF9EE67BD,$5A3BA5762A1DD042,$7C78267162D7FE83,$417420423E9D74B8,$A0F9262D671B6F73
   Data.q $F168DF0FEEFA67AD,$ABB150264A435777,$304D5EBC25B9B3A7,$0990F871B1514C6B,$1D023B0D229F3B64
   Data.q $D64E6AEE6B85A25F,$B0A4D85AFAAAA5EC,$5F1CED66B699DB35,$654BB6AB022EA117,$7AE7B8CA76F977CD
   Data.q $D4A211030F351B4D,$7A0600088D19A711,$DF04612E4CC4E0A2,$CCDE2E47BD81B1FF,$B770E225F3FB3276
   Data.q $C9F3A172A45BE502,$822C960186E5D9E2,$3D0085ADD0209354,$534FB8CE08CAC0C8,$1B9983A678F6E5F1
   Data.q $1BE0F81176BF13DF,$17F315E7E3122CA9,$CE80570885066C1B,$2631CDC950DDD5DD,$C0DBDEA2E0B19191
   Data.q $6178B303E3DB35F2,$52AAB021D55152D3,$69BCE96971363672,$4BBEA1124FE981B6,$C5BB2C542367F389
   Data.q $8482927692837D8E,$D3E2A31ED44E3C99,$2A5A6E140505F5E3,$9E4BEB0F5DC03222,$4DC221CF4CCB6BED
   Data.q $159054FA7C94EA40,$03DC2E862A301AF3,$66282C8C1B8840E8,$FBDAB5B5D993E8CC,$0F1E1C36F9696AC0
   Data.q $15254C6EBF97AB0D,$567E55E3C4A7689D,$CBA5B02E3C4EBDCE,$7955DF89DE1EADEC,$00565CB82DC3A19B
   Data.q $FE773137F669580C,$6214394C90AB8F5E,$9D198A98C5A1517A,$00426B6A318D0D28,$AA3D7D69B1B4EE78
   Data.q $60E8EF5509167EDA,$F6A0CB2A4C9BE6DB,$5AD86CFD8713987C,$57039A4708468000,$423872899060F621
   Data.q $14821A3A1E7E4149,$A495D968F8F80EAA,$AA8005208109A836,$FA992955DEF0F7FD,$C60C4E13CEB3E504
   Data.q $EC5118D2EDF7CB2C,$8870E5E34D3DB7E4,$BFDAD02067FBFD61,$A02E4B6B6B68D340,$7FDF8D3E3D1E7C3E
   Data.q $2A2344399582C5BA,$800ED63B19F94F67,$34DC3841DB272340,$54464C98FA34D64C,$568FA8A84D4080E2
   Data.q $91C0E3F72A6D047A,$46B21E806D7AE065,$C7231F45EAE25D9A,$0F5E23362D623B5A,$146E037BA3AEB219
   Data.q $E3C43D860EFDFB53,$E23786B8B102A4F1,$F1478B11F41FC006,$BBA1025162C4DC46,$341EAD7D630F2378
   Data.q $C207F6DC6DEB210D,$096D1200061EF669,$C1DE9B41DE4B4D34,$60852B2FD08E5DD5,$DCB66714772DCAAB
   Data.q $2CD2B56309EBCF29,$E921DE8D8D350A2B,$7169227A02ED2DBD,$91C8BDA268155500,$68EA72B12C8C3D3F
   Data.q $01C1DA951C2928FB,$2C8D44C983CD7BFC,$C0B33FD6B6B070A5,$0A7236A9B8C00995,$DFE66B2A3D36F694
   Data.q $DAD090AAA3F9FEE6,$F5A64A36ABE96CAF,$5019C78A6E75ABE6,$94127D50070752CC,$350BEECCB2C9F654
   Data.q $1458B162293A567C,$661FBE43BB190EEC,$90DD17DCC8D73321,$FA0B1986C3A09100,$D4A0D646D4BA3002
   Data.q $44B95C03BA34F64E,$260842498E22D0D3,$52F2588AB836922F,$BC62D7DC6B527E59,$E496C1C28B46EA5D
   Data.q $3734ABBAC3628F31,$201946C45FEFF8B1,$5E7A609D4F6B17AD,$0497465E6E664B41,$7778B34777C2AE67
   Data.q $1C02037EEB4D1B86,$87F26A6AB9C7503B,$2A595FAE323C35F2,$76859CD7F1EEF895,$9AD8393496CFD1C5
   Data.q $6A97007293936AC0,$8F272FB0FAC5F0EE,$00093B57176D0FA7,$9D8777BE5E972B4C,$1F7D85F92B34DFD3
   Data.q $953D50E270FFC3EF,$EF8ECA00FFB7859B,$A732B2EFBC1F4714,$61CA9375B99E922C,$0CEF4192984F64C5
   Data.q $F3D80435370B63F3,$C7939738670B9FA3,$BA4B20D3A295A38C,$963E039923BF27F4,$7CF6307730B1EFFB
   Data.q $81ED69E953323817,$CA9D6346206B43AE,$BEF68D32EEA07F85,$107E472D9D2BDC7C,$FE780781524C665D
   Data.q $651631328F14C92D,$D08644285146227C,$15672A4ACD332611,$443B55638546FD85,$C8511B207FE77FB7
   Data.q $0000000042646E48,$826042AE444E4549
highend:

mute:
   Data.q $0A1A0A0D474E5089,$524448490D000000,$1800000018000000,$3D77E00000000608,$59487009000000F8
   Data.q $0E0000C40E000073,$00001B0E2B9501C4,$894854414449E604,$C6146554507D957D,$46158585D85DD77F
   Data.q $B01145D43E403656,$CC69CA52CC72CA64,$2B1AD19C9B529519,$63F2CAD14A533499,$C662B1B249B269CC
   Data.q $29B2B1D1B52C288F,$44150AC946533467,$E5D9710164402951,$FEDF7BDEEEC2F763,$9CEF5FCF5DDD4040
   Data.q $BEE7B9E739E79EF3,$881CB6CA10421247,$25EBDF3C777576B5,$042E18D34B22E1D7,$64C173330CB41342
   Data.q $FEF83D8A8E6EFFD4,$82305218508EB6C2,$9B3CDA5B12A2072D,$3F84E765260B0A7D,$218907C4D4973634
   Data.q $B1B6A3694B86810E,$EB515D394795B382,$61B3189A99D81A31,$BAC10051005762E3,$3E667B16E5AF2912
   Data.q $21D04B89ACE86531,$0191505A5E1D43D3,$89192244818511D0,$E4F471B64737C107,$295A2A2C89A91BA5
   Data.q $08152C50504908FE,$9846E815162BAD8D,$1290CE8502A6E992,$6F9C099A21618402,$AC9378979F2D87FC
   Data.q $C10063F16DFDB0BC,$EF0FCBDC9E52DDDA,$AE64067599D0AFE4,$4B48FBD7D5F28102,$0D1644C7ABC7BF0B
   Data.q $24A6F1286E14EBCE,$C100F4E2558ED4F3,$55E5CEC9B12952BA,$D32147625399664B,$5BD9BBC753DAB410
   Data.q $086C404A40F8A4EC,$CB6329AF28D89112,$B1DCC832321A6727,$4F360E5B807AC84A,$CC869B149CDE3C7B
   Data.q $8B88EDF8000A400D,$C68219B149DB568F,$30E4670F3D4DC035,$1AEA3535A9B3D1E9,$C1C3AB0BB854BD60
   Data.q $408823C2F385F5F5,$7C9BBED0F92027A3,$46195180840DDEF2,$8E8021DA0AC97F4A,$D47F9ABCEC3A5A68
   Data.q $6E66EDDE92499591,$E0DBC8823C29A676,$02F46E68BB175512,$00FB22EBE1E35B50,$54DFA0ED07D3E280
   Data.q $D7126564AC6358DC,$465A6647BD74CDDD,$F60010C1150D0DBA,$0141AD77F3F3B2ED,$02FF3F901A384A7C
   Data.q $591A3F5C28A333A3,$194C8F35616B78D1,$909950D0D34B2BCA,$1EF553ED874FC893,$C1D4082C1213E337
   Data.q $81283FBF7E1AFC2A,$29EC21E64DF9F4A2,$9B9CE973F3EFC3AA,$800B1B9498BA7FF3,$1F63C78AD52D2540
   Data.q $F8E18D1B865557AF,$9F17A53E963FD2F0,$7E3F1F9F03BC17CF,$EECCB74F0639DC3E,$179D35B35800FFA2
   Data.q $1C399301C6DEB35F,$9D9CD0D35E8B03A7,$BB91EDB3838C188D,$091EE40941BD7AF0,$7737B151EC88DCA7
   Data.q $D1E9C56DABABDC0C,$45550397571E7C0D,$989E9D1DAD3F35E8,$1AAAA8325DDD30B8,$9654F8A3F1451F0C
   Data.q $6C6F3233B9C6B9CF,$2B514943D67552B4,$74E0022537379502,$50306F45A68E8878,$34CC3B1B1CE4D4D9
   Data.q $848901FF5C128328,$0B0B03FF2084584A,$5EBC36167C505A57,$7FB0AFA2A82C5447,$DEF34A548D181D6B
   Data.q $1BCDCFC50A724965,$4A6DED322BFAED9C,$40C71AD14CAAF9DF,$1FFD085D0E193E2C,$B90A28D5D586DBF4
   Data.q $FA7C95D5839EBD7A,$90003264C9B233F4,$984F3BEB6C90336C,$7D05DACF423AC26C,$35BF5F290857EB63
   Data.q $D971F632F5727635,$B6972C6608424994,$90F4BCD9F2B36565,$8CDD98ACDDCB1749,$B007BE852F8702D9
   Data.q $FBF8ACEC5A35D36D,$C6CA198807AED890,$1A4B68CB6B99CABF,$C4D1371A4D04B369,$AA8CD05AD812C717
   Data.q $AAA8EBC76582DE86,$CF1DC15F1C7D32A0,$BF3B5734D2559CF5,$0E603EB067165E2E,$05D66D12A5DDD009
   Data.q $3D9B67C9BCAE5D8D,$D711289D8F1B34AE,$6ECD2055980022EE,$D21A452FB9FEC9BF,$7E56BDC32BEFE333
   Data.q $046133852FD281A2,$80FEFD538BF66779,$06F9B934B9733995,$61699DCD4873E3A5,$9DEBF6C0BEF22598
   Data.q $D2AA79F541DBDE1C,$19DEAE2A553FCC6C,$3B22952C67F4BA0F,$18E46CB3B476145D,$5441149AC0B3D2E2
   Data.q $34BD9D5D069A1874,$685775073EA8F9D5,$9F14B1A1E3E78B8A,$FA09412FBC0456FC,$E987B7A32597C9ED
   Data.q $BB76C97A554C3DBD,$10C5A48C610D08B1,$CA06E163818305C1,$03FF1850942F7F4E,$AB321ED7F6360D85
   Data.q $444E454900000000,$826042AE
muteend:
EndDataSection


Edit :Modified for Mono files
Edit #2:Modified and added new feature

_________________
Egypt my love


Last edited by RASHAD on Thu Jun 21, 2018 9:47 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Ver #2 :Simple sound Player using BASS [Stereo & Mono Fi
PostPosted: Wed Jun 20, 2018 9:12 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Sep 17, 2015 3:39 pm
Posts: 147
i love it :D


i listen Adam Snow - Meghan's Theme <3


+added spectrum analyzer

Code:
OpenWindow(99, 0, 0, 220, 100, ":)", #PB_Window_SystemMenu | #PB_Window_ScreenCentered,WindowID(0))
CanvasGadget(99,0,0,220,100)
AddWindowTimer(0,99,100)
Structure _ffT
  _ffT.f[1024]
EndStructure
Procedure _Spectrum()
  If channel = 0 Or BASS_ChannelIsActive(channel) <> #BASS_ACTIVE_PLAYING:ProcedureReturn:EndIf
  Protected _fft._fft,_lines.l=16,ys.l,b0.l,peak.f,b1.l,mm.f,wx
  If BASS_ChannelGetData(channel,@_fft, #BASS_DATA_FFT2048) = -1:ProcedureReturn:EndIf
  Protected ww = GadgetWidth(99)
  Protected wh = GadgetHeight(99)
  Protected bw = ww / _lines
  StartDrawing(CanvasOutput(99))
  Box(0,0,ww,wh,0)
 
  DrawingMode(#PB_2DDrawing_Gradient)     
  BackColor($00FFFF)
  FrontColor($FF0000)
  LinearGradient(0, 0, ww, wh) 
 
  For wx=0 To _lines-1
   
    peak = 0
    b1 = Pow(2,wx * 10.0 / (_lines - 1))
    If (b1 > 1023) :b1 = 1023:EndIf
    If (b1 <= b0): b1 = b0 + 1:EndIf
    For b0=b0 To b1-1
      mm = _fft\_fft[1 + b0]
      If (peak < mm)
        peak = mm
      EndIf
    Next
    ys = Sqr(peak)* 3 * wh - 4
    If (ys > wh) :ys = wh:EndIf;
    If (ys < 0) :ys = 0:EndIf  ;
   
    Box(bw * wx + 3,wh-ys, bw - 2,ys)
   
  Next
  StopDrawing()
EndProcedure
BindEvent(#PB_Event_Timer,@_Spectrum())

_________________
interested in Cybersecurity..


Top
 Profile  
Reply with quote  
 Post subject: Re: Ver #2 :Simple sound Player using BASS [Stereo & Mono Fi
PostPosted: Thu Jun 21, 2018 7:09 am 
Offline
Always Here
Always Here

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 5341
Location: Germany
Hi,

I just tested the players and the FFT gadget :D

Unfortunately I see the following behaviour:

Compared to AudaCity I have a very very long phase of zero at the end of the loaded wav file.
Also when I play it, I still hear music (and see FFT) when this zero phase is shown in the gadget.

Bernd


Top
 Profile  
Reply with quote  
 Post subject: Re: Ver #2 :Simple sound Player using BASS [Stereo & Mono Fi
PostPosted: Thu Jun 21, 2018 8:40 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3941
Hi CELTIC88
Nice work
With some spare time I will see how to add it
Be tuned

Hi Bernd
The point of playing sound is the left edge of the gadget not the thump
position(I was thinking to add a speaker image at left or two :P )
And forget about the very very long phase of zeros
Remember that the FFT right now is by wilbert and it is just simple lines not connected
And please you can not compare that simple player with AudaCity :P
But at least you must admit that the FFT gadget is different from Audacity and Cool Edit (Fixed background and moving FFT)

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Ver #2 :Simple sound Player using BASS [Stereo & Mono Fi
PostPosted: Thu Jun 21, 2018 9:03 am 
Offline
Always Here
Always Here

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 5341
Location: Germany
Hi RASHAD,

I know this.
But try it by yourself:
https://oc.ednt.de/index.php/s/DmaXnIlYOYMnfC0


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye