兄弟们帮帮忙,帮我将这段vb的程序用C语言写出来,并经那段英文反译成汉语,一定会重谢的!再线等待!!!!!

lengfenghongyu 2003-11-22 01:10:36

请翻译下文并将其用VC改造。传回翻译后的文件,和VC主要语句。

Deciphering(判读) MP3 Tag information with Visual Basic

The Windows Media Player provides an easy, quick way to drop MP3 capability i
nto a Visual Basic application. However, once you have an MP3, you may have wonde
red how to read information about the song, such as the song title and artist's n
ame. If the MP3 file uses the most popular tag encryption, ID3, then you're in lu
ck. This standard stores the Tag information in the last 128 bytes of the file (T
ag:3, Title:30, Artist:30, Album:30, Year:4, Comment:30, Genre:1)

To read this information, first open the MP3 file and grab the last 128 bytes
. With ID3, the first three slots hold the string TAG if the file actually contai
ns information. If the file does contain Tag information, store the last 128 byte
s in a custom variable. After that,cycle through the MP3 file, extracting informa
tion as you go. The following procedure shows the code that extracts this informa
tion as
well as creates several important variables to use later on:

Option Explicit
Private Type TagInfo
Tag As String * 3
Songname As String * 30
artist As String * 30
album As String * 30
year As String * 4
comment As String * 30
genre As String * 1
End Type

Dim FileName As String
Dim CurrentTag As TagInfo

Private Sub Form1_Load()
Dim temp As String
On Error Resume Next

FileName = App.Path & "\myMP3.mp3"
Open FileName For Binary As #1
With CurrentTag
Get #1, FileLen(FileName) - 127, .Tag
If Not .Tag = "TAG" Then
label8.Caption = "No tag"
Close #1
Exit Sub
End If
Get #1, , .Songname
Get #1, , .artist
Get #1, , .album
Get #1, , .year
Get #1, , .comment
Get #1, , .genre
Close #1

txtTitle = RTrim(.Songname)
txtArtist = RTrim(.artist)
txtAlbum = RTrim(.album)
txtYear = RTrim(.year)
txtComment = RTrim(.comment)

Temp = RTrim(.genre)
txtGenreCode = Asc(Temp)
Combo1.ListIndex = CInt(txtGenreCode) - 1
End With
End Sub

Notice that the code has to handle the genre character a little differently.
That's because ID3 stores this data as a single ASCII character. To match up the
actual number with its corresponding description -- say contained in a combobox--
the procedure converts the ASCII to a number, and then looks up that number in th
e combobox.


=============================================================



...全文
73 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
sevencat 2003-11-27
  • 打赏
  • 举报
回复
楼主以后找资料可以多找一点,MP3的中文资料可能也不少了。MP3的C代码可能更多了。
wyfsnn 2003-11-27
  • 打赏
  • 举报
回复
怎么解压具体的内容呀?
蝎子i软件 2003-11-26
  • 打赏
  • 举报
回复
用Borland C++ 5.5 Commandline编译并运行通过。
如果要用combobox的话,把genre数组里的字符串加到comobox里就行了。

另外,我的程序里并没有用到temp。

下面给出一个简单的Windows程序。
蝎子i软件 2003-11-26
  • 打赏
  • 举报
回复
程序:
==================================
#include <stdio.h>
#include <string.h>

struct TagInfo {
char Tag[3];
char Songname[30];
char artist[30];
char album[30];
char year[4];
char comment[30];
char genre;
};

char FileName[30]; //长度可变
struct TagInfo CurrentTag;
char *genres[]={
/* The following genres is defined in ID3v1 */
"Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
"Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
"Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska",
"Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient",
"Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical",
"Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise",
"AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative",
"Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave",
"Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream",
"Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap",
"Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave",
"Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal",
"Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll",
"Hard Rock",
/* The following genres are Winamp extensions */
"Folk", "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob",
"Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock",
"Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock",
"Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech",
"Chanson", "Opera", "Chamber Music", "Sonata", "Symphony",
"Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club",
"Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul",
"Freestyle", "Duet", "Punk Rock", "Drum Solo", "Acapella",
"Euro-House", "Dance Hall"
};

