Commit graph

2194 commits

Author SHA1 Message Date
Takashi Iwai
81241ffb81 Change numid properly with external ctl plugins
So far, external ctl plugins don't change numid.  Some apps expect the
non-zero numids with list, and the plugin doesn't work for them.

This patch adds a fake numid to each control based on the offset
number.  The lookup with non-zero numid is supported but is pretty
inefficient.  Eventually the plugin side may be optimized to look
at the numid, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-17 16:58:12 +01:00
Clemens Ladisch
91f1b4b96f oxygen: remove softvol plugin
The change that removed the Master controls for Xonar D2(X) cards was
reverted, so we don't need to use the softvol plugin anymore ...

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-02-17 09:45:57 +01:00
Takashi Iwai
e38f921625 Add hint.device = 0 to pcm.default of HDA-Intel.conf
The hd-audio driver may have no analog stream but only a digital one
which has usually non-zero device number.  To avoid the bogus namehint,
set hint.device 0 for pcm.default (it wasn't handled properly due to
asym).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-13 17:19:52 +01:00
Clemens Ladisch
1009f9859c fix pcm_set_params() documentation
The documentation for the latency parameter of pcm_set_params() says
that the value 0 uses an optimal value.  This is wrong, as there is no
special handling for 0, and the result will be a buffer of minimal size.
Therefore, remove that incorrect statement.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-02-11 09:53:29 +01:00
Takashi Iwai
548dd9be90 Fix misc compile warnings
Shut up misc compile warnings from gcc:
  pcm_plug.c: In function ‘snd_pcm_plug_change_mmap’:
  pcm_plug.c:608: warning: enumeration value ‘SND_PCM_ACCESS_MMAP_INTERLEAVED’ not handled in switch
  pcm_plug.c:608: warning: enumeration value ‘SND_PCM_ACCESS_MMAP_NONINTERLEAVED’ not handled in switch
  pcm_plug.c:608: warning: enumeration value ‘SND_PCM_ACCESS_MMAP_COMPLEX’ not handled in switch

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-02 16:11:39 +01:00
Takashi Iwai
cb66600dd3 Fix handling of revents in snd_pcm_poll_descriptors_revents()
The revents parameter is ambiguously defined whether it's a pointer
to a single event or an arary.

This patch defines the behavior of revents more strictly (in the
function description): it's a pointer of a single event.

Also fixed snd_pcm_wait_nocheck() to follow that rule.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-02 16:10:08 +01:00
Pavel Hofman
59ebaa8e9d PCM parameters in file plugin
* added support for including pcm stream params in the output filename
* added support for piping the stream to a shell command if the filename
  string starts with a pipe char

Signed-off-by: Pavel Hofman <pavel.hofman@insite.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-29 11:59:27 +01:00
Takashi Iwai
56fa81fdab Remove own "default" PCM config from GUS.conf
The system-wide default PCM config works now (by the fix of plug
mmap_emul support), thus no card-specific hackish config is needed
for GUS.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-28 09:07:53 +01:00
Takashi Iwai
d3a8e853fb Fix plug conversion with mmap emulation
If the slave PCM supports only another type of interleaved format,
plug did convert it wrongly and resulted in an unused access type
error.  For example, if a slave PCM supporst only RW_NONINTERLEAVE
access and you try to play an interleaved format file, it resulted
in an error.

This patch fixes the conversion rule.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-27 17:21:34 +01:00
Krzysztof Helt
777a869769 Fix GUS.conf to be usable
Fix GUS.conf to work for default PCM.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-27 11:44:14 +01:00
Takashi Iwai
a789b66d00 Fix build with softfloat option
Fix build of alsa-lib when --with-softfloat is used:
 - disable ladspa plugin
 - don't use sqrt() function

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-21 09:25:48 +01:00
Clemens Ladisch
c8567c5870 add softvol for CMI8788
Master Volume controls were removed from Xonar D2/D2X cards; add the
softvol plugin so that we have at least PCM volume.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-01-19 10:20:38 +01:00
Takashi Iwai
0400fa6f8d Don't accept an empty string for $ALSA_CONFIG_PATH
The variable $ALSA_CONFIG_PATH specifies the config path, but the current
code accepts the empty string and results in a mysterious error because
no config file is found.

