Example #1
0
        public Buffer(WAVEFORMATEX Format, int Count)
        {
            handle = GCHandle.Alloc(this);

            size = BlockAlignedSize(Format, Count);
            samples = new Audio.SampleBuffer(Count) { Tag = this };

            header = new WAVEHDR();
            header.lpData = Marshal.AllocHGlobal(size);
            header.dwUser = (IntPtr)handle;
            header.dwBufferLength = (uint)size;
            header.dwFlags = 0;
            pin = GCHandle.Alloc(header, GCHandleType.Pinned);
        }
Example #2
0
        public Buffer(WAVEFORMATEX Format, int Count)
        {
            samples = new Audio.SampleBuffer(Count)
            {
                Tag = this
            };

            int size = BlockAlignedSize(Format, Count);

            data                  = new byte[size];
            dataPin               = GCHandle.Alloc(data, GCHandleType.Pinned);
            header                = new WAVEHDR();
            headerPin             = GCHandle.Alloc(header, GCHandleType.Pinned);
            header.lpData         = dataPin.AddrOfPinnedObject();
            header.dwBufferLength = (uint)size;
            header.dwFlags        = 0;
        }
Example #3
0
        public Buffer(WAVEFORMATEX Format, int Count)
        {
            handle = GCHandle.Alloc(this);

            size    = BlockAlignedSize(Format, Count);
            samples = new Audio.SampleBuffer(Count)
            {
                Tag = this
            };

            header                = new WAVEHDR();
            header.lpData         = Marshal.AllocHGlobal(size);
            header.dwUser         = (IntPtr)handle;
            header.dwBufferLength = (uint)size;
            header.dwFlags        = 0;
            pin = GCHandle.Alloc(header, GCHandleType.Pinned);
        }
Example #4
0
 public static extern MMRESULT waveOutWrite(IntPtr hWaveOut, ref WAVEHDR lpWaveOutHdr, int uSize);
Example #5
0
 public static extern MMRESULT waveOutUnprepareHeader(IntPtr hWaveOut, ref WAVEHDR lpWaveOutHdr, int uSize);
Example #6
0
 public static extern MMRESULT waveInPrepareHeader(IntPtr hWaveIn, ref WAVEHDR lpWaveInHdr, int uSize);
Example #7
0
 public static extern MMRESULT waveInAddBuffer(IntPtr hwi, ref WAVEHDR pwh, int cbwh);
Example #8
0
 public static extern MMRESULT waveInUnprepareHeader(IntPtr hWaveIn, WAVEHDR lpWaveInHdr, int uSize);
Example #9
0
 public static extern MMRESULT waveInAddBuffer(IntPtr hwi, WAVEHDR pwh, int cbwh);
Example #10
0
 public static extern MMRESULT waveOutWrite(IntPtr hWaveOut, WAVEHDR lpWaveOutHdr, int uSize);
Example #11
0
 public static extern MMRESULT waveOutPrepareHeader(IntPtr hWaveOut, WAVEHDR lpWaveOutHdr, int uSize);