featured work

Categories:

featured work

Content:

Text-To-Speech Expand to full view

C++ Mp3 player - part 2

Here we continue expanding the functionality of the mp3 player with simple control buttons.

updated code for the the player:

#include "mp3player.h"
#include "ui_mp3player.h"
#include <QMediaPlayer>
#include <QFileInfo>

mp3player::mp3player(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::mp3player)
{
    ui->setupUi(this);
}

mp3player::~mp3player()
{
    delete ui;
}

void mp3action (int action)

{

    static QMediaPlayer* player = new QMediaPlayer;

    player->setMedia(QUrl::fromLocalFile("C:/music.mp3"));
    player->setVolume(50);

    if (action == 1)
    {
        player->play();

    }

    if (action == 2)

    {

        player->stop();

    }


}
void mp3player::on_Play_clicked()
{
    int action = 1;
    ::mp3action(action);
}

void mp3player::on_Stop_clicked()
{
    int action = 2;
    ::mp3action(action);
}
tags:


Print Friendly and PDF

Please authenticate to bookmark

1 Votes (10) Average Rating
734 Views
Date Created 2014-04-30
Author : fb-fac3b0ok 
  
Report

There are no comments yet!


Sorry! You need to register and loggin before you can comment.