Commit graph

130 commits

Author SHA1 Message Date
Takashi Iwai
5a6ce31520 PCM: Fix infinite loop in htimestamp of dmix, dsnoop and dshare plugins
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-21 17:59:42 +02:00
Takashi Iwai
3c4a22ea49 Implement the channel mapping API
Added new channel-mapping API functions.
Not all plugins are covered, especially the route, multi and external
plugins don't work yet.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-11 11:34:50 +02:00
Jaroslav Kysela
13b5d972d2 pcm direct plugins: change timestamping in dsnoop
Do not use own timestamps, try to sync hw.ptr with real timestamp.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-10-29 17:36:41 +02:00
Jaroslav Kysela
b9dbee694a pcm direct plugins: drain() call might be blocked when threads are used
Add SETUP state checks and do modifications according latest ALSA driver
(passing wrong event identification).

ALSA bug#4914

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-03-03 10:58:53 +01:00
Jaroslav Kysela
7fd0d9f423 pcm_dmix: add support for S24_LE format
From: Bart De Vos <bart_dv@eia.be>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-03-02 14:01:32 +01:00
Clemens Ladisch
5332d74a67 fix doc errors
Fix various errors in the documentation that make doxygen complain.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-08-04 09:17:20 +02:00
Diego E. 'Flameeyes' Pettenò
8b14625cc3 Make all the PCM plugins ops structure constant.
This ensures they are emitted in .data.rel.ro rather than .data.rel,
which should make a nice difference when using prelink.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 20:38:49 +01:00
Jaroslav Kysela
c88672d86f implemented snd_pcm_rewindable() and snd_pcm_forwardable(), removed can_rewind and can_forward 2008-04-21 12:46:50 +02:00
Takashi Iwai
fe8bb13400 dmix skipping first set of samples
There was a change in alsa-lib 1.0.16 which looks like it was designed to
make dmix skip samples in the case of underruns, but it causes the first
sample to be skipped since dmix->slave_hw_ptr == dmix->slave_appl_ptr.
The following patch fixes this and fixes a small typo in the comment.

From: Mike Gorse <mgorse@mgorse.dhs.org>
2008-03-10 12:02:26 +01:00
Takashi Iwai
35d4f9b8d7 dmix - Enable auto format detection as default
The direct plugins have the automatic format-detection feature but it
wasn't enabled properly in the interface.  Now you can pass the format
"unchanged" to make the plugin detect a proper format.

This will change the default format of some drivers, such as, HD-audio.
2008-01-18 13:42:51 +01:00
Jaroslav Kysela
70b11d614d Implemented snd_pcm_rewind() for the dmix plugin 2008-01-10 10:01:14 +01:00
Jaroslav Kysela
2c1318803f Impemented snd_pcm_htimestamp() function. 2008-01-09 13:50:45 +01:00
Jaroslav Kysela
309a274454 Add support for monotonic timestamps 2008-01-09 11:13:34 +01:00
Clemens Ladisch
6e6f4b9c93 dmix: add U8 support
Add support for direct mixing of U8 samples (for devices like some USB
headsets or the Tux Droid).
2007-12-10 12:35:08 +01:00
Clemens Ladisch
a3fe1f7800 dmix: simplify mix_areas()
The code for the three supported sample widths is almost the same, so it
makes sense to merge the three cases.
2007-12-10 12:32:36 +01:00
Clemens Ladisch
79db4a6bfa dmix: rename mix_areas*
Rename all mix_areas* symbols so that they contain the sample width
instead of some meaningless number.
2007-12-10 12:31:29 +01:00
Takashi Iwai
683c8bc4a2 Clean up using gettimestamp()
Introduce a new local function gettimestamp() to get the current timestamp.
2007-11-21 12:19:43 +01:00
Takashi Iwai
7379b061eb Fix timestamp in status in PCM direct plugins
PCM direct plugins didn't update the timestamp properly.
Now it always starts the slave PCM with MMAP tstamp_mode so that the
timestamp will be being updated.  When a client is set up as MMAP
tstamp_mode as well, simply copy this slave timestamp.  Otherwise
status callback calculates the current timestamp as usual.
2007-11-21 12:10:35 +01:00
Takashi Iwai
d6093c58f3 snd_pcm_dmix_close: raise semaphore if unable to discard
This patch causes snd_pcm_dmix_close() to up a semaphore after downing it
if it is unable to discard it.  It prevents some deadlock that I am
getting when a couple of applications interact and one of them closes the
device and later re-opens it.

