KTV Song System Playback principle

Source: Internet
Author: User

Peking University Jade Bird KTV song system playing principle

Instructor--Yuana Yuming

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

There is one method in the playlist class

public static bool Addsong (song song)

{

BOOL success = false;//Record added song is successful

for (int i = 0; i < songlist.length; i++)

{

Find 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 into 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 in Frmmian 1s enable=true tick click event

If (player1.playstate==vmpplayer.stopped)

{

Song=null;

Playlist.moveon ();//When the song plays to the last second of the moment, play the next song

}

4. Public static void MoveOn ()

{

if (Songlist[songindex]! = null && Songlist[songindex]. Playstate = = Songplaystate.again)

If the currently playing song is not empty and the status is replay

{

Songlist[songindex]. Setsongplayed ();//status changed to broadcast

}

Else

{

songindex++;//Execute + + to play the next song

}

}

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": "Broadcast";

Item. SubItems.Add (playstate);

LVSONG.ITEMS.ADD (item);

}

}

}

KTV Song System Playback principle

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.