13
0
Commit Graph

51 Commits

Author SHA1 Message Date
John Emmas
a2b1482cad Fix a problem with ASIO buffer sizes on Windows
PortAudio uses what it calls 'default suggested latencies' but in callback streaming mode, they can result in wildly inaccurate buffer sizing (e.g. the user requests a buffer size of 128 but PortAudio actually instructs ASIO to use a much bigger size).

What we do now is to improve PortAudio's suggested latency calculation by basing it on the actual buffer size requested by the user.
2021-03-18 16:12:28 +00:00
47a62b2850
Update backend GPL boilerplate and (C) from git log 2019-08-03 15:53:16 +02:00
30b087ab3d globally change all use of "frame" to refer to audio into "sample".
Generated by tools/f2s. Some hand-editing will be required in a few places to fix up comments related to timecode
and video in order to keep the legible
2017-09-18 12:39:17 -04:00
8b5fad0cf9 Use better debug output in PortaudioBackend
When failing to open audio stream in callback mode
2016-11-10 15:23:43 +10:00
ac301b998a Use a range of values for ASIO buffer sizes if provided by driver
This has been tested on four devices:

- A RME HDSP Multiface
- A Yamaha AG06
- A Focusrite 2i2
- A built-in soundcard running ASIO4ALL

The HDSP and the AG06 only return one buffer size when queried so the preferred
size is used as before.

The Focusrite returns a min corresponding to the position of the slider in the
control dialog and the max is 1024. The granularity is 1 so this means that the
number of values needs to be reduced for the current UI design with a combo
box so the granularity is increased until there are around 8-9 buffer sizes to
choose from evenly spaced between min and max(but we could easily change this
if the UI changes etc).

The ASIO4ALL driver returns a min of 64 and a max of 2048 and a granularity of
8. So where the minimum buffer size and granularity is a power of 2 use only
buffer sizes that are power of 2.

If the driver returns different values for min and max it is not currently
possible to indicate which is the driver preferred value. A checkbox or other
UI element could be added to the AudioSetup dialog to only use the preferred
value but that is more work and perhaps not necessary.
2015-11-19 10:23:26 +10:00
f1b336b01e Add support for callback API to portaudio backend but keep blocking API as default
Don't use the callback API for now until further and wider testing.
2015-11-19 10:23:26 +10:00
f178152114 Use portaudio error codes in the PortaudioIO class.
Having error codes defined in PortaudioIO means it is not dependent on the
ErrorCodes in AudioBackend but it doesn't really make sense to have another
set, so just use the PA ones until they become insufficient.
2015-10-01 09:10:19 +10:00
f58282844d Don't add "None" devices for ASIO driver in PortaudioBackend 2015-09-02 12:07:15 +10:00
0396df963f Implement new AudioBackend API for force updating devices in PortaudioBackend 2015-09-02 12:07:15 +10:00
585930f058 Update devices in PortaudioBackend when setting the driver
Reinitialize portaudio to pick up changes in devices and ASIO buffer settings
2015-09-02 12:07:15 +10:00
8c2b9dac59 Rename several methods in PortAudioIO class
return ErrorCode's and handle them where necessary
2015-09-02 12:07:15 +10:00
82f84d6203 Refactor part of PortAudioIO::pcm_setup into new method 2015-09-02 12:07:15 +10:00
1cb36108bb Change the functions related to initializing the Portaudio library 2015-09-02 12:07:15 +10:00
3b71674eee Remove unused and cryptic _state member from PortAudioIO 2015-09-02 12:07:15 +10:00
fd0b54f459 Use PortAudioIO::ErrorCode as return value from PortAudioIO::pcm_setup 2015-09-02 12:07:15 +10:00
e42f9d649b Refactor parts of PortAudioIO class into new method 2015-09-02 12:07:15 +10:00
c857008b93 Refactor part of PortAudioIO::pcm_setup into 2 new methods 2015-09-02 12:07:14 +10:00
41211c984c Make two private methods in PortAudioIO const 2015-09-02 12:07:14 +10:00
8e0e3fcdee Refactor part of PortAudioIO::pcm_setup into new method 2015-09-02 12:07:14 +10:00
58cfd00e5a Add utility method to PortAudioIO class to remove goto from pcm_setup 2015-09-02 12:07:14 +10:00
d6f7066e80 Remove apple specific fixes from PortaudioBackend now that it is windows only 2015-09-02 12:07:14 +10:00
dd93aec029 Don't query supported sample rates for ASIO devices in PortaudioBackend
There has been reports this can take several minutes on some devices so just
return the default rates(and fail to open the device when a SR is specified
that isn't supported)
2015-09-02 12:07:14 +10:00
519f97b91d Use two private utility functions in PortaudioIO class for default SR's and buffer sizes 2015-09-02 12:07:14 +10:00
a272c50597 Move AudioBackend related debug bits into libardour
I put these in libpbd as that is where the debug bits are for the Waves backend
but I think it makes more sense for them to be in libardour as that is where
the AudioBackend class is defined

I left the Waves debug bits in libpbd for now.
2015-09-02 12:07:14 +10:00
201d91aedd Use PortaudioIO::get_current_host_api_type utility function in PortaudioIO class 2015-09-02 12:07:14 +10:00
c6c0654b5a Add Utility function to get host API type in PortaudioIO class 2015-09-02 12:07:14 +10:00
08d6dd153e Add "None" devices to PortaudioBackend
This allows for disabling either input or output, but not both
2015-09-02 12:07:14 +10:00
440e6cd591 Use AudioBackend standard device names for "Default" in PortaudioBackend 2015-09-02 12:07:14 +10:00
3a3d811e82 Use StandardDevices enum in PortaudioIO for default devices
This just makes it a bit easier to read through the code rather than using
magic numbers.
2015-09-02 12:07:14 +10:00
71e7b2fbd6 Set the default host api in PortaudioBackend when initializing portaudio
Not setting a default driver causes issues with the EngineControl dialog
2015-08-07 01:25:14 +10:00
529a625c39 Remove "Default" devices from the PortaudioBackend
These are not really necessary now that input and output devices can be
selected separately.
2015-08-05 23:37:50 +10:00
66cafd10d5 Use ASIO specific device channel names for port properties/pretty names 2015-08-05 13:21:30 +10:00
61e851da08 Add code to use ASIO supplied min/max buffer sizes but don't use it
RME HDSP: min == max == preferred size with granularity == 0
Focusrite scarlett 2i2: min = current ASIO setting and max = max buffersize the
device supports with a granularity of 1 which means hundreds of entries in the
dropdown menu.
2015-08-05 13:21:30 +10:00
7295bb6454 Refactor methods in PortaudioBackend to get ASIO buffer sizes 2015-08-05 13:21:26 +10:00
6ca1c8164f Add ASIO specific code to query preferred buffer size for device 2015-08-05 10:52:03 +10:00
55cd20d862 don’t set paClipOff, have portaudio clip to -1,+1
Fixes issues with some integer drivers where overflow wraps
(values > 1.0 end up at -1, producing a hard click)
2015-08-03 22:57:10 +02:00
cfbd9dd6d4 Add functionality to show ASIO control panel 2015-07-31 09:59:54 +10:00
fe50d06876 Implement AudioBackend::driver_name() in PortaudioBackend
This was missing and is necessary for EngineControl dialog to work properly
2015-07-31 09:59:54 +10:00
6a0e46352c Add extra DEBUG_TRACE output to PortaudioBackend 2015-07-31 09:59:54 +10:00
e258c827e2 WinMME based midi input/output for portaudio backend
TODO:

Use MMCSS to elevate thread priorities
Enable/test and fix SYSEX related code
2015-07-31 09:59:54 +10:00
b12f865a4a Fix for PortAudioBackend::available_sample_rates
Was being called without initializing PA. PA should probably be initialized in
ctor but PA backend also needs to support hot-plugging devices at some point so
this will do for now
2015-07-31 09:59:54 +10:00
6b7875de1e Support selecting separate input and output devices in portaudio backend 2015-07-31 09:59:54 +10:00
ff1d4d5c67 Refactor PortAudioIO::discover into three private methods 2015-07-31 09:59:54 +10:00
4e370feeb1 Set default input/output device based on selected host api rather than global default 2015-07-31 09:59:54 +10:00
e2001ac4f3 Fix crash when unable to open portaudio stream
Calling Pa_Terminate after failing to open stream causes an assertion
2015-07-31 09:59:54 +10:00
b6db19a5c6 Add host api/driver selection to PortaudioBackend 2015-07-31 09:59:54 +10:00
40c603c7e9 UTF8 encode windows device names - potential fix for #6418 2015-07-08 11:34:57 +02:00
9391da0c24 portaudio backend: allow Pa_GetDeviceInfo to fail. 2015-04-15 03:05:09 +02:00
a563007fcc add missing return value 2015-03-20 16:17:07 +01:00
26ce7b5f1b add a non-interleaved mode to the Portaudio backend 2015-03-20 11:45:56 +01:00