From: Mike Gorse <mgorse@mgorse.dhs.org>
2007-10-18 11:10:35 +02:00
Jaroslav Kysela
d25e281230 Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-15 10:24:55 +02:00
Takashi Iwai
267d7c7281 Add support of little-endian on i386/x86_64 dmix
i386/x86_64 alsa-lib may need to handle big-endian formats, e.g.
when running via qemu on PPC.  The generic dmix code already has
both endian support, so let's use it as fallback.
2007-07-03 19:52:33 +02:00
Takashi Iwai
8048321c76 More better fix for linked start/stop
Instead of link_fd, more generic callback link_slaves is introduced.
This is called for linking the slave streams as the source to the
given master stream.
2007-03-13 02:52:33 +01:00
Jaroslav Kysela
10cca7c03b pcm direct plugins - fix memory leak (sconf must be deleted) 2006-10-12 14:42:45 +02:00
Takashi Iwai
eafb7ae5d8 Use O_APPEND mode with dmix & co plugins
Use O_APPEND mode (only if available) with dmix, dsnoop and dshare
plugins.  Using this mode, the plugin requires no resource server
any more.
2006-04-28 15:55:32 +02:00
Takashi Iwai
6ff727bb7f Add check of binding ranges in direct plugins
Add checks of slave channel numbers in bindings of dmix/dsnoop/dshare
plugins to avoid segfault.
Also, fix a possible memory leaks in the error path.
2006-04-26 18:30:44 +02:00
Takashi Iwai
0b9612772c Revert the last fix: finer sync of dmix in delay callback
The fix to enable finer sync of dmix in delay callback seems
rather harmful for some apps like xmms on SMP.
The problem of aoss was solved by max_periods=0, so better to
revert this change.
2006-04-12 12:31:39 +02:00
Takashi Iwai
4c06a75a2f Finer sync of dmix in delay callback
Sync pointers in delay callback in dmix.  This solves some problems
of aoss with apps that don't check poll_revents.

The rate plugin is fixed to call delay of slave appropriately, too.
2006-04-06 19:01:02 +02:00
Takashi Iwai
1128efc7d4 Fix buffer size handling of direct plugins
Introduce "max_periods" option to specify the max number of periods
per buffer to each plugin.

- When max_periods = -1, the fixed buffer size as the slave size is
  used (old behavior).
- When max_periods = 0 (or 1), the number of periods is variable
  between 2 and the slave buffer size.
- When max_periods greater than 2 is given, it specifies the max
  periods of that pcm explicitly.

When no option is given in the PCM defintion, the value
"defaults.pcm.dmix_max_periods" is referred as default.
The default value is 0, as defined in alsa.conf.
You can override this in ~/.asoundrc or /etc/asound.conf as you like.
2006-04-06 18:49:11 +02:00
Takashi Iwai
09c5db44a4 Fix noisy output of dmix with two periods
Fixed the noisy output of dmix with two (or less) periods.
The dmix tends to give noise or XRUN when running with two periods
because of its implementation nature.  To avoid this, the start
position is aligned to the period size, so that the updates are synced
with interrupts of slave PCM.
2006-03-24 14:53:41 +00:00
Takashi Iwai
7e6c920836 dmix - Allow more flexible buffer sizes
With the patch, dmix allows apps to use more flexible buffer sizes.
The max buffer size is unlimited, and the minimal buffer size is
(period size * 2).  The buffer size is aligned to period size.

The period size is still bound to the period size of slave PCM.

To back to the old behavior (the fixed buffer size), you can set

   defaults.pcm.dmix_variable_buffer false

in your configuration.
2006-03-21 10:27:35 +00:00
Clemens Ladisch
8f61812f1c return ENODEV for disconnected devices
Return -ENODEV instead of -ENOTTY for disconnected devices.
2006-03-03 14:08:58 +00:00
Clemens Ladisch
4433248bf3 remove superfluous free() checks
free() correctly handles NULL pointers, so we can omit explicit checks
for that condition.
2006-02-27 09:58:32 +00:00
Takashi Iwai
eccc92a34d Fix infinite parse of recursive definitions
Fixed the infinite parse (and eventually segfault) of recursive definitions.
Also fixed the parse of a string slave PCM of direct plugins.
2006-01-30 14:41:51 +00:00
Takashi Iwai
7eff603576 Support multi-card/device for direct plugins
- Support multi-card/device for dmix/dsnoop/dshare plugins
  The unique ipc key is calculated based on card/device/sub index

