• 大小: 3KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: 其他
  • 标签:

资源简介

提供了实现简单音频播放的audioplayer的类,需要看详细介绍的,可以到我的博客http://blog.csdn.net/mao19931004找关于QMediaplayer详解以及简易音乐播放实现的介绍

资源截图

代码片段和文件信息

#include “audioplayer.h“
#include
#include
#include
#include
#include
#include
#include
#includeyer>
#include
#include
#include“denoiser/denoiser.h“
#include
#include


audioplayer::audioplayer(QWidget *parent) : QWidget(parent)
{
    createWidgets();
QString style;
style = Uiload();
setstyleSheet(style);
}

void audioplayer::createWidgets()
{

    saveAudio =new QToolButton(this);
    saveAudio->setToolTip(tr(“Save Audio“));
    saveAudio->setIcon(QIcon(“:/images/save.png“));
    saveAudio->setstyleSheet(“background:transparent“);
    connect(saveAudioSIGNAL(clicked(bool))thisSLOT(saveAudioFile()));

    playButton = new QToolButton(this);
    playButton->setEnabled(false);
    playButton->setToolTip(tr(“Play“));
    playButton->setIcon(QIcon(“:/images/play.png“));
    connect(playButtonSIGNAL(clicked(bool)) this SLOT(togglePlayback()));


    forwardToolButton =new QToolButton(this);
    forwardToolButton->setToolTip(tr(“next“));
    forwardToolButton->setIcon(QIcon(“:/images/skipForward.png“));
    connect(forwardToolButtonSIGNAL(clicked(bool))thisSLOT(seekForward()));

    backwardToolButton =new QToolButton(this);
    backwardToolButton->setToolTip(tr(“Back“));
    backwardToolButton->setIcon(QIcon(“:/images/skipBackward.png“));
    connect(backwardToolButtonSIGNAL(clicked(bool))thisSLOT(seekBackward()));

    openfileButton = new QToolButton(this);
    openfileButton->setIcon(QIcon(“:/images/open.png“));
    openfileButton->setIconSize(QSize(2424));
    openfileButton->setstyleSheet(“background:transparent“);
    openfileButton->setToolTip(tr(“Open a file...“));
    openfileButton->setFixedSize(playButton->sizeHint());
    connect(openfileButtonSIGNAL(clicked(bool)) this SLOT(openFile()));

    positionSlider = new QSlider(Qt::Horizontal this);
    positionSlider->setEnabled(false);
    positionSlider->setToolTip(tr(“Seek“));
    connect(positionSlider SIGNAL(valueChanged(int)) this SLOT(setPosition(int)));


    infoLabel = new QLabel(this);
    positionLabel = new QLabel(tr(“00:00“) this);
    positionLabel->setMinimumWidth(positionLabel->sizeHint().width());


    denoiserWidget =new denoiser(this);
    connect(denoiserWidgetSIGNAL(ListenEmited())thisSLOT(onstartListened()));

    QHBoxLayout *controlLayout = new QHBoxLayout;
    controlLayout->setMargin(0);
    controlLayout->addWidget(openfileButton);
    controlLayout->addWidget(saveAudio);
    controlLayout->addWidget(positionSlider);
    controlLayout->addWidget(positionLabel);
    controlLayout->addWidget(playButton);
    controlLayout->addWidget(forwardToolButton);
    controlLayout->addWidget(backwardToolButton);

//QLineEdit *test = new QLineEdit(this);
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(infoLabel);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-06-16 14:19  audioplayer\
     文件        6481  2016-06-16 14:19  audioplayer\audioplayer.cpp
     文件        1352  2016-06-15 23:57  audioplayer\audioplayer.h

评论

共有 条评论