How can I play music?

This forum is currently in read-only mode.
From the Asset Store
In this template the music plays without looping in your game
  • After reading some of the posts here, I have a suspicion that because I'm running Vista, I might not be able to play music in my game. I've been using MP3s and of course, that AudioX object or whatever it's called. I've even used MP3s in pathnames without any spaces, and tried doing that binary thing and playing it from resource, but still nothing. I really have no idea what's wrong here...

  • My understanding is that it is DirectSound that's the issue. If you're using the XAudio plugin, you should be all right.

  • XAudio2 has always been able to play music just fine for me... when you're loading a music from file, are you sure the filename exists? You could try AppPath & "myfile.mp3" and it'll load it from the same directory as the .exe/.cap.

  • I haven't made a .exe file or anything, I mean just in testing it won't work.

    Although... I'm fearing that there might be a different problem entirely. When I had Ulead Video Studio on the new laptop, and tried to throw in an MP3 with a video to try and make a video collage... It would have an illegal operation and close down. And on Windows Movie Maker... it can't play MP3s at all, forcing me to have to convert one of my MP3s to .wma for me to make my video collage.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • XAudio2 can play WMA too, have you tried that?

  • I thought I already said I did... but... I guess I forgot that detail. I tried, and that won't play either. ^^;;

  • Can you post a little .cap file which just has XAudio2 trying to play a .mp3 on start of layout from AppPath & "myfile.mp3", and if it doesn't work, upload the .cap and .mp3 somewhere so I can take a look?

  • Here it is. ^^; I dunno what I'm doing wrong with the coding or whatnot, but like I said, it may be a Vista (or more specifially, a "this laptop is just weird") problem. If you guys can get this working and I can't, I might consider installing Construct on this laptop just to see if I get the same problem on it. At this point, I'm putting down money that the problem is the new laptop itself.

    http://rapidshare.com/files/189040336/New_Game.zip.html

    While I'm at it, I might as well go ahead and ask why exactly my pause function and collision box trigger doesn't work until after initiating them once. It's like, you have to trigger them twice to get them to work the first time, and every time after that, it works the way it should. And I've noticed that if you're moving right while pausing, it automatically moves the selection to "Quit" and selects it. I was wondering how to keep the Pause menu from being so sensitive in the first place.

    Not that the second part there is nessecary, but just an afterthought after the music stuff.

  • First off, Autoplay uses channels to play. MP3 doesn't play on a channel. Ashley already posted the link, but in case you missed it, here's the wiki article on XAudio2: http://apps.sourceforge.net/mediawiki/c ... io2_Object

    But... even when I try "Play music," either from file or from resource, I can't get it to play :/. So I don't know what's up. It's not working for me either.

    As for the menu pausing thing... you need your "On 'Enter' Key" triggers at the tops of your events, or they won't work properly. Since there are other events above them, "On 'Enter' Key" triggers as a new press each time the conditions above it are reached. For example:

    +Every 5ms
    +On Enter Key Pressed
    ->Do stuff
    [/code:32byczfv]
    
    If you hold down the Enter key just once, it will register as having a new keypress every 5 milliseconds.  
    
    Another thing to watch out for:
    [code:32byczfv]
    +Foo
    +On Key
    [ul]
    	[li]> Foo is Goo[/li]
    [/ul]
    +Goo
    +On Key
    [ul]
    	[li]> Goo is Foo[/code:32byczfv][/li]
    [/ul]You will never get Goo, because it's changing right back to Foo.  You need more detailed conditions so you're not canceling them out by accident.
  • It's not working for you either? ;_; That sucks... I wonder why...

    And thanks for the suggestion about the order of conditions with that event. ^^; And I learned from your Platform School about how you can make new Event Sheets for totally different things to help make things run a little better. ^_^ So now I know.

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