загрузка в новый гит с мелкими правками
This commit is contained in:
@@ -5,7 +5,7 @@ interface
|
||||
uses
|
||||
System.SysUtils, System.Classes, Web.HTTPApp, FMX.Types,
|
||||
FMX.Controls3D, FMX.Objects3D, FMX.Controls, FMX.Forms, FMX.StdCtrls,
|
||||
FMX.Edit, FMX.ListBox, uPlayerThread, bass_simple;
|
||||
FMX.Edit, FMX.ListBox, uPlayerThread;
|
||||
|
||||
type
|
||||
TOBS_Doc_Player = class(TWebModule)
|
||||
@@ -35,7 +35,7 @@ var
|
||||
ProgressBar1: TProgressBar;
|
||||
TrackBar1: TTrackBar;
|
||||
ListBox1: TListBox;
|
||||
b: TBassSimple;
|
||||
|
||||
player: TPlayerThread;
|
||||
mVolume: Integer;
|
||||
isplay: string;
|
||||
@@ -67,7 +67,7 @@ end;
|
||||
|
||||
procedure TOBS_Doc_Player.Button1Click(Sender: TObject);
|
||||
begin
|
||||
b.Pause;
|
||||
//b.Pause;
|
||||
if isplay = '0' then
|
||||
isplay := '1'
|
||||
else
|
||||
@@ -179,7 +179,7 @@ end;
|
||||
procedure TOBS_Doc_Player.TrackBar1Change(Sender: TObject);
|
||||
begin
|
||||
mVolume := Round(TrackBar1.Value);
|
||||
b.Volume := mVolume;
|
||||
//b.Volume := mVolume;
|
||||
end;
|
||||
|
||||
procedure TOBS_Doc_Player.WebModule1DefaultHandlerAction(Sender: TObject;
|
||||
@@ -217,7 +217,7 @@ begin
|
||||
// Åñëè óäàëîñü ïðåîáðàçîâàòü, îáíîâëÿåì ïåðåìåííóþ mVolume
|
||||
mVolume := VolumeValue;
|
||||
// Îáíîâëÿåì çâóê íà ñåðâåðå (åñëè íóæíî, íàïðèìåð, ÷åðåç áèáëèîòåêó bass)
|
||||
b.Volume := mVolume;
|
||||
//b.Volume := mVolume;
|
||||
// Âîçâðàùàåì îáíîâëåííîå ñîñòîÿíèå íà ñòðàíèöó
|
||||
Response.Content := gethtml;
|
||||
end
|
||||
@@ -253,8 +253,8 @@ end;
|
||||
procedure TOBS_Doc_Player.WebModuleCreate(Sender: TObject);
|
||||
begin
|
||||
mySoundPath := GetPathToTestExe + 'TTW_Bot\ytSongs';
|
||||
b := TBassSimple.Create(0);
|
||||
player := TPlayerThread.Create(b, mySoundPath);
|
||||
//b := TBassSimple.Create(0);
|
||||
player := TPlayerThread.Create({b,} mySoundPath);
|
||||
player.OnAddAd := add;
|
||||
player.OnSkip := del;
|
||||
mVolume := 0;
|
||||
@@ -266,7 +266,7 @@ end;
|
||||
procedure TOBS_Doc_Player.WebModuleDestroy(Sender: TObject);
|
||||
begin
|
||||
player.Free;
|
||||
b.Free;
|
||||
// b.Free;
|
||||
ListBox1.Free;
|
||||
end;
|
||||
|
||||
|
||||
+13
-13
@@ -3,7 +3,7 @@ unit uPlayerThread;
|
||||
interface
|
||||
|
||||
uses
|
||||
System.Classes, System.SysUtils, System.SyncObjs, System.Generics.Collections, bass_simple,
|
||||
System.Classes, System.SysUtils, System.SyncObjs, System.Generics.Collections, {bass_simple,}
|
||||
System.IOUtils, System.Types;
|
||||
|
||||
type
|
||||
@@ -12,7 +12,7 @@ type
|
||||
|
||||
TPlayerThread = class(TThread)
|
||||
private
|
||||
b: tbasssimple;
|
||||
{b: tbasssimple;}
|
||||
FFilesQueue: TList<string>;
|
||||
FQueueCS: TCriticalSection;
|
||||
FCurrentFile: string;
|
||||
@@ -29,7 +29,7 @@ type
|
||||
protected
|
||||
procedure Execute; override;
|
||||
public
|
||||
constructor Create(var ab: tbasssimple; const aFolder: string);
|
||||
constructor Create({var ab: tbasssimple;} const aFolder: string);
|
||||
destructor Destroy; override;
|
||||
procedure Skip;
|
||||
property OnError: TOnError read FOnError write FOnError;
|
||||
@@ -39,15 +39,15 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
constructor TPlayerThread.Create(var ab: tbasssimple; const aFolder: string);
|
||||
constructor TPlayerThread.Create({var ab: tbasssimple;} const aFolder: string);
|
||||
begin
|
||||
inherited Create(True);
|
||||
b := ab;
|
||||
{b := ab;}
|
||||
FMusicFolder := aFolder;
|
||||
FIsPlaying := False;
|
||||
b.OnPlay := OnPlayHandler;
|
||||
b.OnStop := OnStopHandler;
|
||||
b.OnEndPlay := OnEndPlayHandler;
|
||||
{b.OnPlay := OnPlayHandler;
|
||||
b.OnStop := OnStopHandler;
|
||||
b.OnEndPlay := OnEndPlayHandler;}
|
||||
FFilesQueue := TList<string>.Create;
|
||||
FQueueCS := TCriticalSection.Create;
|
||||
end;
|
||||
@@ -103,7 +103,7 @@ begin
|
||||
TThread.Synchronize(nil,
|
||||
procedure
|
||||
begin
|
||||
b.Play(FCurrentFile);
|
||||
{b.Play(FCurrentFile);}
|
||||
end);
|
||||
|
||||
FIsPlaying := True;
|
||||
@@ -148,8 +148,8 @@ end;
|
||||
procedure TPlayerThread.OnEndPlayHandler(Sender: TObject);
|
||||
begin
|
||||
try
|
||||
b.Stop;
|
||||
b.FreeStream;
|
||||
{ b.Stop;
|
||||
b.FreeStream;}
|
||||
if FileExists(FCurrentFile) then
|
||||
begin
|
||||
DeleteFile(FCurrentFile);
|
||||
@@ -167,8 +167,8 @@ procedure TPlayerThread.Skip;
|
||||
begin
|
||||
if FIsPlaying then
|
||||
begin
|
||||
b.Stop;
|
||||
b.FreeStream;
|
||||
{ b.Stop;
|
||||
b.FreeStream;}
|
||||
if FileExists(FCurrentFile) then
|
||||
begin
|
||||
DeleteFile(FCurrentFile);
|
||||
|
||||
+18
-17
@@ -2,7 +2,7 @@ unit uSoundManager;
|
||||
|
||||
interface
|
||||
|
||||
uses System.classes, winapi.ShellAPI, bass_simple, winapi.windows, System.SysUtils;
|
||||
uses System.classes, winapi.ShellAPI, {bass_simple,} winapi.windows, System.SysUtils;
|
||||
|
||||
type
|
||||
TSongMachine = class(TObject)
|
||||
@@ -21,20 +21,21 @@ implementation
|
||||
|
||||
uses uGeneral;
|
||||
|
||||
var
|
||||
mp: TBassSimple;
|
||||
{ var
|
||||
mp: TBassSimple;}
|
||||
|
||||
{ SongMachine }
|
||||
|
||||
constructor TSongMachine.Create;
|
||||
begin
|
||||
mp := TBassSimple.Create(0);
|
||||
inherited;
|
||||
{ mp := TBassSimple.Create(0);}
|
||||
end;
|
||||
|
||||
destructor TSongMachine.Destroy;
|
||||
begin
|
||||
mp.FreeStream;
|
||||
mp.Free;
|
||||
{ mp.FreeStream;
|
||||
mp.Free;}
|
||||
end;
|
||||
|
||||
function TimeToSeconds(const timeStr: string): Integer;
|
||||
@@ -55,7 +56,7 @@ end;
|
||||
procedure TSongMachine.PlaySilent(AFileName: string; aVolume: string);
|
||||
var
|
||||
sec: string;
|
||||
mm: TBassSimple;
|
||||
{ mm: TBassSimple;}
|
||||
begin
|
||||
try
|
||||
if not FileExists(AFileName) then
|
||||
@@ -63,14 +64,14 @@ begin
|
||||
TTW_Bot.toLog( 'TSongMachine', 'PlayPublic', 'Íåò ôàéëà ' + AFileName,2);
|
||||
exit;
|
||||
end;
|
||||
mm := TBassSimple.Create(0);
|
||||
try
|
||||
mm.OpenFile(AFileName);
|
||||
sec := inttostr(TimeToSeconds(mm.TimeLength) + 1);
|
||||
finally
|
||||
mm.FreeStream;
|
||||
mm.Free;
|
||||
end;
|
||||
{ mm := TBassSimple.Create(0);
|
||||
try
|
||||
mm.OpenFile(AFileName);
|
||||
sec := inttostr(TimeToSeconds(mm.TimeLength) + 1);
|
||||
finally
|
||||
mm.FreeStream;
|
||||
mm.Free;
|
||||
end;}
|
||||
ShellExecute(0, 'open', PChar(myConst.SilentPlay),
|
||||
PChar(Format('%s %s "%s"', [sec, aVolume, AFileName])), nil, SW_HIDE);
|
||||
except
|
||||
@@ -87,8 +88,8 @@ begin
|
||||
TTW_Bot.toLog( 'TSongMachine', 'PlayPublic', 'Íåò ôàéëà ' + AFileName,2);
|
||||
exit;
|
||||
end;
|
||||
mp.Volume := strtoint(aVolume);
|
||||
mp.Play(AFileName)
|
||||
{ mp.Volume := strtoint(aVolume);
|
||||
mp.Play(AFileName)}
|
||||
except
|
||||
on e: Exception do
|
||||
TTW_Bot.toLog( 'TSongMachine', 'PlaySilent', e.message,2)
|
||||
|
||||
@@ -17,7 +17,7 @@ type
|
||||
|
||||
type
|
||||
TTTW_Chat = class(TObject)
|
||||
msgStyle: TStyleChat;
|
||||
|
||||
fFontsList: tstringlist;
|
||||
IdHTTPServer1: TIdHTTPServer;
|
||||
procedure IdHTTPServer1CommandGet(AContext: TIdContext;
|
||||
@@ -31,6 +31,7 @@ type
|
||||
function GenerateJSON: string;
|
||||
procedure CleanupOldMessages;
|
||||
public
|
||||
msgStyle: TStyleChat;
|
||||
constructor Create(FontList: tstrings; aPort:integer; aColor:string);
|
||||
destructor Destroy;
|
||||
procedure addMessage(newMsg: TStyleChat);
|
||||
|
||||
Reference in New Issue
Block a user