Ask / Submit
3

QSoundEffect(pulseaudio): Error decoding sourc

asked 2014-08-14 19:34:22 +0300

FloR707 gravatar image

updated 2014-08-15 13:37:47 +0300

jiit gravatar image

Hi,

I am working on an App that should include sounds but I cannot get it to work. Here is what I did:

import QtMultimedia 5.0
Page {
  [..]
  SoundEffect {
        id: soundGong
        source: "../../sounds/gong.wav"
  }
}

I am working off the standard example. If I run the code I get the following error:

QSoundEffect(pulseaudio): Error decoding sourc

Can anyone tell me what I am doing wrong?

edit retag flag offensive close delete

2 Answers

Sort by » oldest newest most voted
0

answered 2014-08-14 20:41:31 +0300

I got this error in my code some days ago, but now I'm not getting it anymore and I don't know why. :/ I did exactly what you did. Try restarting the IDE and the phone! hahaha Who knows? :P

edit flag offensive delete publish link more
0

answered 2014-08-15 10:48:11 +0300

FloR707 gravatar image

I got it working. It is nice that Qt has a lot of documentation but the code examples are always so cryptic that it is hard to learn how to use them. After a endless search I accidentally found a solution in a Symbian tutorial. I would suggest that they add a section with things you should know to understand the help for a package as they do with Ubuntu.

So it is not possible to use a relative path in your code. The error message comes because it does not find the file. To make sure your (sound) files are attached to the project create a resource file. Therefore right click on the project name and choose "add" from the menu. In the dialog box select "Qt" and "Resource" and click okay. A new dialog opens asking for a prefix, here use "/". Now your project tree should have a new folder "Resources". Within that folder is a file called "resources.qrc". Double click it and you will get dialog allowing you to add resources such as images and sounds. Click "add" and then "file" and navigate to your file. Personally I add a resource or sounds folde right in my project folder where I already have stored the files I want to add to the project. Choose these files now to add them. They should appear in the main window now. To use a resource in your code do a right click on the file you want to use and choose "copy path" from the menu. Within your code you have to use the path like this:

source: "qrc:<paste path>"

This worked nicely for me because the audio files, images etc. get packaged with the project and you do not have to worry about getting your resources to the phone.

@Brundu: I think you got it working because you somehow managed to get the file to your phone.

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
1 follower

Stats

Asked: 2014-08-14 19:34:22 +0300

Seen: 4,087 times

Last updated: Aug 15 '14