diff --git a/index.html b/index.html index e348957..eaeca7f 100644 --- a/index.html +++ b/index.html @@ -18,10 +18,10 @@ @@ -31,7 +31,7 @@

lua-libpulse-glib

Lua bindings for PulseAudio’s libpulse, using the GLib Main Loop.

-

While libpulse provides different event loop implementations, these bindings focus on the GLib comaptibility only. +

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’s default main context. Custom loop contexts are currently not supported.

@@ -40,8 +40,32 @@ first parameter, usually just the error message as string, or nil w may either be just a boolean, for operations that don’t return data, or the actual queried data.

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 Context:get_sinks to the output of tools like pactl, +This means that when comparing the output of calls like Context:get_sinks to the output of tools like pactl, indices will be off by one.

+ +
local lgi = require("lgi")
+local pulseaudio = require("lua_libpulse_glib")
+local ppretty = require("pl.pretty")
+
+local pa = pulseaudio.new()
+local ctx = pa:context()
+
+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()
+
+

@@ -52,19 +76,19 @@ indices will be off by one.

- + - + - + - + @@ -75,7 +99,7 @@ indices will be off by one.

diff --git a/modules/pulseaudio.context.html b/modules/lua_libpulse_glib.context.html similarity index 98% rename from modules/pulseaudio.context.html rename to modules/lua_libpulse_glib.context.html index 77df9bc..0e0f8ef 100644 --- a/modules/pulseaudio.context.html +++ b/modules/lua_libpulse_glib.context.html @@ -19,25 +19,25 @@
-

Module pulseaudio.context

+

Module lua_libpulse_glib.context

Bindings for libpulse’s connection context.

-

The connection Context provides introspection calls to query state from the server and various commands to +

The connection Context provides introspection calls to query state from the server and various commands to change this state.

In many cases, sinks and sources may be addressed by either their name or their numeric index. @@ -401,7 +401,7 @@

Gets information about all sinks.

-

This returns the same information as Context:get_sink_info would have returned for every sink +

This returns the same information as Context:get_sink_info would have returned for every sink that’s currently registered at the server.

See pa_sink_info @@ -778,7 +778,7 @@

Gets information about all sink inputs.

-

This returns the same information as Context:get_sink_input_info would have returned for every sink input +

This returns the same information as Context:get_sink_input_info would have returned for every sink input that’s currently registered at the server.

See pa_sink_input_info @@ -1219,7 +1219,7 @@

Gets information about all sources.

-

This returns the same information as Context:get_source_info would have returned for every source +

This returns the same information as Context:get_source_info would have returned for every source that’s currently registered at the server.

See pa_source_info @@ -1594,7 +1594,7 @@

Gets information about all source outputs.

-

This returns the same information as Context:get_source_output_info would have returned for every source output +

This returns the same information as Context:get_source_output_info would have returned for every source output that’s currently registered at the server.

See pa_source_output_info @@ -1962,7 +1962,7 @@

- Generated by LDoc 1.4.6, designed with Bulma. Last updated at 2022-05-15 20:53:32. + Generated by LDoc 1.4.6, designed with Bulma. Last updated at 2022-05-15 21:08:52.
diff --git a/modules/pulseaudio.html b/modules/lua_libpulse_glib.html similarity index 91% rename from modules/pulseaudio.html rename to modules/lua_libpulse_glib.html index 38d6b80..f2f758c 100644 --- a/modules/pulseaudio.html +++ b/modules/lua_libpulse_glib.html @@ -18,24 +18,24 @@
-

Module pulseaudio

+

Module lua_libpulse_glib

Bindings for PulseAudio’s libpulse, using the GLib Main Loop.

@@ -86,7 +86,7 @@

@@ -154,7 +154,7 @@
- Generated by LDoc 1.4.6, designed with Bulma. Last updated at 2022-05-15 20:53:32. + Generated by LDoc 1.4.6, designed with Bulma. Last updated at 2022-05-15 21:08:52.
diff --git a/modules/pulseaudio.proplist.html b/modules/lua_libpulse_glib.proplist.html similarity index 98% rename from modules/pulseaudio.proplist.html rename to modules/lua_libpulse_glib.proplist.html index cb822a7..990f444 100644 --- a/modules/pulseaudio.proplist.html +++ b/modules/lua_libpulse_glib.proplist.html @@ -18,9 +18,9 @@
-

Module pulseaudio.proplist

+

Module lua_libpulse_glib.proplist

Bindings for PulseAudio’s property lists.

Basic operations are mapped to Lua table operations:

@@ -76,7 +76,7 @@
- +
pulseaudio.contextlua_libpulse_glib.context Bindings for libpulse’s connection context.
pulseaudio.proplistlua_libpulse_glib.proplist Bindings for PulseAudio’s property lists.
pulseaudiolua_libpulse_glib Bindings for PulseAudio’s libpulse, using the GLib Main Loop.
pulseaudio.volumelua_libpulse_glib.volume Bindings for libpulse’s pa_cvolume.
from_string(str)Parses a string into a PropList.Parses a string into a PropList.
@@ -791,7 +791,7 @@
type - PropList + PropList
@@ -804,7 +804,7 @@ from_string(str) -
Parses a string into a PropList.
+
Parses a string into a PropList.

Parameters:

@@ -834,7 +834,7 @@
type - PropList + PropList
@@ -1014,7 +1014,7 @@
type - proplist + proplist
@@ -1029,7 +1029,7 @@ diff --git a/modules/pulseaudio.volume.html b/modules/lua_libpulse_glib.volume.html similarity index 95% rename from modules/pulseaudio.volume.html rename to modules/lua_libpulse_glib.volume.html index d8d8107..e5349ac 100644 --- a/modules/pulseaudio.volume.html +++ b/modules/lua_libpulse_glib.volume.html @@ -18,11 +18,11 @@