Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
const PaStreamInfo* Pa_GetStreamInfo( PaStream *stream );
/** Determine the current time for the stream according to the same clock used
to generate buffer timestamps. This time may be used for syncronising other
events to the audio stream, for example synchronizing audio to MIDI.
@return The stream's current time in seconds, or 0 if an error occurred.
@see PaTime, PaStreamCallback
*/
PaTime Pa_GetStreamTime( PaStream *stream );
/** Retrieve CPU usage information for the specified stream.
The "CPU Load" is a fraction of total CPU time consumed by a callback stream's
audio processing routines including, but not limited to the client supplied
stream callback. This function does not work with blocking read/write streams.
This function may be called from the stream callback function or the
application.
@return
A floating point value, typically between 0.0 and 1.0, where 1.0 indicates
that the stream callback is consuming the maximum number of CPU cycles possible
to maintain real-time operation. A value of 0.5 would imply that PortAudio and
the stream callback was consuming roughly 50% of the available CPU time. The
return value may exceed 1.0. A value of 0.0 will always be returned for a
blocking read/write stream, or if an error occurrs.
*/
double Pa_GetStreamCpuLoad( PaStream* stream );
/** Read samples from an input stream. The function doesn't return until
the entire buffer has been filled - this may involve waiting for the operating
system to supply the data.
@param stream A pointer to an open stream previously created with Pa_OpenStream.
@param buffer A pointer to a buffer of sample frames. The buffer contains
samples in the format specified by the inputParameters->sampleFormat field
used to open the stream, and the number of channels specified by
inputParameters->numChannels. If non-interleaved samples were requested,
buffer is a pointer to the first element of an array of non-interleaved
buffer pointers, one for each channel.
@param frames The number of frames to be read into buffer. This parameter
is not constrained to a specific range, however high performance applications
will want to match this parameter to the framesPerBuffer parameter used
when opening the stream.
@return On success PaNoError will be returned, or PaInputOverflowed if input
data was discarded by PortAudio after the previous call and before this call.
*/
PaError Pa_ReadStream( PaStream* stream,
void *buffer,
unsigned long frames );
/** Write samples to an output stream. This function doesn't return until the
entire buffer has been consumed - this may involve waiting for the operating
system to consume the data.
@param stream A pointer to an open stream previously created with Pa_OpenStream.
@param buffer A pointer to a buffer of sample frames. The buffer contains
samples in the format specified by the outputParameters->sampleFormat field
used to open the stream, and the number of channels specified by
outputParameters->numChannels. If non-interleaved samples were requested,
buffer is a pointer to the first element of an array of non-interleaved
buffer pointers, one for each channel.
@param frames The number of frames to be written from buffer. This parameter
is not constrained to a specific range, however high performance applications
will want to match this parameter to the framesPerBuffer parameter used
when opening the stream.
@return On success PaNoError will be returned, or paOutputUnderflowed if
additional output data was inserted after the previous call and before this
call.
*/
PaError Pa_WriteStream( PaStream* stream,
const void *buffer,
unsigned long frames );
/** Retrieve the number of frames that can be read from the stream without
waiting.
@return Returns a non-negative value representing the maximum number of frames
that can be read from the stream without blocking or busy waiting or, a
PaErrorCode (which are always negative) if PortAudio is not initialized or an
error is encountered.
*/
signed long Pa_GetStreamReadAvailable( PaStream* stream );
/** Retrieve the number of frames that can be written to the stream without
waiting.
@return Returns a non-negative value representing the maximum number of frames
that can be written to the stream without blocking or busy waiting or, a
PaErrorCode (which are always negative) if PortAudio is not initialized or an
error is encountered.
*/
signed long Pa_GetStreamWriteAvailable( PaStream* stream );
/* Miscellaneous utilities */
/** Retrieve the size of a given sample format in bytes.
@return The size in bytes of a single sample in the specified format,
or paSampleFormatNotSupported if the format is not supported.
*/
PaError Pa_GetSampleSize( PaSampleFormat format );
/** Put the caller to sleep for at least 'msec' milliseconds. This function is
provided only as a convenience for authors of portable code (such as the tests
and examples in the PortAudio distribution.)
The function may sleep longer than requested so don't rely on this for accurate
musical timing.
*/
void Pa_Sleep( long msec );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* PORTAUDIO_H */