void main(){
char temp[20];
FILE *fin;

strcpy( FileName, "myMP3.mp3" ); //当前程序路径可省略
fin = fopen( FileName, "rb" );
if( fin==NULL ) {
printf("Openning %s failed!\n", FileName);
return;
}

fseek( fin, -128, SEEK_END );
fread( ¤tTag, sizeof(struct TagInfo), 1, fin );

if( CurrentTag.Tag[0]!='T' ||
CurrentTag.Tag[1]!='A' ||
CurrentTag.Tag[2]!='G' ) {
printf("No tag\n");
fclose( fin );
return;
}
printf("Tag Information\n");
printf("\tSong Name:\t%s\n", CurrentTag.Songname);
printf("\tArtist:\t%s\n", CurrentTag.artist);
printf("\tAlbum:\t%s\n", CurrentTag.album);
printf("\tYear:\t%.4s\n", CurrentTag.year);
printf("\tComment:\t%s\n", CurrentTag.comment);
printf("\tGenre:\t%s\n", genres[CurrentTag.genre]);
fclose(fin);
}
蝎子i软件 2003-11-26
  • 打赏
  • 举报
回复
译文:
=====================================
用Visual Basic解读MP3标记的信息
Windows Media Player提供了一个简单的、快速的方法,以使Visual Basic应用具备MP3的能力。不过,当你拿到一个MP3,你可能想知道怎样读取该歌曲的信息,例如歌名、

演唱者的名字等。如果该MP3文件使用的是最流行的标记加密标准,ID3,那你就走运了。这个标准将标记信息存储在文件的最后128个字节里(标记:3,标题:30,歌手:30

,专辑:30,年份:4,注释:30,类别:1)。
要读取这些信息,首先,打开该MP3文件,抓取最后128字节。对于ID3,如果该文件确实包含有信息,头3个位置保存了字符串“TAG”。如果文件确实有标记信息,将最后128

个字节保存在一个变量里。然后,循环遍历该MP3文件,同时解压信息。下面的代码解压该信息,并且创建了几个重要的变量,以备后用:

< 程序 >

注意,对于genre包含的字符的处理有点不同。这是因为ID3将该数据保存为一个单字节的ASCII字符。为了将实际的数值和它相应的描述(假设包含在一个下拉对话框里)对应

起来,本程序将该ASCII转换称一个数值,然后在该下拉对话框中查找该数值。

注:原程序用的combobox控件,因为我的程序不是windows程序,所以就该用数组了。
sdudyfrom 2003-11-26
  • 打赏
  • 举报
回复
这个程序好麻烦噢!顶一下吧!
lengfenghongyu 2003-11-22
  • 打赏
  • 举报
回复
怎么大家都在忙吗?
lengfenghongyu 2003-11-22
  • 打赏
  • 举报
回复
帮帮忙,分不是问题!;)
lengfenghongyu 2003-11-22
  • 打赏
  • 举报
回复
主要是程序,帮我用C语言写出来,谢谢各位了!
hcj2002 2003-11-22
  • 打赏
  • 举报
回复
这段话的主要意思是从一个mp3文件中读出相应的信息如名称,长度等并在vb中用空间输出相关信息。
lengfenghongyu 2003-11-22
  • 打赏
  • 举报
回复

请翻译下文并将其用VC改造。传回翻译后的文件,和VC主要语句。

Deciphering(判读) MP3 Tag information with Visual Basic

