Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
audio.cpp File Reference

Definitions for audio control on Linux. More...

#include <bitset>
#include <map>
#include <sstream>
#include <thread>
#include <boost/regex.hpp>
#include <pulse/error.h>
#include <pulse/pulseaudio.h>
#include <pulse/simple.h>
#include "src/config.h"
#include "src/logging.h"
#include "src/platform/common.h"
#include "src/platform/linux/session_audio.h"
#include "src/thread_safe.h"
Include dependency graph for audio.cpp:

Go to the source code of this file.

Classes

struct  platf::mic_attr_t
struct  platf::pa::add_const_helper< true, T >
struct  platf::pa::add_const_helper< false, T >
class  platf::pa::server_t
class  platf::pa::server_t::lock_t

Typedefs

template<class T>
using platf::pa::add_const_t = typename add_const_helper<std::is_pointer_v<T>, T>::type
using platf::pa::ctx_t = util::safe_ptr<pa_context, pa_context_unref>
using platf::pa::loop_t = util::safe_ptr<pa_threaded_mainloop, pa_threaded_mainloop_free>
using platf::pa::string_t = util::safe_ptr<char, pa_free<char>>
template<class T>
using platf::pa::cb_simple_t = std::function<void(ctx_t::pointer, add_const_t<T> i)>
template<class T>
using platf::pa::cb_t = std::function<void(ctx_t::pointer, add_const_t<T> i, int eol)>

Functions

std::string platf::to_string (const char *name, const std::uint8_t *mapping, int channels)
std::unique_ptr< mic_t > platf::microphone (const std::uint8_t *mapping, int channels, std::uint32_t sample_rate, std::uint32_t frame_size, std::string source_name, const char *server=nullptr)
template<class T>
void platf::pa::pa_free (T *p)
template<class T>
void platf::pa::cb (ctx_t::pointer ctx, add_const_t< T > i, void *userdata)
template<class T>
void platf::pa::cb (ctx_t::pointer ctx, add_const_t< T > i, int eol, void *userdata)
void platf::pa::cb_i (ctx_t::pointer ctx, std::uint32_t i, void *userdata)
void platf::pa::ctx_state_cb (ctx_t::pointer ctx, void *userdata)
void platf::pa::success_cb (ctx_t::pointer ctx, int status, void *userdata)
std::unique_ptr< audio_control_t > platf::audio_control ()

Variables

constexpr pa_channel_position_t platf::position_mapping []

Detailed Description

Definitions for audio control on Linux.

Definition in file audio.cpp.

Typedef Documentation

◆ add_const_t

template<class T>
using platf::pa::add_const_t = typename add_const_helper<std::is_pointer_v<T>, T>::type

Definition at line 136 of file audio.cpp.

◆ cb_simple_t

template<class T>
using platf::pa::cb_simple_t = std::function<void(ctx_t::pointer, add_const_t<T> i)>

Definition at line 148 of file audio.cpp.

◆ cb_t

template<class T>
using platf::pa::cb_t = std::function<void(ctx_t::pointer, add_const_t<T> i, int eol)>

Definition at line 160 of file audio.cpp.

◆ ctx_t

using platf::pa::ctx_t = util::safe_ptr<pa_context, pa_context_unref>

Definition at line 143 of file audio.cpp.

◆ loop_t

using platf::pa::loop_t = util::safe_ptr<pa_threaded_mainloop, pa_threaded_mainloop_free>

Definition at line 144 of file audio.cpp.

◆ string_t

using platf::pa::string_t = util::safe_ptr<char, pa_free<char>>

Definition at line 145 of file audio.cpp.

Function Documentation

◆ audio_control()

std::unique_ptr< audio_control_t > platf::audio_control ( )

Definition at line 752 of file audio.cpp.

◆ cb() [1/2]

template<class T>
void platf::pa::cb ( ctx_t::pointer ctx,
add_const_t< T > i,
int eol,
void * userdata )

Definition at line 163 of file audio.cpp.

◆ cb() [2/2]

template<class T>
void platf::pa::cb ( ctx_t::pointer ctx,
add_const_t< T > i,
void * userdata )

Definition at line 151 of file audio.cpp.

◆ cb_i()

void platf::pa::cb_i ( ctx_t::pointer ctx,
std::uint32_t i,
void * userdata )

Definition at line 174 of file audio.cpp.

◆ ctx_state_cb()

void platf::pa::ctx_state_cb ( ctx_t::pointer ctx,
void * userdata )

Definition at line 180 of file audio.cpp.

◆ microphone()

std::unique_ptr< mic_t > platf::microphone ( const std::uint8_t * mapping,
int channels,
std::uint32_t sample_rate,
std::uint32_t frame_size,
std::string source_name,
const char * server = nullptr )

Definition at line 73 of file audio.cpp.

◆ pa_free()

template<class T>
void platf::pa::pa_free ( T * p)

Definition at line 139 of file audio.cpp.

◆ success_cb()

void platf::pa::success_cb ( ctx_t::pointer ctx,
int status,
void * userdata )

Definition at line 186 of file audio.cpp.

◆ to_string()

std::string platf::to_string ( const char * name,
const std::uint8_t * mapping,
int channels )

Definition at line 38 of file audio.cpp.

Variable Documentation

◆ position_mapping

pa_channel_position_t platf::position_mapping[]
constexpr
Initial value:
{
PA_CHANNEL_POSITION_FRONT_LEFT,
PA_CHANNEL_POSITION_FRONT_RIGHT,
PA_CHANNEL_POSITION_FRONT_CENTER,
PA_CHANNEL_POSITION_LFE,
PA_CHANNEL_POSITION_REAR_LEFT,
PA_CHANNEL_POSITION_REAR_RIGHT,
PA_CHANNEL_POSITION_SIDE_LEFT,
PA_CHANNEL_POSITION_SIDE_RIGHT,
}

Definition at line 27 of file audio.cpp.