Changeset 38 for pa_proposals/trunk

Show
Ignore:
Timestamp:
10/18/02 15:28:41 (6 years ago)
Author:
rossbencina
Message:

-updated v19-devel status
-changed wording of suggestedLatency -> used latency rule to specify rounding up wherever possible (rather than always round up)
-altered default latency values proposal so that they are now fields of PaDeviceInfo? rather than separate query functions
-added additional motivation (sane defaults for GUI apps) for default latency values

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pa_proposals/trunk/003-ImproveLatencySpecificationInterface.html

    r10 r38  
    1818<P><A href="index.html">Enhancement Proposals Index</A>, 
    1919<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> 
    2121 
    2222<H4>Status</H4> 
    2323 
    2424<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.) 
     25This proposal is sufficiently well defined to be implemented. It is implemented in the v19-devel branch. 
    2626</P> 
    2727 
     
    3333 
    3434<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.  
     35A 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. 
    3636</P> 
    3737 
     
    4444 
    4545<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.)  
     46The 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.  
    4747</P> 
     48 
     49<P> 
     50The 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> 
     54typedef double PaTime; /* time expressed in seconds */ 
     55 
     56typedef 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> 
    4867 
    4968<P> 
     
    5170</P> 
    5271 
    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  
    6272<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 as 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. 
     73Currently, 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. 
    6474</P> 
    6575 
     
    94104 
    95105<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. 
     106This 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. 
    97107</P> 
     108 
     109<P> 
     110Originally 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>  
     114typedef double PaTime; /* time expressed in seconds */ 
     115 
     116PaTime Pa_GetDefaultLowInputLatency( PaDeviceIndex deviceID ); /* For interactive performance. */ 
     117PaTime Pa_GetDefaultHighInputLatency( PaDeviceIndex deviceID ); /* For playing sound files. */ 
     118PaTime Pa_GetDefaultLowOutputLatency( PaDeviceIndex deviceID ); /* For interactive performance. */ 
     119PaTime Pa_GetDefaultHighOutputLatency( PaDeviceIndex deviceID ); /* For playing sound files. */ 
     120</PRE> 
    98121 
    99122<P>