GSDP:GAM100/CProcessing/CP Sound StopGroup()

From Inside
Jump to: navigation, search

CP_Sound_StopGroup()

Description

Stops all CP_Sounds that are currently playing within a given group and resets them to their beginnings.

Prototype

void CP_Sound_StopGroup(CP_SOUND_GROUP group)

Parameters

  • group - (CP_SOUND_GROUP) The group that you want to stop all sounds in

Return

This function does not return anything


Example

CP_Sound mySound = NULL;

void init()
{
  mySound = CP_Sound_Load("./Assets/Justins_voice.wav");
}

void update()
{
  float songLength = 500;
  static float timer = 0;

  timer += 1;

  CP_Settings_Background(CP_Color_Create(255, 255, 255, 255));

  CP_Sound_PlayAdvanced(mySound, 1, 1, TRUE, CP_SOUND_GROUP_2); // play a looped, but unedited, mySound in group 2

  if(timer >= .5f * songLength)
  {
    CP_Sound_StopGroup(CP_SOUND_GROUP_2);                         // stop playing mySound and reset it to it's beginning
    CP_Sound_PlayAdvanced(mySound, 1, 1, TRUE, CP_SOUND_GROUP_2); // play mySound from its beginning in group 2
  }
}

void shutdown()
{
  CP_Sound_Free(mySound);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>