Example #1
0
// stop the capture hardware
// returns 0 for success, -1 for failure
int HAE_StopAudioCapture(void* context) {
    audio_info_t sunAudioHeader;
    INT32 error = -1;

    //fprintf(stderr, ">> HAE_API_SolarisOS_Capture: HAE_StopAudioCapture()\n");
	
    if (g_captureSound) {
	g_captureShutdown = TRUE;

	// stop streaming data
	error = HAE_PauseAudioCapture();

	// wait for thread to complete
	while (g_activeWaveInThread) {
	    HAE_SleepFrameThread(context, 10);
	}
    }

    // $$kk: 04.13.99: should do this regardless of error value??
    if (error == 0) {
	// destroy the audio capture thread
	error = HAE_DestroyFrameThread(NULL);
    }

    //fprintf(stderr, "<< HAE_API_SolarisOS_Capture: HAE_StopAudioCapture() returning %d\n", error);
    return (error == 0) ? 0 : -1;
}
Example #2
0
// stop the capture hardware
int HAE_StopAudioCapture(void* context) {
    MMRESULT	theErr;
    int i;

    TRACE0("> HAE_StopAudioCapture\n");
    if (g_captureSound) {
	    // tell the thread to die
	    // the thread will also reset the device
	    g_captureShutdown = TRUE;

	    // stop streaming data
	    theErr = HAE_PauseAudioCapture();

	    // destroy the audio capture thread. 
    
	    /* $$fb:
	     * this is a dummy operation! It wouldn't even
	     * distinguish between playback thread and capture thread...
	     */
	    HAE_DestroyFrameThread(NULL);

	    //printf("  waiting for thread to complete\n");
	    // wait for thread to complete
	    while (g_activeWaveInThread) {
		HAE_SleepFrameThread(context, 10);
	    }

	    // deallocate the capture data buffers
	    for (i = 0; i < HAE_WAVEIN_NUM_BUFFERS; i++) {
		HAE_Deallocate(g_audioBufferBlock[i]);
	    } // for
	}
    TRACE0("< HAE_StopAudioCapture\n");
    return 0;
}