I've been trying to make an alarm clock lately in Qt since school is coming up. Anyhow, I made on about a year ago using an old version of Qt, and used Phonon for the sound, but Phonon is no longer included in Qt. I've tried using QtMultimedia, but it doesn't seem to work because I am missing the library file. If you know a way to play an audio file in Qt, it would be greatly appreciated if you tell me how.
相关问题
- Sorting 3 numbers without branching [closed]
- QML: Cannot read property 'xxx' of undefin
- Can we recover audio from MFCC coefficients?
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
相关文章
- ubuntu20.4中c#通过c++库调用python脚本
- Qt槽函数自动执行多遍
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
QSound can play wav files, QMultimedia is too heavy for this simple job. QSound is perfect solution for short alarm signals. The simplest way is to use static method
play()
QSound class from the QtMultimedia module provides the necessary functionality to play .wav files.
As for the missing library file, I suggest you reinstall Qt5.3 with the online installer. The Multimedia module should be installed automatically (or it may be optional).
Otherwise, if you are building from source, make sure to include the QtMultimedia library.