Yangshan River
MP3 player should have a lot of use, while working while listening to Titanic melodious theme songs! However, if you are tired of the old face of the player, do you try to write a player of your own MP3? What, what is MP3 compresses what is too complicated? ! NO! Don't be modest, will you vb? Will get it! Below, you can use VB5 to compose one of our own MP3 players. Hope to throw bricks, get everyone's advice.
First, I have to understand an ActiveX control jujube Mp3Play.ocx I have from my friends. The so-called ActiveX control is a specialized function software component that has already been compiled in people. Previously, in the 16-bit VB, VBX was used as an extension, and the extension in Win95 was changed to OCX. Everyone knows that MP3Play.ocx is a VB control that is specifically played MP3 music files. We write your own player, use this control, and set its properties, you can get a professional MP3 music effect. To use this control, it is best to put her in the Windwos / System directory and register in the registry. With this control, you can decode an MP3 file as a WAV file.
The main properties of MP3Play.ocx are:
Bitrate: MP3 flow bit rate
Framecount: MP3 flow frame
TotalTime: Total Time Play
FramenotifyCount (RW): Sends a number of frames for a notification, the default is 32 frames send a notice
IscopyRighted, ISORIGINAL, HASCHECKSUMS: Release Information obtained from MP3 stream
Samplefrequency: Sample Rate
Layer: The value can be 1, 2, 3, represents the standard of Layer1, Layer2, Layer3, and defaults to 3
MPEGVERSION: Value represents MPEG-1 or MPEG-2
Common methods are:
AboutBox (): Displays the About box.
Authorize (Name, Password): Verify License (Registration Code), Name, registered name, Password is
The registration code is provided after the provider of the control is available. The return value is 0 passes, otherwise 5.
Open (InputFile, OutputFile): Open the MPEG audio file and decode playback, if you play on the sound card
OutputFile should be an empty string. Returning a non-0 value indicates that the decoding is incorrect. If OutputFile is decoded for file name
To the sound wave file. That is, this method can be used to write the MP3-WAV converter.
Close: Turn off the current MPEG rode.
GetVolumeleft, getVoluMeright: Get the volume of the left and right channels, returns the LONG type.
SetVolume (Left Chanel, Right Chanel): Set the left and right channel volume.
Pause (): Pause, whose sound is suspended, and occasionally open.
Play (): Start the decoding and play the current MPEG file. Returning 0 means decoding correct.
STOP (): Stop current decoding work, return non-0 means incorrectly.
Below, let's take a step by step:
Establish an engineering, add MP3Play.ocx to the control panel to start VB5, select Standard EXE. At this point, only some Win95 standard controls are only in the control panel on the left. We choose the Components ... (Component) item under the Project menu, select the Dialog-Medien Mp3Play ActiveX Control Module item in the pop-up dialog. This "baby" is the MP3 control we need. After determining, a blue speaker icon is added to the control panel, indicating that the control has been added to the control panel. Add the MP3 control instance to the Form1 (Form), set the blue speaker in the attribute point, drag a rectangle box in the form, release the MP3 control icon in the form. In order to go horn when playing, set Visible to false in the attribute table of MP3PLAY1. Generally, there are so many, the rest is to use her method (Methods). Add the "Choice File", "Play", "Pause", etc. "Command" button, build three in the form, named: Command1, Command2, Command3, set their Caption to: "Select MP3 file, "play", "pause". Add a Commondialog control to easily select the MP3 file, you also need the file to open the dialog. If this control does not have this control in the control panel, select the Components menu item as described in 1, tick in the checkbox before Microsoft Common Dialog Control 5.0, and you can see this control icon in the control panel after confirmation. Create an object called CommonDialog1 in the form, which requires its Filter property to "* .mp3 | * .mp3" for the file that quickly finds MP3. Write the corresponding code in the button Double-click Command1, enter the following code in Private Sub Command1_Click (): Commondialog1.Showopen Double-click Command2, entered in Private Sub Command2_Click (): Err = Mp3Play1.Open (Commondialog1.FileName, "")
MP3Play1.Play
Double-click Command3, enter: Enter: in private submmand3_click ():
MP3Play1.pause
6. Adjust the window size, run the player
Adjust the appearance of the form, such as size, color, etc., how to make it comfortable. Ok, start pressing F1
Run, choose the file jujube play! Feel your own MP3 player!
In addition, you can also make some beautiful interfaces such as Photoshop, attached to the form, enhance its artistic. You can also follow Winamp's "PLUG_INS" to complete some special animation effects using the Timer control. Of course, everything depends on your own genius. By the way, ask yourself, where there is an unpowered MP3PLAY.OCX, or you have registration number, please tell it. I have no registration code, each song can only play for 30 seconds. Wan Wang enlightens, grateful! ! !
==
1999? 1998? I don't remember writing it in that year.