Skip to content

Commit

Permalink
Release 1.5.2. Added some protection if audio file is corrupted.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredvs committed Oct 24, 2017
1 parent 0a9b8b2 commit 2cbd348
Show file tree
Hide file tree
Showing 8 changed files with 2,102 additions and 2,098 deletions.
22 changes: 19 additions & 3 deletions src/commander.mfm
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ object commanderfo: tcommanderfo
font.localprops = [flp_color, flp_height]
imagenr = 27
focusrectdist = 0
onexecute = setvu
onexecute = setvuin
end
object nameplayers: tstringdisp
color = -2147483645
Expand Down Expand Up @@ -816,15 +816,31 @@ object commanderfo: tcommanderfo
frame.localprops1 = []
taborder = 26
visible = False
bounds_x = 138
bounds_x = 147
bounds_y = 45
bounds_cx = 29
bounds_cx = 20
bounds_cy = 21
statfile = mainfo.tstatfile1
onchange = setautomix
valuemax = 10
reffontheight = 15
end
object edvuin: tintegeredit
frame.localprops = []
frame.localprops1 = []
taborder = 27
visible = False
bounds_x = 114
bounds_y = 44
bounds_cx = 21
bounds_cy = 21
statfile = mainfo.tstatfile1
onchange = setvu
value = 1
valuedefault = 1
valuemax = 10
reffontheight = 15
end
end
object tgroupboxdrums: tgroupbox
color = -2147483645
Expand Down
35 changes: 24 additions & 11 deletions src/commander.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
interface

uses
msetypes, mseglob, mseguiglob, mseguiintf, mseapplication, msestat, msemenus,
msegui, msetimer, msegraphics, msegraphutils, mseevent, mseclasses, mseforms,
msedock, msedragglob, msesimplewidgets, msewidgets, mseact, msebitmap,
msedataedits, msedatanodes, mseedit, msefiledialog, msegrids, mseificomp,
mseificompglob, mseifiglob, mselistbrowser, msestatfile, msestream, msestrings,
msesys, SysUtils, msegraphedits, msescrollbar, msedispwidgets, mserichstring;
msetypes, mseglob, mseguiglob, mseguiintf, mseapplication, msestat, msemenus,
msegui, msetimer, msegraphics, msegraphutils, mseevent, mseclasses, mseforms,
msedock, msedragglob, msesimplewidgets, msewidgets, mseact, msebitmap,
msedataedits, msedatanodes, mseedit, msefiledialog, msegrids, mseificomp,
mseificompglob, mseifiglob, mselistbrowser, msestatfile, msestream, msestrings,
msesys, SysUtils, msegraphedits, msescrollbar, msedispwidgets, mserichstring;

type
tcommanderfo = class(tdockform)
Expand Down Expand Up @@ -61,6 +61,7 @@ tcommanderfo = class(tdockform)
vuLeft2: tprogressbar;
automix: TButton;
edautomix: tintegeredit;
edvuin: tintegeredit;
procedure formcreated(const Sender: TObject);
procedure visiblechangeev(const Sender: TObject);
procedure onplay(const Sender: TObject);
Expand All @@ -82,6 +83,7 @@ tcommanderfo = class(tdockform)
procedure setvu(const Sender: TObject);
procedure setautomix(const Sender: TObject);
procedure onexecautomix(const Sender: TObject);
procedure setvuin(const sender: TObject);
end;

var
Expand Down Expand Up @@ -522,15 +524,13 @@ procedure tcommanderfo.setlr2(const Sender: TObject);

procedure tcommanderfo.setvu(const Sender: TObject);
begin
if vuin.tag = 0 then
if edvuin.Value = 1 then
begin
vuin.tag := 1;
vuin.face.template := mainfo.tfacebutgray;
vuin.face.template := mainfo.tfacebutgray;
end
else
if vuin.tag = 1 then
if edvuin.Value = 0 then
begin
vuin.tag := 0;
vuin.face.template := mainfo.tfacegreen;
end;

Expand Down Expand Up @@ -562,4 +562,17 @@ procedure tcommanderfo.onexecautomix(const Sender: TObject);
end;
end;

procedure tcommanderfo.setvuin(const sender: TObject);
begin
if edvuin.Value = 1 then
begin
edvuin.Value := 0;
end
else
begin
if edvuin.Value = 0 then
edvuin.Value := 1;
end;
end;

end.
3,824 changes: 1,918 additions & 1,906 deletions src/commander_mfm.pas

Large diffs are not rendered by default.

33 changes: 23 additions & 10 deletions src/filelistform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ procedure tfilelistfo.onsent(const Sender: TObject);

if theplaysender = 0 then
begin
if fileexists((list_files[4][thefocusedcell.row])) then
begin
songplayerfo.historyfn.Value := tosysfilepath(list_files[4][thefocusedcell.row]);

songplayerfo.historyfn.face.template := mainfo.tfaceorange;
Expand All @@ -132,11 +134,15 @@ procedure tfilelistfo.onsent(const Sender: TObject);
commanderfo.tbutton2.SetFocus;
songplayerfo.timersent.Enabled := False;
songplayerfo.timersent.Enabled := True;
end else
ShowMessage(tosysfilepath(list_files[4][thefocusedcell.row]) + ' does not exist or not mounted...');
end;

if theplaysender = 1 then
if theplaysender = 1 then
begin
//songplayer2fo.historyfn.dropdown.valuelist.asarray:= filename.dropdown.valuelist.asarray;
if fileexists((list_files[4][thefocusedcell.row])) then
begin

songplayer2fo.historyfn.Value := tosysfilepath(list_files[4][thefocusedcell.row]);

songplayer2fo.historyfn.face.template := mainfo.tfaceorange;
Expand All @@ -146,10 +152,18 @@ procedure tfilelistfo.onsent(const Sender: TObject);
commanderfo.tbutton3.SetFocus;
songplayer2fo.timersent.Enabled := False;
songplayer2fo.timersent.Enabled := True;
end;
list_files.selectcell(thefocusedcell, csm_select, False);
end;
end;
end else
ShowMessage(tosysfilepath(list_files[4][thefocusedcell.row]) + ' does not exist or not mounted...');

end;

list_files.selectcell(thefocusedcell, csm_select, False);

end;
end else
begin
ShowMessage('Directory ' + historyfn.Value + ' does not exist or not mounted...');
end;
end;

procedure tfilelistfo.whosent(const Sender: tfiledialogcontroller; var dialogkind: filedialogkindty; var aresult: modalresultty);
Expand All @@ -168,6 +182,7 @@ procedure tfilelistfo.onchangpath(const Sender: TObject);

if directoryexists(historyfn.Value) then
begin
list_files.tag := 0;

historyfn.hint := ' Selected: ' + historyfn.Value + ' ';

Expand Down Expand Up @@ -202,7 +217,6 @@ procedure tfilelistfo.onchangpath(const Sender: TObject);
end;
end;


procedure tfilelistfo.onafterdialog(const Sender: tfiledialogcontroller; var aresult: modalresultty);
begin
//list_files.path := dir.value;
Expand All @@ -225,7 +239,7 @@ procedure tfilelistfo.onfloat(const Sender: TObject);
//sizebefdock.cy := 500;
//size := sizebefdock;
bounds_cxmax := fowidth;
bounds_cymax := 600;
bounds_cymax := 700;
end;

