├── po
├── LINGUAS
├── POTFILES.in
└── Makevars
├── m4
└── Makefile.am
├── amixer
├── volume_mapping.c
├── volume_mapping.h
├── Makefile.am
├── go
└── amixer.h
├── include
├── gettext_curses.h
├── gettext.h
├── Makefile.am
├── os_compat.h
└── bswap.h
├── seq
├── Makefile.am
├── aseqdump
│ ├── Makefile.am
│ └── aseqdump.1
├── aseqsend
│ ├── Makefile.am
│ └── aseqsend.1
├── aplaymidi
│ ├── Makefile.am
│ ├── aplaymidi.1
│ └── arecordmidi.1
├── aplaymidi2
│ ├── Makefile.am
│ ├── aplaymidi2.1
│ └── arecordmidi2.1
├── aconnect
│ ├── Makefile.am
│ ├── README.aconnect
│ └── aconnect.1
└── aseqnet
│ ├── Makefile.am
│ ├── README.aseqnet
│ └── aseqnet.1
├── alsaconf
├── alsaconf.fr.8
├── Makefile.am
├── po
│ └── Makefile.in
└── alsaconf.8
├── speaker-test
├── samples
│ ├── Noise.wav
│ ├── Rear_Left.wav
│ ├── Side_Left.wav
│ ├── Front_Center.wav
│ ├── Front_Left.wav
│ ├── Front_Right.wav
│ ├── Rear_Center.wav
│ ├── Rear_Right.wav
│ ├── Side_Right.wav
│ └── Makefile.am
├── Makefile.am
├── readme.txt
├── pink.h
├── st2095.h
└── pink.c
├── utils
├── Makefile.am
├── buildrpm
└── alsa-utils.spec.in
├── alsa-info
├── Makefile.am
└── alsa-info.sh.8
├── amidi
└── Makefile.am
├── alsamixer
├── proc_files.h
├── device_name.h
├── card_select.h
├── die.h
├── mainloop.h
├── configparser.h
├── mixer_display.h
├── menu_widget.h
├── mem.h
├── textbox.h
├── go
├── utils.h
├── mixer_clickable.h
├── volume_mapping.h
├── widget.h
├── colors.h
├── Makefile.am
├── curskey.h
├── mixer_controls.h
├── mixer_widget.h
├── die.c
├── mem.c
├── menu_widget.c
├── bindings.h
├── proc_files.c
└── mixer_clickable.c
├── alsactl
├── .gitignore
├── init
│ ├── Makefile.am
│ ├── help
│ ├── info
│ ├── ca0106
│ ├── hda
│ └── 00main
├── conf
│ ├── alsa-card-wait@.service.in
│ ├── alsa-state.service.in
│ ├── alsa-restore.service.in
│ └── 90-alsa-restore.rules.in
├── init_sysdeps.c
└── Makefile.am
├── bat
├── tests
│ ├── asound_state
│ │ └── Makefile.am
│ ├── Makefile.am
│ ├── map_test_case
│ ├── README
│ ├── hdmi_audio_subdevice_number.sh
│ ├── dp_audio_subdevice_number.sh
│ ├── dp_audio_playback.sh
│ ├── hdmi_audio_playback.sh
│ └── analog_audio_playback_and_capture.sh
├── analyze.h
├── Makefile.am
├── alsa.h
├── latencytest.h
├── tinyalsa.h
├── convert.h
├── bat-signal.h
└── convert.c
├── TODO
├── nhlt
├── Makefile.am
└── nhlt-dmic-info.1
├── iecset
├── Makefile.am
└── iecset.1
├── alsaucm
├── Makefile.am
├── go.sh
└── usecase.h
├── alsaloop
├── Makefile.am
├── test.sh
└── effect-sweep.c
├── topology
├── nhlt
│ ├── intel
│ │ ├── ssp
│ │ │ ├── ssp-debug.h
│ │ │ └── ssp-intel.h
│ │ ├── dmic
│ │ │ ├── dmic-debug.h
│ │ │ ├── dmic-intel.h
│ │ │ └── dmic-process.h
│ │ ├── dmic-nhlt.h
│ │ ├── ssp-nhlt.h
│ │ ├── intel-nhlt.h
│ │ └── intel-nhlt.c
│ └── Makefile.am
├── Makefile.am
├── topology.h
├── pre-process-external.h
└── alsatplg.rst
├── acinclude.m4
├── axfer
├── subcmd.h
├── misc.h
├── test
│ ├── Makefile.am
│ └── generator.h
├── waiter-poll.c
├── Makefile.am
├── frame-cache.h
├── axfer-list.1
├── container-raw.c
├── waiter.h
├── xfer-libasound.h
├── mapper.h
├── waiter.c
├── waiter-epoll.c
├── waiter-select.c
├── axfer.1
├── frame-cache.c
└── xfer.h
├── aplay
└── Makefile.am
├── gitcompile
├── ChangeLog
├── Makefile.am
├── README.md
├── .gitignore
├── INSTALL
└── .github
└── workflows
└── coverity.yml
/po/LINGUAS:
--------------------------------------------------------------------------------
1 | de eu fr ja ka ko sk
2 |
--------------------------------------------------------------------------------
/m4/Makefile.am:
--------------------------------------------------------------------------------
1 | EXTRA_DIST = gettext.m4
2 |
--------------------------------------------------------------------------------
/amixer/volume_mapping.c:
--------------------------------------------------------------------------------
1 | ../alsamixer/volume_mapping.c
--------------------------------------------------------------------------------
/amixer/volume_mapping.h:
--------------------------------------------------------------------------------
1 | ../alsamixer/volume_mapping.h
--------------------------------------------------------------------------------
/include/gettext_curses.h:
--------------------------------------------------------------------------------
1 | #define USES_CURSES
2 | #include "gettext.h"
3 |
--------------------------------------------------------------------------------
/seq/Makefile.am:
--------------------------------------------------------------------------------
1 | SUBDIRS=aconnect aplaymidi aplaymidi2 aseqdump aseqnet aseqsend
2 |
--------------------------------------------------------------------------------
/alsaconf/alsaconf.fr.8:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alsa-project/alsa-utils/HEAD/alsaconf/alsaconf.fr.8
--------------------------------------------------------------------------------
/speaker-test/samples/Noise.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alsa-project/alsa-utils/HEAD/speaker-test/samples/Noise.wav
--------------------------------------------------------------------------------
/utils/Makefile.am:
--------------------------------------------------------------------------------
1 | EXTRA_DIST = buildrpm
2 |
3 | rpm: buildrpm alsa-lib.spec
4 | VERSION=$(VERSION) $(srcdir)/buildrpm
5 |
--------------------------------------------------------------------------------
/alsa-info/Makefile.am:
--------------------------------------------------------------------------------
1 | EXTRA_DIST = alsa-info.sh alsa-info.sh.8
2 | sbin_SCRIPTS = alsa-info.sh
3 | man_MANS = alsa-info.sh.8
4 |
--------------------------------------------------------------------------------
/speaker-test/samples/Rear_Left.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alsa-project/alsa-utils/HEAD/speaker-test/samples/Rear_Left.wav
--------------------------------------------------------------------------------
/speaker-test/samples/Side_Left.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alsa-project/alsa-utils/HEAD/speaker-test/samples/Side_Left.wav
--------------------------------------------------------------------------------
/speaker-test/samples/Front_Center.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alsa-project/alsa-utils/HEAD/speaker-test/samples/Front_Center.wav
--------------------------------------------------------------------------------
/speaker-test/samples/Front_Left.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alsa-project/alsa-utils/HEAD/speaker-test/samples/Front_Left.wav
--------------------------------------------------------------------------------
/speaker-test/samples/Front_Right.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alsa-project/alsa-utils/HEAD/speaker-test/samples/Front_Right.wav
--------------------------------------------------------------------------------
/speaker-test/samples/Rear_Center.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alsa-project/alsa-utils/HEAD/speaker-test/samples/Rear_Center.wav
--------------------------------------------------------------------------------
/speaker-test/samples/Rear_Right.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alsa-project/alsa-utils/HEAD/speaker-test/samples/Rear_Right.wav
--------------------------------------------------------------------------------
/speaker-test/samples/Side_Right.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alsa-project/alsa-utils/HEAD/speaker-test/samples/Side_Right.wav
--------------------------------------------------------------------------------
/amidi/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 | EXTRA_DIST = amidi.1
3 |
4 | bin_PROGRAMS = amidi
5 | man_MANS = amidi.1
6 |
--------------------------------------------------------------------------------
/alsamixer/proc_files.h:
--------------------------------------------------------------------------------
1 | #ifndef PROC_FILES_H_INCLUDED
2 | #define PROC_FILES_H_INCLUDED
3 |
4 | void create_proc_files_list(void);
5 |
6 | #endif
7 |
--------------------------------------------------------------------------------
/seq/aseqdump/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 | EXTRA_DIST = aseqdump.1
3 |
4 | bin_PROGRAMS = aseqdump
5 | man_MANS = aseqdump.1
6 |
--------------------------------------------------------------------------------
/seq/aseqsend/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 | EXTRA_DIST = aseqsend.1
3 |
4 | bin_PROGRAMS = aseqsend
5 | man_MANS = aseqsend.1
6 |
--------------------------------------------------------------------------------
/alsactl/.gitignore:
--------------------------------------------------------------------------------
1 | conf/90-alsa-restore.rules
2 | conf/alsa-state.service
3 | conf/alsa-store.service
4 | conf/alsa-restore.service
5 | conf/alsa-card-wait@.service
6 |
--------------------------------------------------------------------------------
/alsamixer/device_name.h:
--------------------------------------------------------------------------------
1 | #ifndef DEVICE_NAME_FORM_H_INCLUDED
2 | #define DEVICE_NAME_FORM_H_INCLUDED
3 |
4 | void create_device_name_form(void);
5 |
6 | #endif
7 |
--------------------------------------------------------------------------------
/bat/tests/asound_state/Makefile.am:
--------------------------------------------------------------------------------
1 | alsabat_cfg_files = asound.state.Broadwell \
2 | asound.state.Haswell \
3 | asound.state.Skylake
4 |
5 | EXTRA_DIST = \
6 | $(alsabat_cfg_files)
7 |
--------------------------------------------------------------------------------
/alsamixer/card_select.h:
--------------------------------------------------------------------------------
1 | #ifndef CARD_SELECT_H_INCLUDED
2 | #define CARD_SELECT_H_INCLUDED
3 |
4 | void create_card_select_list(void);
5 | void close_card_select_list(void);
6 |
7 | #endif
8 |
--------------------------------------------------------------------------------
/seq/aplaymidi/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 | EXTRA_DIST = aplaymidi.1 arecordmidi.1
3 |
4 | bin_PROGRAMS = aplaymidi arecordmidi
5 | man_MANS = aplaymidi.1 arecordmidi.1
6 |
--------------------------------------------------------------------------------
/TODO:
--------------------------------------------------------------------------------
1 | H add options to aplay to avoid xrun using arecord | aplay
2 | M Rewrite aplay/arecord tool and separate the experimental stuff
3 | M Write a *good* mixer
4 | L Add support for OSS setups to alsactl
5 |
--------------------------------------------------------------------------------
/alsactl/init/Makefile.am:
--------------------------------------------------------------------------------
1 |
2 | init_files = \
3 | 00main default help info test \
4 | hda ca0106
5 | EXTRA_DIST = $(init_files)
6 | alsainitdir = $(datadir)/alsa/init
7 | alsainit_DATA = $(init_files)
8 |
--------------------------------------------------------------------------------
/seq/aplaymidi2/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 | EXTRA_DIST = aplaymidi2.1 arecordmidi2.1
3 |
4 | bin_PROGRAMS = aplaymidi2 arecordmidi2
5 | man_MANS = aplaymidi2.1 arecordmidi2.1
6 |
--------------------------------------------------------------------------------
/nhlt/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 |
3 | bin_PROGRAMS = nhlt-dmic-info
4 | nhlt_dmic_info_SOURCES = nhlt-dmic-info.c
5 | man_MANS = nhlt-dmic-info.1
6 | EXTRA_DIST = nhlt-dmic-info.1
7 |
--------------------------------------------------------------------------------
/seq/aconnect/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 | EXTRA_DIST = README.aconnect aconnect.1
3 | LDADD = $(LIBINTL)
4 |
5 | bin_PROGRAMS = aconnect
6 | aconnect_SOURCES = aconnect.c
7 | man_MANS = aconnect.1
8 |
--------------------------------------------------------------------------------
/seq/aseqnet/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 | EXTRA_DIST = README.aseqnet aseqnet.1
3 |
4 | bin_PROGRAMS = aseqnet
5 | aseqnet_SOURCES = aseqnet.c
6 | aseqnet_LDADD = $(INTLLIBS)
7 | man_MANS = aseqnet.1
8 |
--------------------------------------------------------------------------------
/alsamixer/die.h:
--------------------------------------------------------------------------------
1 | #ifndef DIE_H_INCLUDED
2 | #define DIE_H_INCLUDED
3 |
4 | void fatal_error(const char *msg) __attribute__((__noreturn__));
5 | void fatal_alsa_error(const char *msg, int err) __attribute__((__noreturn__));
6 |
7 | #endif
8 |
--------------------------------------------------------------------------------
/alsamixer/mainloop.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINLOOP_H_INCLUDED
2 | #define MAINLOOP_H_INCLUDED
3 |
4 | #include CURSESINC
5 |
6 | void initialize_curses(bool use_color, bool use_mouse);
7 | void mainloop(void);
8 | void app_shutdown(void);
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/iecset/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 | LDADD = -lm
3 | # LDFLAGS = -static
4 | # CFLAGS += -g -Wall
5 |
6 | bin_PROGRAMS = iecset
7 | iecset_SOURCES = iecset.c iecbits.c
8 | man_MANS = iecset.1
9 | EXTRA_DIST = iecset.1
10 |
--------------------------------------------------------------------------------
/alsamixer/configparser.h:
--------------------------------------------------------------------------------
1 | #ifndef CONFIGPARSER_H_INCLUDED
2 | #define CONFIGPARSER_H_INCLUDED
3 |
4 | #define CONFIG_DEFAULT ((const char*) 1)
5 |
6 | void parse_config_file(const char *file);
7 | void parse_default_config_file();
8 |
9 | #endif
10 |
--------------------------------------------------------------------------------
/alsamixer/mixer_display.h:
--------------------------------------------------------------------------------
1 | #ifndef MIXER_DISPLAY_H_INCLUDED
2 | #define MIXER_DISPLAY_H_INCLUDED
3 |
4 | void init_mixer_layout(void);
5 | void display_card_info(void);
6 | void display_view_mode(void);
7 | void display_controls(void);
8 | void compute_controls_layout(void);
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/alsamixer/menu_widget.h:
--------------------------------------------------------------------------------
1 | #ifndef MENU_WIDGET_H_INCLUDED
2 | #define MENU_WIDGET_H_INCLUDED
3 |
4 | #include "widget.h"
5 | #include
6 |
7 | int menu_widget_handle_key(MENU *menu, int key);
8 | void menu_widget_create(struct widget *widget, MENU *menu, const char *title);
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/speaker-test/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 | SUBDIRS= samples
3 | LDADD = $(LIBINTL) -lm
4 |
5 | bin_PROGRAMS = speaker-test
6 | speaker_test_SOURCES = speaker-test.c pink.c st2095.c
7 | man_MANS = speaker-test.1
8 | EXTRA_DIST = readme.txt speaker-test.1 pink.h st2095.h
9 |
10 |
--------------------------------------------------------------------------------
/po/POTFILES.in:
--------------------------------------------------------------------------------
1 | alsamixer/card_select.c
2 | alsamixer/cli.c
3 | alsamixer/device_name.c
4 | alsamixer/die.c
5 | alsamixer/mixer_display.c
6 | alsamixer/mixer_widget.c
7 | alsamixer/proc_files.c
8 | alsamixer/textbox.c
9 | aplay/aplay.c
10 | seq/aconnect/aconnect.c
11 | seq/aseqnet/aseqnet.c
12 | speaker-test/speaker-test.c
13 |
--------------------------------------------------------------------------------
/alsamixer/mem.h:
--------------------------------------------------------------------------------
1 | #ifndef MEM_H_INCLUDED
2 | #define MEM_H_INCLUDED
3 |
4 | #include
5 |
6 | void *ccalloc(size_t n, size_t size);
7 | void *crealloc(void *ptr, size_t new_size);
8 | char *cstrdup(const char *s);
9 | char *casprintf(const char *fmt, ...) __attribute__((__format__(printf, 1, 2)));
10 |
11 | #endif
12 |
--------------------------------------------------------------------------------
/amixer/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CFLAGS = -D_GNU_SOURCE
2 | AM_CPPFLAGS = -I$(top_srcdir)/include
3 | LDADD = -lm
4 | # LDFLAGS = -static
5 | # CFLAGS += -g -Wall
6 |
7 | bin_PROGRAMS = amixer
8 | amixer_SOURCES = amixer.c volume_mapping.c
9 | noinst_HEADERS = amixer.h volume_mapping.h
10 | man_MANS = amixer.1
11 | EXTRA_DIST = amixer.1
12 |
--------------------------------------------------------------------------------
/bat/tests/Makefile.am:
--------------------------------------------------------------------------------
1 | SUBDIRS=asound_state
2 | alsabat_script_files = analog_audio_playback_and_capture.sh \
3 | dp_audio_playback.sh \
4 | dp_audio_subdevice_number.sh \
5 | hdmi_audio_playback.sh \
6 | hdmi_audio_subdevice_number.sh \
7 | map_test_case \
8 | README
9 |
10 | EXTRA_DIST = \
11 | $(alsabat_script_files)
12 |
--------------------------------------------------------------------------------
/alsamixer/textbox.h:
--------------------------------------------------------------------------------
1 | #ifndef TEXTBOX_H_INCLUDED
2 | #define TEXTBOX_H_INCLUDED
3 |
4 | void show_error(const char *msg, int err);
5 | void show_alsa_error(const char *msg, int err);
6 | void show_text(const char *const *text_lines, unsigned int count,
7 | const char *title);
8 | void show_textfile(const char *file_name);
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/alsactl/conf/alsa-card-wait@.service.in:
--------------------------------------------------------------------------------
1 | #
2 | # ALSA card initialization handler for cards in waiting state
3 | # This service is triggered by udev when ALSA_CARD_STATE=waiting
4 | #
5 |
6 | [Unit]
7 | Description=ALSA Card Initialization for card %I
8 |
9 | [Service]
10 | Type=oneshot
11 | RemainAfterExit=no
12 | ExecStart=@sbindir@/alsactl@args@ wrestore %i
13 |
--------------------------------------------------------------------------------
/speaker-test/readme.txt:
--------------------------------------------------------------------------------
1 | To make or build just type
2 |
3 | make
4 |
5 | To test: -
6 | 1) Just stereo sound from one stereo jack: -
7 | ./speaker-test -Dplug:front -c2
8 | 2) A 4 speaker setup from two stereo jacks: -
9 | ./speaker-test -Dplug:surround40 -c4
10 | 3) A 5.1 speaker setup from three stereo jacks: -
11 | ./speaker-test -Dplug:surround51 -c6
12 |
13 |
--------------------------------------------------------------------------------
/speaker-test/samples/Makefile.am:
--------------------------------------------------------------------------------
1 | sounddir = $(datadir)/sounds/alsa
2 | wav_files = Front_Left.wav \
3 | Rear_Center.wav \
4 | Rear_Right.wav \
5 | Side_Right.wav \
6 | Front_Center.wav \
7 | Front_Right.wav \
8 | Noise.wav \
9 | Rear_Left.wav \
10 | Side_Left.wav
11 | sound_DATA = $(wav_files)
12 |
13 | EXTRA_DIST = \
14 | $(wav_files) \
15 | $(cfg_files)
16 |
--------------------------------------------------------------------------------
/alsaucm/Makefile.am:
--------------------------------------------------------------------------------
1 | bin_PROGRAMS = \
2 | alsaucm
3 |
4 | if USE_RST2MAN
5 | man_MANS = alsaucm.1
6 | endif
7 |
8 | alsaucm_SOURCES = usecase.c dump.c
9 |
10 | noinst_HEADERS = usecase.h
11 |
12 | AM_CPPFLAGS = \
13 | -Wall -I$(top_srcdir)/include
14 |
15 | %.1: %.rst
16 | rst2man $< > $@
17 |
18 | EXTRA_DIST = alsaucm.rst
19 |
20 | CLEANFILES = alsaucm.1
21 |
--------------------------------------------------------------------------------
/amixer/go:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #GDB="gdb --args"
4 | GDB=""
5 |
6 | ALSA_MIXER_SIMPLE_MODULES="$HOME/hg/alsa-lib/modules/mixer/simple/.libs" \
7 | ALSA_MIXER_SIMPLE="$HOME/hg/alsa-lib/src/conf/smixer.conf" \
8 | ALSA_MIXER_SIMPLE_MPYTHON="$HOME/hg/alsa-lib/modules/mixer/simple/python/main.py" \
9 | LD_PRELOAD="$HOME/hg/alsa-lib/src/.libs/libasound.so" \
10 | $GDB ./amixer "$@"
11 |
--------------------------------------------------------------------------------
/bat/tests/map_test_case:
--------------------------------------------------------------------------------
1 | # Analog audio basic test
2 | verify_Analog_audio_playback_and_capture="$ABAT_TEST_PATH/analog_audio_playback_and_capture.sh"
3 |
4 | # Display audio basic test cases - for HDMI
5 | verify_HDMI_audio_playback="$ABAT_TEST_PATH/hdmi_audio_playback.sh"
6 |
7 | # Display audio basic test cases - for DP
8 | verify_DP_audio_playback="$ABAT_TEST_PATH/dp_audio_playback.sh"
9 |
--------------------------------------------------------------------------------
/alsaloop/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS = -I$(top_srcdir)/include
2 | LDADD = -lm
3 | AM_CFLAGS = -D_GNU_SOURCE
4 | if HAVE_SAMPLERATE
5 | LDADD += -lsamplerate
6 | endif
7 | # LDFLAGS = -static
8 | # CFLAGS += -g -Wall
9 |
10 | bin_PROGRAMS = alsaloop
11 | alsaloop_SOURCES = alsaloop.c pcmjob.c control.c
12 | noinst_HEADERS = alsaloop.h
13 | man_MANS = alsaloop.1
14 | EXTRA_DIST = alsaloop.1
15 |
--------------------------------------------------------------------------------
/alsamixer/go:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #GDB="gdb --args"
4 | GDB=""
5 |
6 | ALSA_MIXER_SIMPLE_MODULES="$HOME/hg/alsa-lib/modules/mixer/simple/.libs" \
7 | ALSA_MIXER_SIMPLE="$HOME/hg/alsa-lib/src/conf/smixer.conf" \
8 | ALSA_MIXER_SIMPLE_MPYTHON="$HOME/hg/alsa-lib/modules/mixer/simple/python/main.py" \
9 | LD_PRELOAD="$HOME/hg/alsa-lib/src/.libs/libasound.so" \
10 | $GDB ./alsamixer "$@"
11 |
--------------------------------------------------------------------------------
/alsamixer/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef UTILS_H_INCLUDED
2 | #define UTILS_H_INCLUDED
3 |
4 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof *(a))
5 |
6 | unsigned int get_mbs_width(const char *s);
7 | unsigned int get_max_mbs_width(const char *const *s, unsigned int count);
8 | const char *mbs_at_width(const char *s, int *width, int dir);
9 | char *read_file(const char *file_name, unsigned int *file_size);
10 |
11 | #endif
12 |
--------------------------------------------------------------------------------
/alsactl/init/help:
--------------------------------------------------------------------------------
1 | # help page
2 |
3 | PRINT="Available commands (identified by the environment variable CMD):\n\n"
4 | PRINT=" (not set) Do a soundcard initialization\n"
5 | PRINT=" default Do a default (guess method) initialization\n"
6 | PRINT=" help Show this information\n"
7 | PRINT=" info Print all available hardware identification\n"
8 | PRINT=" test Do alsactl utility parser tests\n"
9 |
--------------------------------------------------------------------------------
/topology/nhlt/intel/ssp/ssp-debug.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | //
3 | // Copyright(c) 2021 Intel Corporation. All rights reserved.
4 | //
5 | // Author: Jaska Uimonen
6 |
7 | #ifndef __SSP_DEBUG_H
8 | #define __SSP_DEBUG_H
9 |
10 | #include "ssp-internal.h"
11 |
12 | void ssp_print_internal(struct intel_ssp_params *ssp);
13 | void ssp_print_calculated(struct intel_ssp_params *ssp);
14 |
15 | #endif
16 |
--------------------------------------------------------------------------------
/alsactl/conf/alsa-state.service.in:
--------------------------------------------------------------------------------
1 | #
2 | # Note that two different ALSA card state management schemes exist and they
3 | # can be switched using a file exist check - /etc/alsa/state-daemon.conf .
4 | #
5 |
6 | [Unit]
7 | Description=Manage Sound Card State (restore and store)
8 | ConditionPathExists=@daemonswitch@
9 |
10 | [Service]
11 | Type=simple
12 | ExecStart=-@sbindir@/alsactl -s -n 19 -c rdaemon
13 | ExecStop=-@sbindir@/alsactl -s kill save_and_quit
14 |
--------------------------------------------------------------------------------
/acinclude.m4:
--------------------------------------------------------------------------------
1 | AC_DEFUN([SAVE_UTIL_VERSION], [
2 | SND_UTIL_VERSION=$VERSION
3 | echo $VERSION > $srcdir/version
4 | AC_DEFINE_UNQUOTED(VERSION, "$SND_UTIL_VERSION", [ALSA util version])
5 | AC_SUBST(SND_UTIL_VERSION)
6 | SND_UTIL_MAJOR=`echo $VERSION | cut -d . -f 1`
7 | AC_SUBST(SND_UTIL_MAJOR)
8 | SND_UTIL_MINOR=`echo $VERSION | cut -d . -f 2`
9 | AC_SUBST(SND_UTIL_MINOR)
10 | SND_UTIL_SUBMINOR=`echo $VERSION | cut -d . -f 3 | sed -e 's/pre[[0-9]]*//g'`
11 | AC_SUBST(SND_UTIL_SUBMINOR)
12 | ])
13 |
--------------------------------------------------------------------------------
/alsactl/conf/alsa-restore.service.in:
--------------------------------------------------------------------------------
1 | #
2 | # Note that two different ALSA card state management schemes exist and they
3 | # can be switched using a file exist check - /etc/alsa/state-daemon.conf .
4 | #
5 |
6 | [Unit]
7 | Description=Save/Restore Sound Card State
8 | ConditionPathExists=!@daemonswitch@
9 | ConditionPathExistsGlob=/dev/snd/control*
10 |
11 | [Service]
12 | Type=oneshot
13 | RemainAfterExit=true
14 | ExecStart=-@sbindir@/alsactl restore
15 | ExecStop=-@sbindir@/alsactl store
16 |
--------------------------------------------------------------------------------
/include/gettext.h:
--------------------------------------------------------------------------------
1 | #ifndef __MY_GETTEXT_H
2 | #define __MY_GETTEXT_H
3 |
4 | #ifdef USES_CURSES
5 | #define ENABLE_NLS_TEST ENABLE_NLS_IN_CURSES
6 | #else
7 | #define ENABLE_NLS_TEST ENABLE_NLS
8 | #endif
9 |
10 | #if ENABLE_NLS_TEST
11 | # include
12 | #else
13 | # define gettext(msgid) (msgid)
14 | # define textdomain(domain)
15 | # define bindtextdomain(domain, dir)
16 | #endif
17 |
18 | #define _(msgid) gettext (msgid)
19 | #define gettext_noop(msgid) msgid
20 | #define N_(msgid) gettext_noop (msgid)
21 |
22 | #endif /* __MY_GETTEXT_H */
23 |
--------------------------------------------------------------------------------
/axfer/subcmd.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // subcmd.h - a header for each sub-commands.
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #ifndef __ALSA_UTILS_AXFER_SUBCMD__H_
10 | #define __ALSA_UTILS_AXFER_SUBCMD__H_
11 |
12 | #include
13 |
14 | int subcmd_list(int argc, char *const *argv, snd_pcm_stream_t direction);
15 |
16 | int subcmd_transfer(int argc, char *const *argv, snd_pcm_stream_t direction);
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/topology/nhlt/intel/dmic/dmic-debug.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | //
3 | // Copyright(c) 2021 Intel Corporation. All rights reserved.
4 | //
5 | // Author: Seppo Ingalsuo
6 | // Jaska Uimonen
7 |
8 | #ifndef __DMIC_DEBUG_H
9 | #define __DMIC_DEBUG_H
10 |
11 | #include "dmic-internal.h"
12 |
13 | void dmic_print_bytes_as_hex(uint8_t *src, size_t size);
14 | void dmic_print_integers_as_hex(uint32_t *src, size_t size);
15 | void dmic_print_internal(struct intel_dmic_params *dmic);
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/axfer/misc.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // misc.h - a header file for miscellaneous tools.
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #ifndef __ALSA_UTILS_AXFER_MISC__H_
10 | #define __ALSA_UTILS_AXFER_MISC__H_
11 |
12 | #include
13 |
14 | #define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
15 |
16 | char *arg_duplicate_string(const char *str, int *err);
17 | long arg_parse_decimal_num(const char *str, int *err);
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/alsaucm/go.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #GDB="gdb --args"
4 | #GDB="strace"
5 | #GDB="valgrind --leak-check=yes --show-reachable=yes"
6 | #GDB="perf stat"
7 | PROG=./alsaucm
8 | #PROG=/home/perex/git/pipewire/builddir/spa/plugins/alsa/spa-acp-tool
9 | #PROG="$HOME/git/pulseaudio/build/src/daemon/pulseaudio -n -F $HOME/git/pulseaudio/build/src/daemon/default.pa -p $HOME/git/pulseaudio/build/src/modules/"
10 | #PROG=pulseaudio
11 |
12 | #ALSA_CONFIG_UCM="$HOME/alsa/alsa-ucm-conf/ucm" \
13 | ALSA_CONFIG_UCM2="$HOME/alsa/alsa-ucm-conf/ucm2" \
14 | LD_PRELOAD="$HOME/alsa/alsa-lib/src/.libs/libasound.so" \
15 | $GDB $PROG "$@"
16 |
--------------------------------------------------------------------------------
/alsamixer/mixer_clickable.h:
--------------------------------------------------------------------------------
1 | #ifndef MIXER_CLICKABLE_H
2 | #define MIXER_CLICKABLE_H
3 |
4 | #include CURSESINC
5 | #include "bindings.h"
6 |
7 | struct clickable_rect {
8 | short y1;
9 | short x1;
10 | short y2;
11 | short x2;
12 | command_enum command;
13 | int arg1;
14 | };
15 |
16 | void clickable_set(int y1, int x1, int y2, int x2, command_enum command, int arg1);
17 | void clickable_set_relative(WINDOW *win, int y1, int x1, int y2, int x2, command_enum command, int arg1);
18 | void clickable_clear(int y1, int x1, int y2, int x2);
19 | struct clickable_rect* clickable_find(int y, int x);
20 |
21 | #endif
22 |
--------------------------------------------------------------------------------
/topology/Makefile.am:
--------------------------------------------------------------------------------
1 | SUBDIRS = nhlt
2 |
3 | bin_PROGRAMS = \
4 | alsatplg
5 |
6 | if USE_RST2MAN
7 | man_MANS = alsatplg.1
8 | endif
9 |
10 | %.1: %.rst
11 | rst2man $< > $@
12 |
13 | alsatplg_SOURCES = topology.c pre-processor.c pre-process-class.c pre-process-object.c \
14 | pre-process-dapm.c pre-process-dai.c
15 |
16 | noinst_HEADERS = topology.h pre-processor.h pre-process-external.h
17 |
18 | AM_CPPFLAGS = \
19 | -Wall -I$(top_srcdir)/include -DALSA_TOPOLOGY_PLUGIN_DIR=\"@ALSA_TOPOLOGY_PLUGIN_DIR@\"
20 |
21 | alsatplg_LDADD = $(ALSA_TOPOLOGY_LIBS)
22 |
23 | EXTRA_DIST = alsatplg.rst
24 |
25 | CLEANFILES = alsatplg.1
26 |
--------------------------------------------------------------------------------
/bat/analyze.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013-2015 Intel Corporation
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | */
15 |
16 | int analyze_capture(struct bat *);
17 |
--------------------------------------------------------------------------------
/topology/nhlt/intel/dmic-nhlt.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | //
3 | // Copyright(c) 2021 Intel Corporation. All rights reserved.
4 | //
5 | // Author: Jaska Uimonen
6 |
7 | #ifndef __DMIC_NHLT_H
8 | #define __DMIC_NHLT_H
9 |
10 | #include "intel-nhlt.h"
11 | #include "../nhlt.h"
12 |
13 | int nhlt_dmic_init_params(struct intel_nhlt_params *nhlt);
14 | int nhlt_dmic_set_params(struct intel_nhlt_params *nhlt, snd_config_t *cfg, snd_config_t *top);
15 | int nhlt_dmic_get_ep(struct intel_nhlt_params *nhlt, struct endpoint_descriptor **eps,
16 | int index);
17 | int nhlt_dmic_get_ep_count(struct intel_nhlt_params *nhlt);
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/alsamixer/volume_mapping.h:
--------------------------------------------------------------------------------
1 | #ifndef VOLUME_MAPPING_H_INCLUDED
2 | #define VOLUME_MAPPING_H_INCLUDED
3 |
4 | #include
5 |
6 | double get_normalized_playback_volume(snd_mixer_elem_t *elem,
7 | snd_mixer_selem_channel_id_t channel);
8 | double get_normalized_capture_volume(snd_mixer_elem_t *elem,
9 | snd_mixer_selem_channel_id_t channel);
10 | int set_normalized_playback_volume(snd_mixer_elem_t *elem,
11 | snd_mixer_selem_channel_id_t channel,
12 | double volume,
13 | int dir);
14 | int set_normalized_capture_volume(snd_mixer_elem_t *elem,
15 | snd_mixer_selem_channel_id_t channel,
16 | double volume,
17 | int dir);
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/speaker-test/pink.h:
--------------------------------------------------------------------------------
1 | #define PINK_MAX_RANDOM_ROWS (30)
2 | #define PINK_RANDOM_BITS (24)
3 | #define PINK_RANDOM_SHIFT ((sizeof(long)*8)-PINK_RANDOM_BITS)
4 |
5 | typedef struct
6 | {
7 | long pink_rows[PINK_MAX_RANDOM_ROWS];
8 | long pink_running_sum; /* Used to optimize summing of generators. */
9 | int pink_index; /* Incremented each sample. */
10 | int pink_index_mask; /* Index wrapped by ANDing with this mask. */
11 | float pink_scalar; /* Used to scale within range of -1.0 to +1.0 */
12 | } pink_noise_t;
13 |
14 | void initialize_pink_noise( pink_noise_t *pink, int num_rows );
15 | float generate_pink_noise_sample( pink_noise_t *pink );
16 |
--------------------------------------------------------------------------------
/axfer/test/Makefile.am:
--------------------------------------------------------------------------------
1 | TESTS = \
2 | container-test \
3 | mapper-test
4 |
5 | check_PROGRAMS = \
6 | container-test \
7 | mapper-test
8 |
9 | container_test_SOURCES = \
10 | ../container.h \
11 | ../container.c \
12 | ../container-riff-wave.c \
13 | ../container-au.c \
14 | ../container-voc.c \
15 | ../container-raw.c \
16 | generator.c \
17 | generator.h \
18 | container-test.c
19 |
20 | mapper_test_SOURCES = \
21 | ../container.h \
22 | ../container.c \
23 | ../container-riff-wave.c \
24 | ../container-au.c \
25 | ../container-voc.c \
26 | ../container-raw.c \
27 | ../mapper.h \
28 | ../mapper.c \
29 | ../mapper-single.c \
30 | ../mapper-multiple.c \
31 | generator.c \
32 | generator.h \
33 | mapper-test.c
34 |
--------------------------------------------------------------------------------
/aplay/Makefile.am:
--------------------------------------------------------------------------------
1 | LIBRT = @LIBRT@
2 |
3 | AM_CPPFLAGS = -I$(top_srcdir)/include
4 | LDADD = $(LIBINTL) $(LIBRT)
5 |
6 | # debug flags
7 | #LDFLAGS = -static
8 | #LDADD += -ldl
9 |
10 | bin_PROGRAMS = aplay
11 | man_MANS = aplay.1 arecord.1
12 | noinst_HEADERS = formats.h
13 |
14 | EXTRA_DIST = aplay.1 arecord.1
15 | EXTRA_CLEAN = arecord
16 |
17 | arecord: aplay
18 | rm -f arecord
19 | $(LN_S) $< $@
20 |
21 | arecord.1: aplay.1
22 | rm -f arecord.1
23 | $(LN_S) $< $@
24 |
25 | install-exec-hook: arecord
26 | rm -f $(DESTDIR)$(bindir)/arecord
27 | (cd $(DESTDIR)$(bindir) && $(LN_S) aplay arecord)
28 |
29 | install-data-hook:
30 | rm -f $(DESTDIR)$(mandir)/man1/arecord.1
31 | (cd $(DESTDIR)$(mandir)/man1 && $(LN_S) aplay.1 arecord.1)
32 |
--------------------------------------------------------------------------------
/bat/Makefile.am:
--------------------------------------------------------------------------------
1 | SUBDIRS=tests
2 | bin_PROGRAMS = alsabat
3 | man_MANS = alsabat.1
4 | EXTRA_DIST = alsabat.1 alsabat-test.sh
5 | sbin_SCRIPTS = alsabat-test.sh
6 |
7 | alsabat_SOURCES = \
8 | bat.c \
9 | common.c \
10 | signal.c \
11 | latencytest.c \
12 | convert.c
13 |
14 | noinst_HEADERS = \
15 | common.h \
16 | bat-signal.h \
17 | latencytest.h \
18 | convert.h
19 |
20 | if HAVE_LIBFFTW3
21 | alsabat_SOURCES += analyze.c
22 | noinst_HEADERS += analyze.h
23 | endif
24 |
25 | if HAVE_LIBTINYALSA
26 | alsabat_SOURCES += tinyalsa.c
27 | noinst_HEADERS += tinyalsa.h
28 | else
29 | alsabat_SOURCES += alsa.c
30 | noinst_HEADERS += alsa.h
31 | endif
32 |
33 | AM_CPPFLAGS = \
34 | -Wall -I$(top_srcdir)/include
35 |
36 | alsabat_LDADD = @FFTW_LIB@
37 |
--------------------------------------------------------------------------------
/bat/alsa.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013-2015 Intel Corporation
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | */
15 |
16 | extern int retval_play;
17 | extern int retval_record;
18 |
19 | void *playback_alsa(struct bat *);
20 | void *record_alsa(struct bat *);
21 |
--------------------------------------------------------------------------------
/bat/latencytest.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013-2015 Intel Corporation
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | */
15 | void roundtrip_latency_init(struct bat *);
16 | int handleinput(struct bat *, void *, int);
17 | int handleoutput(struct bat *, void *, int, int);
18 |
--------------------------------------------------------------------------------
/bat/tinyalsa.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013-2015 Intel Corporation
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | */
15 |
16 | extern int retval_play;
17 | extern int retval_record;
18 |
19 | void *playback_tinyalsa(struct bat *);
20 | void *record_tinyalsa(struct bat *);
21 |
--------------------------------------------------------------------------------
/topology/nhlt/intel/ssp-nhlt.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | //
3 | // Copyright(c) 2021 Intel Corporation. All rights reserved.
4 | //
5 | // Author: Jaska Uimonen
6 |
7 | #ifndef __SSP_NHLT_H
8 | #define __SSP_NHLT_H
9 |
10 | #include "intel-nhlt.h"
11 | #include "../nhlt.h"
12 |
13 | int nhlt_ssp_init_params(struct intel_nhlt_params *nhlt);
14 | int nhlt_ssp_set_params(struct intel_nhlt_params *nhlt, snd_config_t *cfg, snd_config_t *top);
15 | int nhlt_ssp_get_ep(struct intel_nhlt_params *nhlt, struct endpoint_descriptor **eps,
16 | int dai_index, uint8_t dir);
17 | int nhlt_ssp_get_ep_count(struct intel_nhlt_params *nhlt);
18 | int nhlt_ssp_get_dir(struct intel_nhlt_params *nhlt, int dai_index, uint8_t *dir);
19 | #endif
20 |
--------------------------------------------------------------------------------
/alsamixer/widget.h:
--------------------------------------------------------------------------------
1 | #ifndef WIDGET_H_INCLUDED
2 | #define WIDGET_H_INCLUDED
3 |
4 | #include
5 |
6 | #define WIDGET_BORDER 0x1
7 | #define WIDGET_SUBWINDOW 0x2
8 | #define WIDGET_CURSOR_VISIBLE 0x4
9 |
10 | #define SCREEN_CENTER -1
11 |
12 | struct widget {
13 | WINDOW *window;
14 | WINDOW *subwindow; /* optional: contents without border */
15 | PANEL *panel;
16 | int cursor_visibility;
17 |
18 | void (*handle_key)(int key);
19 | void (*window_size_changed)(void);
20 | void (*close)(void);
21 | };
22 |
23 | extern int screen_lines;
24 | extern int screen_cols;
25 |
26 | void widget_init(struct widget *widget,
27 | int lines_, int cols, int y, int x,
28 | chtype bkgd, unsigned int flags);
29 | void widget_free(struct widget *widget);
30 | const struct widget *get_active_widget(void);
31 | void window_size_changed(void);
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/alsamixer/colors.h:
--------------------------------------------------------------------------------
1 | #ifndef COLORS_H_INCLUDED
2 | #define COLORS_H_INCLUDED
3 |
4 | #define TRICOLOR_VOLUME_BAR
5 |
6 | struct attributes {
7 | // Alphabetically sorted
8 | #ifdef TRICOLOR_VOLUME_BAR
9 | int ctl_bar_hi;
10 | #endif
11 | int ctl_bar_lo;
12 | #ifdef TRICOLOR_VOLUME_BAR
13 | int ctl_bar_mi;
14 | #endif
15 | int ctl_capture;
16 | int ctl_frame;
17 | int ctl_inactive;
18 | int ctl_label;
19 | int ctl_label_focus;
20 | int ctl_label_inactive;
21 | int ctl_mark_focus;
22 | int ctl_mute;
23 | int ctl_nocapture;
24 | int ctl_nomute;
25 | int errormsg;
26 | int infomsg;
27 | int menu;
28 | int menu_selected;
29 | int mixer_active;
30 | int mixer_frame;
31 | int mixer_text;
32 | int textbox;
33 | int textfield;
34 | };
35 |
36 | extern struct attributes attrs;
37 |
38 | void init_colors(int use_color);
39 | void reinit_colors(short bg);
40 | int get_color_pair(short fg, short bg);
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/gitcompile:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | if test -d ../alsa-lib/utils && ! test -r `aclocal --print-ac-dir`/alsa.m4; then
4 | ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I ../alsa-lib/utils"
5 | fi
6 | aclocal $ACLOCAL_FLAGS
7 | # save original files to avoid stupid modifications by gettextize
8 | cp Makefile.am Makefile.am.ok
9 | cp configure.ac configure.ac.ok
10 | gettextize -c -f --no-changelog
11 | echo "EXTRA_DIST = gettext.m4" > m4/Makefile.am
12 | cp Makefile.am.ok Makefile.am
13 | cp configure.ac.ok configure.ac
14 | touch ltconfig
15 | libtoolize --force --copy --automake
16 | aclocal $ACLOCAL_FLAGS
17 | autoheader
18 | automake --foreign --copy --add-missing
19 | touch depcomp # for older automake
20 | autoconf
21 | export CFLAGS='-O2 -Wall -W -Wunused-const-variable=0 -pipe -g'
22 | echo "CFLAGS=$CFLAGS"
23 | echo "./configure $@"
24 | ./configure $@ || exit 1
25 | unset CFLAGS
26 | if [ -z "$GITCOMPILE_NO_MAKE" ]; then
27 | make
28 | fi
29 |
--------------------------------------------------------------------------------
/alsamixer/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CFLAGS = -D_GNU_SOURCE @CURSES_CFLAGS@ -DCURSESINC="@CURSESINC@"
2 | LDADD = @CURSESLIB@
3 |
4 | bin_PROGRAMS = alsamixer
5 | alsamixer_SOURCES = card_select.c card_select.h \
6 | bindings.c bindings.h \
7 | cli.c \
8 | colors.c colors.h \
9 | curskey.c curskey.h \
10 | configparser.c configparser.h \
11 | device_name.c device_name.h \
12 | die.c die.h \
13 | mainloop.c mainloop.h \
14 | mem.c mem.h \
15 | menu_widget.c menu_widget.h \
16 | mixer_clickable.c mixer_clickable.h \
17 | mixer_controls.c mixer_controls.h \
18 | mixer_display.c mixer_display.h \
19 | mixer_widget.c mixer_widget.h \
20 | proc_files.c proc_files.h \
21 | textbox.c textbox.h \
22 | utils.c utils.h \
23 | volume_mapping.c volume_mapping.h \
24 | widget.c widget.h
25 | man_MANS = alsamixer.1
26 | EXTRA_DIST = alsamixer.1 alsamixer.rc.example
27 | alsamixer_CPPFLAGS = -I$(top_srcdir)/include
28 |
29 | #LDFLAGS = -static
30 | #CFLAGS += -g -Wall
31 |
--------------------------------------------------------------------------------
/amixer/amixer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * ALSA command line mixer utility
3 | * Copyright (c) 1999 by Jaroslav Kysela
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program; if not, write to the Free Software
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 | *
19 | */
20 |
21 | #include "../include/version.h"
22 |
--------------------------------------------------------------------------------
/nhlt/nhlt-dmic-info.1:
--------------------------------------------------------------------------------
1 | .TH NHLT-DMIC-INFO 1 "16 May 2023"
2 | .SH NAME
3 | nhlt-dmic-info \- dump microphone array information from ACPI NHLT table
4 | .SH SYNOPSIS
5 | \fBnhlt-dmic-info\fP [\fI\-option\fP]
6 | .SH DESCRIPTION
7 |
8 | \fB\fBnhlt-dmic-info\fP\fP dumps microphone array information from ACPI NHLT
9 | table in JSON format.
10 |
11 | .SH OPTIONS
12 |
13 | .TP
14 | \fI\-h\fP | \fI\-\-help\fP
15 |
16 | Prints the help information.
17 |
18 | .TP
19 | \fI\-f \fP | \fI\-\-file=\fP
20 |
21 | Input file with the binary ACPI NHLT table (default is \fB/sys/firmware/acpi/tables/NHLT\fR).
22 |
23 | .TP
24 | \fI\-o \fP | \fI\-\-output=\fP
25 |
26 | JSON output file (default is stdout: \fB\-\fR).
27 |
28 | .SH EXAMPLES
29 | .nf
30 | \fBnhlt-dmic-info \-f nhlt.bin \-o dmic.json\fR
31 |
32 | .ne
33 | .SH BUGS
34 | None known.
35 | .SH AUTHOR
36 | \fBnhlt-dmic-info\fP is by Jaroslav Kysela .
37 | This document is by Jaroslav Kysela .
38 |
--------------------------------------------------------------------------------
/include/Makefile.am:
--------------------------------------------------------------------------------
1 | noinst_HEADERS=version.h gettext.h gettext_curses.h bswap.h os_compat.h
2 |
3 | version.h: stamp-vh
4 | @:
5 |
6 | stamp-vh: $(top_builddir)/configure.ac
7 | @echo "/*" > ver.tmp
8 | @echo " * version.h" >> ver.tmp
9 | @echo " */" >> ver.tmp
10 | @echo "" >> ver.tmp
11 | @echo "#define SND_UTIL_MAJOR $(SND_UTIL_MAJOR)" >> ver.tmp
12 | @echo "#define SND_UTIL_MINOR $(SND_UTIL_MINOR)" >> ver.tmp
13 | @echo "#define SND_UTIL_SUBMINOR $(SND_UTIL_SUBMINOR)" >> ver.tmp
14 | @echo "#define SND_UTIL_VERSION ((SND_UTIL_MAJOR<<16)|\\" >> ver.tmp
15 | @echo " (SND_UTIL_MINOR<<8)|\\" >> ver.tmp
16 | @echo " SND_UTIL_SUBMINOR)" >> ver.tmp
17 | @echo "#define SND_UTIL_VERSION_STR \"$(SND_UTIL_VERSION)\"" >> ver.tmp
18 | @echo >> ver.tmp
19 | @cmp -s version.h ver.tmp \
20 | || (echo "Updating version.h"; \
21 | cp ver.tmp version.h; \
22 | echo timestamp > stamp-vh)
23 | -@rm -f ver.tmp
24 |
25 | AM_CPPFLAGS=-I$(top_srcdir)/include
26 |
--------------------------------------------------------------------------------
/alsactl/init/info:
--------------------------------------------------------------------------------
1 | # show information about card
2 |
3 | PRINT="CARDINFO:\n"
4 | PRINT=" CARDINFO{id}=\"$CARDINFO{id}\"\n"
5 | PRINT=" CARDINFO{card}=\"$CARDINFO{card}\"\n"
6 | PRINT=" CARDINFO{driver}=\"$CARDINFO{driver}\"\n"
7 | PRINT=" CARDINFO{name}=\"$CARDINFO{name}\"\n"
8 | PRINT=" CARDINFO{longname}=\"$CARDINFO{longname}\"\n"
9 | PRINT=" CARDINFO{mixername}=\"$CARDINFO{mixername}\"\n"
10 | PRINT=" CARDINFO{components}=\"$CARDINFO{components}\"\n"
11 |
12 | # sysfs stuff
13 | PRINT="sysfs:\n"
14 | ATTR{bus}=="*", PRINT=" ATTR{bus}=\"$ATTR{bus}\"\n"
15 | ATTR{class}=="*", PRINT=" ATTR{class}=\"$ATTR{class}\"\n"
16 | ATTR{driver}=="*", PRINT=" ATTR{driver}=\"$ATTR{driver}\"\n"
17 | ATTR{vendor}=="*", PRINT=" ATTR{vendor}=\"$ATTR{vendor}\"\n"
18 | ATTR{device}=="*", PRINT=" ATTR{device}=\"$ATTR{device}\"\n"
19 | ATTR{subsystem_vendor}=="*", \
20 | PRINT=" ATTR{subsystem_vendor}=\"$ATTR{subsystem_vendor}\"\n"
21 | ATTR{subsystem_device}=="*", \
22 | PRINT=" ATTR{subsystem_device}=\"$ATTR{subsystem_device}\"\n"
23 |
--------------------------------------------------------------------------------
/utils/buildrpm:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source=.
4 | version=`cat $source/../version`
5 | package=$source/../alsa-utils-$version.tar.bz2
6 | packagedir=/usr/src/redhat
7 | xrpmbuild=rpm
8 | rpmbuild --usage 2> /dev/null > /dev/null && xrpmbuild=rpmbuild
9 |
10 | # SuSE path
11 | if [ -d /usr/src/packages ]; then
12 | packagedir=/usr/src/packages
13 | fi
14 |
15 | make -C .. clean
16 | make -C .. dist
17 |
18 | if [ ! -r $package ]; then
19 | echo "Error: wrong package: $package"
20 | exit 1
21 | fi
22 |
23 | cp -fv $package ${packagedir}/SOURCES
24 |
25 | if [ ! -r $source/buildrpm ]; then
26 | echo "Error: invalid directory: $source"
27 | exit 1
28 | fi
29 |
30 | if [ ! -d ${packagedir} ]; then
31 | echo "Error: ${packagedir} directory not found"
32 | exit 1
33 | fi
34 |
35 | if [ ! -r $source/alsadriver.spec ]; then
36 | cd $source/..
37 | ./configure
38 | cd utils
39 | fi
40 |
41 | cp -fv $source/alsa-utils.spec ${packagedir}/SPECS
42 | cd ${packagedir}/SPECS
43 | $xrpmbuild -ba alsa-utils.spec
44 | cd ${packagedir}
45 |
--------------------------------------------------------------------------------
/alsamixer/curskey.h:
--------------------------------------------------------------------------------
1 | #ifndef CURSKEY_H_INCLUDED
2 | #define CURSKEY_H_INCLUDED
3 |
4 | #include CURSESINC
5 |
6 | /* Additional KEY_ constants */
7 | #define KEY_SPACE ' '
8 | #define KEY_TAB '\t'
9 | #define KEY_DEL 127
10 | #define KEY_ESCAPE 27
11 | #define KEY_INSERT KEY_IC
12 | #define KEY_DELETE KEY_DC
13 | #define KEY_PAGEUP KEY_PPAGE
14 | #define KEY_PAGEDOWN KEY_NPAGE
15 |
16 | /* Modifiers */
17 | #define CURSKEY_MOD_CNTRL 1U
18 | #define CURSKEY_MOD_META 2U
19 | #define CURSKEY_MOD_ALT CURSKEY_MOD_META
20 |
21 | /* Defines the range of characters which should be "meta-able" */
22 | #define CURSKEY_MAX_META_CHAR 127
23 |
24 | int curskey_init();
25 | void curskey_destroy();
26 | int curskey_define_meta_keys(unsigned int keycode_start);
27 |
28 | int curskey_parse(const char *keydef);
29 | int curskey_mod_key(int key, unsigned int modifiers);
30 |
31 | #define curskey_meta_key(KEY) \
32 | curskey_mod_key(KEY, CURSKEY_MOD_META)
33 |
34 | #define curskey_cntrl_key(KEY) \
35 | curskey_mod_key(KEY, CURSKEY_MOD_CNTRL)
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/topology/nhlt/Makefile.am:
--------------------------------------------------------------------------------
1 | alsatplg_module_nhlt_LTLIBRARIES = libalsatplg_module_nhlt.la
2 |
3 | alsatplg_module_nhltdir = @ALSA_TOPOLOGY_PLUGIN_DIR@
4 |
5 | AM_CFLAGS = -Wall -fvisibility=hidden -I$(top_srcdir)/include -I$(top_srcdir)/topology
6 | AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
7 |
8 | libalsatplg_module_nhlt_la_SOURCES = nhlt-processor.c \
9 | intel/intel-nhlt.c \
10 | intel/dmic-nhlt.c \
11 | intel/dmic/dmic-debug.c intel/dmic/dmic-process.c \
12 | intel/ssp-nhlt.c \
13 | intel/ssp/ssp-debug.c intel/ssp/ssp-process.c
14 |
15 | noinst_HEADERS = nhlt.h \
16 | intel/intel-nhlt.h \
17 | intel/dmic-nhlt.h \
18 | intel/dmic/dmic-intel.h \
19 | intel/dmic/dmic-process.h \
20 | intel/dmic/dmic-debug.h \
21 | intel/dmic/dmic-internal.h \
22 | intel/dmic/pdm-decim-fir.h \
23 | intel/ssp-nhlt.h \
24 | intel/ssp/ssp-debug.h \
25 | intel/ssp/ssp-intel.h \
26 | intel/ssp/ssp-process.h \
27 | intel/ssp/ssp-internal.h
28 |
29 | libalsatplg_module_nhlt_la_LIBADD = @ALSA_LIBS@
30 |
--------------------------------------------------------------------------------
/bat/convert.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013-2015 Intel Corporation
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | */
15 |
16 | void convert_uint8_to_float(void *, float *, int);
17 | void convert_int16_to_float(void *, float *, int);
18 | void convert_int24_to_float(void *, float *, int);
19 | void convert_int32_to_float(void *, float *, int);
20 | void convert_float_to_uint8(float *, void *, int, int);
21 | void convert_float_to_int16(float *, void *, int, int);
22 | void convert_float_to_int24(float *, void *, int, int);
23 | void convert_float_to_int32(float *, void *, int, int);
24 |
--------------------------------------------------------------------------------
/alsamixer/mixer_controls.h:
--------------------------------------------------------------------------------
1 | #ifndef MIXER_CONTROLS_H_INCLUDED
2 | #define MIXER_CONTROLS_H_INCLUDED
3 |
4 | #include
5 |
6 | struct control {
7 | snd_mixer_elem_t *elem;
8 | char *name;
9 | unsigned int flags;
10 | #define TYPE_PVOLUME (1u << 4)
11 | #define TYPE_CVOLUME (1u << 5)
12 | #define TYPE_PSWITCH (1u << 6)
13 | #define TYPE_CSWITCH (1u << 7)
14 | #define TYPE_ENUM (1u << 8)
15 | #define HAS_VOLUME_0 (1u << 9)
16 | #define HAS_VOLUME_1 (1u << 10)
17 | #define HAS_PSWITCH_0 (1u << 11)
18 | #define HAS_PSWITCH_1 (1u << 12)
19 | #define HAS_CSWITCH_0 (1u << 13)
20 | #define HAS_CSWITCH_1 (1u << 14)
21 | #define IS_MULTICH (1u << 15)
22 | #define IS_ACTIVE (1u << 16)
23 | #define MULTICH_MASK (0x0000f)
24 | snd_mixer_selem_channel_id_t volume_channels[2];
25 | snd_mixer_selem_channel_id_t pswitch_channels[2];
26 | snd_mixer_selem_channel_id_t cswitch_channels[2];
27 | unsigned int enum_channel_bits;
28 | };
29 |
30 | extern struct control *controls;
31 | extern unsigned int controls_count;
32 |
33 | bool are_there_any_controls(void);
34 | void create_controls(void);
35 | void free_controls(void);
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/alsamixer/mixer_widget.h:
--------------------------------------------------------------------------------
1 | #ifndef MIXER_WIDGET_H_INCLUDED
2 | #define MIXER_WIDGET_H_INCLUDED
3 |
4 | #include CURSESINC
5 | #include
6 | #include "widget.h"
7 |
8 | enum view_mode {
9 | VIEW_MODE_PLAYBACK,
10 | VIEW_MODE_CAPTURE,
11 | VIEW_MODE_ALL,
12 | VIEW_MODE_COUNT,
13 | };
14 |
15 | enum channel_mask {
16 | LEFT = 1,
17 | RIGHT = 2,
18 | };
19 |
20 | extern snd_mixer_t *mixer;
21 | extern char *mixer_device_name;
22 | extern bool unplugged;
23 |
24 | extern struct widget mixer_widget;
25 |
26 | extern enum view_mode view_mode;
27 |
28 | extern int focus_control_index;
29 | extern snd_mixer_selem_id_t *current_selem_id;
30 | extern unsigned int current_control_flags;
31 |
32 | extern bool control_values_changed;
33 | extern bool controls_changed;
34 |
35 | extern unsigned int mouse_wheel_step;
36 | extern bool mouse_wheel_focuses_control;
37 |
38 | void create_mixer_object(struct snd_mixer_selem_regopt *selem_regopt);
39 | void create_mixer_widget(void);
40 | void mixer_shutdown(void);
41 | void close_mixer_device(void);
42 | bool select_card_by_name(const char *device_name);
43 | void refocus_control(void);
44 |
45 | #endif
46 |
--------------------------------------------------------------------------------
/axfer/waiter-poll.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // waiter-poll.c - Waiter for event notification by poll(2).
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #include "waiter.h"
10 | #include "misc.h"
11 |
12 | #include
13 | #include
14 | #include
15 |
16 | static int poll_prepare(struct waiter_context *waiter ATTRIBUTE_UNUSED)
17 | {
18 | // Nothing to do because an instance of waiter has required data.
19 | return 0;
20 | }
21 |
22 | static int poll_wait_event(struct waiter_context *waiter, int timeout_msec)
23 | {
24 | int err;
25 |
26 | err = poll(waiter->pfds, waiter->pfd_count, timeout_msec);
27 | if (err < 0)
28 | return -errno;
29 |
30 | return err;
31 | }
32 |
33 | static void poll_release(struct waiter_context *waiter ATTRIBUTE_UNUSED)
34 | {
35 | // Nothing to do because an instance of waiter has required data.
36 | return;
37 | }
38 |
39 | const struct waiter_data waiter_poll = {
40 | .ops = {
41 | .prepare = poll_prepare,
42 | .wait_event = poll_wait_event,
43 | .release = poll_release,
44 | },
45 | };
46 |
--------------------------------------------------------------------------------
/alsaucm/usecase.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This library is free software; you can redistribute it and/or
3 | * modify it under the terms of the GNU Lesser General Public
4 | * License as published by the Free Software Foundation; either
5 | * version 2 of the License, or (at your option) any later version.
6 | *
7 | * This library is distributed in the hope that it will be useful,
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 | * Lesser General Public License for more details.
11 | *
12 | * You should have received a copy of the GNU General Public License
13 | * along with this program; if not, write to the Free Software
14 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 | */
16 |
17 | #ifndef __USECASE_H
18 | #define __USECASE_H
19 |
20 | struct context {
21 | snd_use_case_mgr_t *uc_mgr;
22 | const char *command;
23 | char *card;
24 | char **argv;
25 | int argc;
26 | int arga;
27 | char *batch;
28 | unsigned int interactive:1;
29 | unsigned int no_open:1;
30 | unsigned int do_exit:1;
31 | };
32 |
33 | void dump(struct context *context, const char *format);
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/ChangeLog:
--------------------------------------------------------------------------------
1 | 2005-08-13 gettextize
2 |
3 | * Makefile.am (EXTRA_DIST): Add config.rpath, mkinstalldirs.
4 | * configure.in (AM_GNU_GETTEXT_VERSION): Bump to 0.14.4.
5 |
6 | 0.0.7 -> 0.2.0
7 |
8 | * removed error message from alsamixer
9 | * fixes in alsactl program
10 | * version is now compatible with driver
11 |
12 | 0.0.6 -> 0.0.7
13 |
14 | * added alsactl control program
15 | * updated alsamixer by Carl van Schaik
16 | - stereo record source select
17 | - left/right route support
18 |
19 | 0.0.5 -> 0.0.6
20 |
21 | * updates for new alsa-lib
22 | * fixed compilation problems with config.h header file
23 | * updated output 'aplay -l'
24 |
25 | 0.0.3 -> 0.0.4
26 |
27 | * added check for alsa-lib package
28 | * added spec file for RPM
29 |
30 | 0.0.2 -> 0.0.3
31 |
32 | * included great ncurses alsamixer from Tim Janik
33 | * enhanced Mixer from Andy Lo A Foe renamed to amixer
34 |
35 | 0.0.1 -> 0.0.2
36 |
37 | * fixed small bug in aplay in command line parsing
38 | * fixed fragment size allocation for low rate files in aplay
39 | * a little bit corrected output from Mixer
40 |
41 | 0.0.1
42 |
43 | * initial release (aplay, broken Mixer)
44 |
--------------------------------------------------------------------------------
/alsaconf/Makefile.am:
--------------------------------------------------------------------------------
1 | sbin_SCRIPTS = alsaconf
2 | man_MANS = alsaconf.8 alsaconf.fr.8
3 | EXTRA_DIST = $(man_MANS)
4 | SUBDIRS = po
5 |
6 | install-man8:
7 | @for i in $(man_MANS); do \
8 | ext=`echo $$i | $(SED) -e 's/^.*\\.//'`; \
9 | inst=`echo $$i | $(SED) -e 's/\\.[^.]*$$//'`; \
10 | case $$inst in \
11 | *.[a-za-z]*)\
12 | loc=`echo $$inst | $(SED) -e 's/^.*\\.//'`; \
13 | loc="/$$loc"; \
14 | inst=`echo $$inst | $(SED) -e 's/\\.[^.]*$$//'`;; \
15 | *)\
16 | loc="";; \
17 | esac; \
18 | $(mkinstalldirs) $(DESTDIR)$(mandir)$$loc/man$$ext; \
19 | echo " $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext"; \
20 | $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext; \
21 | done
22 |
23 | uninstall-man8:
24 | @for i in $(man_MANS); do \
25 | ext=`echo $$i | $(SED) -e 's/^.*\\.//'`; \
26 | inst=`echo $$i | $(SED) -e 's/\\.[^.]*$$//'`; \
27 | case $$inst in \
28 | *.[a-za-z]*)\
29 | loc=`echo $$inst | $(SED) -e 's/^.*\\.//'`; \
30 | loc="/$$loc"; \
31 | inst=`echo $$inst | $(SED) -e 's/\\.[^.]*$$//'`;; \
32 | *)\
33 | loc="";; \
34 | esac; \
35 | echo " rm -f $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext"; \
36 | rm -f $(DESTDIR)$(mandir)$$loc/man$$ext/$$inst.$$ext; \
37 | done
38 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | AM_CPPFLAGS=-I$(top_srcdir)/include
2 |
3 | SUBDIRS = include alsactl utils m4 po alsa-info
4 | if ALSAMIXER
5 | SUBDIRS += alsamixer
6 | endif
7 | if HAVE_MIXER
8 | SUBDIRS += amixer
9 | endif
10 | if HAVE_RAWMIDI
11 | SUBDIRS += amidi
12 | endif
13 | if ALSACONF
14 | SUBDIRS += alsaconf
15 | endif
16 | if HAVE_PCM
17 | SUBDIRS += aplay iecset speaker-test axfer
18 | if ALSALOOP
19 | SUBDIRS += alsaloop
20 | endif
21 | if BAT
22 | SUBDIRS += bat
23 | endif
24 | endif
25 | if HAVE_SEQ
26 | SUBDIRS += seq
27 | endif
28 | if HAVE_UCM
29 | SUBDIRS += alsaucm
30 | endif
31 | if HAVE_TOPOLOGY
32 | SUBDIRS += topology
33 | endif
34 | if NHLT
35 | SUBDIRS += nhlt
36 | endif
37 |
38 | EXTRA_DIST= README.md TODO gitcompile
39 | AUTOMAKE_OPTIONS=foreign
40 | ACLOCAL_AMFLAGS = -I m4
41 |
42 | rpm: dist
43 | $(MAKE) -C $@
44 |
45 | dist-hook:
46 | -chmod -R a+r $(distdir)
47 | @if ! test -z "$(AMTAR)"; then \
48 | $(AMTAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
49 | else \
50 | $(TAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
51 | fi
52 |
53 | install-data-hook:
54 | $(MKDIR_P) -m 0755 $(DESTDIR)$(ASOUND_STATE_DIR)
55 |
56 | DISTCHECK_CONFIGURE_FLAGS = \
57 | --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
58 |
--------------------------------------------------------------------------------
/alsamixer/die.c:
--------------------------------------------------------------------------------
1 | /*
2 | * die.c - error handlers
3 | * Copyright (c) Clemens Ladisch
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | #include "aconfig.h"
20 | #include
21 | #include
22 | #include
23 | #include "gettext_curses.h"
24 | #include "mainloop.h"
25 | #include "die.h"
26 |
27 | void fatal_error(const char *msg)
28 | {
29 | app_shutdown();
30 | fprintf(stderr, "%s\n", msg);
31 | exit(EXIT_FAILURE);
32 | }
33 |
34 | void fatal_alsa_error(const char *msg, int err)
35 | {
36 | app_shutdown();
37 | fprintf(stderr, _("%s: %s\n"), msg, snd_strerror(err));
38 | exit(EXIT_FAILURE);
39 | }
40 |
--------------------------------------------------------------------------------
/bat/tests/README:
--------------------------------------------------------------------------------
1 |
2 | automated test scripts for linux audio driver
3 | based on alsa-lib interface by using alsabat
4 | ===============================================================================
5 |
6 | This package contains the test scripts for linux audio driver based on
7 | alsa-lib interface by using alsabat.
8 | It supports analog and display(HDMI/DP) audio test.
9 | The package needs the alsa-utils, alsa-lib installed environment.
10 |
11 | alsabat_main.sh
12 | - the main entrance test script,
13 | it will call the other scripts to run the tests
14 | (test result will save in the ./log/ folder)
15 | analog_audio_playback_and_capture.sh
16 | - analog audio test script (please to loopback the
17 | analog audio output to analog audio input)
18 | hdmi_audio_playback.sh
19 | - hdmi audio test script (please to loopback the hdmi audio output
20 | to analog audio input)
21 | dp_audio_playback.sh
22 | - dp audio test script (please to loopback the dp audio
23 | output to analog audio input)
24 | map_test_case
25 | - to map the test suite/cases to a test script
26 | asound_state/
27 | - some asound.state config reference files
28 | based on different platforms
29 |
30 | Focus Luo
31 | Wang,Jinliang
32 | Zhang,Keqiao
33 |
--------------------------------------------------------------------------------
/speaker-test/st2095.h:
--------------------------------------------------------------------------------
1 | #define ST2095_MAX_PEAK -9.5 // dB
2 | #define ST2095_HPFC 10.0 // Highpass filter cutoff in Hz
3 | #define ST2095_LPFC 22400.0 // Lowpass filter cutoff in Hz
4 |
5 | typedef struct
6 | {
7 | float maxAmp;
8 | int samplesPerPeriod;
9 | int randStep;
10 | int randMax;
11 | int seed;
12 | float scaleFactor;
13 | float w0t;
14 | float k;
15 | float k2;
16 | float LpFc;
17 | // biquad coefficients
18 | float hp1_a1, hp1_a2;
19 | float hp1_b0, hp1_b1, hp1_b2;
20 | float hp2_a1, hp2_a2;
21 | float hp2_b0, hp2_b1, hp2_b2;
22 | float lp1_a1, lp1_a2;
23 | float lp1_b0, lp1_b1, lp1_b2;
24 | float lp2_a1, lp2_a2;
25 | float lp2_b0, lp2_b1, lp2_b2;
26 | // delay-line variables for bandpass filter
27 | float hp1w1, hp1w2;
28 | float hp2w1, hp2w2;
29 | float lp1w1, lp1w2;
30 | float lp2w1, lp2w2;
31 | // delay-line variables for pink filter network
32 | float lp1, lp2, lp3, lp4, lp5, lp6;
33 | // statistics accumulator
34 | float accum;
35 | } st2095_noise_t;
36 |
37 | void initialize_st2095_noise( st2095_noise_t *st2095, int sample_rate );
38 | float generate_st2095_noise_sample( st2095_noise_t *st2095 );
39 |
40 | void reset_st2095_noise_measurement( st2095_noise_t *st2095 );
41 | float compute_st2095_noise_measurement( st2095_noise_t *st2095, int period );
42 |
--------------------------------------------------------------------------------
/axfer/Makefile.am:
--------------------------------------------------------------------------------
1 | bin_PROGRAMS = \
2 | axfer
3 |
4 | man_MANS = \
5 | axfer.1 \
6 | axfer-list.1 \
7 | axfer-transfer.1
8 |
9 | # To include headers for gettext and version.
10 | AM_CPPFLAGS = \
11 | -I$(top_srcdir)/include
12 |
13 | # Unit tests.
14 | SUBDIRS = \
15 | test
16 |
17 | LIBRT = @LIBRT@
18 | LDADD = \
19 | $(LIBINTL) \
20 | $(LIBRT)
21 |
22 | noinst_HEADERS = \
23 | misc.h \
24 | subcmd.h \
25 | container.h \
26 | mapper.h \
27 | xfer.h \
28 | xfer-libasound.h \
29 | frame-cache.h
30 | waiter.h
31 |
32 | axfer_SOURCES = \
33 | misc.h \
34 | subcmd.h \
35 | main.c \
36 | subcmd-list.c \
37 | container.h \
38 | container.c \
39 | container-riff-wave.c \
40 | container-au.c \
41 | container-voc.c \
42 | container-raw.c \
43 | mapper.h \
44 | mapper.c \
45 | mapper-single.c \
46 | mapper-multiple.c \
47 | xfer.h \
48 | xfer.c \
49 | xfer-options.c \
50 | xfer-libasound.h \
51 | xfer-libasound.c \
52 | frame-cache.h \
53 | frame-cache.c \
54 | xfer-libasound-irq-rw.c \
55 | subcmd-transfer.c \
56 | xfer-libasound-irq-mmap.c \
57 | waiter.h \
58 | waiter.c \
59 | waiter-poll.c \
60 | waiter-select.c \
61 | waiter-epoll.c \
62 | xfer-libasound-timer-mmap.c
63 |
64 | if HAVE_FFADO
65 | axfer_SOURCES += xfer-libffado.c
66 | LDADD += -lffado
67 | endif
68 |
69 | EXTRA_DIST = \
70 | axfer.1 \
71 | axfer-list.1 \
72 | axfer-transfer.1
73 |
--------------------------------------------------------------------------------
/bat/bat-signal.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Caleb Crome
3 | * Copyright (C) 2013-2015 Intel Corporation
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | */
16 |
17 | /*
18 | * Here's a generic sine wave generator that will work indefinitely
19 | * for any frequency.
20 | *
21 | * Note: the state & phasor are stored as doubles (and updated as
22 | * doubles) because after a million samples the magnitude drifts a
23 | * bit. If we really need floats, it can be done with periodic
24 | * renormalization of the state_real+state_imag magnitudes.
25 | */
26 |
27 | int sin_generator_init(struct sin_generator *, float, float, float);
28 | float sin_generator_next_sample(struct sin_generator *);
29 | void sin_generator_vfill(struct sin_generator *, float *, int);
30 | int generate_sine_wave(struct bat *, int, void *);
31 | int generate_sine_wave_raw_mono(struct bat *, float *, float, int);
32 |
--------------------------------------------------------------------------------
/axfer/frame-cache.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // frame-cache.h - maintainer of cache for data frame.
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #include
10 |
11 | struct frame_cache {
12 | void *buf;
13 | void *buf_ptr;
14 |
15 | unsigned int remained_count;
16 |
17 | snd_pcm_access_t access;
18 | unsigned int bytes_per_sample;
19 | unsigned int samples_per_frame;
20 | unsigned int frames_per_cache;
21 |
22 | void (*align_frames)(struct frame_cache *cache,
23 | unsigned int consumed_count);
24 | };
25 |
26 | int frame_cache_init(struct frame_cache *cache, snd_pcm_access_t access,
27 | unsigned int bytes_per_sample,
28 | unsigned int samples_per_frame,
29 | unsigned int frames_per_cache);
30 | void frame_cache_destroy(struct frame_cache *cache);
31 |
32 | static inline unsigned int frame_cache_get_count(struct frame_cache *cache)
33 | {
34 | return cache->remained_count;
35 | }
36 |
37 | static inline void frame_cache_increase_count(struct frame_cache *cache,
38 | unsigned int frame_count)
39 | {
40 | cache->remained_count += frame_count;
41 | }
42 |
43 | static inline void frame_cache_reduce(struct frame_cache *cache,
44 | unsigned int consumed_count)
45 | {
46 | cache->align_frames(cache, consumed_count);
47 | }
48 |
--------------------------------------------------------------------------------
/topology/nhlt/intel/dmic/dmic-intel.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | //
3 | // Copyright(c) 2021 Intel Corporation. All rights reserved.
4 | //
5 | // Author: Seppo Ingalsuo
6 | // Jaska Uimonen
7 |
8 | #ifndef __DMIC_INTEL_H
9 | #define __DMIC_INTEL_H
10 |
11 | #include
12 |
13 | #define DMIC_TS_GROUP_SIZE 4
14 |
15 | /* structs for intel dmic nhlt vendor specific blob generation */
16 | struct dmic_intel_fir_config {
17 | uint32_t fir_control;
18 | uint32_t fir_config;
19 | uint32_t dc_offset_left;
20 | uint32_t dc_offset_right;
21 | uint32_t out_gain_left;
22 | uint32_t out_gain_right;
23 | uint32_t reserved2[2];
24 | uint32_t fir_coeffs[];
25 | } __attribute__((packed));
26 |
27 | struct dmic_intel_pdm_ctrl_cfg {
28 | uint32_t cic_control;
29 | uint32_t cic_config;
30 | uint32_t reserved0;
31 | uint32_t mic_control;
32 | uint32_t pdmsm;
33 | uint32_t reuse_fir_from_pdm;
34 | uint32_t reserved1[2];
35 | struct dmic_intel_fir_config fir_config[];
36 | } __attribute__((packed));
37 |
38 | struct dmic_intel_config_data {
39 | uint32_t gateway_attributes;
40 | uint32_t ts_group[DMIC_TS_GROUP_SIZE];
41 | uint32_t clock_on_delay;
42 | uint32_t channel_ctrl_mask;
43 | uint32_t chan_ctrl_cfg[2];
44 | uint32_t channel_pdm_mask;
45 | struct dmic_intel_pdm_ctrl_cfg pdm_ctrl_cfg[];
46 | } __attribute__((packed));
47 |
48 | #endif /* __DMIC_INTEL_H */
49 |
--------------------------------------------------------------------------------
/alsactl/init/ca0106:
--------------------------------------------------------------------------------
1 | # Configuration for CA0106 driver
2 |
3 | CTL{reset}="mixer"
4 | CTL{name}="Master Playback Volume", CTL{values}="-20dB"
5 | CTL{name}="Master Playback Switch", CTL{values}="on"
6 | CTL{name}="Analog Front Playback Volume", CTL{values}="0dB"
7 | CTL{name}="Analog Front Playback Switch", CTL{values}="on"
8 | CTL{name}="Analog Rear Playback Volume", CTL{values}="0dB"
9 | CTL{name}="Analog Rear Playback Switch", CTL{values}="on"
10 | CTL{name}="Analog Center/LFE Playback Volume", CTL{values}="0dB"
11 | CTL{name}="Analog Center/LFE Playback Switch", CTL{values}="on"
12 | CTL{name}="Analog Side Playback Volume", CTL{values}="0dB"
13 | CTL{name}="Analog Side Playback Switch", CTL{values}="on"
14 | CTL{name}="IEC958 Front Playback Volume", CTL{values}="0dB"
15 | CTL{name}="IEC958 Rear Playback Volume", CTL{values}="0dB"
16 | CTL{name}="IEC958 Center/LFE Playback Volume", CTL{values}="0dB"
17 | # capture
18 | CTL{name}="Analog Source Capture Enum", CTL{value}="Mic"
19 | CTL{name}="Mic Capture Volume", CTL{values}="6dB"
20 | CTL{name}="Shared Mic/Line in Capture Switch", CTL{values}="Mic in"
21 |
22 | # some variants have also AC97 mixer
23 |
24 | CTL{reset}="mixer"
25 | CTL{name}="AC97 Line Capture Volume",PROGRAM!="__ctl_search",GOTO="ac97_end"
26 | CTL{name}="Analog Source Capture Enum", CTL{value}="AC97 in"
27 | CTL{name}="AC97 Mic Capture Switch", "on"
28 | CTL{name}="AC97 Mic Capture Value", "6dB"
29 | LABEL="ac97_end"
30 |
31 | RESULT="true", EXIT="return"
32 |
--------------------------------------------------------------------------------
/topology/nhlt/intel/intel-nhlt.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | //
3 | // Copyright(c) 2021 Intel Corporation. All rights reserved.
4 | //
5 | // Author: Jaska Uimonen
6 |
7 | #ifndef __INTEL_NHLT_H
8 | #define __INTEL_NHLT_H
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | #define MIN(a, b) ({ \
18 | typeof(a) __a = (a); \
19 | typeof(b) __b = (b); \
20 | __a > __b ? __b : __a; \
21 | })
22 | #define MAX(a, b) ({ \
23 | typeof(a) __a = (a); \
24 | typeof(b) __b = (b); \
25 | __a < __b ? __b : __a; \
26 | })
27 |
28 | #define ARRAY_SIZE(a) (sizeof (a) / sizeof (a)[0])
29 |
30 | #define BIT(b) (1UL << (b))
31 | #define MASK(b_hi, b_lo) (((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL) << (b_lo))
32 | #define SET_BIT(b, x) (((x) & 1) << (b))
33 | #define SET_BITS(b_hi, b_lo, x) (((x) & ((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL)) << (b_lo))
34 |
35 | struct intel_nhlt_params {
36 | void *dmic_params;
37 | void *ssp_params;
38 | };
39 |
40 | struct dai_values {
41 | char name[32];
42 | snd_config_type_t type;
43 | snd_config_t *data;
44 | long *int_val;
45 | const char **string_val;
46 | };
47 |
48 | int find_set_values(struct dai_values *values, int size, snd_config_t *dai_cfg,
49 | snd_config_t *top, const char *class_name);
50 |
51 | #endif /* __INTEL_NHLT_H */
52 |
--------------------------------------------------------------------------------
/include/os_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * ALSA lib - compatibility header for supporting various OSes
3 | * Copyright (C) 2022 by Takayoshi SASANO
4 | *
5 | *
6 | * This library is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as
8 | * published by the Free Software Foundation; either version 2.1 of
9 | * the License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | */
21 |
22 | #ifndef __OS_COMPAT_H
23 | #define __OS_COMPAT_H
24 |
25 | #ifndef ESTRPIPE
26 | #define ESTRPIPE ESPIPE
27 | #endif
28 |
29 | #ifndef ERESTART
30 | #define ERESTART EINTR
31 | #endif
32 |
33 | #ifndef SCHED_IDLE
34 | #define SCHED_IDLE SCHED_OTHER
35 | #endif
36 |
37 | #if defined(__OpenBSD__)
38 | /* these functions in are not implemented */
39 | #define sched_getparam(pid, param) (-1)
40 | #define sched_setscheduler(pid, policy, param) (-1)
41 | #endif
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # alsa-utils
2 | ## Advanced Linux Sound Architecture - Utilities
3 |
4 | [](https://github.com/alsa-project/alsa-utils/actions/workflows/build.yml?query=branch%3Amaster++)
5 |
6 | This package contains the command line utilities for the ALSA project.
7 | The package can be compiled only with the installed ALSA driver and
8 | the ALSA C library (alsa-lib).
9 |
10 | Utility | Description
11 | ----------------|----------------------------------------------------
12 | alsaconf | the ALSA driver configurator script
13 | alsa-info | a script to gather information about ALSA subsystem
14 | alsactl | an utility for soundcard settings management
15 | aplay/arecord | an utility for the playback / capture of .wav,.voc,.au files
16 | axfer | an utility to transfer audio data frame (enhancement of aplay)
17 | amixer | a command line mixer
18 | alsamixer | a ncurses mixer
19 | amidi | a utility to send/receive sysex dumps or other MIDI data
20 | iecset | a utility to show/set the IEC958 status bits
21 | speaker-test | a speaker test utility
22 | alsaloop | a software loopback for PCM devices
23 | alsaucm | Use Case Manager utility
24 | alsabat | a sound tester for ALSA sound card driver
25 | alsatplg | ALSA topology compiler
26 |
27 | You may give a look for more information about the ALSA project to URL
28 | http://www.alsa-project.org.
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | configure
2 | config.log
3 | config.cache
4 | config.status
5 | config.guess
6 | config.rpath
7 | config.sub
8 | Makefile.conf
9 | confdefs.h
10 | aclocal.m4
11 | Makefile
12 | Makefile.in
13 | libtool
14 | ltmain.sh
15 | ltconfig
16 | version
17 | autom4te.cache
18 | compile
19 | depcomp
20 | missing
21 | install-sh
22 | mkinstalldirs
23 | test-driver
24 | ABOUT-NLS
25 | *.ok
26 | *.gmo
27 | *.la
28 | *.lo
29 | *.o
30 | *~
31 | .deps
32 | .libs
33 | .dirstamp
34 |
35 | alsactl/alsactl
36 | alsactl/alsactl_init.7
37 | alsactl/alsa-state.service
38 | alsactl/alsa-restore.service
39 | alsactl/alsa-store.service
40 | alsaconf/alsaconf
41 | alsamixer/alsamixer
42 | amidi/amidi
43 | amixer/amixer
44 | aplay/aplay
45 | aplay/arecord
46 | aplay/arecord.1
47 | axfer/axfer
48 | bat/alsabat
49 | iecset/iecset
50 | seq/aconnect/aconnect
51 | seq/aplaymidi/aplaymidi
52 | seq/aplaymidi/arecordmidi
53 | seq/aplaymidi2/aplaymidi2
54 | seq/aplaymidi2/arecordmidi2
55 | seq/aseqdump/aseqdump
56 | seq/aseqsend/aseqsend
57 | seq/aseqnet/aseqnet
58 | speaker-test/speaker-test
59 | topology/alsatplg.1
60 | alsaloop/alsaloop
61 | alsaucm/alsaucm
62 | alsaucm/alsaucm.1
63 | alsaucm/89-alsa-ucm.rules
64 | topology/alsatplg
65 | nhlt/nhlt-dmic-info
66 |
67 | include/aconfig.h*
68 | include/stamp-*
69 | include/version.h
70 | po/Makefile*
71 | po/POTFILES
72 | po/Rules-quot
73 | po/*.header
74 | po/*.sin
75 | po/*.sed
76 | po/*.gmo
77 | po/stamp-po
78 | po/alsa-utils.pot
79 | po/Makevars.template
80 | po/ChangeLog
81 | m4/*
82 | utils/*.spec
83 |
--------------------------------------------------------------------------------
/topology/topology.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This library is free software; you can redistribute it and/or
3 | * modify it under the terms of the GNU Lesser General Public
4 | * License as published by the Free Software Foundation; either
5 | * version 2 of the License, or (at your option) any later version.
6 | *
7 | * This library is distributed in the hope that it will be useful,
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 | * Lesser General Public License for more details.
11 | *
12 | * You should have received a copy of the GNU General Public License
13 | * along with this program; if not, write to the Free Software
14 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 | */
16 |
17 | #ifndef __TOPOLOGY_H
18 | #define __TOPOLOGY_H
19 |
20 | #include
21 |
22 | /* pre_processor */
23 | struct tplg_pre_processor {
24 | snd_config_t *input_cfg;
25 | snd_config_t *output_cfg;
26 | snd_output_t *output;
27 | snd_output_t *dbg_output;
28 | snd_config_t *current_obj_cfg;
29 | snd_config_t *define_cfg;
30 | snd_config_t *define_cfg_merged;
31 | char *inc_path;
32 | };
33 |
34 | int pre_process(struct tplg_pre_processor *tplg_pp, char *config, size_t config_size,
35 | const char *pre_processor_defs, const char *inc_path);
36 | int init_pre_processor(struct tplg_pre_processor **tplg_pp, snd_output_type_t type,
37 | const char *output_file);
38 | void free_pre_processor(struct tplg_pre_processor *tplg_pp);
39 | #endif
40 |
--------------------------------------------------------------------------------
/axfer/axfer-list.1:
--------------------------------------------------------------------------------
1 | .TH AXFER\-LIST 1 "28 November 2018" "alsa\-utils"
2 |
3 | .SH NAME
4 | axfer\-list \- dump lists of available sound devices and nodes to transfer audio
5 | data frame.
6 |
7 | .SH SYNOPSIS
8 |
9 | .B axfer list
10 | .I direction target
11 |
12 | direction =
13 | .B capture
14 | |
15 | .B playback
16 |
17 | target =
18 | .B device
19 | |
20 | .B pcm
21 |
22 | .SH DESCRIPTION
23 | The
24 | .B list
25 | subcommand of
26 | .B axfer
27 | dumps lists of available nodes to
28 | transfer audio data frame. At present, the subcommand is helpful just for
29 | libasound backend of
30 | .B transfer
31 | subcommand.
32 |
33 | .SH OPTIONS
34 |
35 | .SS Direction
36 |
37 | .TP
38 | .B capture
39 | Operates for capture transmission.
40 |
41 | .TP
42 | .B playback
43 | Operates for playback transmission.
44 |
45 | .SS Target
46 |
47 | .TP
48 | .B device
49 | Dumps a list of all soundcards and digital audio devices available in
50 | .I libasound
51 | backend for
52 | .I tranfer
53 | subcommand.
54 |
55 | .TP
56 | .B pcm
57 | Dumps a list of all PCM nodes available in alsa\-lib configuration space in
58 | .I libasound
59 | backend for
60 | .I transfer
61 | subcommand.
62 |
63 | .SH COMPATIBILITY TO APLAY
64 |
65 | Options of
66 | .I \-l
67 | ,
68 | .I \-\-list-devices
69 | are handled as
70 | .I device
71 | operation. Options of
72 | .I \-L
73 | ,
74 | .I \-\-list-pcms
75 | are handled as
76 | .I pcm
77 | operation.
78 |
79 | .SH SEE ALSO
80 | .B axfer(1),
81 | .B axfer\-transfer(1),
82 | .B alsamixer(1),
83 | .B amixer(1)
84 |
85 | .SH AUTHOR
86 | Takashi Sakamoto
87 |
--------------------------------------------------------------------------------
/include/bswap.h:
--------------------------------------------------------------------------------
1 | /*
2 | * ALSA lib - compatibility header for providing byte swapping macros
3 | * Copyright (c) 2016 by Thomas Klausner
4 | *
5 | *
6 | * This library is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU Lesser General Public License as
8 | * published by the Free Software Foundation; either version 2.1 of
9 | * the License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | */
21 |
22 | #ifndef __BSWAP_H
23 | #define __BSWAP_H
24 |
25 | #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
26 | #include
27 | #define bswap_16 bswap16
28 | #define bswap_32 bswap32
29 | #define bswap_64 bswap64
30 | #elif defined(__OpenBSD__)
31 | #include
32 | #define bswap_16 swap16
33 | #define bswap_32 swap32
34 | #define bswap_64 swap64
35 | #elif defined (__sun)
36 | #include
37 | #define bswap_16 BSWAP_16
38 | #define bswap_32 BSWAP_32
39 | #define bswap_64 BSWAP_64
40 | #else
41 | #include
42 | #endif
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/seq/aconnect/README.aconnect:
--------------------------------------------------------------------------------
1 | ================================================================
2 | aconnect - control subscriptions
3 | ver.0.1.3
4 | Copyright (C) 1999-2000 Takashi Iwai
5 | ================================================================
6 |
7 | aconnect is a utility to control subscriptions of two ports as the
8 | third "manager" client.
9 |
10 | For example, the following connects two ports, from 64:0 to 65:0.
11 |
12 | % aconnect 64:0 65:0
13 |
14 | To disconnect the existing subscription, use -d option.
15 |
16 | % aconnect -d 64:0 65:0
17 |
18 | To see which port is available as input port, run the following
19 | command:
20 |
21 | % aconnect -i
22 | client 0: 'System' [type=kernel]
23 | 0 'Timer '
24 | 1 'Announce '
25 | client 64: '0: MIDI Synth' [type=kernel]
26 | 0 'card 0: synth-midi: 0'
27 |
28 | Similary, to see the output ports, use -o flag.
29 |
30 | % aconnect -o
31 | client 64: '0: MIDI Synth' [type=kernel]
32 | 0 'card 0: synth-midi: 0'
33 | client 65: 'AWE Wave Table Synth : 0' [type=kernel]
34 | 0 'Emu8000 port 0 '
35 | 1 'Emu8000 port 1 '
36 | 2 'Emu8000 port 2 '
37 | 3 'Emu8000 port 3 '
38 |
39 | The option -l together with -i or -o shows subscribers for each port.
40 |
41 | Ports are connected exclusively when the option -e is specified.
42 |
43 | For modifying time-stamp with a queue, use -r or -t option followed by
44 | a queue index which updates the time-stamp. Former uses real-time queue,
45 | while the latter uses tick queue. The queue must be used (not necessarily
46 | owned) by the receiver client.
47 |
--------------------------------------------------------------------------------
/alsactl/conf/90-alsa-restore.rules.in:
--------------------------------------------------------------------------------
1 | # do not edit this file, it will be overwritten on update
2 |
3 | ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*",@extratest@ GOTO="alsa_restore_go"
4 | GOTO="alsa_restore_end"
5 |
6 | LABEL="alsa_restore_go"
7 |
8 | ENV{ALSA_CARD_NUMBER}="$attr{device/number}"
9 |
10 | # mark HDA analog card; HDMI/DP card does not have capture devices
11 | DRIVERS=="snd_hda_intel", TEST=="device/pcmC$env{ALSA_CARD_NUMBER}D0c", RUN+="/bin/sh -c 'echo ALSA_CARD_HDA_ANALOG=$env{ALSA_CARD_NUMBER} >> /run/udev/alsa-hda-analog-card'"
12 |
13 | # check for ACP hardware
14 | TEST=="device/device/acp3x-dmic-capture", GOTO="alsa_hda_analog"
15 | TEST=="device/device/acp6x-dmic-capture", GOTO="alsa_hda_analog"
16 | TEST=="device/device/acp63-dmic-capture", GOTO="alsa_hda_analog"
17 | TEST=="device/device/acp-dmic-codec", GOTO="alsa_hda_analog"
18 | GOTO="alsa_restore_std"
19 |
20 | LABEL="alsa_hda_analog"
21 | # restore configuration for profile with combined cards (HDA + digital mic)
22 | TEST!="/run/udev/alsa-hda-analog-card", GOTO="alsa_restore_std"
23 | IMPORT{program}="/usr/bin/cat /run/udev/alsa-hda-analog-card"
24 | ENV{ALSA_CARD_HDA_ANALOG}!="", ENV{ALSA_CARD_NUMBER}="$env{ALSA_CARD_HDA_ANALOG}"
25 |
26 | LABEL="alsa_restore_std"
27 | TEST!="@daemonswitch@", IMPORT{program}="@sbindir@/alsactl@args@ --export restore $env{ALSA_CARD_NUMBER}"
28 | TEST=="@daemonswitch@", IMPORT{program}="@sbindir@/alsactl@args@ --export nrestore $env{ALSA_CARD_NUMBER}"
29 | ENV{ALSA_CARD_STATE}=="waiting", ENV{SYSTEMD_WANTS}="alsa-card-wait@$env{ALSA_CARD_NUMBER}.service"
30 |
31 | LABEL="alsa_restore_end"
32 |
--------------------------------------------------------------------------------
/alsa-info/alsa-info.sh.8:
--------------------------------------------------------------------------------
1 | .TH ALSA-INFO.SH 1 "13 January 2016"
2 | .SH NAME
3 | alsa-info.sh \- command\-line utility to gather information about
4 | the ALSA subsystem
5 | .SH SYNOPSIS
6 | \fBalsa-info.sh\fP [\fIoptions\fP]
7 |
8 | .SH DESCRIPTION
9 | \fBalsa-info.sh\fP is a command\-line utility gathering information
10 | about the ALSA subsystem. It is used mostly for debugging purposes.
11 |
12 | .SH OPTIONS
13 | .TP
14 | \fI\-\-upload\fP
15 | Upload contents to the server (www.alsa-project.org or pastebin.ca).
16 | .TP
17 | \fI\-\-no-upload\fP
18 | Do not upload contents to the remote server.
19 | .TP
20 | \fI\-\-stdout\fP
21 | Print information to standard output.
22 | .TP
23 | \fI\-\-output FILE\fP
24 | Specify file for output in no-upload mode.
25 | .TP
26 | \fI\-\-debug\fP
27 | Run utility as normal, but will not delete file (usually
28 | /tmp/alsa-info.txt).
29 | .TP
30 | \fI\-\-with-aplay\fP
31 | Includes output from \fIaplay -l\fP.
32 | .TP
33 | \fI\-\-with-amixer\fP
34 | Includes output from \fIamixer\fP.
35 | .TP
36 | \fI\-\-with-alsactl\fP
37 | Includes output from \fIalsactl\fP.
38 | .TP
39 | \fI\-\-with-configs\fP
40 | Includes output from ~/.asoundrc and /etc/asound.conf if they exist.
41 | .TP
42 | \fI\-\-update\fP
43 | Check server for updates.
44 | .TP
45 | \fI\-\-about\fP
46 | Print information about authors.
47 |
48 | .SH EXAMPLES
49 |
50 | .TP
51 | \fBalsa-info.sh \-\-no-upload\fR
52 | Will gather all information and show the output file.
53 |
54 | .SH SEE ALSO
55 | \fB
56 | aplay(1)
57 | amixer(1)
58 | alsactl(1)
59 | \fP
60 |
61 | .SH AUTHOR
62 | \fBalsa-info.sh\fP was created by the ALSA team, see \fI\-\-about\fP .
63 |
--------------------------------------------------------------------------------
/axfer/test/generator.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // generator.c - a generator for test with buffers of PCM frames.
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #ifndef __ALSA_UTILS_AXFER_TEST_GENERATOR__H_
10 | #define __ALSA_UTILS_AXFER_TEST_GENERATOR__H_
11 |
12 | #include
13 | #include
14 |
15 | struct test_generator;
16 | typedef int (*generator_cb_t)(struct test_generator *gen,
17 | snd_pcm_access_t access,
18 | snd_pcm_format_t sample_format,
19 | unsigned int samples_per_frame,
20 | void *frame_buffer, unsigned int frame_count);
21 |
22 | struct test_generator {
23 | int fd;
24 | uint64_t access_mask;
25 | uint64_t sample_format_mask;
26 | unsigned int min_samples_per_frame;
27 | unsigned int max_samples_per_frame;
28 | unsigned int min_frame_count;
29 | unsigned int max_frame_count;
30 | unsigned int step_frame_count;
31 |
32 | generator_cb_t cb;
33 | void *private_data;
34 | };
35 |
36 | int generator_context_init(struct test_generator *gen,
37 | uint64_t access_mask, uint64_t sample_format_mask,
38 | unsigned int min_samples_per_frame,
39 | unsigned int max_samples_per_frame,
40 | unsigned int min_frame_count,
41 | unsigned int max_frame_count,
42 | unsigned int step_frame_count,
43 | unsigned int private_size);
44 | int generator_context_run(struct test_generator *gen, generator_cb_t cb);
45 | void generator_context_destroy(struct test_generator *gen);
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/topology/pre-process-external.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This library is free software; you can redistribute it and/or modify
3 | * it under the terms of the GNU Lesser General Public License as
4 | * published by the Free Software Foundation; either version 2.1 of
5 | * the License, or (at your option) any later version.
6 | *
7 | * This program is distributed in the hope that it will be useful,
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 | * GNU Lesser General Public License for more details.
11 | *
12 | * You should have received a copy of the GNU Lesser General Public
13 | * License along with this library; if not, write to the Free Software
14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 | *
16 | */
17 | #ifndef __PRE_PROCESS_EXTERNAL_H
18 | #define __PRE_PROCESS_EXTERNAL_H
19 |
20 | #define PROCESS_FUNC_PREFIX "_snd_topology_"
21 | #define PROCESS_FUNC_POSTFIX "_process"
22 | #define PROCESS_LIB_PREFIX "libalsatplg_module_"
23 | #define PROCESS_LIB_POSTFIX ".so"
24 |
25 | /**
26 | * Define the object entry for external pre-process plugins
27 | */
28 | #define SND_TOPOLOGY_PLUGIN_ENTRY(name) _snd_topology_##name##_process
29 |
30 | /**
31 | * Define the plugin
32 | */
33 | #define SND_TOPOLOGY_PLUGIN_DEFINE_FUNC(plugin) \
34 | __attribute__ ((visibility ("default"))) \
35 | int SND_TOPOLOGY_PLUGIN_ENTRY(plugin) (snd_config_t *input, snd_config_t *output)
36 |
37 | typedef int (*plugin_pre_process)(snd_config_t *input, snd_config_t *output);
38 |
39 | #endif /* __PRE_PROCESS_EXTERNAL_H */
40 |
--------------------------------------------------------------------------------
/alsactl/init/hda:
--------------------------------------------------------------------------------
1 | # Configuration for HDA Intel driver (High Definition Audio - Azalia)
2 |
3 | CARDINFO{mixername}=="Realtek ALC880", \
4 | ATTR{subsystem_vendor}=="0x1025", ATTR{subsystem_device}=="0x0070", \
5 | GOTO="Acer Travelmate 8100"
6 | CARDINFO{mixername}=="Analog Devices AD1984", \
7 | ATTR{subsystem_vendor}=="0x17aa", ATTR{subsystem_device}=="0x20ac", \
8 | GOTO="Lenovo T61"
9 | RESULT="false", EXIT="return"
10 |
11 | LABEL="Acer Travelmate 8100"
12 | # playback
13 | CTL{reset}="mixer"
14 | CTL{name}="Master Playback Volume", CTL{values}="-21dB"
15 | CTL{name}="Master Playback Switch", CTL{values}="on"
16 | CTL{name}="Headphone Playback Switch", CTL{values}="on"
17 | CTL{name}="Front Playback Volume", CTL{values}="-29dB"
18 | CTL{name}="Front Playback Switch", CTL{values}="on"
19 | CTL{name}="PCM Playback Volume", CTL{values}="0dB"
20 | # capture
21 | CTL{name}="Input Source", CTL{value}="Mic"
22 | CTL{name}="Capture Volume", CTL{values}="20dB"
23 | CTL{name}="Capture Switch", CTL{values}="on"
24 | RESULT="true", EXIT="return"
25 |
26 | LABEL="Lenovo T61"
27 | # playback
28 | CTL{reset}="mixer"
29 | CTL{name}="Master Playback Volume", CTL{values}="-13.5dB"
30 | CTL{name}="Master Playback Switch", CTL{values}="on"
31 | CTL{name}="Headphone Playback Switch", CTL{values}="on"
32 | CTL{name}="Speaker Playback Switch", CTL{values}="on"
33 | CTL{name}="PCM Playback Volume", CTL{values}="0dB"
34 | # capture
35 | CTL{name}="Input Source", CTL{value}="Internal Mic"
36 | CTL{name}="Internal Mic Boost", CTL{values}="1"
37 | CTL{name}="Capture Volume", CTL{values}="9dB"
38 | CTL{name}="Capture Switch", CTL{values}="on"
39 | RESULT="true", EXIT="return"
40 |
--------------------------------------------------------------------------------
/alsamixer/mem.c:
--------------------------------------------------------------------------------
1 | /*
2 | * mem.c - memory allocation checkers
3 | * Copyright (c) Clemens Ladisch
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | #include "aconfig.h"
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include "die.h"
26 | #include "mem.h"
27 |
28 | static void check(void *p)
29 | {
30 | if (!p)
31 | fatal_error("out of memory");
32 | }
33 |
34 | void *ccalloc(size_t n, size_t size)
35 | {
36 | void *mem = calloc(n, size);
37 | if (n && size)
38 | check(mem);
39 | return mem;
40 | }
41 |
42 | void *crealloc(void *ptr, size_t new_size)
43 | {
44 | ptr = realloc(ptr, new_size);
45 | if (new_size)
46 | check(ptr);
47 | return ptr;
48 | }
49 |
50 | char *cstrdup(const char *s)
51 | {
52 | char *str = strdup(s);
53 | check(str);
54 | return str;
55 | }
56 |
57 | char *casprintf(const char *fmt, ...)
58 | {
59 | va_list ap;
60 | char *str;
61 |
62 | va_start(ap, fmt);
63 | if (vasprintf(&str, fmt, ap) < 0)
64 | check(NULL);
65 | va_end(ap);
66 | return str;
67 | }
68 |
--------------------------------------------------------------------------------
/INSTALL:
--------------------------------------------------------------------------------
1 |
2 | ALSA utils installation
3 | =======================
4 |
5 | Requirements
6 | ------------
7 |
8 | alsamixer requires the ncurses library. Some systems need to install
9 | the develop package additionally to link with this library.
10 |
11 | alsaconf requires dialog or whiptail program to run properly.
12 |
13 | If systemd (minimum version 18) is installed it will be used to run
14 | alsactl to store and restore settings.
15 |
16 | Installation
17 | ------------
18 |
19 | For installation you can use these commands:
20 |
21 | ./configure
22 | make install
23 |
24 | If ./configure command complain that alsa-lib package isn't installed,
25 | please, check if --prefix option is same for alsa-lib and alsa-utils
26 | package. The configure script from alsa-utils package probably cannot find
27 | header file asoundlib.h in $prefix/include/alsa directory (usually in
28 | /usr/include/alsa directory).
29 |
30 | Compilation from git sources
31 | ---------------------------
32 |
33 | You need also GNU packages autoconf and automake installed in your system
34 | to compile git sources of alsa-utils package.
35 |
36 | For compilation you can use these commands:
37 |
38 | aclocal
39 | gettextize
40 | autoheader
41 | automake --foreign --copy --add-missing
42 | autoconf
43 | ./configure
44 | make
45 |
46 | The included gitcompile script does this job for you.
47 |
48 | To configure the build to install in a local directory, a command like the
49 | following can be used:
50 |
51 | ./gitcompile --prefix="$PWD/build" \
52 | --with-systemdsystemunitdir="$PWD/build/$(pkg-config systemd --variable=systemdsystemunitdir)" \
53 | --with-udev-rules-dir="$PWD/build/$(pkg-config udev --variable=udevdir)"
54 |
55 | Note: Some automake packages have missing aclocal program. Use newer version
56 | in the case.
57 |
--------------------------------------------------------------------------------
/axfer/container-raw.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // container-raw.c - a parser/builder for a container with raw data frame.
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #include "container.h"
10 | #include "misc.h"
11 |
12 | #include
13 | #include
14 | #include
15 |
16 | static int raw_builder_pre_process(struct container_context *cntr ATTRIBUTE_UNUSED,
17 | snd_pcm_format_t *format ATTRIBUTE_UNUSED,
18 | unsigned int *samples_per_frame ATTRIBUTE_UNUSED,
19 | unsigned int *frames_per_second ATTRIBUTE_UNUSED,
20 | uint64_t *byte_count)
21 | {
22 | *byte_count = UINT64_MAX;
23 |
24 | return 0;
25 | }
26 |
27 | static int raw_parser_pre_process(struct container_context *cntr,
28 | snd_pcm_format_t *format ATTRIBUTE_UNUSED,
29 | unsigned int *samples_per_frame ATTRIBUTE_UNUSED,
30 | unsigned int *frames_per_second ATTRIBUTE_UNUSED,
31 | uint64_t *byte_count)
32 | {
33 | struct stat buf = {0};
34 | int err;
35 |
36 | if (cntr->stdio) {
37 | *byte_count = UINT64_MAX;
38 | return 0;
39 | }
40 |
41 | err = fstat(cntr->fd, &buf);
42 | if (err < 0)
43 | return err;
44 |
45 | *byte_count = buf.st_size;
46 | if (*byte_count == 0)
47 | *byte_count = UINT64_MAX;
48 |
49 | return 0;
50 | }
51 |
52 | const struct container_parser container_parser_raw = {
53 | .format = CONTAINER_FORMAT_RAW,
54 | .max_size = UINT64_MAX,
55 | .ops = {
56 | .pre_process = raw_parser_pre_process,
57 | },
58 | };
59 |
60 | const struct container_builder container_builder_raw = {
61 | .format = CONTAINER_FORMAT_RAW,
62 | .max_size = UINT64_MAX,
63 | .ops = {
64 | .pre_process = raw_builder_pre_process,
65 | },
66 | };
67 |
--------------------------------------------------------------------------------
/axfer/waiter.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // waiter.h - a header for I/O event waiter.
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #ifndef __ALSA_UTILS_AXFER_WAITER__H_
10 | #define __ALSA_UTILS_AXFER_WAITER__H_
11 |
12 | #include
13 | #include
14 |
15 | enum waiter_type {
16 | WAITER_TYPE_DEFAULT = 0,
17 | WAITER_TYPE_POLL,
18 | WAITER_TYPE_SELECT,
19 | WAITER_TYPE_EPOLL,
20 | WAITER_TYPE_COUNT,
21 | };
22 |
23 | struct waiter_ops;
24 |
25 | struct waiter_context {
26 | enum waiter_type type;
27 | const struct waiter_ops *ops;
28 | void *private_data;
29 |
30 | struct pollfd *pfds;
31 | unsigned int pfd_count;
32 | };
33 |
34 | enum waiter_type waiter_type_from_label(const char *label);
35 | const char *waiter_label_from_type(enum waiter_type type);
36 |
37 | int waiter_context_init(struct waiter_context *waiter,
38 | enum waiter_type type, unsigned int pfd_count);
39 | int waiter_context_prepare(struct waiter_context *waiter);
40 | int waiter_context_wait_event(struct waiter_context *waiter,
41 | int timeout_msec);
42 | void waiter_context_release(struct waiter_context *waiter);
43 | void waiter_context_destroy(struct waiter_context *waiter);
44 |
45 | // For internal use in 'waiter' module.
46 |
47 | struct waiter_ops {
48 | int (*prepare)(struct waiter_context *waiter);
49 | int (*wait_event)(struct waiter_context *waiter, int timeout_msec);
50 | void (*release)(struct waiter_context *waiter);
51 | };
52 |
53 | struct waiter_data {
54 | struct waiter_ops ops;
55 | unsigned int private_size;
56 | };
57 |
58 | extern const struct waiter_data waiter_poll;
59 | extern const struct waiter_data waiter_select;
60 | extern const struct waiter_data waiter_epoll;
61 |
62 | #endif
63 |
--------------------------------------------------------------------------------
/seq/aplaymidi/aplaymidi.1:
--------------------------------------------------------------------------------
1 | .TH APLAYMIDI 1 "2 Nov 2011"
2 |
3 | .SH NAME
4 | aplaymidi \- play Standard MIDI Files
5 |
6 | .SH SYNOPSIS
7 | .B aplaymidi
8 | \-p client:port[,...] [\-d delay] midifile ...
9 |
10 | .SH DESCRIPTION
11 | .B aplaymidi
12 | is a command-line utility that plays the specified MIDI file(s) to one
13 | or more ALSA sequencer ports.
14 |
15 | .SH OPTIONS
16 |
17 | .TP
18 | .I \-h, \-\-help
19 | Prints a list of options.
20 |
21 | .TP
22 | .I \-V, \-\-version
23 | Prints the current version.
24 |
25 | .TP
26 | .I \-l, \-\-list
27 | Prints a list of possible output ports.
28 |
29 | .TP
30 | .I \-p, \-\-port=client:port,...
31 | Sets the sequencer port(s) to which the events in the MIDI file(s) are
32 | sent.
33 |
34 | .TP
35 | .I \-u, \-\-ump=version
36 | Changes the sequencer client to the given MIDI version and outputs via
37 | the UMP packets instead of legacy sequencer events.
38 | As of now, the only supported version is 1.
39 |
40 | A client can be specified by its number, its name, or a prefix of its
41 | name. A port is specified by its number; for port 0 of a client, the
42 | ":0" part of the port specification can be omitted.
43 |
44 | Multiple ports can be specified to allow playback of MIDI file(s) that
45 | contain events for multiple devices (ports), as specified by "Port
46 | Number" meta events.
47 |
48 | For compatibility with
49 | .B pmidi(1),
50 | the port specification is taken from the
51 | .I ALSA_OUTPUT_PORTS
52 | environment variable if none is given on the command line.
53 |
54 | .TP
55 | .I \-d, \-\-delay=seconds
56 | Specifies how long to wait after the end of each MIDI file,
57 | to allow the last notes to die away.
58 |
59 | .SH BUGS
60 | .B aplaymidi
61 | handles "Port Number" meta events, but not "Port Name" meta events.
62 |
63 | .SH SEE ALSO
64 | pmidi(1)
65 | .br
66 | playmidi(1)
67 |
68 | .SH AUTHOR
69 | Clemens Ladisch
70 |
--------------------------------------------------------------------------------
/alsactl/init_sysdeps.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2003 Greg Kroah-Hartman
3 | * Copyright (C) 2005-2006 Kay Sievers
4 | *
5 | * This program is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation version 2 of the License.
8 | *
9 | * This program is distributed in the hope that it will be useful, but
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 | * General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License along
15 | * with this program; if not, write to the Free Software Foundation, Inc.,
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 | *
18 | */
19 |
20 | #if defined(__GLIBC__) && !(defined(__UCLIBC__) && defined(__USE_BSD))
21 | #if !(__GLIBC_PREREQ(2, 38))
22 | static size_t strlcpy(char *dst, const char *src, size_t size)
23 | {
24 | size_t bytes = 0;
25 | char *q = dst;
26 | const char *p = src;
27 | char ch;
28 |
29 | while ((ch = *p++)) {
30 | if (bytes+1 < size)
31 | *q++ = ch;
32 | bytes++;
33 | }
34 |
35 | /* If size == 0 there is no space for a final null... */
36 | if (size)
37 | *q = '\0';
38 | return bytes;
39 | }
40 |
41 | static size_t strlcat(char *dst, const char *src, size_t size)
42 | {
43 | size_t bytes = 0;
44 | char *q = dst;
45 | const char *p = src;
46 | char ch;
47 |
48 | while (bytes < size && *q) {
49 | q++;
50 | bytes++;
51 | }
52 | if (bytes == size)
53 | return (bytes + strlen(src));
54 |
55 | while ((ch = *p++)) {
56 | if (bytes+1 < size)
57 | *q++ = ch;
58 | bytes++;
59 | }
60 |
61 | *q = '\0';
62 | return bytes;
63 | }
64 | #endif /* !(__GLIBC_PREREQ(2, 38)) */
65 | #endif /* __GLIBC__ */
66 |
--------------------------------------------------------------------------------
/bat/tests/hdmi_audio_subdevice_number.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #/*
4 | # * Copyright (C) 2013-2016 Intel Corporation
5 | # *
6 | # * This program is free software; you can redistribute it and/or modify
7 | # * it under the terms of the GNU General Public License as published by
8 | # * the Free Software Foundation; either version 2 of the License, or
9 | # * (at your option) any later version.
10 | # *
11 | # * This program is distributed in the hope that it will be useful,
12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # * GNU General Public License for more details.
15 | # *
16 | # */
17 | #set -x
18 |
19 | subdevice_number=0
20 | get_subdevice=0
21 |
22 | #make sure the HDMI monitor is connected and active ########
23 |
24 | # To get HDMI audio device number
25 | card_number=$(aplay -l | grep "HDMI 0" | cut -b 6)
26 | if [ "$card_number" = "" ]; then
27 | echo "Can not get Display audio card."
28 | #failed to get Display audio card.
29 | exit 1
30 | fi
31 |
32 | audio_card_dir="/proc/asound/card$card_number/"
33 |
34 | cd $audio_card_dir
35 | for file in `ls`
36 | do
37 | #To get the ELD information according to the connented monitor with HDMI
38 | if [[ $file == eld* ]]; then
39 | let subdevice_number+=1
40 | cat $file | grep connection_type | grep HDMI > /dev/null
41 | if [ $? = 0 ]; then
42 | get_subdevice=1
43 | break
44 | fi
45 | fi
46 | done
47 |
48 | #failed to get the subdevice number of HDMI audio.
49 | if [ $get_subdevice == 0 ]; then
50 | exit 77
51 | fi
52 |
53 | #the subdevice number of HDMI audio is 3.
54 | if [ $subdevice_number == 1 ]; then
55 | exit 3
56 | #the subdevice number of HDMI audio is 7.
57 | elif [ $subdevice_number == 2 ]; then
58 | exit 7
59 | #the subdevice number of HDMI audio is 8.
60 | elif [ $subdevice_number == 3 ]; then
61 | exit 8
62 | #default: failed to get the subdevice number of HDMI audio.
63 | else
64 | exit 77
65 | fi
66 |
--------------------------------------------------------------------------------
/alsactl/init/00main:
--------------------------------------------------------------------------------
1 | # This is the toplevel configuration for 'alsactl init'.
2 | # See 'man alsactl_init' for syntax.
3 |
4 | # set root device directory in sysfs for soundcard for ATTR{} command
5 | CONFIG{sysfs_device}="/class/sound/card$cardinfo{card}/device"
6 | ACCESS!="$sysfsroot$config{sysfs_device}", \
7 | CONFIG{sysfs_device}="/class/sound/controlC$cardinfo{card}/device"
8 |
9 | # test for extra commands
10 | ENV{CMD}=="help", INCLUDE="help", GOTO="00main_end"
11 | ENV{CMD}=="info", INCLUDE="info", GOTO="00main_end"
12 | ENV{CMD}=="default", INCLUDE="default", GOTO="00main_end"
13 | ENV{CMD}=="test", INCLUDE="test", GOTO="00main_end"
14 | ENV{CMD}=="*", ERROR="Unknown command '$env{CMD}'\n", GOTO="00main_end"
15 |
16 | # include files with real configuration
17 | #
18 | # steps are:
19 | # 1) look for preinit subdirectory and parse all files in it
20 | # 2) if RESULT=="skip", skip ALSA standard configuration files
21 | # 3) do ALSA standard configuration
22 | # 4) look for postinit subdirectory and parse all files in it
23 | # 5) if RESULT!="true", initialize hardware using a guess method,
24 | # print an error message and return with exit code 99
25 | # 6) return with exit code 0 (success)
26 | #
27 |
28 | RESULT="unknown"
29 | ACCESS=="preinit", INCLUDE="preinit"
30 | RESULT=="skip", GOTO="init_end"
31 |
32 | # real ALSA configuration database
33 | CARDINFO{driver}=="HDA-Intel", INCLUDE="hda", GOTO="init_end"
34 | CARDINFO{driver}=="CA0106", INCLUDE="ca0106", GOTO="init_end"
35 | CARDINFO{driver}=="Test", INCLUDE="test", GOTO="init_end"
36 |
37 | LABEL="init_end"
38 | ACCESS=="postinit", INCLUDE="postinit"
39 | RESULT=="true", GOTO="00main_end"
40 | ERROR="Found hardware: \"$cardinfo{driver}\" \"$cardinfo{mixername}\" \"$cardinfo{components}\" \"$attr{subsystem_vendor}\" \"$attr{subsystem_device}\"\n"
41 | ERROR="Hardware is initialized using a generic method\n"
42 | INCLUDE="default"
43 | EXIT="99"
44 |
45 | #
46 | # label identifying end of main file
47 | #
48 |
49 | LABEL="00main_end"
50 |
--------------------------------------------------------------------------------
/bat/tests/dp_audio_subdevice_number.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #/*
4 | # * Copyright (C) 2013-2016 Intel Corporation
5 | # *
6 | # * This program is free software; you can redistribute it and/or modify
7 | # * it under the terms of the GNU General Public License as published by
8 | # * the Free Software Foundation; either version 2 of the License, or
9 | # * (at your option) any later version.
10 | # *
11 | # * This program is distributed in the hope that it will be useful,
12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # * GNU General Public License for more details.
15 | # *
16 | # */
17 | #set -x
18 |
19 | subdevice_number=0
20 | get_subdevice=0
21 |
22 | #make sure the DP monitor is connected and active
23 |
24 | # To get DisplayPort audio device number
25 | card_number=$(aplay -l | grep "HDMI 1" | cut -b 6)
26 | echo $card_number
27 | if [ "$card_number" = "" ]; then
28 | echo "Can not get Display audio card."
29 | exit 254
30 | fi
31 |
32 | audio_card_dir="/proc/asound/card$card_number/"
33 |
34 | cd $audio_card_dir
35 |
36 | for file in `ls`
37 | do
38 | #To get the ELD info according to the connented monitor with DisplayPort.
39 | if [[ $file == eld* ]]; then
40 | let subdevice_number+=1
41 | cat $file | grep connection_type | grep DisplayPort > /dev/null
42 | if [ $? = 0 ]; then
43 | echo "Get the ELD information according to the connented \
44 | monitor with DisplayPort."
45 | get_subdevice=1
46 | break
47 | fi
48 | fi
49 | done
50 |
51 | #failed to get the subdevice number of DisplayPort audio
52 | if [ $get_subdevice == 0 ]; then
53 | exit 77
54 | fi
55 |
56 | #the subdevice number of DisplayPort audio is 3
57 | if [ $subdevice_number == 1 ]; then
58 | exit 3
59 | #the subdevice number of DisplayPort audio is 7.
60 | elif [ $subdevice_number == 2 ]; then
61 | exit 7
62 | #the subdevice number of DisplayPort audio is 8
63 | elif [ $subdevice_number == 3 ]; then
64 | exit 8
65 | #default: failed to get the subdevice number of DisplayPort audio
66 | else
67 | exit 77
68 | fi
69 |
--------------------------------------------------------------------------------
/seq/aseqnet/README.aseqnet:
--------------------------------------------------------------------------------
1 | ================================================================
2 | ALSA sequencer connectors over network
3 | ver.0.1
4 | Copyright (C) 1999-2000 Takashi Iwai
5 | ================================================================
6 |
7 | * ASEQNET
8 |
9 | aseqnet is a sequencer client which sends/receives events over
10 | network. Suppose two hosts (hostA and hostB) connected by network.
11 | You need to run ALSA system on both hosts. Then, start aseqnet as a
12 | server on hostA:
13 |
14 | hostA% aseqnet
15 | sequencer opened: 128:0
16 |
17 | A user client 128 with port 0 was opened. (The client number may
18 | vary.) At next, start client on hostB. The argument is the hostname
19 | where server is running.
20 |
21 | hostB% aseqnet hostA
22 | sequencer opened: 132:0
23 |
24 | Now events sent to hostA:128:0 is transferred to hostB:132:0, and vice
25 | versa.
26 |
27 | You can connect these ports arbitrary to other sequencer ports.
28 | For example, connect hostB:132:0 to a MIDI output device 65:0. The
29 | aconnect utility can be used for this:
30 |
31 | hostB% aconnect 132:0 65:0
32 |
33 | Events to hostA:128:0 will be delivered indirectly to hostB:65:0.
34 | You'll hear MIDI sounds as following:
35 |
36 | hostA% pmidi -p 128:0 foo.mid
37 |
38 | The multiple clients may exist simultaneously. If hostC is connected
39 | as a client to hostA, events from from hostA are sent to all connected
40 | network clients, hostB and hostC. However, only one connection is
41 | allowed from a client to a server.
42 |
43 | To disconnect network, stop all clients before server by ctrl-C or
44 | sending signal to them. The server will automatically quit.
45 |
46 | The available options are:
47 |
48 | -p port : specify the TCP port number or TCP service name.
49 | Default value is 40002.
50 | -s addr : explicit read-subscription to the given address
51 | (client:addr).
52 | -d addr : explicit write-subscription to the given address.
53 | -n name : specify the midi name of the process.
54 | Default value is either 'Net Client' or 'Net Server'.
55 | -v : verbose mode.
56 |
--------------------------------------------------------------------------------
/seq/aseqdump/aseqdump.1:
--------------------------------------------------------------------------------
1 | .TH ASEQDUMP 1 "19 Feb 2005"
2 |
3 | .SH NAME
4 | aseqdump \- show the events received at an ALSA sequencer port
5 |
6 | .SH SYNOPSIS
7 | .B aseqdump
8 | [\fI\-p client:port,...\fP]
9 |
10 | .SH DESCRIPTION
11 | .B aseqdump
12 | is a command-line utility that prints the sequencer events it receives as text.
13 |
14 | To stop receiving, press Ctrl+C.
15 |
16 | .SH OPTIONS
17 |
18 | .TP
19 | .I \-h,\-\-help
20 | Prints a list of options.
21 |
22 | .TP
23 | .I \-V,\-\-version
24 | Prints the current version.
25 |
26 | .TP
27 | .I \-l,\-\-list
28 | Prints a list of possible input ports.
29 |
30 | .TP
31 | .I \-u,\-\-ump=version
32 | Sets the client MIDI version.
33 | 0 is for legacy mode, 1 is UMP MIDI 1.0 mode, and 2 is UMP MIDI 2.0 mode.
34 |
35 | .TP
36 | .I \-r,\-\-raw
37 | Suppress the automatic conversion of events among UMP and legacy clients.
38 |
39 | .TP
40 | .I \-R,\-\-raw-view
41 | Shows the raw values as is.
42 | The channel numbers and UMP group numbers are 0-based in this mode.
43 | This is the default behavior.
44 |
45 | .TP
46 | .I \-N,\-\-normalized-view
47 | Shows the normalized values to be aligned with MIDI 1.0.
48 | The channel numbers and UMP group numbers are shown as 1-based values,
49 | i.e. 1 is the lowest number.
50 | The velocity and data values are normalized between 0 and 127.
51 | The values for MIDI 2.0 are shown with two digits decimal points (from
52 | 0.00 to 127.00).
53 | The pitch wheel is normalized between -8192 to 8192, too.
54 |
55 | .TP
56 | .I \-P,\-\-percent-view
57 | Shows the values in percentage.
58 | The channel numbers and UMP group numbers are shown as 1-based values
59 | in this mode, too.
60 | The velocity and data values are normalized between 0 and 100%, shown
61 | with two digits decimal points.
62 | The pitch wheel is normalized between -100% to 100%, too.
63 |
64 | .TP
65 | .I \-p,\-\-port=client:port,...
66 | Sets the sequencer port(s) from which events are received.
67 |
68 | A client can be specified by its number, its name, or a prefix of its
69 | name. A port is specified by its number; for port 0 of a client, the
70 | ":0" part of the port specification can be omitted.
71 |
72 | .SH AUTHOR
73 | Clemens Ladisch
74 |
--------------------------------------------------------------------------------
/utils/alsa-utils.spec.in:
--------------------------------------------------------------------------------
1 | %define ver @VERSION@
2 | %define rel 1
3 |
4 | Summary: Advanced Linux Sound Architecture (ALSA) - Utils
5 | Name: alsa-utils
6 | Version: %ver
7 | Release: %rel
8 | Copyright: GPL
9 | Group: System/Libraries
10 | Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{ver}.tar.bz2
11 | BuildRoot: %{_tmppath}/%{name}-%{version}-root
12 | URL: http://www.alsa-project.org
13 | Requires: alsa-lib ncurses
14 | BuildRequires: alsa-lib-devel ncurses-devel gettext
15 |
16 | %description
17 |
18 | Advanced Linux Sound Architecture (ALSA) - Utils
19 |
20 | %changelog
21 | * Sun Oct 1 2006 Jaroslav Kysela
22 | - add gettext to BuildRequires
23 | - add more files (see alsa bug#2139)
24 |
25 | * Tue Nov 25 2003 Ronny V. Vindenes
26 | - include all manpages
27 |
28 | * Thu Mar 6 2003 Ronny V. Vindenes
29 |
30 | - removed wrongly included doc file
31 | - changed BuildRoot from /var/tmp to _tmppath
32 | - use standard rpm macros for build & install section
33 | - updated dependencies
34 |
35 | * Tue Nov 20 2001 Jaroslav Kysela
36 |
37 | - changed BuildRoot from /tmp to /var/tmp
38 | - _prefix and _mandir macros are used for configure and mkdir
39 | - DESTDIR is used for make install
40 |
41 | * Sun Nov 11 2001 Miroslav Benes
42 |
43 | - dangerous command "rpm -rf $RPM_BUILD_ROOT" checks $RPM_BUILD_ROOT variable
44 | - unset key "Docdir" - on some new systems are documentation in /usr/share/doc
45 |
46 | * Mon May 28 1998 Helge Jensen
47 |
48 | - Made SPEC file
49 |
50 | %prep
51 | %setup
52 | %build
53 | %configure
54 | make
55 |
56 | %install
57 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
58 | %makeinstall
59 |
60 | %clean
61 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
62 |
63 | %files
64 | %defattr(-, root, root)
65 |
66 | %doc ChangeLog COPYING README
67 |
68 | %{_prefix}/sbin/*
69 | %{_prefix}/bin/*
70 | %{_mandir}/man?/*
71 | %{_mandir}/fr/man?/*
72 | %{_prefix}/share/alsa/speaker-test/*
73 | %{_prefix}/share/locale/ja/LC_MESSAGES/*
74 | %{_prefix}/share/locale/ru/LC_MESSAGES/*
75 | %{_prefix}/share/man/fr/man8/alsaconf.8.gz
76 | %{_prefix}/share/sounds/alsa/*
77 |
--------------------------------------------------------------------------------
/seq/aseqnet/aseqnet.1:
--------------------------------------------------------------------------------
1 | .TH aseqnet 1 "January 1, 2000"
2 | .SH NAME
3 | aseqnet \- ALSA sequencer connectors over network
4 |
5 | .SH SYNOPSIS
6 | .B aseqnet
7 | [remotehost]
8 |
9 | .SH DESCRIPTION
10 | .B aseqnet
11 | is an ALSA sequencer client which sends and receives event packets
12 | over network.
13 | Suppose two hosts connected by network,
14 | .I hostA
15 | as a server
16 | and
17 | .I hostB
18 | as a client.
19 | The ALSA sequencer system must be running on both hosts.
20 | For creating the server port, run the following on hostA:
21 | .IP "" 4
22 | hostA% aseqnet
23 | .br
24 | sequencer opened: 128:0
25 | .PP
26 | Then a user client 128 with port 0 was opened on hostA.
27 | (The client number may vary.)
28 | For creating the (network-)client port, run
29 | .B aseqnet
30 | with the hostname of the server:
31 | .IP "" 4
32 | hostB% aseqnet hostA
33 | .br
34 | sequencer opened: 132:0
35 | .PP
36 | Now all events sent to hostA:128:0 are transferred to hostB:132:0, and vice
37 | versa.
38 | .PP
39 | The ports created by
40 | .B aseqnet
41 | can be connected arbitrary to other sequencer ports via
42 | .B aconnect(1).
43 | For example, to connect hostB:132:0 to a MIDI output device 65:0:
44 | .IP "" 4
45 | hostB% aconnect 132:0 65:0
46 | .PP
47 | Then events to hostA:128:0 will be delivered to hostB:65:0.
48 | The following command plays MIDI on
49 | .I hostB.
50 | .IP "" 4
51 | hostA% pmidi \-p 128:0 foo.mid
52 | .PP
53 | The multiple clients may exist simultaneously. If
54 | .I hostC
55 | is connected as a client to hostA, events from from hostA are sent
56 | to all connected network clients, i.e. hostB and hostC.
57 | However, only one connection is allowed from a client to a server.
58 | .PP
59 | To disconnect network, stop all clients before server by ctrl-C or
60 | sending signal to them. The server will automatically quit.
61 |
62 | .SH OPTIONS
63 | .TP
64 | .B \-p port
65 | Specify the TCP port number or TCP service name.
66 | .TP
67 | .B \-s addr
68 | Subscribe to the given address for read automatically.
69 | .TP
70 | .B \-d addr
71 | Subscribe to the given address for write automatically.
72 | .TP
73 | .B \-n name
74 | Specify the midi name of the process.
75 | .TP
76 | .B \-v
77 | Verbose mode.
78 |
79 | .SH "SEE ALSO"
80 | aconnect(1), pmidi(1)
81 |
82 | .SH AUTHOR
83 | Takashi Iwai .
84 |
--------------------------------------------------------------------------------
/seq/aseqsend/aseqsend.1:
--------------------------------------------------------------------------------
1 | .TH ASEQSEND 1 "11 Mar 2024"
2 |
3 | .SH NAME
4 | aseqsend \- send arbitrary messages to selected ALSA MIDI seqencer port
5 |
6 | .SH SYNOPSIS
7 | \fBaseqsend\fP \-p client:port -s file-name
8 | .br
9 | \fBaseqsend\fP \-p client:port "hex encoded byte-string"
10 |
11 | .SH DESCRIPTION
12 | \fBaseqsend\fP is a command-line utility which allows one to send
13 | SysEx (system exclusive) data to ALSA MIDI sequencer port.
14 | It can also send any other MIDI commands.
15 | Messages to be sent can be given in the last argument as hex encoded
16 | byte string or can be read from raw binary file.
17 | When sending several SysEx messages at once there is a delay of 1ms
18 | after each message as default and can be set to different value with
19 | option \-i.
20 |
21 | A client can be specified by its number, its name, or a prefix of its
22 | name. A port is specified by its number; for port 0 of a client, the
23 | ":0" part of the port specification can be omitted.
24 |
25 | \fBaseqsend\fP can send UMP packets as MIDI 2.0 device by specifying
26 | via \-u option as well, while the default operation is the legacy MIDI
27 | 1.0 byte stream.
28 |
29 | .SH OPTIONS
30 |
31 | .TP
32 | \fI\-h, \-\-help\fP
33 | Prints a list of options.
34 |
35 | .TP
36 | \fI\-V, \-\-version\fP
37 | Prints the current version.
38 |
39 | .TP
40 | \fI\-l, \-\-list\FP
41 | Prints a list of possible output ports.
42 |
43 | .TP
44 | \fI\-v, \-\-verbose\fP
45 | Prints number of bytes actually sent
46 |
47 | .TP
48 | \fI\-p, -\-port=client:port\fP
49 | Target port by number or name
50 |
51 | .TP
52 | \fI\-s, \-\-file=filename\fP
53 | Send raw binary data from given file name
54 |
55 | .TP
56 | \fI\-i, \-\-interval=msec\fP
57 | Interval between SysEx messages in milliseconds
58 |
59 | .TP
60 | \fI\-u, \-\-ump=version\fP
61 | Specify the MIDI version. 0 for the legacy MIDI 1.0 (default),
62 | 1 for UMP MIDI 1.0 protocol and 2 for UMP MIDI 2.0 protocol.
63 |
64 | When UMP MIDI 1.0 or MIDI 2.0 protocol is specified, \fBaseqsend\fP
65 | reads the input as raw UMP packets, 4 each byte in big endian.
66 |
67 | .SH EXAMPLES
68 |
69 | \fBaseqsend -p 128:0 "F0 41 10 00 00 64 12 18 00 21 06 59 41 59 4E F7"\fP
70 |
71 | \fBaseqsend -p 128:0 -s I7BulkDump.syx\fP
72 |
73 | .SH SEE ALSO
74 | \fBaseqdump(1)\fP
75 |
76 | .SH AUTHOR
77 | Miroslav Kovac
78 |
--------------------------------------------------------------------------------
/alsaconf/po/Makefile.in:
--------------------------------------------------------------------------------
1 | POFILES = ja.po ka.po ru.po
2 |
3 | DOMAIN = alsaconf
4 | GETTEXT_SRC = ../alsaconf.in
5 |
6 | XGETTEXT_OPTIONS = -kxmsg -kxecho
7 |
8 | top_builddir = ../..
9 |
10 | srcdir = @srcdir@
11 | datadir = @datadir@
12 | exec_prefix = @exec_prefix@
13 | prefix = @prefix@
14 | localedir = $(datadir)/locale
15 |
16 | USE_NLS = @USE_NLS@
17 | INSTALL = @INSTALL@
18 | INSTALL_DATA = @INSTALL_DATA@
19 | # mkdir_p = @mkdir_p@
20 | mkdir_p = mkdir -p --
21 | XGETTEXT = @XGETTEXT@
22 | MSGFMT = @MSGFMT@
23 | GMSGFMT = @GMSGFMT@
24 | MSGMERGE = @MSGMERGE@
25 | MSGMERGE_UPDATE = @MSGMERGE@ --update
26 |
27 | DISTFILES = $(POFILES) Makefile.in
28 | CATALOGS = $(POFILES:.po=.gmo)
29 |
30 | all: all-@USE_NLS@
31 |
32 | all-yes: $(CATALOGS)
33 | all-no:
34 |
35 | .SUFFIXES: .po .gmo .mo
36 |
37 | %.mo : $(srcdir)/%.po
38 | $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
39 |
40 | %.gmo : $(srcdir)/%.po
41 | @lang=`echo $(srcdir)/$* | sed -e 's,.*/,,'`; \
42 | rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $(srcdir)/$${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
43 |
44 | $(DOMAIN).pot: $(GETTEXT_SRC)
45 | $(XGETTEXT) -o$@ --default-domain=$(DOMAIN) \
46 | --add-comments=TRANSLATORS: --language=Shell \
47 | $(XGETTEXT_OPTIONS) $<
48 |
49 | check check_recursive:
50 |
51 | clean:
52 | rm -f $(CATALOGS) $(POFILES:.po=.mo) $(DOMAIN).pot
53 |
54 | update-po: $(DOMAIN).pot
55 | @for po in $(POFILES); do \
56 | $(MSGMERGE_UPDATE) $(srcdir)/$$po $(DOMAIN).pot; \
57 | done
58 |
59 | install-data-no:
60 | install-data-yes: all
61 | $(mkdir_p) $(DESTDIR)$(datadir)
62 | @catalogs='$(CATALOGS)'; \
63 | for cat in $$catalogs; do \
64 | lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
65 | dir=$(localedir)/$$lang/LC_MESSAGES; \
66 | $(mkdir_p) $(DESTDIR)$$dir; \
67 | $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(DOMAIN).mo; \
68 | done
69 |
70 | install-data: install-data-@USE_NLS@
71 | install: install-data
72 |
73 | uninstall-data-no:
74 | uninstall-data-yes:
75 | @catalogs='$(CATALOGS)'; \
76 | for cat in $$catalogs; do \
77 | cat=`basename $$cat`; \
78 | lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
79 | rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo; \
80 | done
81 |
82 | uninstall-data: uninstall-data-@USE_NLS@
83 | uninstall: uninstall-data
84 |
85 | dist distdir: $(DISTFILES)
86 | @for file in $(DISTFILES); do \
87 | cp -p $$file $(distdir); \
88 | done
89 |
90 | distclean: clean
91 | rm -f Makefile *~
92 |
--------------------------------------------------------------------------------
/alsamixer/menu_widget.c:
--------------------------------------------------------------------------------
1 | #include "menu_widget.h"
2 | #include "colors.h"
3 | #include "utils.h"
4 | #include "bindings.h"
5 |
6 | /* Returns
7 | * - KEY_CANCEL: close is requested
8 | * - KEY_ENTER: item is selected
9 | * - -1: no action
10 | */
11 | int menu_widget_handle_key(MENU *menu, int key)
12 | {
13 | MEVENT m;
14 |
15 | switch (key) {
16 | case 27:
17 | case KEY_CANCEL:
18 | case 'q':
19 | case 'Q':
20 | return KEY_CANCEL;
21 | case '\n':
22 | case '\r':
23 | case KEY_ENTER:
24 | return KEY_ENTER;
25 |
26 | case KEY_MOUSE:
27 | switch (menu_driver(menu, KEY_MOUSE)) {
28 | case E_UNKNOWN_COMMAND:
29 | /* If you double-click an item a REQ_TOGGLE_ITEM is generated
30 | * and E_UNKNOWN_COMMAND is returned. (man menu_driver) */
31 | return KEY_ENTER;
32 | case E_REQUEST_DENIED:
33 | /* If menu did not handle KEY_MOUSE is has to be removed from
34 | * input queue to prevent an infinite loop. */
35 | key = wgetch(menu_win(menu));
36 | if (key == KEY_MOUSE) {
37 | if (getmouse(&m) == ERR)
38 | return -1;
39 | if (m.bstate & (BUTTON4_PRESSED|BUTTON4_CLICKED))
40 | menu_driver(menu, REQ_UP_ITEM);
41 | #if NCURSES_MOUSE_VERSION > 1
42 | else if (m.bstate & (BUTTON5_PRESSED|BUTTON5_CLICKED))
43 | menu_driver(menu, REQ_DOWN_ITEM);
44 | #endif
45 | else
46 | return KEY_CANCEL;
47 | }
48 | else if (key > 0)
49 | ungetch(key);
50 | }
51 | return -1;
52 |
53 | default:
54 | if (key < (int)ARRAY_SIZE(textbox_bindings)) {
55 | key = textbox_bindings[key];
56 | if (key >= CMD_TEXTBOX___MIN_MENU_COMMAND &&
57 | key <= CMD_TEXTBOX___MAX_MENU_COMMAND)
58 | menu_driver(menu, key + KEY_MAX);
59 | }
60 |
61 | return -1;
62 | }
63 | }
64 |
65 | void menu_widget_create(struct widget *widget, MENU *menu, const char *title)
66 | {
67 | int rows, columns;
68 |
69 | if (menu)
70 | unpost_menu(menu);
71 |
72 | if (screen_lines < 3 || screen_cols < 10) {
73 | widget->close();
74 | beep();
75 | return;
76 | }
77 | scale_menu(menu, &rows, &columns);
78 | rows += 2;
79 | columns += 2;
80 | if (rows > screen_lines)
81 | rows = screen_lines;
82 | if (columns > screen_cols)
83 | columns = screen_cols;
84 |
85 | widget_init(widget, rows, columns, SCREEN_CENTER, SCREEN_CENTER,
86 | attrs.menu, WIDGET_BORDER | WIDGET_SUBWINDOW);
87 |
88 | mvwprintw(widget->window, 0, (columns - 2 - get_mbs_width(title)) / 2, " %s ", title);
89 | set_menu_win(menu, widget->window);
90 | set_menu_sub(menu, widget->subwindow);
91 | post_menu(menu);
92 | }
93 |
--------------------------------------------------------------------------------
/seq/aplaymidi/arecordmidi.1:
--------------------------------------------------------------------------------
1 | .TH ARECORDMIDI 1 "17 Sep 2007"
2 |
3 | .SH NAME
4 | arecordmidi \- record Standard MIDI Files
5 |
6 | .SH SYNOPSIS
7 | .B arecordmidi
8 | \-p client:port[,...] [options] midifile
9 |
10 | .SH DESCRIPTION
11 | .B arecordmidi
12 | is a command-line utility that records a Standard MIDI File from one or
13 | more ALSA sequencer ports.
14 |
15 | To stop recording, press Ctrl+C.
16 |
17 | .SH OPTIONS
18 |
19 | .TP
20 | .I \-h,\-\-help
21 | Prints a list of options.
22 |
23 | .TP
24 | .I \-V,\-\-version
25 | Prints the current version.
26 |
27 | .TP
28 | .I \-l,\-\-list
29 | Prints a list of possible input ports.
30 |
31 | .TP
32 | .I \-p,\-\-port=client:port,...
33 | Sets the sequencer port(s) from which events are recorded.
34 |
35 | A client can be specified by its number, its name, or a prefix of its
36 | name. A port is specified by its number; for port 0 of a client, the
37 | ":0" part of the port specification can be omitted.
38 |
39 | .TP
40 | .I \-b,\-\-bpm=beats
41 | Sets the musical tempo of the MIDI file, in beats per minute.
42 | The default value is 120 BPM.
43 |
44 | .TP
45 | .I \-f,\-\-fps=frames
46 | Sets the SMPTE resolution, in frames per second.
47 | Possible values are 24, 25, 29.97 (for 30 drop-frame), and 30.
48 |
49 | .TP
50 | .I \-t,\-\-ticks=ticks
51 | Sets the resolution of timestamps (ticks) in the MIDI file,
52 | in ticks per beat (when using musical tempo) or ticks per frame
53 | (when using SMPTE timing).
54 | The default value is 384 ticks/beat or 40 ticks/frame, respectively.
55 |
56 | .TP
57 | .I \-s,\-\-split\-channels
58 | Specifies that the data for each MIDI channel should be written to a
59 | separate track in the MIDI file.
60 | This will result in a "format 1" file.
61 | Otherwise, when there is only one track,
62 | .B arecordmidi
63 | will generate a "format 0" file.
64 |
65 | .TP
66 | .I \-m,\-\-metronome=client:port
67 | Plays a metronome signal on the specified sequencer port.
68 |
69 | Metronome sounds are played on channel 10, MIDI notes 33 & 34 (GM2/GS/XG
70 | metronome standard notes), with velocity 100 and duration 1.
71 |
72 | .TP
73 | .I \-i,\-\-timesig=numerator:denominator
74 | Sets the time signature for the MIDI file and metronome.
75 |
76 | The time signature is specified as usual with two numbers, representing
77 | the numerator and denominator of the time signature as it would be
78 | notated. The denominator must be a power of two. Both numbers should be
79 | separated by a colon. The time signature is 4:4 by default.
80 |
81 | .SH AUTHOR
82 | Clemens Ladisch
83 |
--------------------------------------------------------------------------------
/alsamixer/bindings.h:
--------------------------------------------------------------------------------
1 | #ifndef BINDINGS_H_INCLUDED
2 | #define BINDINGS_H_INCLUDED
3 |
4 | #include CURSESINC
5 | #include
6 | #include
7 |
8 | /* Commands are stored in an uint16_t and may take an unsigned numeric argument.
9 | * The command itself is stored in the lower 7 bits, the argument is stored
10 | * in the higher 9 bits.
11 | *
12 | * The value `0` is used for no (unbound) command. */
13 |
14 | typedef uint16_t command_enum;
15 | extern command_enum mixer_bindings[KEY_MAX];
16 | /* No need for a 16bit type, since textbox commands don't take arguments */
17 | extern uint8_t textbox_bindings[KEY_MAX];
18 |
19 | #define CMD_WITH_ARG(CMD, ARG) \
20 | ((CMD) + ((ARG) << 9))
21 |
22 | #define CMD_GET_COMMAND(CMD) \
23 | ((CMD) & 0x1FF)
24 |
25 | #define CMD_GET_ARGUMENT(CMD) \
26 | ((CMD) >> 9)
27 |
28 | enum mixer_command {
29 | // `CMD % 4` should produce the channel mask
30 | CMD_MIXER_CONTROL_DOWN_LEFT = 1,
31 | CMD_MIXER_CONTROL_DOWN_RIGHT,
32 | CMD_MIXER_CONTROL_DOWN,
33 | CMD_MIXER_CONTROL_UP_LEFT = 5,
34 | CMD_MIXER_CONTROL_UP_RIGHT,
35 | CMD_MIXER_CONTROL_UP,
36 | CMD_MIXER_CONTROL_SET_PERCENT_LEFT = 9,
37 | CMD_MIXER_CONTROL_SET_PERCENT_RIGHT,
38 | CMD_MIXER_CONTROL_SET_PERCENT,
39 |
40 | // Keep those in the same order as displayed on screen
41 | CMD_MIXER_HELP,
42 | CMD_MIXER_SYSTEM_INFORMATION,
43 | CMD_MIXER_SELECT_CARD,
44 | CMD_MIXER_CLOSE,
45 |
46 | CMD_MIXER_TOGGLE_VIEW_MODE,
47 | CMD_MIXER_SET_VIEW_MODE,
48 | CMD_MIXER_PREVIOUS,
49 | CMD_MIXER_NEXT,
50 | CMD_MIXER_FOCUS_CONTROL,
51 | CMD_MIXER_TOGGLE_MUTE,
52 | CMD_MIXER_TOGGLE_CAPTURE,
53 | CMD_MIXER_BALANCE_CONTROL,
54 | CMD_MIXER_REFRESH,
55 |
56 | // Mouse
57 | CMD_MIXER_MOUSE_CLICK_MUTE,
58 | CMD_MIXER_MOUSE_CLICK_VOLUME_BAR,
59 | CMD_MIXER_MOUSE_CLICK_CONTROL_ENUM,
60 | };
61 |
62 | enum textbox_command {
63 | /* Since these commands are also used by the menu widget we make use of
64 | * the menu_driver() request constants.
65 | * KEY_MAX is substracted so the value fits in 8 bits. */
66 | CMD_TEXTBOX___MIN_MENU_COMMAND = MIN_MENU_COMMAND - KEY_MAX,
67 | CMD_TEXTBOX_TOP = REQ_FIRST_ITEM - KEY_MAX,
68 | CMD_TEXTBOX_BOTTOM = REQ_LAST_ITEM - KEY_MAX,
69 | CMD_TEXTBOX_LEFT = REQ_LEFT_ITEM - KEY_MAX,
70 | CMD_TEXTBOX_RIGHT = REQ_RIGHT_ITEM - KEY_MAX,
71 | CMD_TEXTBOX_UP = REQ_UP_ITEM - KEY_MAX,
72 | CMD_TEXTBOX_DOWN = REQ_DOWN_ITEM - KEY_MAX,
73 | CMD_TEXTBOX_PAGE_DOWN = REQ_SCR_DPAGE - KEY_MAX,
74 | CMD_TEXTBOX_PAGE_UP = REQ_SCR_UPAGE - KEY_MAX,
75 | CMD_TEXTBOX___MAX_MENU_COMMAND = MAX_MENU_COMMAND - KEY_MAX,
76 | CMD_TEXTBOX_PAGE_LEFT,
77 | CMD_TEXTBOX_PAGE_RIGHT,
78 | CMD_TEXTBOX_CLOSE,
79 | };
80 |
81 | #endif
82 |
--------------------------------------------------------------------------------
/seq/aplaymidi2/aplaymidi2.1:
--------------------------------------------------------------------------------
1 | .TH APLAYMIDI2 1 "4 July 2024"
2 |
3 | .SH NAME
4 | aplaymidi2 \- play MIDI Clip Files
5 |
6 | .SH SYNOPSIS
7 | .B aplaymidi2
8 | \-p client:port[,...] midi2file ...
9 |
10 | .SH DESCRIPTION
11 | .B aplaymidi2
12 | is a command-line utility that plays the specified MIDI Clip file(s) to one
13 | or more ALSA sequencer ports.
14 |
15 | .SH OPTIONS
16 |
17 | .TP
18 | .I \-h, \-\-help
19 | Prints a list of options.
20 |
21 | .TP
22 | .I \-V, \-\-version
23 | Prints the current version.
24 |
25 | .TP
26 | .I \-p, \-\-port=client:port,...
27 | Sets the sequencer port(s) to which the events in the MIDI Clip file(s) are
28 | sent.
29 |
30 | A client can be specified by its number, its name, or a prefix of its
31 | name. A port is specified by its number; for port 0 of a client, the
32 | ":0" part of the port specification can be omitted.
33 |
34 | Multiple ports can be specified to allow playback of MIDI Clip file(s) that
35 | contain events for multiple devices (ports) corresponding to the
36 | multiple UMP Groups.
37 |
38 | For compatibility with
39 | .B pmidi(1),
40 | the port specification is taken from the
41 | .I ALSA_OUTPUT_PORTS
42 | environment variable if none is given on the command line.
43 |
44 | .B aplaymidi2
45 | supports only basic UMP events: in addition to the standard MIDI1 and
46 | MIDI2 CVMs and 7bit SysEx, only the following are supported:
47 | DCTPQ, DC, Set Tempo, Start Clip, End Clip.
48 | Lyrics and other meta data in Flex Data are printed, too, unless
49 | \fI\-s\fP option is given.
50 |
51 | The multiple output ports are useful when the given MIDI Clip file
52 | contains the UMP packets for multiple Groups.
53 | When the destination port is a UMP MIDI 2.0 port, the single
54 | connection should suffice, though, since a MIDI 2.0 port can process
55 | the inputs for multiple Groups. For other cases (e.g. connecting to a
56 | legacy MIDI port), you would need to specify the destination port per
57 | Group. If undefined, it's sent to the first destination port as
58 | default.
59 |
60 | .TP
61 | .I \-d, \-\-delay=seconds
62 | Specifies how long to wait after the end of each MIDI Clip file,
63 | to allow the last notes to die away.
64 | Default is 2 seconds.
65 |
66 | .TP
67 | .I \-s, \-\-silent
68 | Don't show message texts.
69 |
70 | .TP
71 | .I \-a, \-\-passall
72 | Pass all UMP packets as is.
73 |
74 | As default, \fBaplaymidi2\fP passes only MIDI1 and MIDI2 channel voice
75 | messages and process other UMP packets internally.
76 | With this option, it passes all UMP packets to the target.
77 |
78 | .SH SEE ALSO
79 | pmidi(1)
80 | .br
81 | aplaymidi(1)
82 |
83 | .SH AUTHOR
84 | Takashi Iwai
85 |
--------------------------------------------------------------------------------
/alsactl/Makefile.am:
--------------------------------------------------------------------------------
1 | SUBDIRS = init
2 |
3 | sbin_PROGRAMS=alsactl
4 | man_MANS=alsactl.1
5 | if USE_XMLTO
6 | man_MANS += alsactl_init.7
7 | endif
8 | EXTRA_DIST=alsactl.1 alsactl_init.xml
9 |
10 | AM_CFLAGS = -D_GNU_SOURCE
11 |
12 | AM_CPPFLAGS = -I$(top_srcdir)/include
13 |
14 | alsactl_SOURCES=alsactl.c state.c lock.c utils.c wait.c \
15 | init_parse.c init_ucm.c boot_params.c \
16 | daemon.c monitor.c clean.c info.c export.c
17 |
18 | alsactl_CFLAGS=$(AM_CFLAGS) -D__USE_GNU \
19 | -DSYS_ASOUNDRC=\"$(ASOUND_STATE_DIR)/asound.state\" \
20 | -DSYS_LOCKPATH=\"$(ASOUND_LOCK_DIR)\" \
21 | -DSYS_LOCKFILE=\"asound.state.lock\" \
22 | -DSYS_PIDFILE=\"$(ALSACTL_PIDFILE_DIR)/alsactl.pid\"
23 |
24 | noinst_HEADERS=alsactl.h list.h init_sysdeps.c init_utils_string.c \
25 | init_utils_run.c init_sysfs.c
26 |
27 | udevrules_DATA = \
28 | conf/90-alsa-restore.rules
29 |
30 | if HAVE_SYSTEMD
31 |
32 | systemdsystemunit_DATA = \
33 | conf/alsa-state.service \
34 | conf/alsa-restore.service \
35 | conf/alsa-card-wait@.service
36 |
37 | install-data-hook:
38 | $(MKDIR_P) -m 0755 \
39 | $(DESTDIR)$(systemdsystemunitdir)/sound.target.wants
40 | ( cd $(DESTDIR)$(systemdsystemunitdir)/sound.target.wants && \
41 | rm -f alsa-state.service alsa-restore.service && \
42 | $(LN_S) ../alsa-state.service alsa-state.service && \
43 | $(LN_S) ../alsa-restore.service alsa-restore.service)
44 |
45 | endif
46 |
47 | edit = \
48 | extratest=$$(echo ' $(ALSACTL_UDEV_EXTRATEST)' | sed -e 's/__/ /g' -e 's/^ $$//'); \
49 | args=$$(echo ' $(ALSACTL_UDEV_ARGS)' | sed -e 's/__/ /g' -e 's/^ $$//'); \
50 | mkdir -p conf; \
51 | $(SED) -r -e 's,@sbindir\@,$(sbindir),g' \
52 | -e 's,@mydatadir\@,$(mydatadir),g' \
53 | -e 's,@daemonswitch\@,$(ALSACTL_DAEMONSWITCH),g' \
54 | -e 's,@asoundrcfile\@,$(ASOUND_STATE_DIR)/asound.state,g' \
55 | -e "s;@extratest\@;$${extratest};g" \
56 | -e "s;@args\@;$${args};g" \
57 | < $< > $@ || rm $@
58 |
59 | conf/alsa-state.service: conf/alsa-state.service.in
60 | $(edit)
61 |
62 | conf/alsa-restore.service: conf/alsa-restore.service.in
63 | $(edit)
64 |
65 | conf/alsa-card-wait@.service: conf/alsa-card-wait@.service.in
66 | $(edit)
67 |
68 | conf/90-alsa-restore.rules: conf/90-alsa-restore.rules.in
69 | $(edit)
70 |
71 | EXTRA_DIST += \
72 | conf/alsa-state.service.in \
73 | conf/alsa-restore.service.in \
74 | conf/alsa-card-wait@.service.in \
75 | conf/90-alsa-restore.rules.in
76 |
77 | CLEANFILES = \
78 | conf/alsa-state.service \
79 | conf/alsa-restore.service \
80 | conf/alsa-card-wait@.service \
81 | conf/90-alsa-restore.rules
82 |
83 | %.7: %.xml
84 | xmlto man $?
85 |
--------------------------------------------------------------------------------
/axfer/xfer-libasound.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // xfer-libasound.h - a header for receiver/transmitter of frames by alsa-lib.
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #ifndef __ALSA_UTILS_AXFER_XFER_LIBASOUND__H_
10 | #define __ALSA_UTILS_AXFER_XFER_LIBASOUND__H_
11 |
12 | #include "xfer.h"
13 | #include "waiter.h"
14 |
15 | #define logging(state, ...) \
16 | snd_output_printf(state->log, __VA_ARGS__)
17 |
18 | enum sched_model {
19 | SCHED_MODEL_IRQ = 0,
20 | SCHED_MODEL_TIMER,
21 | SCHED_MODEL_COUNT,
22 | };
23 |
24 | struct xfer_libasound_ops;
25 |
26 | struct libasound_state {
27 | snd_pcm_t *handle;
28 |
29 | snd_output_t *log;
30 | snd_pcm_hw_params_t *hw_params;
31 | snd_pcm_sw_params_t *sw_params;
32 |
33 | const struct xfer_libasound_ops *ops;
34 | void *private_data;
35 |
36 | bool verbose;
37 |
38 | char *node_literal;
39 | char *waiter_type_literal;
40 | char *sched_model_literal;
41 |
42 | unsigned int msec_per_period;
43 | unsigned int msec_per_buffer;
44 | unsigned int frames_per_period;
45 | unsigned int frames_per_buffer;
46 |
47 | unsigned int msec_for_avail_min;
48 | unsigned int msec_for_start_threshold;
49 | unsigned int msec_for_stop_threshold;
50 |
51 | bool finish_at_xrun:1;
52 | bool nonblock:1;
53 | bool mmap:1;
54 | bool test_nowait:1;
55 | bool no_auto_resample:1;
56 | bool no_auto_channels:1;
57 | bool no_auto_format:1;
58 | bool no_softvol:1;
59 |
60 | bool use_waiter:1;
61 |
62 | enum waiter_type waiter_type;
63 | struct waiter_context *waiter;
64 |
65 | // For scheduling type.
66 | enum sched_model sched_model;
67 | };
68 |
69 | // For internal use in 'libasound' module.
70 |
71 | struct xfer_libasound_ops {
72 | int (*pre_process)(struct libasound_state *state);
73 | int (*process_frames)(struct libasound_state *state,
74 | unsigned int *frame_count,
75 | struct mapper_context *mapper,
76 | struct container_context *cntrs);
77 | void (*post_process)(struct libasound_state *state);
78 | unsigned int private_size;
79 | };
80 |
81 | int xfer_libasound_wait_event(struct libasound_state *state, int timeout_msec,
82 | unsigned short *revents);
83 |
84 | extern const struct xfer_libasound_ops xfer_libasound_irq_rw_ops;
85 |
86 | extern const struct xfer_libasound_ops xfer_libasound_irq_mmap_r_ops;
87 | extern const struct xfer_libasound_ops xfer_libasound_irq_mmap_w_ops;
88 |
89 | extern const struct xfer_libasound_ops xfer_libasound_timer_mmap_w_ops;
90 | extern const struct xfer_libasound_ops xfer_libasound_timer_mmap_r_ops;
91 |
92 | #endif
93 |
--------------------------------------------------------------------------------
/bat/tests/dp_audio_playback.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #/*
4 | # * Copyright (C) 2013-2016 Intel Corporation
5 | # *
6 | # * This program is free software; you can redistribute it and/or modify
7 | # * it under the terms of the GNU General Public License as published by
8 | # * the Free Software Foundation; either version 2 of the License, or
9 | # * (at your option) any later version.
10 | # *
11 | # * This program is distributed in the hope that it will be useful,
12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # * GNU General Public License for more details.
15 | # *
16 | # */
17 |
18 | #set test freq table (HZ)
19 | freq_table="10 31 73 155 380 977 1932 4119 8197 16197"
20 |
21 | #set test number of channels
22 | test_channel=2
23 |
24 | #get device number for DP
25 | DP_device_num=0
26 | $ABAT_TEST_PATH/dp_audio_subdevice_number.sh
27 | DP_device_num=$?
28 | if [ $DP_device_num = 77 ]; then
29 | echo "Prompt: Can not get device with DP audio or \
30 | show the wrong connection type as HDMI in ELD info"
31 | exit 1
32 | fi
33 |
34 | #To get DP audio device number
35 | DP_card_number=$(aplay -l | grep "HDMI 0" | cut -b 6)
36 | if [ "$DP_card_number" = "" ]; then
37 | echo "Error: Can not get Display audio card."
38 | exit 1
39 | fi
40 |
41 | DP_device="hw:$DP_card_number,$DP_device_num"
42 | echo $device
43 | sleep 2
44 |
45 | #get Analog audio record card number
46 | record_card_number=$(arecord -l | grep "Analog" | cut -b 6)
47 | if [ "$record_card_number" = "" ]; then
48 | echo "Can not get record card number."
49 | exit 1
50 | fi
51 |
52 | #get Analog audio record device number
53 | record_device_number=$(arecord -l | grep "Analog"| cut -d " " -f 8 |cut -b 1)
54 | echo $record_device_number
55 | if [ "$record_device_number" = "" ]; then
56 | echo "Can not get record device number"
57 | exit 1
58 | fi
59 |
60 | #Notice: to loopback the DP audio output to the analog audio input
61 | record_device="hw:$record_card_number,$record_device_number"
62 | test_flag=0
63 |
64 | echo -e "\e[31m Notice: to loopback the DP audio \
65 | output to the analog audio input"
66 | echo -e "\e[0m"
67 | read -p "Press enter to continue"
68 |
69 | #call alsabat to do the test for each frequency in the freq_table
70 | for freq in $freq_table
71 | do
72 | alsabat -P $DP_device -C plug$record_device -c $test_channel -F $freq
73 | if [ $? = 0 ]; then
74 | echo "Test target frequency:$freq for DP audio playback--Passed" \
75 | >> $ABAT_TEST_LOG_FILE
76 | else
77 | echo "Test target frequency:$freq for DP audio playback--Failed" \
78 | >> $ABAT_TEST_LOG_FILE
79 | test_flag=1
80 | fi
81 | done
82 |
83 | exit $test_flag
84 |
--------------------------------------------------------------------------------
/bat/tests/hdmi_audio_playback.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #/*
4 | # * Copyright (C) 2013-2016 Intel Corporation
5 | # *
6 | # * This program is free software; you can redistribute it and/or modify
7 | # * it under the terms of the GNU General Public License as published by
8 | # * the Free Software Foundation; either version 2 of the License, or
9 | # * (at your option) any later version.
10 | # *
11 | # * This program is distributed in the hope that it will be useful,
12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # * GNU General Public License for more details.
15 | # *
16 | # */
17 |
18 | #set test freq table (HZ)
19 | freq_table="10 31 73 155 380 977 1932 4119 8197 16197"
20 |
21 | #set test number of channels
22 | test_channel=2
23 |
24 | #get device number for HDMI
25 | HDMI_device_num=0
26 | $ABAT_TEST_PATH/hdmi_audio_subdevice_number.sh
27 | HDMI_device_num=$?
28 | if [ $HDMI_device_num = 77 ]; then
29 | echo "Prompt: Can not get device with HDMI audio or \
30 | show the wrong connection type as DP in ELD info"
31 | exit 1
32 | fi
33 |
34 | #To get HDMI audio device number
35 | HDMI_card_number=$(aplay -l | grep "HDMI 0" | cut -b 6)
36 | if [ "$HDMI_card_number" = "" ]; then
37 | echo "Error: Can not get Display audio card."
38 | exit 1
39 | fi
40 |
41 | HDMI_device="hw:$HDMI_card_number,$HDMI_device_num"
42 | echo $device
43 | sleep 2
44 |
45 | #get Analog audio record card number
46 | record_card_number=$(arecord -l | grep "Analog" | cut -b 6)
47 | if [ "$record_card_number" = "" ]; then
48 | echo "Can not get record card number."
49 | exit 1
50 | fi
51 |
52 | #get Analog audio record device number
53 | record_device_number=$(arecord -l | grep "Analog"| cut -d " " -f 8 |cut -b 1)
54 | if [ "$record_device_number" = "" ]; then
55 | echo "Can not get record device number"
56 | exit 1
57 | fi
58 |
59 | #Notice: to loopback the HDMI audio output to the analog audio input
60 | record_device="hw:$record_card_number,$record_device_number"
61 | test_flag=0
62 |
63 | echo -e "\e[31m Notice: to loopback the HDMI audio output \
64 | to the analog audio input"
65 | echo -e "\e[0m"
66 | read -p "Press enter to continue"
67 | #call alsabat to do the test for each frequency in the freq_table
68 | for freq in $freq_table
69 | do
70 | alsabat -P $HDMI_device -C plug$record_device -c $test_channel -F $freq
71 | if [ $? = 0 ]; then
72 | echo "Test target frequency:$freq for HDMI audio playback \
73 | -- Passed " >> $ABAT_TEST_LOG_FILE
74 | else
75 | echo "Test target frequency:$freq for HDMI audio playback \
76 | -- Failed " >> $ABAT_TEST_LOG_FILE
77 | test_flag=1
78 | fi
79 | done
80 |
81 | exit $test_flag
82 |
--------------------------------------------------------------------------------
/topology/nhlt/intel/dmic/dmic-process.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | //
3 | // Copyright(c) 2021 Intel Corporation. All rights reserved.
4 | //
5 | // Author: Seppo Ingalsuo
6 | // Jaska Uimonen
7 |
8 | #ifndef __DMIC_PROCESS_H
9 | #define __DMIC_PROCESS_H
10 |
11 | #include
12 |
13 | /* initialize and set default values before parsing */
14 | int dmic_init_params(struct intel_nhlt_params *nhlt);
15 |
16 | /* set parameters when parsing topology2 conf */
17 | int dmic_set_params(struct intel_nhlt_params *nhlt, int dai_index, int driver_version,
18 | int io_clk, int num_pdm_active, int fifo_word_length, int clk_min, int clk_max,
19 | int duty_min, int duty_max, int sample_rate, int unmute_ramp_time);
20 | int dmic_set_pdm_params(struct intel_nhlt_params *nhlt, int pdm_index, int enable_a,
21 | int enable_b, int polarity_a, int polarity_b, int clk_edge, int skew);
22 | int dmic_set_ext_params(struct intel_nhlt_params *nhlt, uint32_t snr, uint32_t sensitivity);
23 | int dmic_set_mic_params(struct intel_nhlt_params *nhlt, int index,
24 | uint8_t type, uint8_t panel, uint32_t speaker_position_distance,
25 | uint32_t horizontal_offset, uint32_t vertical_offset,
26 | uint8_t frequency_low_band, uint8_t frequency_high_band,
27 | uint16_t direction_angle, uint16_t elevation_angle,
28 | uint16_t vertical_angle_begin, uint16_t vertical_angle_end,
29 | uint16_t horizontal_angle_begin, uint16_t horizontal_angle_end);
30 |
31 | /* calculate the blob after parsing the values*/
32 | int dmic_calculate(struct intel_nhlt_params *nhlt);
33 |
34 | /* get spec parameters when building the nhlt endpoint */
35 | int dmic_get_params(struct intel_nhlt_params *nhlt, int index, uint32_t *sample_rate,
36 | uint16_t *channel_count, uint32_t *bits_per_sample, uint8_t *array_type,
37 | uint8_t *num_mics, uint8_t *extension, uint32_t *snr, uint32_t *sensitivity);
38 | int dmic_get_mic_params(struct intel_nhlt_params *nhlt, int index,
39 | uint8_t *type, uint8_t *panel, uint32_t *speaker_position_distance,
40 | uint32_t *horizontal_offset, uint32_t *vertical_offset,
41 | uint8_t *frequency_low_band, uint8_t *frequency_high_band,
42 | uint16_t *direction_angle, uint16_t *elevation_angle,
43 | uint16_t *vertical_angle_begin, uint16_t *vertical_angle_end,
44 | uint16_t *horizontal_angle_begin, uint16_t *horizontal_angle_end);
45 |
46 | /* get vendor specific blob when building the nhlt endpoint */
47 | int dmic_get_vendor_blob_count(struct intel_nhlt_params *nhlt);
48 | int dmic_get_vendor_blob_size(struct intel_nhlt_params *nhlt, size_t *size);
49 | int dmic_get_vendor_blob(struct intel_nhlt_params *nhlt, uint8_t *vendor_blob);
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/axfer/mapper.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // mapper.h - an interface of muxer/demuxer between buffer with data frames and
4 | // formatted files.
5 | //
6 | // Copyright (c) 2018 Takashi Sakamoto
7 | //
8 | // Licensed under the terms of the GNU General Public License, version 2.
9 |
10 | #ifndef __ALSA_UTILS_AXFER_MAPPER__H_
11 | #define __ALSA_UTILS_AXFER_MAPPER__H_
12 |
13 | #include "container.h"
14 |
15 | enum mapper_type {
16 | MAPPER_TYPE_MUXER = 0,
17 | MAPPER_TYPE_DEMUXER,
18 | MAPPER_TYPE_COUNT,
19 | };
20 |
21 | enum mapper_target {
22 | MAPPER_TARGET_SINGLE = 0,
23 | MAPPER_TARGET_MULTIPLE,
24 | MAPPER_TARGET_COUNT,
25 | };
26 |
27 | struct mapper_ops;
28 |
29 | struct mapper_context {
30 | enum mapper_type type;
31 | enum mapper_target target;
32 | const struct mapper_ops *ops;
33 | unsigned int private_size;
34 |
35 | void *private_data;
36 | unsigned int cntr_count;
37 |
38 | // A part of parameters of PCM substream.
39 | snd_pcm_access_t access;
40 | unsigned int bytes_per_sample;
41 | unsigned int samples_per_frame;
42 | snd_pcm_uframes_t frames_per_buffer;
43 |
44 | unsigned int verbose;
45 | };
46 |
47 | int mapper_context_init(struct mapper_context *mapper,
48 | enum mapper_type type, unsigned int cntr_count,
49 | unsigned int verbose);
50 | int mapper_context_pre_process(struct mapper_context *mapper,
51 | snd_pcm_access_t access,
52 | unsigned int bytes_per_sample,
53 | unsigned int samples_per_frame,
54 | unsigned int frames_per_buffer,
55 | struct container_context *cntrs);
56 | int mapper_context_process_frames(struct mapper_context *mapper,
57 | void *frame_buffer,
58 | unsigned int *frame_count,
59 | struct container_context *cntrs);
60 | void mapper_context_post_process(struct mapper_context *mapper);
61 | void mapper_context_destroy(struct mapper_context *mapper);
62 |
63 | // For internal use in 'mapper' module.
64 |
65 | struct mapper_ops {
66 | int (*pre_process)(struct mapper_context *mapper,
67 | struct container_context *cntrs,
68 | unsigned int cntr_count);
69 | int (*process_frames)(struct mapper_context *mapper,
70 | void *frame_buffer, unsigned int *frame_count,
71 | struct container_context *cntrs,
72 | unsigned int cntr_count);
73 | void (*post_process)(struct mapper_context *mapper);
74 | };
75 |
76 | struct mapper_data {
77 | struct mapper_ops ops;
78 | unsigned int private_size;
79 | };
80 |
81 | extern const struct mapper_data mapper_muxer_single;
82 | extern const struct mapper_data mapper_demuxer_single;
83 |
84 | extern const struct mapper_data mapper_muxer_multiple;
85 | extern const struct mapper_data mapper_demuxer_multiple;
86 |
87 | #endif
88 |
--------------------------------------------------------------------------------
/axfer/waiter.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // waiter.c - I/O event waiter.
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #include "waiter.h"
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | #include "misc.h"
16 |
17 | static const char *const waiter_type_labels[] = {
18 | [WAITER_TYPE_DEFAULT] = "default",
19 | [WAITER_TYPE_POLL] = "poll",
20 | [WAITER_TYPE_SELECT] = "select",
21 | [WAITER_TYPE_EPOLL] = "epoll",
22 | };
23 |
24 | enum waiter_type waiter_type_from_label(const char *label)
25 | {
26 | int i;
27 |
28 | for (i = 0; i < (int)ARRAY_SIZE(waiter_type_labels); ++i) {
29 | if (!strcmp(waiter_type_labels[i], label))
30 | return i;
31 | }
32 |
33 | return WAITER_TYPE_DEFAULT;
34 | }
35 |
36 | const char *waiter_label_from_type(enum waiter_type type)
37 | {
38 | return waiter_type_labels[type];
39 | }
40 |
41 | int waiter_context_init(struct waiter_context *waiter,
42 | enum waiter_type type, unsigned int pfd_count)
43 | {
44 | struct {
45 | enum waiter_type type;
46 | const struct waiter_data *waiter;
47 | } entries[] = {
48 | {WAITER_TYPE_POLL, &waiter_poll},
49 | {WAITER_TYPE_SELECT, &waiter_select},
50 | {WAITER_TYPE_EPOLL, &waiter_epoll},
51 | };
52 | int i;
53 |
54 | if (pfd_count == 0)
55 | return -EINVAL;
56 |
57 | for (i = 0; i < (int)ARRAY_SIZE(entries); ++i) {
58 | if (entries[i].type == type)
59 | break;
60 | }
61 | if (i == ARRAY_SIZE(entries))
62 | return -EINVAL;
63 |
64 | waiter->private_data = malloc(entries[i].waiter->private_size);
65 | if (waiter->private_data == NULL)
66 | return -ENOMEM;
67 | memset(waiter->private_data, 0, entries[i].waiter->private_size);
68 |
69 | waiter->type = type;
70 | waiter->ops = &entries[i].waiter->ops;
71 |
72 | waiter->pfds = calloc(pfd_count, sizeof(*waiter->pfds));
73 | if (waiter->pfds == NULL)
74 | return -ENOMEM;
75 | waiter->pfd_count = pfd_count;
76 |
77 | return 0;
78 | }
79 |
80 | int waiter_context_prepare(struct waiter_context *waiter)
81 | {
82 | return waiter->ops->prepare(waiter);
83 | }
84 |
85 | int waiter_context_wait_event(struct waiter_context *waiter,
86 | int timeout_msec)
87 | {
88 | return waiter->ops->wait_event(waiter, timeout_msec);
89 | }
90 |
91 | void waiter_context_release(struct waiter_context *waiter)
92 | {
93 | waiter->ops->release(waiter);
94 | }
95 |
96 | void waiter_context_destroy(struct waiter_context *waiter)
97 | {
98 | if (waiter->pfds)
99 | free(waiter->pfds);
100 | waiter->pfd_count = 0;
101 | if (waiter->private_data)
102 | free(waiter->private_data);
103 | waiter->private_data = NULL;
104 | }
105 |
--------------------------------------------------------------------------------
/bat/tests/analog_audio_playback_and_capture.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #/*
4 | # * Copyright (C) 2013-2016 Intel Corporation
5 | # *
6 | # * This program is free software; you can redistribute it and/or modify
7 | # * it under the terms of the GNU General Public License as published by
8 | # * the Free Software Foundation; either version 2 of the License, or
9 | # * (at your option) any later version.
10 | # *
11 | # * This program is distributed in the hope that it will be useful,
12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # * GNU General Public License for more details.
15 | # *
16 | # */
17 |
18 | #set test freq table (HZ)
19 | freq_table="10 31 73 155 380 977 1932 4119 8197 16197"
20 |
21 | #set test number of channels
22 | test_channel=2
23 |
24 | #get Analog audio card number
25 | card_number=$(aplay -l | grep "Analog" | cut -b 6)
26 | if [ "$card_number" = "" ]; then
27 | echo "Can not get Analog card number."
28 | exit 1
29 | fi
30 |
31 | #get Analog audio device number
32 | device_number=$(aplay -l | grep "Analog"| cut -d " " -f 8 |cut -b 1)
33 | if [ "$device_number" = "" ]; then
34 | echo "Can not get Analog device number"
35 | exit 1
36 | fi
37 |
38 |
39 | device="hw:$card_number,$device_number"
40 | echo $device
41 |
42 | #get Analog audio record card number
43 | record_card_number=$(arecord -l | grep "Analog" | cut -b 6)
44 | if [ "$record_card_number" = "" ]; then
45 | echo "Can not get record card number."
46 | exit 1
47 | fi
48 |
49 | #get Analog audio record device number
50 | record_device_number=$(arecord -l | grep "Analog"| cut -d " " -f 8 |cut -b 1)
51 | echo $record_device_number
52 | if [ "$record_device_number" = "" ]; then
53 | echo "Can not get record device number"
54 | exit 1
55 | fi
56 |
57 | #Notice: to loopback the analog audio output to the analog audio input
58 | record_device="hw:$record_card_number,$record_device_number"
59 | test_flag=0
60 |
61 | echo -e "\e[31m Notice: to loopback the analog audio output to \
62 | the analog audio input"
63 | echo -e "\e[0m"
64 | read -p "Press enter to continue"
65 |
66 | #call alsabat to do the test for each frequency in the freq_table
67 | for freq in $freq_table
68 | do
69 | alsabat -P $device -C plug$record_device -c $test_channel -F $freq
70 | if [ $? = 0 ]; then
71 | echo "Test target frequency:$freq for Analog playback -- Passed \
72 | " >> $ABAT_TEST_LOG_FILE
73 | echo "Test target frequency:$freq for Analog capture -- Passed \
74 | " >> $ABAT_TEST_LOG_FILE
75 | else
76 | echo "Test target frequency:$freq for Analog playback -- Failed \
77 | " >> $ABAT_TEST_LOG_FILE
78 | echo "Test target frequency:$freq for Analog capture -- Failed \
79 | " >> $ABAT_TEST_LOG_FILE
80 | test_flag=1
81 | fi
82 | done
83 |
84 | exit $test_flag
85 |
--------------------------------------------------------------------------------
/axfer/waiter-epoll.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // waiter-epoll.c - Waiter for event notification by epoll(7).
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #include "waiter.h"
10 | #include "misc.h"
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 |
19 | struct epoll_state {
20 | int epfd;
21 | struct epoll_event *events;
22 | unsigned int ev_count;
23 | };
24 |
25 | static int epoll_prepare(struct waiter_context *waiter)
26 | {
27 | struct epoll_state *state = waiter->private_data;
28 | int i;
29 |
30 | state->ev_count = waiter->pfd_count;
31 | state->events = calloc(state->ev_count, sizeof(*state->events));
32 | if (state->events == NULL)
33 | return -ENOMEM;
34 |
35 | state->epfd = epoll_create(1);
36 | if (state->epfd < 0)
37 | return -errno;
38 |
39 | for (i = 0; i < (int)waiter->pfd_count; ++i) {
40 | struct epoll_event ev = {
41 | .data.fd = waiter->pfds[i].fd,
42 | .events = waiter->pfds[i].events,
43 | };
44 | if (epoll_ctl(state->epfd, EPOLL_CTL_ADD, ev.data.fd, &ev) < 0)
45 | return -errno;
46 | }
47 |
48 | return 0;
49 | }
50 |
51 | static int epoll_wait_event(struct waiter_context *waiter, int timeout_msec)
52 | {
53 | struct epoll_state *state = waiter->private_data;
54 | unsigned int ev_count;
55 | int i, j;
56 | int err;
57 |
58 | memset(state->events, 0, state->ev_count * sizeof(*state->events));
59 | err = epoll_wait(state->epfd, state->events, state->ev_count,
60 | timeout_msec);
61 | if (err < 0)
62 | return -errno;
63 | ev_count = (unsigned int)err;
64 |
65 | if (ev_count > 0) {
66 | // Reconstruct data of pollfd structure.
67 | for (i = 0; i < (int)ev_count; ++i) {
68 | struct epoll_event *ev = &state->events[i];
69 | for (j = 0; j < (int)waiter->pfd_count; ++j) {
70 | if (waiter->pfds[i].fd == ev->data.fd) {
71 | waiter->pfds[i].revents = ev->events;
72 | break;
73 | }
74 | }
75 | }
76 | }
77 |
78 | return ev_count;
79 | }
80 |
81 | static void epoll_release(struct waiter_context *waiter)
82 | {
83 | struct epoll_state *state = waiter->private_data;
84 | int i;
85 |
86 | for (i = 0; i < (int)waiter->pfd_count; ++i) {
87 | int fd = waiter->pfds[i].fd;
88 | epoll_ctl(state->epfd, EPOLL_CTL_DEL, fd, NULL);
89 | }
90 |
91 | free(state->events);
92 | state->events = NULL;
93 |
94 | close(state->epfd);
95 |
96 | state->ev_count = 0;
97 | state->epfd = 0;
98 | }
99 |
100 | const struct waiter_data waiter_epoll = {
101 | .ops = {
102 | .prepare = epoll_prepare,
103 | .wait_event = epoll_wait_event,
104 | .release = epoll_release,
105 | },
106 | .private_size = sizeof(struct epoll_state),
107 | };
108 |
--------------------------------------------------------------------------------
/axfer/waiter-select.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // waiter-select.c - Waiter for event notification by select(2).
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #include "waiter.h"
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | // Except for POLLERR.
18 | #ifdef POLLRDNORM
19 | // This program is for userspace compliant to POSIX 2008 (IEEE 1003.1:2008).
20 | // This is the default compliance level since glibc-2.12 or later.
21 | # define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP)
22 | # define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT)
23 | #else
24 | // However it's allowed to be for old compliance levels.
25 | # define POLLIN_SET (POLLIN | POLLHUP)
26 | # define POLLOUT_SET (POLLOUT)
27 | #endif
28 | #define POLLEX_SET (POLLPRI)
29 |
30 |
31 | struct select_state {
32 | fd_set rfds_rd;
33 | fd_set rfds_wr;
34 | fd_set rfds_ex;
35 | };
36 |
37 | static int select_prepare(struct waiter_context *waiter ATTRIBUTE_UNUSED)
38 | {
39 | return 0;
40 | }
41 |
42 | static int select_wait_event(struct waiter_context *waiter, int timeout_msec)
43 | {
44 | struct select_state *state = waiter->private_data;
45 | struct pollfd *pfd;
46 | int fd_max;
47 | struct timeval tv, *tv_ptr;
48 | int i;
49 | int err;
50 |
51 | FD_ZERO(&state->rfds_rd);
52 | FD_ZERO(&state->rfds_wr);
53 | FD_ZERO(&state->rfds_ex);
54 |
55 | fd_max = 0;
56 | for (i = 0; i < (int)waiter->pfd_count; ++i) {
57 | pfd = &waiter->pfds[i];
58 |
59 | if (pfd->events & POLLIN_SET)
60 | FD_SET(pfd->fd, &state->rfds_rd);
61 | if (pfd->events & POLLOUT_SET)
62 | FD_SET(pfd->fd, &state->rfds_wr);
63 | if (pfd->events & POLLEX_SET)
64 | FD_SET(pfd->fd, &state->rfds_ex);
65 | if (pfd->fd > fd_max)
66 | fd_max = pfd->fd;
67 | }
68 |
69 | if (timeout_msec < 0) {
70 | tv_ptr = NULL;
71 | } else {
72 | tv.tv_sec = 0;
73 | tv.tv_usec = timeout_msec * 1000;
74 | tv_ptr = &tv;
75 | }
76 |
77 | err = select(fd_max + 1, &state->rfds_rd, &state->rfds_wr,
78 | &state->rfds_ex, tv_ptr);
79 | if (err < 0)
80 | return -errno;
81 |
82 | for (i = 0; i < (int)waiter->pfd_count; ++i) {
83 | pfd = &waiter->pfds[i];
84 |
85 | pfd->revents = 0;
86 | if (FD_ISSET(pfd->fd, &state->rfds_rd))
87 | pfd->revents |= POLLIN;
88 | if (FD_ISSET(pfd->fd, &state->rfds_wr))
89 | pfd->revents |= POLLOUT;
90 | if (FD_ISSET(pfd->fd, &state->rfds_ex))
91 | pfd->revents |= POLLHUP;
92 | }
93 |
94 | return err;
95 | }
96 |
97 | static void select_release(struct waiter_context *waiter ATTRIBUTE_UNUSED)
98 | {
99 | return;
100 | }
101 |
102 | const struct waiter_data waiter_select = {
103 | .ops = {
104 | .prepare = select_prepare,
105 | .wait_event = select_wait_event,
106 | .release = select_release,
107 | },
108 | .private_size = sizeof(struct select_state),
109 | };
110 |
--------------------------------------------------------------------------------
/alsamixer/proc_files.c:
--------------------------------------------------------------------------------
1 | /*
2 | * proc_files.c - shows ALSA system information files
3 | * Copyright (c) Clemens Ladisch
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | */
18 |
19 | #include "aconfig.h"
20 | #include
21 | #include
22 | #include
23 | #include "gettext_curses.h"
24 | #include "utils.h"
25 | #include "die.h"
26 | #include "mem.h"
27 | #include "colors.h"
28 | #include "widget.h"
29 | #include "textbox.h"
30 | #include "proc_files.h"
31 | #include "menu_widget.h"
32 |
33 | static struct widget proc_widget;
34 | static ITEM *items[7];
35 | static unsigned int items_count;
36 | static MENU *menu;
37 |
38 | static void on_handle_key(int key)
39 | {
40 | ITEM *item;
41 |
42 | switch (menu_widget_handle_key(menu, key)) {
43 | case KEY_ENTER:
44 | item = current_item(menu);
45 | if (item)
46 | show_textfile(item_name(item));
47 | break;
48 | case KEY_CANCEL:
49 | proc_widget.close();
50 | break;
51 | }
52 | }
53 |
54 | static void create(void)
55 | {
56 | menu_widget_create(&proc_widget, menu, _("Select File"));
57 | }
58 |
59 | static void on_close(void)
60 | {
61 | unsigned int i;
62 |
63 | unpost_menu(menu);
64 | free_menu(menu);
65 | for (i = 0; i < items_count; ++i)
66 | free_item(items[i]);
67 | widget_free(&proc_widget);
68 | }
69 |
70 | static void add_item(const char *file_name)
71 | {
72 | if (access(file_name, F_OK) == 0) {
73 | items[items_count] = new_item(file_name, NULL);
74 | if (!items[items_count])
75 | fatal_error("cannot create menu item");
76 | ++items_count;
77 | assert(items_count < ARRAY_SIZE(items));
78 | }
79 | }
80 |
81 | static struct widget proc_widget = {
82 | .handle_key = on_handle_key,
83 | .window_size_changed = create,
84 | .close = on_close,
85 | };
86 |
87 | void create_proc_files_list(void)
88 | {
89 | items_count = 0;
90 | add_item("/proc/asound/version");
91 | add_item("/proc/asound/cards");
92 | add_item("/proc/asound/devices");
93 | add_item("/proc/asound/oss/devices");
94 | add_item("/proc/asound/timers");
95 | add_item("/proc/asound/pcm");
96 | items[items_count] = NULL;
97 |
98 | menu = new_menu(items);
99 | if (!menu)
100 | fatal_error("cannot create menu");
101 | set_menu_fore(menu, attrs.menu_selected);
102 | set_menu_back(menu, attrs.menu);
103 | set_menu_mark(menu, NULL);
104 | menu_opts_off(menu, O_SHOWDESC);
105 |
106 | create();
107 | }
108 |
--------------------------------------------------------------------------------
/.github/workflows/coverity.yml:
--------------------------------------------------------------------------------
1 | name: Coverity Scan
2 |
3 | on:
4 | workflow_dispatch:
5 | # push:
6 | # branches:
7 | # - master
8 | schedule:
9 | # Run once a week on Sunday at 4am UTC
10 | - cron: '0 4 * * 0'
11 |
12 | jobs:
13 | coverity:
14 | runs-on: ubuntu-latest
15 | container:
16 | image: fedora:latest
17 | steps:
18 | - name: Prepare environment
19 | run: |
20 | dnf -y upgrade
21 | dnf -y install @development-tools libtool bzip2 gettext-devel ncurses-devel awk curl wget tar file
22 |
23 | - name: Checkout alsa-lib
24 | uses: actions/checkout@v4
25 | with:
26 | repository: alsa-project/alsa-lib
27 | ref: master
28 | path: alsa-lib
29 |
30 | - name: Configure alsa-lib
31 | run: |
32 | cd alsa-lib
33 | head -5 configure.ac
34 | libtoolize --force --copy --automake
35 | aclocal
36 | autoheader
37 | automake --foreign --copy --add-missing
38 | autoconf
39 | export CFLAGS="-O2 -Wall -W -Wunused-const-variable=0 -pipe -g"
40 | ./configure
41 | echo "Version: $(cat version)"
42 |
43 | - name: Build alsa-lib
44 | run: |
45 | cd alsa-lib
46 | make
47 |
48 | - name: Install alsa-lib
49 | run: |
50 | cd alsa-lib
51 | make install
52 |
53 | - name: Checkout alsa-utils
54 | uses: actions/checkout@v4
55 | with:
56 | path: alsa-utils
57 |
58 | - name: Configure alsa-utils
59 | run: |
60 | cd alsa-utils
61 | mv configure.ac configure.ac.old
62 | sed -e 's;po/Makefile.in;;' < configure.ac.old > configure.ac
63 | aclocal
64 | gettextize -c -f --no-changelog
65 | libtoolize --force --copy --automake
66 | aclocal -I m4
67 | autoheader
68 | automake --foreign --copy --add-missing
69 | autoconf
70 | export CFLAGS="-O2 -Wall -W -Wunused-const-variable=0 -pipe -g"
71 | ./configure
72 |
73 | - name: Download Coverity Build Tool
74 | run: |
75 | cd alsa-utils
76 | wget -q https://scan.coverity.com/download/linux64 \
77 | --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=${{ secrets.COVERITY_SCAN_PROJECT }}" \
78 | -O coverity_tool.tar.gz
79 | mkdir coverity-tool
80 | tar xzf coverity_tool.tar.gz --strip-components=1 -C coverity-tool
81 |
82 | - name: Build with Coverity Build Tool
83 | run: |
84 | cd alsa-utils
85 | export PATH="$PWD/coverity-tool/bin:$PATH"
86 | cov-build --dir cov-int make
87 |
88 | - name: Submit results to Coverity Scan
89 | run: |
90 | cd alsa-utils
91 | tar czvf alsa-utils.tgz cov-int
92 | curl --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \
93 | --form email=${{ secrets.COVERITY_SCAN_EMAIL }} \
94 | --form file=@alsa-utils.tgz \
95 | --form version="$(git describe --tags --always)" \
96 | --form description="ALSA Utils Coverity Scan" \
97 | https://scan.coverity.com/builds?project=alsa-project%2Falsa-utils
98 |
--------------------------------------------------------------------------------
/bat/convert.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013-2015 Intel Corporation
3 | *
4 | * This program is free software; you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation; either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | */
15 |
16 | #include "aconfig.h"
17 | #include
18 | #include
19 | #include
20 | #include
21 |
22 | void convert_uint8_to_float(void *buf, float *val, int samples)
23 | {
24 | int i;
25 |
26 | for (i = 0; i < samples; i++)
27 | val[i] = ((uint8_t *) buf)[i];
28 | }
29 |
30 | void convert_int16_to_float(void *buf, float *val, int samples)
31 | {
32 | int i;
33 |
34 | for (i = 0; i < samples; i++)
35 | val[i] = ((int16_t *) buf)[i];
36 | }
37 |
38 | void convert_int24_to_float(void *buf, float *val, int samples)
39 | {
40 | int i;
41 | int32_t tmp;
42 |
43 | for (i = 0; i < samples; i++) {
44 | tmp = ((uint8_t *) buf)[i * 3 + 2] << 24;
45 | tmp |= ((uint8_t *) buf)[i * 3 + 1] << 16;
46 | tmp |= ((uint8_t *) buf)[i * 3] << 8;
47 | tmp >>= 8;
48 | val[i] = tmp;
49 | }
50 | }
51 |
52 | void convert_int32_to_float(void *buf, float *val, int samples)
53 | {
54 | int i;
55 |
56 | for (i = 0; i < samples; i++)
57 | val[i] = ((int32_t *) buf)[i];
58 | }
59 |
60 | void convert_float_to_uint8(float *val, void *buf, int samples, int channels)
61 | {
62 | int i, c, idx;
63 |
64 | for (i = 0; i < samples; i++) {
65 | for (c = 0; c < channels; c++) {
66 | idx = i * channels + c;
67 | ((uint8_t *) buf)[idx] = (uint8_t) val[idx];
68 | }
69 | }
70 | }
71 |
72 | void convert_float_to_int16(float *val, void *buf, int samples, int channels)
73 | {
74 | int i, c, idx;
75 |
76 | for (i = 0; i < samples; i++) {
77 | for (c = 0; c < channels; c++) {
78 | idx = i * channels + c;
79 | ((int16_t *) buf)[idx] = (int16_t) val[idx];
80 | }
81 | }
82 | }
83 |
84 | void convert_float_to_int24(float *val, void *buf, int samples, int channels)
85 | {
86 | int i, c, idx_f, idx_i;
87 | int32_t val_f_i;
88 |
89 | for (i = 0; i < samples; i++) {
90 | for (c = 0; c < channels; c++) {
91 | idx_f = i * channels + c;
92 | idx_i = 3 * idx_f;
93 | val_f_i = (int32_t) val[idx_f];
94 | ((int8_t *) buf)[idx_i + 0] =
95 | (int8_t) (val_f_i & 0xff);
96 | ((int8_t *) buf)[idx_i + 1] =
97 | (int8_t) ((val_f_i >> 8) & 0xff);
98 | ((int8_t *) buf)[idx_i + 2] =
99 | (int8_t) ((val_f_i >> 16) & 0xff);
100 | }
101 | }
102 | }
103 |
104 | void convert_float_to_int32(float *val, void *buf, int samples, int channels)
105 | {
106 | int i, c, idx;
107 |
108 | for (i = 0; i < samples; i++) {
109 | for (c = 0; c < channels; c++) {
110 | idx = i * channels + c;
111 | ((int32_t *) buf)[idx] = (int32_t) val[idx];
112 | }
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/alsaloop/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #DBG="gdb --args "
4 | #DBG="strace"
5 | #DBG="valgrind --leak-check=full"
6 | ARGS=
7 | CFGFILE="/tmp/alsaloop.test.cfg"
8 |
9 | test1() {
10 | echo "TEST1"
11 | $DBG ./alsaloop -C hw:1,0 -P plughw:0,0 \
12 | --tlatency 50000 \
13 | --mixer "name='Master Playback Volume'@name='Master Playback Volume'" \
14 | --mixer "name='Master Playback Switch'@name='Master Playback Switch'" \
15 | --mixer "name='PCM Playback Volume'" \
16 | --ossmixer "Master@VOLUME" \
17 | --ossmixer "PCM@PCM" \
18 | $ARGS
19 | }
20 |
21 | test2() {
22 | echo "TEST2"
23 | cat > $CFGFILE < $CFGFILE < $CFGFILE <
10 | :Date: 2018-10-09
11 | :Copyright: GPLv2+
12 | :Manual section: 1
13 | :Manual group: General Commands Manual
14 |
15 | SYNOPSIS
16 | ========
17 |
18 | *alsatplg* [command]
19 |
20 | DESCRIPTION
21 | ===========
22 |
23 | alsatplg (ALSA Topology compiler) is a program to compile topology
24 | configuration file to the binary file for the kernel drivers.
25 |
26 | Current audio drivers typically hard code topology information
27 | in the driver sources: This tightly couples the audio driver
28 | to the development board making it time consuming to modify
29 | a driver to work on a different devices. The driver is also
30 | tightly coupled to the DSP firmware version meaning extra care
31 | is needed to keep the driver and firmware version in sync.
32 | New firmware features also mean driver updates.
33 |
34 | The ALSA topology project removes the need for re-writing or
35 | porting audio drivers to different devices or different firmwares:
36 | Drivers have no hard coded topology data meaning a single driver
37 | can be used on different devices by updating the topology data
38 | from the file system. Firmware updates can be pushed without
39 | having to update the drivers. The new firmware just needs
40 | to include an updated topology file describing the update.
41 |
42 | OPTIONS
43 | =======
44 |
45 | Available options:
46 |
47 | **-h**, **--help**
48 | this help
49 |
50 | **-V**, **--version**
51 | show the utility version and versions of used libraries
52 |
53 | **-c**, **--compile** `FILE`
54 | source configuration file for the compilation
55 |
56 | **-d**, **--decode** `FILE`
57 | source binary topology file for the decode
58 |
59 | **-n**, **--normalize** `FILE`
60 | parse and save the configuration file in the normalized format
61 |
62 | **-u**, **--dump** `FILE`
63 | parse and save the configuration file in the specified format
64 |
65 | **-o**, **--output** `FILE`
66 | output file
67 |
68 | **-v**, **--verbose** `LEVEL`
69 | set verbose level
70 |
71 | **-s**, **--sort**
72 | sort the configuration identifiers (set for normalization)
73 |
74 | **-x**, **--nocheck**
75 | save the configuration without additional integrity check
76 |
77 | **-z**, **--dapm-nosort**
78 | do not sort DAPM graph items (like in version 1.2.1-)
79 |
80 |
81 | FILES
82 | =====
83 |
84 | The master topology files for each supported sound card are in
85 | ``/usr/share/alsa/topology``.
86 |
87 | For example, the master use case file for the `broadwell` card is in
88 | ``/usr/share/alsa/topology/broadwell/broadwell.conf``, this file
89 | describes the audio hardware for the driver.
90 |
91 | For more details on the syntax of UCM files, see the alsa-lib source code:
92 | http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/topology/parser.c
93 |
94 | SEE ALSO
95 | ========
96 |
97 | * Topology Interface: http://www.alsa-project.org/alsa-doc/alsa-lib/group__topology.html
98 |
99 | BUGS
100 | ====
101 |
102 | None known.
103 |
--------------------------------------------------------------------------------
/axfer/axfer.1:
--------------------------------------------------------------------------------
1 | .TH AXFER 1 "28 November 2018" "alsa\-utils"
2 |
3 | .SH NAME
4 | axfer \- command\-line sound recorder and player for sound devices and nodes
5 | supported by Linux sound subsystem (Advanced Linux Sound Architecture, also
6 | known as ALSA).
7 |
8 | .SH SYNOPSYS
9 |
10 | .B axfer
11 | .I subcommand direction options
12 |
13 | subcommand =
14 | .B transfer
15 | |
16 | .B list
17 | |
18 | .B version
19 | |
20 | .B help
21 |
22 | direction =
23 | .B capture
24 | |
25 | .B playback
26 |
27 | options = ( depends on
28 | .I subcommand
29 | )
30 |
31 | .SH DESCRIPTION
32 | The
33 | .B axfer
34 | is a command\-line recorder and player to transfer audio data frame between
35 | sound devices/nodes and files/stdin/stdout.
36 |
37 | .SH OPTIONS
38 |
39 | .SS Subcommand
40 |
41 | .TP
42 | .B transfer
43 | Performs transmission of audio data frame. Its detail is described in
44 | .B axfer\-transfer(1)
45 | manual.
46 |
47 | .TP
48 | .B list
49 | Dumps lists of available sound devices and nodes. Its detail is described in
50 | .B axfer\-list(1)
51 | manual.
52 |
53 | .TP
54 | .B version
55 | Prints version of this application (as the same version as alsa\-utils package).
56 |
57 | .TP
58 | .B help
59 | Prints a short message about subcommands for users to enter this application.
60 |
61 | .SS Direction
62 |
63 | .TP
64 | .B capture
65 | Operates for capture transmission.
66 |
67 | .TP
68 | .B playback
69 | Operates for playback transmission.
70 |
71 | .SH EXIT STATUS
72 |
73 | .I EXIT_SUCCESS
74 | (0) if run time successfully finished, else
75 | .I EXIT_FAILURE
76 | (1).
77 |
78 | .SH UNIT TEST
79 |
80 | This program has unit tests for internal implementation. Please refer to the
81 | manual of
82 | .I axfer-transfer
83 | for details.
84 |
85 | .SH COMPATIBILITY TO APLAY
86 |
87 | The
88 | .I axfer
89 | is designed to be compatible to aplay(1) as much as possible. In command line,
90 | executions of aplay/arecord files under $PATH runs axfer with compatibility
91 | mode if filesystem has symbolic link from the aplay/arecord to axfer.
92 |
93 | .PP
94 | .in +4n
95 | .EX
96 | $ ln \-s aplay axfer
97 | $ ln \-s arecord axfer
98 | .EE
99 | .in
100 | .PP
101 |
102 | .SS A string to which arg[0] points
103 | When args[0] in run time points to string ended with \(aqaplay\(aq, it has the
104 | same meaning of
105 | .I playback
106 | direction. When it points to string ended with \(aqarecord\(aq, it has the same
107 | meaning of
108 | .I capture
109 | direction.
110 |
111 | .SS Options acknowledged as list subcommand
112 | Options of
113 | .I \-l
114 | ,
115 | .I \-\-list\-devices
116 | ,
117 | .I \-L
118 | ,
119 | .I \-\-list\-pcms
120 | are acknowledged as
121 | .I list
122 | subcommand. Without them, the run time performs
123 | .I transfer
124 | subcommand.
125 |
126 | .SH REPORTING BUGS
127 | Report any bugs to mailing list of ALSA community
128 | where the development and maintenance is
129 | primarily done. Bug tracking service of alsa\-utils repository on github.com is
130 | also available.
131 |
132 | .SH SEE ALSO
133 | .B axfer\-transfer(1),
134 | .B axfer\-list(1),
135 | .B alsamixer(1),
136 | .B amixer(1)
137 |
138 | .SH AUTHOR
139 | Takashi Sakamoto
140 |
--------------------------------------------------------------------------------
/iecset/iecset.1:
--------------------------------------------------------------------------------
1 | .TH iecset 1 "23 Oct 2003"
2 | .SH NAME
3 | iecset \- Set or dump IEC958 status bits
4 |
5 | .SH SYNOPSIS
6 | \fBiecset\fP [\fIoptions\fP] [\fIcmd\fP \fIarg\fP...]
7 |
8 | .SH DESCRIPTION
9 | \fBiecset\fP is a small utility to set or dump the IEC958 (or so-called
10 | "S/PDIF") status bits of the specified sound card via ALSA control API.
11 |
12 | When \fBiecset\fP is started without arguments except for options,
13 | it will show the current IEC958 status in a human-readable form.
14 | When the commands are given in the arguments, they are parsed
15 | and the IEC958 status bits are updated. The resultant status is
16 | shown as well.
17 |
18 | The commands consist of the command directive and the argument.
19 | As the boolean argument, \fIyes\fP, \fIno\fP, \fItrue\fP, \fIfalse\fP,
20 | or a digit number is allowed.
21 |
22 | .SH EXAMPLES
23 | .TP
24 | .BI iecset\ \-Dhw:1
25 | Displays the current IEC958 status bits on the second card.
26 | This is equivalent with \fI\-c 1\fP.
27 | .TP
28 | .BI iecset\ \-x
29 | Displays the current IEC958 status bits in a style of the arguments
30 | for the PCM stream. The output string can be passed to the \fIiec958\fP
31 | (or \fIspdif\fP) PCM type as the optional argument.
32 | .TP
33 | .BI iecset\ pro\ off\ audio\ off
34 | Sets the current status to the consumer-mode and turns on the
35 | non-audio bit. The modified status will be shown, too.
36 |
37 | .SH OPTIONS
38 | .TP
39 | \fI\-D\fP device
40 | Specifies the device name of the control to open
41 | .TP
42 | \fI\-c\fP card
43 | Specifies the card index to open. Equivalent with \fI\-Dhw:x\fP.
44 | .TP
45 | \fI\-n\fP index
46 | Specifies the IEC958 control element index, in case you have multiple
47 | IEC958 devices and need to choose one of them.
48 | .TP
49 | \fI\-x\fP
50 | Dumps the status in the form of AESx bytes.
51 | .TP
52 | \fI\-i\fP
53 | Reads the command sequences from stdin.
54 | Each line has single command.
55 |
56 | .SH COMMANDS
57 | .TP
58 | \fIprofessional\fP
59 | The professional mode (true) or consumer mode (false).
60 |
61 | .TP
62 | \fIaudio\fP
63 | The audio mode (true) or non-audio mode (false).
64 |
65 | .TP
66 | \fIrate\fP
67 | The sample rate in Hz.
68 |
69 | .TP
70 | \fIemphasis\fP
71 | The emphasis: 0 = none, 1 = 50/15us, 2 = CCITT.
72 |
73 | .TP
74 | \fIlock\fP
75 | Rate lock: locked (true), unlocked (false).
76 | This command is for the professional mode only.
77 |
78 | .TP
79 | \fIsbits\fP
80 | Sample bits: 2 = 20bit, 4 = 24bit, 6 = undefined.
81 | This command is for the professional mode only.
82 |
83 | .TP
84 | \fIwordlength\fP
85 | Wordlength: 0 = No, 2 = 22-18 bit, 4 = 23-19 bit, 5 = 24-20 bit, 6 = 20-16 bit.
86 | This command is for the professional mode only.
87 |
88 | .TP
89 | \fIcategory\fP
90 | Category: the value is from 0 to 0x7f.
91 | This command is for the consumer mode only.
92 |
93 | .TP
94 | \fIcopyright\fP
95 | Copyright: copyrighted (true), non-copyrighted (false).
96 | This command is for the consumer mode only.
97 |
98 | .TP
99 | \fIoriginal\fP
100 | Original flag: original (true), 1st generation (false).
101 | This command is for the consumer mode only.
102 |
103 | .SH AUTHOR
104 | Takashi Iwai
105 |
--------------------------------------------------------------------------------
/speaker-test/pink.c:
--------------------------------------------------------------------------------
1 | /*
2 | patest_pink.c
3 |
4 | generate Pink Noise using Gardner method.
5 | Optimization suggested by James McCartney uses a tree
6 | to select which random value to replace.
7 |
8 | x x x x x x x x x x x x x x x x
9 | x x x x x x x x
10 | x x x x
11 | x x
12 | x
13 |
14 | Tree is generated by counting trailing zeros in an increasing index.
15 | When the index is zero, no random number is selected.
16 |
17 | This program uses the Portable Audio library which is under development.
18 | For more information see: http://www.audiomulch.com/portaudio/
19 |
20 | Author: Phil Burk, http://www.softsynth.com
21 |
22 | Revision History:
23 |
24 | Copyleft 1999 Phil Burk - No rights reserved.
25 | */
26 |
27 | #include "aconfig.h"
28 | #include
29 | #include
30 | #include "pink.h"
31 |
32 | /************************************************************/
33 | /* Calculate pseudo-random 32 bit number based on linear congruential method. */
34 | static unsigned long generate_random_number( void )
35 | {
36 | static unsigned long rand_seed = 22222; /* Change this for different random sequences. */
37 | rand_seed = (rand_seed * 196314165) + 907633515;
38 | return rand_seed;
39 | }
40 |
41 | /* Setup PinkNoise structure for N rows of generators. */
42 | void initialize_pink_noise( pink_noise_t *pink, int num_rows )
43 | {
44 | int i;
45 | long pmax;
46 | pink->pink_index = 0;
47 | pink->pink_index_mask = (1<pink_scalar = 1.0f / pmax;
51 | /* Initialize rows. */
52 | for( i=0; ipink_rows[i] = 0;
53 | pink->pink_running_sum = 0;
54 | }
55 |
56 | /* generate Pink noise values between -1.0 and +1.0 */
57 | float generate_pink_noise_sample( pink_noise_t *pink )
58 | {
59 | long new_random;
60 | long sum;
61 | float output;
62 |
63 | /* Increment and mask index. */
64 | pink->pink_index = (pink->pink_index + 1) & pink->pink_index_mask;
65 |
66 | /* If index is zero, don't update any random values. */
67 | if( pink->pink_index != 0 )
68 | {
69 | /* Determine how many trailing zeros in PinkIndex. */
70 | /* This algorithm will hang if n==0 so test first. */
71 | int num_zeros = 0;
72 | int n = pink->pink_index;
73 | while( (n & 1) == 0 )
74 | {
75 | n = n >> 1;
76 | num_zeros++;
77 | }
78 |
79 | /* Replace the indexed ROWS random value.
80 | * Subtract and add back to Running_sum instead of adding all the random
81 | * values together. Only one changes each time.
82 | */
83 | pink->pink_running_sum -= pink->pink_rows[num_zeros];
84 | new_random = ((long)generate_random_number()) >> PINK_RANDOM_SHIFT;
85 | pink->pink_running_sum += new_random;
86 | pink->pink_rows[num_zeros] = new_random;
87 | }
88 |
89 | /* Add extra white noise value. */
90 | new_random = ((long)generate_random_number()) >> PINK_RANDOM_SHIFT;
91 | sum = pink->pink_running_sum + new_random;
92 |
93 | /* Scale to range of -1.0 to 0.9999. */
94 | output = pink->pink_scalar * sum;
95 |
96 | return output;
97 | }
98 |
--------------------------------------------------------------------------------
/axfer/frame-cache.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // frame-cache.c - maintainer of cache for data frame.
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #include "frame-cache.h"
10 |
11 | static void align_frames_in_i(struct frame_cache *cache,
12 | unsigned int consumed_count)
13 | {
14 | char *buf = cache->buf;
15 | unsigned int offset;
16 | unsigned int size;
17 |
18 | cache->remained_count -= consumed_count;
19 |
20 | offset = cache->bytes_per_sample * cache->samples_per_frame *
21 | consumed_count;
22 | size = cache->bytes_per_sample * cache->samples_per_frame *
23 | cache->remained_count;
24 | memmove(buf, buf + offset, size);
25 |
26 | cache->buf_ptr = buf + size;
27 | }
28 |
29 | static void align_frames_in_n(struct frame_cache *cache,
30 | unsigned int consumed_count)
31 | {
32 | char **bufs = cache->buf;
33 | char **buf_ptrs = cache->buf_ptr;
34 | unsigned int offset;
35 | unsigned int size;
36 | unsigned int i;
37 |
38 | cache->remained_count -= consumed_count;
39 |
40 | for (i = 0; i < cache->samples_per_frame; ++i) {
41 | offset = cache->bytes_per_sample * consumed_count;
42 | size = cache->bytes_per_sample * cache->remained_count;
43 | memmove(bufs[i], bufs[i] + offset, size);
44 | buf_ptrs[i] = bufs[i] + size;
45 | }
46 | }
47 |
48 | int frame_cache_init(struct frame_cache *cache, snd_pcm_access_t access,
49 | unsigned int bytes_per_sample,
50 | unsigned int samples_per_frame,
51 | unsigned int frames_per_cache)
52 | {
53 | cache->access = access;
54 | cache->remained_count = 0;
55 | cache->bytes_per_sample = bytes_per_sample;
56 | cache->samples_per_frame = samples_per_frame;
57 | cache->frames_per_cache = frames_per_cache;
58 |
59 | if (access == SND_PCM_ACCESS_RW_INTERLEAVED)
60 | cache->align_frames = align_frames_in_i;
61 | else if (access == SND_PCM_ACCESS_RW_NONINTERLEAVED)
62 | cache->align_frames = align_frames_in_n;
63 | else
64 | return -EINVAL;
65 |
66 | if (access == SND_PCM_ACCESS_RW_INTERLEAVED) {
67 | char *buf;
68 |
69 | buf = calloc(frames_per_cache,
70 | bytes_per_sample * samples_per_frame);
71 | if (buf == NULL)
72 | goto nomem;
73 | cache->buf = buf;
74 | cache->buf_ptr = buf;
75 | } else {
76 | char **bufs = calloc(samples_per_frame, sizeof(*bufs));
77 | char **buf_ptrs = calloc(samples_per_frame, sizeof(*buf_ptrs));
78 | unsigned int i;
79 |
80 | cache->buf = bufs;
81 | cache->buf_ptr = buf_ptrs;
82 | if (bufs == NULL || buf_ptrs == NULL)
83 | goto nomem;
84 | for (i = 0; i < samples_per_frame; ++i) {
85 | bufs[i] = calloc(frames_per_cache, bytes_per_sample);
86 | if (bufs[i] == NULL)
87 | goto nomem;
88 | buf_ptrs[i] = bufs[i];
89 | }
90 | }
91 |
92 |
93 | return 0;
94 |
95 | nomem:
96 | frame_cache_destroy(cache);
97 | return -ENOMEM;
98 | }
99 |
100 | void frame_cache_destroy(struct frame_cache *cache)
101 | {
102 | if (cache->access == SND_PCM_ACCESS_RW_NONINTERLEAVED) {
103 | char **bufs = cache->buf;
104 | if (bufs) {
105 | unsigned int i;
106 | for (i = 0; i < cache->samples_per_frame; ++i)
107 | free(bufs[i]);
108 | }
109 | free(cache->buf_ptr);
110 | }
111 | free(cache->buf);
112 | memset(cache, 0, sizeof(*cache));
113 | }
114 |
--------------------------------------------------------------------------------
/alsaconf/alsaconf.8:
--------------------------------------------------------------------------------
1 | .\" Hey, EMACS: -*- nroff -*-
2 | .\" alsaconf.8 is copyright 2003 by Jordi Mallach
3 | .\"
4 | .\" This is free documentation, see the latest version of the GNU
5 | .\" General Public License for copying conditions. There is NO warranty.
6 | .TH ALSACONF 8 "February 23, 2003"
7 |
8 | .SH NAME
9 | alsaconf \- configuration tool for the Advanced Linux Sound Architecture
10 |
11 | .SH SYNOPSIS
12 | .B alsaconf
13 | .RI [ options ]
14 |
15 | .SH DESCRIPTION
16 | This manual page documents briefly the
17 | .B alsaconf
18 | command.
19 | This manual page was written for the Debian distribution because the
20 | original program does not have a manual page.
21 | .PP
22 | \fBAlsaconf\fP is a simple shell script which tries to detect the sound cards
23 | on your system and writes a suitable configuration file for ALSA. It will try
24 | to guess what GNU/Linux distribution you're running, and will act accordingly
25 | to the standards of that distribution, if specific support is available.
26 | .PP
27 | Alsaconf will write a module-init-tools (or modutils) snippet which can be then used by module-init-tools (or modutils)
28 | to load the correct parameters for your sound card.
29 |
30 | .SH OPTIONS
31 | Alsaconf accepts the following options:
32 | .TP
33 | .B \-c, \-\-config file
34 | Specify the module config file.
35 | As default,
36 | .B alsaconf
37 | probes the available config file automatically.
38 | .TP
39 | .B \-d, \-\-devmode mode
40 | Set the device mode for the ALSA devices (default = 0666).
41 | This option is obsolete in the recent ALSA version.
42 | .TP
43 | .B \-g, \-\-gid gid
44 | Set the gid for the ALSA devices (default = 0).
45 | This option is obsolete in the recent ALSA version.
46 | .TP
47 | .B \-h, \-\-help
48 | Displays this help text.
49 | .TP
50 | .B \-L, \-\-log file
51 | Logging on the given file. The log is appended to the file.
52 | This option is for debugging purpose only.
53 | .TP
54 | .B \-l, \-\-legacy
55 | Check only for legacy non-isapnp cards.
56 | .TP
57 | .B \-m, \-\-modinfo
58 | Read module descriptions instead of reading a card database.
59 | .TP
60 | .B \-P, \-\-listprobe
61 | List the supported legacy card modules.
62 | .TP
63 | .B \-p, \-\-probe card-name
64 | Probe a legacy non-isapnp card and print module options.
65 | .TP
66 | .B \-r, \-\-strict
67 | Set strict device mode (equiv. with \-g 17 \-d 0660).
68 | This option is obsolete in the recent ALSA version.
69 | .TP
70 | .B \-s, \-\-sound\-wav\-file
71 | Use the specified wav file as a test sound.
72 | .TP
73 | .B \-u, \-\-uid uid
74 | Set the uid for the ALSA devices (default = 0).
75 | This option is obsolete in the recent ALSA version.
76 |
77 | .SH DEBIAN SPECIFIC
78 | In Debian, the default gid of the device files is 29 (corresponding to the
79 | audio group) and the default device mode is 0660.
80 |
81 | For the ALSA base package, see also
82 | .I /usr/share/doc/alsa\-base/
83 |
84 | .SH SEE ALSO
85 | \fB
86 | alsamixer(1),
87 | amixer(1),
88 | aplay(1),
89 | arecord(1)
90 | \fP
91 |
92 | .SH HOMEPAGE
93 | http://www.alsa\-project.org/
94 |
95 | .SH AUTHOR
96 | The alsaconf script was written by
97 | Takashi Iwai ,
98 | Bernd Kaindl and
99 | Jan Ondrej (SAL)
100 |
101 | This manual page was written by Jordi Mallach ,
102 | for the Debian system (but may be used by others).
103 |
--------------------------------------------------------------------------------
/topology/nhlt/intel/intel-nhlt.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | //
3 | // Copyright(c) 2021 Intel Corporation. All rights reserved.
4 | //
5 | // Author: Jaska Uimonen
6 |
7 | #include "aconfig.h"
8 | #include "intel-nhlt.h"
9 |
10 | static int get_int_val(snd_config_t *input, long *int_val, snd_config_t *top)
11 | {
12 | char tplg_define[128] = "Define.";
13 | snd_config_t *n;
14 | const char *s;
15 | int ret;
16 |
17 | if (snd_config_get_string(input, &s) < 0)
18 | return snd_config_get_integer(input, int_val);
19 |
20 | if (*s != '$')
21 | return 0;
22 |
23 | strcat(tplg_define, s + 1);
24 |
25 | ret = snd_config_search(top, tplg_define, &n);
26 | if (ret < 0)
27 | return ret;
28 |
29 | return snd_config_get_integer(n, int_val);
30 | }
31 |
32 | static int get_string_val(snd_config_t *input, const char **string_val, snd_config_t *top)
33 | {
34 | char tplg_define[128] = "Define.";
35 | snd_config_t *n;
36 | int ret;
37 |
38 | if (snd_config_get_string(input, string_val) < 0)
39 | return -EINVAL;
40 |
41 | if (**string_val != '$')
42 | return 0;
43 |
44 | strcat(tplg_define, *string_val + 1);
45 |
46 | ret = snd_config_search(top, tplg_define, &n);
47 | if (ret < 0)
48 | return ret;
49 |
50 | return snd_config_get_string(n, string_val);
51 | }
52 |
53 | #ifdef NHLT_DEBUG
54 | static void print_array_values(struct dai_values *values, int size)
55 | {
56 | int i;
57 |
58 | fprintf(stdout, "print parsed array:\n");
59 | for (i = 0; i < size; i++, values++) {
60 | if (values->type == SND_CONFIG_TYPE_INTEGER)
61 | fprintf(stdout, "%s %ld\n", values->name, *values->int_val);
62 | else
63 | fprintf(stdout, "%s %s\n", values->name, *values->string_val);
64 | }
65 | fprintf(stdout, "\n");
66 | }
67 | #endif
68 |
69 | int find_set_values(struct dai_values *values, int size, snd_config_t *dai_cfg,
70 | snd_config_t *top, const char *class_name)
71 | {
72 | snd_config_iterator_t i, next;
73 | struct dai_values *temp_val;
74 | snd_config_t *class_cfg;
75 | snd_config_t *n;
76 | const char *id;
77 | int ret;
78 | int j;
79 |
80 | /* get default values from class definition */
81 | ret = snd_config_search(top, class_name, &class_cfg);
82 | if (ret < 0)
83 | return ret;
84 |
85 | snd_config_for_each(i, next, class_cfg) {
86 | n = snd_config_iterator_entry(i);
87 |
88 | if (snd_config_get_id(n, &id) < 0)
89 | continue;
90 |
91 | for (j = 0, temp_val = values; j < size; j++, temp_val++) {
92 | if (!strcmp(id, temp_val->name)) {
93 | temp_val->data = n;
94 | break;
95 | }
96 | }
97 | }
98 |
99 | /* set instance specific values */
100 | snd_config_for_each(i, next, dai_cfg) {
101 | n = snd_config_iterator_entry(i);
102 |
103 | if (snd_config_get_id(n, &id) < 0)
104 | continue;
105 |
106 | for (j = 0, temp_val = values; j < size; j++, temp_val++) {
107 | if (!strcmp(id, temp_val->name)) {
108 | temp_val->data = n;
109 | break;
110 | }
111 | }
112 | }
113 |
114 | for (j = 0, temp_val = values; j < size; j++, temp_val++) {
115 | if (!temp_val->data)
116 | continue;
117 | if (temp_val->type == SND_CONFIG_TYPE_INTEGER)
118 | get_int_val(temp_val->data, temp_val->int_val, top);
119 | else
120 | get_string_val(temp_val->data, temp_val->string_val, top);
121 | }
122 |
123 | #ifdef NHLT_DEBUG
124 | print_array_values(values, size);
125 | #endif
126 | return 0;
127 | }
128 |
--------------------------------------------------------------------------------
/topology/nhlt/intel/ssp/ssp-intel.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | //
3 | // Copyright(c) 2021 Intel Corporation. All rights reserved.
4 | //
5 | // Author: Liam Girdwood
6 | // Keyon Jie
7 | // Rander Wang
8 | // Jaska Uimonen
9 |
10 | #ifndef __SSP_INTEL_H
11 | #define __SSP_INTEL_H
12 |
13 | #include
14 |
15 | #define SSP_TS_GROUP_SIZE 8
16 |
17 | /* struct for intel ssp nhlt vendor specific blob generation */
18 | struct ssp_intel_config_data {
19 | uint32_t gateway_attributes;
20 | uint32_t ts_group[SSP_TS_GROUP_SIZE];
21 | uint32_t ssc0;
22 | uint32_t ssc1;
23 | uint32_t sscto;
24 | uint32_t sspsp;
25 | uint32_t sstsa;
26 | uint32_t ssrsa;
27 | uint32_t ssc2;
28 | uint32_t sspsp2;
29 | uint32_t ssc3;
30 | uint32_t ssioc;
31 | uint32_t mdivc;
32 | uint32_t mdivr;
33 | } __attribute__((packed));
34 |
35 | #define SSP_BLOB_VER_1_5 0xEE000105
36 | #define SSP_BLOB_VER_3_0 0xEE000300
37 |
38 | struct ssp_intel_config_data_1_5 {
39 | uint32_t gateway_attributes;
40 | uint32_t version;
41 | uint32_t size;
42 | uint32_t ts_group[SSP_TS_GROUP_SIZE];
43 | uint32_t ssc0;
44 | uint32_t ssc1;
45 | uint32_t sscto;
46 | uint32_t sspsp;
47 | uint32_t sstsa;
48 | uint32_t ssrsa;
49 | uint32_t ssc2;
50 | uint32_t sspsp2;
51 | uint32_t ssc3;
52 | uint32_t ssioc;
53 | uint32_t mdivctlr;
54 | uint32_t mdivrcnt;
55 | uint32_t mdivr[];
56 | } __attribute__((packed));
57 |
58 | #define I2SIPCMC 8
59 | #define I2SOPCMC 8
60 |
61 | struct ssp_rx_dir {
62 | uint64_t ssmidytsa;
63 | } __attribute__((packed));
64 |
65 | struct ssp_tx_dir {
66 | uint64_t ssmodytsa;
67 | } __attribute__((packed));
68 |
69 | struct ssp_intel_config_data_3_0 {
70 | uint32_t gateway_attributes;
71 | uint32_t version;
72 | uint32_t size;
73 | uint32_t ts_group[SSP_TS_GROUP_SIZE];
74 | uint32_t ssc0;
75 | uint32_t ssc1;
76 | uint32_t sscto;
77 | uint32_t sspsp;
78 | uint32_t ssc2;
79 | uint32_t sspsp2;
80 | uint32_t rsvd2;
81 | uint32_t ssioc;
82 | struct ssp_rx_dir rx_dir[I2SIPCMC];
83 | struct ssp_tx_dir tx_dir[I2SOPCMC];
84 | uint32_t mdivctlr;
85 | uint32_t mdivrcnt;
86 | uint32_t mdivr[];
87 | } __attribute__((packed));
88 |
89 | struct ssp_intel_aux_tlv {
90 | uint32_t type;
91 | uint32_t size;
92 | uint32_t val[];
93 | } __attribute__((packed));
94 |
95 | struct ssp_intel_mn_ctl {
96 | uint32_t div_m;
97 | uint32_t div_n;
98 | } __attribute__((packed));
99 |
100 | struct ssp_intel_clk_ctl {
101 | uint32_t start;
102 | uint32_t stop;
103 | } __attribute__((packed));
104 |
105 | struct ssp_intel_tr_ctl {
106 | uint32_t sampling_frequency;
107 | uint32_t bit_depth;
108 | uint32_t channel_map;
109 | uint32_t channel_config;
110 | uint32_t interleaving_style;
111 | uint32_t format;
112 | } __attribute__((packed));
113 |
114 | struct ssp_intel_run_ctl {
115 | uint32_t enabled;
116 | } __attribute__((packed));
117 |
118 | struct ssp_intel_node_ctl {
119 | uint32_t node_id;
120 | uint32_t sampling_rate;
121 | } __attribute__((packed));
122 |
123 | struct ssp_intel_sync_ctl {
124 | uint32_t sync_denominator;
125 | uint32_t count;
126 | } __attribute__((packed));
127 |
128 | struct ssp_intel_ext_ctl {
129 | uint32_t ext_data;
130 | } __attribute__((packed));
131 |
132 | struct ssp_intel_link_ctl {
133 | uint32_t clock_source;
134 | } __attribute__((packed));
135 |
136 | #endif /* __SSP_INTEL_H */
137 |
--------------------------------------------------------------------------------
/po/Makevars:
--------------------------------------------------------------------------------
1 | # Makefile variables for PO directory in any package using GNU gettext.
2 |
3 | # Usually the message domain is the same as the package name.
4 | DOMAIN = $(PACKAGE)
5 |
6 | # These two variables depend on the location of this directory.
7 | subdir = po
8 | top_builddir = ..
9 |
10 | # These options get passed to xgettext.
11 | XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
12 |
13 | # This tells whether or not to prepend "GNU " prefix to the package
14 | # name that gets inserted into the header of the $(DOMAIN).pot file.
15 | # Possible values are "yes", "no", or empty. If it is empty, try to
16 | # detect it automatically by scanning the files in $(top_srcdir) for
17 | # "GNU packagename" string.
18 | PACKAGE_GNU =
19 |
20 | # This is the copyright holder that gets inserted into the header of the
21 | # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
22 | # package. (Note that the msgstr strings, extracted from the package's
23 | # sources, belong to the copyright holder of the package.) Translators are
24 | # expected to transfer the copyright for their translations to this person
25 | # or entity, or to disclaim their copyright. The empty string stands for
26 | # the public domain; in this case the translators are expected to disclaim
27 | # their copyright.
28 | COPYRIGHT_HOLDER = The ALSA Team
29 |
30 | # This is the email address or URL to which the translators shall report
31 | # bugs in the untranslated strings:
32 | # - Strings which are not entire sentences, see the maintainer guidelines
33 | # in the GNU gettext documentation, section 'Preparing Strings'.
34 | # - Strings which use unclear terms or require additional context to be
35 | # understood.
36 | # - Strings which make invalid assumptions about notation of date, time or
37 | # money.
38 | # - Pluralisation problems.
39 | # - Incorrect English spelling.
40 | # - Incorrect formatting.
41 | # It can be your email address, or a mailing list address where translators
42 | # can write to without being subscribed, or the URL of a web page through
43 | # which the translators can contact you.
44 | MSGID_BUGS_ADDRESS =
45 |
46 | # This is the list of locale categories, beyond LC_MESSAGES, for which the
47 | # message catalogs shall be used. It is usually empty.
48 | EXTRA_LOCALE_CATEGORIES =
49 |
50 | # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
51 | # context. Possible values are "yes" and "no". Set this to yes if the
52 | # package uses functions taking also a message context, like pgettext(), or
53 | # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
54 | USE_MSGCTXT = no
55 |
56 | # These options get passed to msgmerge.
57 | # Useful options are in particular:
58 | # --previous to keep previous msgids of translated messages,
59 | # --quiet to reduce the verbosity.
60 | MSGMERGE_OPTIONS =
61 |
62 | # These options get passed to msginit.
63 | # If you want to disable line wrapping when writing PO files, add
64 | # --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
65 | # MSGINIT_OPTIONS.
66 | MSGINIT_OPTIONS =
67 |
68 | # This tells whether or not to regenerate a PO file when $(DOMAIN).pot
69 | # has changed. Possible values are "yes" and "no". Set this to no if
70 | # the POT file is checked in the repository and the version control
71 | # program ignores timestamps.
72 | PO_DEPENDS_ON_POT = yes
73 |
74 | # This tells whether or not to forcibly update $(DOMAIN).pot and
75 | # regenerate PO files on "make dist". Possible values are "yes" and
76 | # "no". Set this to no if the POT file and PO files are maintained
77 | # externally.
78 | DIST_DEPENDS_ON_UPDATE_PO = yes
79 |
--------------------------------------------------------------------------------
/seq/aplaymidi2/arecordmidi2.1:
--------------------------------------------------------------------------------
1 | .TH ARECORDMIDI2 1 "4 July 2024"
2 |
3 | .SH NAME
4 | arecordmidi2 \- record a MIDI Clip file
5 |
6 | .SH SYNOPSIS
7 | .B arecordmidi2
8 | [options] midi2file
9 |
10 | .SH DESCRIPTION
11 | .B arecordmidi2
12 | is a command-line utility that records a MIDI Clip file from one or
13 | more ALSA sequencer ports.
14 |
15 | To stop recording, press Ctrl+C.
16 |
17 | When \fB\-\fP is passed to the MIDI Clip file argument,
18 | it's recorded to stdout. It implies \fI\-s\fP option, too.
19 |
20 | .SH OPTIONS
21 |
22 | .TP
23 | .I \-h,\-\-help
24 | Prints a list of options.
25 |
26 | .TP
27 | .I \-V,\-\-version
28 | Prints the current version.
29 |
30 | .TP
31 | .I \-p,\-\-port=client:port,...
32 | Sets the sequencer port(s) from which events are recorded.
33 |
34 | A client can be specified by its number, its name, or a prefix of its
35 | name. A port is specified by its number; for port 0 of a client, the
36 | ":0" part of the port specification can be omitted.
37 |
38 | \fBarecordmidi2\fP creates a UMP Endpoint containing the same number
39 | of Function Blocks as specified by this option, each of which is
40 | connected to the specified port as a source.
41 |
42 | When no source ports are specified with \fI\-p\fP option,
43 | \fBarecordmidi2\fP creates a UMP Endpoint with full 16 Function Blocks
44 | and records from those inputs. User can connect the sequencer ports
45 | freely via \fBaconnect\fP, for example. This mode can be used
46 | together with the interactive mode via \fI\-r\fP option.
47 |
48 | .TP
49 | .I \-b,\-\-bpm=beats
50 | Sets the musical tempo of the MIDI file, in beats per minute.
51 | The default value is 120 BPM.
52 |
53 | .TP
54 | .I \-t,\-\-ticks=ticks
55 | Sets the resolution of timestamps (ticks) in the MIDI file,
56 | in ticks per beat.
57 | The default value is 384 ticks/beat.
58 |
59 | .TP
60 | .I \-i,\-\-timesig=numerator:denominator
61 | Sets the time signature for the MIDI file.
62 |
63 | The time signature is specified as usual with two numbers, representing
64 | the numerator and denominator of the time signature as it would be
65 | notated. The denominator must be a power of two. Both numbers should be
66 | separated by a colon. The time signature is 4:4 by default.
67 |
68 | .TP
69 | .I \-n,\-\-num-events=events
70 | Stops the recording after receiving the given number of events.
71 |
72 | .TP
73 | .I \-u,\-\-ump=version
74 | Sets the UMP MIDI protocol version. Either 1 or 2 has to be given for
75 | MIDI 1.0 and MIDI 2.0 protocol, respectively.
76 | Default is 1.
77 |
78 | .TP
79 | .I \-r,\-\-interactive
80 | Run in the interactive mode. \fBarecordmidi2\fP waits for a RETURN
81 | key input from the terminal to start the recording. After starting,
82 | the recording ends when another RETURN key is input from the
83 | terminal. The received events before the start of recording are
84 | discarded.
85 |
86 | .TP
87 | .I \-s,\-\-silent
88 | Don't print messages to stdout.
89 |
90 | .TP
91 | .I \-P,\-\-profile=file
92 | Read the UMP data from the given file and put them into the
93 | configuration section of the recorded output.
94 | The file must contain only valid UMP data encoded in big-endian.
95 |
96 | .TP
97 | .I \-\-song=text, \-\-clip=text, \-\-copyright=text, \-\-composer=text, \
98 | \-\-lyricist=text, \-\-arranger=text, \-\-publisher=text, \
99 | \-\-performer=text \-\-accompany=text, \-\-date=text, \-\-location=text
100 | Put the given meta data text in the configuration section.
101 |
102 | .SH SEE ALSO
103 | arecordmidi(1)
104 | .br
105 | aplaymidi2(1)
106 |
107 | .SH AUTHOR
108 | Takashi Iwai
109 |
110 |
111 |
--------------------------------------------------------------------------------
/seq/aconnect/aconnect.1:
--------------------------------------------------------------------------------
1 | .TH aconnect 1 "August 31, 2000"
2 | .de EX
3 | .nf
4 | .ft CW
5 | ..
6 | .de EE
7 | .ft R
8 | .fi
9 | ..
10 | .SH NAME
11 | aconnect \- ALSA sequencer connection manager
12 |
13 | .SH SYNOPSIS
14 | .B aconnect
15 | [\-d] [\-options] sender receiver
16 | .br
17 | .B aconnect
18 | \-i|\-o [\-options]
19 | .br
20 | .B aconnect
21 | \-x
22 |
23 | .SH DESCRIPTION
24 | .B aconnect
25 | is a utility to connect and disconnect two existing ports on ALSA sequencer
26 | system.
27 | The ports with the arbitrary subscription permission, such as created
28 | by
29 | .B aseqview(1),
30 | can be connected to any (MIDI) device ports using
31 | .B aconnect.
32 | For example, to connect from port 64:0 to 65:0, run as follows:
33 | .IP "" 4
34 | % aconnect 64:0 65:0
35 | .PP
36 | The connection is one-way, and the whole data to the sender port (64:0)
37 | is redirected to the receiver port (65:0). When another port (e.g. 65:1)
38 | is attached to the same sender port, the data is sent to both receiver
39 | ports.
40 | For disconnection, use
41 | .B \-d
42 | option.
43 | .sp
44 | .EX
45 | % aconnect \-d 64:0 65:0
46 | .EE
47 | .PP
48 | The address can be given using the client's name.
49 | .sp
50 | .EX
51 | % aconnect External:0 Emu8000:1
52 | .EE
53 | .PP
54 | Then the port 0 of the client matching with the string "External" is
55 | connected to the port 1 of the client matching with the "Emu8000".
56 | .PP
57 | Another function of
58 | .B aconnect
59 | is to list the present ports
60 | on the given condition.
61 | The input ports, which may become
62 | .I sender
63 | ports, can be listed with
64 | .B \-i
65 | option.
66 | .sp
67 | .EX
68 | % aconnect \-i
69 | client 0: 'System' [type=kernel]
70 | 0 'Timer '
71 | 1 'Announce '
72 | client 64: 'External MIDI\-0' [type=kernel]
73 | 0 'MIDI 0\-0 '
74 | .EE
75 | .PP
76 | Similarly, to see the output ports, use
77 | .B \-o
78 | flag.
79 | .PP
80 | You can remove all existing exported connections using
81 | .B \-x
82 | option. This function is useful for terminating the ALSA drivers,
83 | because the modules with sequencer connections cannot be unloaded
84 | unless their connections are removed.
85 |
86 | .SH OPTIONS
87 | .SS CONNECTION MANAGEMENT
88 | .TP
89 | .B \-d, \-\-disconnect
90 | Disconnect the given subscription.
91 | .TP
92 | .B \-e, \-\-exclusive
93 | Connect ports with exclusive mode.
94 | Both sender and receiver ports can be no longer connected by any other ports.
95 | .TP
96 | .B \-r, \-\-real queue
97 | Convert time-stamps of event packets to the current value of the given
98 | .I real-time
99 | queue.
100 | This is option is, however, not so useful, since
101 | the receiver port must use (not necessarily own) the specified queue.
102 | .TP
103 | .B \-t, \-\-tick queue
104 | Like
105 | .B \-r
106 | option, but
107 | time-stamps are converted to the current value of the given
108 | .I tick
109 | queue.
110 |
111 | .SS LIST PORTS
112 | .TP
113 | .B \-i, \-\-input
114 | List existing input (readable) ports.
115 | This option is exclusive to
116 | .B \-o.
117 | .TP
118 | .B \-o, \-\-output
119 | List existing output (writable) ports.
120 | This option is exclusive to
121 | .B \-i.
122 | .TP
123 | .B \-a, \-\-all
124 | List inactive ports, too.
125 | .TP
126 | .B \-l, \-\-list
127 | List the current connection status. The connected and connecting ports
128 | from/to each port are listed together.
129 | The suffix flag
130 | .B [ex]
131 | means the connection is exclusive.
132 | The suffix flag
133 | .B [real:#]
134 | and
135 | .B [tick:#]
136 | mean the connection includes real-time and tick conversion on the listed
137 | queue, respectively.
138 |
139 | .SS REMOVE ALL CONNECTIONS
140 | .TP
141 | .B \-x, \-\-removeall
142 | Remove all exported connections.
143 |
144 | .SH "SEE ALSO"
145 | aseqnet(1), aseqview(1)
146 |
147 | .SH AUTHOR
148 | Takashi Iwai
149 |
--------------------------------------------------------------------------------
/axfer/xfer.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | //
3 | // xfer.h - a header for receiver/transmiter of data frames.
4 | //
5 | // Copyright (c) 2018 Takashi Sakamoto
6 | //
7 | // Licensed under the terms of the GNU General Public License, version 2.
8 |
9 | #ifndef __ALSA_UTILS_AXFER_XFER__H_
10 | #define __ALSA_UTILS_AXFER_XFER__H_
11 |
12 | #include "aconfig.h"
13 |
14 | #include "mapper.h"
15 |
16 | #include
17 |
18 | enum xfer_type {
19 | XFER_TYPE_UNSUPPORTED = -1,
20 | XFER_TYPE_LIBASOUND = 0,
21 | #if WITH_FFADO
22 | XFER_TYPE_LIBFFADO,
23 | #endif
24 | XFER_TYPE_COUNT,
25 | };
26 |
27 | struct xfer_ops;
28 |
29 | struct xfer_context {
30 | snd_pcm_stream_t direction;
31 | enum xfer_type type;
32 | const struct xfer_ops *ops;
33 | void *private_data;
34 |
35 | char *sample_format_literal;
36 | char *cntr_format_literal;
37 | unsigned int verbose;
38 | unsigned int duration_seconds;
39 | unsigned int duration_frames;
40 | unsigned int frames_per_second;
41 | unsigned int samples_per_frame;
42 | bool help:1;
43 | bool quiet:1;
44 | bool dump_hw_params:1;
45 | bool multiple_cntrs:1; // For mapper.
46 |
47 | snd_pcm_format_t sample_format;
48 |
49 | // For containers.
50 | char **paths;
51 | unsigned int path_count;
52 | enum container_format cntr_format;
53 | };
54 |
55 | enum xfer_type xfer_type_from_label(const char *label);
56 | const char *xfer_label_from_type(enum xfer_type type);
57 |
58 | int xfer_context_init(struct xfer_context *xfer, enum xfer_type type,
59 | snd_pcm_stream_t direction, int argc, char *const *argv);
60 | void xfer_context_destroy(struct xfer_context *xfer);
61 | int xfer_context_pre_process(struct xfer_context *xfer,
62 | snd_pcm_format_t *format,
63 | unsigned int *samples_per_frame,
64 | unsigned int *frames_per_second,
65 | snd_pcm_access_t *access,
66 | snd_pcm_uframes_t *frames_per_buffer);
67 | int xfer_context_process_frames(struct xfer_context *xfer,
68 | struct mapper_context *mapper,
69 | struct container_context *cntrs,
70 | unsigned int *frame_count);
71 | void xfer_context_pause(struct xfer_context *xfer, bool enable);
72 | void xfer_context_post_process(struct xfer_context *xfer);
73 |
74 | struct xfer_data;
75 | int xfer_options_parse_args(struct xfer_context *xfer,
76 | const struct xfer_data *data, int argc,
77 | char *const *argv);
78 | int xfer_options_fixup_paths(struct xfer_context *xfer);
79 | void xfer_options_calculate_duration(struct xfer_context *xfer,
80 | uint64_t *total_frame_count);
81 |
82 | // For internal use in 'xfer' module.
83 |
84 | struct xfer_ops {
85 | int (*init)(struct xfer_context *xfer, snd_pcm_stream_t direction);
86 | int (*parse_opt)(struct xfer_context *xfer, int key, const char *optarg);
87 | int (*validate_opts)(struct xfer_context *xfer);
88 | int (*pre_process)(struct xfer_context *xfer, snd_pcm_format_t *format,
89 | unsigned int *samples_per_frame,
90 | unsigned int *frames_per_second,
91 | snd_pcm_access_t *access,
92 | snd_pcm_uframes_t *frames_per_buffer);
93 | int (*process_frames)(struct xfer_context *xfer,
94 | unsigned int *frame_count,
95 | struct mapper_context *mapper,
96 | struct container_context *cntrs);
97 | void (*post_process)(struct xfer_context *xfer);
98 | void (*destroy)(struct xfer_context *xfer);
99 | void (*pause)(struct xfer_context *xfer, bool enable);
100 | void (*help)(struct xfer_context *xfer);
101 | };
102 |
103 | struct xfer_data {
104 | const char *s_opts;
105 | const struct option *l_opts;
106 | unsigned int l_opts_count;
107 | struct xfer_ops ops;
108 | unsigned int private_size;
109 | };
110 |
111 | extern const struct xfer_data xfer_libasound;
112 |
113 | #if WITH_FFADO
114 | extern const struct xfer_data xfer_libffado;
115 | #endif
116 |
117 | #endif
118 |
--------------------------------------------------------------------------------
/alsamixer/mixer_clickable.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "mixer_clickable.h"
4 |
5 | extern int screen_cols;
6 | extern int screen_lines;
7 |
8 | static struct clickable_rect *clickable_rects = NULL;
9 | static unsigned int clickable_rects_count = 0;
10 | static unsigned int last_rect = 0;
11 |
12 | /* Using 0 instead of -1 for marking free rectangles allows us to use
13 | * memset for `freeing` all rectangles at once.
14 | * Zero is actually a valid coordinate in ncurses, but since we don't have
15 | * any clickables in the top line this is fine. */
16 | #define FREE_MARKER 0
17 | #define RECT_IS_FREE(RECT) ((RECT).y1 == FREE_MARKER)
18 | #define RECT_FREE(RECT) ((RECT).y1 = FREE_MARKER)
19 |
20 | void clickable_set(int y1, int x1, int y2, int x2, command_enum command, int arg1) {
21 | struct clickable_rect* tmp;
22 | unsigned int i;
23 |
24 | for (i = last_rect; i < clickable_rects_count; ++i) {
25 | if (RECT_IS_FREE(clickable_rects[i])) {
26 | last_rect = i;
27 | goto SET_CLICKABLE_DATA;
28 | }
29 | }
30 |
31 | for (i = 0; i < last_rect; ++i) {
32 | if (RECT_IS_FREE(clickable_rects[i])) {
33 | last_rect = i;
34 | goto SET_CLICKABLE_DATA;
35 | }
36 | }
37 |
38 | last_rect = clickable_rects_count;
39 | tmp = realloc(clickable_rects, (clickable_rects_count + 8) * sizeof(*clickable_rects));
40 | if (!tmp) {
41 | free(clickable_rects);
42 | clickable_rects = NULL;
43 | clickable_rects_count = 0;
44 | last_rect = 0;
45 | return;
46 | }
47 | clickable_rects = tmp;
48 | #if FREE_MARKER == 0
49 | memset(clickable_rects + clickable_rects_count, 0, 8 * sizeof(*clickable_rects));
50 | #else
51 | for (i = clickable_rects_count; i < clickable_rects_count + 8; ++i)
52 | RECT_FREE(clickable_rects[i]);
53 | #endif
54 | clickable_rects_count += 8;
55 |
56 | SET_CLICKABLE_DATA:
57 | clickable_rects[last_rect] = (struct clickable_rect) {
58 | .y1 = y1,
59 | .x1 = x1,
60 | .x2 = x2,
61 | .y2 = y2,
62 | .command = command,
63 | .arg1 = arg1
64 | };
65 | }
66 |
67 | void clickable_set_relative(WINDOW *win, int y1, int x1, int y2, int x2, command_enum command, int arg1) {
68 | int y, x;
69 | getyx(win, y, x);
70 | y1 = y + y1;
71 | x1 = x + x1;
72 | y2 = y + y2;
73 | x2 = x + x2;
74 | clickable_set(y1, x1, y2, x2, command, arg1);
75 | }
76 |
77 | void clickable_clear(int y1, int x1, int y2, int x2) {
78 | #define IS_IN_RECT(Y, X) (Y >= y1 && Y <= y2 && X >= x1 && X <= x2)
79 | unsigned int i;
80 |
81 | if (x1 == 0 && x2 == -1 && y2 == -1) {
82 | if (y1 == 0) {
83 | // Optimize case: clear all
84 | #if FREE_MARKER == 0
85 | if (clickable_rects)
86 | memset(clickable_rects, 0,
87 | clickable_rects_count * sizeof(*clickable_rects));
88 | #else
89 | for (i = 0; i < clickable_rects_count; ++i)
90 | RECT_FREE(clickable_rects[i]);
91 | #endif
92 | }
93 | else {
94 | // Optimize case: clear all lines beyond y1
95 | for (i = 0; i < clickable_rects_count; ++i) {
96 | if (clickable_rects[i].y2 >= y1)
97 | RECT_FREE(clickable_rects[i]);
98 | }
99 | }
100 | return;
101 | }
102 |
103 | if (y2 < 0)
104 | y2 = screen_lines + y2 + 1;
105 | if (x2 < 0)
106 | x2 = screen_cols + x2 + 1;
107 |
108 | for (i = 0; i < clickable_rects_count; ++i) {
109 | if (!RECT_IS_FREE(clickable_rects[i]) && (
110 | IS_IN_RECT(clickable_rects[i].y1, clickable_rects[i].x1) ||
111 | IS_IN_RECT(clickable_rects[i].y2, clickable_rects[i].x2)
112 | ))
113 | {
114 | RECT_FREE(clickable_rects[i]);
115 | }
116 | }
117 | }
118 |
119 | struct clickable_rect* clickable_find(int y, int x) {
120 | unsigned int i;
121 |
122 | for (i = 0; i < clickable_rects_count; ++i) {
123 | if (
124 | !RECT_IS_FREE(clickable_rects[i]) &&
125 | y >= clickable_rects[i].y1 &&
126 | x >= clickable_rects[i].x1 &&
127 | y <= clickable_rects[i].y2 &&
128 | x <= clickable_rects[i].x2
129 | )
130 | {
131 | return &clickable_rects[i];
132 | }
133 | }
134 |
135 | return NULL;
136 | }
137 |
--------------------------------------------------------------------------------
/alsaloop/effect-sweep.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Bandpass filter sweep effect
3 | * Copyright (c) Maarten de Boer
4 | *
5 | * This program is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 2 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program; if not, write to the Free Software
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 | *
19 | */
20 |
21 | #include "aconfig.h"
22 | #include
23 | #include
24 |
25 | struct effect_private {
26 | /* filter the sweep variables */
27 | float lfo,dlfo,fs,fc,BW,C,D,a0,a1,a2,b1,b2,*x[3],*y[3];
28 | float lfo_depth, lfo_center;
29 | unsigned int channels;
30 | };
31 |
32 | static int effect_init(struct lookback *loopback,
33 | void *private_data,
34 | snd_pcm_access_t access,
35 | unsigned int channels,
36 | unsigned int rate,
37 | snd_pcm_format_t format)
38 | {
39 | struct effect_private *priv = private_data;
40 | int i;
41 |
42 | #if __BYTE_ORDER == __LITTLE_ENDIAN
43 | if (format != SND_PCM_FORMAT_S16_LE)
44 | return -EIO;
45 | #elif __BYTE_ORDER == __BIG_ENDIAN
46 | if (format != SND_PCM_FORMAT_S16_BE)
47 | return -EIO;
48 | #else
49 | return -EIO;
50 | #endif
51 | priv->fs = (float) rate;
52 | priv->channels = channels;
53 | for (i = 0; i < 3; i++) {
54 | priv->x[i] = calloc(channels * sizeof(float));
55 | priv->y[i] = calloc(channels * sizeof(float));
56 | }
57 | return 0;
58 | }
59 |
60 | static int effect_done(struct loopback *loopback,
61 | void *private_data)
62 | {
63 | struct effect_private *priv = private_data;
64 | int i;
65 |
66 | for (i = 0; i < 3; i++) {
67 | free(priv->x[i]);
68 | free(priv->y[i]);
69 | }
70 | return 0;
71 | }
72 |
73 | static int effect_apply(struct loopback *loopback,
74 | void *private_data,
75 | const snd_pcm_channel_area_t *areas,
76 | snd_uframes_t offset,
77 | snd_uframes_t frames)
78 | {
79 | struct effect_private *priv = private_data;
80 | short *samples = (short*)areas[0].addr + offset*priv->channels;
81 | snd_uframes_t i;
82 |
83 | for (i=0; i < frames; i++) {
84 | int chn;
85 |
86 | fc = sin(priv->lfo)*priv->lfo_depth+priv->lfo_center;
87 | priv->lfo += priv->dlfo;
88 | if (priv->lfo>2.*M_PI) priv->lfo -= 2.*M_PI;
89 | priv->C = 1./tan(M_PI*priv->BW/priv->fs);
90 | priv->D = 2.*cos(2*M_PI*fc/fs);
91 | priv->a0 = 1./(1.+priv->C);
92 | priv->a1 = 0;
93 | priv->a2 = -priv->a0;
94 | priv->b1 = -priv->C*priv->D*a0;
95 | priv->b2 = (priv->C-1)*priv->a0;
96 |
97 | for (chn=0; chn < priv->channels; chn++)
98 | {
99 | priv->x[chn][2] = priv->x[chn][1];
100 | priv->x[chn][1] = priv->x[chn][0];
101 |
102 | priv->y[chn][2] = priv->y[chn][1];
103 | priv->y[chn][1] = priv->y[chn][0];
104 |
105 | priv->x[chn][0] = samples[i*channels+chn];
106 | priv->y[chn][0] = priv->a0*priv->x[0][chn]
107 | + priv->a1*priv->x[1][chn] + priv->a2*x[2][chn]
108 | - priv->b1*priv->y[1][chn] - priv->b2*y[2][chn];
109 | samples[i*channels+chn] = priv->y[chn][0];
110 | }
111 | }
112 | return 0;
113 | }
114 |
115 | void effect_init_sweep(void)
116 | {
117 | struct effect_private *priv;
118 |
119 | priv = register_effect(effect_init,
120 | effect_apply,
121 | effect_done,
122 | sizeof(struct effectprivate));
123 | if (priv) {
124 | priv->lfo_center = 2000.;
125 | priv->lfo_depth = 1800.;
126 | priv->lfo_freq = 0.2;
127 | priv->BW = 50;
128 | }
129 | }
130 |
--------------------------------------------------------------------------------