package main

/*
#cgo CFLAGS: -I/usr/include/pipewire-0.3 -I/usr/include/spa-0.2
#cgo LDFLAGS: -lpipewire-0.3 -lm -lpthread
#include "pw_audio.h"
*/
import "C"

type DataSource struct {
	left  float64
	right float64
}

func NewDataSource() *DataSource {
	return &DataSource{}
}

func (ds *DataSource) Start() {
	C.pw_audio_start()
}

func (ds *DataSource) Stop() {
	C.pw_audio_stop()
}

func (ds *DataSource) GetLevels() (float64, float64) {
	var l, r C.float
	C.pw_audio_get_levels(&l, &r)
	return float64(l), float64(r)
}
