Guidance
指路人
g.yi.org
software / rapidq / Examples / Audio & Video / Qmp3 / Qmp3_Example.htm

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Qmp3_Example
$include "Qmp3.inc"

declare sub ReadClickedFile
declare sub UpdateTags
declare sub Play
declare sub Stop

CREATE Form AS QFORM
    Caption = "Qid3Tag example"
    Width = 580
    Height = 244
    Center
    CREATE Label1 AS QLAbEL
        Caption = "Title"
        Left = 176
        Top = 24
        Transparent = 1
    END CREATE
    CREATE Label2 AS QLABEL
        Caption = "Artist"
        Left = 176
        Top = 56
        Transparent = 1
    END CREATE
    CREATE Label3 AS QLABEL
        Caption = "Album"
        Left = 176
        Top = 88
        Transparent = 1
    END CREATE
    CREATE Label4 AS QLABEL
        Caption = "Year"
        Left = 176
        Top = 120
        Transparent = 1
    END CREATE
    create tnlabel as qlabel
        caption = "Track"
        left = 292
        top = 120
        transparent = 1
    end create
    CREATE Label5 AS QLABEL
        Caption = "Comment"
        Left = 176
        Top = 152
        Width = 48
        Transparent = 1
    END CREATE
    CREATE Label6 AS QLABEL
        Caption = "Genre"
        Left = 176
        Top = 184
        Transparent = 1
    END CREATE
    CREATE FileListBox AS QFILELISTBOX
        Left = 6
        Top = 13
        Height = 137
        Directory = ".\"
        onclick = ReadClickedFile
    END CREATE
    CREATE ed_title AS QEDIT
        Left = 232
        Top = 16
    END CREATE
    CREATE ed_artist AS QEDIT
        Left = 232
        Top = 48
    END CREATE
    CREATE ed_album AS QEDIT
        Left = 232
        Top = 80
    END CREATE
    CREATE ed_year AS QEDIT
        Left = 232
        Top = 112
        width = 40
    END CREATE
    create ed_track as qedit
        left = 332
        top = 112
        width = 20
    end create
    CREATE ed_comment AS QEDIT
        Left = 232
        Top = 144
    END CREATE
    CREATE ed_genre AS QEDIT
        Left = 232
        Top = 176
    END CREATE
    CREATE Button1 AS QBUTTON
        Caption = "Write"
        Left = 5
        Top = 160
        Width = 147
       onclick = UpdateTags
    END CREATE
END CREATE

dim mp3 as qmp3
'The following code adds the GenresCB. It's optional
mp3.genrescb.parent = form
mp3.genrescb.top = 190
mp3.genrescb.left = 6
mp3.loadlist               'use this one to load genres list into GenresCB

dim red as qrichedit
with red
.parent = form
.left = 370
.height = 170
.top = 10
end with

dim play_b as qbutton
with play_b
.parent = form
.left = 370
.top = 190
.caption = "Play"
.onclick = Play
end with

dim stop_b as qbutton
with stop_b
.parent = form
.left = 480
.top = 190
.caption = "Stop"
.onclick = Stop
end with
Form.ShowModal


sub ReadClickedFile
mp3.filename = Filelistbox.filename

mp3.readheader
red.clear
red.addstrings "Mpeg Version: " + mp3.version
red.addstrings "Layer: " + mp3.Layer
red.addstrings "Protection: " + mp3.Protection
red.addstrings "Bitrate: " + str$(mp3.Bitrate)
red.addstrings "Frequency: " + str$(mp3.Frequency)
red.addstrings "Padding: " + mp3.Padding
red.addstrings "Channels: " + mp3.Channels
red.addstrings "Intensify Stereo: " + mp3.IntensityStereo
red.addstrings "MS Stereo: " + mp3.MS_Stereo
red.addstrings "Copyright: " + mp3.Copyright
red.addstrings "Original: " + mp3.Original
red.addstrings "Emphasis: " + mp3.Emphasis
'_________________________________________________________

mp3.readtags
mp3.genrescb.itemindex = mp3.genreid
ed_title.text = mp3.title
ed_artist.text = mp3.artist
ed_album.text = mp3.album
ed_year.text = mp3.year
ed_comment.text = mp3.comment
ed_track.text = str$(mp3.track)
ed_genre.text = mp3.genre
end sub

Sub UpdateTags
mp3.title = ed_title.text
mp3.artist = ed_artist.text
mp3.album = ed_album.text
mp3.year = ed_year.text
mp3.comment = ed_comment.text
mp3.track = val(ed_track.text)
mp3.genreid = mp3.genrescb.itemindex     'Pay attention, you have to give a valid genre id (BYTE),
                                         'so you cannot pass mp3.genre (which is a STRING)
mp3.writetags
end sub

Sub Play
mp3.play
end sub

Sub stop
Mp3.Stop
end sub



掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2024-10-6  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-04-05 00:30:15