Chris Robinson
1fb9311d82
Lock the device before calling aluHandleDisconnect
...
PulseAudio causes an assert if being relocked inside a callback on the worker
thread, where aluHandleDisconnect is called. We can assume it's already locked
there, so just make sure the device is locked before being calling it.
2012-12-02 11:30:23 -08:00
Chris Robinson
0f3a575a09
Don't include alu.h in alMain.h
2012-09-14 02:14:29 -07:00
Chris Robinson
2b5fdad2c8
Free the global ALSA config after opening capture devices too
2012-09-02 14:26:46 -07:00
Lauri Kasanen
a6f9ede849
alsa: Free the global config cache to remove a lot of reported leaks
...
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
2012-09-02 14:16:23 -07:00
Chris Robinson
f2fa5e7c88
Print the error when reporting snd_pcm_delay failure
2012-08-27 22:52:37 -07:00
Chris Robinson
a56a974149
Hold the device lock with ALSA between mixing and writing
2012-08-18 17:18:53 -07:00
Chris Robinson
af7f3768fa
Use non-blocking access for ALSA playback
2012-08-18 17:01:56 -07:00
Chris Robinson
0865db564f
Move the device lock into the backend function table
...
For backend-specific implementations: this should hold the audio mixer loop for
playback devices, and provide recursive mutex behavior.
2012-08-18 15:58:04 -07:00
Chris Robinson
ac4fc4026c
Add a device method to retrieve the active latency
...
This is effectively the time until the next update will be heard by the user,
or the closest approximation thereof, in nanoseconds.
2012-08-17 13:38:52 -07:00
Chris Robinson
051195a991
Avoid failing if ALSA can't set a buffer or period time near to our request
...
These functions should not fail, but there seem to be bugs that cause them to
sometimes. We're flexible enough to handle almost anything it throws back at us
though, so anything is better than nothing here.
2012-06-16 23:02:59 -07:00
Chris Robinson
259e4f5b38
Rename AllDevice -> AllDevices
2012-05-09 16:28:16 -07:00
Chris Robinson
e44229c74e
Clamp the ALSA period time between min and max if setting near fails
2012-05-08 01:23:53 -07:00
Chris Robinson
92827cc467
Clamp the ALSA buffer time between min and max if setting near fails
...
It seems there's some bugs with snd_pcm_hw_params_set_buffer_time_near that
cause it to return "invalid argument" despite a valid nearby buffer time being
available. Clamping the buffer time seems to mitigate the issue a bit.
2012-05-07 11:42:59 -07:00
Chris Robinson
5418519637
Remove some more hungarian notation
2012-04-19 23:00:58 -07:00
Chris Robinson
b023dbe7b8
Remove hungarian notation from the device and context structs
2012-04-19 22:50:11 -07:00
Chris Robinson
fe6e532c87
Use a separate backend callback to start playback of the device
...
This allows us to properly update the ALCdevice and its resources with the new
parameters before starting playback, instead of expecting the mixer to block
and wait after it has begun.
This also lets us avoid holding the device lock while resetting and starting
the device, which helps prevent lock inversion on some backends (ie, one thread
locking A then B, and another thread locking B then A), ultimately allowing
certain backends to asynchronously update the ALCdevice without risk of lockup.
Capture still has issues here, however.
2012-03-05 07:11:09 -08:00
Chris Robinson
e5d365a3d9
Avoid an unnecessary doCapture check
2012-03-01 20:47:49 -08:00
Chris Robinson
06debb153d
Fix a memory leak
2012-03-01 09:56:25 -08:00
Chris Robinson
55556f0e6c
Avoid enumerating when opening the default ALSA device
2012-03-01 04:58:28 -08:00
Chris Robinson
85daab0d5e
Don't define lib handles when dynamic loading is disabled
2012-03-01 03:46:45 -08:00
Chris Robinson
e88f954cbf
Allow reading audio from ALSA directly if the requested length is supported
2012-02-29 10:01:45 -08:00
Chris Robinson
4b88168edb
Use a switch to handle the ALSA PCM state
2012-02-27 04:31:03 -08:00
Chris Robinson
f29fbdf088
Print enumerated ALSA devices
2012-02-26 23:02:29 -08:00
Chris Robinson
6ba0fd25a2
Remove an unneeded wrapper
2012-02-22 18:08:15 -08:00
Chris Robinson
4f0d862cbe
Set the default ALSA device name when probing
2012-02-20 20:59:55 -08:00
Chris Robinson
e2ccc6f98e
Always use "OpenAL Soft" for the short device enumeration list
2012-02-20 20:45:22 -08:00
Chris Robinson
771ef3e8d5
Rename p -> hp for ALSA's hw params
2012-02-20 12:46:09 -08:00
Chris Robinson
4a65747a4b
Add a COUNTOF macro to get the number of entries in a static array
2012-02-19 12:07:40 -08:00
Chris Robinson
592fb2b913
Make sure an ALSA capture device was found before accessing the map
2012-02-18 12:39:17 -08:00
Chris Robinson
f68f3f5f86
Simplify ALSA parameter error checking
2012-02-18 12:34:58 -08:00
Chris Robinson
5f23860880
Rename a couple variables and fix their types
2012-02-18 11:07:54 -08:00
Chris Robinson
faf59a7cba
Fix some comments
2012-02-18 11:03:42 -08:00
Chris Robinson
1140b3ae83
Support signed and unsigned 32-bit int output
2012-02-14 11:44:57 -08:00
Chris Robinson
5e1d1a52ba
Check for each ALSA prefix config option only as needed
2012-02-13 10:33:53 -08:00
Chris Robinson
b375b130ba
Add config options for card- and device-specific prefixes in ALSA device names
2012-02-11 09:36:40 -08:00
Chris Robinson
3fb6351212
Format the ALSA device name when enumerating them
2012-02-11 06:55:24 -08:00
Chris Robinson
b4b492c417
Improve checks for supported output formats from ALSA
2012-02-09 22:26:16 -08:00
Chris Robinson
deb84cfdac
Improve a couple error messages with the full ALSA device control name
2012-02-07 07:04:33 -08:00
Chris Robinson
ae7b61b040
Avoid printing messages about device parameter changes in the backends
2012-01-17 16:38:58 -08:00
Chris Robinson
6a97f6a327
Reset the ALSA device if the number of available samples grows too large
2011-11-28 10:24:24 -08:00
Chris Robinson
dfd02817fa
Make ALSA XRUN when the number of available samples exceeds the buffer size
2011-11-28 09:12:30 -08:00
Chris Robinson
edb386eb1e
Add a ConfigValueStr function, to return the string through a parameter
2011-09-19 11:29:18 -07:00
Chris Robinson
cc3dd648ac
Check the number of available samples before calling the capture method
2011-09-18 20:27:34 -07:00
Chris Robinson
97024151e4
Return an error from the CaptureSamples method instead of setting it
2011-09-14 02:01:35 -07:00
Chris Robinson
62dfea43c6
Limit the minimum ALSA capture size to 100ms, and the maximum period size to 50ms
2011-09-13 23:51:22 -07:00
Chris Robinson
7e2155d937
Return an ALC error enum from the OpenCapture backend method
2011-08-24 14:44:15 -07:00
Chris Robinson
c696d4dbb2
Return an ALC error enum from the OpenPlayback backend method
2011-08-24 14:24:48 -07:00
Chris Robinson
9989f33fc2
Move backend sources to a separate sub-directory
2011-08-20 00:41:47 -07:00