The Windows Media Player provides an easy, quick way to drop MP3 capability i
nto a Visual Basic application. However, once you have an MP3, you may have wonde
red how to read information about the song, such as the song title and artist's n
ame. If the MP3 file uses the most popular tag encryption, ID3, then you're in lu
ck. This standard stores the Tag information in the last 128 bytes of the file (T
ag:3, Title:30, Artist:30, Album:30, Year:4, Comment:30, Genre:1)

To read this information, first open the MP3 file and grab the last 128 bytes
. With ID3, the first three slots hold the string TAG if the file actually contai
ns information. If the file does contain Tag information, store the last 128 byte
s in a custom variable. After that,cycle through the MP3 file, extracting informa
tion as you go. The following procedure shows the code that extracts this informa
tion as
well as creates several important variables to use later on:

Option Explicit
Private Type TagInfo
Tag As String * 3
Songname As String * 30
artist As String * 30
album As String * 30
year As String * 4
comment As String * 30
genre As String * 1
End Type

Dim FileName As String
Dim CurrentTag As TagInfo

Private Sub Form1_Load()
Dim temp As String
On Error Resume Next

FileName = App.Path & "\myMP3.mp3"
Open FileName For Binary As #1
With CurrentTag
Get #1, FileLen(FileName) - 127, .Tag
If Not .Tag = "TAG" Then
label8.Caption = "No tag"
Close #1
Exit Sub
End If
Get #1, , .Songname
Get #1, , .artist
Get #1, , .album
Get #1, , .year
Get #1, , .comment
Get #1, , .genre
Close #1

txtTitle = RTrim(.Songname)
txtArtist = RTrim(.artist)
txtAlbum = RTrim(.album)
txtYear = RTrim(.year)
txtComment = RTrim(.comment)

Temp = RTrim(.genre)
txtGenreCode = Asc(Temp)
Combo1.ListIndex = CInt(txtGenreCode) - 1
End With
End Sub

Notice that the code has to handle the genre character a little differently.
That's because ID3 stores this data as a single ASCII character. To match up the
actual number with its corresponding description -- say contained in a combobox--
the procedure converts the ASCII to a number, and then looks up that number in th
e combobox.


=============================================================



