如何利用madplay移植后调音量管理自己的播放器,比如调节音量

解码器无旋钮调节音量,系统音量最高,播放器只能5%,难调,怎么破?_音频解码器吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:46贴子:
解码器无旋钮调节音量,系统音量最高,播放器只能5%,难调,怎么破?收藏
解码器没有旋钮调节音量,只能软件调节音量,如果 win7 系统音量(设备 扬声器 音量)100%不动, 那么播放器的音量就要调的非常低,windows media player 音量个位数,5%左右,这么低的音量,调节合适的音量,很困难, 5%太轻,6%太响. 如果 win7 系统音量(设备 扬声器 音量) 降低,比如降到80%,又可能损失音质.1. 这种左右为难的情况,怎么办? (最好有2级调节,比如: 专用数字音量调节软件,音量调到50%,那么播放器的音量就可以30%左右,音量轻响就容易调节了.)2. 解码器的驱动程序(如果有的话)和usb 接收驱动,能调音量吗?音质会损失吗?3. win7有没有通用的数字音量调节软件(算法优秀,音质损失小,不是简单的播放器)?各位高手多多指教!
想要找合作?想要操作项目?
高手??????
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或mini2440_mp3 基于 用madplay实现的MP3播放器,能够 上一首,下 ,暂停,音量调 Multimedia Develop 多媒体编程 238万源代码下载-
&文件名称: mini2440_mp3
& & & & &&]
&&所属分类:
&&开发工具: Visual C++
&&文件大小: 486 KB
&&上传时间:
&&下载次数: 0
&&提 供 者:
&详细说明:基于mini2440用madplay实现的MP3播放器,能够实现上一首,下一首,播放,暂停,音量调节-Mini2440 implementation using madplay based on the MP3 player, can realize a song, the next song, play, pause, volume adjustment
文件列表(点击判断是否您需要的文件,如果是垃圾请在下面评价投诉):
&&app-mp3.c&&key_driver.c&&madplay
&输入关键字,在本站238万海量源码库中尽情搜索:君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
音乐播放器的设计与实现
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口经过几天的努力,利用Qt4实现的前台界面,madplay实现的后台播放器总算是能正常运行了(在fs2410开发板上的运行界面如下),下面的笔记简要说明了实现方式。
&&&&&&&&&&&
1.main.cpp 文件
#include&QApplication&
#include"audio_player.h"
#include &QTranslator&
#include &QTextCodec&
int main(int argc, char *argv[])
&&& &&& QApplication app(argc, argv);
&&& &&& QTextCodec::setCodecForLocale(QTextCodec::codecForLocale());
&&& &&& QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK"));
&&& &&& QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK"));
&&& &&& audio_player myA
&&& &&& myAudio.setFont(QFont("wenquanyi",12,QFont::Normal));&& //设置字体
&&& &&& myAudio.show();
&&& &&& return app.exec();
2.Audio_player.h 文件
#ifndef _AUDIO_PLAYER_H_
#define _AUDIO_PLAYER_H_
#include&QtGui&
#include&QDir&
#include&QDialog&
#include&QString&
#include&QStringList&
#include&QFileDialog&
#include&QPalette&
#include&QToolButton&
#include&QHBoxLayout&
#include&QGridLayout&
#include&QSlider&
#include&QLabel&
#include&QTimer&
#include&QTime&
#include &unistd.h&
#include &stdio.h&
#include &stdlib.h&
#include &string.h&
#include &sys/ioctl.h&
#include &linux/soundcard.h&
#include &sys/types.h&
#include &sys/stat.h&
#include &sys/wait.h&
#include &fcntl.h&
struct Tag_Header{
&&&&&&& char Header[3];
&&&&&&& &&&&&&&
&&&&&&& char R
&&&&&&& char F
&&&&&&& char Size[4];
struct Tag_Trailer{
&&&&&&& char Header[3];
&&&&&&& char Title[30];
&&&&&&& char Artist[30];
&&&&&&& char Album[30];
&&&&&&& char Year[4];
&&&&&&& char Comment[28];
&&&&&&& char Cenre[1];
class audio_player : public QDialog
&&& &&& Q_OBJECT
&&& &&& audio_player(QWidget *parent = 0, Qt::WindowFlags f = 0);
&&& &&& void readInfo(QString file);
&&& &&& void Tag_GetTrailer(void);
&&& &&& void Tag_GetHeader(void);
private slots:
&&& &&& void slotStart();
&&& &&& void slotUp();
&&& &&& void slotDown();
&&& &&& void slotOpen();&&&
&&& &&& void slotGetVol();
&&& &&& void slotShowTime();
&&& &&& QToolButton *
&&& &&& QToolButton *
&&& &&& QToolButton *
&&& &&& QSlider *
&&& &&& QHBoxLayout *keyL
&&& &&& QGridLayout *mainL
&&& &&& QLabel *mp3T
&&& &&& QLabel *mp3A
&&& &&& QLabel *mp3A
&&& &&& QLabel *mp3T
&&& &&& QLabel *mp3L
&&& &&& QTimer *
&&& &&& QString fileN
&&& &&& QString fileP
&&& &&& QStringList musicL
&&& &&& QS
&&& &&& QS
&&& &&& QString Mp3Title_
&&& &&& Tag_Header Mp3H
&&& &&& Tag_Trailer Mp3T
&&& &&& int nC
&&& &&& &&
&&& &&& FILE *
3.Audio_player.cpp 文件
&&& #include"audio_player.h"
int tm =0;&&&&&&&&&&& //分钟
int ts =0;&&&&&&&&&&& //秒
audio_player::audio_player(QWidget *parent, Qt::WindowFlags f)
&&&&&&& : QDialog(parent, f)&&&
&&& &&& QPalette p = this-&palette();
&&& &&& p.setColor(QPalette::Window,Qt::black);&& //设置背景色
&&& &&& this-&setPalette(p);
&&& &&& timer = new QTimer(this);
&&& &&& mainLayout = new QGridLayout(this);
&&& &&& keyLayout = new QHBoxLayout();&
&&& &&& mp3Title = new QL
&&& &&& mp3Art = new QL
&&& &&& mp3Album = new QL
&&& &&& mp3Time = new QL
&&& &&& mp3Length = new QL
&&& &&& mp3Length-&setText("04:23");
&&& &&& p.setColor(QPalette::WindowText,Qt::white);&& //设置前景色&&&
&&& &&& mp3Title-&setPalette(p);
&& &&&& mp3Art-&setPalette(p);
&&& &&& mp3Album-&setPalette(p);
&&& &&& mp3Time-&setPalette(p);
&&& &&& mp3Length-&setPalette(p);
&&& &&& start = new QToolB&&&&&&&&&&&&&&&&&&&&& //开始
&&& &&& start-&setText(tr("start"));
&&& &&& start-&setIcon(QPixmap(":/images/3.png"));
&&& &&& start-&setIconSize(QPixmap(":/images/3.png").size());
&&& &&& start-&setAutoRaise(TRUE);
&&& &&& start-&setToolButtonStyle(Qt::ToolButtonIconOnly);
&&& &&& up = new QToolB&&&&&&&&&&&&&&&&&&&&&&&& //上一曲
&&& &&& up-&setText(tr("up"));
&&& &&& up-&setIcon(QPixmap(":/images/1.png"));
&&& &&& up-&setIconSize(QPixmap(":/images/1.png").size());
&&& &&& up-&setAutoRaise(TRUE);
&&& &&& up-&setToolButtonStyle(Qt::ToolButtonIconOnly);
&&& &&& down = new QToolB&&&&&&&&&&&&&&&&&&&&& &&&&&&&//下一曲
&&& &&& down-&setText(tr("down"));
&&& &&& down-&setIcon(QPixmap(":/images/5.png"));
&&& &&& down-&setIconSize(QPixmap(":/images/5.png").size());
&&& &&& down-&setAutoRaise(TRUE);
&&& &&& down-&setToolButtonStyle(Qt::ToolButtonIconOnly);
&&& &&& slider = new QSlider(Qt::Horizontal);&&&& &&&&&&&&&&&//音量
&&& &&& slider-&setMinimum(40);
&&& &&& slider-&setMaximum(120);
&&& &&& slider-&setValue(80);
&&& &&& slider-&setTickPosition(QSlider::TicksBelow);
&&& &&& p.setColor(QPalette::Window,Qt::blue);
&&& &&& slider-&setPalette(p);&&&&&&&&&&
&&& &&& keyLayout-&addWidget(mp3Time);
&&& &&& keyLayout-&addWidget(up);
&&& &&& keyLayout-&addWidget(start);
&&& &&& keyLayout-&addWidget(down);
&&& &&& keyLayout-&addWidget(mp3Length);
&&&&&&&&&&&&&&&&&&
&&& &&& mainLayout-&addWidget(mp3Title,0,0,Qt::AlignHCenter);
&&& &&& mainLayout-&addWidget(mp3Art,1,0,Qt::AlignHCenter);
&&& &&& mainLayout-&addWidget(mp3Album,2,0,Qt::AlignHCenter);
&&& &&& mainLayout-&addWidget(slider,3,0);
&&& &&& mainLayout-&addLayout(keyLayout,4,0);
&&& &&& connect(start,SIGNAL(clicked()),this,SLOT(slotOpen()));
&&& &&& connect(up,SIGNAL(clicked()),this,SLOT(slotUp()));
&&& &&& connect(down,SIGNAL(clicked()),this,SLOT(slotDown()));
&&& &&& connect(slider,SIGNAL(valueChanged(int)),SLOT(slotGetVol()));
&&& &&& connect(timer,SIGNAL(timeout()),this,SLOT(slotShowTime()));
&&& &&& fd =::open("/dev/mixer", O_RDWR);&&&&&&& //打开mixer设备,用于音量调节
&&& &&& if (fd ==& - 1)
&&&&& &&&&& perror("unable to open /dev/mixer");
&&&&& &&&&& exit(1);
&&& &&& QDir dir("/mnt/udisk/mp3");&&&&&&&&&&&&&
&&& &&& filePath = tr("/mnt/udisk/mp3/");&&&&&&&&&&&&&&&&&&& //设置播放目录
musicList = dir.entryList(QDir::Files,QDir::Name);&& //遍历播放目录下的所有歌曲
&&& &&& nCount = musicList.size();&&&&&&&&&&&&&&&&&&&&&&&&&& //获得歌曲数目
&&& &&& fileName =& static_cast&QString&(musicList.at(0));&& //提取歌曲名称
&&& &&& command=tr("./sbin/madplay ");&&&&&&&&&&&&&
&&& &&& backend = tr(" &");&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //后台播放
&&& &&& setWindowTitle(tr("Madplayer"));&&&&&&&&&&&&&&&&&&& //设置窗口名称
&&& &&& slotStart();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //开始播放
&&& &&& this-&sizeHint();&&&
void audio_player::slotOpen()
&&& &&& QFileDialog fileDilog(this);&&&&&&&&&&&&&&&&&&&&& //建立文件对话框
&&& &&& QStringList openL
&&& &&& fileDilog.setFileMode(QFileDialog::AnyFile);
&&& &&& fileDilog.setDirectory (trUtf8("/mnt/udisk/mp3"));
&&& &&& fileDilog.setNameFilter(trUtf8("*.mp3"));&&&&&&&//仅显示 .mp3 文件&&&& &&&&
&&& &&& fileDilog.setViewMode(QFileDialog::List);&&&&&&&//以list方式显示
&&& &&& fileDilog.resize(320,240);&&&&&&&&&&&&&&&&&&&&&&//对话框尺寸&
&&& &&& if (fileDilog.exec())&&&
&&&&&&& &&& openList =fileDilog.selectedFiles();
&&& &&& fileName = static_cast&QString&(openList.at(0));&& //获取歌曲路径和名称
&&& &&& fileName.remove(0,15);&&&&&&&&&&&&&&& //移除15个字符的路径,得到歌曲名
&&& &&& system("killall -9 madplay");&&&&&&&& //关闭madplay 进程
&&& &&& slotStart();
int flag =1;
void audio_player::slotShowTime()
&&& &&& char disp_buf[5];
&&& &&& FILE *
&&& &&& char str[30];
&&&& && ts++;
&&&& && if(ts &= 60) {
&&&&&&& &&& tm++;
&&&&&&& &&& ts = 0;
&&&& && if(tm &= 60) {
&&&&&&& &&& tm = 0;
&&&&&&& &&& ts = 0;
&&& &&& sprintf(disp_buf,"%02d:%02d",tm,ts);
&&& &&& QString text = disp_
&&& &&& mp3Time-&setText(text);&&&&&&&&&&&&&&&&&&&&&&& //显示时间
&&&&&&& /* 查看当前进程列表中是否有 madplay 进程存在,如果不存在,说明当前歌曲播放完毕,则启动播放下一曲
&&&&&&& */
&&& &&& system("ps |pgrep -l madplay &/usr/run.dat");&
&&& &&& out = fopen ("/usr/run.dat", "r");&
&&& &&& fread (str, sizeof (str), 1, out);
&&& &&& printf("%snr",str);
&&& &&& if(str[0]&48 ) slotDown();
&&& &&& fclose (out);
void audio_player::slotGetVol()
&&& &&& int usr_
&&& &&& usr_volume = slider-&value();&&&&&&&&&&&&&&& //设置音量大小
&&& &&& ioctl(fd,MIXER_WRITE(0),&usr_volume);&&&&&&& //调节音量&&&& &&&
void audio_player::slotStart()
&& &&& char *S;
&&& &&& readInfo(fileName);
&&& &&& tm =0;
&&& &&& ts =0;
&&& &&& if(flag!=1)
&&&&&&&&&& {system("killall -9 madplay");flag = 1;}
&&& &&& else
&&& &&& {&&
flag=0;&&&&&&
&&&&&&&&&&& QString command_full =
&&& &&&&&&& command_full.append(filePath);
&&& &&&&&&& command_full.append(fileName);
&&& &&&&&&& command_full.append(backend);
&&& &&&&&&& S = (command_full.toAscii()).data();
&&& &&&&&&& printf("%snr",S);&&&
&&& &&&&&&& timer-&start(1000);&&&&&&& //设置定是器的时间为一秒
&&& &&&&&&& system(S);&&
void audio_player::slotUp()
&&& &&& QString command_full =
&&& &&& system("killall -9 madplay");&&&&&&&& //停止播放当前歌曲
&&& &&& index = musicList.indexOf(fileName);& //获取当前歌曲索引&
&&& &&& index--; &&&&&&&&&&&&&&&&&&&&&&&&&&&&&//获取上一曲索引
&&& &&& if(index & 0)
&&&&&&& &&& index = nCount-1;
&&&&&&& /* 根据上一曲索引找到上一曲文件名 */
&&& &&& fileName = static_cast&QString&(musicList.at(index));
&&& &&& flag = 1;&&&&&&
&&& &&& slotStart();&&&&&&& //播放
void audio_player::slotDown()
&&& &&& QString command_full =
&&& &&& system("killall -9 madplay");
&&& &&& index = musicList.indexOf(fileName);
&&& &&& index++;
&&& &&& if(index &(nCount-1))
&&&&&&& &&& index = 0;
&&& &&& fileName = static_cast&QString&(musicList.at(index));
&&& &&& flag = 1;
&&& &&& slotStart();
void audio_player::Tag_GetTrailer(void)
&&& &&& fseek(fp,-128L,SEEK_END);
&&& &&& fread(Mp3Trailer.Header,3,1,fp);
&&& &&& fseek(fp,-125L,SEEK_END);
&&& &&& fread(Mp3Trailer.Title,30,1,fp);
&&& &&& fseek(fp,-95L,SEEK_END);
&&& &&& fread(Mp3Trailer.Artist,30,1,fp);
&&&&& &&&&&
&&& &&& fseek(fp,-65L,SEEK_END);
&&& &&& fread(Mp3Trailer.Album,30,1,fp);
&&&&&&&&&&&&&&&
&&& &&& fseek(fp,-35L,SEEK_END);
&&& &&& fread(Mp3Trailer.Year,4,1,fp);
&&&&&&&&&&&&&&&&&&
&&& &&& fseek(fp,-31L,SEEK_END);
&&& &&& ment,28,1,fp);
&&&&&&&& &&&&&&&&&&&&&&&&&
&&& &&& fseek(fp,-1L,SEEK_END);
&&& &&& fread(Mp3Trailer.Cenre,1,1,fp);
&&& /* 读取mp3文件ID3标签 */
void audio_player::Tag_GetHeader(void)
&&& &&& fseek(fp,0,SEEK_SET);
&&& &&& fread(Mp3Header.Header,sizeof(Mp3Header.Header),1,fp);
&&&&&&&&&&&&&&&&& &&&&&&&&&&&
&&& &&& fseek(fp,3,SEEK_CUR);
&&& &&& fread(&Mp3Header.ver,sizeof(Mp3Header.ver),1,fp);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&& &&& fseek(fp,4,SEEK_CUR);
&&& &&& fread(&Mp3Header.Revision,sizeof(Mp3Header.Revision),1,fp);
&&&&&&&&&&&&&&&&&&&&&&&
&&& &&& fseek(fp,5,SEEK_CUR);
&&& &&& fread(&Mp3Header.Flag,sizeof(Mp3Header.Flag),1,fp);
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&& &&& fseek(fp,6,SEEK_CUR);
&&& &&& fread(Mp3Header.Size,sizeof(Mp3Header.Size),1,fp);
&&& /* 获取mp3文件信息 */
void audio_player::readInfo(QString file)
&&& &&& QString local_
&&& &&& char *S;
&&& &&& QString file_full = fileP
&&& &&& file_full.append(file);
&&& &&& S = (file_full.toAscii()).data();
&&&&&&& /* 以二进制格式打开当前文件进行分析 */
&&& &&& if((fp=fopen(S,"rb"))==NULL)
&&&&&&& &&& printf("ERROR:can't open the file!");
&&&&&&& &&& getchar();
&&&&&&& &&& exit(1);
&&& &&& Tag_GetTrailer();
&&& &&& Tag_GetHeader();
&&& &&& QS
&&& &&& sbuf = (tr(Mp3Trailer.Title)).section("&& " ,0,0);&&&
&&& &&& mp3Title-&setText(tr("%1").arg(sbuf,0));&&&&&&&&&& //mp3文件标题
&&& &&& sbuf = (tr(Mp3Trailer.Artist)).section("&& ",0,1);
&&& &&& mp3Art-&setText(tr("%1").arg(sbuf,0));&&&&&&&&&&&& //mp3 Artist
&&& &&& sbuf = (tr(Mp3Trailer.Album)).section("& ",0,1);
&&& &&& mp3Album-&setText(tr("%1").arg(sbuf,0));&&&&&&&&&& //mp3 Album
&&& &&& fclose(fp);
链接:http://blog.chinaunix.net/u3/108905/showart_2319016.html
注明:本文章属于转载,仅供行业人员学习交流使用,文章版权属于原创作者,在此向原创者致敬,感谢原创作者为大家学习交流提供精品内容。
站方声明:IThao123是为广大互联网从业者免费提供学习交流的平台,如果侵犯了原创著作权,请联系站方删除,给你带来不便,深表歉意。您所在位置: &
&nbsp&&nbsp&nbsp&&nbsp
基于网络地拳击机器人智能语音互动系统.pdf74页
本文档一共被下载:
次 ,您可全文免费在线阅读后下载本文档。
文档加载中...广告还剩秒
需要金币:200 &&
你可能关注的文档:
··········
··········
北京T、lp夫学T学顺l。学付论疋 Abstract T嫩sarticleintrodllcea robot whic_his iIl applied boxing trainir培systelll the of andentenaimentfield.It 如nctionS ,gymnasium possesses
professional datas,Voicehint,songpla≯ng,local
controlling垃ainingprocess,Collectingtrain主ng a11dsoon.Ita
contmlbaseontouch contr01 is practicalboxing screen,netwofking whichcaIlbeuscdtodo and
system professionaltraining,eXercisesplaytime. includePCaIldmicrocontroller.Microcontrollercontrol 1'11issVstem the仃ailling and data.Wecan onPCand p觚蚰eter
processcoIlect仃aining
desi印仃aining onePC controland multidevicebaseon
implements ,nchronous m锄age ne聃orking. hardware selectS3C24lOmicrocontrollerwhichisofmekenIel Onthe side,We andLinux2.6aSthe caniIlllanceme
ofARM920C0re system.It System operation a11d ofthe intlle如tllre.The conVenientextent sySteIll
perf0肌a11ce,suppon up黟ade
砒iclein乜.oducethewhole of锄beddedLinux enVironment。 process development UDAl341 and deCoderoflibmad
Selecting microChipMp3
library desi印a audio6le.Thismedia caIlbeusedand which to multim。dia playcr
player supportplay
controlled canusememedia to the内nctionof conVeIliencely.We
pla弦Irimplem锄t mcdia voicealld aumor ofme
play song.Thedesi踮theconn.011ingpr0铲觚Ⅱne alldLinux wi也Q1’/Embeddedpr0笋amlaIlguage.nrou曲mismethod,me
uscrcancontrolthe touchscreeIlinte渤cea11d nlis, by ke I boam.F0r playingproceed audio.
theaumor a solutionforthe aIldcon仃0lof inte蓼ated play proVide onme infomlation softwarewitllaS PC,designboxillg manag锄entsystem QT
me toolwhiCh include mode’ multi―pIat南胁.n profcssional developm饥t
exercisemodeandentertaimnent di行lerent arcdi丘.erent mode,there mode.According
methordsofs01utionalld t11edata of designmaIlagement.ItimplemelltmaJlagement
de啊ce resulta11dthehistoricaJ in南锄
正在加载中,请稍后...}

我要回帖

更多关于 madplay播放器 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信