BASS Issue

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Post Reply
Username
Posts: 30
Joined: Jun 22, 2020 5:56

BASS Issue

Post by Username »

If I DIM variables pertaining to BASS sound (Dim As String death0file = "C:\Program Files\FreeBASIC\Gog Umagog The Game\Assets\Audio\death0.ogg"
Dim As HSTREAM death0stream = BASS_StreamCreateFile(0, StrPtr(death0file), 0, 0, 0)), it cannot be at the beginning of the code. I seemingly have to put the DIM lines in close proximity to the variables' usage, otherwise the sound won't play and I'll get a BASS error code 5. How do I fix this? Thanks.
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: BASS Issue

Post by paul doe »

Can you provide a code sample where the above occurs? Thanks.
UEZ
Posts: 972
Joined: May 05, 2017 19:59
Location: Germany

Re: BASS Issue

Post by UEZ »

Just a guess: if you are calling death0stream variable within a function and want to use is outside then you should declare it as shared at the top.

Code: Select all

Dim Shared As HSTREAM death0stream
Username
Posts: 30
Joined: Jun 22, 2020 5:56

Re: BASS Issue

Post by Username »

UEZ wrote:Just a guess: if you are calling death0stream variable within a function and want to use is outside then you should declare it as shared at the top.

Code: Select all

Dim Shared As HSTREAM death0stream

Ok I'll try that. THANKS!
Username
Posts: 30
Joined: Jun 22, 2020 5:56

Re: BASS Issue

Post by Username »

UEZ wrote:Just a guess: if you are calling death0stream variable within a function and want to use is outside then you should declare it as shared at the top.

Code: Select all

Dim Shared As HSTREAM death0stream
it says var-length strings cannot be initialized. :/
Username
Posts: 30
Joined: Jun 22, 2020 5:56

Re: BASS Issue

Post by Username »

UEZ wrote:Just a guess: if you are calling death0stream variable within a function and want to use is outside then you should declare it as shared at the top.

Code: Select all

Dim Shared As HSTREAM death0stream
actually i made a mistake
Username
Posts: 30
Joined: Jun 22, 2020 5:56

Re: BASS Issue

Post by Username »

UEZ wrote:Just a guess: if you are calling death0stream variable within a function and want to use is outside then you should declare it as shared at the top.

Code: Select all

Dim Shared As HSTREAM death0stream
it works!
Post Reply