GithubHelp home page GithubHelp logo

tinyalsa / tinyalsa Goto Github PK

View Code? Open in Web Editor NEW
586.0 586.0 301.0 807 KB

Tiny library to interface with ALSA in the Linux kernel

License: Other

C 76.07% Makefile 1.48% Roff 2.05% CMake 0.90% Meson 0.54% Shell 1.84% Starlark 0.69% C++ 16.44%
alsa c linux-kernel tinyalsa

tinyalsa's Introduction

TinyALSA

Build Status

TinyALSA is a small library to interface with ALSA in the Linux kernel.

The aims are:

  • Provide a basic pcm and mixer API.
  • If it's not absolutely needed, don't add it to the API.
  • Avoid supporting complex and unnecessary operations, that could be dealt with at a higher level.
  • Provide comprehensive documentation.

Building

TinyALSA supports these build systems:

To build and install with Make, run the commands:

make
sudo make install
sudo ldconfig

Installing

TinyALSA is now available as a set of the following Debian packages from launchpad:

Package Name: Description:
tinyalsa Contains tinyplay, tinycap, tinymix and tinypcminfo
libtinyalsa Contains the shared library
libtinyalsa-dev Contains the static library and header files

To install these packages, run the commands:

sudo apt-add-repository ppa:taylorcholberton/tinyalsa
sudo apt-get update
sudo apt-get install tinyalsa
sudo apt-get install libtinyalsa-dev

Documentation

Once installed, the man pages are available via:

man tinyplay
man tinycap
man tinymix
man tinypcminfo
man libtinyalsa-pcm
man libtinyalsa-mixer

Test

To test libtinyalsa, please follow the instructions,

Setup Bazel build environment

Visit here to get more info to setup Bazel environment.

Insert loopback devices

The test program does pcm_* operations on loopback devices. You have to insert loopback devices after your system boots up.

