public DSResult CreateSoundBufferNative(DSBufferDescription bufferDesc, out IntPtr soundBuffer, IntPtr pUnkOuter) { fixed(void *ptrsoundbuffer = &soundBuffer) { return(InteropCalls.CalliMethodPtr(_basePtr, &bufferDesc, ptrsoundbuffer, (void *)pUnkOuter, ((void **)(*(void **)_basePtr))[3])); } }
private void Create(DirectSoundBase directSound, DSBufferDescription bufferDesc) { if ((bufferDesc.dwFlags & DSBufferCapsFlags.DSBCAPS_PRIMARYBUFFER) == DSBufferCapsFlags.DSBCAPS_PRIMARYBUFFER) throw new ArgumentException("Don t set the PRIMARYBUFFER flag for creating a secondarybuffer.", "bufferDesc"); _basePtr = directSound.CreateSoundBuffer(bufferDesc, IntPtr.Zero).ToPointer(); }
public DirectSoundSecondaryBuffer(DirectSoundBase directSound, WaveFormat waveFormat, int bufferSize) { if (directSound == null) { throw new ArgumentNullException("directSound"); } DSBufferDescription secondaryBufferDesc = new DSBufferDescription() { dwBufferBytes = (uint)bufferSize * 2, dwFlags = DSBufferCapsFlags.DSBCAPS_CTRLFREQUENCY | DSBufferCapsFlags.DSBCAPS_CTRLPAN | DSBufferCapsFlags.DSBCAPS_CTRLVOLUME | DSBufferCapsFlags.DSBCAPS_CTRLPOSITIONNOTIFY | DSBufferCapsFlags.DSBCAPS_GETCURRENTPOSITION2 | DSBufferCapsFlags.DSBCAPS_GLOBALFOCUS | DSBufferCapsFlags.DSBCAPS_STICKYFOCUS, dwReserved = 0, guid3DAlgorithm = Guid.Empty }; secondaryBufferDesc.dwSize = Marshal.SizeOf(secondaryBufferDesc); GCHandle hWaveFormat = GCHandle.Alloc(waveFormat, GCHandleType.Pinned); secondaryBufferDesc.lpwfxFormat = hWaveFormat.AddrOfPinnedObject(); Create(directSound, secondaryBufferDesc); hWaveFormat.Free(); }
public IntPtr CreateSoundBuffer(DSBufferDescription bufferDesc, IntPtr pUnkOuter) { IntPtr soundBuffer; DirectSoundException.Try(CreateSoundBufferNative(bufferDesc, out soundBuffer, pUnkOuter), "IDirectSound8", "CreateSoundBuffer"); return(soundBuffer); }
private void Create(DirectSoundBase directSound, DSBufferDescription bufferDesc) { if ((bufferDesc.dwFlags & DSBufferCapsFlags.DSBCAPS_PRIMARYBUFFER) == DSBufferCapsFlags.DSBCAPS_PRIMARYBUFFER) { throw new ArgumentException("Don t set the PRIMARYBUFFER flag for creating a secondarybuffer.", "bufferDesc"); } _basePtr = directSound.CreateSoundBuffer(bufferDesc, IntPtr.Zero).ToPointer(); }
public DirectSoundPrimaryBuffer(DirectSoundBase directSound) { if (directSound == null) throw new ArgumentNullException("directSound"); DSBufferDescription primaryBufferDesc = new DSBufferDescription() { dwBufferBytes = 0, dwFlags = DSBufferCapsFlags.DSBCAPS_PRIMARYBUFFER | DSBufferCapsFlags.DSBCAPS_CTRLVOLUME | DSBufferCapsFlags.DSBCAPS_CTRL3D, dwReserved = 0, lpwfxFormat = IntPtr.Zero, guid3DAlgorithm = Guid.Empty }; primaryBufferDesc.dwSize = Marshal.SizeOf(primaryBufferDesc); _basePtr = directSound.CreateSoundBuffer(primaryBufferDesc, IntPtr.Zero).ToPointer(); }
public DirectSoundPrimaryBuffer(DirectSoundBase directSound) { if (directSound == null) { throw new ArgumentNullException("directSound"); } DSBufferDescription primaryBufferDesc = new DSBufferDescription() { dwBufferBytes = 0, dwFlags = DSBufferCapsFlags.DSBCAPS_PRIMARYBUFFER | DSBufferCapsFlags.DSBCAPS_CTRLVOLUME | DSBufferCapsFlags.DSBCAPS_CTRL3D, dwReserved = 0, lpwfxFormat = IntPtr.Zero, guid3DAlgorithm = Guid.Empty }; primaryBufferDesc.dwSize = Marshal.SizeOf(primaryBufferDesc); _basePtr = directSound.CreateSoundBuffer(primaryBufferDesc, IntPtr.Zero).ToPointer(); }
public DirectSoundSecondaryBuffer(DirectSoundBase directSound, WaveFormat waveFormat, int bufferSize) { if (directSound == null) throw new ArgumentNullException("directSound"); DSBufferDescription secondaryBufferDesc = new DSBufferDescription() { dwBufferBytes = (uint)bufferSize * 2, dwFlags = DSBufferCapsFlags.DSBCAPS_CTRLFREQUENCY | DSBufferCapsFlags.DSBCAPS_CTRLPAN | DSBufferCapsFlags.DSBCAPS_CTRLVOLUME | DSBufferCapsFlags.DSBCAPS_CTRLPOSITIONNOTIFY | DSBufferCapsFlags.DSBCAPS_GETCURRENTPOSITION2 | DSBufferCapsFlags.DSBCAPS_GLOBALFOCUS | DSBufferCapsFlags.DSBCAPS_STICKYFOCUS, dwReserved = 0, guid3DAlgorithm = Guid.Empty }; secondaryBufferDesc.dwSize = Marshal.SizeOf(secondaryBufferDesc); GCHandle hWaveFormat = GCHandle.Alloc(waveFormat, GCHandleType.Pinned); secondaryBufferDesc.lpwfxFormat = hWaveFormat.AddrOfPinnedObject(); Create(directSound, secondaryBufferDesc); hWaveFormat.Free(); }
public DSResult Initialize(DirectSoundBase directSound, DSBufferDescription bufferDesc) { return InteropCalls.CalliMethodPtr(_basePtr, directSound.BasePtr.ToPointer(), &bufferDesc, ((void**)(*(void**)_basePtr))[10]); }
public DSResult Initialize(DirectSoundBase directSound, DSBufferDescription bufferDesc) { return(InteropCalls.CalliMethodPtr(_basePtr, directSound.BasePtr.ToPointer(), &bufferDesc, ((void **)(*(void **)_basePtr))[10])); }
public DirectSoundSecondaryBuffer(DirectSoundBase directSound, DSBufferDescription bufferDesc) { Create(directSound, bufferDesc); }