1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/include/adapters/alsa/generic.hpp

66 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
#ifdef USE_ALSALIB_H
#include <alsa/asoundlib.h>
#else
#include <assert.h>
2018-03-21 18:35:10 -04:00
#ifndef __FreeBSD__
#include <endian.h>
2018-03-21 18:35:10 -04:00
#endif
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <poll.h>
#include <sys/types.h>
#include <unistd.h>
#ifndef __GNUC__
#define __inline__ inline
#endif
#include <alsa/asoundef.h>
#include <alsa/version.h>
#include <alsa/global.h>
#include <alsa/input.h>
#include <alsa/output.h>
#include <alsa/error.h>
#include <alsa/conf.h>
#include <alsa/pcm.h>
#include <alsa/rawmidi.h>
#include <alsa/timer.h>
#include <alsa/hwdep.h>
#include <alsa/control.h>
#include <alsa/mixer.h>
#include <alsa/seq_event.h>
#include <alsa/seq.h>
#include <alsa/seqmid.h>
#include <alsa/seq_midi_event.h>
#endif
#include "common.hpp"
2017-01-10 21:07:28 -05:00
#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