24 May '13 - 16:07 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Could not get file to play  (Read 593 times)
ELCouz
Guest
« on: 18 Apr '10 - 19:03 »
Reply with quoteQuote

Hi

It's me again!  Smiley

with this code :

chn := BASS_StreamCreateFile(FALSE, pchar(fileplaylist[0]), 0, 0, BASS_STREAM_PRESCAN);

i could not get any filename to play that i put in my TStringlist!

This works :

chn := BASS_StreamCreateFile(FALSE, pchar('C:\test.mp3'), 0, 0, BASS_STREAM_PRESCAN);

but this won't :

fileplaylist.add('C:\test.mp3'); //first entry index 0
showmessage(fileplaylist[0]); //the messagebox show the correct filename C:\test.mp3
chn := BASS_StreamCreateFile(FALSE, pchar(fileplaylist[0]), 0, 0, BASS_STREAM_PRESCAN);

couldn't get the file to load!


Thanks Smiley

Regards,
Laurent
Logged
ELCouz
Guest
« Reply #1 on: 18 Apr '10 - 19:48 »
Reply with quoteQuote

Damn Delphi 2009!

All string are unicode by default this cause some problem when converting string to pchar...

After a little bit of research found the solution ...ugly but it works!


chn := BASS_StreamCreateFile(FALSE, pansichar(ansistring(fileplaylist[0])), 0, 0, BASS_STREAM_PRESCAN);


Hope this can be useful to someone Smiley

Laurent
Logged
Chris
Posts: 1507


« Reply #2 on: 18 Apr '10 - 19:56 »
Reply with quoteQuote

Hi
this  solution will work too


chn := BASS_StreamCreateFile(FALSE, pchar(fileplaylist[0]), 0, 0, BASS_STREAM_PRESCAN or BASS_UNICODE);
Chris
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines