1
Fork 0
lua-libpulse-glib/index.html

107 lines
4.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>lua-libpulse-glib</title>
<link rel="stylesheet" href="ldoc.css" type="text/css" />
</head>
<body>
<aside id="sidebar" class="has-background-white-ter">
<h1 class="title">lua-libpulse-glib</h1>
<nav class="menu">
<ul class="menu-list">
<li><a class="is-active" href="../index.html">Index</a></li>
</ul>
<p class="menu-label">Modules</p>
<ul class="menu-list">
<li><a href="modules/lua_libpulse_glib.context.html">lua_libpulse_glib.context</a></li>
<li><a href="modules/lua_libpulse_glib.proplist.html">lua_libpulse_glib.proplist</a></li>
<li><a href="modules/lua_libpulse_glib.html">lua_libpulse_glib</a></li>
<li><a href="modules/lua_libpulse_glib.volume.html">lua_libpulse_glib.volume</a></li>
</ul>
</nav>
</aside>
<div id="content" class="content__wrapper">
<section class="section section__project-description">
<div class="container">
<h1 class="title is-1">lua-libpulse-glib</h1>
<h2 class="subtitle is-3">Lua bindings for PulseAudio&rsquo;s libpulse, using the GLib Main Loop.</h2>
<div class="content">
<p><p>While libpulse provides different event loop implementations, these bindings focus on the GLib comaptibility only.
Therefore, all asynchronous functions need to be executed inside a running GLib Main Loop.
For now, this loop has to run on GLib&rsquo;s default main context. Custom loop contexts are currently not supported.</p>
<p>The majority of the API is callback-based asynchronous. Callbacks always receive any potential errors as their
first parameter, usually just the error message as string, or <code>nil</code> when there was no error. Additional parameters
may either be just a boolean, for operations that don&rsquo;t return data, or the actual queried data.</p>
<p>All numeric indices (such as sink or source indices) are adjusted to be 1-based in typical Lua fashion.
This means that when comparing the output of calls like <a href="modules/lua_libpulse_glib.context.html#Context:get_sinks">Context:get_sinks</a> to the output of tools like <code>pactl</code>,
indices will be off by one.</p>
<pre><code>local lgi = require("lgi")
local pulseaudio = require("lua_libpulse_glib")
local ppretty = require("pl.pretty")
local pa = pulseaudio.new()
local ctx = pa:context("My Test App")
local loop = lgi.GLib.MainLoop.new()
ctx:connect(nil, function(state)
if state == 4 then
print("Connection is ready")
ctx:get_sinks(function(sinks)
ppretty.dump(sinks)
loop:quit()
end)
end
end)
loop:run()
</code></pre>
</p>
</div>
</div>
</section>
<section class="section section__project-summary">
<div class="container">
<h2 class="title is-4">modules</h2>
<table class="table is-fullwidth is-striped">
<tbody>
<tr>
<td class="name"><a href="modules/lua_libpulse_glib.context.html">lua_libpulse_glib.context</a></td>
<td class="summary">Bindings for libpulse&rsquo;s connection context.</td>
</tr>
<tr>
<td class="name"><a href="modules/lua_libpulse_glib.proplist.html">lua_libpulse_glib.proplist</a></td>
<td class="summary">Bindings for PulseAudio&rsquo;s property lists.</td>
</tr>
<tr>
<td class="name"><a href="modules/lua_libpulse_glib.html">lua_libpulse_glib</a></td>
<td class="summary">Bindings for PulseAudio&rsquo;s libpulse, using the GLib Main Loop.</td>
</tr>
<tr>
<td class="name"><a href="modules/lua_libpulse_glib.volume.html">lua_libpulse_glib.volume</a></td>
<td class="summary">Bindings for libpulse&rsquo;s <code>pa_cvolume</code>.</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
<footer class="footer">
<div class="content has-text-centered">
Generated by <a href="https://github/com/stevendonovan/LDoc">LDoc 1.4.6</a>, designed with <a href="https://github.com/jgthms/bulma">Bulma</a>. Last updated at 2022-08-10 11:05:56.
</div>
</footer>
</body>
</html>