public void Shutdown() { buffer.Dispose(); sourceVoice.FlushSourceBuffers(); buffer = null; sourceVoice.Dispose(); sourceVoice = null; masteringVoice.Dispose(); masteringVoice = null; device.StopEngine(); device.Dispose(); }
/// <summary> /// Gets rid of audio objects. /// </summary> public static void cleanUp() { musicMasteringVoice.Dispose(); musicDevice.Dispose(); mainMasteringVoice.Dispose(); mainSoundDevice.Dispose(); }
public void Dispose() { buffer.Dispose(); srcVoice.Dispose(); masteringVoice.Dispose(); device.Dispose(); }
public override void Dispose(bool disposing) { if (disposing) { if (sourceVoice != null) { sourceVoice.FlushSourceBuffers(); sourceVoice.Stop(); sourceVoice.Dispose(); sourceVoice = null; } if (xAudioBuffer != null) { xAudioBuffer.Stream.Dispose(); xAudioBuffer.Stream = null; xAudioBuffer = null; } if (xAudio != null) { xAudio.StopEngine(); xAudio.Dispose(); xAudio = null; } } }
private void Dispose(bool disposing) { if (!_disposed) { if (disposing) { StopFxSounds(); StopEnvSounds(); _currentBgm?.DestroyVoice(); _currentBgm?.Dispose(); _currentBgm = null; _fxLinkedSoundList.Clear(); _envLinkedSoundList.Clear(); UnloadAll(); _fxSubmixVoice.DestroyVoice(); _fxSubmixVoice.Dispose(); _envSubmixVoice.DestroyVoice(); _envSubmixVoice.Dispose(); _masteringVoice.DestroyVoice(); _masteringVoice.Dispose(); _xAudio2.Dispose(); } _disposed = true; } }
public override void Dispose() { if (InvokeRequired) { stopThread = true; int count = 0; while (xaudThread.ThreadState == ThreadState.Running) { Thread.Sleep(10); count++; if (count > 20) { xaudThread.Abort(); } } return; } masteringVoice.Dispose(); mDevice.Dispose(); }
static SoundEffect() { // This cannot fail. Device = new XAudio2(); try { Device.StartEngine(); // Let windows autodetect number of channels and sample rate. MasterVoice = new MasteringVoice(Device, XAudio2.DefaultChannels, XAudio2.DefaultSampleRate); MasterVoice.SetVolume(_masterVolume, 0); // The autodetected value of MasterVoice.ChannelMask corresponds to the speaker layout. Speakers = (Speakers)MasterVoice.ChannelMask; } catch { // Release the device and null it as // we have no audio support. Device.Dispose(); Device = null; MasterVoice = null; } }
protected virtual void Dispose(bool disposing) { if (disposing) { _xAudio.Dispose(); } }
protected virtual void Dispose(bool disposing) { if (!m_Disposed) { if (disposing) { Stop(); m_CancellationToken?.Dispose(); m_Current?.Dispose(); m_ProcessingTask.Dispose(); SoundMsgStart?.Dispose(); SoundMsgEnd?.Dispose(); foreach (var msg in SupportedMessages) { msg?.Dispose(); } m_MasteringVoice.Dispose(); m_Device.Dispose(); } m_Disposed = true; } }
public void Dispose() { foreach (var item in voices) { item.Key.Dispose(); } xAudio?.Dispose(); }
// Does someone actually need to call this if it only happens when the whole // game closes? And if so, who would make the call? internal static void Shutdown() { MasterVoice.DestroyVoice(); MasterVoice.Dispose(); Device.StopEngine(); Device.Dispose(); }
/// <summary> /// Não necessariamente um dispose. /// </summary> public void Dispose() { StopEngine(); XAudio2.Dispose(); XAudio2 = null; MasteringVoice = null; }
public static DeviceDetails[] GetAudioDevices() { XAudio2 system = new XAudio2(); var dd = GetAudioDevices(system); system.Dispose(); return(dd); }
public static void disposeAudio() { mv.Dispose(); xa2.Dispose(); foreach (SourceVoice s in sources.Keys) { finishSource(s); } }
private void AwcForm_FormClosing(object sender, FormClosingEventArgs e) { Stop(); if (xAudio2 != null) { masteringVoice.Dispose(); xAudio2.Dispose(); } }
private void Dispose(bool isDisposing) { if (!isDisposing) { return; } //disposed managed items: XAudio2.Dispose(); MasteringVoice.Dispose(); }
public void Dispose() { foreach (var wave in Sounds) { wave.Value.Buffer.Stream.Dispose(); } xAudio2.StopEngine(); masteringVoice?.Dispose(); xAudio2?.Dispose(); }
private void finalizeXAudio2() { if (xaMaster != null) { xaMaster.Dispose(); } if (xaDevice != null) { xaDevice.Dispose(); } }
public void DisposeAudio() { if (xAudio2 != null) { masteringVoice.Dispose(); xAudio2.Dispose(); } foreach (var voice in voices) { voice?.audioBuffer?.Stream?.Dispose(); } }
/// <summary> /// SharpDX XAudio2 sample. Plays wav/xwma/adpcm files from the disk. /// </summary> static void Main(string[] args) { var xaudio2 = new XAudio2(); var masteringVoice = new MasteringVoice(xaudio2); PLaySoundFile(xaudio2, "1) Playing a standard WAV file", "ergon.wav"); PLaySoundFile(xaudio2, "2) Playing a XWMA file", "ergon.xwma"); PLaySoundFile(xaudio2, "3) Playing an ADPCM file", "ergon.adpcm.wav"); masteringVoice.Dispose(); xaudio2.Dispose(); }
public void Stop() { thread?.Abort(); if (sourceVoice != null && buffer != null && xaudio2 != null && masteringVoice != null) { sourceVoice.DestroyVoice(); sourceVoice.Dispose(); sourceVoice = null; xaudio2.Dispose(); masteringVoice.Dispose(); } }
public void Dispose() { _quit = true; _audioThread.Wait(); Stop(); foreach (var buffer in _buffers) { buffer.Dispose(); } _voice.Dispose(); _masteringVoice.Dispose(); _xAudio.Dispose(); }
/*------------------------------------- * PUBLIC METHODS *-----------------------------------*/ public void Cleanup() { if (m_MasteringVoice != null) { m_MasteringVoice.Dispose(); m_MasteringVoice = null; } if (m_XAudio2 != null) { m_XAudio2.Dispose(); m_XAudio2 = null; } }
const int VK_ESCAPE = 0x1B; // public static void AudioMain() { XAudio2 device = new XAudio2(); //audio output stream/device MasteringVoice masteringVoice = new MasteringVoice(device); //no idea, presumably prepares the out stream // play a PCM file PlayPcm(device, "MusicMono.wav"); //this actually plays a wav file // play a 5.1 PCM wave extensible file PlayPcm(device, "MusicSurround.wav"); masteringVoice.Dispose(); //cleanup device.Dispose(); // }
public void TestPlaySoundXAudio2() { XAudio2 device = new XAudio2(); MasteringVoice masteringVoice = new MasteringVoice(device); // play a PCM file PlayPCM(device, TWDir.GameData + "\\Core\\TestSound.wav"); // play a 5.1 PCM wave extensible file //PlayPCM(device, "MusicSurround.wav"); masteringVoice.Dispose(); device.Dispose(); }
static void Main() { XAudio2 device = new XAudio2(); MasteringVoice masteringVoice = new MasteringVoice(device); // play a PCM file PlayPCM(device, "MusicMono.wav"); // play a 5.1 PCM wave extensible file PlayPCM(device, "MusicSurround.wav"); masteringVoice.Dispose(); device.Dispose(); }
public override void Dispose() { if (_voice != null) { _voice.Dispose(); } if (_masteringVoice != null) { _masteringVoice.Dispose(); } if (_xaudio2 != null) { _xaudio2.Dispose(); } }
public static bool TryDetectXAudio2() { try { var xaudio2 = new XAudio2(); xaudio2.Dispose(); xaudio2 = null; return(true); } catch { return(false); } }
public void Dispose() { DeviceMain.Direct3D.Dispose(); SpriteMain.Dispose(); if (TextureObjectDictionary != null) { foreach (TextureObject textureObject in TextureObjectDictionary.Values) { textureObject.Dispose(); } } if (SoundDictionary != null) { foreach (XAudio2_Player xaudio2Player in SoundDictionary.Values) { xaudio2Player.Dispose(); } } if (BGM_Player != null) { BGM_Player.Dispose(); } if (ScreenTexMan != null) { ScreenTexMan.Dispose(); } if (EffectDictionary != null) { foreach (ComObject comObject in EffectDictionary.Values) { comObject.Dispose(); } } if (ModelDictionary != null) { foreach (Model model in ModelDictionary.Values) { model.Dispose(); } } if (DeviceXaudio2 == null) { return; } DeviceXaudio2.Dispose(); }
public void Dispose() { Stop(); for (int i = 0; i < audioBuffersRing.Length; i++) { Utilities.FreeMemory(memBuffers[i].Pointer); memBuffers[i].Pointer = IntPtr.Zero; } masteringVoice.DestroyVoice(); masteringVoice.Dispose(); masteringVoice = null; xaudio2.Dispose(); xaudio2 = null; }