dos2unix
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@968 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
0232f398c7
commit
df1f3209d9
|
@ -55,10 +55,10 @@
|
|||
/************************************************************************/
|
||||
/******** Prototypes ****************************************************/
|
||||
/************************************************************************/
|
||||
static int blockingIOCallback(void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
|
||||
static int blockingIOCallback(void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer,
|
||||
PaTimestamp outTime, void *userData);
|
||||
static PaError PABLIO_InitFIFO(RingBuffer * rbuf, long numFrames, long bytesPerFrame);
|
||||
static PaError PABLIO_TermFIFO(RingBuffer * rbuf);
|
||||
static PaError PABLIO_InitFIFO(RingBuffer * rbuf, long numFrames, long bytesPerFrame);
|
||||
static PaError PABLIO_TermFIFO(RingBuffer * rbuf);
|
||||
|
||||
/************************************************************************/
|
||||
/******** Functions *****************************************************/
|
||||
|
@ -90,7 +90,7 @@ static int blockingIOCallback(void *inputBuffer, void *outputBuffer,
unsigned l
|
|||
((char *) outputBuffer)[i] = 0;
|
||||
} }
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Allocate buffer. */
|
||||
|
@ -102,7 +102,7 @@ static PaError PABLIO_InitFIFO(RingBuffer * rbuf, long numFrames, long bytesPerF
|
|||
return paInsufficientMemory;
|
||||
memset(buffer, 0, numBytes);
|
||||
return (PaError) RingBuffer_Init(rbuf, numBytes, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Free buffer. */
|
||||
|
@ -112,7 +112,7 @@ static PaError PABLIO_TermFIFO(RingBuffer * rbuf)
|
|||
free(rbuf->buffer);
|
||||
rbuf->buffer = NULL;
|
||||
return paNoError;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************
|
||||
|
@ -133,7 +133,7 @@ long WriteAudioStream(PABLIO_Stream * aStream, void *data, long numFrames)
|
|||
Pa_Sleep(10);
|
||||
}
|
||||
return numFrames;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************
|
||||
|
@ -154,7 +154,7 @@ long ReadAudioStream(PABLIO_Stream * aStream, void *data, long numFrames)
|
|||
Pa_Sleep(10);
|
||||
}
|
||||
return numFrames;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************
|
||||
|
@ -165,7 +165,7 @@ long GetAudioStreamWriteable(PABLIO_Stream * aStream)
|
|||
{
|
||||
int bytesEmpty = RingBuffer_GetWriteAvailable(&aStream->outFIFO);
|
||||
return bytesEmpty / aStream->bytesPerFrame;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************
|
||||
|
@ -176,7 +176,7 @@ long GetAudioStreamReadable(PABLIO_Stream * aStream)
|
|||
{
|
||||
int bytesFull = RingBuffer_GetReadAvailable(&aStream->inFIFO);
|
||||
return bytesFull / aStream->bytesPerFrame;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************/
|
||||
|
@ -191,7 +191,7 @@ static unsigned long RoundUpToNextPowerOf2(unsigned long n)
|
|||
numBits++;
|
||||
}
|
||||
return (1 << numBits);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************
|
||||
|
@ -276,7 +276,7 @@ static unsigned long RoundUpToNextPowerOf2(unsigned long n)
|
|||
|
||||
/* Open a PortAudio stream that we will use to communicate with the underlying
|
||||
* audio drivers. */
|
||||
err = Pa_OpenStream(
&aStream->stream,
|
||||
err = Pa_OpenStream(&aStream->stream,
|
||||
(doRead ? (indev > -1) ? indev : Pa_GetDefaultInputDeviceID() : paNoDevice),
|
||||
(doRead ? aStream->samplesPerFrame : 0), format, NULL,
|
||||
(doWrite ? (outdev > -1) ? outdev : Pa_GetDefaultOutputDeviceID() : paNoDevice),
|
||||
|
@ -291,10 +291,10 @@ static unsigned long RoundUpToNextPowerOf2(unsigned long n)
|
|||
goto error;
|
||||
*rwblPtr = aStream;
|
||||
return paNoError;
|
||||
error:
CloseAudioStream(aStream);
|
||||
error:CloseAudioStream(aStream);
|
||||
*rwblPtr = NULL;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************/
|
||||
|
@ -323,11 +323,11 @@ static unsigned long RoundUpToNextPowerOf2(unsigned long n)
|
|||
goto error;
|
||||
err = Pa_CloseStream(aStream->stream);
|
||||
}
|
||||
error:
Pa_Terminate();
|
||||
error:Pa_Terminate();
|
||||
PABLIO_TermFIFO(&aStream->inFIFO);
|
||||
PABLIO_TermFIFO(&aStream->outFIFO);
|
||||
free(aStream);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ long RingBuffer_Init(RingBuffer * rbuf, long numBytes, void *dataPtr)
|
|||
rbuf->bigMask = (numBytes * 2) - 1;
|
||||
rbuf->smallMask = (numBytes) - 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -61,7 +61,7 @@ long RingBuffer_Init(RingBuffer * rbuf, long numBytes, void *dataPtr)
|
|||
long RingBuffer_GetReadAvailable(RingBuffer * rbuf)
|
||||
{
|
||||
return ((rbuf->writeIndex - rbuf->readIndex) & rbuf->bigMask);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -69,7 +69,7 @@ long RingBuffer_GetReadAvailable(RingBuffer * rbuf)
|
|||
long RingBuffer_GetWriteAvailable(RingBuffer * rbuf)
|
||||
{
|
||||
return (rbuf->bufferSize - RingBuffer_GetReadAvailable(rbuf));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -77,7 +77,7 @@ long RingBuffer_GetWriteAvailable(RingBuffer * rbuf)
|
|||
void RingBuffer_Flush(RingBuffer * rbuf)
|
||||
{
|
||||
rbuf->writeIndex = rbuf->readIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** Get address of region(s) to which we can write data.
|
||||
|
@ -114,7 +114,7 @@ long RingBuffer_GetWriteRegions(RingBuffer * rbuf, long numBytes,
void **dataPt
|
|||
*sizePtr2 = 0;
|
||||
}
|
||||
return numBytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -122,7 +122,7 @@ long RingBuffer_GetWriteRegions(RingBuffer * rbuf, long numBytes,
void **dataPt
|
|||
long RingBuffer_AdvanceWriteIndex(RingBuffer * rbuf, long numBytes)
|
||||
{
|
||||
return rbuf->writeIndex = (rbuf->writeIndex + numBytes) & rbuf->bigMask;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -160,7 +160,7 @@ long RingBuffer_GetReadRegions(RingBuffer * rbuf, long numBytes,
void **dataPtr
|
|||
*sizePtr2 = 0;
|
||||
}
|
||||
return numBytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -168,7 +168,7 @@ long RingBuffer_GetReadRegions(RingBuffer * rbuf, long numBytes,
void **dataPtr
|
|||
long RingBuffer_AdvanceReadIndex(RingBuffer * rbuf, long numBytes)
|
||||
{
|
||||
return rbuf->readIndex = (rbuf->readIndex + numBytes) & rbuf->bigMask;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -191,7 +191,7 @@ long RingBuffer_Write(RingBuffer * rbuf, void *data, long numBytes)
|
|||
}
|
||||
RingBuffer_AdvanceWriteIndex(rbuf, numWritten);
|
||||
return numWritten;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -214,6 +214,6 @@ long RingBuffer_Read(RingBuffer * rbuf, void *data, long numBytes)
|
|||
}
|
||||
RingBuffer_AdvanceReadIndex(rbuf, numRead);
|
||||
return numRead;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue