BASS Issue

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

BASS Issue

Postby Username » May 13, 2021 20:09

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: 1428
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: BASS Issue

Postby paul doe » May 13, 2021 20:43

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

Re: BASS Issue

Postby UEZ » May 14, 2021 12:57

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: 15
Joined: Jun 22, 2020 5:56

Re: BASS Issue

Postby Username » May 23, 2021 21:39

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: 15
Joined: Jun 22, 2020 5:56

Re: BASS Issue

Postby Username » May 23, 2021 21:43

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: 15
Joined: Jun 22, 2020 5:56

Re: BASS Issue

Postby Username » May 23, 2021 21:44

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: 15
Joined: Jun 22, 2020 5:56

Re: BASS Issue

Postby Username » May 23, 2021 22:00

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!

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 2 guests