0 Favourites

Sound not working in exe

This forum is currently in read-only mode.
  • 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?

  • 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.

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

    Thanks InkBot, you made my day

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

    What else can be wrong?

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

    What else can be wrong?

    Did you also send all the sound files to your friend?

    Krush.

  • 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?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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?

    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.

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

    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.

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

    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.

  • 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.

    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.

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

    <img src="http://i79.photobucket.com/albums/j135/mr_norris/reosurce_1.png">

    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)

    <img src="http://i79.photobucket.com/albums/j135/mr_norris/reosurce_2.png">

    Now you can use XAudio's or Audieres "from resources" functions to play and load them and they'll be compiled into the exe.

    <img src="http://i79.photobucket.com/albums/j135/mr_norris/reosurce_3.png">

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

    Want also to thanks ROJOhound for the nice Audiere Plugin

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)