Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Sound and the using of the Resource system
Forum Updated to NodeBB v4.3 + New Features

Sound and the using of the Resource system

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 8.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    swhweng
    wrote on last edited by
    #1

    This post was split off from "this discussion":http://developer.qt.nokia.com/forums/viewthread/4453/ on certification; Andre

    A huge desire to develop Qt and it's usages further!
    It has all of potential to grow.
    For example:
    a) When they add support QSound class can read .wav files embedded into executable ( Qt Resources)?
    b) How can I put any .txt file into Resources ( embbed ) and read it via QFile?
    Pavel

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Any file that uses Qt's file access mechanisms can be read from the resource system. That certainly includes text files that you want to access via QFile. What don't you understand from the documentation on the Qt Resource System?

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on last edited by
        #3

        Yes, just use qt-creator's qrc editor or edit the file by hand to add in any file that you like.

        In your app just pass in a path prefixed with a ":" to access the file from the compiled in resources. ie:

        @
        QFile file( ":/path/to/my/sound.wav" );
        if ( !file.open( QIODevice::ReadOnly ) )
        return;

        // Play the file...
        @

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dangelog
          wrote on last edited by
          #4

          But please don't use QSound! :-)

          Software Engineer
          KDAB (UK) Ltd., a KDAB Group company

          1 Reply Last reply
          0
          • S Offline
            S Offline
            swhweng
            wrote on last edited by
            #5

            Hey!
            I specially ask when QSound() will open wav files from resources?
            That is the question when QSound class will work with .wav files from resource system.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              [quote author="Pavel Mazniker" date="1300194760"]Hey!
              I specially ask when QSound() will open wav files from resources?
              That is the question when QSound class will work with .wav files from resource system.[/quote]
              Probably the answer is "never". It is documented that QSound does not support loading from resources. QSound is not marked as such, but AFAIK it is basically deprecated. Use QtMultimedia or Phonon instead.

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                ZapB
                wrote on last edited by
                #7

                As Andre says, QSound does not support playing from resources. So either use QtMultimedia or -Phone- Phonon. Or submit a merge request in gitorious to make QSound support resources.

                Nokia Certified Qt Specialist
                Interested in hearing about Qt related work

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  swhweng
                  wrote on last edited by
                  #8

                  OK.

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved