c++ - QSound Unexpected null receiver while playing .wav files -
i play .wav samples of engine through out qt creator. of course first thought on qsound class, did whatever necessary play , shows me
qcoreapplication::postevent: unexpected null receiver which means entered wrong path file, seems simple have tried absoulte paths , etc. nothing new has happened.
sourcecode , photos, trying on windows run on raspberry(fedora).
#include <qcoreapplication> #include <qsound> #include <iostream> #include <qmediaplayer> int main(int argc, char *argv[]) { qcoreapplication a(argc, argv); qsound let("music/letitplay.wav"); let.play(); /*qmediaplayer * music = new qmediaplayer(); music->setmedia(qurl("qrc:/sounds/letitplay.wav")); music->play(); */ return 0; } snippet .pro
qt += core qt -= gui qt += multimedia target = silnik1 config += console config -= app_bundle template = app sources += main.cpp resources +=
qsound plays sounds asynchronously; you're going need start qcoreapplication first there's event loop running.
Comments
Post a Comment