If user asks for 1dB the snd_tlv_convert_from_dB will not find
the raw value, since the 1dB is not part of either range.
To fix this, we will store the previous non maching range's
maximum raw value. If the dB value is not found in the next range,
we will check, if the requested dB value is in between the current
and the previous range, and if it is than pick the apropriate raw
value based on the xdir (up or down rounding).
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Peter Ujfalusi [Wed, 19 May 2010 06:19:26 +0000 (08:19 +0200)]
control: tlv: Check dB range only within the control's volume range
The DB_RANGE need to be used on some HW, since the gain on
volume control is not continuous, and has to be divided into
several sub DB_SCALE ranges.
ASoC has a feature to override the HW default volume range,
and in this case when the volume range is less than the
HW maximum we do not need to go through the whole DB_RANGE,
but we need to stop where the kcontrol's maximum tell us.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
snd_seq_parse_address() uses strncmp() to compare the client name
in the string argument with the existing clients, until it finds one
name matching the same leading characters. This may produce wrong
results when there are two sequencer clients with similar names.
Example: "KMidimon" : "Kmid"
Signed-off-by: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
setlocale() is not thread-safe. It can actually trigger a crash if
another thread uses locale informations at the same time in the process.
Library code should use POSIX newlocale/duplocale/uselocale/freelocale
instead. Those functions only change the locale data for the calling
thread.
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
David Fries [Fri, 25 Dec 2009 20:22:38 +0000 (14:22 -0600)]
modem.conf Off-hook improve behavior
Only restore the old value if it differs from the requested
value, because if it has changed restoring the old value
overrides the change. Take for example, a voice modem with
a .conf that sets preserve off-hook. Start playback (on-hook
to off-hook), start record (off-hook to off-hook), stop
playback (off-hook to restore on-hook), stop record (on-hook
to restore off-hook), Clearly you don't want to leave the
modem "on the phone" now that there isn't any playback or
recording active.
Signed-off-by: David Fries <david@fries.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Mon, 21 Dec 2009 08:09:42 +0000 (09:09 +0100)]
pcm: Close event timer in pcm_hw plugin
Dan McCombs discovered that snd_pcm_close() invocations are not leading
to associated timers being closed, which results in successively more
timers being created but not freed.
Original patch from Daniel T Chen <crimsun@ubuntu.com>.
Clemens Ladisch [Mon, 23 Nov 2009 09:56:46 +0000 (10:56 +0100)]
mixer: fix enum check
The recent CHECK_ENUM fix uncovered a bug in snd_mixer_selem_is_enumerated()
which would now return -EINVAL for any non-enum control, which would be
interpreted as 'true' by callers like amixer or alsamixer.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Michael Olbrich [Mon, 16 Nov 2009 10:31:49 +0000 (11:31 +0100)]
simple_none.c uses HAVE_SOFT_FLOAT it has to include config.h
for this to work properly.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Sun, 8 Nov 2009 08:26:23 +0000 (09:26 +0100)]
Fix CHECK_ENUM() in simple.c
simple.c: In function ‘snd_mixer_selem_is_enumerated’:
simple.c:881: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’
Jaroslav Kysela [Tue, 3 Nov 2009 15:36:55 +0000 (16:36 +0100)]
namehint: add missing list->card initialization
list->card is wrongly assumed to be initialized, but the previous
initialization is within a conditional that is false when only
card-independent devices are found. (This is the case when searching
for mixers on my system; the end result is that the "pulse" mixer is
listed three times.)
Signed-off-by: John Lindgren <john.lindgren@tds.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Tue, 3 Nov 2009 15:34:34 +0000 (16:34 +0100)]
Cache libasound.so access in snd_dlopen
Speed up repeated calls to snd_dlopen by caching the path to
libasound.so; this reduces the instructions executed by
snd_device_name_hint by 40 percent.
Signed-off-by: John Lindgren <john.lindgren@tds.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Takashi Iwai [Tue, 3 Nov 2009 07:57:10 +0000 (08:57 +0100)]
Fix corruption after snd_device_name_hint()
snd_device_name_hint() corrupts the config name space after its call.
This results in the error from the suceeding calls of snd_pcm_open()
after snd_device_name_hint().
The bug is in try_config() in namehint.c; it calls snd_config_delete(res)
but res can be two different objects in the function. One is the object
obtained via snd_config_search_definition(), and another is the one from
snd_config_search_alias_hooks(). The former is the expanded objects,
thus it should be freed. But, the latter is a reference, and must not be
freed.
This patch adds the check to free or not.
Reported-by: John Lindgren <john.lindgren@tds.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Schmidt [Tue, 29 Sep 2009 21:48:20 +0000 (23:48 +0200)]
configure.in: Add m4 check for new AM_SILENT_RULES
Kbuild like output for automake (>=1.11). It's no hard dependency as it needs
the newest automake, but enable it by default if it is available. To turn it off
you can either use --disable-silent-rules at configure time or make V=0 at
compile time.
Signed-off-by: Stefan Schmidt <stefan@slimlogic.co.uk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Call the slave snd_pcm_info() as long as possible in the direct plugins
(i.e. when the PCM device could be opened with O_APPEND mode).
This allows dmix/dsnoop as a salve for PCM hook controls.
Kai Vehmanen [Thu, 10 Sep 2009 22:07:21 +0000 (01:07 +0300)]
pcm_hw: Always use delay ioctl in snd_pcm_delay()
As the result of snd_pcm_delay() is affected not only by hw_ptr
and appl_ptr, but also by 'runtime->delay' property,
either SNDRV_PCM_IOCTL_DELAY or SNDRV_PCM_IOCTL_STATUS ioctl
must be used to get the correct result.
Previously 'runtime->delay' was ignored in case 'hw->sync_ptr'
was used.
Signed-off-by: Kai Vehmanen <kvehmanen@eca.cx> Signed-off-by: Takashi Iwai <tiwai@suse.de>
In snd_pcm_hw_params_choose(), set the buffer size before the period
size and time as default. This will give more useful configuration for
most of apps, i.e. larger buffer size.
For apps that require the old behavior, now the function checks the
environment variable $LIBASOUND_COMPAT. If this variable is set to
non-empty, the hw_params is determined in the old way, first period
then buffer sizes.
Takashi Iwai [Thu, 20 Aug 2009 23:18:00 +0000 (01:18 +0200)]
pcm: workaround for avoiding automatic start in mmap mode
In the normal mmap mode, the stream isn't started automatically even after
the data >= start_threshold has been written. However, in the
mmap-emulation mode, the stream is started because it uses
snd_pcm_write_areas() internally.
As a workaround for this inconsistency, start_threshold value is changed
dynamically in sw_parmams and mmap_commit callbacks in mmap-emul plugin.
Meanwhile, start_threshold for slave PCM is set to boundary so that only
this plugin (or the one over it) can control the start of the stream.
This will fix problems in some apps using pulse plugin in the mmap mode.
Takashi Iwai [Mon, 10 Aug 2009 12:11:57 +0000 (14:11 +0200)]
Fix driver conf parsing in snd_config_hook_load_for_all_cards()
Reported by Kevin Goodsell.
Summary: load_for_all_cards fails with existing configuration elements
In snd_config_hook_load_for_all_cards, the first call to
snd_config_search attempts to locate an existing configuration node with
the name of the driver. Typically none is found, and everything is
good. However, if such a node is located, the next line assumes it is a
leaf node with type 'string' and calls snd_config_get_string to fetch
the string value. If this fails, the entire hook is abandoned.
Because of this, setting something like the following in asoundrc:
cards.<driver name>.foo 0
is sufficient to disable the entire card-specific configuration.
As a concrete example, I have a HDA-Intel sound card. dmix.conf includes
a way to set period_size, period_time, and periods by using
configuration elements of the form cards.<driver name>.pcm.dmix.<var>.
In ~/.asoundrc I add
cards.HDA-Intel.pcm.dmix.period_size 1024
This will cause HDA-Intel.conf to fail to load, and the pcm defined in
default.conf will fail to find the device-specific pcm
cards.HDA-Intel.pcm.default, and fall back on the default pcm using
plughw. By attempting to configure dmix, I have disabled it.
Clemens Ladisch [Mon, 10 Aug 2009 08:09:02 +0000 (10:09 +0200)]
timer_query: make ops structure constant
The contents of the snd_timer_query_ops structure are not going to be
changed, so we might as well declare is as constant. This change avoids
a warning if some ops structure is actually defined as const.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Clemens Ladisch [Mon, 10 Aug 2009 08:08:25 +0000 (10:08 +0200)]
snd_pcm_scope_set_ops: make ops parameter const
The contents of the snd_pcm_scope_ops structure are not going to be
changed, so we might as well declare is as constant. This change is
backwards compatible, and avoids warnings if some ops structure is
actually defined as const.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Clemens Ladisch [Tue, 4 Aug 2009 07:15:40 +0000 (09:15 +0200)]
doc: hide structs with typedefs
In the documentation, hide structure types that have a corresponding
typedef. Since doxygen 1.5.4, this is no longer the default when
OPTIMIZE_OUTPUT_FOR_C is set.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Clemens Ladisch [Wed, 15 Jul 2009 09:20:29 +0000 (11:20 +0200)]
conf.c: snd_config_add: prevent adopting a non-orphan
When adding a configuration node to another, check that the child node
does not already have a parent. Otherwise, the old parent's children
list would become corrupted.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Clemens Ladisch [Mon, 13 Jul 2009 11:53:16 +0000 (13:53 +0200)]
sound: rawmidi: disable active-sensing-on-close by default
Sending an Active Sensing message when closing a port can interfere with
the following data if the port is reopened and a note-on is sent before
the device's timeout has elapsed. Therefore, it is better to disable
this setting by default.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Clemens Ladisch [Fri, 10 Jul 2009 05:25:50 +0000 (07:25 +0200)]
conf.c: snd_config_set_id: prevent duplicate ids
snd_config_add() checks for duplicate ids, but it was possible to create
duplicates by adding a note and changing the id afterwards with
snd_config_set_id(); so we have to add a check there, too.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Clemens Ladisch [Thu, 9 Jul 2009 05:38:26 +0000 (07:38 +0200)]
conf.c: fix handling of NULL ids
Make sure that we do not crash when encountering configuration nodes
with a NULL id. Furthermore, since we cannot avoid having NULL ids
anyway, allow the id of a top-level node to be reset to NULL.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Takashi Iwai [Tue, 30 Jun 2009 09:11:34 +0000 (11:11 +0200)]
Manage dlobj lifetime in pcm_hooks.c
The shared object may be still needed depending on the implementation
of hook-installation functions. When any hooks are registered in the
installation function, the dlobj has to be kept opened until closing
the PCM instance.
Clemens Ladisch [Mon, 22 Jun 2009 08:00:46 +0000 (10:00 +0200)]
seq_midi_event: fix decoding of (N)RPN events
When decoding (N)RPN sequencer events into raw MIDI commands, the
extra_decode_xrpn() function had accidentally swapped the MSB and LSB
controller values of both the parameter number and the data value.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Clemens Ladisch [Mon, 22 Jun 2009 08:00:03 +0000 (10:00 +0200)]
MIDI event decoder: prevent running status after sysex
Running status cannot be using in the command immediately following
a system exclusive command, so we have to reset the running status
state in that case.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Takashi Iwai [Tue, 2 Jun 2009 14:13:01 +0000 (16:13 +0200)]
Query the supported rate ranges from rate plugins
Extend the PCM-rate plugin protocol to allow the host to query the
supported sample rates. The protocol version is bumped to 0x010002,
and the version number negotiaion is slightly changed.
Now the plugin is supposed to fill the version it supports in return.
The old versioned plugins are still supported, but they may spew
version-mismatch warning prints.