use wav file as resource file

In this category you can exchange your programming questions and solutions.
Post Reply
PaPi
Posts: 114
Joined: Wed May 16, 2007 11:55 am

use wav file as resource file

Post: # 195Post PaPi
Sat Mar 22, 2008 7:56 am

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

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

use wav file as resource file

Post: # 196Post Marco
Sun Mar 23, 2008 5:32 pm

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

PaPi
Posts: 114
Joined: Wed May 16, 2007 11:55 am

use wav file as resource file

Post: # 197Post PaPi
Sun Mar 23, 2008 7:27 pm

I don`t quite get the idea, bat it work freely. Thanks  :)
PaPi

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

use wav file as resource file

Post: # 198Post Marco
Sun Mar 23, 2008 9:39 pm

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

PaPi
Posts: 114
Joined: Wed May 16, 2007 11:55 am

use wav file as resource file

Post: # 199Post PaPi
Sun Mar 30, 2008 7:06 am

Yes, I see. But not: "into the file test1", rather: "into the file test" , I think.
PaPi



Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

use wav file as resource file

Post: # 200Post Marco
Sun Mar 30, 2008 4:05 pm

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.

Post Reply