qt5:c++ implementation of multimedia-based music player (order)

Source: Internet
Author: User
Tags shuffle

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.