亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? pa_unix.c

?? 一個(gè)任天堂掌上游戲機(jī)NDS的源代碼
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/*
 * PortAudio Portable Real-Time Audio Library
 * Latest Version at: http://www.portaudio.com
 * Linux OSS Implementation by douglas repetto and Phil Burk
 *
 * Copyright (c) 1999-2000 Phil Burk
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files
 * (the "Software"), to deal in the Software without restriction,
 * including without limitation the rights to use, copy, modify, merge,
 * publish, distribute, sublicense, and/or sell copies of the Software,
 * and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * Any person wishing to distribute modifications to the Software is
 * requested to send the modifications to the original developer so that
 * they can be incorporated into the canonical version.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */

/*
Modification History
  1/2001 - Phil Burk - initial hack for Linux
  2/2001 - Douglas Repetto - many improvements, initial query support
  4/2/2001 - Phil - stop/abort thread control, separate in/out native buffers
  5/28/2001 - Phil - use pthread_create() instead of clone(). Thanks Stephen Brandon!
       use pthread_join() after thread shutdown.
  5/29/2001 - Phil - query for multiple devices, multiple formats,
                     input mode and input+output mode working,
       Pa_GetCPULoad() implemented.
  PLB20010817 - Phil & Janos Haber - don't halt if test of sample rate fails.
  SB20010904 - Stephen Brandon - mods needed for GNUSTEP and SndKit
  JH20010905 - Janos Haber - FreeBSD mods
  2001-09-22 - Heiko - (i.e. Heiko Purnhagen <purnhage@tnt.uni-hannover.de> ;-)
                       added 24k and 16k to ratesToTry[]
         fixed Pa_GetInternalDevice()
         changed DEVICE_NAME_BASE from /dev/audio to /dev/dsp
         handled SNDCTL_DSP_SPEED in Pq_QueryDevice() more graceful
         fixed Pa_StreamTime() for paqa_errs.c
         fixed numCannel=2 oddity and error handling in Pa_SetupDeviceFormat()
         grep also for HP20010922 ...
  PLB20010924 - Phil - merged Heiko's changes
                       removed sNumDevices and potential related bugs,
         use getenv("PA_MIN_LATENCY_MSEC") to set desired latency,
         simplify CPU Load calculation by comparing real-time to framesPerBuffer,
         always close device when querying even if error occurs,
  PLB20010927 - Phil - Improved negotiation for numChannels.
  SG20011005 - Stewart Greenhill - set numChannels back to reasonable value after query.
  DH20010115 - David Herring - fixed uninitialized handle.

  DM20020218 - Dominic Mazzoni - Try to open in nonblocking mode first, in case
                                 the device is already open.  New implementation of
                                 Pa_StreamTime that uses SNDCTL_DSP_GETOPTR but
                                 uses our own counter to avoid wraparound.
  PLB20020222 - Phil Burk - Added WatchDog proc if audio running at high priority.
                      Check error return from read() and write().
                      Check CPU endianness instead of assuming Little Endian.
  20020621 - pa_unix_oss.c split into pa_unix.c, pa_unix.h, pa_unix_oss.c by
         Augustus Saunders. Return values from usleep() ignored by Sam Bayer
         because not cross-platform compatible (at least until we get configure
         going). Pa_SetupDeviceFormat split into input and output sides to
         reflect capabilities of Solaris.

  20030206 - Martin Rohrbach - various mods for Solaris
  
  20030410 - Bjorn Dittmer-Roche - fixed numerous problems associated with pthread_t
  
  20030630 - Thomas Richter - eliminated unused variable warnings.

TODO
O- put semaphore lock around shared data?
O- handle native formats better
O- handle stereo-only device better ???
O- what if input and output of a device capabilities differ (e.g. es1371) ???
*/


#include "pa_unix.h"

typedef void *(*pthread_function_t)(void *);

/************************************************* Shared Data ********/
/* FIXME - put Mutex around this shared data. */
static internalPortAudioDevice *sDeviceList = NULL;
static int sDefaultInputDeviceID = paNoDevice;
static int sDefaultOutputDeviceID = paNoDevice;
static int sPaHostError = 0;

/********************************* BEGIN CPU UTILIZATION MEASUREMENT ****/
static void Pa_StartUsageCalculation( internalPortAudioStream   *past )
{
    PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData;
    if( pahsc == NULL ) return;
    /* Query system timer for usage analysis and to prevent overuse of CPU. */
    gettimeofday( &pahsc->pahsc_EntryTime, NULL );
}

static long SubtractTime_AminusB( struct timeval *timeA, struct timeval *timeB )
{
    long secs = timeA->tv_sec - timeB->tv_sec;
    long usecs = secs * 1000000;
    usecs += (timeA->tv_usec - timeB->tv_usec);
    return usecs;
}

/******************************************************************************
** Measure fractional CPU load based on real-time it took to calculate
** buffers worth of output.
*/
static void Pa_EndUsageCalculation( internalPortAudioStream   *past )
{
    struct timeval currentTime;
    long  usecsElapsed;
    double newUsage;

#define LOWPASS_COEFFICIENT_0   (0.95)
#define LOWPASS_COEFFICIENT_1   (0.99999 - LOWPASS_COEFFICIENT_0)

    PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData;
    if( pahsc == NULL ) return;

    if( gettimeofday( &currentTime, NULL ) == 0 )
    {
        usecsElapsed = SubtractTime_AminusB( &currentTime, &pahsc->pahsc_EntryTime );
        /* Use inverse because it is faster than the divide. */
        newUsage =  usecsElapsed * pahsc->pahsc_InverseMicrosPerBuffer;

        past->past_Usage = (LOWPASS_COEFFICIENT_0 * past->past_Usage) +
                           (LOWPASS_COEFFICIENT_1 * newUsage);

    }
}
/****************************************** END CPU UTILIZATION *******/

/*********************************************************************
 * Determines the number of available devices by trying to open
 * each "/dev/dsp#" or "/dsp/audio#" in order until it fails.
 * Add each working device to a singly linked list of devices.
 */
PaError Pa_QueryDevices( void )
{
    internalPortAudioDevice *pad, *lastPad;
    int      go = 1;
    int      numDevices = 0;
    PaError  testResult;
    PaError  result = paNoError;
    char     *envdev;

    sDefaultInputDeviceID = paNoDevice;
    sDefaultOutputDeviceID = paNoDevice;

    lastPad = NULL;

    while( go )
    {
        /* Allocate structure to hold device info. */
        pad = (internalPortAudioDevice *)
              PaHost_AllocateFastMemory( sizeof(internalPortAudioDevice) );
        if( pad == NULL ) return paInsufficientMemory;
        memset( pad, 0, sizeof(internalPortAudioDevice) );

        /* Build name for device. */
        if( numDevices == 0 )
        {
            sprintf( pad->pad_DeviceName, DEVICE_NAME_BASE);
        }
        else
        {
            sprintf( pad->pad_DeviceName, DEVICE_NAME_BASE "%d", numDevices );
        }

        DBUG(("Try device %s\n", pad->pad_DeviceName ));
        testResult = Pa_QueryDevice( pad->pad_DeviceName, pad );
        DBUG(("Pa_QueryDevice returned %d\n", testResult ));
        if( testResult != paNoError )
        {
            if( lastPad == NULL )
            {
                result = testResult; /* No good devices! */
            }
            go = 0;
            PaHost_FreeFastMemory( pad, sizeof(internalPortAudioDevice) );
        }
        else
        {
            numDevices += 1;
            /* Add to linked list of devices. */
            if( lastPad )
            {
                lastPad->pad_Next = pad;
            }
            else
            {
                sDeviceList = pad; /* First element in linked list. */
            }
            lastPad = pad;
        }
    }

    /* I'm sitting at a SunRay1 and I neither have /dev/audio# nor /dev/dsp#.
       Instead, the correct audio device is stored in the environment variable
       AUDIODEV and/or UTAUDIODEV, so check these devices as well if we haven't
       checked them yet above  - MR */

    DBUG(("Checking for AUDIODEV and UTAUDIODEV\n"));
    envdev = getenv("AUDIODEV");
    if (envdev != NULL && !strstr(envdev, DEVICE_NAME_BASE)) {
        result = paNoError;

        /* Allocate structure to hold device info. */
        pad = (internalPortAudioDevice *)
              PaHost_AllocateFastMemory( sizeof(internalPortAudioDevice) );
        if( pad == NULL ) return paInsufficientMemory;
        memset( pad, 0, sizeof(internalPortAudioDevice) );

        /* Build name for device. */
        strcpy(pad->pad_DeviceName, envdev);

        DBUG(("Try device %s\n", pad->pad_DeviceName ));
        testResult = Pa_QueryDevice( pad->pad_DeviceName, pad );
        DBUG(("Pa_QueryDevice returned %d\n", testResult ));
        if( testResult != paNoError )
        {
            if( lastPad == NULL )
            {
                result = testResult; /* No good devices! */
            }
            PaHost_FreeFastMemory( pad, sizeof(internalPortAudioDevice) );
        }
        else
        {
            numDevices += 1;
            /* Add to linked list of devices. */
            if( lastPad )
            {
                lastPad->pad_Next = pad;
            }
            else
            {
                sDeviceList = pad; /* First element in linked list. */
            }
            lastPad = pad;
        }
    }

    envdev = getenv("UTAUDIODEV");
    if (envdev != NULL && !strstr(envdev, DEVICE_NAME_BASE) && getenv("AUDIODEV") != NULL && strcmp(envdev, getenv("AUDIODEV"))) {
        result = paNoError;

        /* Allocate structure to hold device info. */
        pad = (internalPortAudioDevice *)
              PaHost_AllocateFastMemory( sizeof(internalPortAudioDevice) );
        if( pad == NULL ) return paInsufficientMemory;
        memset( pad, 0, sizeof(internalPortAudioDevice) );

        /* Build name for device. */
        strcpy(pad->pad_DeviceName, envdev);

        DBUG(("Try device %s\n", pad->pad_DeviceName ));
        testResult = Pa_QueryDevice( pad->pad_DeviceName, pad );
        DBUG(("Pa_QueryDevice returned %d\n", testResult ));
        if( testResult != paNoError )
        {
            if( lastPad == NULL )
            {
                result = testResult; /* No good devices! */
            }
            PaHost_FreeFastMemory( pad, sizeof(internalPortAudioDevice) );
        }
        else
        {
            numDevices += 1;
            /* Add to linked list of devices. */
            if( lastPad )
            {
                lastPad->pad_Next = pad;
            }
            else
            {
                sDeviceList = pad; /* First element in linked list. */
            }
            lastPad = pad;
        }
    }

    return result;
}

/*************************************************************************/
int Pa_CountDevices()
{
    int numDevices = 0;
    internalPortAudioDevice *pad;

    if( sDeviceList == NULL ) Pa_Initialize();
    /* Count devices in list. */
    pad = sDeviceList;
    while( pad != NULL )
    {
        pad = pad->pad_Next;
        numDevices++;
    }

    return numDevices;
}

/*************************************************************************/
internalPortAudioDevice *Pa_GetInternalDevice( PaDeviceID id )
{
    internalPortAudioDevice *pad;
    if( (id < 0) || ( id >= Pa_CountDevices()) ) return NULL;
    pad = sDeviceList;
    while( id > 0 )
    {
        pad = pad->pad_Next;
        id--;
    }
    return pad;
}

