Example #1
0
        public WaveOutBuffer(IntPtr theWaveOutHandle, short[] theBuffer, UInt32 theNumberOfSamples)
        {
            waveOutHandle = theWaveOutHandle;

            headerHandle            = GCHandle.Alloc(new short[2 * theNumberOfSamples], GCHandleType.Pinned);
            waveHeader              = new WaveOutNative.WaveHeader();
            waveHeader.user         = (IntPtr)GCHandle.Alloc(this);
            waveHeader.bufferLength = (int)theNumberOfSamples * 2 * Marshal.SizeOf(typeof(short));
            waveHeader.data         = headerHandle.AddrOfPinnedObject();

            Marshal.Copy(theBuffer, 0, waveHeader.data, (int)(2 * theNumberOfSamples));
        }
Example #2
0
        public static void OnWaveOutDataReceived(IntPtr theHdr, int theMessage, int theUserData, ref WaveOutNative.WaveHeader theWaveHeader, int theParam)
        {
            if (theMessage == 0x3BD /* MM_WOM_DONE */)
            {
                GCHandle aHandle = (GCHandle)theWaveHeader.user;

                WaveOutHandler.sentBufferCount--;
            }
        }