[SailfishDevel] Problem with playing sounds in first application
Juho Hämäläinen
juho.hamalainen at tieto.com
Wed Feb 4 13:07:26 UTC 2015
On 04.02.2015 01:13, Luis Manuel Ramos Da Costa wrote:
> Hello Everyone,
>
> I've started developing for Jolla today, I am quite familiarez with the
> Qt/C++ language but not enough with the QML part.
>
> Audio {
> id : whipSound
> loops : Audio.Infinite
> source:"qrc:/sounds/resources/sounds/whipSound.flac"
> }
> }
> }
For this particular case if you are going to play your sample only once,
remove the "loops" part, with loops Audio.Infinite the sample will loop
indefinitely until the playback is stopped.
As to just playing short samples, SoundEffect is better suited to the
task. SoundEffect unfortunately doesn't accept flac files as source,
you'll need to use wav instead, but as the samples won't be long anyway
it's not that bad. Using SoundEffect the above code part would be
something like
SoundEffect {
id : whipSound
source : "qrc:/sounds/resources/sounds/whipSound.wav"
}
> And I have a problem with this. The song plays one time by taping on the
> picture (the song is a .flac file with 1second long of audio), and after
> that if I press the picture again it simply doesn't play.
This sounds like a bug (which I couldn't reproduce when quickly testing
(as you described it). I only saw that trying to play 1 second long flac
with Audio always failed, raising the length to 4s and the sample played
fine. Something is wrong anyway so I'll investigate more.
--
juho
More information about the Devel
mailing list