polybar-dwm/include/adapters/alsa/generic.hpp
patrick96 16102c258a alsa: include asoundlib.h instead of all alsa headers
In alsa 1.2.10, the `alsa/control.h` header cannot be included on its
own because it does not include all symbols it uses.

We are basically duplicating asoundlib.h anyway and there is even a
macro variable to switch to it.

Ref: #3009
Ref: https://github.com/alsa-project/alsa-lib/issues/348
2023-09-28 19:30:49 +02:00

26 lines
540 B
C++

#pragma once
#include <alsa/asoundlib.h>
#include "common.hpp"
#include "settings.hpp"
#include "errors.hpp"
POLYBAR_NS
namespace alsa {
DEFINE_ERROR(alsa_exception);
DEFINE_CHILD_ERROR(mixer_error, alsa_exception);
DEFINE_CHILD_ERROR(control_error, alsa_exception);
template <typename T>
void throw_exception(string&& message, int error_code) {
const char* snd_error = snd_strerror(error_code);
if (snd_error != nullptr)
message += ": " + string{snd_error};
throw T(message.c_str());
}
}
POLYBAR_NS_END