sudo modprobe snd-aloop
sudo chmod 777 /dev/snd/*

Run test program

bazel test //:tinyalsa_tests --test_output=all

The default playback device is hw:2,0 and the default capture device is hw:2,1. If your loopback devices are not hw:2,0 and hw:2,1, you can specify the loopback device.

bazel test //:tinyalsa_tests --test_output=all \
    --copt=-DTEST_LOOPBACK_CARD=[loopback card] \
    --copt=-DTEST_LOOPBACK_PLAYBACK_DEVICE=[loopback playback device] \
    --copt=-DTEST_LOOPBACK_CAPTURE_DEVICE=[loopback capture device]

Generate coverage report

bazel coverage //:tinyalsa_tests --combined_report=lcov --test_output=all
genhtml bazel-out/_coverage/_coverage_report.dat -o tinyalsa_tests_coverage

tinyalsa's People

Contributors

afordcirrus avatar aonea-harman avatar bpankajl avatar broonie avatar charleskeepax avatar dawagner avatar dvdli avatar e5ten avatar gajare-codeaurora avatar gkasten avatar jaydeepdhole avatar johngro avatar lkundrak avatar lrg-ti avatar lucastanure avatar maximeh avatar mgaio avatar michaelforney avatar mikopp6 avatar mkupchik avatar plbossart avatar psqli avatar quic-huicliu avatar quic-rohit avatar rohkkumar avatar simonrules avatar stephan-gh avatar tay10r avatar toge avatar tp-m avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tinyalsa's Issues

Tinyalsa open failed when a abnormal close

There is something wrong with TINYALSA based program. We can not shut down TINYALSA on ours initiative in both case ,first ,stop the program using the task manager,second,exit the program without a response.therefore ,after restart the program,we failed to open PCM succesfully.We wonder if there are some problems with OCCI.Do you have any suggestions about this problems?

Easier Version Specification

Currently, the version is specified in:

  • src/Makefile
  • debian/changelog
  • include/tinyalsa/version.h

When a new release is made, the risk is present of one of these files not getting updated. There should be an easier way of ensuring that all the versions get updated correctly. Perhaps a script to search and replace the version numbers in the specified files.

For example a script, scripts/bump-version.sh or scripts/bump-version.py that can be used to specify the version in these files.

./scripts/bump-version.sh minor
# or ./scripts/bump-version.sh major
# or ./scripts/bump-version.sh patch

The header file can be used to parse the current version.

Bug in mixer_ctl_set_value

Hi, there is a bug in "mixer_ctl_set_value". I discovered it when I tryed to set with "tinymix" a value to 0 = off. But the value was always 1 = On.

.. code ..
if (value > mixer_ctl_get_range_max(ctl))
value = mixer_ctl_get_range_max(ctl);
..code..

If "mixer_ctl_get_range_max" returns -22 (EINVAL) then the code set the "value" to "-22".
So, when there is a "boolean" control type, it will allways be "On" and there isn't any error messages.

I think that the code must be something like this:

.. code ..
if (value > mixer_ctl_get_range_max(ctl) && mixer_ctl_get_range_max(ctl)>0)
value = mixer_ctl_get_range_max(ctl);
..code..

Best regards

How to capture playback sound use tinyalsa?

I want capture playback sound on ubuntu and android.
I call pcm_open() and pcm_readi() and I try:
mixer_get_ctl_by_name(mixer, "Loopback Mixing");
mixer_ctl_set_enum_by_string(ctl, "Enabled");

But, allways record wav from MIC, not from playing sound.
How to do I can?
Thank you very much.

-------------- My sound card Device Info: ------------------------

yangyuqi@yangyuqi-T450:~/sound$ tinymix -D 1 contents
Number of controls: 30
ctl	type	num	name                                    value
0	INT	2	Speaker Playback Volume                 0, 0 (range 0->87)
1	BOOL	2	Speaker Playback Switch                 Off, Off
2	INT	2	Headphone Playback Volume               87, 87 (range 0->87)
3	BOOL	2	Headphone Playback Switch               On, On
4	BOOL	2	Headphone Playback Switch               On, On
5	ENUM	1	Loopback Mixing                         Disabled, > Enabled, 
6	INT	2	Dock Mic Playback Volume                0, 0 (range 0->31)
7	BOOL	2	Dock Mic Playback Switch                Off, Off
8	INT	2	Mic Playback Volume                     0, 0 (range 0->31)
9	BOOL	2	Mic Playback Switch                     Off, Off
10	ENUM	1	Auto-Mute Mode                          Disabled, > Enabled, 
11	INT	2	Capture Volume                          37, 37 (range 0->63)
12	BOOL	2	Capture Switch                          On, On
13	INT	2	Dock Mic Boost Volume                   0, 0 (range 0->3)
14	INT	2	Mic Boost Volume                        0, 0 (range 0->3)
15	INT	2	Internal Mic Boost Volume               0, 0 (range 0->1)
16	INT	2	Beep Playback Volume                    0, 0 (range 0->31)
17	BOOL	2	Beep Playback Switch                    Off, Off
18	ENUM	1	Mic Mute-LED Mode                       On, Off, Follow Capture, > Follow Mute, 
19	INT	1	Master Playback Volume                  66 (range 0->87)
20	BOOL	1	Master Playback Switch                  On
21	BOOL	1	Dock Mic Jack                           Off
22	BOOL	1	Mic Jack                                Off
23	BOOL	1	Internal Mic Phantom Jack               On
24	BOOL	1	Speaker Phantom Jack                    On
25	BOOL	1	Dock Headphone Jack                     Off
26	BOOL	1	Headphone Jack                          On
27	INT	4	Playback Channel Map                    3, 4, 0, 0 (range 0->36)
28	INT	2	Capture Channel Map                     0, 0 (range 0->36)
29	INT	2	PCM Playback Volume                     255, 255 (range 0->255)
yangyuqi@yangyuqi-T450:~/sound$ 

tinyalsa hangs opening sound device at Ubuntu 18.10

Ubuntu 18.10. aplay (and all ALSA applications) works o'k.

But any tinyalsa application (including tinyplay) hangs at opening sound device.

Here is strace log:

$ strace tinyplay poehali.wav 
execve("/usr/bin/tinyplay", ["tinyplay", "poehali.wav"], 0x7ffe300e0578 /* 76 vars */) = 0
brk(NULL)                               = 0x560e66d0c000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=204048, ...}) = 0
mmap(NULL, 204048, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe4add1f000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260A\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1996592, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe4add1d000
mmap(NULL, 2004992, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe4adb33000
mprotect(0x7fe4adb55000, 1826816, PROT_NONE) = 0
mmap(0x7fe4adb55000, 1511424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7fe4adb55000
mmap(0x7fe4adcc6000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x193000) = 0x7fe4adcc6000
mmap(0x7fe4add13000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1df000) = 0x7fe4add13000
mmap(0x7fe4add19000, 14336, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe4add19000
close(3)                                = 0
arch_prctl(ARCH_SET_FS, 0x7fe4add1e540) = 0
mprotect(0x7fe4add13000, 16384, PROT_READ) = 0
mprotect(0x560e64d77000, 4096, PROT_READ) = 0
mprotect(0x7fe4add7a000, 4096, PROT_READ) = 0
munmap(0x7fe4add1f000, 204048)          = 0
brk(NULL)                               = 0x560e66d0c000
brk(0x560e66d2d000)                     = 0x560e66d2d000
openat(AT_FDCWD, "poehali.wav", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0664, st_size=172860, ...}) = 0
read(3, "RIFF4\243\2\0WAVEfmt \20\0\0\0\1\0\2\0\"V\0\0\210X\1\0"..., 4096) = 4096
openat(AT_FDCWD, "/dev/snd/pcmC0D0p", O_RDWR

I tried to build fresh tinyalsa from source with make; sudo make install and also to rebuild debian package from Launchpad (unfortunately there is no package for Ubuntu 18.10 on Launchpad). The result is the same.

tinyplay can't play 24 bits WAV files

Hi, when you try to play a 24 bits WAV file with tinyplay, it shows an error that says:
Bitrate is 24 bits, device only supports >= 32 bits

Tracing this problem, I found this happens in:
check_param(params, PCM_PARAM_SAMPLE_BITS, bits, "Bitrate", " bits");

So, I traced the problem in my Linux kernel, and I think I've found the problem. It seems that 24 bit samples are 32 bits physically. You can see this in:
http://lxr.free-electrons.com/source/sound/core/pcm_misc.c#L67

And you can see that is the physical sample bits value, the one that is used in "snd_pcm_hw_rule_sample_bits" function:
http://lxr.free-electrons.com/source/sound/core/pcm_native.c#L1959

This causes that when you call to the SNDRV_PCM_IOCTL_HW_REFINE is 32 the value that is read and not 24.

I think that the easiest workaround to this is to hack the "check_param" function, but this is something that you must decide.

Best regards

tinyplay error fail to open pcm device

When I porting tinyalsa(version 1.1.1) to openwrt(using uclibc for libc),run tinyplay,it occurred that:

root@Widora:/mnt# tinyplay -D 0 -d 0 10.wav 
[  471.980000] playback free_dma_buffer
[  471.990000] ptri2s_config->mmap_index:0
failed to open for pcm 0,0

run tinycap,it go wrong:fail to open PCM device too.

root@Widora:/mnt# tinycap 11.wav 
[  673.780000] capture free_dma_buffer
[  673.780000] ptri2s_config->mmap_index:0
Unable to open PCM device (cannot set hw params: Unknown error -22)
Captured 0 frames

It seems that there is an error while calling 'ioctl' function to set hw_params.
But It's no problem to play wav format music with 'aplay',and play format mp3 music with 'madplay '
My sound card listed below.

root@Widora:/mnt# ls /dev/snd/
controlC0  pcmC0D0c   pcmC0D0p   timer
root@Widora:/mnt# cat /proc/asound/devices 
  0: [ 0]   : control
 16: [ 0- 0]: digital audio playback
 24: [ 0- 0]: digital audio capture
 33:        : time

I can't find any problem with it.Do you have any ideas?Thanks.

root@Widora:/mnt# tinymix -D 0
no command specified (see --help)
root@Widora:/mnt# tinymix contents
Number of controls: 54
ctl     type    num     name                                    value
0       INT     2       Capture Volume                          43, 43 (range 0->63)
1       INT     2       Capture Volume ZC Switch                0, 0 (range 0->1)
2       BOOL    2       Capture Switch                          Off, Off
3       INT     1       Right Input Boost Mixer RINPUT3 Volume  0 (range 0->7)
4       INT     1       Right Input Boost Mixer RINPUT2 Volume  0 (range 0->7)
5       INT     1       Left Input Boost Mixer LINPUT3 Volume   0 (range 0->7)
6       INT     1       Left Input Boost Mixer LINPUT2 Volume   0 (range 0->7)
7       INT     2       Playback Volume                         255, 255 (range 0->255)
8       INT     2       Headphone Playback Volume               127, 127 (range 0->127)
9       BOOL    2       Headphone Playback ZC Switch            On, On
10      INT     2       Speaker Playback Volume                 123, 123 (range 0->127)
11      BOOL    2       Speaker Playback ZC Switch              Off, Off
12      INT     1       Speaker DC Volume                       0 (range 0->5)
13      INT     1       Speaker AC Volume                       0 (range 0->5)
14      BOOL    1       PCM Playback -6dB Switch                Off
15      ENUM    1       ADC Polarity                            > No Inversion, Left Inverted, Right Inverted, Stereo Inversion, 
16      BOOL    1       ADC High Pass Filter Switch             Off
17      ENUM    1       DAC Polarity                            > No Inversion, Left Inverted, Right Inverted, Stereo Inversion, 
18      BOOL    1       DAC Deemphasis Switch                   Off
19      ENUM    1       3D Filter Upper Cut-Off                 0 (range 0->7)
20      ENUM    1       3D Filter Lower Cut-Off                 0 (range 0->7)
21      INT     1       3D Volume                               0 (range 0->7)
22      BOOL    1       3D Switch                               0 (range 0->7)
23      ENUM    1       ALC Function                            > Off, Right, Left, Stereo, 
24      INT     1       ALC Max Gain                            7 (range 0->7)
25      INT     1       ALC Target                              4 (range 0->15)
26      INT     1       ALC Min Gain                            0 (range 0->7)
27      INT     1       ALC Hold Time                           0 (range 0->15)
28      ENUM    1       ALC Mode                                > ALC, Limiter, 
29      INT     1       ALC Decay                               3 (range 0->15)
30      INT     1       ALC Attack                              2 (range 0->15)
31      INT     1       Noise Gate Threshold                    0 (range 0->31)
32      BOOL    1       Noise Gate Switch                       Off
33      INT     2       ADC PCM Capture Volume                  195, 195 (range 0->255)
34      INT     1       Left Output Mixer Boost Bypass Volume   2 (range 0->7)
35      INT     1       Left Output Mixer LINPUT3 Volume        2 (range 0->7)
36      INT     1       Right Output Mixer Boost Bypass Volume  2 (range 0->7)
37      INT     1       Right Output Mixer RINPUT3 Volume       2 (range 0->7)
38      BOOL    1       Mono Output Mixer Left Switch           Off
39      BOOL    1       Mono Output Mixer Right Switch          Off
40      BOOL    1       Right Output Mixer PCM Playback Switch  Off
41      BOOL    1       Right Output Mixer RINPUT3 Switch       Off
42      BOOL    1       Right Output Mixer Boost Bypass Switch  Off
43      BOOL    1       Left Output Mixer PCM Playback Switch   Off
44      BOOL    1       Left Output Mixer LINPUT3 Switch        Off
45      BOOL    1       Left Output Mixer Boost Bypass Switch   Off
46      BOOL    1       Right Input Mixer Boost Switch          Off
47      BOOL    1       Left Input Mixer Boost Switch           Off
48      BOOL    1       Right Boost Mixer RINPUT2 Switch        Off
49      BOOL    1       Right Boost Mixer RINPUT3 Switch        Off
50      BOOL    1       Right Boost Mixer RINPUT1 Switch        On
51      BOOL    1       Left Boost Mixer LINPUT2 Switch         Off
52      BOOL    1       Left Boost Mixer LINPUT3 Switch         Off
53      BOOL    1       Left Boost Mixer LINPUT1 Switch         On
root@Widora:/mnt# 

Bug in tinymix util

For TLV mixer controls, tinymix adds TLV_HEADER_SIZE to the num_values and sets 0th and 1st element of tlv to
tlv[0] = 0;
tlv[1] = num_values;
before calling mixer_ctl_set_array().
https://github.com/tinyalsa/tinyalsa/blob/master/utils/tinymix.c#L281

However, mixer_ctl_set_array() also does the same thing
https://github.com/tinyalsa/tinyalsa/blob/master/src/mixer.c#L1088

This causes TLV header to be added twice. I already have a fix but wanted to confirm if I am missing something here.

Release with cmake support

Hi guys,

I'm looking into creating a conan recipe for tinyalsa. This would we way easier if it is built with CMake. Do you guys have an ETA for a release with cmake support?

Thanks!

Adding an audio sample for examples

As is the pcm-readi.c example just seg faults since there isn't anything to read in. I understand the idea of just showing the example, but thoughts of me adding a small demo wav file so it's working right off the back.

Also there are a few sample audio tracks in /usr/share/sounds/alsa already

Android 5.0 and later only support position-independent executables(-fPIE)

i have genrated exutables using tinyalsa release 1.1.1 with command ndk-build inside jni folder.
I have copied tinymix in /data/local/tmp, also set chmod 777 to tinymix file.

After running tinymix command on device i got following errror:

"/data/local/tmp/tinymix": error: Android 5.0 and later only support position-independent executables (-fPIE).

More PCM Formats

Currently, the PCM formats that are supported are mostly the signed integer ones.

The rest of the PCM formats from sound/asound.h should be supported.

See the definitions here.

mixer: int_to_percent() doesn't work

Hi there,
here is a snippet what that function do:

#include <stdio.h>

int
main(void)
{
    int n, i = 1;

    n = ((i - 0) / 31) * 100;

    printf("%d\n", n);
    return 0;
}

it will print 0 (should be 3).
To fix it you can simply cast i to double, float:
n = (((double)i - 0) / 31) * 100;

or change to something like this:
n = (i - 0) * 100 / 31;

Issue "ioctl err" with Debian.

I test tinyalsa playing with Debian distribution.
My test command is ./tinyplay -d 0 friend.wav.
And ls /dev/snd list files:

➜ utils git:(master) ✗ ls /dev/snd
by-path controlC0 midiC0D0 pcmC0D0c pcmC0D0p pcmC0D1p seq timer

But I got an error with call pcm->ops->ioctl(pcm->data, SNDRV_PCM_IOCTL_HW_PARAMS, &params) in pcm_set_config, and got errno 22.

I print config variable in ctx_init before pcm_open:

printf("config channel:%d rate:%d perod:%dx%d formate:%d start:%d stop:%d silence:%d\n",
       config.channels, config.rate, config.period_size, config.period_count,
       config.format, config.start_threshold, config.stop_threshold, config.silence_threshold);

Log:
config channel:1 rate:16000 perod:1024x2 formate:0 start:1024 stop:2048 silence:2048

pcm_read blocking

Hi,tay10r
My program have a A few seconds blocking (Read buf time is 20ms) when "pcm_read" first called. And subsequent call run normally.
what might be the cause of this BUG?

TLV_HEADER_SIZE is added to num_values in tinymix.c

TLV_HEADER_SIZE is defined as 2 * sizeof(unsigned int), but in tinymix.c it is added to num_values, which is not a number of bytes.

In addition, TLV_HEADER_SIZE should be based on the actual tlv header size and not hard-coded as it is now.

tinyplay error unable to open pcm device

Hi, I am getting this error open("/dev/snd/pcmC0D0p", O_RDONLY) = -1 EINVAL (Invalid argument)
while using tinyplay on android device samsung galaxy s4 mini, sound card is msm8230-tapan-snd-card.
I am passing input file by matching its configuration with sound card file proc/asound/card0/pcm0p/sub0/hwparam
please tell me reason for this error

useage for tinymix?

#tinymix
Mixer name: 'sdm660-snd-card-mtp'
Number of controls: 2288
ctl type num name value
0 INT 3 Voice Rx Device Mute -1 -1 -1
3 INT 3 Voice Rx Gain -1 -1 -1
4 ENUM 1 TTY Mode OFF
5 INT 2 Slowtalk Enable -1 -1
9 BOOL 1 Voice Sidetone Enable Off
12 INT 1 Voip Mode Config 12

how to reset the value of “Voice Rx Gain”?
input "tinymix ”Voice Sidetone Enable” 1 ",it works.
but input "tinymix “Voice Rx Gain” 0 0 0",
I only got this error message:
"Error: only enum types can be set with strings."
so how to reset this value?By modifying the xml files in /system/etc?
If there is an usage , it would be nice for some newbee like me. thanks.

tinycap: Use buffer size in bytes instead of frames

Hi,
i'm looking at tinycap.c.
When you calculate the buffer size you get it in frames with pcm_get_buffer_size(pcm);, but then this size is used to call pcm_read() that needs bytes.
I was wondering if it is what you really want to do or if you should convert buffer size to bytes with pcm_frames_to_bytes(pcm, pcm_get_buffer_size(pcm)); as in tinyplay.c.

Thanks,
Francesco

Clarification regarding Usage on Android

Hi Taylor,

sorry for asking some very basic questions regarding tinyalsa. I'm not having real issues with the software, just need to know the applicability of it on Android:

Is it possible to use tinyalsa for capturing any audio on Android devices? A typical use case would be an audio visualizer. What would be the prerequsites? Is rooting the device necessary?

Very kind regards,
Hans-J.

how to install?

hello,
there is no discription how to install from a Raspi!
sudo apt-get...?
git clone...?
make...?
make install...?

tinymix shouldn't always print the paths

I work on platforms based on the Qualcomm SnapDragon chip. There can be hundreds of paths on the audio side of this chip.

There was a recent change whereby tinymix will ALWAYS prints the routes/paths for the different ports on ALSA. I consider this to be a regression. It really should only be printed if asked.

In addition, I've modified tinymix to more closely conform to the following:
https://www.gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html

Lastly, I removed a redundant errno.h..

support for multiple cards

Looks like dev nodes are hardcoded to pcmC0D0... is there any consideration to support multiple cards? USB audio devices come to mind as an example because I have had to support them in the past using the generic USB Audio driver.

tinymix: set volume with percentages and increments

Would it be possible to add functionality to do things like:
tinymix set <volume control> 50%
and
tinymix set <volume control> 5+
and combinations of the two? that way instead of having to know the range for the volume to do things like binding volume keys to increase or decrease volume by e.g. 5%, one could just bind them to something like:
tinymix set <volume control> 5%+ or the same with 5%-.

pcm_get_latency not implemented

service in available at API level(asoundlib.h) is not supported.

Should be something like that

unsigned int pcm_get_latency(struct pcm pcm)
{
unsigned int ret;
signed long *latency;
if(!pcm)
return -1;
if(ioctl(
(int *)pcm, SNDRV_PCM_IOCTL_DELAY, latency)) {
return -1;
}
else
return ((unsigned int) latency);
}
}

Bug:tinyplay.c

In cmd_parse_arg of tinyplay.c

where

else if ((strcmp(argv[0], "-p") == 0) || (strcmp(argv[0], "--period-count") == 0)) {

should be

else if ((strcmp(argv[0], "-n") == 0) || (strcmp(argv[0], "--period-count") == 0)) {

"-p" is repeat to --peroid-size.

Question about license.

Hello.
I have question about tinyalsa.
Actually tinyalsa using BSD license, but it use some structurs and constant values in ALSA.
I checked ALSA's license but it is LGPL.
As I know even if anything uses constant value in spechfic file which is under the GPL, it can not apply BSD.
If I fork tinyalsa and modify something to do not use ALSA, can I keep BSD license??
Could you please let me know it?
Thank you so much.

How to cross-compile properly?

Hello, I want to cross-compile tinyalsa to an arm target, however compilation of anything but the library itself fails in my system due to implicit Makefile rules like these:

tinyplay: tinyplay.o libtinyalsa.a -ldl

On my system at least, make resolves the -ldl to my native architecture and I'll get something like:

my-cross-gcc -L ../src -pie  tinyplay.o ../src/libtinyalsa.a /usr/lib/x86_64-linux-gnu/libdl.so -o tinyplay
/usr/lib/x86_64-linux-gnu/libdl.so: file not recognized: file format not recognized

I don't understand what is the point of a CROSS_COMPILE variable in the Makefile if utils, examples, etc can't be built properly by setting it?

The build can be easily fixed by having an explicit rule, for instance, in the utils subfolder:

tinyplay: tinyplay.o libtinyalsa.a
	$(CC) -o $@ $^ -ldl

Is there a clear reason for not doing this? If not, I'd be glad to submit a pull request which fixes these.

Removal of the Config Structure

I would like to know if the pcm_config structure could be replaced with the standard hw_params and sw_params structures, like how the original asound library is written.

Or perhaps leave the pcm_config object, but as something like this:

struct pcm_config {
    struct snd_pcm_hw_params * hw_params;
    struct snd_pcm_sw_params * sw_params;
};

This would make more sense to me, and I would be willing to write the code and submit the pull request.

Proposal for extending tinyalsa to support plugins

Current tinyalsa supports only interfacing directly with the ALSA kernel interface. Proposal is to add support for tinyalsa plugins for below reasons:
• Allow custom implementation of PCM and mixer modules in userspace
• Plugins can perform data processing (ex: noise suppression, etc)
• Plugins can enable software enhancements (ex: channel mixer, rate convertors, etc)
• Can extend hardware capabilities (ex: DSP not having enough MIPS, etc)

To add this support, we have come up with the below design goals to make sure the impact is minimal and the changes are helpful to the community of tinyalsa users.
• Extend tinyalsa functionality at run time to support plugins
• No change in any of the APIs exposed by tinyalsa
• Re-use all existing tinyalsa functionality for plugins
• Do not allow duplication of similar logic
• Plugins to adhere to same ALSA kernel interface (from uapi/asound.h file)

The high level design to achieve this is as described below, request you to please let us know if you have any other options in mind that can better the design, we are open to changes that will benefit the community
• Concept of virtual PCM nodes and mixer nodes
• Virtual nodes defined in config file
• At [pcm|mixer]_open call, resolve the node to be either kernel node (present under /dev/snd/*) or as a virtual node (defined in the config file).
• Based on resolution at open assign function pointers for all functions at kernel interface level (ex: read/write/ioctl, etc).
• For kernel node, all function pointers implemented under new file pcm_hw.c and all of them call into the kernel interface
• For virtual node, all function pointers implemented under new file pcm_plugin.c, which interfaces with the plugin.
• Plugin itself is a .so library, dynamically dlopen’ed by the pcm_plugin.c at open, and expected to register its ops to the framework (ex ops: open/read/write/hw_params, prepare, etc)

Voice Tx Mute :- input format fail

Hi Team,

i was trying to call voice tx mute using tinymix command but its failing.

there is problem for input , check below

nora_8917:/ $ su -c tinymix 2 1,1,1
Error: invalid value
22|nora_8917:/ $ su -c tinymix 2 0.1,1.1,2.1
Error: invalid value
22|nora_8917:/ $ su -c tinymix 2 0:1
Error: invalid value
22|nora_8917:/ $ su -c tinymix 2 [1,1,1]
Error: only enum types can be set with strings
22|nora_8917:/ $ su -c tinymix 2 ['1','1','2']
Error: only enum types can be set with strings
22|nora_8917:/ $ su -c tinymix 2 ["1"]
Error: only enum types can be set with strings
22|nora_8917:/ $ su -c tinymix 2 {1,1,1}
Error: invalid value for index 0
22|nora_8917:/ $ su -c tinymix 2 {0.1,1,1}
Error: invalid value for index 0
22|nora_8917:/ $ su -c tinymix 2 {'1',1,1}
Error: invalid value for index 0
22|nora_8917:/ $ su -c tinymix 2 {"1"}
Error: only enum types can be set with strings
nora_8917:/ $ su -c tinymix 2 [0,0,0]
Error: only enum types can be set with strings
22|nora_8917:/ $ su -c tinymix 2 {0,0,0}
Error: invalid value for index 0
22|nora_8917:/ $ su -c tinymix 2 {'0','0','0'}
Error: invalid value for index 0

New tag/release?

The last tag/release is from 3 years ago, there were many fixes and new features since then. Are there any plans to make a tag a new release? This would make packaging more easy in other distributions.

Thanks!

tinypcminfo freezes

When I run tinypcminfo built from the latest git master (34ffa58) it hangs after PCM out:.

$ ./tinypcminfo 
Info for card 0, device 0:

PCM out:

Reading symbols from ./tinypcminfo...done.
(gdb) run
Starting program: /media/gittings/tinyalsa/utils/tinypcminfo 
Info for card 0, device 0:

PCM out:
^C
Program received signal SIGINT, Interrupt.
0x00007fee339ea210 in __open_nocancel () from /lib64/libc.so.6
(gdb) bt
#0  0x00007fee339ea210 in __open_nocancel () from /lib64/libc.so.6
#1  0x00000000004028e5 in pcm_params_get (card=0, device=0, flags=0) at pcm.c:821
#2  0x0000000000400e8d in main (argc=1, argv=0x7fffffffe230) at tinypcminfo.c:138
(gdb) bt full
#0  0x00007fee339ea210 in __open_nocancel () from /lib64/libc.so.6
No symbol table info available.
#1  0x00000000004028e5 in pcm_params_get (card=0, device=0, flags=0) at pcm.c:821
        params = 0x0
        fn = "/dev/snd/pcmC0D0p\000@\000\000\000\000\000 \342\377\377\377\177", '\000' <repeats 18 times>, "@\341\377\377\377\177\000\000\311L\224\063\356\177\000\000\000\000\000\000\000\000\000\000\020\000\000\000\060\000\000\000\360\340\377\377\377\177\000\000\060\340\377\377\377\177\000\000\000\000\000\000\000\000\000\000X;@", '\000' <repeats 14 times>, "\004", '\000' <repeats 22 times>, "\200\340\377\377\377\177\000\000\000\000\000\000\000\000\000\000\360\366\355\063\356\177\000\000窧3\356\177", '\000' <repeats 34 times>...
        fd = 32750
#2  0x0000000000400e8d in main (argc=1, argv=0x7fffffffe230) at tinypcminfo.c:138
        params = 0x403900 <__libc_csu_init>
        m = 0x0
        min = 32767
        max = 4294959672
        device = 0
        card = 0
        i = 0
(gdb) t a a f

Thread 1 (process 7514):
#2  0x0000000000400e8d in main (argc=1, argv=0x7fffffffe230) at tinypcminfo.c:138
138	        params = pcm_params_get(card, device, i == 0 ? PCM_OUT : PCM_IN);

Recently the program RetroArch allowed the use of a tinyalsa driver and similarly it will freeze when started using tinyalsa. It seems to be connected to the working on board audio device provided my by motherboard.

$ cat /sys/devices/virtual/dmi/id/board_{vendor,name}
Gigabyte Technology Co., Ltd.
990FXA-UD5 R5
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC1150 Analog [ALC1150 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC1150 Digital [ALC1150 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=SB
    HDA ATI SB, ALC1150 Analog
    Default Audio Device
sysdefault:CARD=SB
    HDA ATI SB, ALC1150 Analog
    Default Audio Device
front:CARD=SB,DEV=0
    HDA ATI SB, ALC1150 Analog
    Front speakers
surround21:CARD=SB,DEV=0
    HDA ATI SB, ALC1150 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=SB,DEV=0
    HDA ATI SB, ALC1150 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=SB,DEV=0
    HDA ATI SB, ALC1150 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=SB,DEV=0
    HDA ATI SB, ALC1150 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=SB,DEV=0
    HDA ATI SB, ALC1150 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=SB,DEV=0
    HDA ATI SB, ALC1150 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=SB,DEV=0
    HDA ATI SB, ALC1150 Digital
    IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=NVidia,DEV=0
    HDA NVidia, HDMI 0
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=1
    HDA NVidia, HDMI 1
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=2
    HDA NVidia, HDMI 2
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=3
    HDA NVidia, HDMI 3
    HDMI Audio Output
$ ls -l /dev/snd
total 0
drwxr-xr-x 2 root root       80 Jul 28 22:28 by-path
crw-rw---- 1 root audio 116,  2 Jul 28 22:28 controlC0
crw-rw---- 1 root audio 116,  8 Jul 28 22:28 controlC1
crw-rw---- 1 root audio 116,  7 Jul 28 22:28 hwC0D0
crw-rw---- 1 root audio 116, 13 Jul 28 22:28 hwC1D0
crw-rw---- 1 root audio 116,  4 Jul 28 22:28 pcmC0D0c
crw-rw---- 1 root audio 116,  3 Jul 28 22:33 pcmC0D0p
crw-rw---- 1 root audio 116,  5 Jul 28 22:28 pcmC0D1p
crw-rw---- 1 root audio 116,  6 Jul 28 22:28 pcmC0D2c
crw-rw---- 1 root audio 116,  9 Jul 28 22:30 pcmC1D3p
crw-rw---- 1 root audio 116, 10 Jul 28 22:28 pcmC1D7p
crw-rw---- 1 root audio 116, 11 Jul 28 22:28 pcmC1D8p
crw-rw---- 1 root audio 116, 12 Jul 28 22:28 pcmC1D9p
crw-rw---- 1 root audio 116,  1 Jul 28 22:28 seq
crw-rw---- 1 root audio 116, 33 Jul 28 22:28 timer

OS: Slackware64-current
Compiler: gcc-7.1.0

Incorrect error handling in pcm_sync_ptr

Errors in pcm_sync_ptr() arn't correctly handled.

Fix:

diff --git a/pcm.c b/pcm.c
index 5cdb231..c3bc8b0 100644
--- a/pcm.c
+++ b/pcm.c
@@ -224,8 +224,9 @@ static int pcm_sync_ptr(struct pcm *pcm, int flags) {
         pcm->sync_ptr->flags = flags;
         if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_SYNC_PTR, pcm->sync_ptr) < 0)
             return -1;
+        return 0;
     }
-    return 0;
+    return -1;
 }

unsigned int pcm_get_latency(struct pcm *pcm)
@@ -723,11 +724,15 @@ int pcm_mmap_begin(struct pcm *pcm, void **areas, unsigned int *offset,

 int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames)
 {
+    int ret;
+
     /* update the application pointer in userspace and kernel */
     pcm_mmap_appl_forward(pcm, frames);
-    pcm_sync_ptr(pcm, 0);
+    ret = pcm_sync_ptr(pcm, 0);
+    if (!ret)
+        ret = (int)frames;

-    return frames;
+    return ret;
 }

 int pcm_avail_update(struct pcm *pcm)

Android 9 pcm->ops->open fails

Hi,
The

pcm->fd = pcm->ops->open(card, device, flags, &pcm->data, NULL);

fails with errno 13' permission denied'. How do I fix this from user app.

Thank you.

con't played the end of buff

I met the problem,when i use tinyplay to play sine wav file, and test the line out.the end of wave was killed.

Segment Fault

I've just added tinyalsa to my Linux distro (BlueSkyOS, Version 0.2.0-beta) and I tried to run tinypcminfo but I got a Segment Fault. I've run dmesg and I found out this:

[   47.171027] tinypcminfo[1072]: segfault at 1 ip 0000000000000001 sp 00007ffc65179ce8 error 14 in tinypcminfo[7fcd26e30000+6000]

I'm using musl for libc if that helps at all, and I have tested all the tinyalsa commands but they don't work.

Examples for Playback

It would be nice to have example audio files used for testing playback with tinyplay. Ideally, there would be a web resource to get the files from so that they're not downloaded with the git repository (not everyone will want them.) But if they're small enough, that will be okay.

The examples should be of multiple different channel maps and sample types. That way, we can ensure the likely hood of anyone of them "fitting the shoe" of the sound card.

Having a problem that generates audio (such as a sine wave) in these multiple configurations would also be acceptable (if not preferred.)

tinymix/tinyalsa is not sending second mixer value correctly

Hi,

I'm writing an Android audio driver that uses ALSA/tinymix: https://github.com/androidarmv6/android_device_samsung_bcm21553-common/tree/cm-11.0/audio

In order to control routing on this device, I need to modify this mixer control that contains two values: https://gist.github.com/psyke83/a6ca133e023d966c273b#file-gistfile1-txt-L14

The first value is an enable/disable flag (0/1), and the second value corresponds to the audio endpoint as defined in the kernel driver. So, to switch to the headset, I would disable the default speaker route (4) and enable the headset (1):
tinymix 10 0 4
tinymix 10 1 1

However, it is not working correctly. The first value is set properly, but the second is not set correctly (the alsa kernel driver debug shows that it receives zero for the second value).

I know that it's a bug in tinymix, because the standard alsa_amixer works (mixer id is offset by +1):
alsa_amixer cset numid=11 10 0,4
alsa_amixer cset numid=11 10 1,1

I was using tinymix from CyanogenMod: https://github.com/CyanogenMod/android_external_tinyalsa - but it's an older version that had a bug with parsing multiple values in tinymix. I'm now testing against your latest upstream code, and the problem is the same: https://github.com/tinyalsa/tinyalsa

Please let me know if I can give any more information to help solve this problem.

'__bitwise' macro redefined [-Wmacro-redefined]

Hi ,

I am trying to build project using android studio but its giving me error

'__bitwise' macro redefined [-Wmacro-redefined]

Please check below logs for same

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:externalNativeBuildDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.internal.UncheckedException: Build command failed.
Error while executing process G:\software\dev\mobile\android-sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\Dev\TS2.0\ALSA\TinyalsaTest\app.externalNativeBuild\cmake\debug\x86_64 --target tinymix}
[1/5] Building C object CMakeFiles/tinyalsa.dir/src/pcm.c.o
[2/5] Building C object CMakeFiles/tinyalsa.dir/src/mixer.c.o
FAILED: G:\software\dev\mobile\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe --target=x86_64-none-linux-android --gcc-toolchain=G:/software/dev/mobile/android-sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/windows-x86_64 --sysroot=G:/software/dev/mobile/android-sdk/ndk-bundle/sysroot -I../../../../include -isystem G:/software/dev/mobile/android-sdk/ndk-bundle/sysroot/usr/include/x86_64-linux-android -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -Wall -Wextra -Werror -Wfatal-errors -MD -MT CMakeFiles/tinyalsa.dir/src/pcm.c.o -MF CMakeFiles\tinyalsa.dir\src\pcm.c.o.d -o CMakeFiles/tinyalsa.dir/src/pcm.c.o -c D:\Dev\TS2.0\ALSA\TinyalsaTest\app\src\pcm.c
D:\Dev\TS2.0\ALSA\TinyalsaTest\app\src\pcm.c:46:9: fatal error: '__bitwise' macro redefined [-Wmacro-redefined]
#define __bitwise
^
G:/software/dev/mobile/android-sdk/ndk-bundle/sysroot/usr/include\linux/types.h:25:9: note: previous definition is here
#define __bitwise bitwise
^
1 error generated.
ninja: build stopped: subcommand failed.

at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:780)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 32 more

Caused by: Build command failed.
Error while executing process G:\software\dev\mobile\android-sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build D:\Dev\TS2.0\ALSA\TinyalsaTest\app.externalNativeBuild\cmake\debug\x86_64 --target tinymix}
[1/5] Building C object CMakeFiles/tinyalsa.dir/src/pcm.c.o
[2/5] Building C object CMakeFiles/tinyalsa.dir/src/mixer.c.o
FAILED: G:\software\dev\mobile\android-sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe --target=x86_64-none-linux-android --gcc-toolchain=G:/software/dev/mobile/android-sdk/ndk-bundle/toolchains/x86_64-4.9/prebuilt/windows-x86_64 --sysroot=G:/software/dev/mobile/android-sdk/ndk-bundle/sysroot -I../../../../include -isystem G:/software/dev/mobile/android-sdk/ndk-bundle/sysroot/usr/include/x86_64-linux-android -D__ANDROID_API__=21 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -fPIC -Wall -Wextra -Werror -Wfatal-errors -MD -MT CMakeFiles/tinyalsa.dir/src/pcm.c.o -MF CMakeFiles\tinyalsa.dir\src\pcm.c.o.d -o CMakeFiles/tinyalsa.dir/src/pcm.c.o -c D:\Dev\TS2.0\ALSA\TinyalsaTest\app\src\pcm.c
D:\Dev\TS2.0\ALSA\TinyalsaTest\app\src\pcm.c:46:9: fatal error: '__bitwise' macro redefined [-Wmacro-redefined]
#define __bitwise
^
G:/software/dev/mobile/android-sdk/ndk-bundle/sysroot/usr/include\linux/types.h:25:9: note: previous definition is here
#define __bitwise bitwise
^
1 error generated.
ninja: build stopped: subcommand failed.

at com.android.build.gradle.tasks.ExternalNativeBuildTaskUtils.executeBuildProcessAndLogError(ExternalNativeBuildTaskUtils.java:244)
at com.android.build.gradle.tasks.ExternalNativeBuildTask.executeProcessBatch(ExternalNativeBuildTask.java:307)
at com.android.build.gradle.tasks.ExternalNativeBuildTask.build(ExternalNativeBuildTask.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
... 44 more

tinyalsa_macro_redefined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.