summaryrefslogtreecommitdiff
path: root/src/seq
Commit message (Collapse)AuthorAgeFilesLines
* add NetBSD/OpenBSD build support (except test/)SASANO Takayoshi2022-10-171-0/+2
| | | | | | Fixes: https://github.com/alsa-project/alsa-lib/pull/250 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* seq: fix snd_seq_parse_address()Jaroslav Kysela2021-05-261-12/+30
| | | | | | | | Use safe_strtol() for the integer conversion. Also accept client name in "" or '' notation. BugLink: https://github.com/alsa-project/alsa-utils/issues/90 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: add LibraryConfig supportJaroslav Kysela2021-04-131-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit allows to define private alsa-lib's configuration. When the configuration is present, the device values ("PlaybackCTL", "CaptureCTL", "PlaybackMixer", "CaptureMixer", "CapturePCM") are prefixed with '_ucmHEXA.' string where HEXA is replaced by the unique hexadecimal number identifying the opened ucm manager handle. Syntax 4 LibraryConfig.a_label.SubstiConfig { # substituted library configuration like: usr_share_dir "${ConfLibDir}" } LibraryConfig.b_label.Config { # non-substituted library configuration like: usr_share_dir "/usr/share/alsa" } The File counterparts: LibraryConfig.c_label.SubstiFile "/some/path" LibraryConfig.d_label.File "/some/path" Note that for files the contents is substituted on the request, but the file name is always substituted (useful for ${ConfDir} etc.). The private configuration is not saved or preserved. It's life time belongs to the opened ucm manager handle. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* add snd_strlcpy() and use it everywhereJaroslav Kysela2019-03-251-5/+5
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* seq: Fix signedness in MIDI encoder/decoderTakashi Iwai2018-08-231-1/+3
| | | | | | | | | | | | | | | | | | | The qlen field of struct snd_midi_event was declared as size_t while status_events[] assigns the qlen to -1 indicating to skip. This leads to the misinterpretation since size_t is unsigned, hence it passes the check "dev.qlen > 0" incorrectly in snd_midi_event_encode_byte(), which eventually results in a memory corruption. Also, snd_midi_event_decode() doesn't consider about a negative qlen value and tries to copy the size as is. This patch fixes these issues: the first one is addressed by simply replacing size_t with ssize_t in snd_midi_event struct. For the latter, a check "qlen <= 0" is added to bail out; this is also good as a slight optimization. Reported-by: Prashant Malani <pmalani@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* core: Proper reference of internal snd_dlopen()Takashi Iwai2018-01-041-1/+1
| | | | | | | | | | snd_dlopen() was recently rewritten to be versioned symbols, and we have to call it with INTERNAL() wrapper from the library itself. Add the proper declaration in the local header and fix the callers appropriately. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Change snd_dlopen() function to return the error stringJaroslav Kysela2017-11-271-3/+3
| | | | | | | The dlopen() function might fail also for another reason than a missing file, thus return the error string from dlerror(). Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* Change FSF address (Franklin Street)Jaroslav Kysela2017-11-146-6/+6
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* seq: fix snd_seq_set_queue_tempo() usage example in the documentationAntonio Ospite2017-10-031-2/+2
| | | | | | | | | | | snd_seq_set_queue_tempo() requires a queue id as the second argument, fix the example in documentation to reflect that. Also add the queue id as an argument of the set_tempo() function, just to keep the whole example compilable. Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* cleanup: fix poll.h includesNatanael Copa2017-07-121-1/+1
| | | | | | | | | | | | | | According POSIX[1] and linux manpage[2] the include is poll.h, not sys/poll.h. This fixes the he following compiler warning when build with musl libc: /usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp] #warning redirecting incorrect #include <sys/poll.h> to <poll.h> ^~~~~~~ Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* seq: improve documentation about new get pid/card functionsAdam Goode2017-01-031-2/+42
| | | | | | | | | | Document the technique for determining if the running kernel supports the new snd_seq_client_info_get_pid and snd_seq_client_info_get_card functions. Also add a little information about how to use these functions and add some cross references. Signed-off-by: Adam Goode <agoode@google.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* conf: Add thread-safe global tree referenceTakashi Iwai2016-05-171-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of open functions in alsa-lib have the call pattern: snd_config_update(); return snd_xxx_open(x, snd_config, ...); This means that the toplevel config gets updated, and passed to a local open function. Although snd_config_update() itself has a pthread mutex to be thread safe, the whole procedure above isn't thread safe. Namely, the global snd_config tree may be deleted and recreated at any time while the open function is being processed. This may lead to a data corruption and crash of the program. For avoiding the corruption, this patch introduces a refcount to config tree object. A few new helper functions are introduced as well: - snd_config_update_ref() does update and take the refcount of the toplevel tree. The obtained config tree has to be freed via snd_config_unref() below. - snd_config_ref() and snd_config_unref() manage the refcount of the config object. The latter eventually deletes the object when all references are gone. Along with these additions, the caller of snd_config_update() and snd_config global tree in alsa-lib are replaced with the new helpers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* seq: Provide sequencer sound card number / PID via alsa-libMartin Koegler2016-03-082-1/+37
| | | | | | | | | | | | | | | | | rawmidi devices expose the card number via IOCTLs, which allows to find the corresponding device in sysfs. The sequencer provides no identifing data. Chromium works around this issue by scanning rawmidi as well as sequencer devices and matching them by using assumtions, how the kernel register sequencer devices. This changes adds support for exposing the card number for kernel clients as well as the PID for user client. It supports kernels with and without the required support. Signed-off-by: Martin Koegler <martin.koegler@chello.at> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Allow hint for ctl, hwdep, timer and seqTakashi Iwai2015-04-301-3/+1
| | | | | | | | | | | Like pcm and rawmidi, each object parser needs to accept the hint component. Now a new local function _snd_conf_generic_id() was introduced to replace each call of "comment" and "type" field checks. Also, the two existing identical functions for pcm and rawmidi are removed and the new function is used commonly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* autotools: update stylePatrick Welche2014-02-261-1/+1
| | | | | | | | | - rename configure.in to configure.ac - replace INCLUDES with AM_CPPFLAGS - modernize AM_INIT_AUTOMAKE invocation Signed-off-by: Patrick Welche <prlw1@cam.ac.uk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* seqmid: restore sequencer address prefix match featureClemens Ladisch2013-05-131-11/+16
| | | | | | | | | | | | | Commit 19892334499e (seq: Fix for snd_seq_parse_address()) removed the ability to match sequencer client names by any of by their prefixes in an attempt to avoid wrong matches when one client name is the prefix of another. However, the prefix match feature was documented and actually used. Allow prefixes to match, but only if there is no exact match. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
* Merge kernel uapi/sound/asound.h and asequencer.hTakashi Iwai2012-11-263-18/+18
| | | | | | | | | | | | | | | | | | | Instead of keeping modified asound.h and asequencer.h, copy the files in the kernel include/uapi/sound as is, and give some renames for avoiding conflicts with alsa-lib's definitions. Some structs, unions and typedefs in asound.h and asequencer.h are once renamed in local.h before inclusion, then renamed back again. A bonus by this action is that some local codes don't have to refer to sndrv_xxx any longer. However, some codes like src/seq/seq.c need explicit cast because of unavoidable conflicts of struct types. Another significant change is that now snd_pcm_sw_params.period_event field is removed. Instead, try to access the last reserved field internally. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Reduce compilation warningsJaroslav Kysela2012-10-301-1/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* seqmid - more descriptions on snd_seq_parse_address() behaviorHenning Thielemann2012-03-141-1/+10
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* seq: Fix for snd_seq_parse_address()Pedro Lopez-Cabanillas2010-04-221-1/+2
| | | | | | | | | | | | 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>
* Remove old commented-out FD_CLOEXEC codeRémi Denis-Courmont2009-11-081-11/+0
| | | | | Signed-off-by: Rémi Denis-Courmont <remi@remlab.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* fix doc errorsClemens Ladisch2009-08-041-5/+5
| | | | | | Fix various errors in the documentation that make doxygen complain. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
* more midi_event documentationClemens Ladisch2009-07-061-54/+194
| | | | | | Expand the documentation for the snd_midi_event_* functions. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
* seq_midi_event: fix decoding of (N)RPN eventsClemens Ladisch2009-06-221-4/+4
| | | | | | | | 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>
* MIDI event decoder: prevent running status after sysexClemens Ladisch2009-06-221-0/+1
| | | | | | | | 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>
* Fix typos in ALSA Lib documentationPatricio Paez2009-02-232-24/+24
| | | | | Signed-off-by: Patricio Paez <pp@pp.com.mx> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Make seq, rawmidi and control operation structures static const.Diego E. 'Flameeyes' Pettenò2008-11-212-2/+2
| | | | | | | | | 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>
* Make some static tables and strings constants.Diego E. 'Flameeyes' Pettenò2008-11-211-5/+5
| | | | | | | | | | | 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>
* mark snd_seq_client_info_{get,set}_event_filter deprecatedAldrin Martoq2008-02-221-6/+17
| | | | | | Mark snd_seq_client_info_{get,set}_event_filter deprecated Signed-off-by: Aldrin Martoq <amartoq@dcc.uchile.cl>
* use snd_seq_client_info_event_filter_*() functionsAldrin Martoq2008-02-221-2/+1
| | | | | | | Change snd_seq_set_client_event_filter to use the new snd_seq_client_info_event_filter_* API Signed-off-by: Aldrin Martoq <amartoq@dcc.uchile.cl>
* add snd_seq_client_info_event_filter_*() functionsAldrin Martoq2008-02-221-0/+81
| | | | | | | Added snd_seq_client_info_event_filter_{clear,add,del,check} to alsa sequencer API Signed-off-by: Aldrin Martoq <amartoq@dcc.uchile.cl>
* add snd_seq_unset_bit()Aldrin Martoq2008-02-221-0/+8
| | | | | | Added snd_seq_unset_bit() to alsa sequencer API Signed-off-by: Aldrin Martoq <amartoq@dcc.uchile.cl>
* Fix snd_seq_change_bit()Takashi Iwai2008-02-211-1/+1
| | | | | | snd_seq_change_bit() doesn't change but only set. From: Aldrin Martoq <amartoq@dcc.uchile.cl>
* Remove sequencer instrument layerTakashi Iwai2007-10-304-269/+225
| | | | | | | Remove obsoleted sequencer instrument layer from alsa-lib. The old symbols are compiled in as default as dummy functions (unless --disable-old-symbols is given to configure) so that the old binaries can still work more or less.
* Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.czJaroslav Kysela2007-10-155-6/+6
|
* seq_midi_event: fix parsing of F9/FD bytesClemens Ladisch2007-08-101-1/+1
| | | | | Check for a valid event type when encoding a system real-time message to prevent the bytes F9 or FD resulting in an empty sequencer message.
* seq_midi_event: fix parsing of missing data bytesClemens Ladisch2007-08-101-39/+41
| | | | | Reorganize the encoder logic to prevent status bytes that appear where data bytes are expected from being interpreted as data bytes.
* seq_midi_event: prevent running status after system messagesClemens Ladisch2007-08-101-0/+2
| | | | | | Reset the event type after encoding a system message to prevent any following data bytes from being interpreted as data for a running status system message, which is not allowed in MIDI.
* seq_midi_event: fix encoding of data bytes after end of sysexClemens Ladisch2007-08-101-7/+8
| | | | | | Create a new state ST_INVALID for the encoder to prevent data bytes at the beginning of a stream or after a sysex message being interpreted as note-off parameters.
* Allow build without libdl and libpthreadTakashi Iwai2007-03-221-1/+0
| | | | | Allow building alsa-lib without libdl and libpthread. Added new options to configure, --with-libdl and --with-pthread.
* Fix build of static libraryTakashi Iwai2006-10-271-1/+1
| | | | | | - Add missing pcm_empty entry - Return the array pointer instead of the first array member. Otherwise only the first entry is linked to the binary.
* change iface argument for namehint function to const char *Jaroslav Kysela2006-10-271-1/+1
| | | | remove snd_ctl_iface_conf_name function
* clarify SND_SEQ_PORT_TYPE_xxx documentationClemens Ladisch2006-05-021-3/+3
| | | | | Clarify the documentation for the SND_SEQ_PORT_TYPE_xxx flags, especially for _SYNTH and *_SAMPLE where it was rather misleading.
* add more sequencer port type information bitsClemens Ladisch2006-05-021-1/+6
| | | | | | Add four new information flags SNDRV_SEQ_PORT_TYPE_HARDWARE, _SOFTWARE, _SYNTHESIZER, _PORT for sequencer ports. This makes it easier for apps like Rosegarden to make policy decisions based on the port type.
* Fix missing snd_dlclose() in sequencerTakashi Iwai2006-04-252-1/+11
| | | | Call snd_dlclose() with the dlopen handle in snd_seq_close().
* allow changing of device directory pathClemens Ladisch2006-02-271-2/+2
| | | | | | Add configuration options to change the default device path from the default /dev/snd. This is useful for embedded systems that do not want subdirectories in /dev.
* fix a typoClemens Ladisch2006-02-271-1/+1
| | | | Fix a memory leak in an error path of snd_seq_hw_open().
* remove superfluous free() checksClemens Ladisch2006-02-272-12/+6
| | | | | free() correctly handles NULL pointers, so we can omit explicit checks for that condition.
* Do not abort in snd_xxx_close() functionsClemens Ladisch2006-02-272-5/+5
| | | | | | Remove several memory leaks by not aborting prematurely from a snd_xxx_close() function when some operation fails. This can happen when a USB device was unplugged.
* Fix infinite parse of recursive definitionsTakashi Iwai2006-01-301-3/+18
| | | | | Fixed the infinite parse (and eventually segfault) of recursive definitions. Also fixed the parse of a string slave PCM of direct plugins.