- Clean up and share the code among all d* plugins

- Refer the defaults.pcm.* configuration
  The base ipc_key number, ipc_gid and ipc_perm are referred.
2006-01-16 13:15:32 +00:00
Takashi Iwai
0e15e6a97a Fix compile warnings
Fix compile warnings about cast signedness.
2006-01-10 11:03:02 +00:00
Clemens Ladisch
45f63a8735 dmix: add S24_3LE support
Add to the dmix plugin support for the S24_3LE sample format which is
used by 24-bit USB devices.

The optimized assembler version uses only 23 bits for sample data so
that the lowest bit can be used for synchronization because there is no
24-bit cmpxchg instruction.
2005-12-19 07:39:03 +00:00
Jaroslav Kysela
bdfbbed5ca pcm dump() routines update: use spaces to indent texts 2005-12-11 08:24:13 +00:00
Jaroslav Kysela
8b908f233d direct plugins - fixed ipc_gid initialization when gid specified as number 2005-12-04 09:19:11 +00:00
Takashi Iwai
8495f42feb abort snd_pcm_dmix_drain when state is SND_PCM_STATE_XRU
From: Sascha Sommer <saschasommer@freenet.de>

this is a fix for bug 0001559.
Unlike my first guesses the real problem is not in the kernel driver but in
alsa-lib. Whenever the current dmix status is xrun and snd_pcm_dmix_drain
gets called the process will hang forever in the poll function. The reason is
that poll gets called even though the timer already stopped.
As described in the bugtracking system this bug was not noticable with alsa
versions that used the old IOCTLS because the SNDRV_TIMER_IOCTL_STOP ioctl
never reached the timer kernel module.

Attached patch fixes this problem for alsa-lib 1.0.10 by simply calling
snd_pcm_dmix_drop when snd_pcm_dmix_drain gets called in the state
SND_PCM_STATE_XRUN.
2005-11-21 10:47:42 +00:00
Takashi Iwai
5bf3b31cf1 Fix endianess with dmix plugin
Allow different endianess with the generic dmix code, mainly for
big-endian architectures.
2005-09-19 12:37:08 +00:00
Takashi Iwai
ea77e08cc6 Misc fixes
Fixes of spots found via valgrind

- non-freed chunks after snd_config_get_ascii()
- zero-fill records (to make valgrind happy)
- compile warning fixes
2005-08-17 17:27:16 +00:00
Jaroslav Kysela
bac9a7de83 direct plugins (dmix) - suspend/resume fixes
- this patch adds support for suspend & result for dmix and other
  direct plugins
- the timer detection / initialization (TREAD support) was redesigned and
  the check for proper driver version was moved to the timer_hw.c
2005-08-16 12:19:15 +00:00
Takashi Iwai
e80f80866f Fix direct plugins running on 32bit emulation with 64bit arch
Fix the problems of dmix/dsnoop/dshare plugins running on 32bit mode with
64bit biarch.
2005-08-12 15:53:02 +00:00
Takashi Iwai
6c7f60f7a9 Fix boundary overlap
Fixed the possible bug with boundary overlap in dmix code.
2005-06-16 14:03:15 +00:00
Takashi Iwai
b69ab56881 Fix bugs in the last change of ipc_gid option
- Fix semaphore gid control
- Do semaphore discard for all semaphores (although currently defined as 1)
- Fix the wrong check of return value from shmctl
2005-05-30 17:56:12 +00:00
Jaroslav Kysela
4b7e3cff81 added ipc_gid for direct plugins 2005-05-30 10:13:54 +00:00
Takashi Iwai
087184b0f9 Fix doxygen documents
Fix the warnings of doxygen parsing.
Add some missing documentation.
2005-05-24 14:14:28 +00:00
Takashi Iwai
dd37bb20ee Move poll_* callbacks to fast_ops
Moved poll_* callbacks to fast_ops.
These callbacks may be called frequently indeed.
2005-05-23 09:03:16 +00:00
Takashi Iwai
a3ae02d884 Fix semaphore deadlocks
- Fixed unbalanced semaphores (which may cause deadlock)
- Do semaphore-up before blocking calls for communication with the server
- Don't discard semaphores on the client side
- Open slave PCMs always in non-blocking mode to avoid blocking by semaphore
  with the secondary open
2005-05-23 08:56:48 +00:00
Takashi Iwai
1661759351 Minor clean up of dmix codes
Minor clean up of dmix codes.
2005-05-23 08:49:58 +00:00