本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例4: SoundObjectBackend_IrrKlang
/// <summary>
/// コンストラクタ
/// </summary>
public SoundObjectBackend_IrrKlang(ISound sound)
{
if (sound == null)
{
throw new ArgumentNullException("sound");
}
sound.setSoundStopEventReceiver(this);
this.sound = sound;
}
示例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);
}