Skip to content

An easy wrapper library around pulseaudio, written in c++.

License

Notifications You must be signed in to change notification settings

SCOTT-HAMILTON/FakeLib

Repository files navigation

Fake Lib

powered by Pulseaudio

Powered by Pulseaudio

Build Passing

Fake is a pulseaudio wrapper library written in c++.

Meson Building

To build it, run :

meson setup build
ninja -C build
ninja -C install

Usage

FakeLib can run multiple pulseaudio commands at once. The structure used runs the commands in the same server connection. The basic usage consists of four steps :

  1. Stacking commands that you want to run.
  2. Running them.
  3. Extracting the resuts you're interesed in.
  4. Using the extracted results.

In code, this would translate to

// The FakeLib instance to work with
FakeLib fakeLib;

// stacking and running commands (steps 1 and 2) is done here
auto result = fakeLib
	     .get_module_list()
	     .get_sink_list()
	     .get_source_list()
	     .get_source_output_list()
	     .run_commands();

// We extract the results
auto module_list = extract<info_list<module_infos_t>>(result);
auto sink_list = extract<info_list<sink_infos_t>>(result);
auto source_list = extract<info_list<source_infos_t>>(result);
auto source_output_list = extract<info_list<source_output_infos_t>>(result);

// And we print them with those helper functions
print_module_list(module_list);
print_sink_list(sink_list);
print_source_list(source_list);
print_source_output_list(source_output_list);

This code outputs this on my laptop :

=======[ Module info #1 ]=======
Name: module-device-restore
Index: 0

=======[ Module info #2 ]=======
Name: module-stream-restore
Index: 1

[...]

=======[ Module info #15 ]=======
Name: module-rescue-streams
Index: 14

=======[ Module info #16 ]=======
Name: module-always-sink
Index: 15

=======[ Sink info #1 ]=======
Name: alsa_output.pci-0000_00_1f.3.analog-stereo
Index: 0
Description: Audio interne Stéréo analogique

=======[ Source info #1 ]=======
Name: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
Index: 0
Description: Monitor of Audio interne Stéréo analogique

=======[ Source info #2 ]=======
Name: alsa_input.pci-0000_00_1f.3.analog-stereo
Index: 1
Description: Audio interne Stéréo analogique

=======[ Source Output info #1 ]=======
Name: recStream
Source: 1
Index: 0
Source Process Binary Name: .Discord-wrapped

Integration

FakeLib provides a pkg-config file.

Requirements

Fake requires libpulse

Help

FakeLib is just a little project, but feel free to fork, change, extend or correct the code.

License

FakeLib is delivered as it is under the well known MIT License

References that helped

About

An easy wrapper library around pulseaudio, written in c++.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published