001、VB串口通讯视频教程源码41个 002、Visual Basic串口通信工程开发实例导航随书源码7个 003、Visual Basic串口通信与测控应用技术实战详解 源代码(15个全) 004、GE PLC串口通讯,VB编制,读取内存单元 005、PC机与51单片机之间的串口通讯,VB编的,分PC和单片机两部分 006、VB6的串口通信程序,还有crc校验 007、VB Modbus RTU源码,其中协议部分已生成DLL,可直接调用 008、VB.net开发的串口调试程序 009、VB.net实现串口编程,希望大家有用 010、VB版串口调试程序,包含VB源码及安装文件,适合调试串口 011、VB编程RS232串口控制DA数模转换 012、VB编程实现的串口调试工具源码 013、VB的RS232串口通信测试程序,以txt格式接受,可定义发送字符 014、VB的SouthStar串口测试与51串口烧器V1.0版 015、VB的串口调试助手1.0的源码 016、VB的串口短信发送程序,需要数据线支持 017、VB的串口通信程序,实现多机通信 018、VB的串口通信程序,主要用于上位机与下位机间的通信 019、VB的串口通信程序界面参考网上的程序较简单 020、VB的串口通讯界面,主要面向51单片机的串口通信 021、VB的单片机和PC串口通信的调试程序 022、VB的仿真实电子琴操作界面,包含与FPGA串口通信的功能 023、VB串口API通讯,附带BAS文件全部源码,实现与饭卡读卡器通讯 024、VB串口编程,关于上位机的应用,特别适合初级学习VB的学员 025、VB串口编程调试精灵源码 026、VB串口编程实现完整的多费率电表读数软件 027、VB串口程序,,是一个串口使用例程,对初学者有用,特别是工控类的 028、VB串口传输文本,实现2台PC间的通信,类似简单的聊天工具 029、VB串口的一个电子称的项目 030、VB串口调试程序,用于通过串口控制松下空调测试 031、VB串口调试程序及源码 032、VB串口调试软件源代码,可以参考修改为其它通讯程序 033、VB串口调试软件源文件 034、VB串口控制步进电机程序完整源码 035、VB串口通信 6路10位AD转换数据采集源程序 036、VB串口通信,API串口通信模块源码 037、VB串口通信,适用简单,适合初学者 038、VB串口通信操作界面,进行数据采集,画实时曲线 039、VB串口通信程序,可以读取串口并显示保存数据,且能显示数据曲线 040、VB串口通信的源码,学习的好资料 041、VB串口通信调试器的源码程序 042、VB串口通信设计视频演示源码 043、VB串口通信示例 044、VB串口通信数据源码 045、VB串口通信之串口接收程序 046、VB串口通讯测试源代码,有文本和图形两种端口数据观察方式 047、VB串口通讯程序,用来跟单片机通讯 048、VB串口通讯代码(部分) 049、VB串口通讯的参考源程序 050、VB串口通讯实例 高精度电压表(24bit) VB程序 051、vb串口通讯示例 052、VB串口与伺服电机DSP2407通讯完整代码源程序 053、VB串口源码,动力电池检测数据采集,内含电导巡检模块通讯报文,可,读,保存,备份数据 054、VB串口字节通信程序,包括:1字节发送子程序,n字节接收子程序 055、VB串行口通信测试示例 056、VB串行通信试验程序 057、VB的MODEM通信源代码,智能化水电远端数据读取系统 058、VB的串口源程序,包括串口的配置界面,接收功能和发送功能 059、VB访问串口,并读取电子秤上显示的数据 060、VB和西门子S7-300 PLC串口通讯程序能实现读功能 061、VB检测串口工作状态 062、VB简单的串口短信收发功能,使用短信猫测试通过 063、VB开发串口通信,关于生物医学工程专业的血氧饱和度的设计 064、VB开发串口通信软件,利用按钮控件控制高清晰数字展示台 065、VB开发的RS232串口图像处理器驱动(摄像头驱动) 066、VB开发的串口通信源码 067、VB开发的串口与三菱FX PLC通讯源码 068、VB控制串口232通讯,对飞利浦M1卡内数据进行处理,支持密码修改等 069、VB利用Mscomm控件编的通讯终端,可做串口通讯编程参考示例 070、VB平台单片机与PC机串口通信的PC端程序。小巧易用,功能丰富 071、VB嵌入式串口通讯波形分析显示软件 072、VB实现串口调试LED信息显示屏设备主要代码 073、VB实现串口调试工具的完整源码 074、vb实现串口通信 文件传送系统,用vb以及mscomm控件实现 075、VB实现串口通信,发送命令从而接收相应数据 076、VB使用mscom控件实现PC机与单片机串口通信 077、VB通过COM串口读取条形码设备 078、VB通过串口控制单片机读24C02源代码 079、VB通讯程序,连接串口可在电脑显示来电号码 080、VB下的串口发短信程序,可选择端口,设置短信中心号码 081、VB的串口通信,发送和接收实例 082、VB的串口通信分析程序源码 083、VB的串口通讯,通过串口对单片机进行控制 084、VB的串口通讯软件,简单易学,适合初学者 085、VB的通过串口与考勤机连接通讯的程序 086、vb用控件的的串口程序,是vb的经典之作 087、VB与USB转串口的通讯完整程序,有详细说明,不需要安装驱动 088、vb与串口通信的关于回路测试的小程序很实用 089、vb语言开发的串口通信,可实现拨号传送文件等 090、VB中串口事件处理函数的示例 091、VB中的串口通讯,串口通讯作为一种古老而又灵活的通讯方式,被广泛地应用 092、VB自动枚举系统串口加摄象头图象采集,坐标系变换 093、Visual Basic2005与自动化系统监控(串并行控制)光盘

69,364

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