GSDP:GAM100/CProcessing/PChannel

From Inside
Jump to: navigation, search

PChannel

Description

PChannel is a type used to store distinct audio channels. These channels can be created using createChannel() and sounds can be played on them using soundChannel() . The pitch, volume, paused state, fade, reverb and pan can be changed using the following functions:

Example

void update() 
{
    // Load a sound from the assets folder
    // Pass 0 as FALSE so the sound doesn't loop
    PSound mySound = loadSound("./Assets/Clap.wav", 0);

    // Create a channel named myChannel
    PChannel myChannel = createChannel("myChannel");

    // Set the pan to oscillate with the frame count
    setPan(myChannel, (float)sin(frameCount / 10.0));

    // If the left mouse is clicked, play the sound on our channel
    if (mouseClicked())
    {
        soundChannel(mySound, myChannel);
    }
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>