summaryrefslogtreecommitdiffstats
path: root/src/multimedia/audio/qsoundeffect_pulse_p.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PulseAudio: make sound effect implementation more robustYoann Lopes2016-12-121-16/+94
| | | | | | | | | | | | - Always lock the pulse thread when modifying variables that are also used in callbacks (prevents concurrent access). - Improved handling of repeated calls to setSource(). - Don't try to write to the device when there is nothing to write. - Stop the Pulse thread when there are no sound effects in use anymore. Task-number: QTBUG-55735 Change-Id: I5e1c6beab89fdbb98707f5fcbb539dddea9a333f Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Cleanup all maemo/meego specific codeLars Knoll2016-11-141-74/+0
| | | | | Change-Id: I6c6f28084c6b030928eebc53c5d0009b168ede6a Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Yoann Lopes2016-09-221-14/+47
|\ | | | | | | Change-Id: I5bce2843ac62bb97efc1ccaaa9c671c4adf10640
| * PulseAudio: make code more robustYoann Lopes2016-09-211-14/+47
| | | | | | | | | | | | | | | | | | | | Some asynchronous operations return a pa_operation pointer, which can be null if the operation fails. In some cases we were not checking that the returned object was non null, leading to some asserts being raised in pa_operation_unref. Change-Id: Iff1cc67b7f79b758fa81d79e658debb1d737b29f Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-271-8/+41
|\| | | | | | | Change-Id: I639d42e78a2b85e939c9f8e9dd5da70cdc058857
| * PulseAudio (QSoundEffect): don't write data to an unready streamYoann Lopes2016-08-151-0/+4
| | | | | | | | | | | | | | | | The PulseAudio stream must be ready to write data to it, otherwise an assert is raised. Change-Id: Iaa108124a135b018aa84845a37665895a005f380 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
| * PulseAudio: flush stream before loading a new source in a sound effectYoann Lopes2016-08-151-8/+37
| | | | | | | | | | | | | | | | | | When loading a new QSoundEffect source, the data in the stream must be flushed to avoid that the old source plays right before the new one. Task-number: QTBUG-48982 Change-Id: Iff14884edb2fb4851f93e67ff8191b77ebb16359 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-211-162/+52
|\| | | | | | | Change-Id: Ieb1a3081907093e31e8c8b7f95993bb3b2173672
| * PulseAudio: change the way volume is applied.Yoann Lopes2016-03-161-162/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to change the PulseAudio sink input volume. Doing so had some potential unwanted side effects depending on the PulseAudio server configuration. When flat volumes were enabled, it would affect the global system volume. It could also affect the volume of other streams having the same audio role. Volumes in Qt Multimedia are supposed to be relative to the application volume and should not affect anything else than the object on which it was changed. To guarantee that, PulseAudio volume APIs are not used anymore. Instead, software-based volume attenuation is applied on the audio samples before being passed to PulseAudio. Applies to QSoundEffect, QAudioOutput and QAudioInput. Task-number: QTBUG-40823 Task-number: QTBUG-49461 Change-Id: I690716976bda8fe666969ca2cbdf6d8d0b419733 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* | Updated license headersAntti Kokko2016-01-191-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I324f65c61171f36641472964d095d72e452afb3a Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Remove stray <QtNetwork> includesAndrew Knight2015-03-301-1/+1
| | | | | | | | Module includes slow down the build when PCH is disabled, so don't use them. Change-Id: Ic0bf0d938ef06dea9dba6897df592311230a6529 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* Update copyright headersAntti Kokko2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I1c6faa4f59f8eca54f01ef20941fa60161dd7872 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
* Update license headers and add new license filesAntti Kokko2014-08-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: Ied06887225df341064c12bcc14c259ae74116f2e Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Set volume only if volume was explicitly set.Robin Burchell2014-08-041-3/+13
| | | | | | Change-Id: I0d5abab0ffbf61a74c59ce240fd39e756479026b Done-with: Juho Hämäläinen <juho.hamalainen@tieto.com> Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
* Resource policy support for QSoundEffect.Robin Burchell2014-08-041-1/+30
| | | | | | | | | | | | | | | | | | Since sound effects are something short and mixed with other audio, do not acquire resources explicitly. Follow the resources availability information to determine when it is ok to play the sound effects. When client has registered itself to resource manager, client's streams are classified properly. If no higher priority client has acquired the resources, isAvailable() is true, and sound effects can be played. We do not explicitly acquire the resources, since then other clients with the same resource class would lose the resources, thus not possible to have second client play music with QMediaPlayer class while our client would just want to play simple sound effects. Change-Id: Ib5589349dca6900a8bee616b8ad77e7cb5ec9533 Done-with: Juho Hämäläinen <juho.hamalainen@tieto.com> Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
* QSoundEffect: fix changing the loop count while playing.v5.3.0-alpha1Yoann Lopes2014-02-251-1/+3
| | | | | | | | | | | | The running count was not updated with the new value. Auto-test added and documentation updated to be more clear about this behavior. Task-number: QTBUG-36643 Change-Id: I29e98ca4679f950a75133b21873738bcb72d23d4 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* QSoundEffect: Don't try guess a media role if one has not been provided.Robin Burchell2014-02-071-5/+1
| | | | | | | | | Trying to heuristically guess this kind of thing is almost always a bad idea. Expect the creator of the output to explicitly tell us the category instead of guessing. Change-Id: I5f2988e2456685f3622e0ab136951b1742215f71 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* PulseAudio: fix crash when failing to create a context.Yoann Lopes2014-01-061-2/+3
| | | | | | | | | | Don't try to call a function on a null PulseAudio context. If pa_context_new() fails, we now try again to connect to the pulse audio daemon later. Task-number: QTBUG-35456 Change-Id: I0b848d3f25f57651ab31b9eca7ceb1bc9df2f682 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
* Don't use integers to describe volume internally in QSoundEffect.Christian Strømme2013-11-281-4/+4
| | | | | | | | | The public api takes floating point values and so does most of the back- ends. Conversion should be done in the back-ends that expect other value types to avoid unnecessary float -> int -> float conversions. Change-Id: I0ee1bfbe350f985294c20f897ffa3bd55288b4c9 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Make PulseAudio implementation of QSoundEffect more robust.Yoann Lopes2013-07-251-8/+46
| | | | | | | | | | | | | It was crashing when the PulseAudio daemon was not running or was killed. When the connection to the daemon fails (or is terminated), it now tries to reconnect every 30 seconds. Sounds created before a connection loss will be recreated after reconnection. Task-number: QTBUG-32487 Change-Id: Ia63707aa5c70434b834b3079a9950a9b35057b26 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: Ia8c1c38aba1544603fada8c414cc856f365fd15b Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix a possible crash in QSoundEffect.Robin Burchell2012-11-091-1/+3
| | | | | | | | | | pa_stream_cork may fail, and pa_operation_unref won't handle that gracefully, so check the return value before unreffing. Done-with: Vesa-Matti Hartikainen Change-Id: If789e37a13f85487c79dd8a03a7ca3624b1412d2 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Andras Becsi <andras.becsi@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-241-24/+24
| | | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Id77334cfb15de096941c88e32d04ca07b4eb4709 Reviewed-by: Janne Anttila <janne.anttila@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Delete obsolete class methods and update related codeMithra Pattison2012-07-101-2/+2
| | | | | | | | Delete obsolete methods from QAudioFormat and QAudioDeviceInfo and update code that relied on the obsolete methods. Change-Id: I007e36375a45399b1d5a289341bc5d5a05dc68cc Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
* Change uses of {to,from}Ascii to {to,from}Latin1Thiago Macieira2012-05-041-1/+1
| | | | | | | | | | This operation should be a no-op anyway, since at this point in time, the fromAscii and toAscii functions simply call their fromLatin1 and toLatin1 counterparts. Task-number: QTBUG-21872 Change-Id: Ic591779a3431999c007fb0ff362c7e25ce54097e Reviewed-by: Jonas Rabbe <jonas.rabbe@gmail.com>
* Fix a compiler warning.Michael Goddard2012-04-271-1/+1
| | | | | | Change-Id: If82ec145b9076c1418460fa4d59595e0a60e5a0f Reviewed-by: Jun Zhu <jun.5.zhu@nokia.com> Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
* Fix a possible stale pointer access if we can't connect to PulseAudio.Michael Goddard2012-04-271-2/+11
| | | | | | | | | | | We free the mainloop but didn't check validity before calling lock or unlock. Also we might need to unlock the main loop before freeing it in some other error cases. Change-Id: Iadf1049324cdf37ca9841b82e53e33afdcba8cb2 Reviewed-by: Jun Zhu <jun.5.zhu@nokia.com> Reviewed-by: Lev Zelenskiy <lev.zelenskiy@nokia.com> Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
* Do not try to complete flush operation if stream has changed.Lev Zelenskiy2012-04-251-3/+9
| | | | | | | | | | | | | | | There is a problem when sound effect already has a sound loaded and we try to load new sound with setSource(). When sampleReady() is called between emptyStream() and emptyComplete() it unloads the current stream and creates a new stream. As a result pulse audio crashed in emptyComplete() while calling pa_operation_unref(pa_stream_cork( m_pulseStream, 1, stream_cork_callback, m_ref->getRef())) with the new m_pulseStream. Change-Id: Idff4fe6037d3f3f116734dc0facabaafa3db14a2 Reviewed-by: Michael Goddard <michael.goddard@nokia.com> Reviewed-by: Ling Hu <ling.hu@nokia.com>
* Expose the audio category information for streams.Michael Goddard2012-04-161-3/+41
| | | | | | | | | | | QAudioOutput and QSoundEffect now have a category property so that system volume mixing or processing can be applied. Initially just pulseaudio supports this but Windows Vista etc should also work. Change-Id: I6855b08367e5a055ac7dfcffd644c98bfd7c5a4e Reviewed-by: Ling Hu <ling.hu@nokia.com>
* Rename the daemon global static to pulseDaemonThiago Macieira2012-03-251-15/+15
| | | | | | | There's a daemon() function declared in unistd.h. Change-Id: I1063e71248a5236a5bb6b8f10804c469c8d1f788 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Use a PA function to compare specs instead of memcmp.Michael Goddard2012-02-171-1/+1
| | | | | | | | Otherwise valgrind complains a lot. Probably holes in the spec structure. Change-Id: I9580a73255820f49c0ac947eed1595a758f19ccd Reviewed-by: Ling Hu <ling.hu@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I20e5215108c6ebd5f8474fed5c3665118e4791e6 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update obsolete contact address.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: Ie8cd560b6d9a2c6e552b6be1ad8bc96c80a6535c Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update year in Nokia copyright headers.Jason McDonald2012-01-121-1/+1
| | | | | | | Update headers from before 2011 that were missed in the previous commit. Change-Id: Ib0fd91a39ffc57117fe01280e34519c3f914fac0 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix for QSoundEffect crash bugMithra Pattison2012-01-061-1/+2
| | | | | | | | | | | | When multiple QSoundEffect instances play the same wav source file simultaneously, the system would crash due to some instances not waiting for the underlying pulse audio stream to complete its setup logic. QSoundEffect now waits for the stream to attain the correct state before playing the sound. Change-Id: Ib5a1e6bc3f1cc314054f9cdc89c10100ad546721 Reviewed-by: Ling Hu <ling.hu@nokia.com> Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
* Restructure the source code a little.Michael Goddard2012-01-051-0/+1100
Change-Id: I995b0fb33bdda7f01bf6266c1c50a1b17eba6760 Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>