GSDP:GAM100/CProcessing/soundPauseAll()

From Inside
Jump to: navigation, search

soundPauseAll

Description

Stops all sound from playing until soundResumeAll() is called. This includes all soundPlay() calls made after calling soundPauseAll().

Example

PSound snare;
PSound cowbell;
PSound hiHat;

void init()
{
  snare = soundLoad("./Assets/Snare.wav");
  cowbell = soundLoad("./Assets/Cowbell.wav");
  hiHat = soundLoad("./Assets/HiHat.wav");

  soundPlayAdvanced(snare, 1.0, 1.0, -1);
  soundPlayAdvanced(hiHat, 1.0, 1.0, -1);
}

bool isPaused = false;

void update()
{
  // If the left mouse is clicked, play the sound
  if (mouseClicked())
    soundPlayAdvanced(cowbell, 2.0, 0.5, 0);

  // If space is pressed pause/unpause sounds
  if (keyPressed(KEY_SPACE))
  {
    if (isPaused)
      soundResumeAll();
    else
      soundPauseAll();

    // Invert the paused bool
    isPaused = !isPaused;
  }
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>