XAudio not playing OGG from resource

This forum is currently in read-only mode.
From the Asset Store
Mine those precious space resources & start trading
  • Hi all.

    I've been playing sounds from file in the past, but now I'm looking to see how it goes with using the sounds as resources instead.

    After a good 20 minutes not understanding why the sound won't play, I found this thread:


    Was it true back then that OGG files couldn't be played from resources, and if so, is it still true now?


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No-one else had this problem?

    I'm going to go back and have a look at it this afternoon, but I'm pretty sure I've eliminated all human error and that this just doesn't work.


  • Well, it's definitely nothing my side, so it must be construct.

    Converting both OGG files that I was using to WAV, I am able to load them as resources and then play them on their channel when I need them without problem.

    The problem there is that the 15k OGG file becomes a 191k WAV file, and the 106k OGG file becomes more than 1.6 Mb.

    Yes, I can probably get them down from that, but I'm not prepared to lose much quality to get the filesize down, when the OGG does it so well.

    This is a real showstopper for me.

    I can't see me developing anything in Construct with this restriction.

    Is this just a bug that has been missed for so long, or is there another reason for it?

    BTW, this forum hasn't died has it?

    Seems to be getting quieter all the time.

    Time for the Devs to start making regular appearances again perhaps?


  • I haven't really used XAudio2 yet but this is what I found.

    After I added a ogg file to the files directory i was able to get it to play doing this:

    + Button: On Button clicked
    -> XAudio2: Play music "bgm012.ogg"[/code:iknmdomk]
    But not this:
    [code:iknmdomk]+ Button: On Button clicked
    -> XAudio2: Autoplay resource "bgm012.ogg" (No loop)[/code:iknmdomk]
    Does that help?
  • Thanks for replying rojo.

    I've found that using both methods you suggest gets the same results as you, except that the last 2/10ths of a second are cropped off the end of the sample (not played completely).

    I mentioned the devs having to sort out the Xaudio side of construct by version 1.0 months ago, based solely on what others where saying in various threads.

    Now I'm starting to put more sounds into the game, I can see where others were getting frustrated.

    One of my projects can easily be transferred over to another dev platform, or even C++, because it's still in the design stages, but I've put a lot of effort into the Construct side of my other project, and it would be annoying to lose all that.

    I'd like to hear what the devs think.

    Is the XAudio where they want it to be at, or do they have plans to give it some serious attention.

    As it stands, loading from file into channels works like a charm, but I'd prefer to store the samples away one way or another.

    Any chance the devs will consider allowing us to load files from password-protected ZIP files?

    Like I say, the playing of OGG files seems fine when loading from file into channels, so this would be a good solution.


  • Xaudio2 is set up into two different categories, sound, and music.

    Wav files while large in size on disk, remain about the same size when loaded into memory, thus making them comparatively easy to load and unload. This is why they are the only file type considered as sound, or usable as a sound fx.

    Ogg while much smaller on disk than wavs can take up much more memory, and is only set up as music for this reason.

    As I understand it XAudio2 is finished, with no other plans to change anything, I will add that since this is an open source project anybody is free to make up a plug that plays ogg's as a sound fx. I just pity anyone who tries to load a bunch of songs that way.

  • Thanks for a very informative post Newt.

    Much appreciated.

    I'll take a look at getting the wav filesize down without losing too much quality, and have a play around.

    The reason I wanted to use OGG was to keep the project filesize down, even though I don't have a clue how big it will be at the end.

    I'm afraid I'm the same when making 3D models.

    I like to get the best looking model with as few polys as possible if it's for a game rather than render, probably because I've seen too many poly-heavy models over the years.

    Maybe I shouldn't be as strict on the size of the wav files until I get closer to finishing the game (but I know I'll spend hours in GoldWave getting them just right )

    Thanks again for the info.


  • Don't forget there's always Python.

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