1. Use normal Strings and use {$MODE DelphiUnicode} with or without {$Define UNICODE}.
2. Use normal Strings and use {$MODE OBJFPC}{$H+}{$J-} and {$ModeSwitch UnicodeStrings} with or without {$Define UNICODE}.
3. Use the following example... (I only checked if I can play umlauts not real unicode characters, but these should work too).
Unit uLittleBass;
{$MODE OBJFPC}{$J-}
Implementation
{$R *.LFM}
{$DEFINE UNICODE}
Callback
// CALLBACK
Procedure BassCallback
(hsHandle: HSync; dwChan, dwData: DWORD; ptrUser: Pointer); StdCall;
Begin
wndGUI.OnBassCallback;
End;
// ON CALLBACK
Procedure TwndGUI.OnBassCallBack;
Begin
BASS_ChannelRemoveSync(hstChan, hsCallback);
BASS_StreamFree(hstChan);
PLAY;
End;
FormCreate
If Not BASS_Init(-1, 44100, 0, 0, Nil)
Then ShowMessage('ERROR: BASS Initialization failed !');
// put BASS.dll x64 or x86 inside main program directory
// put BASS.pas inside main program directory
uslPL:= TUnicodeStrList.Create;
TLabel
labArtist.Caption:= UTF8Encode(uStr);
labTitle.Caption := UTF8Encode(uStr);
PLAY (uslPL : TUnicodeStrList)
hstChan:= BASS_StreamCreateFile
(False, PChar(uslPL[iCurrSong]), 0, 0, 0
{$IFDEF UNICODE} or BASS_UNICODE {$ENDIF});
hsCallback:= BASS_ChannelSetSync
(hstChan, BASS_SYNC_END, 0, @BassCallback, Nil);
ShowTitle(uslPL[iCurrSong]);
Load uslPL (PlayList)
uslPL.AddNotIn(UnicodeString(dlgOpen.Files[i]));
UnicodeStringlist // or use a TList with UnicodeStrings...
UNIT uUnicodeStrList; // originally by Jordan Russell
{$MODE OBJFPC}{$J-}
Interface
TYPE
PArrStrList = ^TArrStrList;
TArrStrList = Array[0..50] Of UnicodeString;
TUnicodeStrList = Class
PRIVATE
arrList: PArrStrList;
iCount, iCapacity: Integer;
Function GetStr (iIndex: Integer): UnicodeString;
Procedure SetCapacity (iNewCapacity: Integer);
PUBLIC
Destructor Destroy; Override;
Procedure Add (Const uStr: UnicodeString);
Procedure AddNotIn (Const uStr: UnicodeString);
Function IndexOf (Const uStr: UnicodeString): Integer;
Procedure Clear;
Property Count: Integer Read iCount;
Property Items[iIndex: Integer]: UnicodeString Read GetStr; Default;
End;
Implementation
Procedure TUnicodeStrList.Add(Const uStr: UnicodeString);
Begin
If iCount = iCapacity
Then SetCapacity(iCapacity+8);
arrList^[iCount]:= uStr;
Inc(iCount);
End;
Procedure TUnicodeStrList.AddNotIn(Const uStr: UnicodeString);
Begin
If IndexOf(uStr) = -1
Then Add(uStr);
End;
Procedure TUnicodeStrList.SetCapacity(iNewCapacity: Integer);
Begin
ReAllocMem(arrList, iNewCapacity*SizeOf(Pointer));
If iNewCapacity > iCapacity
Then FillChar(arrList^[iCapacity],
(iNewCapacity-iCapacity)*SizeOf(Pointer), 0);
iCapacity:= iNewCapacity;
End;
Procedure TUnicodeStrList.Clear;
Begin
If iCount <> 0
Then Finalize(arrList^[0], iCount);
iCount:= 0;
SetCapacity(0);
End;
Function TUnicodeStrList.GetStr(iIndex: Integer): UnicodeString;
Begin
Result:= arrList^[iIndex];
End;
Function TUnicodeStrList.IndexOf(Const uStr: UnicodeString): Integer;
// Case sensitive !
Var
i: Integer;
Begin
Result:= -1;
For i:= 0 To iCount-1
Do
Begin
If arrList^[i] = uStr
Then
Begin
Result:= i;
Break;
End;
End;
End;
Destructor TUnicodeStrList.Destroy;
Begin
Clear;
Inherited Destroy;
End;
END.