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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pa_mac.c

?? Audacity是一款用於錄音和編輯聲音的、免費的開放源碼軟體。它可以執行於Mac OS X、Microsoft Windows、GNU/Linux和其它作業系統
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* * $Id: pa_mac.c,v 1.7 2003/03/02 08:01:36 dmazzoni Exp $ * Portable Audio I/O Library for Macintosh * * Based on the Open Source API proposed by Ross Bencina * Copyright (c) 1999-2000 Phil Burk * * Special thanks to Chris Rolfe for his many helpful suggestions, bug fixes, * and code contributions. * Thanks also to Tue Haste Andersen, Alberto Ricci, Nico Wald, * Roelf Toxopeus and Tom Erbe for testing the code and making * numerous suggestions. * * 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   PLB20010415 - ScanInputDevices was setting sDefaultOutputDeviceID instead of sDefaultInputDeviceID   PLB20010415 - Device Scan was crashing for anything other than siBadSoundInDevice, but some Macs may return other errors!   PLB20010420 - Fix TIMEOUT in record mode.   PLB20010420 - Change CARBON_COMPATIBLE to TARGET_API_MAC_CARBON   PLB20010907 - Pass unused event to WaitNextEvent to prevent Mac OSX crash. Thanks Dominic Mazzoni.   PLB20010908 - Use requested number of input channels. Thanks Dominic Mazzoni.   PLB20011009 - Use NewSndCallBackUPP() for CARBON   PLB20020417 - I used to call Pa_GetMinNumBuffers() which doesn't take into account the                 variable minFramesPerHostBuffer. Now I call PaMac_GetMinNumBuffers() which will                 give lower latency when virtual memory is turned off.                 Thanks Kristoffer Jensen and Georgios Marentakis for spotting this bug.   PLB20020423 - Use new method to calculate CPU load similar to other ports. Based on num frames calculated.                 Fixed Pa_StreamTime(). Now estimates how many frames have played based on MicroSecond timer.                 Added PA_MAX_USAGE_ALLOWED to prevent Mac from hanging when CPU load approaches 100%.   PLB20020424 - Fixed return value in Pa_StreamTime   PLB20020612 - Fix allocation error on Mac 8600 by casting *nameH as uchar* so that we get a proper Str255 length.*//*COMPATIBILITYThis Macintosh implementation is designed for use with Mac OS 7, 8 and9 on PowerMacs, and OS X if compiled with CARBON OUTPUTA circular array of CmpSoundHeaders is used as a queue. For low latency situationsthere will only be two small buffers used. For higher latency, more and larger buffersmay be used.To play the sound we use SndDoCommand() with bufferCmd. Each buffer is followedby a callbackCmd which informs us when the buffer has been processsed. INPUTThe SndInput Manager SPBRecord call is used for sound input. If onlyinput is used, then the PA user callback is called from the Input completion proc.For full-duplex, or output only operation, the PA callback is called from theHostBuffer output completion proc. In that case, input sound is passed to thecallback by a simple FIFO. TODO:O- Add support for native sample data formats other than int16.O- Review buffer sizing. Should it be based on result of siDeviceBufferInfo query?O- Determine default devices somehow.*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <memory.h>#include <math.h>/* Mac specific includes */#include "OSUtils.h"#include <MacTypes.h>#include <Math64.h>#include <Errors.h>#include <Sound.h>#include <SoundInput.h>#include <SoundComponents.h>#include <Devices.h>#include <DateTimeUtils.h>#include <Timer.h>#include <Gestalt.h>#include "portaudio.h"#include "pa_host.h"#include "pa_trace.h"#ifndef FALSE #define FALSE  (0) #define TRUE   (!FALSE)#endif/* #define TARGET_API_MAC_CARBON (1) *//* * Define maximum CPU load that will be allowed. User callback will * be skipped if load exceeds this limit. This is to prevent the Mac * from hanging when the CPU is hogged by the sound thread. * On my PowerBook G3, the mac hung when I used 94% of CPU ( usage = 0.94 ). */#define PA_MAX_USAGE_ALLOWED    (0.92)/* Debugging output macros. */#define PRINT(x) { printf x; fflush(stdout); }#define ERR_RPT(x) PRINT(x)#define DBUG(x)   /* PRINT(x) */#define DBUGX(x)  /* PRINT(x) */#define MAC_PHYSICAL_FRAMES_PER_BUFFER   (512)  /* Minimum number of stereo frames per SoundManager double buffer. */#define MAC_VIRTUAL_FRAMES_PER_BUFFER   (4096) /* Need this many when using Virtual Memory for recording. */#define PA_MIN_NUM_HOST_BUFFERS            (2)#define PA_MAX_NUM_HOST_BUFFERS           (16)   /* Do not exceed!! */#define PA_MAX_DEVICE_INFO                (32)/* Conversions for 16.16 fixed point code. */#define DoubleToUnsignedFixed(x) ((UnsignedFixed) ((x) * 65536.0))#define UnsignedFixedToDouble(fx) (((double)(fx)) * (1.0/(1<<16)))/************************************************************************************//****************** Structures ******************************************************//************************************************************************************//* Use for passing buffers from input callback to output callback for processing. */typedef struct MultiBuffer{    char    *buffers[PA_MAX_NUM_HOST_BUFFERS];    int      numBuffers;    int      nextWrite;    int      nextRead;}MultiBuffer;/* Define structure to contain all Macintosh specific data. */typedef struct PaHostSoundControl{    UInt64                  pahsc_EntryCount;	double                  pahsc_InverseMicrosPerHostBuffer; /* 1/Microseconds of real-time audio per user buffer. */    /* Use char instead of Boolean for atomic operation. */    volatile char           pahsc_IsRecording;   /* Recording in progress. Set by foreground. Cleared by background. */    volatile char           pahsc_StopRecording; /* Signal sent to background. */    volatile char           pahsc_IfInsideCallback;    /* Input */    SPB                     pahsc_InputParams;    SICompletionUPP         pahsc_InputCompletionProc;    MultiBuffer             pahsc_InputMultiBuffer;    int32                   pahsc_BytesPerInputHostBuffer;    int32                   pahsc_InputRefNum;    /* Output */    CmpSoundHeader          pahsc_SoundHeaders[PA_MAX_NUM_HOST_BUFFERS];    int32                   pahsc_BytesPerOutputHostBuffer;    SndChannelPtr           pahsc_Channel;    SndCallBackUPP          pahsc_OutputCompletionProc;    int32                   pahsc_NumOutsQueued;    int32                   pahsc_NumOutsPlayed;    PaTimestamp             pahsc_NumFramesDone;    UInt64                  pahsc_WhenFramesDoneIncremented;    /* Init Time -------------- */    int32                   pahsc_NumHostBuffers;    int32                   pahsc_FramesPerHostBuffer;    int32                   pahsc_UserBuffersPerHostBuffer;    int32                   pahsc_MinFramesPerHostBuffer; /* Can vary depending on virtual memory usage. */}PaHostSoundControl;/* Mac specific device information. */typedef struct internalPortAudioDevice{    long                    pad_DeviceRefNum;    long                    pad_DeviceBufferSize;    Component               pad_Identifier;    PaDeviceInfo            pad_Info;}internalPortAudioDevice;/************************************************************************************//****************** Data ************************************************************//************************************************************************************/static int                 sNumDevices = 0;static internalPortAudioDevice sDevices[PA_MAX_DEVICE_INFO] = { 0 };static int32               sPaHostError = 0;static int                 sDefaultOutputDeviceID;static int                 sDefaultInputDeviceID;/************************************************************************************//****************** Prototypes ******************************************************//************************************************************************************/static PaError PaMac_TimeSlice( internalPortAudioStream   *past,  int16 *macOutputBufPtr );static PaError PaMac_CallUserLoop( internalPortAudioStream   *past, int16 *outPtr );static PaError PaMac_RecordNext( internalPortAudioStream   *past );static void    PaMac_StartLoadCalculation( internalPortAudioStream   *past );static int     PaMac_GetMinNumBuffers( int minFramesPerHostBuffer, int framesPerBuffer, double sampleRate );static double *PaMac_GetSampleRatesFromHandle ( int numRates, Handle h );static PaError PaMac_ScanInputDevices( void );static PaError PaMac_ScanOutputDevices( void );static PaError PaMac_QueryOutputDeviceInfo( Component identifier, internalPortAudioDevice *ipad );static PaError PaMac_QueryInputDeviceInfo( Str255 deviceName, internalPortAudioDevice *ipad );static void    PaMac_InitSoundHeader( internalPortAudioStream   *past, CmpSoundHeader *sndHeader );static void    PaMac_EndLoadCalculation( internalPortAudioStream   *past );static void    PaMac_PlayNext ( internalPortAudioStream *past, int index );static long    PaMac_FillNextOutputBuffer( internalPortAudioStream   *past, int index );static pascal void PaMac_InputCompletionProc(SPBPtr recParams);static pascal void PaMac_OutputCompletionProc (SndChannelPtr theChannel, SndCommand * theCmd);static PaError PaMac_BackgroundManager( internalPortAudioStream   *past, int index );long PaHost_GetTotalBufferFrames( internalPortAudioStream   *past );static int     Mac_IsVirtualMemoryOn( void );static void    PToCString(unsigned char* inString, char* outString);static void    CToPString(char *inString, unsigned char* outString);char *MultiBuffer_GetNextWriteBuffer( MultiBuffer *mbuf );char *MultiBuffer_GetNextReadBuffer( MultiBuffer *mbuf );int   MultiBuffer_GetNextReadIndex( MultiBuffer *mbuf );int   MultiBuffer_GetNextWriteIndex( MultiBuffer *mbuf );int   MultiBuffer_IsWriteable(  MultiBuffer *mbuf );int   MultiBuffer_IsReadable(  MultiBuffer *mbuf );void  MultiBuffer_AdvanceReadIndex(  MultiBuffer *mbuf );void  MultiBuffer_AdvanceWriteIndex(  MultiBuffer *mbuf );/*************************************************************************** Simple FIFO index control for multiple buffers.** Read and Write indices range from 0 to 2N-1.** This allows us to distinguish between full and empty.*/char *MultiBuffer_GetNextWriteBuffer( MultiBuffer *mbuf ){    return mbuf->buffers[mbuf->nextWrite % mbuf->numBuffers];}char *MultiBuffer_GetNextReadBuffer( MultiBuffer *mbuf ){    return mbuf->buffers[mbuf->nextRead % mbuf->numBuffers];}int MultiBuffer_GetNextReadIndex( MultiBuffer *mbuf ){    return mbuf->nextRead % mbuf->numBuffers;}int MultiBuffer_GetNextWriteIndex( MultiBuffer *mbuf ){    return mbuf->nextWrite % mbuf->numBuffers;}int MultiBuffer_IsWriteable(  MultiBuffer *mbuf ){    int bufsFull = mbuf->nextWrite - mbuf->nextRead;    if( bufsFull < 0 ) bufsFull += (2 * mbuf->numBuffers);    return (bufsFull < mbuf->numBuffers);}int MultiBuffer_IsReadable(  MultiBuffer *mbuf ){    int bufsFull = mbuf->nextWrite - mbuf->nextRead;    if( bufsFull < 0 ) bufsFull += (2 * mbuf->numBuffers);    return (bufsFull > 0);}void MultiBuffer_AdvanceReadIndex(  MultiBuffer *mbuf ){    int temp = mbuf->nextRead + 1;    mbuf->nextRead = (temp >= (2 * mbuf->numBuffers)) ? 0 : temp;}void MultiBuffer_AdvanceWriteIndex(  MultiBuffer *mbuf ){    int temp = mbuf->nextWrite + 1;    mbuf->nextWrite = (temp >= (2 * mbuf->numBuffers)) ? 0 : temp;}/*************************************************************************** String Utility by Chris Rolfe*/static void PToCString(unsigned char* inString, char* outString){    long i;    for(i=0; i<inString[0]; i++)  /* convert Pascal to C string */        outString[i] = inString[i+1];    outString[i]=0;}/*************************************************************************** String Utility by Dominic Mazzoni*/static void CToPString(char* inString, unsigned char* outString){    long len = strlen(inString);    long i;    if (len > 255)        len = 255;    /* Length is stored in first char of Pascal string */    outString[0] = (unsigned char)len;    for(i=0; i<len; i++)        outString[i+1] = inString[i];}/*************************************************************************/PaError PaHost_Term( void ){    int           i;    PaDeviceInfo *dev;    double       *rates;    /* Free any allocated sample rate arrays. */    for( i=0; i<sNumDevices; i++ )    {        dev =  &sDevices[i].pad_Info;        rates = (double *) dev->sampleRates;        if( (rates != NULL) ) free( rates ); /* MEM_011 */        dev->sampleRates = NULL;        if( dev->name != NULL ) free( (void *) dev->name ); /* MEM_010 */        dev->name = NULL;    }    sNumDevices = 0;    return paNoError;}/************************************************************************* PaHost_Init() is the library initialization function - call this before    using the library.*/PaError PaHost_Init( void ){    PaError err;    NumVersionVariant version;    version.parts = SndSoundManagerVersion();    DBUG(("SndSoundManagerVersion = 0x%x\n", version.whole));    /* Have we already initialized the device info? */    err = (PaError) Pa_CountDevices();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区在线免费观看| 欧美三级电影一区| 免费高清在线一区| 手机精品视频在线观看| 亚洲影视资源网| 综合久久久久综合| 亚洲天堂成人在线观看| 亚洲日本成人在线观看| 亚洲欧美一区二区三区极速播放 | 在线区一区二视频| 91年精品国产| 91久久精品一区二区三| 色呦呦国产精品| 精品视频一区二区不卡| 91精品在线观看入口| 欧美一区二区视频在线观看2022| 欧美一卡二卡在线观看| 欧美本精品男人aⅴ天堂| 久久久久免费观看| 综合久久久久久久| 午夜精品福利一区二区蜜股av| 视频一区二区三区入口| 久久国产欧美日韩精品| 粉嫩高潮美女一区二区三区| av一区二区久久| 欧洲日韩一区二区三区| 日韩一二三四区| 久久先锋影音av| 亚洲视频一二区| 日韩高清不卡一区二区| 国产精品66部| 在线精品国精品国产尤物884a| 欧美裸体一区二区三区| 久久综合久久综合九色| 亚洲精品老司机| 久久国产精品第一页| 色综合久久久久综合| 日韩欧美中文字幕公布| 中文字幕一区二区在线观看| 亚洲第一福利视频在线| 高清在线成人网| 欧美乱妇15p| 国产精品久久久久久久久免费樱桃 | 亚洲综合偷拍欧美一区色| 麻豆精品一区二区| 一本一本久久a久久精品综合麻豆| 4438x亚洲最大成人网| 欧美国产亚洲另类动漫| 日韩电影免费一区| av高清不卡在线| 欧美成人a∨高清免费观看| 亚洲免费在线观看视频| 国产精品白丝av| 欧美一区二区三区人| 亚洲素人一区二区| 国产suv精品一区二区883| 制服丝袜一区二区三区| 亚洲精品ww久久久久久p站| 国产一区二区三区黄视频 | 久久久久97国产精华液好用吗| 亚洲少妇30p| 成人性生交大片免费看视频在线| 欧美一级电影网站| 亚洲第一二三四区| 色婷婷综合久久久久中文一区二区| 国产亚洲人成网站| 国内精品久久久久影院色| 欧美一区二区免费观在线| 亚洲电影一级片| 色综合天天狠狠| 国产精品久久久久久户外露出| 国模冰冰炮一区二区| 欧美电影免费观看完整版| 香蕉久久夜色精品国产使用方法 | 精品欧美一区二区三区精品久久| 一级精品视频在线观看宜春院| 成人免费va视频| 国产精品私人自拍| 国产91丝袜在线播放| 中文字幕国产精品一区二区| 国产毛片精品国产一区二区三区| 欧美不卡视频一区| 99麻豆久久久国产精品免费| 国产精品久久99| 97精品久久久午夜一区二区三区| 国产精品久久久久影院亚瑟 | 色婷婷香蕉在线一区二区| 日韩一区在线播放| 色婷婷av一区二区三区大白胸 | 亚洲国产精品一区二区www| 欧美日韩在线亚洲一区蜜芽| 亚洲狠狠爱一区二区三区| 欧美日韩视频在线一区二区| 亚洲图片有声小说| 欧美一区日本一区韩国一区| 久久国产综合精品| 国产日韩欧美综合一区| av中文一区二区三区| 亚洲精品一二三| 欧美精品亚洲一区二区在线播放| 免费久久99精品国产| 久久久久久日产精品| aaa欧美日韩| 日日摸夜夜添夜夜添亚洲女人| 日韩精品一区二| 91久久精品国产91性色tv| 毛片av一区二区三区| 亚洲国产精品av| 欧美人伦禁忌dvd放荡欲情| 国模套图日韩精品一区二区| 成人免费一区二区三区在线观看| 欧美伦理电影网| 成人app在线| 六月丁香综合在线视频| 国产精品三级在线观看| 91.com在线观看| aaa亚洲精品一二三区| 久久精品72免费观看| 亚洲欧美日韩精品久久久久| 91精品国产综合久久精品性色 | **性色生活片久久毛片| 91精品国产日韩91久久久久久| 国产高清无密码一区二区三区| 一区二区三区四区在线| 精品欧美久久久| 欧美午夜免费电影| 国产sm精品调教视频网站| 日韩精品成人一区二区三区| 中文字幕一区在线| 欧美va亚洲va在线观看蝴蝶网| 一本大道av一区二区在线播放| 久久99精品网久久| 一个色综合av| 国产精品九色蝌蚪自拍| 精品国产sm最大网站免费看| 欧美在线短视频| 99久久婷婷国产综合精品电影 | 中文字幕日韩一区| 精品粉嫩超白一线天av| 欧美精品欧美精品系列| 一本一道综合狠狠老| 国产91丝袜在线18| 久久国产人妖系列| 蜜臀av在线播放一区二区三区| 一区二区三区色| 亚洲精品五月天| 国产精品每日更新| 国产亚洲综合性久久久影院| 欧美一区二区久久| 在线不卡中文字幕| 欧美男同性恋视频网站| 在线观看亚洲成人| 在线视频欧美精品| 91久久久免费一区二区| 欧美在线免费播放| 精品视频在线看| 欧美视频你懂的| 欧美三级日本三级少妇99| 欧美亚洲综合另类| 欧美专区在线观看一区| 欧美丝袜丝交足nylons图片| 欧美在线视频日韩| 欧美日韩在线播放三区| 欧美日韩精品系列| 在线不卡免费欧美| 日韩欧美的一区二区| 精品福利av导航| 国产精品国产三级国产a| 亚洲免费av网站| 午夜国产不卡在线观看视频| 日本亚洲欧美天堂免费| 国产做a爰片久久毛片 | 亚洲色图清纯唯美| 亚洲专区一二三| 美女一区二区三区在线观看| 精品中文字幕一区二区小辣椒| 国产成人高清视频| 色综合久久综合中文综合网| 欧美日韩免费不卡视频一区二区三区 | 精品少妇一区二区三区在线视频| 日韩视频一区二区| 久久久亚洲午夜电影| 国产精品美女久久久久久久久| 国产精品国产三级国产| 亚洲综合激情网| 日本不卡一区二区| 狠狠色狠狠色综合日日91app| 粉嫩av一区二区三区| 欧美军同video69gay| 久久综合色一综合色88| 18成人在线观看| 蜜桃视频免费观看一区| 东方欧美亚洲色图在线| 欧美午夜精品理论片a级按摩| 日韩视频一区在线观看| 国产精品第一页第二页第三页| 午夜激情一区二区三区| av电影一区二区| 精品国产自在久精品国产| 亚洲免费高清视频在线|