Show
Ignore:
Timestamp:
08/24/02 05:47:48 (6 years ago)
Author:
rossbencina
Message:

- added additional analysis, esp. wrt sample rate info
- clarified what is being changed from V18

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pa_proposals/trunk/002-ImproveDeviceFormatsQueryInterface.html

    r16 r23  
    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: August 1, 2002 </P> 
     20<P>Updated: August 24, 2002 </P> 
    2121 
    2222<H4>Status</H4> 
    2323 
    24 <P>This proposal is open for discussion.</P> 
     24<P>This proposal is sufficiently well defined to be implemented.</P> 
    2525 
    2626<H4>Background</H4> 
    2727 
    2828<P> 
    29 The current (V18) method of querying devices for supported sample formats, channels, and sample rates (Pa_GetDeviceInfo()) is weak.  
    30 It is incapable of representing formats where the parameters are interdependent (eg where full duplex is only supported for certain sample rates.) We have also found that a static structure is not a good match for many host APIs where format discovery is performed by polling the driver, as filling the structure may involve many polling operations. Even if a sound card supports arbitrary sample rates, the host API may only allow a client to poll to see whether a rate is available rather than providing the available rate ranges. 
     29The current (V18) method of querying devices for supported sample formats, channels, and sample rates (Pa_GetDeviceInfo()) is considered to be weak. It is incapable of representing formats where stream parameters are interdependent (for example where full duplex is only supported for certain sample rates.) We have found that representing device capabilities using a static structure is not a good match for many host APIs where format discovery is performed by polling the driver. This is because populating the structure may involve many polling operations. The current PortAudio API is able to provide details about hardware which supports a continuous range of sample rates, however many host APIs only allow sample rate information to be gathered by polling for specific rates. 
    3130</P> 
    3231 
    3332<P> 
    34 It has been noted that most (platform specific) audio APIs have poor device capability querying mechanisms. Even the better APIs (ALSA is perhaps one) don't necessarily provide accurate information. This proposal should seek to maximise the amount of information that can be extracted from existing APIs while remaining expressive enough to take full advantage of APIs with more advanced capability querying systems should they become available in the future. 
     33It has been noted that most host audio APIs have poor device capability querying mechanisms. Even the better APIs (ALSA is perhaps one) don't necessarily provide accurate information. Ideally this proposal should seek to maximise the amount of information that can be extracted from existing APIs while remaining expressive enough to take full advantage of APIs with more advanced capability querying systems should they become available in the future. In reality, the available design options consist of providing an expressive interface that may provide inaccurate information on some platforms, or providing a less expressive interface which is more likely to provide accurate information, but may limit the amount and detail of information compared to that supplied by the underlying host API. The latter design option has been chosen for this proposal. 
    3534</P> 
    3635 
     
    5554 
    5655<P> 
    57 The notion of "native sample formats" - those that are directly supported by the underlying 
     56The following fields have been removed from the above structure, relative to V18:  
     57numSampleRates, sampleRates, nativeSampleFormats. Sample rate information will only 
     58be available by polling PortAudio using the Pa_IsFormatSupported() function defined below. 
     59The concept of "native sample formats" - those that are directly supported by the underlying 
    5860host API - will be removed from the PortAudio specification as PortAudio's conversion 
    5961capabilities allow support for all PortAudio sample formats. 
     
    8183</PRE> 
    8284 
     85<P> 
     86The <A href="016-UseStructsForOpenStreamParameters.html">Use Structs for Pa_OpenStream() Parameters</A> proposal defines 
     87the PaStreamParameters structure which will replace the individual parameters in the Pa_IsFormatSupported() definition above, 
     88resulting in the following prototype: 
     89</P> 
     90 
     91<PRE> 
     92PaError Pa_IsFormatSupported( 
     93   PaStreamParameters *inputParameters, 
     94   PaStreamParameters *outputParameters, 
     95   double sampleRate ); 
     96</PRE> 
     97 
    8398 
    8499 
     
    87102<P> This proposal provides a mechanism for querying PortAudio for supported 
    88103formats without requiring implementations to construct device information structures 
    89 by polling the host api multiple times. 
     104by polling the host api multiple times. The down side to this design is that 
     105some information that host APIs may make available without polling is hidden 
     106from PortAudio clients. Most significantly, if a PortAudio client wishes to display 
     107a list of supported sample rates, it's only option is to poll PortAudio. This was 
     108deemed to be satisfactory because in many cases PortAudio is unable to establish  
     109the available sample rates without polling itself. The alternative of providing  
     110sample rate information only when it is available was considered, but discarded 
     111as being confusing and error prone. 
    90112</P> 
    91113 
     
    102124to implement their own conversion layer on top of PortAudio. C) It is difficult to imagine 
    103125a Portable software design that would want to determine its output sample buffer format  
    104 based on host api native format constraints; usually internal constraints such as use of a  
     126based on host API native format constraints; usually internal constraints such as use of a  
    105127floating point signal path, or the format of a soundfile being played back would be more 
    106128important.