This patch fixes the check of the variable and takes the default value
if the string is empty.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-12-10 18:20:50 +01:00
Takashi Iwai
48e4d089dc Fix softvol access refine
The commit a13707da6b

    pcm_softvol plugin: remove access type change for refine

breaks the softvol in the case of RW -> MMAP.  The slave of softvol
must be an mmap although the previous fix forces RW access.

This patch reverts the commit, and the fixed access refine method
to hanle non-interleaved <-> interleaved changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-12-04 16:01:22 +01:00
Takashi Iwai
c0fd854ff1 Fix snd-pcsp default configuration
The softvol must be inside the plug.  Otherwise it gets stuck.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-26 14:09:06 +01:00
Diego E. 'Flameeyes' Pettenò
03388ca6d3 Mark static tables as constant when possible.
This makes it possible to write them to .data.rel.ro or to .rodata if
there is no relocation involved (arrays of character arrays).

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 22:39:38 +01:00
Diego E. 'Flameeyes' Pettenò
fc8d8bb2e6 Make string arrays as constant as possible.
Use "const char *const []" as type for string arrays, or convert to
"const char [][x]" when it makes sense.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 22:14:52 +01:00
Diego E. 'Flameeyes' Pettenò
2eaf9403d2 Make all the remaining ops structure constants.
This excludes the mixer for now since it requires a change to the
public headers.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 20:48:33 +01: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
Diego E. 'Flameeyes' Pettenò
1f734e3058 Make snd_pcm_hw_params_names static to pcm_params.c .
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 20:28:56 +01:00
Diego E. 'Flameeyes' Pettenò
2289326673 Make seq, rawmidi and control operation structures static const.
Since they are never changed it does not make sense to have them in
the writeable .data section, just make sure to add const to the ops
member in the structure definitions so that there are no extra
warnings added.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 20:28:38 +01:00
Diego E. 'Flameeyes' Pettenò
8ed98db259 Make some static tables and strings constants.
By doing this we move them from the .data section to .rodata setion,
or from .data.rel to .data.rel.ro.

The .rodata section is mapped directly from the on-disk file, which is
always a save, while .data.rel.ro is mapped directly when using
prelink, which is a save in a lot of cases.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 13:04:41 +01:00
Diego E. 'Flameeyes' Pettenò
0b92e53cf9 Check for --no-undefined linker flag and use it.
This adds extra safety that the built libraries will have all the
correct dependencies linked in.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
2008-11-21 13:04:26 +01:00
Takashi Iwai
73ddcda842 Fix segfault with invalid meter plugin option
snd_pcm_meter_add_scope_conf() may cause a segfault when pcm_scope_type
isn't defined.

Initialize type_conf properly to avoid it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-19 16:14:27 +01:00
Takashi Iwai
cb1fd837d9 Add linear plugin wrapping iec958 PCM for ice1724-based boards
The ice1724-based cards can handle only 32bit while the apps almost
expet 16bit format for SPDIF I/O.  This prevents the default config
working on many apps like mplayer, xine, etc.

