Example #1
0
bool CSoundChannel::m_bAbort()
{
	DWORD dwErr = MMSYSERR_NOERROR;

	if(m_hWaveIn != NULL)
		dwErr = waveInReset(m_hWaveIn);
	
	if(m_hWaveOut != NULL)
		dwErr = waveOutReset(m_hWaveOut);

	CWaitAndSignal mutex(m_Mutex);
	for(int i=0; i<m_Buffers.size(); i++)
	{
		while(m_Buffers[i]->m_dwRelease() == WAVERR_STILLPLAYING)
		{
			if(m_hWaveIn != NULL)
				dwErr = waveInReset(m_hWaveIn);
			
			if(m_hWaveOut != NULL)
				dwErr = waveOutReset(m_hWaveOut);
		}
	}
	
	m_iBufByteOffset = 0x7fffffff;
	m_iBufIndex = 0;
	m_iPacket = 1;

	SetEvent(m_hEventDone);

	if(dwErr != MMSYSERR_NOERROR)
		return false;
	else
		return true;
}
Example #2
0
/**
 * win32ai_close()
 * Terminate recording.
 * This function discards all data that has been sampled but not read.
 * Return 0 if happy, -1 if error.
 */
int win32ai_close(void) {
	MMRESULT res;
	int i;

	// stop device
	res = waveInReset(wavein);
	if (checkWaveInResult(wavein, res, "waveInReset"))
		return -1;

	// wait for buffers to finish and unprepare them all
	for (i = 0; i < WaveBuf_N; ++i) {
		while ((whin[i]->dwFlags & WHDR_DONE) == 0) {
			// buffer not ready, wait, try again
			WaitForSingleObject(whinEvent, INFINITE);
		}
		// unprepare the buffer
		res = waveInUnprepareHeader(wavein, whin[i], sizeof(WAVEHDR));
		if (checkWaveInResult(wavein, res, "waveInUnprepareHeader"))
			return -1;
		// free memory
		free(whin[i]->lpData);
		free(whin[i]);
	}

	// close device
	res = waveInClose(wavein);
	if (checkWaveInResult(wavein, res, "waveInClose"))
		return -1;
			
	return 0;
}
Example #3
0
int tdav_producer_waveapi_stop(tmedia_producer_t* self)
{
	tdav_producer_waveapi_t* producer = (tdav_producer_waveapi_t*)self;
	MMRESULT result;

	if(!self){
		TSK_DEBUG_ERROR("Invalid parameter");
		return -1;
	}

	if(!producer->started){
		TSK_DEBUG_WARN("Producer not started");
		return 0;
	}

	/* stop thread */
	if(producer->tid[0]){
		SetEvent(producer->events[1]);
		tsk_thread_join(&(producer->tid[0]));
	}

	/* should be done here */
	producer->started = tsk_false;

	if(producer->hWaveIn && (((result = waveInReset(producer->hWaveIn)) != MMSYSERR_NOERROR) || ((result = waveInClose(producer->hWaveIn)) != MMSYSERR_NOERROR))){
		print_last_error(result, "waveInReset/waveInClose");
	}

	return 0;
}
Example #4
0
static void WinMMCloseCapture(ALCdevice *Device)
{
    WinMMData *data = (WinMMData*)Device->ExtraData;
    void *buffer = NULL;
    int i;

    /* Tell the processing thread to quit and wait for it to do so. */
    data->killNow = AL_TRUE;
    PostThreadMessage(data->thread, WM_QUIT, 0, 0);

    althrd_join(data->thread, &i);

    /* Make sure capture is stopped and all pending buffers are flushed. */
    waveInReset(data->WaveHandle.In);

    // Release the wave buffers
    for(i = 0; i < 4; i++)
    {
        waveInUnprepareHeader(data->WaveHandle.In, &data->WaveBuffer[i], sizeof(WAVEHDR));
        if(i == 0) buffer = data->WaveBuffer[i].lpData;
        data->WaveBuffer[i].lpData = NULL;
    }
    free(buffer);

    DestroyRingBuffer(data->Ring);
    data->Ring = NULL;

    // Close the Wave device
    waveInClose(data->WaveHandle.In);
    data->WaveHandle.In = 0;

    free(data);
    Device->ExtraData = NULL;
}
void RUIAudio::RecordClose()
{
	Stop();
	HWAVEIN hTemp = m_hWaveIn;
	m_hWaveIn = NULL;
	if (hTemp == NULL)
		return;

	RUIBuffer*	pRUIBuffer = m_RecBufferList.GetFirst();
	while (pRUIBuffer != NULL)
	{
		RecRemoveBuffer(pRUIBuffer);

		pRUIBuffer = m_RecBufferList.GetNext(pRUIBuffer);
	}

	if( hTemp == NULL )
		return;

	if (waveInReset(hTemp) != MMSYSERR_NOERROR)
		ASSERT(FALSE);

	if (waveInClose(hTemp) != MMSYSERR_NOERROR)
		ASSERT(FALSE);
}
Example #6
0
BMID_API int BGBMID_SoundDev_RecDeInit()
{
	int i;

	waveInStop(hWaveIn);

	waveInReset(hWaveIn);

	if(lpInWaveHdr)
	{
		for(i=0; i<WAV_BUFFERS; i++)
			waveInUnprepareHeader(hWaveIn, lpInWaveHdr+i, sizeof(WAVEHDR));
	}

	waveInClose(hWaveIn);

	if(hInWaveHdr)
	{
		GlobalUnlock(hInWaveHdr); 
		GlobalFree(hInWaveHdr);
	}

	if(hInData)
	{
		GlobalUnlock(hInData);
		GlobalFree(hInData);
	}

	return(0);
}
Example #7
0
void mmio_close_audio( void)
{
    int errcode;
    int nda, nad;
    if (sys_verbose)
    	post("closing audio...");

    for (nda=0; nda < nt_nwaveout; nda++) /*if (nt_nwaveout) wini */
    {
       errcode = waveOutReset(ntsnd_outdev[nda]);
       if (errcode != MMSYSERR_NOERROR)
	   printf("error resetting output %d: %d\n", nda, errcode);
       errcode = waveOutClose(ntsnd_outdev[nda]);
       if (errcode != MMSYSERR_NOERROR)
	   printf("error closing output %d: %d\n",nda , errcode);	   
    }
    nt_nwaveout = 0;

    for(nad=0; nad < nt_nwavein;nad++) /* if (nt_nwavein) wini */
    {
	errcode = waveInReset(ntsnd_indev[nad]);
	if (errcode != MMSYSERR_NOERROR)
	    printf("error resetting input: %d\n", errcode);
	errcode = waveInClose(ntsnd_indev[nad]);
	if (errcode != MMSYSERR_NOERROR)
	    printf("error closing input: %d\n", errcode);
    }
    nt_nwavein = 0;
}
Example #8
0
//停止录音
BOOL CWaveIn::CloseRecord()
{
    //已经停止录音
    if (!m_bRecord)
    {
        //返回
        return FALSE;
    }

    //录音设备句柄无效
    if(!m_hIn)
    {
        //返回
        return FALSE;
    }

    //重置录音设备,停止录音
    m_mmr = waveInReset(m_hIn);

    //出错
    if (m_mmr)
    {
        //返回
        return FALSE;
    }

    //设置录音停止标记
    m_bRecord = FALSE;

    //返回
    return TRUE;
}
Example #9
0
static void winwave_fini_in (HWVoiceIn *hw)
{
    int i;
    MMRESULT mr;
    WaveVoiceIn *wave = (WaveVoiceIn *) hw;

    mr = waveInReset (wave->hwi);
    if (mr != MMSYSERR_NOERROR) {
        winwave_logerr (mr, "waveInReset");
    }

    for (i = 0; i < conf.adc_headers; ++i) {
        mr = waveInUnprepareHeader (wave->hwi, &wave->hdrs[i],
                                     sizeof (wave->hdrs[i]));
        if (mr != MMSYSERR_NOERROR) {
            winwave_logerr (mr, "waveInUnprepareHeader(%d)", i);
        }
    }

    winwave_anal_close_in (wave);

    if (wave->event) {
        qemu_del_wait_object (wave->event, winwave_poll, wave);
        if (!CloseHandle (wave->event)) {
            dolog ("ADC CloseHandle failed %lx\n", GetLastError ());
        }
        wave->event = NULL;
    }

    g_free (wave->pcm_buf);
    wave->pcm_buf = NULL;

    g_free (wave->hdrs);
    wave->hdrs = NULL;
}
Example #10
0
// stop the capture hardware
int BAE_StopAudioCapture(void)
{
    MMRESULT    theErr;
    int i;

    if (g_captureSound)
    {
        g_captureShutdown = TRUE;

        // stop streaming data
        theErr = BAE_PauseAudioCapture();

        // release all buffers
        theErr = waveInReset(g_captureSound);

        // deallocate the capture data buffers
        // this could really be done in initialiation...?
        // is waveInReset synchronous?  otherwise something bad could happen....
        for (i = 0; i < BAE_WAVEIN_NUM_BUFFERS; i++)                                        
        {         
            BAE_Deallocate(g_audioBufferBlock[i]);
        } // for
    }
    return 0;
}
audioStreamer_waveOut::~audioStreamer_waveOut()
{
   int x;
   if (m_hwo) waveOutReset(m_hwo);
   if (m_hwi) waveInReset(m_hwi);
   for (x = 0; x < m_bufs.GetSize(); x ++)
   {
	   WAVEHDR *p = (WAVEHDR *)m_bufs.Get(x)->Get();
	   if (m_hwi && p)
		   if (p->dwFlags & WHDR_PREPARED) waveInUnprepareHeader(m_hwi,p,sizeof(WAVEHDR));

	   if (m_hwo && p)
     {
		   if (p->dwFlags & WHDR_PREPARED) waveOutUnprepareHeader(m_hwo,p,sizeof(WAVEHDR));
     }
	   delete m_bufs.Get(x);
   }
   m_bufs.Empty();

   if (m_hwo)
   {
	   waveOutClose(m_hwo);
	   m_hwo=0;
   }
   if (m_hwi)
   {
	   waveInClose(m_hwi);
	   m_hwi=0;
   }

}
Example #12
0
static void
winaudio_in_fini (HWVoiceIn *hw)
{
    WinAudioIn*  s = (WinAudioIn*) hw;
    int           i;

    if (s->wavein) {
        waveInReset(s->wavein);
            s->wavein = 0;
    }

    for ( i=0; i<NUM_OUT_BUFFERS; ++i ) {
        if ( s->buffers[i].dwUser != 0xFFFF ) {
            waveInUnprepareHeader(
                s->wavein, &s->buffers[i], sizeof(s->buffers[i]) );
                s->buffers[i].dwUser = 0xFFFF;
        }
    }

    if (s->buffer_bytes != NULL) {
        qemu_free(s->buffer_bytes);
        s->buffer_bytes = NULL;
    }

    if (s->wavein) {
        waveInClose(s->wavein);
        s->wavein = NULL;
    }
}
Example #13
0
static void ALCwinmmCapture_Destruct(ALCwinmmCapture *self)
{
    void *buffer = NULL;
    int i;

    /* Tell the processing thread to quit and wait for it to do so. */
    if(!ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel))
    {
        PostThreadMessage(self->thread, WM_QUIT, 0, 0);

        althrd_join(self->thread, &i);

        /* Make sure capture is stopped and all pending buffers are flushed. */
        waveInReset(self->InHdl);

        // Release the wave buffers
        for(i = 0;i < 4;i++)
        {
            waveInUnprepareHeader(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR));
            if(i == 0) buffer = self->WaveBuffer[i].lpData;
            self->WaveBuffer[i].lpData = NULL;
        }
        free(buffer);
    }

    ll_ringbuffer_free(self->Ring);
    self->Ring = NULL;

    // Close the Wave device
    if(self->InHdl)
        waveInClose(self->InHdl);
    self->InHdl = 0;

    ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
}
Example #14
0
/*
 * Class:     com_ibm_media_protocol_device_DataSource
 * Method:    disconnectDevice
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_com_ibm_media_protocol_device_DataSource_disconnectDevice
(JNIEnv* env, jobject obj) {

	MMRESULT result;

	/* first mark all pending buffers as done */
	result = waveInReset(hwi); 
	
	/* DEBUG */
	if (result == MMSYSERR_NOERROR)
		printf("Device reset\n");
	else
		printf("ERROR reseting device !\n");
	/* end DEBUG */

	result = waveInClose(hwi);

	/* DEBUG */
	if (result == MMSYSERR_NOERROR)
		printf("Device closed\n");
	else
		printf("ERROR closing device !\n");
	/* end DEBUG */

}
Example #15
0
int32
ad_stop_rec(ad_rec_t * r)
{
    int32 i, st;

    if ((!r->opened) || (!r->recording))
        return -1;

    if (waveInStop(r->h_wavein) != 0)
        return AD_ERR_WAVE;

    if ((st = waveInReset(r->h_wavein)) != 0) {
        wavein_error("waveInReset", st);
        return AD_ERR_WAVE;
    }

    /* Wait until all buffers marked done */
    for (i = 0; i < r->n_buf; i++)
        while (!(r->wi_buf[i].p_whdr->dwFlags & WHDR_DONE));

    if ((r->lastbuf = r->curbuf - 1) < 0)
        r->lastbuf = r->n_buf - 1;

    r->recording = 0;

    return 0;
}
Example #16
0
void WaveInStart(WaveIn *waveIn, BOOL prep)
{
    MMRESULT res;

    res = waveInReset(waveIn->handler);
    if(res) {
        return;
    }

    // prepare header an add the buffer
    waveIn->header.lpData = (char *) waveIn->data;
    waveIn->header.dwBufferLength = waveIn->n * 2;
    waveIn->header.dwBytesRecorded = 0;
    waveIn->header.dwFlags = 0L;
    waveIn->header.dwLoops = 0L;
    waveIn->header.dwUser = 0L;
    waveInPrepareHeader(waveIn->handler, &waveIn->header, sizeof(WAVEHDR));

    res = waveInAddBuffer(waveIn->handler, &waveIn->header, sizeof(WAVEHDR));
    if(res) {
        return;
    }

    res = waveInStart(waveIn->handler);
    if(res) {
        return;
    }
}
Example #17
0
int audio_close(snd_type snd)
{
    int i;
    MMRESULT er;
    buffer_state *bs = (buffer_state *) snd->u.audio.descriptor;
    if (snd->write_flag == SND_READ) {
        if (er = waveInReset(bs->u.h_in)) {
            mm_error_handler(snd, er, snd_fail);
            return !SND_SUCCESS;
        }
        if (er = waveInClose(bs->u.h_in)) {
            mm_error_handler(snd, er, snd_fail);
            return !SND_SUCCESS;
        }
    } else { // SND_WRITE
        if (er = waveOutReset(bs->u.h_out)) {
            mm_error_handler(snd, er, snd_fail);
            return !SND_SUCCESS;
        }
        if (er = waveOutClose(bs->u.h_out)) {
            mm_error_handler(snd, er, snd_fail);
            return !SND_SUCCESS;
        }
    }
    for (i = 0; i < bs->numofbuffers; i++) {
        snd_free(bs->whdr[i].lpData);
    }
    snd_free(bs->whdr);
    snd_free(bs);
    if (rt_devices_open) {
        timeEndPeriod(1);
        rt_devices_open--;
    }
    return SND_SUCCESS;
}
Example #18
0
bool CSoundChannel::m_bCloseAudio()
{
	if(m_bClose)
		return m_bClose;
	
	m_bAbort();

	if(m_hWaveOut != NULL)
	{
		while(waveOutClose(m_hWaveOut) == WAVERR_STILLPLAYING)	//关闭WAVEOUT设备
			waveOutReset(m_hWaveOut);
		m_hWaveOut = NULL;
	}

	if(m_hWaveIn != NULL)
	{
		while(waveInClose(m_hWaveIn) == WAVERR_STILLPLAYING)	//关闭WAVEIN设备
			waveInReset(m_hWaveIn);
		m_hWaveIn = NULL;
	}

	m_bAbort();

	m_uOldHandle = -1;
	m_bClose = true;
	return true;
}
Example #19
0
void CAudio2Dlg::OnRecStop() 
{bEnding=TRUE;

	waveInReset(hWaveIn);
	
	
}
Example #20
0
CAudio::~CAudio()
{
	if (m_bIsWaveInUsed)
	{
		waveInStop(m_hWaveIn);
		waveInReset(m_hWaveIn);
		for (int i = 0; i < 2; i++)
			waveInUnprepareHeader(m_hWaveIn, m_lpInAudioHdr[i], sizeof(WAVEHDR));
		waveInClose(m_hWaveIn);
		TerminateThread(m_hThreadCallBack, -1);
	}

	if (m_bIsWaveOutUsed)
	{
		waveOutReset(m_hWaveOut);
		for (int i = 0; i < 2; i++)
			waveOutUnprepareHeader(m_hWaveOut, m_lpInAudioHdr[i], sizeof(WAVEHDR));
		waveOutClose(m_hWaveOut);
	}		


	for (int i = 0; i < 2; i++)
	{
		delete [] m_lpInAudioData[i];
		delete m_lpInAudioHdr[i];
		
		delete [] m_lpOutAudioData[i];
		delete m_lpOutAudioHdr[i];
	}

	CloseHandle(m_hEventWaveIn);
	CloseHandle(m_hStartRecord);
	CloseHandle(m_hThreadCallBack);
}
Example #21
0
//分配内存
BOOL CWaveIn::PerPareBuffer()
{
    //已经分配内存
    if (m_bAllocBuffer)
    {
        //返回
        return FALSE;
    }

    //重置录音设备
    m_mmr = waveInReset(m_hIn);
    //出错
    if (m_mmr)
    {
        //返回
        return FALSE;
    }

    //循环变量
    UINT i;
    //新建WAVEHDR结构
    m_pHdr = new WAVEHDR[NUM_BUF];

    for (i = 0; i < NUM_BUF; i++)
    {
        //初始化
        ZeroMemory(&m_pHdr[i], sizeof(WAVEHDR));
        //波形缓存
        m_pHdr[i].lpData = new char[SIZE_AUDIO_FRAME];
        //缓存大小
        m_pHdr[i].dwBufferLength = SIZE_AUDIO_FRAME;
        m_pHdr[i].dwFlags = WHDR_BEGINLOOP | WHDR_ENDLOOP;
        m_pHdr[i].dwLoops = 1;

        //准备缓存
        m_mmr = waveInPrepareHeader(m_hIn, &m_pHdr[i], sizeof(WAVEHDR));
        //出错
        if (m_mmr)
        {
            //返回
            return FALSE;
        }

        //添加缓存到录音设备
        m_mmr = waveInAddBuffer(m_hIn, &m_pHdr[i], sizeof(WAVEHDR));
        //出错
        if (m_mmr)
        {
            //返回
            return FALSE;
        }
    }

    //设置内存分配标记
    m_bAllocBuffer = TRUE;

    //返回
    return TRUE;
}
void QAudioInputPrivate::suspend()
{
    if(deviceState == QAudio::ActiveState) {
        waveInReset(hWaveIn);
        deviceState = QAudio::SuspendedState;
        emit stateChanged(deviceState);
    }
}
void ph_media_stop(phcall_t *ca)
{
  phmstream_t *stream = (phmstream_t *) ca->phstream;


  ca->hasaudio = 0;
  ca->phstream = 0;

  stream->running = 0;

  osip_thread_join(stream->audio_in_thread);
  osip_thread_join(stream->audio_out_thread);
  osip_free(stream->audio_in_thread);
  osip_free(stream->audio_out_thread);

  
  rtp_session_signal_disconnect_by_callback(stream->rtp_session, "telephone-event",
					    (RtpCallback)ph_telephone_event);
  ortp_set_debug_file("oRTP", stdout);
  ortp_global_stats_display();
  ortp_set_debug_file("oRTP", NULL);
  rtp_session_destroy(stream->rtp_session);

#if USE_CODECS
  if (stream->codec->encoder_cleanup)
	  stream->codec->encoder_cleanup(stream->encoder_ctx);
  if (stream->codec->decoder_cleanup)
	  stream->codec->decoder_cleanup(stream->decoder_ctx);
#endif /* !USE_CODECS */

  waveInReset(stream->hWaveIn);
  waveInClose(stream->hWaveIn);
  waveOutReset(stream->hWaveOut);
  waveOutClose(stream->hWaveOut);

#if DO_ECHO_CAN
   printf("\nbytes echoed %d %d\n", stream->sent_cnt, stream->recv_cnt);

  free(stream->pcm_sent);

# if !AEC_BIS
  if(stream->ec)
    echo_can_free(stream->ec);
# else /* AEC_BIS */
  kill_AEC();
# endif /* AEC_BIS */

  g_mutex_free(stream->synclock);
  g_cond_free(stream->sync_cond);
  g_mutex_free(stream->aec_mutex);


#endif /* !DO_ECHO_CAN */

  g_mutex_free(stream->dtmfg_lock);

  osip_free(stream);
}
Example #24
0
/*
 * Destroy stream.
 */
PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream)
{
    unsigned i;

    PJ_ASSERT_RETURN(stream != NULL, PJ_EINVAL);

    pjmedia_snd_stream_stop(stream);

    if (stream->thread)
    {
	SetEvent(stream->thread_quit_event);
	pj_thread_join(stream->thread);
	pj_thread_destroy(stream->thread);
	stream->thread = NULL;
    }

    /* Unprepare the headers and close the play device */
    if (stream->play_strm.hWave.Out)
    {
	waveOutReset(stream->play_strm.hWave.Out);
	for (i = 0; i < stream->play_strm.dwMaxBufIdx; ++i)
	    waveOutUnprepareHeader(stream->play_strm.hWave.Out, 
				   &(stream->play_strm.WaveHdr[i]),
				   sizeof(WAVEHDR));
	waveOutClose(stream->play_strm.hWave.Out);
	stream->play_strm.hWave.Out = NULL;
    }

    /* Close the play event */
    if (stream->play_strm.hEvent)
    {
	CloseHandle(stream->play_strm.hEvent);
	stream->play_strm.hEvent = NULL;
    }

    /* Unprepare the headers and close the record device */
    if (stream->rec_strm.hWave.In)
    {
	waveInReset(stream->rec_strm.hWave.In);
	for (i = 0; i < stream->play_strm.dwMaxBufIdx; ++i)
	    waveInUnprepareHeader(stream->rec_strm.hWave.In, 
				  &(stream->rec_strm.WaveHdr[i]),
				  sizeof(WAVEHDR));
	waveInClose(stream->rec_strm.hWave.In);
	stream->rec_strm.hWave.In = NULL;
    }

    /* Close the record event */
    if (stream->rec_strm.hEvent)
    {
	CloseHandle(stream->rec_strm.hEvent);
	stream->rec_strm.hEvent = NULL;
    }

    pj_pool_release(stream->pool);

    return PJ_SUCCESS;
}
Example #25
0
void CAudioCollect::Stop()
{
	bStart = false;
	bReset = true;
	waveOutReset(m_hWaveOut);
	waveOutClose(m_hWaveOut);
	waveInReset(m_hWaveIn);
	waveInClose(m_hWaveIn);
}
Example #26
0
void HAE_FlushAudioCapture() {
    TRACE0("> HAE_FlushAudioCapture\n");
    if (g_captureSound) {
	g_flushMode = FLUSHMODE_FLUSHING;
	/* flush will cease activity, and mark all buffers as done */
	waveInReset(g_captureSound);
	g_flushMode = FLUSHMODE_FLUSHED;
    }
}
void stop_sound(void)
{ if (sound_recording)
  { sound_recording = 0;
    error_code = waveInReset(hwavein);
    if( error_code != MMSYSERR_NOERROR)
      errormsg("Unable to stop sound recording.",error_code);
    stop_encoder();
  }
  SetDlgItemText(hMainDialog,IDC_LISTEN_INDICATOR,"");
  meter_off();
}
Example #28
0
BOOL Mic_DeInit_Physical()
{
	if(!Mic_Inited)
		return TRUE;

	INFO("win32 microphone DEinit OK\n");

	Mic_Inited = FALSE;

	waveInReset(waveIn);
	waveInClose(waveIn);

	return TRUE;
}
Example #29
0
bool UBWaveRecorder::close()
{
    if (waveInReset(mWaveInDevice) != MMSYSERR_NOERROR)
    {
        setLastErrorMessage("Cannot reset wave in device ");
        return false;
    }

    foreach(WAVEHDR* buffer, mWaveBuffers)
    {
        waveInUnprepareHeader(mWaveInDevice, buffer, sizeof(WAVEHDR));
        delete [] buffer->lpData;
        delete buffer;
    }
Example #30
0
File: wave.cpp Project: bugou/test
void WaveIn::close()
{
	waveInReset(hWaveIn);
	
	while (!waveHeaders.IsEmpty()) {
		LPWAVEHDR pwh = (LPWAVEHDR) waveHeaders.RemoveHead();
		waveInUnprepareHeader(hWaveIn, pwh, sizeof(WAVEHDR));
		delete []pwh->lpData;
		delete pwh;
	}

	waveInClose(hWaveIn);
	hWaveIn = NULL;
}