Changeset 38
- Timestamp:
- 10/18/02 15:28:41 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pa_proposals/trunk/003-ImproveLatencySpecificationInterface.html
r10 r38 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: July 30, 2002 </P>20 <P>Updated: October 19, 2002 </P> 21 21 22 22 <H4>Status</H4> 23 23 24 24 <P> 25 This proposal is sufficiently well defined to be implemented. The current V19 implementation is not up to date (it uses frames instead of seconds for the suggestedInputLatency and suggestedOuputLatency parameters to Pa_OpenStream, and doesn't provide the default latency or latency querying functions.)25 This proposal is sufficiently well defined to be implemented. It is implemented in the v19-devel branch. 26 26 </P> 27 27 … … 33 33 34 34 <P> 35 A related issue is the need to improve the interface available to determine default latency parameters . The most recent proposal is documented below, however there is still some debate as to whether this is satisfactory.35 A related issue is the need to improve the interface available to determine default latency parameters - both for simple applications that just want to use the default values, and for applications that want to give user's the ability to tune latency values starting from sane defaults. 36 36 </P> 37 37 … … 44 44 45 45 <P> 46 The numBuffers parameter to Pa_OpenStream() will be removed, and replaced by two new parameters suggestedInputLatency and suggestedOutputLatency, both expressed in seconds. These parameters allow clients to fine-tune latency in a portable manner. Where practical PortAudio implementations should select buffer sizes based on these parameters, otherwise they may choose the closest viable buffer size and latency instead. In such cases the PortAudio implementations should round-up (ie always provide an equal or higher latency than requested.)46 The numBuffers parameter to Pa_OpenStream() will be removed, and replaced by two new parameters suggestedInputLatency and suggestedOutputLatency, both expressed in seconds. These parameters allow clients to fine-tune latency in a portable manner. Where practical, PortAudio implementations should select buffer sizes based on these parameters, otherwise they may choose the closest viable buffer size and latency instead. Unless the suggested latency is greater than the upper limit for the device, PortAudio implementations should aim to round the suggestedLatency up to the next practial value - ie to provide an equal or higher latency than requested whereever possibe. 47 47 </P> 48 49 <P> 50 The following fields will be added to PaDevice info to expose the default input and output latency values for each device. Separate default latency values are provided for (1) interactive applications where low latency is important to useful operation (defaultLowInputLatency, defaultLowOutputLatency), and (2) robust applications where additional latency is acceptable if it will result in more stable performance or place a reduced load on the system (defaultHighInputLatcncy, defaultHighOutputLatency). 51 </P> 52 53 <PRE> 54 typedef double PaTime; /* time expressed in seconds */ 55 56 typedef struct PaDeviceInfo { 57 ... 58 /* Default latency values for interactive performance. */ 59 PaTime defaultLowInputLatency; 60 PaTime defaultLowOutputLatency; 61 /* Default latency values for robust non-interactive applications (eg. playing sound files). */ 62 PaTime defaultHighInputLatency; 63 PaTime defaultHighOutputLatency; 64 ... 65 } PaDeviceInfo; 66 </PRE> 48 67 49 68 <P> … … 51 70 </P> 52 71 53 <PRE>54 typedef double PaTime; /* time expressed in seconds */55 56 PaTime Pa_GetDefaultLowInputLatency( PaDeviceIndex deviceID ); /* For interactive performance. */57 PaTime Pa_GetDefaultHighInputLatency( PaDeviceIndex deviceID ); /* For playing sound files. */58 PaTime Pa_GetDefaultLowOutputLatency( PaDeviceIndex deviceID ); /* For interactive performance. */59 PaTime Pa_GetDefaultHighOutputLatency( PaDeviceIndex deviceID ); /* For playing sound files. */60 </PRE>61 62 72 <P> 63 Currently, when numBuffers is greater than 0, Pa_OpenStream will constrain the actual numBuffers so that the latency is within a valid range determined by the host API, or an environment variables such as PA_MIN_LATENCY_MSEC. Propose changing the behavior so that the requested value is honored as much aspossible. This will allow the user to override the recommended minimum latency if they know their system can handle it. This might be used, for example on patched Linux kernels.73 Currently, when numBuffers is greater than 0, Pa_OpenStream will constrain the actual numBuffers so that the latency is within a valid range determined by the host API, or an environment variables such as PA_MIN_LATENCY_MSEC. Propose changing the behavior so that the requested value is honored whenever possible. This will allow the user to override the recommended minimum latency if they know their system can handle it. This might be used, for example on patched Linux kernels. 64 74 </P> 65 75 … … 94 104 95 105 <P> 96 This proposal provides both a high level mechanism for portable latency tuning, and suggests a method for providing a host-API specific latency tuning interface. Default latency query functions are provided to support simple portable applications .106 This proposal provides both a high level mechanism for portable latency tuning, and suggests a method for providing a host-API specific latency tuning interface. Default latency query functions are provided to support simple portable applications, and to provide starting values for applications that present a generic latency tuning user interface. 97 107 </P> 108 109 <P> 110 Originally default latency values were retrieved using query functions listed below, however providing these values in the PaDeviceInfo structure seemed like a more natural fit to the rest of the API. 111 </P> 112 113 <PRE> 114 typedef double PaTime; /* time expressed in seconds */ 115 116 PaTime Pa_GetDefaultLowInputLatency( PaDeviceIndex deviceID ); /* For interactive performance. */ 117 PaTime Pa_GetDefaultHighInputLatency( PaDeviceIndex deviceID ); /* For playing sound files. */ 118 PaTime Pa_GetDefaultLowOutputLatency( PaDeviceIndex deviceID ); /* For interactive performance. */ 119 PaTime Pa_GetDefaultHighOutputLatency( PaDeviceIndex deviceID ); /* For playing sound files. */ 120 </PRE> 98 121 99 122 <P>
