Urgent question about sound, files, and exe's

This forum is currently in read-only mode.
  • I'm about to send a project over to an interested party today, and I need to know:

    When I put a sound file link into Construct and I can see that it's playing when I run the layout, is that all I have to do to make sure the music and/or sound is in the game? Or do I have to insert the actual files into the sounds or music folder so that the sounds or music will be play on the recipients computer?

  • It's gotta be in a subfolder of your project and go with it to the recipient.

  • You can either:

    1. Embed the music/sound in the exe as a resource

    2. Put the music/sound in subfolder, reference it in your .cap with "app path" and send with the game.

  • When you export to a exe all the files in the "files" folder are embedded into the exe. The files are then accessible from the play from resource actions of xaudio2 or by using the resource plugin.

  • Handy... didn't even know that was possible. All the projects I've downloaded had all the external files in the folder structure.

  • Thanks guys, but I have a big problem now...

    I've tried one method of naming the file path for each music and sound file in Construct to a music and sound folder called "MyNewGameSounds" inside the .zip I've created. For example, I'd change "C:\Users\Miller\Desktop\MyNewGameSounds\LetsRock.wav" to "MyNewGameSounds\LetsRock.wav".

    Here's the thing, when I fire the game up it works fine and the sounds play in the first layout, and plays through the second, but when it goes to the third layout I get this error message:

    "You can't have a layout object set to view its own layout!"

    This has only happened while running the .exe after having changed the music file paths. I made an .exe yesterday without changing the paths and it worked fine with no crash. It also runs fine as a .cap as I have used "Run layout" from the cap many times and it never crashes. I haven't made any major changes to the program today.

    I do have a layout object within the third layout, but that shouldn't be causing a problem, and to reiterate it's never crashed at any time prior to me changing the music file paths. I didn't save it after the changes, so I've run the file again with the original music file paths intact and it runs fine... I can't figure out what the heck is happening...? And what a horrible time for it to be happening!!! Noooo!!! LOL!

  • Try "apppath & "MyNewGameSounds\LetsRock.wav""

  • Try "apppath & "MyNewGameSounds\LetsRock.wav""

    No luck. I still get: "You can't have a layout object set to view its own layout!"

  • That's why I tell people to steer clear of the layout object. Too buggy.

    Perhaps try going back to the version that was working, and try step by step? Or embed the sounds in the exe instead?

    Also check each layout object for what layout it's set to. Try changing it something else, run it, then back again.

  • Okay, so here is what I've determined regarding the "You can't have a layout object set to view its own layout!" problem:

    *I went ahead and erased all 4 of the layout objects from the layouts. I then packaged the .exe and the game now runs perfectly.

    I can't explain why the .exe I ran yesterday played fine. The only difference between the file I ran yesterday and the one today, is that yesterdays was just a raw .exe while today's was an .exe within a zip file. I don't see how it could make a dramatic difference to how it operates, but that's the only contrast that there's been when comparing both days.

    As a sidenote, I should mention that apppath & "MyNewGameSounds\LetsRock.wav" only produced silence in my project.

  • That's why I tell people to steer clear of the layout object. Too buggy.

    It's such a great object idea though, I hope they can get that worked out.

    I wonder why it's been working fine all this time in my .caps for this project, but now it suddenly crashes as an .exe? But even more odd, is that it worked perfectly with the first .exe of this project I ran yesterday.

  • I wonder why it's been working fine all this time in my .caps for this project, but now it suddenly crashes as an .exe? But even more odd, is that it worked perfectly with the first .exe of this project I ran yesterday.

    No clue. Try saving a fresh .cap in the same directory as your game and try to find the correct directory path from there. Also, are you using autoplay?

  • No clue. Try saving a fresh .cap in the same directory as your game and try to find the correct directory path from there. Also, are you using autoplay?

    Nah, no autoplay. Only load file actions and play channel actions.

  • Well, I got it all set now. But only some of the sound files play while others do nothing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If all the sound and music file names are correct, then it's a bug. I'm sorry that happened to you

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