Sounds work then they don't - AudioEmitter
by Andy Hawkins · in Torque Game Engine · 11/13/2006 (6:50 am) · 7 replies
In this part of my code in player.cs I get an error when trying to load this sound, but in another piece of code in another .cs (below) it works fine. I debugged it, and the filename var resolves to "starter.fps/data/staticobjects/fences/IronGateClose.ogg" which is exactly where the sound is that works in the other door.cs file listed below
... can anyone see what's going wrong?
error in Console.log...
here's the offending function...in player.cs
but in another file door.cs then same sound call works...
... can anyone see what's going wrong?
error in Console.log...
Mapping string: You picked up %1 to index: 15 AudioEmitter::update: failed to create source! AudioEmitter::onAdd: client failed initial update!
here's the offending function...in player.cs
function Armor::onCollision(%this,%obj,%col)
{
if (%obj.getState() $= "Dead")
return;
// Try and pickup all items
if (%col.getClassName() $= "Item")
{
if (%obj.pickup(%col))
{
// play sounds for objects - ANDY H
%key = %col.getDatablock();
if (%key.pickUpName $= "a gold key")
{
%keySound = new AudioEmitter()
{
position = %key.position;
fileName = "~/data/staticobjects/fences/IronGateClose.ogg";
description = AudioClose3d; //for loud sound
};
schedule(3000,0,deletethis, %keySound); //delete the sound in 3 sec.
}
}
}
....but in another file door.cs then same sound call works...
if (%door)
{
if (%door.isOpen)
{
messageClient(%client, 'MsgClosingDoor', '\c0Closing door');
%closesound = new AudioEmitter()
{
//datablock = %door.closeSound;
position = %door.position;
fileName = "~/data/staticobjects/fences/IronGateClose.ogg";
description = AudioClose3d; //for loud sound
};
schedule(3000,0,deletethis, %closesound); //delete the sound in 3 sec.
%door.setThreadDir(0,false);
%door.isOpen = false;
MoveObject(%obj, %obj.closedPosition);
}
}
#2
For anyone that is reading, I might have a upcoming fix but it would have to be made to fit OpenAL instead of FMOD. A 10 minute job perhaps.
11/15/2006 (4:32 am)
That's helpful Jon :)For anyone that is reading, I might have a upcoming fix but it would have to be made to fit OpenAL instead of FMOD. A 10 minute job perhaps.
#3
11/15/2006 (5:43 am)
I think the error is in using AudioEmitter() and not setting up an AudioProfile - I think it's a server / client thing.
#4
...yielded no position
It should have been
... ah well - so AudioEmitter is a quick way to play sounds... heh....erm....
11/15/2006 (6:06 am)
Dumb a#$ - it was a typo - sorry to waste space....position = %key.position;
...yielded no position
It should have been
position = %col.getTransform();
... ah well - so AudioEmitter is a quick way to play sounds... heh....erm....
#5
11/15/2006 (6:54 am)
That's different than what I had in mind. Glad it was a typo! :)
#6
@Andy-Its too bad you figured it out before I had a chance to look at your work, now I can't have fun with you.
11/15/2006 (7:59 am)
@ Stefan-I was just trying to figure out what context Andy was playing the sound in, plus if it was a silly issue I wanted to give him a hard time. :) I would like to check out what you are up to regarding sound, tho.@Andy-Its too bad you figured it out before I had a chance to look at your work, now I can't have fun with you.
#7
11/15/2006 (1:39 pm)
@Jon - don't make me tell everyone about that sound byte you sent me :P
Torque Owner Jon Jorajuria