Ejemplo n.º 1
0
 public WaveOutPlayer(Int32 intDevice, WaveFormat objFormat, Int32 intBufferSize, Int32 intBufferCount, BufferFillEventHandler objFillProc)
 {
     objZero     = objFormat.shrWBitsPerSample == 8 ? (Byte)128 : (Byte)0;
     objFillProc = objFillProc;
     WaveOutHelper.Try(WaveNative.waveOutOpen(out objWaveOut, intDevice, objFormat, objBufferProc, 0, WaveNative.CALLBACK_FUNCTION));
     AllocateBuffers(intBufferSize, intBufferCount);
     objThread = new Thread(new ThreadStart(ThreadProc));
     objThread.Start();
 }
Ejemplo n.º 2
0
 public WaveOutBuffer(IntPtr objWaveOutHandle, Int32 intSize)
 {
     objWaveOut                  = objWaveOutHandle;
     objHeaderHandle             = GCHandle.Alloc(objHeader, GCHandleType.Pinned);
     objHeader.objDwUser         = (IntPtr)GCHandle.Alloc(this);
     objHeaderData               = new Byte[intSize];
     objHeaderDataHandle         = GCHandle.Alloc(objHeaderData, GCHandleType.Pinned);
     objHeader.objLpData         = objHeaderDataHandle.AddrOfPinnedObject();
     objHeader.intDwBufferLength = intSize;
     WaveOutHelper.Try(WaveNative.waveOutPrepareHeader(objWaveOut, ref objHeader, Marshal.SizeOf(objHeader)));
 }