Playing Music

This forum is currently in read-only mode.
From the Asset Store
This Student Workbook uses both Construct 3 & 2 encoding. It supplies client-side & php "back-end" encoding.
  • In my game, I'd like to play music in my layouts in the simplest ways possible. I find that when you load the file during play time as an action, it's a bit complicated for my liking. You have to load the file from where the construct file is, otherwise you have to specify the folder, which I'm guessing as an exe would be a huge pain since I'd have to include all those files with the exe (Or am I wrong?), so I want to avoid that.

    I notice that there is a folder for music and sounds in the project bar of Construct, so I'm wondering, how would I play music from the files I already loaded to those folders? I figure just putting them in the program like I would, say, a sprite, would be by far the easiest route to go, but in both Xaudio2 and Audiere, I can't figure out how to play those files I had already loaded.

    So basically, what I'm hoping to do is just play the sounds I've already loaded into Construct. Any ideas how I'd go about doing that? Thanks.

  • Wondering this also.

  • Instead of using the "Music" and "Sounds" folders use the "Files" folder. Then use the various "...from resource" actions of XAudio2 to control them. For example, when using "Autoplay resource" you will select the music to play from a list.

    As long as you are working on the cap, all those files will stay where they are, just a path to the file is stored. As soon as you build the executable, those files will be copied and added as resources to the .exe-file.

  • What you say seems to be working for me, though only for Audiere, the sounds won't play using Xaudio2 for some reason. On the flip side, Audiere apparently doesn't recognize when it's supposed to be global even though the option is there... oh well, at least sound related things are nice and simple to add in now.

    Thanks for the help, tulamide! :)

  • Now I can't get the music to stop. The only thing that is working is pause music. I want the music to stop at the end of the layout not just pause or are they one and the same?

    I am trying to create an audio event sheet but I don't know how to set it up to change the music when on a specific layout yet.

  • In whatever event I use to switch layouts, I also include an action to stop the music within that event. Have you already tried that? It works for me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you have an extra event sheet for all your audio events, you can specify where these events are valid by adding the system expression "get layout name" or "get layout number". You best use it in a compare event, like so:

    + System: LayoutName Equal to "options"

    -> add all events as subevents here, that belong to the layout "options"

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