public void PlaySync () { Start (); if (mstream == null) { SystemSounds.Beep.Play (); return; } if (!use_win32_player) { try { if (adata == null) adata = new WavData (mstream); if (adev == null) adev = AudioDevice.CreateDevice (null); if (adata != null) { adata.Setup (adev); adata.Play (adev); } } catch { } } else { win32_player.PlaySync (); } }
public void Load () { // can this be reused to load the same file again without re-setting the location? if (load_completed) return; if (audiostream != null) { LoadFromStream (audiostream); } else { LoadFromUri (sound_location); } // force recreate for new stream adata = null; adev = null; load_completed = true; AsyncCompletedEventArgs e = new AsyncCompletedEventArgs (null, false, this); OnLoadCompleted (e); if (LoadCompleted != null) LoadCompleted (this, e); if (use_win32_player) { if (win32_player == null) win32_player = new Win32SoundPlayer (mstream); else win32_player.Stream = mstream; } }