⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pa_front.c

📁 一个开源的sip源代码
💻 C
📖 第 1 页 / 共 4 页
字号:
PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ){    PaError result = PaUtil_ValidateStreamPointer( stream );#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_SetStreamFinishedCallback called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );    PaUtil_DebugPrint("\tPaStreamFinishedCallback* streamFinishedCallback: 0x%p\n", streamFinishedCallback );#endif    if( result == paNoError )    {        result = PA_STREAM_INTERFACE(stream)->IsStopped( stream );        if( result == 0 )        {            result = paStreamIsNotStopped ;        }        if( result == 1 )        {            PA_STREAM_REP( stream )->streamFinishedCallback = streamFinishedCallback;            result = paNoError;        }    }#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_SetStreamFinishedCallback returned:\n" );    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    return result;}PaError Pa_StartStream( PaStream *stream ){    PaError result = PaUtil_ValidateStreamPointer( stream );#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_StartStream called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( result == paNoError )    {        result = PA_STREAM_INTERFACE(stream)->IsStopped( stream );        if( result == 0 )        {            result = paStreamIsNotStopped ;        }        else if( result == 1 )        {            result = PA_STREAM_INTERFACE(stream)->Start( stream );        }    }#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_StartStream returned:\n" );    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    return result;}PaError Pa_StopStream( PaStream *stream ){    PaError result = PaUtil_ValidateStreamPointer( stream );#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_StopStream called\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( result == paNoError )    {        result = PA_STREAM_INTERFACE(stream)->IsStopped( stream );        if( result == 0 )        {            result = PA_STREAM_INTERFACE(stream)->Stop( stream );        }        else if( result == 1 )        {            result = paStreamIsStopped;        }    }#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_StopStream returned:\n" );    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    return result;}PaError Pa_AbortStream( PaStream *stream ){    PaError result = PaUtil_ValidateStreamPointer( stream );#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_AbortStream called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( result == paNoError )    {        result = PA_STREAM_INTERFACE(stream)->IsStopped( stream );        if( result == 0 )        {            result = PA_STREAM_INTERFACE(stream)->Abort( stream );        }        else if( result == 1 )        {            result = paStreamIsStopped;        }    }#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_AbortStream returned:\n" );    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    return result;}PaError Pa_IsStreamStopped( PaStream *stream ){    PaError result = PaUtil_ValidateStreamPointer( stream );#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_IsStreamStopped called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( result == paNoError )        result = PA_STREAM_INTERFACE(stream)->IsStopped( stream );#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_IsStreamStopped returned:\n" );    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    return result;}PaError Pa_IsStreamActive( PaStream *stream ){    PaError result = PaUtil_ValidateStreamPointer( stream );#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_IsStreamActive called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( result == paNoError )        result = PA_STREAM_INTERFACE(stream)->IsActive( stream );#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_IsStreamActive returned:\n" );    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    return result;}const PaStreamInfo* Pa_GetStreamInfo( PaStream *stream ){    PaError error = PaUtil_ValidateStreamPointer( stream );    const PaStreamInfo *result;#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_GetStreamInfo called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( error != paNoError )    {        result = 0;#ifdef PA_LOG_API_CALLS        PaUtil_DebugPrint("Pa_GetStreamInfo returned:\n" );        PaUtil_DebugPrint("\tconst PaStreamInfo*: 0 [PaError error:%d ( %s )]\n\n", result, error, Pa_GetErrorText( error ) );#endif    }    else    {        result = &PA_STREAM_REP( stream )->streamInfo;#ifdef PA_LOG_API_CALLS        PaUtil_DebugPrint("Pa_GetStreamInfo returned:\n" );        PaUtil_DebugPrint("\tconst PaStreamInfo*: 0x%p:\n", result );        PaUtil_DebugPrint("\t{" );        PaUtil_DebugPrint("\t\tint structVersion: %d\n", result->structVersion );        PaUtil_DebugPrint("\t\tPaTime inputLatency: %f\n", result->inputLatency );        PaUtil_DebugPrint("\t\tPaTime outputLatency: %f\n", result->outputLatency );        PaUtil_DebugPrint("\t\tdouble sampleRate: %f\n", result->sampleRate );        PaUtil_DebugPrint("\t}\n\n" );#endif    }    return result;}PaTime Pa_GetStreamTime( PaStream *stream ){    PaError error = PaUtil_ValidateStreamPointer( stream );    PaTime result;#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_GetStreamTime called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( error != paNoError )    {        result = 0;#ifdef PA_LOG_API_CALLS        PaUtil_DebugPrint("Pa_GetStreamTime returned:\n" );        PaUtil_DebugPrint("\tPaTime: 0 [PaError error:%d ( %s )]\n\n", result, error, Pa_GetErrorText( error ) );#endif    }    else    {        result = PA_STREAM_INTERFACE(stream)->GetTime( stream );#ifdef PA_LOG_API_CALLS        PaUtil_DebugPrint("Pa_GetStreamTime returned:\n" );        PaUtil_DebugPrint("\tPaTime: %g\n\n", result );#endif    }    return result;}double Pa_GetStreamCpuLoad( PaStream* stream ){    PaError error = PaUtil_ValidateStreamPointer( stream );    double result;#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_GetStreamCpuLoad called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( error != paNoError )    {        result = 0.0;#ifdef PA_LOG_API_CALLS        PaUtil_DebugPrint("Pa_GetStreamCpuLoad returned:\n" );        PaUtil_DebugPrint("\tdouble: 0.0 [PaError error: %d ( %s )]\n\n", error, Pa_GetErrorText( error ) );#endif    }    else    {        result = PA_STREAM_INTERFACE(stream)->GetCpuLoad( stream );#ifdef PA_LOG_API_CALLS        PaUtil_DebugPrint("Pa_GetStreamCpuLoad returned:\n" );        PaUtil_DebugPrint("\tdouble: %g\n\n", result );#endif    }    return result;}PaError Pa_ReadStream( PaStream* stream,                       void *buffer,                       unsigned long frames ){    PaError result = PaUtil_ValidateStreamPointer( stream );#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_ReadStream called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( result == paNoError )    {        if( frames == 0 )        {            /* XXX: Should we not allow the implementation to signal any overflow condition? */            result = paNoError;        }        else if( buffer == 0 )        {            result = paBadBufferPtr;        }        else        {            result = PA_STREAM_INTERFACE(stream)->IsStopped( stream );            if( result == 0 )            {                result = PA_STREAM_INTERFACE(stream)->Read( stream, buffer, frames );            }            else if( result == 1 )            {                result = paStreamIsStopped;            }        }    }#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_ReadStream returned:\n" );    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    return result;}PaError Pa_WriteStream( PaStream* stream,                        const void *buffer,                        unsigned long frames ){    PaError result = PaUtil_ValidateStreamPointer( stream );#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_WriteStream called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( result == paNoError )    {        if( frames == 0 )        {            /* XXX: Should we not allow the implementation to signal any underflow condition? */            result = paNoError;        }        else if( buffer == 0 )        {            result = paBadBufferPtr;        }        else        {            result = PA_STREAM_INTERFACE(stream)->IsStopped( stream );            if( result == 0 )            {                result = PA_STREAM_INTERFACE(stream)->Write( stream, buffer, frames );            }            else if( result == 1 )            {                result = paStreamIsStopped;            }          }    }#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_WriteStream returned:\n" );    PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    return result;}signed long Pa_GetStreamReadAvailable( PaStream* stream ){    PaError error = PaUtil_ValidateStreamPointer( stream );    signed long result;#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_GetStreamReadAvailable called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( error != paNoError )    {        result = 0;#ifdef PA_LOG_API_CALLS        PaUtil_DebugPrint("Pa_GetStreamReadAvailable returned:\n" );        PaUtil_DebugPrint("\tunsigned long: 0 [ PaError error: %d ( %s ) ]\n\n", error, Pa_GetErrorText( error ) );#endif    }    else    {        result = PA_STREAM_INTERFACE(stream)->GetReadAvailable( stream );#ifdef PA_LOG_API_CALLS        PaUtil_DebugPrint("Pa_GetStreamReadAvailable returned:\n" );        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    }    return result;}signed long Pa_GetStreamWriteAvailable( PaStream* stream ){    PaError error = PaUtil_ValidateStreamPointer( stream );    signed long result;#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_GetStreamWriteAvailable called:\n" );    PaUtil_DebugPrint("\tPaStream* stream: 0x%p\n", stream );#endif    if( error != paNoError )    {        result = 0;#ifdef PA_LOG_API_CALLS        PaUtil_DebugPrint("Pa_GetStreamWriteAvailable returned:\n" );        PaUtil_DebugPrint("\tunsigned long: 0 [ PaError error: %d ( %s ) ]\n\n", error, Pa_GetErrorText( error ) );#endif    }    else    {        result = PA_STREAM_INTERFACE(stream)->GetWriteAvailable( stream );#ifdef PA_LOG_API_CALLS        PaUtil_DebugPrint("Pa_GetStreamWriteAvailable returned:\n" );        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    }    return result;}PaError Pa_GetSampleSize( PaSampleFormat format ){    int result;#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_GetSampleSize called:\n" );    PaUtil_DebugPrint("\tPaSampleFormat format: %d\n", format );#endif    switch( format & ~paNonInterleaved )    {    case paUInt8:    case paInt8:        result = 1;        break;    case paInt16:        result = 2;        break;    case paInt24:        result = 3;        break;    case paFloat32:    case paInt32:        result = 4;        break;    default:        result = paSampleFormatNotSupported;        break;    }#ifdef PA_LOG_API_CALLS    PaUtil_DebugPrint("Pa_GetSampleSize returned:\n" );    if( result > 0 )        PaUtil_DebugPrint("\tint: %d\n\n", result );    else        PaUtil_DebugPrint("\tPaError: %d ( %s )\n\n", result, Pa_GetErrorText( result ) );#endif    return (PaError) result;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -