Chris Robinson
a6974a6c83
Don't try to read the internal capture buffer into itself
2014-05-14 21:20:28 -07:00
Chris Robinson
f311f74001
Avoid freeing an in-use capture buffer
...
When stopping, ALSA may capture into its own storage buffer. Do not free
the storage buffer if it first reads from it.
2014-05-14 03:22:42 -07:00
Chris Robinson
f150676873
Add a helper VECTOR_FOR_EACH macro
2014-04-30 12:30:02 -07:00
Chris Robinson
83970369e0
More device list cleanup cleanup
2014-04-24 02:33:54 -07:00
Chris Robinson
8fd224f841
Avoid forward-declaring backend vtables
2014-04-23 03:52:05 -07:00
Chris Robinson
0d2521e30e
Use a vector to store the ALSA device lists
2014-04-21 23:01:50 -07:00
Chris Robinson
df3c54a4bf
Use al_string for ALSA's device map
2014-04-21 20:53:27 -07:00
Chris Robinson
ad71565e45
Trace the device name being opened in ALSA and PulseAudio
2014-04-21 20:26:29 -07:00
Chris Robinson
36df67f546
Rename SetThreadName to althrd_setname
2014-04-17 20:41:32 -07:00
Chris Robinson
d124aee4d7
Remove the old thread wrappers for the new ones
2014-04-16 06:11:40 -07:00
Chris Robinson
7b93e10f7a
Use an al_string for the device name
2014-03-28 22:11:34 -07:00
Chris Robinson
d8bfd12d31
Use a void* for the backend Delete method param
2014-03-22 00:28:55 -07:00
Chris Robinson
191e8172f0
Use a macro to help condense some repeated code
2013-11-24 18:11:45 -08:00
Chris Robinson
3d921e0e6f
Make backend factory methods static as needed
2013-11-02 16:35:05 -07:00
Chris Robinson
9f0e49917d
Add default handlers for reset, captureSamples, and availableSamples
2013-10-29 15:07:13 -07:00
Chris Robinson
d4aa4e16a0
Add a macro to forward methods to a base type
2013-10-29 11:22:18 -07:00
Chris Robinson
3c65c946d4
Fix capture with the new backend interface
2013-10-28 22:03:54 -07:00
Chris Robinson
16d5d5760c
Convert ALSA to the new backend interface
2013-10-28 21:56:14 -07:00
Chris Robinson
f24cb44781
Move the device mutex to the backend
2013-10-28 12:05:33 -07:00
Chris Robinson
8ceb800def
Rework threading functions
2013-10-27 08:14:13 -07:00
Chris Robinson
f93bfab824
Set a name for the mixer and recording threads
2013-10-27 07:00:44 -07:00
Chris Robinson
01a5946a2e
Compile using -std=c99 when available
2013-10-03 05:45:12 -07:00
Chris Robinson
6bf8f01af5
Report the actual ALSA error if setting the buffer metrics fails
2013-03-18 05:21:41 -07:00
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