Need help with sound [ FIXED ]

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi I'm new to this forum. I'm using Construct Classic and I have a problem with sounds.

    I was trying to make a game with some complicated sound options but I failed. Then I thought, maybe I'm missing something, I should try it with a simplier way and I failed that too so now heres the simple one:

    I inserted Mouse&Keyboard, XAudio2 on the layout. Then I wrote:

    On key 1 pressed-> 1_XAudio2: Load file AppPath & "1.wav" to channel 1 (No loop)

                       2_XAudio2: Play channel 1

    On key 2 pressed-> 1_XAudio2: Load file AppPath & "2.wav" to channel 2 (No loop)

                       2_ Play channel 2

    on the event sheet. And yes I also added 1.wav and 2.wav to Sounds in the Project.

    Now. If I added 2.wav last into Sounds, when I launch the game and press 2, it plays the sound but doesn't play 1.wav. If I added 1.wav last into Sounds and when I launch and press 1, it plays the sound but doesn't play 2.wav. Or maybe it's just a coincidence.

    Basically, it plays just 1 of them and doesn't play the other.

    I don't understand what the problem is and I don't think I was able to tell you my problem here properly :(. But what I want is:

    I want multiple sounds. Example: When I press 1, a sound will play. When I press 2, another sound will play. When I press 3 another and so on...

    Please help me I'm thinking about a big game and this is the one and only problem I have.

    Thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're mixing resources and files in the description. So I'm not sure, what you heading for.

    Sound file play: You need to make sure that the files exist at AppPath & "xx.wav". AppPath always points to the directory, where the .cap or .exe exists. If you didn't save the .cap before running it, AppPath isn't valid.

    Sound resource play: You need to add the sounds to the files folder in the project tab and have to use the "load resource" actions.

    The two events you posted are quite a mess <img src="smileys/smiley2.gif" border="0" align="middle" />

    You seem to have a xaudio object called "1_XAudio2" and load the file to it. But then you try to play it on an object called "2_XAudio2", which never had any files loaded to its channels.

    Summary: Place all your sounds in the correct folder on disc. Use just one XAudio2 object. Correct the two events to only load and play on this one XAudio2 object. Save the cap before running.

  • Well actually those 1_ and 2_ were to show the number of actions :P my bad. I only used "XAudio2" not something else. And I also tried another things like, using a different audio thing for each sound like: XAudio1 will play 1.wav, XAudio2 will play 2.wav etc. but that didn't work too. Anyway I'll try what you're saying here and get back to you :D

    EDIT1: WOW! Thanks a lot! This solves my problem.

    Here's the fix for the people who couldn't figure out putting sounds like me :P

    Sound resource play: You need to add the sounds to the files folder in the project tab and have to use the "load resource" actions.

    Locking topic, thanks again.

    EDIT2: Eh, how do I lock topic :D :S

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