-
Notifications
You must be signed in to change notification settings - Fork 2
/
lofi.h
115 lines (92 loc) · 2.63 KB
/
lofi.h
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef LOFI_H
#define LOFI_H
#include <QMainWindow>
#include <QMediaPlayer>
QT_BEGIN_NAMESPACE
namespace Ui { class lofi; }
QT_END_NAMESPACE
struct Station{
QString name;
QString url;
};
class lofi : public QMainWindow
{
Q_OBJECT
public:
void setStreams(){
this->liveStation[0] = {"Lauft.fm" , "http://stream.laut.fm/lofi"};
this->liveStation[1] = {"Planet Lofi","http://198.245.60.88:8080" };
this->liveStation[2] = {"Chill Cafe","http://192.99.35.215:5078"};
this->liveStation[3] = {"Stream Name","http://192.99.0.170:5038"};
this->liveStation[4] = {"No Copyright Stream","http://78.129.222.70:33297" };
this->liveStation[5] = {"Radio Seguidor", "http://176.9.43.216:8236"};
this->liveStation[6] = {"Chillsky", "https://lfhh.radioca.st/stream"};
this->liveStation[7] = {"The Augmented Ear", "http://66.228.41.10:8000/http://thirtythree-45.com:8000"};
this->liveStation[8] = {"Lofi Hip Hop Radio", "https://stream.zeno.fm/0r0xa792kwzuv"};
this->liveStation[9] = {"RauteMusik.FM Study", "http://de-hz-fal-stream07.rautemusik.fm/study"};
}
int playStatus(){
return this->isPlaying;
}
void setPlaying(){
this ->isPlaying = 1;
}
void setPause(){
this ->isPlaying = 0;
}
void setAudio(){
this->player.setMedia(QUrl(this->liveStation[this->nowPlaying].url));
qInfo()<<this->liveStation[this->nowPlaying].name<<" : "<<this->liveStation[this->nowPlaying].url;
}
void nextStation(){
if ( this->nowPlaying == 9){
this->nowPlaying = 1;
}
else{
this->nowPlaying++;
}
setAudio();
if(this->isPlaying){
playAudio();
}
}
void previousStation(){
if ( this->nowPlaying == 0){
this->nowPlaying = 9;
}
else{
this->nowPlaying--;
}
setAudio();
if(this->isPlaying){
playAudio();
}
}
void playAudio() {
this->player.play();
}
QString getStationName(){
return this->liveStation[this->nowPlaying].name;
}
void changeVolume(int val) {
this->player.setVolume(val);
}
void pauseAudio() {
this->player.pause();
}
lofi(QWidget *parent = nullptr);
~lofi();
private slots:
void on_Button_clicked();
void on_volumeSlider_sliderMoved(int position);
void on_Button_pressed();
void on_pushButton_pressed();
void on_pushButton_2_pressed();
private:
int isPlaying = 0;
int nowPlaying = 1;
Ui::lofi *ui;
Station liveStation[10];
QMediaPlayer player;
};
#endif // LOFI_H