Beispiel #1
0
void CDAudio_SetVolume (float newvolume)
{
	if (!initialized || !enabled)
		return;

	SetVolumeOgg((int)(newvolume * 255.0));
}
Beispiel #2
0
void GuiSound::Play() {
    switch (type) {
        case SOUND_PCM:
            xenon_sound_submit((void*)sound,length);
            break;
    }
#ifndef NO_SOUND
    int vol;

    switch (type) {
        case SOUND_PCM:
            vol = 255 * (volume / 100.0);
            voice = ASND_GetFirstUnusedVoice();
            if (voice >= 0)
                ASND_SetVoice(voice, VOICE_STEREO_16BIT, 48000, 0,
                    (u8 *) sound, length, vol, vol, NULL);
            break;

        case SOUND_OGG:
            voice = 0;
            if (loop)
                PlayOgg((char *) sound, length, 0, OGG_INFINITE_TIME);
            else
                PlayOgg((char *) sound, length, 0, OGG_ONE_TIME);
            SetVolumeOgg(255 * (volume / 100.0));
            break;
    }
#endif
}
Beispiel #3
0
/***
      gx_audio_Stop

     This function stops current Audio DMA process
     This is called when going back to Main Menu
 ***/
void gx_audio_Stop(void)
{
  /* restart menu audio processing */
  DSP_Unhalt();
  ASND_Init();
  ASND_Pause(0);
	
  /* play background music */
  if (Bg_music_ogg && !Shutdown)
  {
    PauseOgg(0);	
    PlayOgg((char *)Bg_music_ogg, Bg_music_ogg_size, 0, OGG_INFINITE_TIME);	
    SetVolumeOgg(((int)config.bgm_volume * 255) / 100);	
  }
}
Beispiel #4
0
void GuiSound::SetVolume(int vol)
{
	volume = vol;

	if(voice < 0)
		return;

	int newvol = 255*(volume/100.0);

	switch(type)
	{
		case SOUND_PCM:
		ASND_ChangeVolumeVoice(voice, newvol, newvol);
		break;

		case SOUND_OGG:
		SetVolumeOgg(255*(volume/100.0));
		break;
	}
}