This patch simply adds the least automatic conversion by linear plugin.
Note that "plug" isn't used here.  Otherwise we get a problem of the
routing (plug over plug is buggy).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-19 14:59:03 +01:00
Takashi Iwai
55c77d0ec2 Fix volume/switch updates for global/simple mixer elements
Fixed a long-standing bug that the values of global or simple mixer
elements aren't updated when dir = SM_CAPT is given.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-10 17:39:11 +01:00
Takashi Iwai
3b3eac25ab Add iec958 PCM definition for PS3
Added the iec958 PCM definition for PS3.
Since it's a new feature, the definition is marked as optional.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-20 11:26:20 +02:00
Takashi Iwai
3b2c53c2a6 Fix sort-out of non-existing devices in namehint
get_dev_name() checks wrongly the device_output, and it doesn't check
properly the case when only device is set and device_input and output
are unset.  This resulted in listing of non-existing HDMI device, for
example.  The patch fixes both issues.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-17 17:51:45 +02:00
Takashi Iwai
1cf904e894 Fix return value of snd_ctl_hw_subscribe_events()
snd_ctl_subscribe_events() must return 0 when succeeded.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-09-30 14:44:12 +02:00
Takashi Iwai
5cee69b47b Replace some assert() with runtime checks
assert() for sanity checks that can happen in runtime isn't a good idea.
Replaced it with the real check.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-09-30 14:43:14 +02:00
Jaroslav Kysela
1dd1ba94a3 Fix comment typos for snd_pcm_read[in]()
From: William Estrada <MrUmunhum@popdial.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-09-09 19:58:59 +02:00
Jaroslav Kysela
a13707da6b pcm_softvol plugin: remove access type change for refine
The softvol plugin does in-place sample recalculation. The access type
cannot be changed like in linear plugins. Remove access type change
in refine functions.

This bug was detected with PulseAudio on Sony PS3 platform.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-09-09 13:10:55 +02:00
Jaroslav Kysela
fe5391c9da Add snd_pcm_avail() and snd_pcm_avail_delay() functions. Make snd_pcm_hwsync() deprecated.
As proposed in http://mailman.alsa-project.org/pipermail/alsa-devel/2008-June/008558.html
the snd_pcm_avail() and snd_pcm_avail_delay() functions are now available
to get accurate stream position in a straight way. The snd_pcm_avail_delay()
function was added to ensure full sync between avail and delay values. It's
actually implemented using delay() + avail_update() calls but it might be
changed in future.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-09-01 11:38:53 +02:00
Lennart Poettering
bd7b73a621 alsa-lib: Reword doxygen doc for snd_pcm_delay()
snd_pcm_delay() is for synchronization purposes, it returns the overall latency
of the stream, not just the latency induced by the hardware playback buffer.
The documentation is a bit misleading about this fact, and some people already
misunderstood it. So let's reword this to make the explanation clearer and
explicit.

This is a result of the discussions of the thread this mail belongs to:

http://mailman.alsa-project.org/pipermail/alsa-devel/2008-June/008456.html

From: Lennart Poettering <mznyfn@0pointer.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-31 15:46:22 +02:00
Lennart Poettering
73d20069e0 alsa-lib: Make sure SND_PCM_NO_xxx flags don't get lost when nonblocking mode is enabled
The plug PCM copies the 'mode' field from the slave PCM. If blocking mode is
enabled for the plug PCM the mode is subsequently overwritten with the original
requested 'mode'. If non-blocking mode is requested this does not happen.

Because the hw PCM synthesizes the 'mode' from the actual file descriptor flags
no SND_PCM_NO_xxx will ever be set for it. This has the effect that the 'mode'
of the plug PCM will also not include those flags anymore -- unless they are
overwritten as mentioned above. This basically means SND_PCM_NO_xxx is ignored
for plug:hw:4711 style device strings opened in non-blocking mode.

You can easily test this with "aplay --channels 7 --disable-channels -f S16_LE
-r 44100 -D plug:hw:0" on a device that cannot do 7 channels. Normally this
call should fail, however if you add "-N" to the command line this call will
succeed.

This patch simply copies the SND_PCM_NO_xxx flags back into the 'mode' field in
case we don't overwrite it with the original anyway.

Probably closes bug 3571 for good.

