mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-28 09:47:09 +02:00
Fix Linter issues
This commit is contained in:
parent
72358cd912
commit
ce743ce4c6
6 changed files with 60 additions and 42 deletions
|
@ -4,7 +4,7 @@ WarningsAsErrors: ''
|
||||||
HeaderFilterRegex: ''
|
HeaderFilterRegex: ''
|
||||||
AnalyzeTemporaryDtors: false
|
AnalyzeTemporaryDtors: false
|
||||||
FormatStyle: file
|
FormatStyle: file
|
||||||
User: johannes
|
User: badaix
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: modernize-loop-convert.MaxCopySize
|
- key: modernize-loop-convert.MaxCopySize
|
||||||
value: '16'
|
value: '16'
|
||||||
|
|
26
README.md
26
README.md
|
@ -115,13 +115,13 @@ Available audio backends are configured using the `--player` command line parame
|
||||||
|
|
||||||
| Backend | OS | Description | Parameters |
|
| Backend | OS | Description | Parameters |
|
||||||
| --------- | ------- | ------------ | ---------- |
|
| --------- | ------- | ------------ | ---------- |
|
||||||
| alsa | Linux | ALSA | `buffer_time=<total buffer size [ms]>` (default 80, min 10)<br />`fragments=<number of buffers>` (default 4, min 2) |
|
| alsa | Linux | ALSA | `buffer_time=<total buffer size [ms]>` (default 80, min 10)<br>`fragments=<number of buffers>` (default 4, min 2) |
|
||||||
| pulse | Linux | PulseAudio | `buffer_time=<buffer size [ms]>` (default 100, min 10)<br />`server=<PulseAudio server>` - default not-set: use the default server<br />`property=<key>=<value>` set PA property, can be used multiple times (default `media.role=music`) |
|
| pulse | Linux | PulseAudio | `buffer_time=<buffer size [ms]>` (default 100, min 10)<br>`server=<PulseAudio server>` - default not-set: use the default server<br>`property=<key>=<value>` set PA property, can be used multiple times (default `media.role=music`) |
|
||||||
| oboe | Android | Oboe, using OpenSL ES on Android 4.1 and AAudio on 8.1 | |
|
| oboe | Android | Oboe, using OpenSL ES on Android 4.1 and AAudio on 8.1 | |
|
||||||
| opensl | Android | OpenSL ES | |
|
| opensl | Android | OpenSL ES | |
|
||||||
| coreaudio | macOS | Core Audio | |
|
| coreaudio | macOS | Core Audio | |
|
||||||
| wasapi | Windows | Windows Audio Session API | |
|
| wasapi | Windows | Windows Audio Session API | |
|
||||||
| file | All | Write audio to file | `filename=<filename>` (`<filename>` = `stdout`, `stderr`, `null` or a filename)<br />`mode=[w|a]` (`w`: write (discarding the content), `a`: append (keeping the content) |
|
| file | All | Write audio to file | `filename=<filename>` (`<filename>` = `stdout`, `stderr`, `null` or a filename)<br>`mode=[w\|a]` (`w`: write (discarding the content), `a`: append (keeping the content) |
|
||||||
|
|
||||||
Parameters are appended to the player name, e.g. `--player alsa:buffer_time=100`. Use `--player <name>:?` to get a list of available options.
|
Parameters are appended to the player name, e.g. `--player alsa:buffer_time=100`. Use `--player <name>:?` to get a list of available options.
|
||||||
For some audio backends you can configure the PCM device using the `-s` or `--soundcard` parameter, the device is chosen by index or name. Available PCM devices can be listed with `-l` or `--list`
|
For some audio backends you can configure the PCM device using the `-s` or `--soundcard` parameter, the device is chosen by index or name. Available PCM devices can be listed with `-l` or `--list`
|
||||||
|
@ -131,18 +131,24 @@ If you are running MPD and Shairport-sync into a soundcard that only supports 48
|
||||||
|
|
||||||
You can test your installation by copying random data into the server's fifo file
|
You can test your installation by copying random data into the server's fifo file
|
||||||
|
|
||||||
cat /dev/urandom > /tmp/snapfifo
|
```shell
|
||||||
|
cat /dev/urandom > /tmp/snapfifo
|
||||||
|
```
|
||||||
|
|
||||||
All connected clients should play random noise now. You might raise the client's volume with "alsamixer".
|
All connected clients should play random noise now. You might raise the client's volume with "alsamixer".
|
||||||
It's also possible to let the server play a WAV file. Simply configure a `file` stream in `/etc/snapserver.conf`, and restart the server:
|
It's also possible to let the server play a WAV file. Simply configure a `file` stream in `/etc/snapserver.conf`, and restart the server:
|
||||||
|
|
||||||
[stream]
|
```ini
|
||||||
source = file:///home/user/Musik/Some%20wave%20file.wav?name=test
|
[stream]
|
||||||
|
source = file:///home/user/Musik/Some%20wave%20file.wav?name=test
|
||||||
|
```
|
||||||
|
|
||||||
When you are using a Raspberry Pi, you might have to change your audio output to the 3.5mm jack:
|
When you are using a Raspberry Pi, you might have to change your audio output to the 3.5mm jack:
|
||||||
|
|
||||||
#The last number is the audio output with 1 being the 3.5 jack, 2 being HDMI and 0 being auto.
|
``` shell
|
||||||
amixer cset numid=3 1
|
# The last number is the audio output with 1 being the 3.5 jack, 2 being HDMI and 0 being auto.
|
||||||
|
amixer cset numid=3 1
|
||||||
|
```
|
||||||
|
|
||||||
To setup WiFi on a Raspberry Pi, you can follow this [guide](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md)
|
To setup WiFi on a Raspberry Pi, you can follow this [guide](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md)
|
||||||
|
|
||||||
|
@ -195,7 +201,9 @@ The only requirement is that the player's audio can be redirected into the Snaps
|
||||||
|
|
||||||
The goal is to build the following chain:
|
The goal is to build the following chain:
|
||||||
|
|
||||||
audio player software -> snapfifo -> snapserver -> network -> snapclient -> alsa
|
```plain
|
||||||
|
audio player software -> snapfifo -> snapserver -> network -> snapclient -> alsa
|
||||||
|
```
|
||||||
|
|
||||||
This [guide](doc/player_setup.md) shows how to configure different players/audio sources to redirect their audio signal into the Snapserver's fifo:
|
This [guide](doc/player_setup.md) shows how to configure different players/audio sources to redirect their audio signal into the Snapserver's fifo:
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ pipe:///<path/to/pipe>?name=<name>[&mode=create]
|
||||||
|
|
||||||
`mode` can be `create` or `read`. Sometimes your audio source might insist in creating the pipe itself. So the pipe creation mode can by changed to "not create, but only read mode", using the `mode` option set to `read`
|
`mode` can be `create` or `read`. Sometimes your audio source might insist in creating the pipe itself. So the pipe creation mode can by changed to "not create, but only read mode", using the `mode` option set to `read`
|
||||||
|
|
||||||
**NOTE** With newer kernels using FIFO pipes in a world writeable sticky dir (e.g. `/tmp`) one might also have to turn off `fs.protected_fifos`, as default settings have changed recently: `sudo sysctl fs.protected_fifos=0`.
|
**NOTE** With newer kernels using FIFO pipes in a world writeable sticky dir (e.g. `/tmp`) one might also have to turn off `fs.protected_fifos`, as default settings have changed recently: `sudo sysctl fs.protected_fifos=0`.
|
||||||
|
|
||||||
See [stackexchange](https://unix.stackexchange.com/questions/503111/group-permissions-for-root-not-working-in-tmp) for more details. You need to run this after each reboot or add it to /etc/sysctl.conf or /etc/sysctl.d/50-default.conf depending on distribution.
|
See [stackexchange](https://unix.stackexchange.com/questions/503111/group-permissions-for-root-not-working-in-tmp) for more details. You need to run this after each reboot or add it to /etc/sysctl.conf or /etc/sysctl.d/50-default.conf depending on distribution.
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ have a Jack client named "system" with four output ports ("playback_1",
|
||||||
could either autoconnect to the exact ports, or you use an `autoconnect` search
|
could either autoconnect to the exact ports, or you use an `autoconnect` search
|
||||||
term that returns all ports and use `autoconnect_skip` to pick the right one:
|
term that returns all ports and use `autoconnect_skip` to pick the right one:
|
||||||
|
|
||||||
```
|
```ini
|
||||||
jack:///?name=Channel1&sampleformat=48000:16:1&autoconnect=system:playback_
|
jack:///?name=Channel1&sampleformat=48000:16:1&autoconnect=system:playback_
|
||||||
jack:///?name=Channel2&sampleformat=48000:16:1&autoconnect=system:playback_&autoconnect_skip=1
|
jack:///?name=Channel2&sampleformat=48000:16:1&autoconnect=system:playback_&autoconnect_skip=1
|
||||||
jack:///?name=Channel3&sampleformat=48000:16:1&autoconnect=system:playback_&autoconnect_skip=2
|
jack:///?name=Channel3&sampleformat=48000:16:1&autoconnect=system:playback_&autoconnect_skip=2
|
||||||
|
@ -306,7 +306,6 @@ jack:///?name=Channel4&sampleformat=48000:16:1&autoconnect=system:playback_&auto
|
||||||
- The `chunk_ms` parameter is ignored for jack streams. The Jack buffer size
|
- The `chunk_ms` parameter is ignored for jack streams. The Jack buffer size
|
||||||
(Frames/Period) is used instead.
|
(Frames/Period) is used instead.
|
||||||
|
|
||||||
|
|
||||||
### meta
|
### meta
|
||||||
|
|
||||||
Read and mix audio from other stream sources
|
Read and mix audio from other stream sources
|
||||||
|
|
|
@ -9,7 +9,7 @@ The goal is to build the following chain:
|
||||||
audio player software -> snapfifo -> snapserver -> network -> snapclient -> alsa
|
audio player software -> snapfifo -> snapserver -> network -> snapclient -> alsa
|
||||||
```
|
```
|
||||||
|
|
||||||
**NOTE** With newer kernels using FIFO pipes in a world writeable sticky dir (e.g. `/tmp`) one might also have to turn off `fs.protected_fifos`, as default settings have changed recently: `sudo sysctl fs.protected_fifos=0`.
|
**NOTE** With newer kernels using FIFO pipes in a world writeable sticky dir (e.g. `/tmp`) one might also have to turn off `fs.protected_fifos`, as default settings have changed recently: `sudo sysctl fs.protected_fifos=0`.
|
||||||
|
|
||||||
See [stackexchange](https://unix.stackexchange.com/questions/503111/group-permissions-for-root-not-working-in-tmp) for more details. You need to run this after each reboot or add it to /etc/sysctl.conf or /etc/sysctl.d/50-default.conf depending on distribution.
|
See [stackexchange](https://unix.stackexchange.com/questions/503111/group-permissions-for-root-not-working-in-tmp) for more details. You need to run this after each reboot or add it to /etc/sysctl.conf or /etc/sysctl.d/50-default.conf depending on distribution.
|
||||||
|
|
||||||
|
@ -200,9 +200,9 @@ sudo apt install -y shairport-sync
|
||||||
sudo systemctl disable --now shairport-sync
|
sudo systemctl disable --now shairport-sync
|
||||||
```
|
```
|
||||||
|
|
||||||
Here is an example configuration line for /etc/snapserver.conf but please see [the Snapcast Airplay configuration guide](configuration.md#airplay) for more details on the syntax and options.
|
Here is an example configuration line for `/etc/snapserver.conf` but please see [the Snapcast Airplay configuration guide](configuration.md#airplay) for more details on the syntax and options.
|
||||||
|
|
||||||
```plaintext
|
```ini
|
||||||
source = airplay:///shairport-sync?name=Airplay
|
source = airplay:///shairport-sync?name=Airplay
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -212,11 +212,11 @@ Although this _might_ be a quick and convenient way to set up an Airplay source
|
||||||
|
|
||||||
1. Install dependencies. For debian derivates: `apt-get install autoconf libpopt-dev libconfig-dev libssl-dev`
|
1. Install dependencies. For debian derivates: `apt-get install autoconf libpopt-dev libconfig-dev libssl-dev`
|
||||||
2. Build shairport-sync (version 3.3 or later) with `stdout` backend:
|
2. Build shairport-sync (version 3.3 or later) with `stdout` backend:
|
||||||
* `autoreconf -i -f`
|
* `autoreconf -i -f`
|
||||||
* `./configure --with-stdout --with-avahi --with-ssl=openssl --with-metadata`
|
* `./configure --with-stdout --with-avahi --with-ssl=openssl --with-metadata`
|
||||||
3. Copy the `shairport-sync` binary somewhere to your `PATH`, e.g. `/usr/local/bin/`
|
3. Copy the `shairport-sync` binary somewhere to your `PATH`, e.g. `/usr/local/bin/`
|
||||||
4. Configure snapserver with `source = airplay:///shairport-sync?name=Airplay[&devicename=Snapcast][&port=PORT]`
|
4. Configure snapserver with `source = airplay:///shairport-sync?name=Airplay[&devicename=Snapcast][&port=PORT]`
|
||||||
* `PORT` is 5000 for Airplay 1 and 7000 for Airplay 2
|
* `PORT` is 5000 for Airplay 1 and 7000 for Airplay 2
|
||||||
|
|
||||||
### Spotify
|
### Spotify
|
||||||
|
|
||||||
|
@ -266,28 +266,39 @@ Audio can be played directly through the line-in via ALSA. The following guide w
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Edit the file `/etc/snapserver.conf` and add the following line, substituting `<device_name>` for the value derived from the previous step. Pick whatever you'd like for `<stream_name>`.
|
3. Edit the file `/etc/snapserver.conf` and add the following line, substituting `<device_name>` for the value derived from the previous step. Pick whatever you'd like for `<stream_name>`.
|
||||||
```
|
|
||||||
|
```ini
|
||||||
stream = alsa:///?name=<stream_name>&device=hw:<device_name>
|
stream = alsa:///?name=<stream_name>&device=hw:<device_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Restart the snapserver service.
|
4. Restart the snapserver service.
|
||||||
```
|
|
||||||
|
```shell
|
||||||
sudo service snapserver restart
|
sudo service snapserver restart
|
||||||
```
|
```
|
||||||
|
|
||||||
5. You are done. Enjoy your new snapserver with line in. However, if you'd like to run the client on the same machine as the server then continue with the remaining steps.
|
5. You are done. Enjoy your new snapserver with line in. However, if you'd like to run the client on the same machine as the server then continue with the remaining steps.
|
||||||
6. Get the sound devices as far as snapclient is concerned. You are looking for the device name. This is probably the same as the `aplay -l` device names so may be able to use that instead.
|
6. Get the sound devices as far as snapclient is concerned. You are looking for the device name. This is probably the same as the `aplay -l` device names so may be able to use that instead.
|
||||||
```
|
|
||||||
|
```shell
|
||||||
snapclient -l
|
snapclient -l
|
||||||
```
|
```
|
||||||
|
|
||||||
7. In the output you are looking for the `hw:CARD` line that corresponds with the output device you want to use. Note the `<device_name>` for the next step.
|
7. In the output you are looking for the `hw:CARD` line that corresponds with the output device you want to use. Note the `<device_name>` for the next step.
|
||||||
```
|
|
||||||
|
```plain
|
||||||
<number> hw:CARD=<device_name>,DEV=<device_number>
|
<number> hw:CARD=<device_name>,DEV=<device_number>
|
||||||
```
|
```
|
||||||
8. Edit the file `/etc/default/snapclient` and modify the `SNAPCLIENT_OPTS`.
|
|
||||||
```
|
8. Edit the file `/etc/default/snapclient` and modify the `SNAPCLIENT_OPTS`.
|
||||||
|
|
||||||
|
```ini
|
||||||
SNAPCLIENT_OPTS=" --host <hostname> -s <dervice_name> "
|
SNAPCLIENT_OPTS=" --host <hostname> -s <dervice_name> "
|
||||||
```
|
```
|
||||||
|
|
||||||
9. Restart the snapclient service.
|
9. Restart the snapclient service.
|
||||||
```
|
|
||||||
|
```shell
|
||||||
sudo service snapclient restart
|
sudo service snapclient restart
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -28,5 +28,5 @@ if(ANDROID)
|
||||||
target_link_libraries(snapcast_test log)
|
target_link_libraries(snapcast_test log)
|
||||||
endif(ANDROID)
|
endif(ANDROID)
|
||||||
|
|
||||||
target_link_libraries(snapcast_test Catch2::Catch2WithMain OpenSSL::Crypto
|
target_link_libraries(snapcast_test OpenSSL::Crypto OpenSSL::SSL)
|
||||||
OpenSSL::SSL Catch2::Catch2)
|
target_link_libraries(snapcast_test Catch2::Catch2WithMain Catch2::Catch2)
|
||||||
|
|
|
@ -53,14 +53,14 @@ TEST_CASE("String utils")
|
||||||
|
|
||||||
strings = split("*", '*');
|
strings = split("*", '*');
|
||||||
REQUIRE(strings.size() == 2);
|
REQUIRE(strings.size() == 2);
|
||||||
REQUIRE(strings[0] == "");
|
REQUIRE(strings[0].empty());
|
||||||
REQUIRE(strings[1] == "");
|
REQUIRE(strings[1].empty());
|
||||||
|
|
||||||
strings = split("**", '*');
|
strings = split("**", '*');
|
||||||
REQUIRE(strings.size() == 3);
|
REQUIRE(strings.size() == 3);
|
||||||
REQUIRE(strings[0] == "");
|
REQUIRE(strings[0].empty());
|
||||||
REQUIRE(strings[1] == "");
|
REQUIRE(strings[1].empty());
|
||||||
REQUIRE(strings[2] == "");
|
REQUIRE(strings[2].empty());
|
||||||
|
|
||||||
strings = split("1*2", '*');
|
strings = split("1*2", '*');
|
||||||
REQUIRE(strings.size() == 2);
|
REQUIRE(strings.size() == 2);
|
||||||
|
@ -70,21 +70,21 @@ TEST_CASE("String utils")
|
||||||
strings = split("1**2", '*');
|
strings = split("1**2", '*');
|
||||||
REQUIRE(strings.size() == 3);
|
REQUIRE(strings.size() == 3);
|
||||||
REQUIRE(strings[0] == "1");
|
REQUIRE(strings[0] == "1");
|
||||||
REQUIRE(strings[1] == "");
|
REQUIRE(strings[1].empty());
|
||||||
REQUIRE(strings[2] == "2");
|
REQUIRE(strings[2] == "2");
|
||||||
|
|
||||||
strings = split("*1*2", '*');
|
strings = split("*1*2", '*');
|
||||||
REQUIRE(strings.size() == 3);
|
REQUIRE(strings.size() == 3);
|
||||||
REQUIRE(strings[0] == "");
|
REQUIRE(strings[0].empty());
|
||||||
REQUIRE(strings[1] == "1");
|
REQUIRE(strings[1] == "1");
|
||||||
REQUIRE(strings[2] == "2");
|
REQUIRE(strings[2] == "2");
|
||||||
|
|
||||||
strings = split("*1*2*", '*');
|
strings = split("*1*2*", '*');
|
||||||
REQUIRE(strings.size() == 4);
|
REQUIRE(strings.size() == 4);
|
||||||
REQUIRE(strings[0] == "");
|
REQUIRE(strings[0].empty());
|
||||||
REQUIRE(strings[1] == "1");
|
REQUIRE(strings[1] == "1");
|
||||||
REQUIRE(strings[2] == "2");
|
REQUIRE(strings[2] == "2");
|
||||||
REQUIRE(strings[3] == "");
|
REQUIRE(strings[3].empty());
|
||||||
|
|
||||||
std::vector<std::string> vec{"1", "2", "3"};
|
std::vector<std::string> vec{"1", "2", "3"};
|
||||||
REQUIRE(container_to_string(vec) == "1, 2, 3");
|
REQUIRE(container_to_string(vec) == "1, 2, 3");
|
||||||
|
@ -442,11 +442,11 @@ TEST_CASE("Librespot2")
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
size_t title_pos = 0;
|
size_t title_pos = 0;
|
||||||
size_t ms_pos = 0;
|
size_t ms_pos = 0;
|
||||||
if (((title_pos = line.find("<")) != std::string::npos) && ((n = line.find(">", title_pos)) != std::string::npos) &&
|
if (((title_pos = line.find('<')) != std::string::npos) && ((n = line.find('>', title_pos)) != std::string::npos) &&
|
||||||
((ms_pos = line.find("(", n)) != std::string::npos) && ((n = line.find("ms) loaded", ms_pos)) != std::string::npos))
|
((ms_pos = line.find('(', n)) != std::string::npos) && ((n = line.find("ms) loaded", ms_pos)) != std::string::npos))
|
||||||
{
|
{
|
||||||
title_pos += 1;
|
title_pos += 1;
|
||||||
std::string title = line.substr(title_pos, line.find(">", title_pos) - title_pos);
|
std::string title = line.substr(title_pos, line.find('>', title_pos) - title_pos);
|
||||||
REQUIRE(title == "Tunnel");
|
REQUIRE(title == "Tunnel");
|
||||||
ms_pos += 1;
|
ms_pos += 1;
|
||||||
std::string ms = line.substr(ms_pos, n - ms_pos - 1);
|
std::string ms = line.substr(ms_pos, n - ms_pos - 1);
|
||||||
|
@ -616,11 +616,11 @@ TEST_CASE("Error")
|
||||||
REQUIRE(ec);
|
REQUIRE(ec);
|
||||||
REQUIRE(ec == ControlErrc::can_not_control);
|
REQUIRE(ec == ControlErrc::can_not_control);
|
||||||
REQUIRE(ec != ControlErrc::success);
|
REQUIRE(ec != ControlErrc::success);
|
||||||
std::cout << ec << std::endl;
|
std::cout << ec << '\n';
|
||||||
|
|
||||||
ec = make_error_code(ControlErrc::can_not_control);
|
ec = make_error_code(ControlErrc::can_not_control);
|
||||||
REQUIRE(ec.category() == snapcast::error::control::category());
|
REQUIRE(ec.category() == snapcast::error::control::category());
|
||||||
std::cout << "Category: " << ec.category().name() << ", " << ec.message() << std::endl;
|
std::cout << "Category: " << ec.category().name() << ", " << ec.message() << '\n';
|
||||||
|
|
||||||
snapcast::ErrorCode error_code{};
|
snapcast::ErrorCode error_code{};
|
||||||
REQUIRE(!error_code);
|
REQUIRE(!error_code);
|
||||||
|
@ -639,7 +639,7 @@ TEST_CASE("ErrorOr")
|
||||||
// Move value out
|
// Move value out
|
||||||
REQUIRE(error_or.takeValue() == "test");
|
REQUIRE(error_or.takeValue() == "test");
|
||||||
// Value has been moved out, get will return an empty string
|
// Value has been moved out, get will return an empty string
|
||||||
REQUIRE(error_or.getValue() == "");
|
REQUIRE(error_or.getValue().empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue