Sound not working in exe

For questions about using Classic.

Post » Thu Jun 09, 2011 3:22 pm

Have search the forum abouth this issue but can't find a clear solution.

If I run my exe in the same folder as where the cap file is, the sound and music plays fine, but when I made a exe and send it to some friends to test it, they don't have any sound.

So I moved my exe to desktop and then found out that I did not have any sounds either anymore. :?

Someone knows whats wrong here? :roll:
B
43
S
8
G
5
Posts: 110
Reputation: 3,605

Post » Thu Jun 09, 2011 3:38 pm

How did you do the code for playing the sounds?

If you used "Apppath & (wherever your sound file is)" then you'd have to have the sounds included in whatever folder you have your exe in for the sounds to play. I assume this is what you did.

If you add the sound files as resources and instead use "play from resource" they will be compiled into the exe.
B
73
S
20
G
10
Posts: 524
Reputation: 9,896

Post » Thu Jun 09, 2011 3:52 pm

Thats exact what I did, so I moved all sound/music to the cap/exe root now and it works fine at desktop :D :D :D

Thanks InkBot, you made my day :D :D :D :D :D :D :D :D :D :D :D :D :D
B
43
S
8
G
5
Posts: 110
Reputation: 3,605

Post » Thu Jun 09, 2011 4:18 pm

I just send it to a friend and he still don't have sound :?

What else can be wrong? :roll:
B
43
S
8
G
5
Posts: 110
Reputation: 3,605

Post » Thu Jun 09, 2011 4:35 pm

[quote="Steely":jyq4ht0t]I just send it to a friend and he still don't have sound :?

What else can be wrong? :roll:[/quote:jyq4ht0t]
Did you also send all the sound files to your friend?

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Thu Jun 09, 2011 4:42 pm

Thanks for the reply KrushBrother,

No I did not, but what I don't understand then, how does construct knows where to find the sound files when I place a copy at my desktop?

And how to make a comercial exe? So construct don't extract the sound files in the exe?

I can't release my game if I can't put my sound files at a safe locations because of loyalty rights :(

How I solve this? :roll:
B
43
S
8
G
5
Posts: 110
Reputation: 3,605

Post » Thu Jun 09, 2011 4:59 pm

[quote="Steely":2213qnew]No I did not, but what I don't understand then, how does construct knows where to find the sound files when I place a copy at my desktop?[/quote:2213qnew]

It depends on how you tell Construct to find them. If you tell it to play a sound located in "C:/folderwithmusicinit/music.ogg" then it will look for that specific folder, no matter what computer you put it in, and chances are that that folder and its content does not exist on any other computer than yours. This is why we have installers.

If you use the "AppPath & [folder]" route then Construct will look for the
corresponding folder/file from wherever you place your exe. So if you have an exe that plays a sound using AppPath but place the exe somewhere else without the sound file the sound will not play.

[quote="Steely":2213qnew]
And how to make a comercial exe? So construct don't extract the sound files in the exe?[/quote:2213qnew]
Not sure I understand what you mean here. If you add your sounds as resources then they will be compiled into the exe. This will make your exe bigger (not sure if it causes performance differenses) and you won't have to keep external files around.

[quote="Steely":2213qnew]
I can't release my game if I can't put my sound files at a safe locations because of loyalty rights :[/quote:2213qnew]

I assume you mean royalty rights. There's really no good way to keep files safe. If someone wants to steal your stuff, they will. Compiling the sounds into the exe will make it more difficult yes, so go with that.

Edit: Maybe there's some funky encryption thing you could do, but I don't really know. Pirates seem to be able to crack through whatever blockade devs seem to think up. That's what I wanted to point to, not to say it's impossible to do a effective encryption.

Edit2: Took out some unnecessary stuff.
B
73
S
20
G
10
Posts: 524
Reputation: 9,896

Post » Thu Jun 09, 2011 6:10 pm

Thanks InkBot for youre reply :)

[quote:uumfrtx9] Not sure I understand what you mean here. If you add your sounds as resources then they will be compiled into the exe. This will make your exe bigger (not sure if it causes performance differenses) and you won't have to keep external files around.

[/quote:uumfrtx9] to me it looks like it is in the exe, because it went from 7mb exe without sounds to 12mb exe with sound, but still don't play, maybe I don't understand what you mean with: to put it as resources? If I put all sound files in the root of the .cap, is that what you mean with resources? Because that is what I did now and it still don't work.
B
43
S
8
G
5
Posts: 110
Reputation: 3,605

Post » Thu Jun 09, 2011 8:53 pm

To add a file as a resource to a project you right click the "files" folder in the project view and chose "add files"


You'll get a file dialog where you can choose the file oyu want to add. It'll be listed in the files folder. (You can add stuff to the "sound" and "music" folders but you won't be able to access the files from there so just add the files to the "files" folder)


Now you can use XAudio's or Audieres "from resources" functions to play and load them and they'll be compiled into the exe.
B
73
S
20
G
10
Posts: 524
Reputation: 9,896

Post » Fri Jun 10, 2011 4:15 pm

Thanks InkBot for this nice example, it works fine now. :D :D :D

Want also to thanks ROJOhound for the nice Audiere Plugin :D :D :D
B
43
S
8
G
5
Posts: 110
Reputation: 3,605

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests