The playing principle of the KTV karaoke System and the working principle of the ktv karaoke System

Source: Internet
Author: User

The playing principle of the KTV karaoke System and the working principle of the ktv karaoke System
Playing principle of the karaoke song system of Beida qingniao

Instructor-former Yuming

 

1. First, we know there are two classes (PlayList Song)

There is a method in the PlayList class.

Public static bool AddSong (Song song)

{

Bool success = false; // record whether the song is successfully added

For (int I = 0; I <SongList. Length; I ++)

{

// Locate the first null position in the array

If (SongList [I] = null)

{

SongList [I] = song;

Success = true;

Break;

}

}

Return success;

}

 

2. Place the selected song object to an array in the PlayList class.

Song song = new Song ();

Song. SongName = dgvSong. SelectedRows [0]. Cells ["songName"]. Value. ToString (); record the current song

Song. SongURL = KtvUnit. SongPath + "\" + dgvSong. SelectedRows [0]. Cells ["songURL"]. Value. ToString ();

// MessageBox. Show (song. SongURL );

PlayList. AddSong (song );

 

3. Timer control 1 s Enable = true Tick Click Event in FrmMian

If (Player1.playstate = Vmpplayer. stopped)

{

Song = null;

PlayList. MoveOn (); // when the song is played to the last second, play the next one.

}

4. public static void MoveOn ()

{

If (SongList [SongIndex]! = Null & SongList [SongIndex]. PlayState = SongPlayState. again)

// If the current playing song is not empty and the status is Replay

{

SongList [SongIndex]. SetSongPlayed (); // The status is changed to played.

}

Else

{

SongIndex ++; // execute ++ to play the next video

}

}

5. public void SongList ()'

{

LvSong. Items. Clear ();

For (int I = 0; I <PlayList. SongList. Length; I ++)

{

If (PlayList. SongList [I]! = Null)

{

ListViewItem item = new ListViewItem ();

Item. Text = PlayList. SongList [I]. SongName;

Item. Tag = I;

String playstate = PlayList. SongList [I]. PlayState = SongPlayState. unplayed? "Not played": "played ";

Item. SubItems. Add (playstate );

LvSong. Items. Add (item );

}

}

}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.