示例#1
0
        public void PlayMusicThen(MusicInfo m, Action then)
        {
            if (m == null || !m.Exists)
            {
                return;
            }

            onMusicComplete = then;

            if (m == currentMusic && music != null)
            {
                soundEngine.PauseSound(music, false);
                MusicPlaying = true;
                return;
            }

            StopMusic();

            Func <ISoundFormat, ISound> stream = soundFormat => soundEngine.Play2DStream(
                soundFormat.GetPCMInputStream(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate,
                false, true, WPos.Zero, MusicVolume * m.VolumeModifier);

            music = LoadSound(m.Filename, stream);

            if (music == null)
            {
                onMusicComplete = null;
                return;
            }

            currentMusic = m;
            MusicPlaying = true;
        }
示例#2
0
 public ISound Play(ISoundFormat soundFormat, float volume)
 {
     return(soundEngine.Play2DStream(soundFormat.GetPCMInputStream(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate,
                                     false, true, WPos.Zero, volume));
 }