コード例 #1
0
ファイル: WaveOut.cs プロジェクト: iraychen/ourmsg
		public WaveOut(int index,WAVEFORMATEX format,int buffersize,int buffer_count)//波形输出
		{
			this.m_fmt=format;
			this.m_outdex=index;
			m_buffersize=buffersize;
			m_outcb=new waveProc(this.waveOutProc);
			Debug.Assert(buffer_count>0 && buffer_count<65535);
			this.m_hs=new WAVEHDR[buffer_count];
			this.gchs=new GCHandle[buffer_count];
			for(int i=0;i<buffer_count;i++)
			{
				gchs[i]=GCHandle.Alloc(new byte[buffersize],GCHandleType.Pinned);
				WAVEHDR hdr=new WAVEHDR();
				hdr.dwBufferLength=buffersize;
				hdr.lpData=this.gchs[i].AddrOfPinnedObject();
				hdr.dwUser=i;
				this.m_hs[i]=hdr;
			}
			CheckError(waveOutOpen(ref m_out,m_outdex,ref m_fmt,m_outcb,0,0x00030000));
		}
コード例 #2
0
 public WaveOut(int index, WAVEFORMATEX format, int buffersize, int buffer_count)     //波形输出
 {
     this.m_fmt    = format;
     this.m_outdex = index;
     m_buffersize  = buffersize;
     m_outcb       = new waveProc(this.waveOutProc);
     Debug.Assert(buffer_count > 0 && buffer_count < 65535);
     this.m_hs = new WAVEHDR[buffer_count];
     this.gchs = new GCHandle[buffer_count];
     for (int i = 0; i < buffer_count; i++)
     {
         gchs[i] = GCHandle.Alloc(new byte[buffersize], GCHandleType.Pinned);
         WAVEHDR hdr = new WAVEHDR();
         hdr.dwBufferLength = buffersize;
         hdr.lpData         = this.gchs[i].AddrOfPinnedObject();
         hdr.dwUser         = i;
         this.m_hs[i]       = hdr;
     }
     CheckError(waveOutOpen(ref m_out, m_outdex, ref m_fmt, m_outcb, 0, 0x00030000));
 }
コード例 #3
0
ファイル: WaveIn.cs プロジェクト: cheehwasun/ourmsg
		public WaveIn(int index,WAVEFORMATEX format,int buffersize,int buffer_count)
		{
			this.m_fmt=format;
			this.m_index=index;
			m_incb=new waveProc(this.waveInProc);
			Debug.Assert(buffer_count>0 && buffer_count<65535);
			
			this.m_hs=new WAVEHDR[buffer_count];
			this.gchs=new GCHandle[buffer_count];
		//	this.datas=new IntPtr[buffer_count];
			for(int i=0;i<buffer_count;i++)
			{
				gchs[i]=GCHandle.Alloc(new byte[buffersize],GCHandleType.Pinned);
			//	this.datas[i]=Marshal.AllocCoTaskMem(buffer_count);
				WAVEHDR hdr=new WAVEHDR();
				hdr.dwBufferLength=buffersize;
				hdr.lpData=this.gchs[i].AddrOfPinnedObject();
				hdr.dwUser=i;
				this.m_hs[i]=hdr;
			}
			CheckError(waveInOpen(ref m_in,m_index,ref m_fmt,m_incb,0,0x00030000));
			CheckError(waveInStart(m_in));
		}
コード例 #4
0
        public WaveIn(int index, WAVEFORMATEX format, int buffersize, int buffer_count)
        {
            this.m_fmt   = format;
            this.m_index = index;
            m_incb       = new waveProc(this.waveInProc);
            Debug.Assert(buffer_count > 0 && buffer_count < 65535);

            this.m_hs = new WAVEHDR[buffer_count];
            this.gchs = new GCHandle[buffer_count];
            //	this.datas=new IntPtr[buffer_count];
            for (int i = 0; i < buffer_count; i++)
            {
                gchs[i] = GCHandle.Alloc(new byte[buffersize], GCHandleType.Pinned);
                //	this.datas[i]=Marshal.AllocCoTaskMem(buffer_count);
                WAVEHDR hdr = new WAVEHDR();
                hdr.dwBufferLength = buffersize;
                hdr.lpData         = this.gchs[i].AddrOfPinnedObject();
                hdr.dwUser         = i;
                this.m_hs[i]       = hdr;
            }
            CheckError(waveInOpen(ref m_in, m_index, ref m_fmt, m_incb, 0, 0x00030000));
            CheckError(waveInStart(m_in));
        }
コード例 #5
0
ファイル: WaveOut.cs プロジェクト: iraychen/ourmsg
		private extern static int waveOutOpen(ref IntPtr phwo,int uDeviceID,
			ref WAVEFORMATEX pwfx, waveProc dwCallback,int dwInstance, int fdwOpen);
コード例 #6
0
 private extern static int waveOutOpen(ref IntPtr phwo, int uDeviceID,
                                       ref WAVEFORMATEX pwfx, waveProc dwCallback, int dwInstance, int fdwOpen);