Audio Qml Failure












0















I'm trying to add background music to a small application. I'm using Window7 and MinGW but I get this error:




ASSERT: "!url.isRelative() && (QQmlFile::urlToLocalFileOrQrc(url).isEmpty() || !QDir::isRelativePath(QQmlFile::urlToLocalFileOrQrc(url)))" in file qmlqqmltypeloader.cpp, line 1639
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.




This is the code:



import QtQuick 2.0
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtMultimedia 5.8

Rectangle {
id: main
width: 600
height: 400
state: "mainMenu"
property int margePixel: 30
property int tailleInfoJeux: 200

Image {
id: background
source:"qrc:/images/mainbkg"
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
sourceSize.height: 800
}

MediaPlayer{
id: musicBkg
source: "file:///Users/COMPUTER/Documents/candycrush/candy-crush-like-master/sound/bkg1.wav"
autoLoad: true
autoPlay: false
volume: 1.0
loops: Audio.Infinite

Component.onCompleted: {
//console.log(source==Qt.resolvedUrl("file:///Users/COMPUTER/Documents/candycrush/candy-crush-like-master/sound/Kalimba.mp3"))
console.log(musicBkg.supportedAudioRoles())
}
}
}


this is the .pro file



# Add more folders to ship with the application, here
folder_01.source = qml/SweetCandy
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01

# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =

# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp
bonbon.cpp
niveau.cpp
case.cpp
controleur.cpp

# Installation path
# target.path =
QT += multimedia
# Please do not modify the following two lines. Required for deployment.
include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
qtcAddDeployment()

OTHER_FILES +=
qml/SweetCandy/main.qml
qml/SweetCandy/VueBonbon.qml
qml/SweetCandy/VueCase.qml

HEADERS +=
bonbon.h
niveau.h
case.h
controleur.h

RESOURCES +=
ressources.qrc

ICON = SweetCandyIconeLinux.png
macx: ICON = SweetCandyIconeMac.icns
win32: RC_FILE = SweetCandy.rc









