×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    12

    Correct way to access file:///mysound.wav

    Hi,
    I am having no success trying to access my sound.wav
    In researching it seems you cannot add a sound file to a qrc resource.
    So this is my try at a work around. I have tried a few other things I've found on the net
    regarding this . But they didn't work. I have two apps that were finished months ago all but
    getting the sound too work. They need the sound !!!

    I can see my sound file on the phone!!!!!!

    In my pro file
    folder_01.source = qml/testapp/sound/mysound.wav
    DEPLOYMENTFOLDERS = folder_01

    viewer.setSource(QUrl("qrc:/qml/testapp/main.qml"));

    Sound only works using viewer.setMainQmlFile(QLatin1String("qml/SteamPunkCalculator/main.qml")

    --------------------------------------------------------------------------------------------------
    On install the file 'mysound.wav" is successfully installed into F:\private\0xE76C5555\mysound.wav

    I can not find the url to get to it................

    In my qml I have tried a few things. and spent a couple of days on this. some of the examples
    Audio {
    id: playSound
    volume: 1.0
    source: "file:///mysound.wav"

    //source: "QUrl(mysound.wav)"
    // source: "../../mysound.wav"
    //source: "file: sound/mysound.wav"
    // source: "sound/mysound.wav"
    playing: true;
    }

    I setup my QT creator environment so all my testing apps get installed on the SD card so my phone doesn't get mucked up by the constant installing and uninstalling. I don't know whether that makes a difference in finding the wav file I should not think so?

    Thanks for looking and hopefully some help.

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,004

    Re: Correct way to access file:///mysound.wav

    Quote Originally Posted by FOXtion View Post
    Hi,
    I am having no success trying to access my sound.wav
    In researching it seems you cannot add a sound file to a qrc resource.
    So this is my try at a work around. I have tried a few other things I've found on the net
    regarding this . But they didn't work. I have two apps that were finished months ago all but
    getting the sound too work. They need the sound !!!

    I can see my sound file on the phone!!!!!!

    In my pro file
    folder_01.source = qml/testapp/sound // mention only folder name(not file)
    DEPLOYMENTFOLDERS = folder_01

    viewer.setSource(QUrl("qrc:/qml/testapp/main.qml"));

    Sound only works using viewer.setMainQmlFile(QLatin1String("qml/SteamPunkCalculator/main.qml")

    --------------------------------------------------------------------------------------------------
    On install the file 'mysound.wav" is successfully installed into F:\private\0xE76C5555\mysound.wav

    I can not find the url to get to it................

    In my qml I have tried a few things. and spent a couple of days on this. some of the examples
    Audio {
    id: playSound
    volume: 1.0
    source: "sound/mysound.wav" // this should do, i used it a same way
    playing: true;
    }

    I setup my QT creator environment so all my testing apps get installed on the SD card so my phone doesn't get mucked up by the constant installing and uninstalling. I don't know whether that makes a difference in finding the wav file I should not think so?

    Thanks for looking and hopefully some help.
    Notice the text changes & try changing them in your code accordingly. Even then if it is not working, then there might be some issue with the file play code.

  3. #3
    Registered User
    Join Date
    Nov 2011
    Posts
    12

    Re: Correct way to access file:///mysound.wav

    Thank you for your answer, I tried your suggestion and it didn't work. Have spent another day working on this.
    Create another blank test app instead of sound just trying to get one image to load OUTSIDE the qrc resource file.
    Get anything to load externally.......

    Code:
      viewer.setSource(QUrl("qrc:/qml/testingQRC/main.qml"));
    In the main.qml I have just one image

    Code:
    Image {
          id: tempImage
          x: 61
          y: 230
          source: "Icon.png"
        }
    The compiler error
    Code:
    qrc:/qml/testingQRC/main.qml:24:5: QML Image: Cannot open: qrc:/qml/testingQRC/Icon.png
    It is looking for the file in the qrc resource file. (which it isn't there as the attempt is to load external file outside resource)
    I then have added to the pro file like so
    OTHER_FILES += \
    qml/testingQRC/Icon.png (throws same error as above)

    new attempts
    Code:
    source: "file:Icon.png"    Compiler error QML Image: Cannot open: file:Icon.png
    source: "file:/Icon.png"            Compiler error QML Image: Cannot open: file:///Icon.png
    and I've tried all variations of file: /// or // or ../ or ../../
    When I use source: file:Icon.png there is no wriggly line so qt creator sees the file.

    Every where I have read says I should just add file:/ and it will work....
    I found this link querying the same problem
    https://bugreports.qt-project.org/browse/QTBUG-15438
    It states
    The correct behaviour is that a "file:/" is required.
    as sound can not be added to qt resource file and then play on phone, it needs to be added externally.
    Very frustrating.....

    So any ideas? or does anyone have code that actually works, that I could try?

    I am on win7 and

Similar Threads

  1. correct header file for accelerometer
    By robinbartels in forum Symbian
    Replies: 3
    Last Post: 2009-10-12, 08:33
  2. Replies: 4
    Last Post: 2009-07-14, 13:47
  3. xhtml - correct file name
    By boredom2 in forum Browsing and Mark-ups
    Replies: 2
    Last Post: 2003-06-02, 06:57
  4. cannot create correct smil file by golive6.0
    By zhlp in forum General Messaging
    Replies: 2
    Last Post: 2002-07-05, 02:13
  5. How can I find the correct Lib file????
    By Nokia_Archive in forum Symbian
    Replies: 1
    Last Post: 2002-06-01, 20:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×