public static DirectSound8 Create8(Guid device) { IntPtr ptr; DirectSoundException.Try(NativeMethods.DirectSoundCreate8(ref device, out ptr, IntPtr.Zero), "DSInterop", "DirectSoundCreate8(ref Guid, out IntPtr, IntPtr)"); return(new DirectSound8(ptr)); }
public IntPtr CreateSoundBuffer(DSBufferDescription bufferDesc, IntPtr pUnkOuter) { IntPtr soundBuffer; DirectSoundException.Try(CreateSoundBufferNative(bufferDesc, out soundBuffer, pUnkOuter), "IDirectSound8", "CreateSoundBuffer"); return(soundBuffer); }
public bool SupportsFormat(WaveFormat format) { DirectSoundCapabilities caps; DirectSoundException.Try(GetCaps(out caps), "IDirectSound", "GetCaps"); bool result = true; if (format.Channels == 2) { result &= (caps.Flags & DSCapabilitiesFlags.SecondaryBufferStereo) == DSCapabilitiesFlags.SecondaryBufferStereo; } else if (format.Channels == 1) { result &= (caps.Flags & DSCapabilitiesFlags.SecondaryBufferMono) == DSCapabilitiesFlags.SecondaryBufferMono; } else { result &= false; } if (format.BitsPerSample == 8) { result &= (caps.Flags & DSCapabilitiesFlags.SecondaryBuffer8Bit) == DSCapabilitiesFlags.SecondaryBuffer8Bit; } else if (format.BitsPerSample == 16) { result &= (caps.Flags & DSCapabilitiesFlags.SecondaryBuffer16Bit) == DSCapabilitiesFlags.SecondaryBuffer16Bit; } else { result &= false; } result &= format.WaveFormatTag == AudioEncoding.Pcm; return(result); }
public void Restore() { DirectSoundException.Try(RestoreNative(), c, "Restore"); }
public void Stop() { DirectSoundException.Try(StopNative(), c, "Stop"); }
public void Play(DSBPlayFlags flags) { DirectSoundException.Try(PlayNative(flags), c, "Play"); }
public void SetVolume(double volume) { DirectSoundException.Try(SetVolumeNative(volume), c, "SetVolume"); }
public void SetCurrentPosition(int playPosition) { DirectSoundException.Try(SetCurrentPositionNative(playPosition), c, "SetCurrentPosition"); }
public void SetCooperativeLevel(IntPtr hWnd, DSCooperativeLevelType level) { DirectSoundException.Try(SetCooperativeLevelNative(hWnd, level), "IDirectSound8", "SetCooperativeLevel"); }
public void SetNotificationPositions(DSBPositionNotify[] notifies) { DirectSoundException.Try(SetNotificationPositionsNative(notifies), "IDirectSoundNotify", "SetNotificationPositions"); }