Hi
I have a scenario that for best effect 'sound' would go speaker L to R / R to L...
It's for an unseen 'object' above scuttling about/around.
What is the efficient way of doing this?
cheers
That's pretty easy to do by setting up an audio channel
AudioChannel *channel = MYSOUND.Play();
and then playing with the panning property:
channel.Panning = VALUE;
-100 is left speaker only, 100 is right speaker only, 0 is "the middle". You can "move" a sound by adjusting the value:
int soundPos = -100
while (soundpos < 100)
{
channel.Panning = soundPos;
soundPos++;
Wait(1);
}
[edit]
You may want to include a failcheck if the sound has stopped while the "panning" is still in progress; I do NOT know if panning a channel that does no longer exist will throw an error.
Hi Ghost,
Got this error:
QuoteFailed to save room room2.crm; details below
room2.asc(175): Error (line 175): undefined symbol 'soundpos'
}
if (IsTimerExpired(3))
{
AudioChannel *channel = aScuttling_creature.Play();
int soundPos = -100;
while (soundpos < 100) // * UNDEFINED SYMBOL soundpos
channel.Panning = soundPos;
soundPos++;
Wait(1);
cspaceman.SayBackground("What the hell is that scuttling noise???");
Wait(60);
cspaceman.SayBackground("");
SetTimer(3, 600);
}
}
slasher
Declare int soundpos at the top of the room script, that should do the trick.
Quote from: slasher on Sun 16/06/2013 15:34:14
Hi Ghost,
Got this error:
}
if (IsTimerExpired(3))
{
AudioChannel *channel = aScuttling_creature.Play();
int soundPos = -100;
while (soundPos < 100)
{
channel.Panning = soundPos;
soundPos++;
Wait(1);
}
cspaceman.SayBackground("What the hell is that scuttling noise???");
Wait(60);
cspaceman.SayBackground("");
SetTimer(3, 600);
}
}
Variables are case sensitive. Also, remember to bracket your while loop! Otherwise the code will just hang.
You need to change soundpos to soundPos. There are inconsistencies. X sorry, scavenger addressed it. Not sure how I missed that.
Many thanks guys,
with a bit of tweaking and stuff its perfect...
Many thanks
slasher