GSDP:GAM100/CProcessing/CP Sound SetGroupVolume()

From Inside
Jump to: navigation, search

CP_Sound_SetGroupVolume()

Description

Sets the volume of all CP_Sounds that are within the given CP_SOUND_GROUP.

Prototype

void CP_Sound_PauseGroup(CP_SOUND_GROUP group, float volume)

Parameters

  • group - (CP_SOUND_GROUP) The sound group that you want to pause
  • volume - (float) The volume modifier you want to apply to the group (1.0f is normal volume)

Return

void - This function does not return anything

Example

CP_Sound mySound = NULL;
CP_Sound mySecondSound = NULL;

void init()
{
  mySound = CP_Sound_Load("./Assets/Justins_voice.wav");
  mySecondSound = CP_Sound_Load("./Assets/Justins_laugh.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_3);
  CP_Sound_PlayAdvanced(mySecondSound, 1, 1, TRUE, CP_SOUND_GROUP_5);

  if(timer >= .5f * songLength)
  {
      // make all sounds in group 3 (currently only mySound) half their original volume
    CP_Sound_SetGroupVolume(CP_SOUND_GROUP_3, .5);
  }
}

void shutdown()
{
  CP_Sound_Free(mySound);
  CP_Sound_Free(mySecondSound);
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>