예제 #1
0
void native_midi_start(NativeMidiSong *song, int loops)
{
    int vol;

    if (song == NULL)
        return;

    SDL_PauseAudio(1);
    SDL_UnlockAudio();

    if (currentsong)
        MusicPlayerStop(currentsong->player);

    currentsong = song;
    currentsong->loops = loops;

    MusicPlayerPreroll(song->player);
    MusicPlayerSetTime(song->player, 0);
    MusicPlayerStart(song->player);

    GetSequenceAudioUnit(song->sequence, &song->audiounit);

    vol = latched_volume;
    latched_volume++;  /* just make this not match. */
    native_midi_setvolume(vol);

    SDL_LockAudio();
    SDL_PauseAudio(0);
}
예제 #2
0
파일: music.c 프로젝트: iaco79/IrrGameDemo
/* Set the music volume */
static void music_internal_volume(int volume)
{
	switch (music_playing->type) {
#ifdef CMD_MUSIC
	    case MUS_CMD:
		MusicCMD_SetVolume(volume);
		break;
#endif
#ifdef WAV_MUSIC
	    case MUS_WAV:
		WAVStream_SetVolume(volume);
		break;
#endif
#ifdef MODPLUG_MUSIC
	    case MUS_MODPLUG:
		modplug_setvolume(music_playing->data.modplug, volume);
		break;
#endif
#ifdef MOD_MUSIC
	    case MUS_MOD:
		MOD_setvolume(music_playing->data.module, volume);
		break;
#endif
#ifdef MID_MUSIC
	    case MUS_MID:
#ifdef USE_NATIVE_MIDI
		if ( native_midi_ok ) {
			native_midi_setvolume(volume);
			return;
		}
#endif
#ifdef USE_FLUIDSYNTH_MIDI
		if ( fluidsynth_ok ) {
			fluidsynth_setvolume(music_playing->data.fluidsynthmidi, volume);
			return;
		}
#endif
#ifdef USE_TIMIDITY_MIDI
		if ( timidity_ok ) {
			Timidity_SetVolume(volume);
			return;
		}
#endif
		break;
#endif
#ifdef OGG_MUSIC
	    case MUS_OGG:
		OGG_setvolume(music_playing->data.ogg, volume);
		break;
#endif
#ifdef FLAC_MUSIC
	    case MUS_FLAC:
		FLAC_setvolume(music_playing->data.flac, volume);
		break;
#endif
#ifdef MP3_MUSIC
	    case MUS_MP3:
		smpeg.SMPEG_setvolume(music_playing->data.mp3,(int)(((float)volume/(float)MIX_MAX_VOLUME)*100.0));
		break;
#endif
#ifdef MP3_MAD_MUSIC
	    case MUS_MP3_MAD:
		mad_setVolume(music_playing->data.mp3_mad, volume);
		break;
#endif
	    default:
		/* Unknown music type?? */
		break;
	}
}