/*************************************************************************/
const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceID id )
{
    internalPortAudioDevice *pad;
    if( (id < 0) || ( id >= Pa_CountDevices()) ) return NULL;
    pad = Pa_GetInternalDevice( id );
    return  &pad->pad_Info ;
}

static PaError Pa_MaybeQueryDevices( void )
{
    if( sDeviceList == NULL )
    {
        return Pa_QueryDevices();
    }
    return 0;
}

PaDeviceID Pa_GetDefaultInputDeviceID( void )
{
    /* return paNoDevice; */
    return 0;
}

PaDeviceID Pa_GetDefaultOutputDeviceID( void )
{
    return 0;
}

/**********************************************************************
** Make sure that we have queried the device capabilities.
*/

PaError PaHost_Init( void )
{
    return Pa_MaybeQueryDevices();
}

/*******************************************************************************************
 * The ol' Canary in a Coal Mine trick.
 * Just update the time periodically.
 * Runs at low priority so if audio thread runs wild, this thread will get starved
 * and the watchdog will detect it.

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品国产第一综合99久久 | 67194成人在线观看| av男人天堂一区| 成人午夜又粗又硬又大| 国产精品一区二区果冻传媒| 狠狠色丁香婷婷综合| 久久www免费人成看片高清| 亚洲h动漫在线| 午夜欧美电影在线观看| 日韩国产欧美在线视频| 日韩av一区二区三区四区| 蜜臀av性久久久久蜜臀aⅴ四虎| 麻豆91在线看| 国产成人综合在线观看| 国产69精品久久99不卡| 成人一道本在线| 97aⅴ精品视频一二三区| 色婷婷精品久久二区二区蜜臀av| 一本色道久久加勒比精品| 亚洲高清三级视频| 国产精品一卡二| 国产露脸91国语对白| 国产精品久久久久7777按摩| 久久久综合精品| 日韩一级黄色大片| 久久亚洲一级片| 亚洲妇女屁股眼交7| 国产精品66部| 在线综合+亚洲+欧美中文字幕| 国产婷婷色一区二区三区四区| 亚洲国产美国国产综合一区二区| 国产一区91精品张津瑜| 欧美日韩在线三级| 欧美国产乱子伦| 免费成人在线视频观看| 日本韩国欧美国产| 中文字幕精品一区二区精品绿巨人 | 中文字幕在线观看不卡视频| 日本不卡一区二区三区高清视频| 99综合影院在线| 久久久精品影视| 日韩专区一卡二卡| www成人在线观看| 日韩欧美一级片| 国产日韩欧美综合一区| 视频一区二区中文字幕| 欧洲人成人精品| 亚洲欧美综合色| 国产一区二区三区美女| 欧美一区二区三区免费| 亚洲国产一区二区三区青草影视| www.欧美.com| 国产精品每日更新在线播放网址 | 欧美成人猛片aaaaaaa| 亚洲va欧美va国产va天堂影院| proumb性欧美在线观看| 国产嫩草影院久久久久| 国产精品一区二区免费不卡| 精品国产乱码久久久久久图片| 日韩成人精品在线观看| 欧美美女直播网站| 亚洲成人三级小说| 在线观看亚洲精品视频| 亚洲伊人色欲综合网| 在线免费亚洲电影| 一区二区三区在线影院| 欧美在线综合视频| 一区二区三区四区高清精品免费观看 | 欧美日韩美女一区二区| 一区二区久久久久| 91国产精品成人| 亚洲国产精品综合小说图片区| 91久久一区二区| 亚洲自拍偷拍欧美| 欧美亚洲综合网| 视频一区视频二区中文| 777亚洲妇女| 精品一区二区三区免费| 26uuuu精品一区二区| 国产高清在线精品| 国产精品动漫网站| 色婷婷激情久久| 亚洲va欧美va人人爽| 日韩午夜激情免费电影| 国产在线播放一区| 国产精品每日更新在线播放网址| 99精品久久免费看蜜臀剧情介绍 | 欧美综合亚洲图片综合区| 亚洲午夜国产一区99re久久| 欧美日韩久久一区| 久久精品久久综合| 中文字幕欧美日本乱码一线二线| 成人av午夜影院| 亚洲最大成人综合| 日韩三级伦理片妻子的秘密按摩| 国内精品写真在线观看| 中文字幕亚洲区| 欧美日韩精品一区二区| 久久精品国产77777蜜臀| 欧美激情在线免费观看| 一本色道**综合亚洲精品蜜桃冫 | 日韩欧美色电影| 国产91精品入口| 一区二区三区四区蜜桃| 日韩一区二区中文字幕| 成人黄色av网站在线| 亚洲一线二线三线久久久| 日韩亚洲国产中文字幕欧美| 高清国产午夜精品久久久久久| 亚洲精品一卡二卡| 日韩午夜激情av| 99久久免费精品高清特色大片| 亚洲成av人**亚洲成av**| 精品久久久久久久人人人人传媒| 99这里只有精品| 日本vs亚洲vs韩国一区三区二区| 欧美国产一区二区| 欧美性videosxxxxx| 精品一区二区三区免费毛片爱| 亚洲色图色小说| 日韩一级视频免费观看在线| 91亚洲精华国产精华精华液| 美女视频免费一区| 亚洲日穴在线视频| 精品国产乱码久久久久久免费| 色婷婷av一区二区三区软件| 免费精品视频最新在线| 亚洲欧美日韩国产一区二区三区 | 精品一区二区三区视频| 亚洲精品一二三| 国产性色一区二区| 欧美巨大另类极品videosbest| 国产·精品毛片| 青草av.久久免费一区| 亚洲欧洲美洲综合色网| 91麻豆精品国产91久久久久久 | 亚洲色图在线播放| 久久久精品国产免费观看同学| 欧美午夜片在线观看| 丁香啪啪综合成人亚洲小说| 蜜臀久久久久久久| 亚洲日本韩国一区| 中文字幕av资源一区| 日韩一区二区三区三四区视频在线观看| 成人国产精品视频| 韩国女主播成人在线| 婷婷六月综合亚洲| 亚洲综合免费观看高清完整版在线| 国产视频一区在线播放| 制服丝袜av成人在线看| 在线观看av一区二区| www.欧美色图| 国产麻豆成人精品| 另类小说综合欧美亚洲| 亚洲国产精品久久久男人的天堂| 亚洲欧美在线另类| 亚洲午夜激情网页| 中文字幕一区免费在线观看| 久久综合狠狠综合久久综合88| 欧美日韩国产片| 色偷偷久久一区二区三区| 国产福利一区二区三区视频在线| 日本成人在线电影网| 亚洲一区二区3| 亚洲三级在线播放| 中文字幕免费不卡| 欧美韩国一区二区| 国产人成亚洲第一网站在线播放| 精品奇米国产一区二区三区| 91精品国产91久久综合桃花| 欧美日韩免费视频| 欧美视频完全免费看| 一本久久综合亚洲鲁鲁五月天| 99re热这里只有精品视频| 播五月开心婷婷综合| 丁香六月综合激情| 国产.欧美.日韩| 国产伦精品一区二区三区在线观看| 免费观看30秒视频久久| 日本美女一区二区| 日本欧美韩国一区三区| 视频在线观看一区| 蜜桃免费网站一区二区三区| 麻豆精品一区二区| 黑人巨大精品欧美一区| 国产一区二区福利| 国产91丝袜在线播放九色| 成人免费电影视频| 91美女视频网站| 色婷婷精品久久二区二区蜜臀av| 日本伦理一区二区| 欧美唯美清纯偷拍| 欧美日韩成人在线| 日韩美一区二区三区| 26uuu国产日韩综合| 国产网红主播福利一区二区| 欧美国产成人精品| 亚洲色图在线视频| 午夜私人影院久久久久| 久久99国产精品麻豆|