Ticket #54 (new enhancement)

Opened 13 months ago

Last modified 6 months ago

Enable >16bit output sample widths using DirectSound API

Reported by: alec.rogers@… Owned by: rossb
Priority: major Milestone: V20
Component: host-api-dsound Version: 2.0
Keywords: Cc:

Description (last modified by rossb) (diff)

Multichannel support is complete in DirectSound?. This has been quite extensively tested. The remaining work pertains to >16 bit sample formats. Progress on this issue was made in changesets r1268 r1258. See the checkin comments there.

At the moment input and output sample formats are hardwired to 16 bit in the two lines in pa_win_ds.c reading: PaSampleFormat? nativeInputFormats = paInt16; It is possible to uncomment the following lines to support other sample formats: PaSampleFormat? nativeFormats = paUInt8 | paInt16 | paInt24 | paInt32 | paFloat32;

However this will make use of DS converters rather than using PortAudio converters to map to the best supported sample format. The main work left to do is to handle renegotiation of sample format if the requested format fails (ie if 24 bit is requested, but dsound fails, we need to fall back to 16 bit).

The issue has been discussed on the mailing list: http://techweb.rfa.org/pipermail/portaudio/2008-January/008175.html http://techweb.rfa.org/pipermail/portaudio/2008-February/008195.html

There have been other discussions here on when/why to use WAVEFORMATEX instead of WAVEFORMATEXTENSIBLE:

For example, there are some very popular soundcards with bugs in their WAVEFORMATEXTENSIBLE support: http://techweb.rfa.org/pipermail/portaudio/2008-February/008237.html

Alec originally wrote: I have attached a modified version of portaudio/src/hostapi/dsound/pa_win_ds.c, which has been patched to allow multiple (more than two) channels, and sample formats other than paInt16. This is achieved through the use of the WAVEFORMATEXTENSIBLE structure.

Of note: * I have coded away the PA sample format conversion, which is probably not in model for PortAudio. This can be re-introduced by specifying desired sample formats in the call to PaUtil?_SelectClosestAvailableFormat(). * The use of WAVEFORMATEXTENSIBLE requires us to define a channel mapping. I have used the technique of 1 channel -> FrontCenterSpeaker?, N channels -> FirstNSpeakers. This makes sense to me, but be aware of the choice.

Attachments

pa_win_ds.c (82.3 kB) - added by alec_rogers 13 months ago.

Change History

Changed 13 months ago by alec_rogers

Changed 12 months ago by rossb

Some progress made, see also ticket #29

Changed 7 months ago by rossb

  • summary changed from Enable multiple channels and different sample widths using DirectSound API to Enable >16bit output sample widths using DirectSound API

Renamed from "Enable multiple channels and different sample widths..." since multichannel has been implemented since r1268

Changed 6 months ago by rossb

  • version set to 2.0
  • description modified (diff)
  • milestone set to V20

Changed ticket description with more detail about current status of >16 bit support.

Changed 6 months ago by rossb

  • description modified (diff)
Note: See TracTickets for help on using tickets.