Audio Emitters
by Louis Dufresne · in General Discussion · 01/02/2004 (11:43 am) · 75 replies
I am trying to place an audio emitter in my world. While the emitter is there, no sound plays when I come near it. I load up the world editor and simply click on the sound box and then the emitter starts to play. Anyone know of a way to fix this? Ive tried everything I can possibly think of.
About the author
#2
I ran intot his a while ago, I will post again when I remember how I fixed this.
01/23/2004 (3:37 pm)
I would wonder if your audio profile is set up properly.I ran intot his a while ago, I will post again when I remember how I fixed this.
#3
01/24/2004 (5:49 am)
The sound resources that I use im my game are all 22,050, 16 bit MONO. They play fine for background music, gui buttons, guns shooting, explosions, etc. Just when I place audio emitters into the world the sounds never play. I then go into the world editor, click on the audio emitter and it starts to play/loop. Triggers work and for now thats how ive gotten around this emitter problem. So when I enter a trigger I just play the sound and when I leave the sound stops. So for now thats how im going with things, but it would be nice to get the emitters working. Robert if you do remember how you fixed this problem that would be great to know how. Thanks
#4
http://holodeck.st.usm.edu/vrcomputing/scenebuilding/chapter08.shtml
Regards,
Dirk
01/24/2004 (10:21 am)
I am not sure if this helps but check this page:http://holodeck.st.usm.edu/vrcomputing/scenebuilding/chapter08.shtml
Regards,
Dirk
#5
When I renamed them to something much more remote, they started working again.
If this is not the case, double check your audio channels and profiles for the sounds.
01/25/2004 (8:18 pm)
I believe when I had my problem, that I had a problem with the names of the ogg files.When I renamed them to something much more remote, they started working again.
If this is not the case, double check your audio channels and profiles for the sounds.
#6
Anyway how'd you get it to work with a trigger? I set up a trigger and it's checking fine, but I don't know how to make it play the sound. This is how I made the sound:
And I tried playing it by calling "alxPLay(WaterfallSound);" in the trigger, but it just says "unable to locate audio profile 'WaterfallSound'". I doubt the sound isn't being loaded since I stuck it in a file with a buncha other AudioProfiles.
Working on a Realm Wars map by the way (using the latest public release), not my own game. I don't think that should matter, but if nothing else that means it was compiled in an older version of Torque. This scripting thing is all new to me, so pry something simple I'm doing wrong.
And the sound file is 16bit 22k mono.
01/25/2004 (9:04 pm)
Gah I get the same problem, I keep thinkin maybe you have to manually start the emitter to play or something, but no idea how youl'd do that.Anyway how'd you get it to work with a trigger? I set up a trigger and it's checking fine, but I don't know how to make it play the sound. This is how I made the sound:
datablock AudioProfile(WaterfallSound)
{
fileName = "~/data/water/waterfall2.wav";
description = AudioDefaultLooping3d;
preload = true;
};And I tried playing it by calling "alxPLay(WaterfallSound);" in the trigger, but it just says "unable to locate audio profile 'WaterfallSound'". I doubt the sound isn't being loaded since I stuck it in a file with a buncha other AudioProfiles.
Working on a Realm Wars map by the way (using the latest public release), not my own game. I don't think that should matter, but if nothing else that means it was compiled in an older version of Torque. This scripting thing is all new to me, so pry something simple I'm doing wrong.
And the sound file is 16bit 22k mono.
#7
In my scripting, I have the following (I am using your file names though):
new AudioProfile(WaterfallSound)
{
filename = "~/data/water/waterfall2.wav";
description = "AudioDefaultLooping3d";
preload = true;
};
notice my differences. I have quotes around the description. Sometimes this has made a difference, sometimes not... havent figured out why. HUGE difference: I claimed it is a new audio profile, not a datablock.
Let me know if that helps.
01/26/2004 (6:05 am)
OK, a big difference to what I have.In my scripting, I have the following (I am using your file names though):
new AudioProfile(WaterfallSound)
{
filename = "~/data/water/waterfall2.wav";
description = "AudioDefaultLooping3d";
preload = true;
};
notice my differences. I have quotes around the description. Sometimes this has made a difference, sometimes not... havent figured out why. HUGE difference: I claimed it is a new audio profile, not a datablock.
Let me know if that helps.
#8
I got all my emitters work fine have no problems with
the distance or cutoff .
But i dont use the profiles at all !
I turn off profiledescription and load the soundfile direct on the emitter,set the distances and it work fine.
Look at this
This one i use for my fires
-Billy
01/26/2004 (9:37 am)
Are you using head ?I got all my emitters work fine have no problems with
the distance or cutoff .
But i dont use the profiles at all !
I turn off profiledescription and load the soundfile direct on the emitter,set the distances and it work fine.
Look at this
new AudioEmitter(firesound1) {
position = "106.607 -373.824 149.021";
rotation = "1 0 0 0";
scale = "1 1 1";
fileName = "~/data/soundfx/campfiremono.wav";
useProfileDescription = "0";
outsideAmbient = "0";
volume = "1";
isLooping = "1";
is3D = "1";
referenceDistance = "2";
maxDistance = "20";
coneInsideAngle = "360";
coneOutsideAngle = "360";
coneOutsideVolume = "1";
coneVector = "0 0 1";
loopCount = "-1";
minLoopGap = "0";
maxLoopGap = "0";
type = "4";
MinDistance = "5";
};This one i use for my fires
-Billy
#9
01/26/2004 (10:32 am)
I just added that code into my mission and im still getting the same effect. I need to run the editor and click on the audio emitter in order for it to work. The way I setup the trigger was that I just set the trigger command to alxPlay(thesound). And on exit the trigger I just alxStop(thesound) and it works perfectly. Except that the volume doesnt go down or up based on distance, so thats the only downfall.
#10
And yeah my AudioEmitter doesn't use profiles, I defined everything in it manually... only difference on mine is the "type" is 1... I don't even know what that parameter does though. But like I said, that's an older version of Torque, so I dunno if that might have something to do with it.
01/26/2004 (4:11 pm)
Hmmm yeah I originally had it as a new AudioProfile in the missionfile, but it wasn't working there either. I'll try putting quotes on the description when I get home, though that really shouldn't have any effect... though on second thought I think I did get a testplay working like that... oh well I'll have to see later.And yeah my AudioEmitter doesn't use profiles, I defined everything in it manually... only difference on mine is the "type" is 1... I don't even know what that parameter does though. But like I said, that's an older version of Torque, so I dunno if that might have something to do with it.
#11
I got it working without any changes with my soundfile.
So i converted the file to 16 bit 22khz mono and
to 8 bit 22khz mono and the emitter still works fine !
what soundcards do you have ?
I use a sblive 1024.
01/26/2004 (5:33 pm)
I tested your codes in the head version .I got it working without any changes with my soundfile.
So i converted the file to 16 bit 22khz mono and
to 8 bit 22khz mono and the emitter still works fine !
what soundcards do you have ?
I use a sblive 1024.
#12
Also I got the sound playing when I enter the trigger, but it won't stop when I leave? Put "alxStop(WaterfallSound);" in the exit function. It is checking the leave state, but I guess maybe that's not how you stop a sound? And how could I setup the trigger so I can pick what sound effect I want it to play?
01/26/2004 (10:10 pm)
Could have somethin' to do with it. I just have whatever generic sound card came with the computer.Also I got the sound playing when I enter the trigger, but it won't stop when I leave? Put "alxStop(WaterfallSound);" in the exit function. It is checking the leave state, but I guess maybe that's not how you stop a sound? And how could I setup the trigger so I can pick what sound effect I want it to play?
#13
try to use serverplay2d or serverplay3d with the trigger
look in common/server/audio.cs
01/27/2004 (3:09 am)
Paul i got soundtriggers totry to use serverplay2d or serverplay3d with the trigger
look in common/server/audio.cs
#14
01/27/2004 (6:27 am)
Have a question, what channel are you using?
#15
I dunno where youl'd set your audio channels... this is what's in the prefs file if that helps:
01/27/2004 (9:38 am)
Yeah I can make it play with those functions too, but when I use it with a 3d type, it either never stops beyond the max distance, or if you start it beyond the max distance, it never starts playing.I dunno where youl'd set your audio channels... this is what's in the prefs file if that helps:
$pref::Audio::activeDriver = "default"; $pref::Audio::captureGainScale = 1; $pref::Audio::channelVolume1 = "1"; $pref::Audio::channelVolume2 = "1"; $pref::Audio::channelVolume3 = 0.8; $pref::Audio::channelVolume4 = 0.8; $pref::Audio::channelVolume5 = 0.8; $pref::Audio::channelVolume6 = 0.8; $pref::Audio::channelVolume7 = 0.8; $pref::Audio::channelVolume8 = 0.8; $pref::Audio::driver = "OpenAL"; $pref::Audio::effectsVolume = 1; $pref::Audio::enableVoiceCapture = 1; $pref::Audio::environmentEnabled = 0; $pref::Audio::forceMaxDistanceUpdate = 0; $pref::Audio::guiVolume = 0.8; $pref::Audio::masterVolume = 0.8; $pref::Audio::microphoneEnabled = 1; $pref::Audio::musicEnabled = 1; $pref::Audio::musicVolume = 0.8; $pref::Audio::radioVolume = 0.8; $pref::Audio::voiceChannels = 2; $pref::Audio::voiceVolume = 1;Come to think of it, I've never heard a working example of an audio emitter or a sound that actually falls off to nothing... maybe it doesn't work with a crappy sound card?
#16
this is setting the audio using this description to channel 4.
01/27/2004 (11:28 am)
datablock AudioDescription(ShortObjectEmmiters)
{
volume = 0.75;
isLooping= true;
is3D = true;
referenceDistance = 10.0;
MaxDistance= 50.0;
type = 4;
};this is setting the audio using this description to channel 4.
#17
But really, if I can just get a sound to stop playing when I leave a trigger, that would work fine (using a 2d looped sound), but how would I do that?
01/27/2004 (1:52 pm)
That's pretty much the same as the audio types already defined, I tried it and it did nothing. I'm pretty sure this isn't an issue with the code. It's either because of an older version of something, or my crappy hardware. Because the problem is that any 3d sound does not start if you enter it from beyond it's max distance, and likewise does not stop if you started it and then move beyond it's max distance.But really, if I can just get a sound to stop playing when I leave a trigger, that would work fine (using a 2d looped sound), but how would I do that?
#18
try to unmark this line in audio.cc
alxUpdateMaxDistance();
Maybe it works or not ,atleast for the sounds to turn on and off
01/29/2004 (11:52 am)
If you have the source code try to unmark this line in audio.cc
alxUpdateMaxDistance();
Maybe it works or not ,atleast for the sounds to turn on and off
#19
01/29/2004 (8:35 pm)
No I don't, I'm working on Realm Wars. So I don't think I'm going to get emitters working. I got the sound to start and stop playing when you exit and enter the trigger, though sadly it only seems to work with a 2d sound. I noticed alxStop didn't work coz' I checked the documentation and it only takes a Handle. But is it OK to be using CreateSource like this every time you enter the trigger area? I can just say alxPLay(WaterfallSound), but then I have to call alxStopAll() to stop it.function SoundTrigger::onEnterTrigger( %this, %trigger, %obj )
{
$WaterfallHandle = alxCreateSource(WaterfallSound, %trigger.getPosition() );
alxPLay($WaterfallHandle);
echo("play sound!");
Parent::onEnterTrigger( %this, %trigger, %obj );
}
function SoundTrigger::onLeaveTrigger( %this, %trigger, %obj )
{
alxStop($WaterfallHandle);
echo("stop sound!");
Parent::onLeaveTrigger( %this, %trigger, %obj );
}And how would I do something like add an extra function definition to the trigger or whatever youl'd do so I could make a parameter on the trigger that lets you define what sound it plays?
#20
01/30/2004 (3:45 am)
Paul try this then it works todatablock TriggerData(SoundTrigger)
{
tickPeriodMS = 100;
};
function SoundTrigger::onEnterTrigger(%this, %trigger, %obj)
{
Parent::onEnterTrigger(%this,%trigger,%obj);
%obj.PlayAudio(1,waterfallsound);
}
function SoundTrigger::onLeaveTrigger(%this,%trigger, %obj)
{
Parent::onLeaveTrigger(%this,%trigger,%obj);
%obj.StopAudio(1);
}
function SoundTrigger::onTickTrigger(%data, %obj)
{
}
Torque Owner Anthony Lovell
tone