Game Development Community

Errors from SFX Engine, Can't get sound to work

by RealDecoy Inc · in Torque 3D Professional · 12/14/2009 (5:56 pm) · 6 replies

Hey, I'm trying to throw some background music to a main menu.

I've created an SFX Profile and all that, and when I try to play, it just doesn't.

So I tried calling GuiMusicPlayer and that runs fine as well, but when I try to play a file, it doesn't work.

Checking the console log results in:

*********** Game Startup **********
SFXSource::_create() - Could not create device buffer!
SFXSystem::createSource() - Creation failed!
  Profile: IntroTheme
  Filename: /art/audio/audioprofiles.cs

Then when I ran the GuiMusicPlayer basically the exact same error repeated several times:
SFXSource::_create() - Could not create device buffer!
SFXSystem::createSource() - Creation failed!
  Profile: (null)
  Filename: (null)
SFXSource::_create() - Could not create device buffer!
SFXSystem::createSource() - Creation failed!
  Profile: (null)
  Filename: (null)

(and repeated several times)

I'm trying to play an ogg file here, but any file via guimusicplayer fails.

Also in the options dialog, I can see my sound card, and it is selected, and sound is setup. And when I adjust the sound master volume in the options dialog, it does make the volume test sound. So sound is working (I assume).

anyone have any suggestions as to what I might have broken in my scripts? Or if something else is wrong?

I'm running Windows Vista X64 if that helps.

Thanks!

#1
12/14/2009 (8:42 pm)

Which audio provider are you using? (XAudio, DirectSound, OpenAL, FMOD?)

Could you try this with a different audio provider and see if the behavior is different?

Also, can you show me one of your SFXProfile definitions?

Am I understanding you correctly that all files listed in GuiMusicPlayer fail with the error above when you try to play them?

Could you possibly give this a shot on 1.1 Alpha? I *think* this is already fixed.

BTW, noticed another issue there where the script filename was printed in the error instead of the sound filename. Fixed for 1.1 Beta.
#2
12/15/2009 (9:09 am)
Ok... apparently, if I go into the settings ui, and change the provider and hit apply, then go back to guimusicplayer, it works... But upon restart of the game, I still get the error on loading my sfxprofile, and sound doesn't work. Then I go to guimusicplayer and it doesn't work again, but once I go into the settings ui, and edit the provider and hit apply again, then go back into guimusicplayer it works again...

Something odd is happening.

I know the settings ui is able to write the prefs.cs file, because if I change resolution, and quit and restart the game, it keeps resolution fine, and other graphics settings. It's also remembering my provider and slider settings just fine.

But yeah, it seems once in game I need to edit settings and hit apply then sound works.

Hell, just tested it without even going to the audio properties, I just open settings, hit apply, then run guimusicplayer and it works. but I have to hit apply first once upon running the game.

I have rewritten my main.cs files, since I ported this project in from a heavily rewritten TGE project. Perhaps I'm loading some core file, or prerequisite file out of order?

And yes, when it's not working, no matter what file I run (wav or ogg) it won't play, spits out the errors above. But once I click apply in the settings dialog (without changing a thing) then all files play fine.

Here is the sfxprofile I'm using:

new SFXProfile(IntroTheme)
{
   filename = "./music/introtheme.ogg";
   description = "Audio2D";
};

Also while I'm here, I'm noticing that in guimusicplayer the sound is very... quiet. But when I play the ogg with VLC for example it's nice and clear and loud (the volume in settings is maxed)

Any thoughts? or is that just guimusicplayer running the sfx profile with lower volume, so when I get it working with my own code, it should be louder?

Thanks!
#3
12/15/2009 (10:21 am)

Ok, this sounds like the SFX device is not being initialized on startup.

Do a normal startup and then look in the console log for a line that says "sfxStartup...". Also, after that line should be some lines beginning with "SFXSystem::createDevice" that show the device that had been created.

If none of this is there, no device is being created. I'm pretty sure that is the case which is why things only work after the audio options dialog kickstarts the system.

To fix this, make sure the relevant client init funtions in core are called. If you have changed the core scripts (which isn't a good thing), you have probably merged the relevant code away.

For the 2D audio volume being at full strength, make sure that both the volume of both master channel and the channel you play the profile in ($SimAudioType in your case) are at 1.0.
#4
12/15/2009 (2:07 pm)
I definately haven't changed the core scripts (with the exception of some of the gui profiles and such in core, which I know is messy but it was way easier for now for reworking the GUI.)

I just rewrote the main.cs in the game root, all the scripts outside of core basically.

Thanks for the tips, I'll take a look in my init routines and make sure that sfxStartup is calling at the right time.
#5
12/16/2009 (12:01 am)
Thanks! that totally did the trick, I wasn't calling sfxStartup in my scripts/main.cs (doh!)

Thanks!
#6
12/16/2009 (12:07 am)

:)

On the other hand, SFX could have really displayed a more indicative error message there ("No sound device initialized!") instead of printing stuff about follow-up errors and leaving the developer in the dark.

Will fix that.