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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
| unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ExtCtrls, Bass_DSHOW, bass, StdCtrls, Buttons, Menus, iniFiles, ShellAPI, CoolTrayIcon;
type
TForm6 = class(TForm)
Panel1: TPanel;
ListBox1: TListBox;
ListBox2: TListBox;
OpenDialog1: TOpenDialog;
Timer1: TTimer;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
TrackBar1: TTrackBar;
Label3: TLabel;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
StatusBar1: TStatusBar;
ComboBox1: TComboBox;
PopupMenu1: TPopupMenu;
PopupMenu2: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N12: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
GroupBox1: TGroupBox;
ScrollBar1: TScrollBar;
Label1: TLabel;
BitBtn4: TBitBtn;
BitBtn1: TBitBtn;
BitBtn3: TBitBtn;
BitBtn2: TBitBtn;
BitBtn5: TBitBtn;
N13: TMenuItem;
Label4: TLabel;
Label2: TLabel;
N14: TMenuItem;
N15: TMenuItem;
Label5: TLabel;
N16: TMenuItem;
N17: TMenuItem;
pb1: TPaintBox;
Timer2: TTimer;
pr1: TProgressBar;
pr2: TProgressBar;
Timer3: TTimer;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
procedure SpeedButton1Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure ListBox1DblClick(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure SpeedButton4Click(Sender: TObject);
procedure ListBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure BitBtn5Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure ComboBox1Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure N10Click(Sender: TObject);
procedure N11Click(Sender: TObject);
procedure N12Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure Panel1DblClick(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure N13Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N15Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure N17Click(Sender: TObject);
procedure pb1Paint(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
private
{ Private declarations }
procedure FilesAdd(FileName: string);
procedure FilesPlay(Item: integer);
procedure DropFile( var Msg: TWMDropFiles); message WM_DropFiles;
procedure WMKeyDown(Var Msg:TWMKeyDown); message WM_KeyDown;
function GetFileSize(filename: string): Integer;
function KHZStream(s: Cardinal): Integer;
procedure Draw(HWND : THandle; FFTData : TFFTData; X, Y : Integer);
public
{ Public declarations }
end;
var
Form6: TForm6;
stream: Hstream;
track: boolean;
T: integer;
f: file of Integer;
FullScreen: boolean;
P1: integer;
//переменые размера панели
H1, L1, T1, W1: integer;
//переменые размера и положения формы
CH, CW, H2, W2, L2, T2: integer;
FFTPeacks : array [0..128] of Integer;
FFTFallOff : array [0..128] of Integer;
implementation
uses Unit1, Unit7, Unit8;
{$R *.dfm}
procedure TForm6.FormCreate(Sender: TObject);
var
E: integer;
begin
DragAcceptFiles(Handle, true);
if xVideo_Init(handle, 0)=false then
ShowMessage('Неудаетcя иниилизировать видеопаток');
xVideo_ChannelSetWindow(stream, Panel1.Height, Panel1.Handle);
if FileExists(ExtractFilePath(Application.ExeName) + 'Set/VideoPlayer.ini') then
begin
AssignFile(f, ExtractFilePath(Application.ExeName) + 'Set/VideoPlayer.ini');
{$I-}
Reset(f);
{$I+}
if IOResult=0 then begin
read(f, E);
trackbar1.Position:=E;
xVideo_ChannelSetAttribute(stream, xVideo_ATTRIB_VOL, TrackBar1.Position);
Label3.Caption:='Громкость(' + inttostr(TrackBar1.Position) + '%)';
end;
if FileExists(ExtractFilePath(Application.ExeName) + 'Set/Combo.saved') then
begin
ComboBox1.Items.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Set/Combo.saved');
end;
FullScreen:=false;
end;
end;
procedure TForm6.FormDestroy(Sender: TObject);
begin
xVideo_Free();
end;
procedure TForm6.BitBtn1Click(Sender: TObject);
begin
if T=1 then
begin
xVideo_ChannelPlay(stream);
T:=0;
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Воспреизведение видео',bitInfo,30);
end
else
FilesPlay(ListBox1.ItemIndex);
end;
procedure TForm6.BitBtn2Click(Sender: TObject);
begin
if OpenDialog1.Execute=false then exit;
FilesAdd(OpenDialog1.FileName);
ListBox1.ItemIndex:=ListBox1.Items.Count-1;
FilesPlay(ListBox1.ItemIndex);
end;
procedure TForm6.BitBtn3Click(Sender: TObject);
begin
xVideo_ChannelPause(stream);
T:=1;
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Пауза',bitInfo,30);
end;
procedure TForm6.BitBtn4Click(Sender: TObject);
begin
xVideo_ChannelStop(stream);
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Стоп',bitInfo,30);
xVideo_ChannelSetPosition(stream,0,0);
end;
procedure TForm6.Timer1Timer(Sender: TObject);
var
TrackLen: Double;
TrackPos: Double;
ValPos, ValLen: Double;
begin
if track=false then
begin
ScrollBar1.Position:=Trunc(xVideo_ChannelGetPosition(stream, 0));
end;
TrackPos:=xVideo_ChannelGetPosition(stream, XVideo_Pos_SEC);
TrackLen:=xVideo_ChannelGetLength(stream,xVideo_POS_SEC);
ValPos:=TrackPos / (24 * 3600);
ValLen:=TrackLen / (24 * 3600);
Label2.Caption:=FormatDateTime('hh:mm:ss',ValPos)+'/'+FormatDateTime('hh:mm:ss',ValLen);
end;
procedure TForm6.ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
if ScrollCode=scEndScroll then
begin
xVideo_ChannelSetPosition(stream,ScrollBar1.Position,0);
Track:=true;
end
else
Track:=false;
end;
procedure TForm6.FilesAdd(FileName: string);
begin
ListBox1.Items.Add(ExtractFileName(FileName));
ListBox2.Items.Add(FileName);
if ListBox1.Itemindex=-1 then
ListBox1.ItemIndex:=ListBox1.Items.Count-1;
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Добавлено видео: ' + ExtractFileName(FileName),bitInfo,30);
end;
procedure TForm6.FilesPlay(Item: integer);
var
size: string; //размер
kh: string; //частота
begin
if item<0 then exit;
if stream<>0 then
xVideo_StreamFree(stream);
stream:=xVideo_StreamCreateFile(PChar(ListBox2.Items.Strings[item]),0,Panel1.Handle,0);
if stream=0 then
ShowMessage('Видео не выбрано')
else
begin
ScrollBar1.Min:=0;
ScrollBar1.Max:=Trunc(xVideo_ChannelGetLength(stream,0));
ScrollBar1.Position:=0;
Label1.Caption:=ListBox1.Items.Strings[item];
xVideo_ChannelPlay(stream);
size:=inttostr(round(GetFileSize(ListBox2.Items.Strings[item]) / 1000000));
kh:=inttostr(KHZStream(stream));
Label5.Caption:='Характеристики файла: Размер- ' + size + ' мб.' + ' , Частота- ' + kh + ' Hz';
Timer2.Enabled:=true;
Timer3.Enabled:=true;
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Воспроизводится видео: ' + ListBox1.Items.Strings[item],bitInfo,30);
end;
end;
procedure TForm6.SpeedButton1Click(Sender: TObject);
begin
if OpenDialog1.Execute=true then
FilesAdd(OpenDialog1.FileName);
end;
procedure TForm6.ListBox1Click(Sender: TObject);
begin
Label1.Caption:=ListBox1.Items.Strings[ListBox1.ItemIndex];
end;
procedure TForm6.ListBox1DblClick(Sender: TObject);
begin
FilesPlay(ListBox1.ItemIndex);
end;
procedure TForm6.TrackBar1Change(Sender: TObject);
begin
xVideo_ChannelSetAttribute(stream, xVideo_ATTRIB_VOL, TrackBar1.Position);
Label3.Caption:='Громкость(' + inttostr(TrackBar1.Position) + '%)';
end;
procedure TForm6.SpeedButton2Click(Sender: TObject);
var
itemindex: integer;
begin
itemindex:=ListBox1.ItemIndex;
if itemindex<0 then exit;
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Удалено видео из видеоплейлиста: ' + ListBox1.Items.Strings[itemindex],bitInfo,30);
ListBox1.Items.Delete(itemindex);
ListBox2.Items.Delete(itemindex);
if itemindex>ListBox1.Items.Count-1 then
itemindex:=ListBox1.Items.Count-1;
ListBox1.ItemIndex:=itemindex;
end;
procedure TForm6.FormClose(Sender: TObject; var Action: TCloseAction);
var
E: integer;
begin
E:=Trackbar1.Position;
if FileExists(ExtractFilePath(Application.ExeName) + 'Set/VideoPlayer.ini') then
begin
DeleteFile(ExtractFilePath(Application.ExeName) + 'Set/VideoPlayer.ini');
AssignFile(f, ExtractFilePath(Application.ExeName) + 'Set/VideoPlayer.ini');
Rewrite(f);
Write(f, E);
CloseFile(f);
end
else
begin
AssignFile(f, ExtractFilePath(Application.ExeName) + 'Set/VideoPlayer.ini');
{$I-}
Rewrite(f);
{$I+}
if IOResult=0 then begin
Write(f, E);
CloseFile(f);
end;
if FileExists(ExtractFilePath(Application.ExeName) + 'Set/Combo.saved') then
begin
DeleteFile(ExtractFilePath(Application.ExeName) + 'Set/Combo.saved');
ComboBox1.Items.SaveToFile(ExtractFilePath(Application.ExeName) + 'Set/Combo.saved');
end
else
ComboBox1.Items.SaveToFile(ExtractFilePath(Application.ExeName) + 'Set/Combo.saved');
end;
BitBtn4.Click;
end;
procedure TForm6.SpeedButton4Click(Sender: TObject);
var
Files: string;
begin
if ComboBox1.Items.Count=0 then
begin
ShowMessage('Плейлистов нет');
exit;
end;
if ComboBox1.ItemIndex=-1 then
begin
ShowMessage('Выбирите плейлист');
exit;
end;
Files:=ComboBox1.Items.Strings[ComboBox1.ItemIndex];
if Files='' then exit;
if not FileExists(ExtractFilePath(Application.ExeName) + 'VideoPlayLists' + Files + '1' + '.saved') then exit;
if not FileExists(ExtractFilePath(Application.ExeName) + 'VideoPlayLists' + Files + '2' + '.saved') then exit;
ListBox1.Items.LoadFromFile(ExtractFilePath(Application.ExeName) + 'VideoPlayLists' + Files + '1' + '.saved');
ListBox2.Items.LoadFromFile(ExtractFilePath(Application.ExeName) + 'VideoPlayLists' + Files + '2' + '.saved');
Label4.Caption:='Имя текущего плейлиста: ' + Files;
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Открыт видеоплейлист: ' + Files,bitInfo,30);
end;
procedure TForm6.ListBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=VK_DELETE then
SpeedButton1.Click;
if key=VK_ESCAPE then
begin
ListBox1.Items.Clear;
ListBox2.Items.Clear;
end;
if key=VK_RETURN then
BitBtn2.Click;
end;
procedure TForm6.BitBtn5Click(Sender: TObject);
begin
if ListBox1.Items.Count-1=0 then exit;
Form8.Show;
ShowMessage('Введите название нового плейлиста');
end;
procedure TForm6.SpeedButton3Click(Sender: TObject);
var
i: integer;
Files: string;
begin
if ComboBox1.ItemIndex<0 then exit;
i:=ComboBox1.ItemIndex;
Files:=ComboBox1.Items.Strings[i];
if not FileExists(ExtractFilePath(Application.ExeName) + 'VideoPlayLists/' + Files + '1.saved') then exit;
if not FileExists(ExtractFilePath(Application.ExeName) + 'VideoPlayLists/' + Files + '2.saved') then exit;
DeleteFile(ExtractFilePath(Application.ExeName) + 'VideoPlayLists/' + Files + '1.saved');
DeleteFile(ExtractFilePath(Application.ExeName) + 'VideoPlayLists/' + Files + '2.saved');
ListBox1.Items.SaveToFile(ExtractFilePath(Application.ExeName) + 'VideoPlayLists/' + Files + '1.saved');
ListBox2.Items.SaveToFile(ExtractFilePath(Application.ExeName) + 'VideoPlayLists/' + Files + '2.saved');
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Сохранены изменения в видеоплейлесте: ' + Files,bitInfo,30);
end;
procedure TForm6.ComboBox1Click(Sender: TObject);
begin
Label1.Caption:='Имя выбраного плейлиста:' + ComboBox1.Items.Strings[ComboBox1.ItemIndex];
end;
procedure TForm6.N1Click(Sender: TObject);
begin
BitBtn1.Click;
end;
procedure TForm6.N2Click(Sender: TObject);
begin
BitBtn4.Click;
end;
procedure TForm6.N3Click(Sender: TObject);
begin
BitBtn2.Click;
end;
procedure TForm6.N4Click(Sender: TObject);
begin
BitBtn3.Click;
end;
procedure TForm6.N7Click(Sender: TObject);
begin
BitBtn5.Click;
end;
procedure TForm6.N8Click(Sender: TObject);
begin
SpeedButton1.Click;
end;
procedure TForm6.N9Click(Sender: TObject);
begin
SpeedButton2.Click;
end;
procedure TForm6.N10Click(Sender: TObject);
begin
SpeedButton3.Click;
end;
procedure TForm6.N11Click(Sender: TObject);
begin
SpeedButton4.Click;
end;
procedure TForm6.N12Click(Sender: TObject);
begin
ListBox1.Items.Clear;
ListBox2.Items.Clear;
end;
procedure TForm6.DropFile(var Msg: TWMDropFiles);
var
CFileName: array[0..Max_Path] of Char;
begin
try
if DragQueryFile(Msg.Drop, 0, CFileName, Max_Path)>0 then
begin
FilesAdd(CFileName);
Msg.Result:=0;
end;
finally
DragFinish(msg.Drop);
end;
end;
procedure TForm6.N5Click(Sender: TObject);
begin
ShellExecute(handle, 'open', PChar(ExtractFilePath(Application.ExeName) + 'VideoPlayLists'), nil,nil,SW_SHOW);
end;
procedure TForm6.WMKeyDown(var Msg: TWMKeyDown);
begin
if Msg.CharCode=VK_ESCAPE then
begin
if FullScreen=true then
begin
P1:=Trunc(xVideo_ChannelGetPosition(stream,0));
Timer1.Enabled:=false;
xVideo_ChannelStop(stream);
//делаем форму больше
Form6.BorderStyle:=bsSizeable;
Form6.FormStyle:=fsNormal;
Form6.WindowState:=wsNormal;
Form6.Top:=T2;
Form6.Left:=L2;
Form6.ClientHeight:=CH;
Form6.ClientWidth:=CW;
Form6.Width:=W2;
Form6.Height:=H2;
Panel1.Height:=H1;
Panel1.Width:=W1;
Panel1.Top:=T1;
Panel1.Left:=L1;
if stream<0 then
begin
xVideo_StreamFree(stream);
end;
stream:=xVideo_StreamCreateFile(PChar(ListBox2.Items.Strings[ListBox1.ItemIndex]),0,Panel1.Handle,0);
xVideo_ChannelResizeWindow(stream,0,0,0,panel1.Width,panel1.Height);
xVideo_ChannelPlay(stream);
ScrollBar1.Min:=0;
ScrollBar1.Max:=Trunc(xVideo_ChannelGetLength(stream,0));
xVideo_ChannelSetPosition(stream,P1,0);
ScrollBar1.Position:=P1;
Timer1.Enabled:=true;
StatusBar1.Visible:=true;
//скрываем компоненты
GroupBox1.Visible:=true;
Label2.Font.Color:=clWindowText;
ListBox1.Visible:=true;
ListBox2.Visible:=true;
ComboBox1.Visible:=true;
SpeedButton1.Visible:=true;
SpeedButton2.Visible:=true;
SpeedButton3.Visible:=true;
SpeedButton4.Visible:=true;
Label3.Visible:=true;
Label4.Visible:=true;
Label5.Visible:=true;
Trackbar1.Visible:=true;
//придаем значение переменой
FullScreen:=false;
N13.Enabled:=false;
N6.Enabled:=true;
N14.Enabled:=false;
N16.Enabled:=false;
N17.Enabled:=false;
N16.Click;
Timer2.Enabled:=true;
pb1.Visible:=true;
pr1.Visible:=true;
pr2.Visible:=true;
Timer3.Enabled:=true;
end
else
exit;
end;
inherited;
end;
procedure TForm6.Panel1DblClick(Sender: TObject);
begin
if FullScreen=false then
begin
//записываем панель
H1:=Panel1.Height;
L1:=Panel1.Left;
T1:=Panel1.Top;
W1:=Panel1.Width;
//записываем форму
CH:=Form6.ClientHeight;
CW:=Form6.ClientWidth;
H2:=Form6.Height;
L2:=Form6.Left;
T2:=Form6.Top;
W2:=Form6.Width;
P1:=Trunc(xVideo_ChannelGetPosition(stream,0)); //положение проигрывателя
Timer1.Enabled:=false; //останавливаем таймер
xVideo_ChannelStop(stream); //останавливаем воспроизведение
//делаем форму больше
Form6.BorderStyle:=bsNone;
Form6.FormStyle :=fsstayOnTop; //поверх окон
Form6.windowState:= wsMaximized;// на весь экран
Panel1.Width:=Form6.ClientWidth;
Panel1.Height:=Form6.ClientHeight;
if stream<0 then
begin
xVideo_StreamFree(stream);
end;
stream:=xVideo_StreamCreateFile(PChar(ListBox2.Items.Strings[ListBox1.ItemIndex]),0,Panel1.Handle,0);
xVideo_ChannelResizeWindow(stream,0,0,0,panel1.Width,panel1.Height);
xVideo_ChannelPlay(stream);
ScrollBar1.Min:=0;
ScrollBar1.Max:=Trunc(xVideo_ChannelGetLength(stream,0));
ScrollBar1.Position:=P1;
xVideo_ChannelSetPosition(stream,P1,0);
Timer1.Enabled:=true;
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Активирован полноэкраный режим',bitInfo,10);
StatusBar1.Visible:=false;
//скрываем компоненты
GroupBox1.Visible:=false;
Label2.Font.Color:=clRed;
ListBox1.Visible:=false;
ListBox2.Visible:=false;
ComboBox1.Visible:=false;
SpeedButton1.Visible:=false;
SpeedButton2.Visible:=false;
SpeedButton3.Visible:=false;
SpeedButton4.Visible:=false;
Label3.Visible:=false;
Label4.Visible:=false;
Label5.Visible:=false;
Trackbar1.Visible:=false;
//придаем значение переменой
FullScreen:=true;
N13.Enabled:=true;
N6.Enabled:=false;
N14.Enabled:=true;
N16.Enabled:=true;
N17.Enabled:=false;
Timer2.Enabled:=false;
pb1.Visible:=false;
pr1.Visible:=false;
pr2.Visible:=false;
Timer3.Enabled:=false;
end
else
exit;
end;
procedure TForm6.N6Click(Sender: TObject);
begin
if FullScreen=false then
begin
//записываем панель
H1:=Panel1.Height;
L1:=Panel1.Left;
T1:=Panel1.Top;
W1:=Panel1.Width;
//записываем форму
CH:=Form6.ClientHeight;
CW:=Form6.ClientWidth;
H2:=Form6.Height;
L2:=Form6.Left;
T2:=Form6.Top;
W2:=Form6.Width;
P1:=Trunc(xVideo_ChannelGetPosition(stream,0));
Timer1.Enabled:=false;
xVideo_ChannelStop(stream);
//делаем форму больше
Form6.BorderStyle:=bsNone;
Form6.FormStyle :=fsstayOnTop; //поверх окон
Form6.windowState:= wsMaximized;// на весь экран
Panel1.Width:=Form6.ClientWidth;
Panel1.Height:=Form6.ClientHeight;
if stream<0 then
xVideo_StreamFree(stream);
stream:=xVideo_StreamCreateFile(PChar(ListBox2.Items.Strings[ListBox1.ItemIndex]),0,Panel1.Handle,0);
xVideo_ChannelResizeWindow(stream,0,0,0,panel1.Width,panel1.Height);
xVideo_ChannelPlay(stream);
ScrollBar1.Min:=0;
ScrollBar1.Max:=Trunc(xVideo_ChannelGetLength(stream,0));
ScrollBar1.Position:=P1;
xVideo_ChannelSetPosition(stream,P1,0);
Timer1.Enabled:=true;
StatusBar1.Visible:=false;
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Активирован полноэкраный режим',bitInfo,10);
//скрываем компоненты
GroupBox1.Visible:=false;
Label2.Font.Color:=clRed;
ListBox1.Visible:=false;
ListBox2.Visible:=false;
ComboBox1.Visible:=false;
SpeedButton1.Visible:=false;
SpeedButton2.Visible:=false;
SpeedButton3.Visible:=false;
SpeedButton4.Visible:=false;
Label3.Visible:=false;
Label4.Visible:=false;
Label5.Visible:=false;
Trackbar1.Visible:=false;
//придаем значение переменой
FullScreen:=true;
N13.Enabled:=true;
N6.Enabled:=false;
N14.Enabled:=true;
N16.Enabled:=true;
N17.Enabled:=false;
Timer2.Enabled:=false;
pb1.Visible:=false;
pr1.Visible:=false;
pr2.Visible:=false;
Timer3.Enabled:=false;
end
else
exit;
end;
procedure TForm6.N13Click(Sender: TObject);
begin
if FullScreen=true then
begin
P1:=Trunc(xVideo_ChannelGetPosition(stream,0));
Timer1.Enabled:=false;
xVideo_ChannelStop(stream);
//делаем форму обычной;
Form6.BorderStyle:=bsSizeable;
Form6.FormStyle:=fsNormal;
Form6.WindowState:=wsNormal;
Form6.Top:=T2;
Form6.Left:=L2;
Form6.ClientHeight:=CH;
Form6.ClientWidth:=CW;
Form6.Width:=W2;
Form6.Height:=H2;
Panel1.Height:=H1;
Panel1.Width:=W1;
Panel1.Top:=T1;
Panel1.Left:=L1;
if stream<0 then
begin
xVideo_StreamFree(stream);
end;
stream:=xVideo_StreamCreateFile(PChar(ListBox2.Items.Strings[ListBox1.ItemIndex]),0,Panel1.Handle,0);
xVideo_ChannelResizeWindow(stream,0,0,0,panel1.Width,panel1.Height);
xVideo_ChannelPlay(stream);
ScrollBar1.Min:=0;
ScrollBar1.Max:=Trunc(xVideo_ChannelGetLength(stream,0));
xVideo_ChannelSetPosition(stream,P1,0);
ScrollBar1.Position:=P1;
Timer1.Enabled:=true;
Form1.CoolTrayIcon1.ShowBalloonHint('Информация','Деактивирован полноэкраный режим',bitInfo,10);
StatusBar1.Visible:=true;
//скрываем компоненты
GroupBox1.Visible:=true;
Label2.Font.Color:=clWindowText;
ListBox1.Visible:=true;
ListBox2.Visible:=true;
ComboBox1.Visible:=true;
SpeedButton1.Visible:=true;
SpeedButton2.Visible:=true;
SpeedButton3.Visible:=true;
SpeedButton4.Visible:=true;
Label3.Visible:=true;
Label4.Visible:=true;
Label5.Visible:=true;
Trackbar1.Visible:=true;
//придаем значение переменой
FullScreen:=false;
N6.Enabled:=true;
N13.Enabled:=false;
N14.Enabled:=false;
N16.Enabled:=false;
N17.Enabled:=false;
N16.Click;
Timer2.Enabled:=true;
pb1.Visible:=true;
pr1.Visible:=true;
pr2.Visible:=true;
Timer3.Enabled:=true;
end
else
exit;
end;
procedure TForm6.N14Click(Sender: TObject);
begin
if GroupBox1.Visible=false then
begin
GroupBox1.Visible:=true;
N14.Enabled:=false;
N15.Enabled:=true;
end;
end;
procedure TForm6.N15Click(Sender: TObject);
begin
if GroupBox1.Visible=true then
begin
GroupBox1.Visible:=false;
N15.Enabled:=false;
N14.Enabled:=true;
end;
end;
function TForm6.GetFileSize(filename: string): Integer;
Var
InfoFile : TSearchRec;
AttrFile : Integer;
ErrorReturn : Integer;
Begin
AttrFile := $0000003F; {Any file}
ErrorReturn := FindFirst(filename,AttrFile,InfoFile);
if ErrorReturn <> 0 Then Result := -1 {в случае, если файл не найден}
else Result := InfoFile.Size; {Размер файла в байтах}
FindClose(InfoFile);
end;
procedure TForm6.N16Click(Sender: TObject);
begin
Label3.Visible:=true;
TrackBar1.Visible:=true;
N16.Enabled:=false;
N17.Enabled:=true;
end;
procedure TForm6.N17Click(Sender: TObject);
begin
Label3.Visible:=false;
TrackBar1.Visible:=false;
N16.Enabled:=true;
N17.Enabled:=false;
end;
function TForm6.KHZStream(s: Cardinal): Integer;
Var CHANINFO : BASS_CHANNELINFO;
begin
result:=0;
BASS_ChannelGetInfo(stream, CHANINFO);
result := round(CHANINFO.freq);
end;
procedure TForm6.Draw(HWND: THandle; FFTData: TFFTData; X, Y: Integer);
var i, YPos : LongInt; YVal : Single;
begin
//очистка области визуализации
pb1.Canvas.Pen.Color := clBlack;
pb1.Canvas.Brush.Color := clBlack;
pb1.Canvas.Rectangle(0, 0, pb1.Width, pb1.Height);
//визуализация
// pb1.Canvas.Pen.Color := clRed;
for i := 0 to 65 do begin // количество столбиков
YVal := Abs(FFTData[i]);
YPos := trunc((YVal) * 500);
if YPos > pb1.Height then YPos := pb1.Height;
if YPos >= FFTPeacks[i] then FFTPeacks[i] := YPos
else FFTPeacks[i] := FFTPeacks[i] - 1;
if YPos >= FFTFallOff[i] then FFTFallOff[i] := YPos
else FFTFallOff[i] := FFTFallOff[i] - 3;
//рисование пика
pb1.Canvas.Pen.Color := clRed;
pb1.Canvas.MoveTo(X + i*(3+1) , Y + pb1.Height - FFTPeacks[i]);
pb1.Canvas.LineTo(X + i*(3+1) + 3, Y + pb1.Height - FFTPeacks[i]);
//рисование столбика
pb1.Canvas.Pen.Color := clWhite;
pb1.Canvas.Brush.Color := clBlue;
pb1.Canvas.Rectangle(X + i*(3+1) , Y + pb1.Height - FFTFallOff[i], X + i*(3+1) + 3, Y + pb1.Height);
end;
end;
procedure TForm6.pb1Paint(Sender: TObject);
begin
//фон окна визуализации
pb1.Canvas.Pen.Color:=clBlack; //цвет пера
pb1.Canvas.Brush.Color:=clBlack;//цвет кисти
pb1.Canvas.Rectangle(0,0,pb1.Width,pb1.Height); //рисуем прямоугольник фон
end;
procedure TForm6.Timer2Timer(Sender: TObject);
var FFTFata : TFFTData;
begin
xVideo_ChannelGetData(stream,@FFTFata, BASS_DATA_FFT1024);
Draw (pb1.Canvas.Handle, FFTFata, 0,-5);
end;
procedure TForm6.Timer3Timer(Sender: TObject);
var
R, L, G: DWORD;
begin
G:=xVideo_ChannelGetLevel(stream);
R:=HIWORD(G);
L:=LOWORD(G);
Pr1.Position:=R;
Pr2.Position:=L;
end;
end. |