Skip to content

sclu1034/lua-libpulse-glib

Repository files navigation

lua-libpulse-glib

License Build Status (Concourse CI) LuaRocks Package

libpulse bindings for use with a GLib MainLoop via LGI.

The project is still in a development state. It hasn’t been fully tested yet, and not all functions from libpulse have a corresponding binding yet. Please do report anything that’s missing or not working correctly.

Quick Start

Install lgi and lua_libpulse_glib from LuaRocks:

luarocks install lgi
luarocks install --dev lua-libpulse-glib
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()