Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pulse/pulse.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,24 @@ func (c *Context) MoveSourceOutputsByIndex(sourceOutputs []uint32, sourceIdx uin
})
}

// GetModuleList retrieves the list of loaded modules
func (c *Context) GetModuleList() (r []*Module) {
ck := newCookie()

c.safeDo(func() {
C._get_module_info_list(c.loop, c.ctx, C.int64_t(ck.id))
})

for _, info := range ck.ReplyList() {
module := info.data.(*Module)
if module == nil {
continue
}
r = append(r, module)
}
return
}

var (
__context *Context
__ctxLocker sync.Mutex
Expand Down
2 changes: 2 additions & 0 deletions pulse/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func NewPaInfo(data unsafe.Pointer, Type int) *paInfo {
info.data = toServerInfo((*C.pa_server_info)(data))
case C.PA_SUBSCRIPTION_EVENT_CARD:
info.data = toCardInfo((*C.pa_card_info)(data))
case C.PA_SUBSCRIPTION_EVENT_MODULE:
info.data = toModuleInfo((*C.pa_module_info)(data))
default:
// current didn't support this type
return nil
Expand Down
23 changes: 23 additions & 0 deletions pulse/wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,26 @@ type SampleSpec struct {
Rate uint32
Channels uint8
}

type Module struct {
Index uint32
Name string
Argument string
NUsed uint32
AutoUnload int // deprecated, but keep for completeness
PropList map[string]string
}

func toModuleInfo(info *C.pa_module_info) *Module {
if info == nil {
return nil
}
return &Module{
Index: uint32(info.index),
Name: C.GoString(info.name),
Argument: C.GoString(info.argument),
NUsed: uint32(info.n_used),
AutoUnload: int(info.auto_unload),
PropList: toProplist(info.proplist),
}
}