From: Lennart Poettering <mznyfn@0pointer.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-31 15:45:18 +02:00
Takashi Iwai
ddf063f499 Fix non-tread mode with PCM direct plugins
tread=0 wasn't set properly for very old ALSA drivers with no timer
tread support.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-07-31 12:18:08 +02:00
Takashi Iwai
118fedb90a Fix interleave check in pcm_direct.c
Fix the check of interleaved format.  It checked a totally bogus value
as PCM format.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-07-29 14:41:51 +02:00
Lennart Poettering
8d3fb3102f fix return value of snd_pcm_rewind()/snd_pcm_forward() to return how much actually has been rewound, instead of what actually could have rewound
Make snd_pcm_plugin_rewind()/_forward() actually return how much has
been rewound/forwarded instead of how much could have been
rewounded/forwarded. This makes the code actually do what the
documentation of snd_pcm_rewind() suggests.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-07-20 17:27:57 +02:00
Lennart Poettering
15769ead72 fix type of internally used sframes variable, to avoid unnecessary casts
This minor patch fixes the type of the sframes variable in
snd_pcm_plugin_forward(). With this fix we need to cast less and the
code is less confusing.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-07-20 17:26:55 +02:00
Lennart Poettering
0fbfe2d8d6 clamp snd_pcm_rewind()/snd_pcm_forward() into the right direction
The clamping of the input parameter in snd_pcm_rewind()/_forward() is
in the wrong direction.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-07-20 17:25:53 +02:00
Takashi Iwai
f78af4ab04 Add boolean (mute) functionality to softvol plugin
When the resolution is set to 2, a boolean control is created as a
mute switch instead of a volume control.
Also, fixed the possible zero-division error.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-07-16 12:37:51 +02:00
Jaroslav Kysela
5e91207586 pcm: fix comment for snd_pcm_avail_update()
In some cases, value might be used for r/w ops, too.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-06-16 13:23:22 +02:00
Josh Green
2076b88a77 Fix segfault with dmix of 3-bytes formats
The i386 and x86-64 dmix may cause segfaults when 3-bytes formats are used
due to btsl asm code, which may overcome the buffer end-boundary.
The patch changes btsl to btsw so that it doesn't happen.

ALSA bug#3341:
	https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3341

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-07 10:10:49 +02:00
Takashi Iwai
1467f4e238 PCM: allow mmap-access conversion in plug
The plug plugin has a long-standing problem that it can handle only
slaves that support mmap because of format/rate/access conversions
(these corresponding plugins work only with mmap).

This patch adds the support of automatic mmap->rw conversion via
mmap_emul plugin.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-06 17:10:41 +02:00
Takashi Iwai
538726cc55 Export __snd_pcm_mmap_emul_open()
Export __snd_pcm_mmap_emul_open() for plug layer.  This isn't exported
globally, though.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-06 17:09:07 +02:00
Takashi Iwai
8843cf11e0 pcm_mmap_emul: clean up
A little bit of code clean up.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-06 17:07:45 +02:00
Takashi Iwai
2db108cc72 pcm_mmap_emul: Fix invalid check
The check in snd_pcm_mmap_emul_refine() is bogus and buggy.

Since the changed access type is took back at snd_pcm_mmap_emul_refine
again, it has to check the availability of mmap at each time.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-06 17:05:56 +02:00
Takashi Iwai
b6af5e1822 Fix compile warnings in pcm_hw.c
Two trivial compile warning fixes:

- Add a missing return to snd_pcm_hw_clear_timer_queue()
- params->info is no long but int

The second one might have hit already on 64bit machine, but alas,
no one didn't notice it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-06 16:59:47 +02:00
Takashi Iwai
fce17b8c47 Fix cast warning
int64_t and long long isn't strictly identical, and thus gcc gives us
a heartful warning.  Suppress the warning by a pointer cast.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-06 16:58:02 +02:00
Jaroslav Kysela
8aaccc9484 Implemented snd_pcm_sw_params_(set|get)_period_event for interrupt wakeup like behaviour
Actually, PCM timer is used as source for poll(). It might be optimized
in the kernel code later.
2008-05-09 16:02:02 +02:00