procedure tfilelistfo.afterdrag(const asender: TObject; const apos: pointty; var adragobject: tdragobject;
Expand Down Expand Up @@ -259,7 +273,6 @@ procedure tfilelistfo.oncellev(const Sender: TObject; var info: celleventinfoty)

cellpos := info.cell;


if (info.eventkind = cek_buttonrelease) or (info.eventkind = cek_focusedcellchanged) then
begin
if (cellpos.row = -1) and (cellpos.col = 3) then
Expand Down
10 changes: 6 additions & 4 deletions src/main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ tmainfo = class(tmainform)
end;

const
versiontext = '1.5.1';
versiontext = '1.5.2';
emptyheight = 40;
drumsfoheight = 236;
filelistfoheight = 128;
Expand Down Expand Up @@ -185,10 +185,12 @@ procedure tmainfo.onabout(const Sender: TObject);
begin
aboutfo.Caption := 'About StrumPract';
aboutfo.about_text.frame.colorclient := $DFFFB2;
aboutfo.about_text.Value := c_linefeed + c_linefeed + 'StrumPract ' + versiontext + ' for ' + platformtext +
c_linefeed + c_linefeed + 'Compiled with FPC 3.0.3.' + c_linefeed + 'http://www.freepascal.org' + c_linefeed +
aboutfo.about_text.Value := c_linefeed + 'StrumPract ' + versiontext + ' for ' + platformtext +
c_linefeed + 'https://github.com/fredvs/strumpract/releases/' +
c_linefeed +
c_linefeed + 'Compiled with FPC 3.0.3.' + c_linefeed + 'http://www.freepascal.org' + c_linefeed +
c_linefeed + 'Graphic widget: MSEgui ' + mseguiversiontext + '.' + c_linefeed + 'http://sourceforge.net/projects/mseide-msegui/' +
c_linefeed + c_linefeed + 'Audio library: uos 1.7 (United Openlib of Sound)' + c_linefeed + 'https://github.com/fredvs/uos' +
c_linefeed + c_linefeed + 'Audio library: uos 1.7. (United Openlib of Sound)' + c_linefeed + 'https://github.com/fredvs/uos' +
c_linefeed + c_linefeed + 'Copyright 2017' + c_linefeed + 'Fred van Stappen <fiens@hotmail.com>';
aboutfo.Show(True);
end;
Expand Down
26 changes: 12 additions & 14 deletions src/songplayer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ procedure tsongplayerfo.ShowLevel(const Sender: TObject);
vuLeft.Visible := True;
vuRight.Visible := True;

if (commanderfo.Visible) and (commanderfo.vuin.tag = 0) then
if (commanderfo.Visible) and (commanderfo.edvuin.value = 0) then
begin
commanderfo.vuLeft.Visible := True;
commanderfo.vuRight.Visible := True;
Expand All @@ -267,24 +267,24 @@ procedure tsongplayerfo.ShowLevel(const Sender: TObject);
if leftlev < 0.80 then
begin
vuLeft.bar_face.template := mainfo.tfacegreen;
if (commanderfo.Visible) and (commanderfo.vuin.tag = 0) then
if (commanderfo.Visible) and (commanderfo.edvuin.value = 0) then
commanderfo.vuLeft.bar_face.template := mainfo.tfacegreen;
end
else
if leftlev < 0.90 then
begin
vuLeft.bar_face.template := mainfo.tfaceorange;
if (commanderfo.Visible) and (commanderfo.vuin.tag = 0) then
if (commanderfo.Visible) and (commanderfo.edvuin.value = 0) then
commanderfo.vuLeft.bar_face.template := mainfo.tfaceorange;
end
else
begin
vuLeft.bar_face.template := mainfo.tfacered;
if (commanderfo.Visible) and (commanderfo.vuin.tag = 0) then
if (commanderfo.Visible) and (commanderfo.edvuin.value = 0) then
commanderfo.vuLeft.bar_face.template := mainfo.tfacered;
end;
vuLeft.Value := leftlev;
if (commanderfo.Visible) and (commanderfo.vuin.tag = 0) then
if (commanderfo.Visible) and (commanderfo.edvuin.value = 0) then
commanderfo.vuLeft.Value := leftlev;
end;

Expand All @@ -295,24 +295,24 @@ procedure tsongplayerfo.ShowLevel(const Sender: TObject);
begin
vuRight.bar_face.template := mainfo.tfacegreen;

if (commanderfo.Visible) and (commanderfo.vuin.tag = 0) then
if (commanderfo.Visible) and (commanderfo.edvuin.value = 0) then
commanderfo.vuRight.bar_face.template := mainfo.tfacegreen;
end
else
if rightlev < 0.90 then
begin
vuRight.bar_face.template := mainfo.tfaceorange;
if (commanderfo.Visible) and (commanderfo.vuin.tag = 0) then
if (commanderfo.Visible) and (commanderfo.edvuin.value = 0) then
commanderfo.vuRight.bar_face.template := mainfo.tfaceorange;
end
else
begin
vuRight.bar_face.template := mainfo.tfacered;
if (commanderfo.Visible) and (commanderfo.vuin.tag = 0) then
if (commanderfo.Visible) and (commanderfo.edvuin.value = 0) then
commanderfo.vuRight.bar_face.template := mainfo.tfacered;
end;
vuright.Value := rightlev;
if (commanderfo.Visible) and (commanderfo.vuin.tag = 0) then
if (commanderfo.Visible) and (commanderfo.edvuin.value = 0) then
commanderfo.vuright.Value := rightlev;
end;

Expand Down Expand Up @@ -602,7 +602,7 @@ procedure tsongplayerfo.doplayerstart(const Sender: TObject);

end
else
ShowMessage(historyfn.Value + ' does not exist...');
ShowMessage(historyfn.Value + ' does not exist or not mounted...');
end
else
ShowMessage(historyfn.Value + ' is not a audio file...');
Expand Down Expand Up @@ -867,11 +867,9 @@ procedure tsongplayerfo.oninfowav(const Sender: TObject);
else


if (waveformcheck.Value = True) then
if (waveformcheck.Value = True) and (iswav = False) then
begin

iswav := False;

chan1 := uos_InputGetChannels(theplayerinfo, 0);

// writeln('chan = ' + inttostr(chan1));
Expand Down Expand Up @@ -901,7 +899,7 @@ procedure tsongplayerfo.oninfowav(const Sender: TObject);
ShowMessage(historyfn.Value + ' cannot load...');
end
else
ShowMessage(historyfn.Value + ' does not exist...');
ShowMessage(historyfn.Value + ' does not exist or not mounted...');
end
else
ShowMessage(historyfn.Value + ' is not a audio file...');
Expand Down
Loading

0 comments on commit 2cbd348

Please sign in to comment.