-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathplayer.cpp
87 lines (66 loc) · 2.04 KB
/
player.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "player.h"
#include <ctime>
int randomInt(int max_int) {
srand(time(NULL));
return (rand() % max_int) + 1;
}
void printInfo(List L) {
/**
* PR : menampilkan informasi ID, nama, dan lokasi file
*/
address Q = first(L);
do {
cout<<"name : "<<info(Q).name<<endl
<<"ID : "<<info(Q).ID<<endl
<<"location: "<<info(Q).location<<endl;
Q = next(Q);
} while(Q!=first(L));
cout<<"==============================================="<<endl;
}
void playMusic(address P) {
/**
* PR : memainkan lagu yang ditunjuk oleh pointer P
*/
string filename = info(P).location+"/"+info(P).name;
cout<<"playing "<<filename<<endl;
PlaySound(TEXT(filename.c_str()), NULL, SND_FILENAME);
_sleep(500); //delay 0.5 second
}
void shuffleList(List &L) {
/**
* PR : mengacak isi (elemen) dari list L
* FS : isi (elemen) dari list teracak
*/
//-------------your code here-------------
cout<<"UNDER MAIN TENIS"<<endl;
//----------------------------------------
}
void sortListByID(List &L) {
/**
* PR : mengurutkan isi (elemen) dari list L berdasarkan ID
* FS : isi (elemen) dari list L terurut
*/
//-------------your code here-------------
cout<<"UNDER MAIN TENIS"<<endl;
//----------------------------------------
}
void playRepeat(List &L, int n) {
/**
* PR : memainkan seluruh lagu di dalam list
* dari lagu pertama hingga terakhir sebanyak n kali
*/
//-------------your code here-------------
cout<<"UNDER MAIN TENIS"<<endl;
//----------------------------------------
}
void deleteMusicByID(List &L, infotype x) {
/**
* IS : list L mungkin kosong
* PR : menerima input user untuk ID lagu yang ingin dihapus
* jika ID lagu ditemukan, hapus (deallocate) lagu dari list
* FS : elemen dengan ID yang dicari dideallocate
*/
//-------------your code here-------------
cout<<"UNDER MAIN TENIS"<<endl;
//----------------------------------------
}