Page 1 of 1

use wav file as resource file

Posted: Sat Mar 22, 2008 7:56 am
by PaPi
Hi, how can I use a windows sound file (  ......wav ) as resource file in fnxbasic? I will make my project as one exe-file, without the many extra wav-files.
Thx
PaPi

use wav file as resource file

Posted: Sun Mar 23, 2008 5:32 pm
by Marco
Hi,

I am afraid it is not possible to play the wav file as a resource file.
Simply because windows playsound api (playwav for fnx) support only to play wav files. However you can extract the resourc wav file if your application start with the following code:

resource wav1 as "test1.wav"
dim f as filestream

if fileexists("test.wav")=false then
     f.open("test.wav")
     f.loadresource(wav1)
     f.Close
end if

I hope you are satisfied with this solution
Best regards marco

use wav file as resource file

Posted: Sun Mar 23, 2008 7:27 pm
by PaPi
I don`t quite get the idea, bat it work freely. Thanks  :)
PaPi

use wav file as resource file

Posted: Sun Mar 23, 2008 9:39 pm
by Marco
Hi,
with this code you load the resource wav1 into the file test1, in other words you create a real file from a resource file.
best regards

use wav file as resource file

Posted: Sun Mar 30, 2008 7:06 am
by PaPi
Yes, I see. But not: "into the file test1", rather: "into the file test" , I think.
PaPi



use wav file as resource file

Posted: Sun Mar 30, 2008 4:05 pm
by Marco
You are right about it it is loaded into the file test, after use you can erase the file with the command kill, if you wish to do that.