[SailfishDevel] QAudioOutput and raw/pcm audio output

Thomas Perl th.perl at gmail.com
Mon Dec 16 21:46:09 UTC 2013


Hi,

2013/12/16 Andreas Enbacka <aenbacka at gmail.com>:
> What codes are supported currently on SailfishOS using QAudioOutput? In my
> QSpot application I am writing raw PCM audio directly (using push) to
> QAudioOutput, however I get absolutely no sound output (tested on the
> emulator, and also on SailfishOS port running on N950). Is this the expected
> behaviour, and in such case, are any solutions available?

Yes, this is expected behavior (at least when using libpulse directly,
haven't tested with QAudioOutput). You need to acquire audio playback
resources from the resource framework to play back audio. Also when
the resource framework tells you to stop playing audio (e.g. because
some higher-priority audio such as a phone call is coming in), you
should stop playing. This is not to annoy developers, but actually to
make sure only one application is using audio, and that third party
apps don't interfere with calls and media players and other things.

The library that will be supported in Harbour (i.e. you will be able
to link against it), but is not yet in the repositories is this one
(the plan is to also have a Qt wrapper for this library to expose
signals and slots for easy usage in Qt-based applications) is
libaudioresource:

https://github.com/nemomobile/libaudioresource/

libaudioresource is just a small, simplified wrapper around
libresource at the moment, but it will allow us to replace
libresource/OHM (the middleware used as backend for resource policy at
the moment) in the future without breaking third party applications
(by changing libaudioresource to use a different backend, but still
providing the same API).

There's already a package in Nemo Mobile if you want to start playing
with it right now:

https://build.merproject.org/package/show?package=audioresource&project=nemo:devel:mw

In the meantime (for testing and deployment), you can use libresource
and/or libresource-qt, but be aware that using these libraries
directly will not be possible for apps that plan to go to Harbour:

https://gitorious.org/maemo-multimedia/libresource
https://github.com/mer-packages/libresourceqt

Once you finished your app, you should be able to simply replace
libresource usage with libaudioresource and submit it to Harbour. If
you don't plan to submit your app to Harbour, you can use libresource
until it breaks with an update ;)


HTH :)
Thomas


More information about the Devel mailing list