share|improve this question





























    0















    I'm trying to add background music to a small application. I'm using Window7 and MinGW but I get this error:




    ASSERT: "!url.isRelative() && (QQmlFile::urlToLocalFileOrQrc(url).isEmpty() || !QDir::isRelativePath(QQmlFile::urlToLocalFileOrQrc(url)))" in file qmlqqmltypeloader.cpp, line 1639
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.




    This is the code:



    import QtQuick 2.0
    import QtQuick.Controls 1.1
    import QtQuick.Controls.Styles 1.1
    import QtMultimedia 5.8

    Rectangle {
    id: main
    width: 600
    height: 400
    state: "mainMenu"
    property int margePixel: 30
    property int tailleInfoJeux: 200

    Image {
    id: background
    source:"qrc:/images/mainbkg"
    anchors.fill: parent
    fillMode: Image.PreserveAspectCrop
    sourceSize.height: 800
    }

    MediaPlayer{
    id: musicBkg
    source: "file:///Users/COMPUTER/Documents/candycrush/candy-crush-like-master/sound/bkg1.wav"
    autoLoad: true
    autoPlay: false
    volume: 1.0
    loops: Audio.Infinite

    Component.onCompleted: {
    //console.log(source==Qt.resolvedUrl("file:///Users/COMPUTER/Documents/candycrush/candy-crush-like-master/sound/Kalimba.mp3"))
    console.log(musicBkg.supportedAudioRoles())
    }
    }
    }


    this is the .pro file



    # Add more folders to ship with the application, here
    folder_01.source = qml/SweetCandy
    folder_01.target = qml
    DEPLOYMENTFOLDERS = folder_01

    # Additional import path used to resolve QML modules in Creator's code model
    QML_IMPORT_PATH =

    # The .cpp file which was generated for your project. Feel free to hack it.
    SOURCES += main.cpp
    bonbon.cpp
    niveau.cpp
    case.cpp
    controleur.cpp

    # Installation path
    # target.path =
    QT += multimedia
    # Please do not modify the following two lines. Required for deployment.
    include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
    qtcAddDeployment()

    OTHER_FILES +=
    qml/SweetCandy/main.qml
    qml/SweetCandy/VueBonbon.qml
    qml/SweetCandy/VueCase.qml

    HEADERS +=
    bonbon.h
    niveau.h
    case.h
    controleur.h

    RESOURCES +=
    ressources.qrc

    ICON = SweetCandyIconeLinux.png
    macx: ICON = SweetCandyIconeMac.icns
    win32: RC_FILE = SweetCandy.rc









    share|improve this question



























      0












      0








      0








      I'm trying to add background music to a small application. I'm using Window7 and MinGW but I get this error:




      ASSERT: "!url.isRelative() && (QQmlFile::urlToLocalFileOrQrc(url).isEmpty() || !QDir::isRelativePath(QQmlFile::urlToLocalFileOrQrc(url)))" in file qmlqqmltypeloader.cpp, line 1639
      Invalid parameter passed to C runtime function.
      Invalid parameter passed to C runtime function.




      This is the code:



      import QtQuick 2.0
      import QtQuick.Controls 1.1
      import QtQuick.Controls.Styles 1.1
      import QtMultimedia 5.8

      Rectangle {
      id: main
      width: 600
      height: 400
      state: "mainMenu"
      property int margePixel: 30
      property int tailleInfoJeux: 200

      Image {
      id: background
      source:"qrc:/images/mainbkg"
      anchors.fill: parent
      fillMode: Image.PreserveAspectCrop
      sourceSize.height: 800
      }

      MediaPlayer{
      id: musicBkg
      source: "file:///Users/COMPUTER/Documents/candycrush/candy-crush-like-master/sound/bkg1.wav"
      autoLoad: true
      autoPlay: false
      volume: 1.0
      loops: Audio.Infinite

      Component.onCompleted: {
      //console.log(source==Qt.resolvedUrl("file:///Users/COMPUTER/Documents/candycrush/candy-crush-like-master/sound/Kalimba.mp3"))
      console.log(musicBkg.supportedAudioRoles())
      }
      }
      }


      this is the .pro file



      # Add more folders to ship with the application, here
      folder_01.source = qml/SweetCandy
      folder_01.target = qml
      DEPLOYMENTFOLDERS = folder_01

      # Additional import path used to resolve QML modules in Creator's code model
      QML_IMPORT_PATH =

      # The .cpp file which was generated for your project. Feel free to hack it.
      SOURCES += main.cpp
      bonbon.cpp
      niveau.cpp
      case.cpp
      controleur.cpp

      # Installation path
      # target.path =
      QT += multimedia
      # Please do not modify the following two lines. Required for deployment.
      include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
      qtcAddDeployment()

      OTHER_FILES +=
      qml/SweetCandy/main.qml
      qml/SweetCandy/VueBonbon.qml
      qml/SweetCandy/VueCase.qml

      HEADERS +=
      bonbon.h
      niveau.h
      case.h
      controleur.h

      RESOURCES +=
      ressources.qrc

      ICON = SweetCandyIconeLinux.png
      macx: ICON = SweetCandyIconeMac.icns
      win32: RC_FILE = SweetCandy.rc









      share|improve this question
















      I'm trying to add background music to a small application. I'm using Window7 and MinGW but I get this error:




      ASSERT: "!url.isRelative() && (QQmlFile::urlToLocalFileOrQrc(url).isEmpty() || !QDir::isRelativePath(QQmlFile::urlToLocalFileOrQrc(url)))" in file qmlqqmltypeloader.cpp, line 1639
      Invalid parameter passed to C runtime function.
      Invalid parameter passed to C runtime function.




      This is the code:



      import QtQuick 2.0
      import QtQuick.Controls 1.1
      import QtQuick.Controls.Styles 1.1
      import QtMultimedia 5.8

      Rectangle {
      id: main
      width: 600
      height: 400
      state: "mainMenu"
      property int margePixel: 30
      property int tailleInfoJeux: 200

      Image {
      id: background
      source:"qrc:/images/mainbkg"
      anchors.fill: parent
      fillMode: Image.PreserveAspectCrop
      sourceSize.height: 800
      }

      MediaPlayer{
      id: musicBkg
      source: "file:///Users/COMPUTER/Documents/candycrush/candy-crush-like-master/sound/bkg1.wav"
      autoLoad: true
      autoPlay: false
      volume: 1.0
      loops: Audio.Infinite

      Component.onCompleted: {
      //console.log(source==Qt.resolvedUrl("file:///Users/COMPUTER/Documents/candycrush/candy-crush-like-master/sound/Kalimba.mp3"))
      console.log(musicBkg.supportedAudioRoles())
      }
      }
      }


      this is the .pro file



      # Add more folders to ship with the application, here
      folder_01.source = qml/SweetCandy
      folder_01.target = qml
      DEPLOYMENTFOLDERS = folder_01

      # Additional import path used to resolve QML modules in Creator's code model
      QML_IMPORT_PATH =

      # The .cpp file which was generated for your project. Feel free to hack it.
      SOURCES += main.cpp
      bonbon.cpp
      niveau.cpp
      case.cpp
      controleur.cpp

      # Installation path
      # target.path =
      QT += multimedia
      # Please do not modify the following two lines. Required for deployment.
      include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
      qtcAddDeployment()

      OTHER_FILES +=
      qml/SweetCandy/main.qml
      qml/SweetCandy/VueBonbon.qml
      qml/SweetCandy/VueCase.qml

      HEADERS +=
      bonbon.h
      niveau.h
      case.h
      controleur.h

      RESOURCES +=
      ressources.qrc

      ICON = SweetCandyIconeLinux.png
      macx: ICON = SweetCandyIconeMac.icns
      win32: RC_FILE = SweetCandy.rc






      qt audio qml






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 16 '18 at 11:33







      Diego

















      asked Nov 16 '18 at 8:23









      DiegoDiego

      34




      34
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Try this,



          source: "file:///c:UsersCOMPUTERDocumentscandycrushcandy-crush-like-mastersoundbkg1.wav"





          share|improve this answer
























          • Thank your for the reply. I tried with your suggestion but it doesn't work. It gives:DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x80040216 ()

            – Diego
            Nov 16 '18 at 9:53













          • it is either url problem or codec problem. Can you please check that wav file directory and also extension. if you are %100 sure that url is correct than you should change to mp3 and try again. if mp3 is working that means there is missing codec at your system.

            – Kerem
            Nov 16 '18 at 10:53











          • The Url i think is correct, i tried with Qt.resolvedUrl(...) and it returns true, I tried also with mp3 and ogg, same result

            – Diego
            Nov 16 '18 at 11:01











          • Could you provide project's .pro file please?

            – Kerem
            Nov 16 '18 at 11:12











          • I added the pro file, thank you

            – Diego
            Nov 16 '18 at 11:34











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333960%2faudio-qml-failure%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Try this,



          source: "file:///c:UsersCOMPUTERDocumentscandycrushcandy-crush-like-mastersoundbkg1.wav"





          share|improve this answer
























          • Thank your for the reply. I tried with your suggestion but it doesn't work. It gives:DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x80040216 ()

            – Diego
            Nov 16 '18 at 9:53













          • it is either url problem or codec problem. Can you please check that wav file directory and also extension. if you are %100 sure that url is correct than you should change to mp3 and try again. if mp3 is working that means there is missing codec at your system.

            – Kerem
            Nov 16 '18 at 10:53











          • The Url i think is correct, i tried with Qt.resolvedUrl(...) and it returns true, I tried also with mp3 and ogg, same result

            – Diego
            Nov 16 '18 at 11:01











          • Could you provide project's .pro file please?

            – Kerem
            Nov 16 '18 at 11:12











          • I added the pro file, thank you

            – Diego
            Nov 16 '18 at 11:34
















          0














          Try this,



          source: "file:///c:UsersCOMPUTERDocumentscandycrushcandy-crush-like-mastersoundbkg1.wav"





          share|improve this answer
























          • Thank your for the reply. I tried with your suggestion but it doesn't work. It gives:DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x80040216 ()

            – Diego
            Nov 16 '18 at 9:53













          • it is either url problem or codec problem. Can you please check that wav file directory and also extension. if you are %100 sure that url is correct than you should change to mp3 and try again. if mp3 is working that means there is missing codec at your system.

            – Kerem
            Nov 16 '18 at 10:53











          • The Url i think is correct, i tried with Qt.resolvedUrl(...) and it returns true, I tried also with mp3 and ogg, same result

            – Diego
            Nov 16 '18 at 11:01











          • Could you provide project's .pro file please?

            – Kerem
            Nov 16 '18 at 11:12











          • I added the pro file, thank you

            – Diego
            Nov 16 '18 at 11:34














          0












          0








          0







          Try this,



          source: "file:///c:UsersCOMPUTERDocumentscandycrushcandy-crush-like-mastersoundbkg1.wav"





          share|improve this answer













          Try this,



          source: "file:///c:UsersCOMPUTERDocumentscandycrushcandy-crush-like-mastersoundbkg1.wav"






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 16 '18 at 9:46









          KeremKerem

          5511




          5511













          • Thank your for the reply. I tried with your suggestion but it doesn't work. It gives:DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x80040216 ()

            – Diego
            Nov 16 '18 at 9:53













          • it is either url problem or codec problem. Can you please check that wav file directory and also extension. if you are %100 sure that url is correct than you should change to mp3 and try again. if mp3 is working that means there is missing codec at your system.

            – Kerem
            Nov 16 '18 at 10:53











          • The Url i think is correct, i tried with Qt.resolvedUrl(...) and it returns true, I tried also with mp3 and ogg, same result

            – Diego
            Nov 16 '18 at 11:01











          • Could you provide project's .pro file please?

            – Kerem
            Nov 16 '18 at 11:12











          • I added the pro file, thank you

            – Diego
            Nov 16 '18 at 11:34



















          • Thank your for the reply. I tried with your suggestion but it doesn't work. It gives:DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x80040216 ()

            – Diego
            Nov 16 '18 at 9:53













          • it is either url problem or codec problem. Can you please check that wav file directory and also extension. if you are %100 sure that url is correct than you should change to mp3 and try again. if mp3 is working that means there is missing codec at your system.

            – Kerem
            Nov 16 '18 at 10:53











          • The Url i think is correct, i tried with Qt.resolvedUrl(...) and it returns true, I tried also with mp3 and ogg, same result

            – Diego
            Nov 16 '18 at 11:01











          • Could you provide project's .pro file please?

            – Kerem
            Nov 16 '18 at 11:12











          • I added the pro file, thank you

            – Diego
            Nov 16 '18 at 11:34

















          Thank your for the reply. I tried with your suggestion but it doesn't work. It gives:DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x80040216 ()

          – Diego
          Nov 16 '18 at 9:53







          Thank your for the reply. I tried with your suggestion but it doesn't work. It gives:DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x80040216 ()

          – Diego
          Nov 16 '18 at 9:53















          it is either url problem or codec problem. Can you please check that wav file directory and also extension. if you are %100 sure that url is correct than you should change to mp3 and try again. if mp3 is working that means there is missing codec at your system.

          – Kerem
          Nov 16 '18 at 10:53





          it is either url problem or codec problem. Can you please check that wav file directory and also extension. if you are %100 sure that url is correct than you should change to mp3 and try again. if mp3 is working that means there is missing codec at your system.

          – Kerem
          Nov 16 '18 at 10:53













          The Url i think is correct, i tried with Qt.resolvedUrl(...) and it returns true, I tried also with mp3 and ogg, same result

          – Diego
          Nov 16 '18 at 11:01





          The Url i think is correct, i tried with Qt.resolvedUrl(...) and it returns true, I tried also with mp3 and ogg, same result

          – Diego
          Nov 16 '18 at 11:01













          Could you provide project's .pro file please?

          – Kerem
          Nov 16 '18 at 11:12





          Could you provide project's .pro file please?

          – Kerem
          Nov 16 '18 at 11:12













          I added the pro file, thank you

          – Diego
          Nov 16 '18 at 11:34





          I added the pro file, thank you

          – Diego
          Nov 16 '18 at 11:34




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53333960%2faudio-qml-failure%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Xamarin.iOS Cant Deploy on Iphone

          Glorious Revolution

          Dulmage-Mendelsohn matrix decomposition in Python