コード例 #1
0
        public void Play(byte track, bool looping)
        {
            if (_noAudio == false)
            {
                trackid   = track.ToString("00");
                trackpath = string.Format("{0}/{1}/music/track{2}.ogg", qparam.globalbasedir, qparam.globalgameid, trackid);
#if DEBUG
                Console.WriteLine("DEBUG: track path:{0} ", trackpath);
#endif
                try
                {
                    _isLooping = looping;
                    if (oggStream != null)
                    {
                        oggStream.Stop();
                    }
                    oggStream          = new OggStream(trackpath, 3);
                    oggStream.IsLooped = looping;
                    oggStream.Play();
                    oggStream.Volume = _Volume;
                    _noPlayback      = false;
                }
                catch (Exception e)
                {
                    Console.WriteLine("Could not find or play {0}", trackpath);
                    _noPlayback = true;
                    //throw;
                }
            }
        }
コード例 #2
0
ファイル: Audio.cs プロジェクト: hoptond/magiciansdemo
        public void SetMusic(string se, bool looping)
        {
            float volume = game.settings.musVolume;

            if (game.settings.mutedMusic)
            {
                volume = 0;
            }
            if (File.Exists(game.Content.RootDirectory + game.PathSeperator + "Music" + game.PathSeperator + se + ".ogg"))
            {
                if (currentMusic == se)
                {
                    return;
                }
                currentMusic = se;
                if (music != null)
                {
                    music.Stop();
                }
            }
            else
            {
                currentMusic = "";
                music.Stop();
                Console.WriteLine("PANIC: MUSIC FILE " + se + " NOT FOUND");
                return;
            }
            if (se != currentMusic || music == null)
            {
                if (music != null)
                {
                    music.Stop();
                    music.Dispose();
                    music = null;
                }
                music          = new OggStream(game.Content.RootDirectory + game.PathSeperator + "Music" + game.PathSeperator + se + ".ogg");
                music.IsLooped = looping;
                music.Volume   = volume;
                music.Play();
                currentMusic = se;
            }
            else
            {
                if (music.IsFinished())
                {
                    music.Stop();
                    music.Dispose();
                    music          = null;
                    music          = new OggStream(game.Content.RootDirectory + game.PathSeperator + "Music" + game.PathSeperator + se + ".ogg");
                    music.IsLooped = looping;
                    music.Volume   = volume;
                    music.Play();
                    currentMusic = se;
                }
            }
        }
コード例 #3
0
        internal void Stop()
        {
            if (stream == null)
            {
                return;
            }

            stream.Stop();
            _playCount = 0;
        }
コード例 #4
0
 public void Stop()
 {
     _stream.Stop();
 }
コード例 #5
0
 internal void Stop()
 {
     stream.Stop();
     _playCount = 0;
 }