-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRadio.pas
151 lines (134 loc) · 3.92 KB
/
Radio.pas
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
{
- NetRadio -
Lige hvad enhver doven geek eller musik freak har brug for!
Ægte netradio i høj kvalitet! :-)
Damn det er en nice funktion ! ! !
(og konkurrent til SpuKie.dk's "NetTools" :-P )
}
unit Radio;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, WMPLib_TLB, StdCtrls, Buttons, ComCtrls, main, inifiles,
ExtCtrls;
type
TNetRadio = class(TForm)
RadioSelect: TComboBox;
PlayBtn: TBitBtn;
StopBtn: TBitBtn;
Player: WMPLib_TLB;
Volume: TTrackBar;
VolumeStatus: TProgressBar;
LydstyrkeLabel: TLabel;
BitRate: TLabel;
InfoLabel1: TLabel;
LabelHiderTimer: TTimer;
procedure PlayBtnClick(Sender: TObject);
procedure StopBtnClick(Sender: TObject);
procedure VolumeChange(Sender: TObject);
procedure PlayerBuffering(ASender: TObject; Start: WordBool);
procedure RadioSelectChange(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure LabelHiderTimerTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
NetRadio: TNetRadio;
ConfigFile: TINIFile;
PathToINIFile: String;
implementation
{$R *.dfm}
// Afspiller den valgte station.
procedure TNetRadio.PlayBtnClick(Sender: TObject);
begin
InfoLabel1.Visible:=true;
if RadioSelect.ItemIndex = 0 then
begin
Player.URL:='http://www.dr.dk/netradio/metafiler/asx/DR_P1_128.asx';
end
else
if RadioSelect.ItemIndex = 1 then
begin
Player.URL:='http://www.dr.dk/netradio/metafiler/asx/DR_P2_128.asx';
end
else
if RadioSelect.ItemIndex = 2 then
begin
Player.URL:='http://www.dr.dk/netradio/metafiler/asx/DR_P3_128.asx';
end
else
if RadioSelect.ItemIndex = 3 then
begin
Player.URL:='http://dix.media.webpartner.dk/voice128';
end
else
if RadioSelect.ItemIndex = 4 then
begin
Player.URL:='http://100fm.dk/netradio/100fm_live.asx';
end
else
if RadioSelect.ItemIndex = 5 then
begin
Player.URL:='http://www.dr.dk/netradio/metafiler/asx/DR_Boogie_128.asx';
end
else
if RadioSelect.ItemIndex = 6 then
begin
Player.URL:='http://dix.media.webpartner.dk/radio2-96';
end
else
if RadioSelect.ItemIndex = 7 then
begin
Player.URL:='mms://85.214.46.76/mmradio/live128.asf';
end
else ShowMessage('Du har ikke valgt noget radioprogram!');
LabelHiderTimer.Enabled:=true;
end;
// Stopper radioen.
procedure TNetRadio.StopBtnClick(Sender: TObject);
begin
Player.controls.stop;
Player.close;
end;
procedure TNetRadio.VolumeChange(Sender: TObject);
begin
Player.settings.volume:=Volume.Position;
VolumeStatus.Position:=Volume.Position;
Configfile.WriteInteger('Radio', 'Volume', Player.settings.volume);
end;
// Viser lydens bitrate.
procedure TNetRadio.PlayerBuffering(ASender: TObject; Start: WordBool);
begin
BitRate.Caption:='Bit rate: '+IntToStr(Player.network.bitRate);
end;
// Gemmer favorit radioen.
procedure TNetRadio.RadioSelectChange(Sender: TObject);
begin
ConfigFile.WriteInteger('Radio', 'Favorit', RadioSelect.ItemIndex);
end;
// Rydder op efter ini filen.
procedure TNetRadio.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ConfigFile.Free;
end;
// Indstiller volumen når vinduet åbnes.
procedure TNetRadio.FormShow(Sender: TObject);
begin
PathToINIFile:=IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)))+Main.ConfFil;
ConfigFile:=TINIFile.Create(PathToINIFile);
RadioSelect.ItemIndex:=ConfigFile.ReadInteger('Radio', 'Favorit', 2);
AlphaBlendValue:=Main.Trans;
Player.settings.volume:=ConfigFile.ReadInteger('Radio', 'Volume', 50);
Volume.Position:=Player.settings.volume;
VolumeStatus.Position:=Player.settings.volume;
end;
procedure TNetRadio.LabelHiderTimerTimer(Sender: TObject);
begin
InfoLabel1.Visible:=false;
LabelHiderTimer.Enabled:=false;
end;
end.