private void init_dx() { try { sound_card = new Device(); sound_card.SetCooperativeLevel(this, CooperativeLevel.Priority); } catch { MessageBox.Show("Failed to create a sound card, check your directX version\nTheSoftware will run in compatibility mode. It will NOT sound good as it can only play one sound at a time"); return; } try { description = new BufferDescription(); description.ControlVolume = true; description.LocateInSoftware = true; } catch { MessageBox.Show("Failed to create a sound buffer, check your directX version\nTheSoftware will run in compatibility mode. It will NOT sound good as it can only play one sound at a time"); sound_card.Dispose(); sound_card = null; return; } }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } if (dxSoundDevice != null) { dxSoundDevice.Dispose(); } } base.Dispose(disposing); }
static Sound() { // Not sure what the equiv of java's Class.forName() is for testing availability... try { Device d = new Microsoft.DirectX.DirectSound.Device(); d.Dispose(); available = true; } catch (Exception e) { // to avoid warning on e not being used. // is there a [SuppressWarning] attribute? available = (e == null); } }
protected virtual void Dispose(bool disposing) { // If you need thread safety, use a lock around these // operations, as well as in your methods that use the resource. if (!m_disposed) { if (disposing) { Unload(); if (m_sounddevice != null) { m_sounddevice.Dispose(); } } m_sounddevice = null; // Indicate that the instance has been disposed. m_disposed = true; } }
public virtual void Dispose() { foreach (Picture picture in m_Pictures) { picture.Dispose(); } m_Pictures.Clear(); foreach (Font font in m_Fonts) { font.Dispose(); } m_Fonts.Clear(); foreach (Sound sound in m_Sounds) { sound.Dispose(); } m_Sounds.Clear(); foreach (Music music in m_Music) { music.Dispose(); } m_Music.Clear(); dIDevice.Dispose(); dIDevice = null; dsDevice.Dispose(); dsDevice = null; DXSprite.Dispose(); DXSprite = null; dGDevice.Dispose(); dGDevice = null; m_GameWindow.Dispose(); m_GameWindow = null; m_Disposed = true; }
public override void Dispose() { mDevice.Dispose(); }
public void Dispose() { applicationListener.Dispose(); applicationDevice.Dispose(); }