English has gradually become a worldwide language, and modern people learn English with enthusiasm, so that the English reader is very hot. However, no matter how powerful complexing machine has a significant defect - the fixed time is fixed. If the re-reading time is too short, then it is not powerful when you encounter a long sentence; if the time is long, you will be inevitably repeated some extra parts, which will not make fast forward (sometimes 200 seconds of complexing machines have fast forward function ), This is the same as the fast forward of the tape! Therefore, the author wants to develop a software reader using Delphi powerful media playback control. The biggest advantage of software resequences is that whether you can recover from the length of the sentence! Never need to rewind, nor does it require fast forward. Not only that, the software reader also has a random selection function, which is a general re-reader is very difficult.
Preparing for work Delphi media playback controls have played a variety of sound files. We can record the learning materials into your computer according to your preferences, and store the appropriate format. A WAVE file or MP3 file can generally be stored.
The development and development of the resequence machine is used by the media play control TMEDIAPLAYER for Delphi. This control is in the System Control (SYSTEM page. First create an application. Set the BorderStyle of the main form for BSDIALOG, prohibiting the enlargement and reduction of the form. Set KeyPreview to TRUE to process keyboard events. Place the control on the main form:
Among them: The media player is a critical control of the program to enable the playback of sound. TrackBar is used to indicate the current playback progress. The left TListBox (SectionList) is used to store the sound file name (learning information) that will be played. The two TListBox (startlist, stoplist) on the right is used to record the repeated sentence. 'Increase' and 'Delete' Button for Maintaining Learning Information. Trackbar1 is used to display the playback process. Timer1 is used to dynamically display playback progress. OpenDialog1 is used to select a playback file.
Implementation of the complex function: 1 Set two integers in the program (startPOS, SSTOPOS) is used to record the starting point of the playback, and assign the Stoppos to -1 when initialization. 2 Record the starting value at the time at a time: startpos: = mediaplayer1.position; 3 Programs Control repeatedly, the Enter key continues to play. First, set the keypreview of the main form to True so that the main form can intercept button messages. Then, the ONKEYDOWN method is then reloaded. code show as below:
Implementation of free reading functions: Since all complexed sentences are recorded, any sentence can be repeated. When the user doubles the 'to the old row in the past, you can switch directly to the playback of the sentence. The code is as follows: Procedure Trepeaterform.ListDblclick (Sender: TOBJECT);
Begin
SID: = (sender as tlistbox) .itemindex; // get the index sid stoplist.itemindex: = SID; // set the end point list to SID; // Set the start list to SID; // StartPos: = strt (startlist.items [sID]); // get the start position
Stoppos: = strt (stoplist.items [sID]); // get the termination position
MediaPlayer1.stop; // Stop current play MediaPlayer1.StartPos: = StartPos; // Set new play range MediaPlayer1.Endpos: = stoppos; MediaPlayer1.play; // Play the specified sound end;
Add: Click the Add button to add learning information. It should be noted that the original list should be retrieved before adding new files to prevent repetition. The code is as follows: Procedure Trepeaterform.addbtnclick (Sender: TOBJECT);
Var fn: string; begin
If OpenDialog1.execute1 Begin Fn: = Opendialog1.FileName; if section <0 THEN // Retrieve this file first, if there is no sectionList.Items.add (fn); // Add to the list
END;
END;
Choice of learning materials: Realize the onclick method. First get the index when you click, then get the file name via items [index]. Assign the file name to the FileName property of MediaPlayer and then call the Open method. (Code) In addition, open learning data files when the program is initialized; the program will learn the data store when exiting. These features are implemented by TListBox.Items.LoadFromFile and TListbox.Items.SaveTofile (code). The program is debugged in a Chinese Windows98 Delphi5.0 environment. All source code can be asked by the MIL author.