Fixed! Thanks again Sean.<br>Apologies for not copying to the list previously. G<br><br>---- Sean Greenslade wrote ----<br><br>(Re-added the list again. Please make sure to Reply-List or Reply-All<br>when responding to mailing list messages.)<br><br>On Tue, Feb 15, 2022 at 10:56:55AM +0000, Geoff Browne wrote:<br>> Great!  You cracked it Sean.<br>> <br>> > What user is the C code running as?<br>> <br>> Thank you Sean, I should have realised - it felt like something silly<br>> all along.  The current C code has to be run with root privileges at<br>> the moment due to the need to access various low-level control<br>> registers.  I'd assumed that with root privileges it would just work<br>> for any user, not realising that pulseaudio uses daemon sockets on a<br>> per-user basis.<br>> <br>> All I really want to do is to play short sine wave bleeps of varying<br>> frequency to the bluetooth speaker that i've paired with the Pi, maybe<br>> I'm making a mountain out of a molehill?<br><br>There is a way to get root to use your user's pulseaudio session. You<br>just need to point it to pulse's socket and connection cookie. This can<br>be done via environment variables. For example, I ran the following on<br>my machine:<br><br># PULSE_SERVER=/run/user/1000/pulse/native PULSE_COOKIE=/home/sean/.config/pulse/cookie pactl list<br><br>Of course, you will need to substitute your user's correct UID and home<br>directory path. You should be able to set environment variables with the<br>setenv() C function in stdlib.h.<br><br>--Sean<br><br>