Author Topic: Play a specific frequency  (Read 454 times)

Hey guys,

Do any of you know if torkscrupt has a function that can play a frequency? Thats really all, I dont have much more to say.

You can record a fixed tone and pitch it down/up (within the range 0.2x-2x) with alxListenerf(<handle>, "AL_PITCH", <scale>) on the client.

I sorta did this server sided by changing the timescale before playing the sound, and changing it back afterwards. I had to break messageAll to stop the " changed the timescale to X" (which is not a good idea, but nothing crashed). There is a function that sets the timescale server sided without the message, but it doesn't work on a dedicated.

I sorta did this server sided by changing the timescale before playing the sound, and changing it back afterwards. I had to break messageAll to stop the " changed the timescale to X" (which is not a good idea, but nothing crashed). There is a function that sets the timescale server sided without the message, but it doesn't work on a dedicated.

There's no reason to set the timescale on the server - only clients actually play the sound, of course.

function playWithPitch(%profile, %pitch)
{
    %timeScale = getTimeScale();

    if (%pitch != %timeScale)
        commandToAll('TimeScale', %pitch);

    serverPlay2D(%profile);

    if (%pitch != %timeScale)
        commandToAll('TimeScale', %timeScale);
}