Page 1 of 1

BASS library, with UNICODE enabled

Posted: Mon Jul 14, 2008 3:06 pm
by Perkin
I've been using BASS library to play songs etc, but needed to enable Unicode strings, but doing so caused the BASS lib to not play anything because of the filenames were expected to be in Ascii. I couldn't find a simple command to do it, so here's a quick solution.
(Somebody will now tell me it's easier than this :) )

Code: Select all

Global *BASS_Filename

Procedure SetBASSFilename(filename.s)
  If *BASS_Filename
    FreeMemory (*BASS_Filename)
  EndIf
  *BASS_FILENAME=AllocateMemory(Len(filename)+1)
  PokeS(*BASS_FILENAME,filename,-1,#PB_Ascii)
EndProcedure
Then when needed before creating the stream channel.

Code: Select all

  SetBASSFilename(songname)
  Handle = BASS_StreamCreateFile(0, *BASS_Filename, 0, 0, 0)

You could also use this for any strings that need to be in Ascii.