The previous time C + + lesson set, decided to do a player, so reference to the code on the Internet, did a very primitive music player (only write the MP3 format) out, although the function is very little, but still decided to record the process.
Finished products such as:
Player Features:
- Top, Next, Volume control
- Single and list loop, shuffle mode
- Add songs (because lazy, even delete songs are not written)
The technology used:qt5,c++.
The entire program inherits Qt's Qwidget complete, the interface uses the QSS adornment (QSS syntax and the CSS almost exactly the same), the entire player mainly relies on the QT multimedia to complete the music decoding and the broadcast. Qmediaplayer is used to parse audio files, qmediaplaylist as a media playlist, save the path of the media (without writing the database to save the song, just read the local path), this class also comes with the playback mode.
Qmediaplaylist as a media playlist, save the path to the media.
* This class has a function, void Setplaybackmode (Playbackmode mode),
* While enum Playbackmode {currentitemonce, currentiteminloop, sequential, Loop, Random}
* Play once, single loop, order, list loop, shuffle.
The button is created with Qpushbutton and the external resource is loaded to decorate the button's appearance through QSS.
The volume and music progress bar is created with Qslider, and the music progress time is done with Qlabel (a class that can place images, text, and so on) and Qtimer (timers).
The song playlist on the picture is created with Qlistwidget, and the song name is obtained by qfileinfo the local path. Originally wanted to rewrite the right mouse button function to add, delete, play songs, but ultimately because lazy, did not write .
qt5:c++ implementation of multimedia-based music player (order)