Changeset 60
- Timestamp:
- 12/03/02 01:32:24 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pa_proposals/trunk/019-NotifyClientWhenAllBuffersHavePlayed.html
r53 r60 18 18 <P><A href="index.html">Enhancement Proposals Index</A>, 19 19 <A href="http://www.portaudio.com/">PortAudio Home Page</A></P> 20 <P>Updated: October 22, 2002 </P>20 <P>Updated: December 3, 2002 </P> 21 21 22 22 <H4>Status</H4> 23 23 24 <P>This proposal is open for discussion.</P>24 <P>This proposal is sufficiently well defined to be implemented.</P> 25 25 26 26 <H4>Background</H4> 27 27 28 28 <P> 29 PortAudio allows clients to terminate a stream by returning non-zero from the stream callback function. When the callback return value is paComplete, PortAudio will finish playing all generated audio data before deactivating the stream. PortAudio does not notify clients when the stream has actually completed playing all audio data. Currently the only methods of discovering whether a stream has actually finished playing is to poll Pa_IsStreamActive() or to wait for a blocking call to Pa_StopStream() to return. Some clients would prefer to receive an asyncronous notification when the stream completes playing.29 PortAudio allows clients to terminate a stream by returning non-zero from the stream callback function. When the callback return value is paComplete, PortAudio will finish playing all generated audio data before deactivating the stream. PortAudio does not notify clients when the stream has actually completed playing all audio data. Currently the only methods of discovering whether a stream has actually finished playing is to poll Pa_IsStreamActive() or to wait for a blocking call to Pa_StopStream() to return. Some clients would like to receive an asyncronous notification when the stream completes playing all queued sample data. 30 30 </P> 31 31 … … 37 37 38 38 <PRE> 39 /** Functions of type PaStreamFinishedCallback are implemented by PortAudio 40 clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback 41 function. Once registered they are called when the stream becomes inactive 42 (ie once a call to Pa_StopStream() will not block). 43 A stream will become inactive after the stream callback returns non-zero, 44 or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio 45 output, if the stream callback returns paComplete, or Pa_StopStream is called, 46 the stream finished callback will not be called until all generated sample data 47 has been played. 48 49 @param userData The userData parameter supplied to Pa_OpenStream() 50 51 @see Pa_SetStreamFinishedCallback 52 */ 39 53 typedef void PaStreamFinishedCallback( void *userData ); 40 54 41 /** Register a callback function which will be called when a stream finishes 42 playing all queued audio data - this condition will arise after the stream 43 callback returns non-zero, or when Pa_StopStream or Pa_AbortStream is called. 44 If the stream callback returns paComplete, or Pa_StopStream is called, the 45 stream finished callback will not be called until all generated sample data 46 has been played. In the case of an input-only stream, the callback will be 47 called when the stream becomes inactive (ie once a call to Pa_StopStream() 48 will not block.) Passing NULL for the streamFinishedCallback parameter 49 un-registers a previously registered stream finished callback function. 50 Pa_SetStreamFinishedCallback must only be called when the stream is stopped, 51 otherwise an error will be returned. 55 56 /** Register a stream finished callback function which will be called when the 57 stream becomes inactive. See the description of PaStreamFinishedCallback for 58 further details about when the callback will be called. 59 60 @param stream a pointer to a PaStream that is in the stopped state - if the 61 stream is not stopped, the stream's finished callback will remain unchanged 62 and an error code will be returned. 63 64 @param streamFinishedCallback a pointer to a function with the same signature 65 as PaStreamFinishedCallback, that will be called when the stream becomes 66 inactive. Passing NULL for this parameter will un-register a previously 67 registered stream finished callback function. 68 69 @return on success returns paNoError, otherwise an error code indicating the cause 70 of the error. 71 72 @see PaStreamFinishedCallback 52 73 */ 53 74 PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ); … … 58 79 59 80 <P> 60 The stream finished callback could be passed as a parameter to PaOpenStream, 81 Instead of providing a Pa_SetStreamFinishedCallback function, the stream 82 finished callback could be passed as a parameter to PaOpenStream, 61 83 this would make things more complicated for clients who don't need to use 62 a stream finished callback. No clear decision has been made on this point yet.84 a stream finished callback. 63 85 </P> 64 86
