コード例 #1
0
        private void buttonBrowsePauseSound_Click(object sender, EventArgs e)
        {
            if (openFileDialogPause.ShowDialog() == DialogResult.OK)
            {
                //Try opening the file
                try
                {
                    string extension = Path.GetExtension(openFileDialogPause.FileName);
                    switch (extension)
                    {
                    /*case ".wav":
                     *  PauseSound = new CachedVorbisSound(openFileDialogPause.FileName);
                     *  break;
                     * case ".aiff":
                     *  PauseSound = new CachedVorbisSound(openFileDialogPause.FileName);
                     *  break;
                     * case ".mp3":
                     *  PauseSound = new CachedVorbisSound(openFileDialogPause.FileName);
                     *  break;*/
                    case ".ogg":
                        PauseSound = new CachedVorbisSound(openFileDialogPause.FileName);
                        break;

                    /*case ".flac":
                     *  PauseSound = new CachedVorbisSound(openFileDialogPause.FileName);
                     *  break;*/
                    default:
                        ResetPauseSound();
                        return;
                    }
                }
                catch (Exception)
                {
                    ResetPauseSound();
                    return;
                }

                //If we got to here, it opened successfully
                labelPauseSound.Text = "Pause sound: " + Path.GetFileName(openFileDialogPause.FileName);
                LogMessage("Pause sound is set to " + Path.GetFullPath(openFileDialogPause.FileName) + ". This sound will play when playback pauses", Color.LightSkyBlue);

                Mixer.PlaySound(PauseSound);
            }
            else
            {
                ResetPauseSound();
                return;
            }
        }
コード例 #2
0
 public void PlaySound(CachedVorbisSound sound)
 {
     AddMixerInput(new CachedSoundSampleProvider(sound));
 }
コード例 #3
0
 public CachedSoundSampleProvider(CachedVorbisSound cachedSound)
 {
     this.cachedSound = cachedSound;
 }