当前位置: 首页>>代码示例>>C#>>正文


C# ISound.setSoundStopEventReceiver方法代码示例

本文整理汇总了C#中ISound.setSoundStopEventReceiver方法的典型用法代码示例。如果您正苦于以下问题:C# ISound.setSoundStopEventReceiver方法的具体用法?C# ISound.setSoundStopEventReceiver怎么用?C# ISound.setSoundStopEventReceiver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISound的用法示例。


在下文中一共展示了ISound.setSoundStopEventReceiver方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SoundPlayer

        private ISound sound; // Current playing song

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes music player and randomizer. After that plays first song
        /// from file and sets event receiver.
        /// </summary>
        /// <param name="mWindow">The RenderWindow instance for making overlays</param>
        public SoundPlayer( Mogre.RenderWindow mWindow)
        {
            engine = new ISoundEngine();
            songs = Directory.GetFiles(songPath);
            r = new Random();
            this.mWindow = mWindow;
            sound = engine.Play2D(songs[0]);
            sound.setSoundStopEventReceiver(this);
            ShowCurrentPlaying(songs[current]);

            effects = new Dictionary<string, string>();
            var tempEff = Directory.GetFiles(effectPath);
            foreach (var effName in tempEff) {
                var splited = effName.Split('\\');
                effects.Add(splited[splited.Length - 1], effName);
            }
        }
开发者ID:vavrekmichal,项目名称:Strategy,代码行数:28,代码来源:SoundPlayer.cs

示例2: Play

 public bool Play(AudioClip clip)
 {
     if (!File.Exists(clip.CacheFileName))
     {
         return false;
     }
     // we have to read it into memory and then play from memory,
     // because the built-in Irrklang play from file function keeps
     // the file open and locked
     byte[] audioData = File.ReadAllBytes(clip.CacheFileName);
     ISoundSource source = _soundEngine.AddSoundSourceFromMemory(audioData, clip.CacheFileName);
     _soundPlaying = _soundEngine.Play2D(source, false, false, false);
     if (_soundPlaying == null)
     {
         return false;
     }
     _audioClip = clip;
     _soundPlaying.setSoundStopEventReceiver(this);
     return true;
 }
开发者ID:Aquilon96,项目名称:ags,代码行数:20,代码来源:IrrklangPlayer.cs

示例3: Play

        public void Play()
        {
            if(IsRecording)
                throw new ApplicationException("Can't play while recording.");

            if (_sound != null)
            {
                _engine.StopAllSounds();
            }

            if(!File.Exists(_path))
                throw new FileNotFoundException("Could not find sound file", _path);

            //turns out, the silly engine will keep playing the same recording, even
            //after we've chaned the contents of the file or even delete it.
            //so, we need to make a new engine.
            //   NO   _sound = _engine.Play2D(path, false);

            var engine = new IrrKlang.ISoundEngine();

            // we have to read it into memory and then play from memory,
            // because the built-in Irrklang play from file function keeps
            // the file open and locked
            byte[] audioData = File.ReadAllBytes(_path);	//REVIEW: will this leak?
             _soundSource = engine.AddSoundSourceFromMemory(audioData, _path);
            if (_sound != null)
                _sound.Dispose();
            _sound = engine.Play2D(_soundSource, false, false, false);
            _sound.setSoundStopEventReceiver(_irrklangEventProxy,engine);
        }
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:30,代码来源:AudioIrrKlangSession.cs

示例4: SoundObjectBackend_IrrKlang

        /// <summary>
        /// コンストラクタ
        /// </summary>
        public SoundObjectBackend_IrrKlang(ISound sound)
        {
            if (sound == null)
            {
                throw new ArgumentNullException("sound");
            }

            sound.setSoundStopEventReceiver(this);
            this.sound = sound;
        }
开发者ID:leontius,项目名称:Ragnarok,代码行数:13,代码来源:SoundObjectBackend_IrrKlang.cs

示例5: PlayMusic

 /// <summary>
 /// Gets random number which is different than number of current playing song and play the new song.
 /// After that shows the name of the new song and sets the SoundStopEventReceiver.
 /// </summary>
 private void PlayMusic()
 {
     int i;
     while (current == (i = r.Next(songs.Length))) { }
     current = i;
     sound = engine.Play2D(songs[current]);
     ShowCurrentPlaying(songs[current]);
     sound.setSoundStopEventReceiver(this);
 }
开发者ID:vavrekmichal,项目名称:Strategy,代码行数:13,代码来源:SoundPlayer.cs


注:本文中的ISound.setSoundStopEventReceiver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。