Thread
:
Making a metronome for the Jolla / Sailfish, trials and tribulations
View Single Post
krig
2014-01-06 , 22:26
Posts: 11 | Thanked: 33 times | Joined on Jan 2010 @ Sweden
#
1
Hey everyone,
As an exercise in learning Qt and figuring out if low latency audio works, I started making a simple metronome app.
Source here:
https://github.com/krig/metronom-sailfish
My conclusion so far: The OS is not quite ready for this yet.
I thought I'd write down what I've been doing here, so that it can help others that try to do the same thing in the future. The two main problems that I had will both hopefully be fixed in the next update.
First, I tried playing sound using the QML SoundEffect class which is part of the QtMultimedia package, and it works with only one issue: The system volume is bypassed, so the sound is always played at maximum volume.
To get around that problem, I started experimenting with using libpulse-simple to play sound, but I haven't gotten this to work. I suspect that maybe it needs a glib mainloop, because I can create the stream OK, but writing to it hangs. Maybe it's something obvious I'm doing wrong, comments from someone with more experience working with Pulseaudio are more than welcome.
The second problem is obtaining permission from the system to play sound, which should be done using libaudioresource, or libaudioresource-qt. Only problem there is that those libraries aren't actually on the device yet.
So right now my app is using libresourceqt5. Now, thanks to the previous bug in SoundEffect it doesn't really need to, but...
One thing that would be nice would be example apps in this area. Maybe a game which uses PulseAudio directly to play sound, and a Qt UI app which needs low-latency audio, like a drum machine for example.
More info on libaudioresource-qt can be found here:
https://github.com/nemomobile/libaud...ple/player.cpp
Quote & Reply
|
The Following 3 Users Say Thank You to krig For This Useful Post:
DrWilken
,
Jordi
,
lkravovicz
krig
View Public Profile
Send a private message to krig
Visit krig's homepage!
Find all posts by krig