Skip to content

Commit

Permalink
Some more code for BPMGet.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredvs committed Nov 28, 2017
1 parent b5f5571 commit 014d46b
Show file tree
Hide file tree
Showing 14 changed files with 133 additions and 131 deletions.
26 changes: 16 additions & 10 deletions examples/consolebpmdetect.pas
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ctypes,
SysUtils,
CustApp,
uos_soundtouch,
uos_flat;

type
Expand Down Expand Up @@ -100,27 +101,31 @@ TuosConsole = class(TCustomApplication)
SoundFilename := opath + '/sound/test.mp3';
{$ENDIF}

// SoundFilename := ordir + 'sound/testbpm.ogg';

// Load the libraries
// Load the libraries
// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename: PChar) : LongInt;
res := uos_LoadLib(Pchar(PA_FileName), Pchar(SF_FileName), Pchar(MP_FileName), nil, nil, nil) ;

writeln('Result of loading libraries (if 0 => ok ) : ' + IntToStr(res));


res2 := uos_LoadPlugin('soundtouch', Pchar(ST_FileName));

writeln('Result of loading SoundTouch plugin (if 0 => ok ) : ' + IntToStr(res2));

if (res = 0) and (res2 = 0) then begin

// Create a memory buffer from a audio file with 1024 buffers.
writeln('soundtouch_getVersionId = ' + inttostr(soundtouch_getVersionId()));

writeln('soundtouch_getVersionString = ' + (soundtouch_getVersionString()));

// {
// Create a memory buffer from a audio file with 1024 frames.
thebuffer := uos_File2Buffer(pchar(SoundFilename), 0, thebufferinfos, 1024);

writeln('length(thebuffer) = ' + inttostr(length(thebuffer)));

writeln('BPM = ' + floattostr(uos_GetBPM(thebuffer,thebufferinfos.channels,thebufferinfos.samplerate)));
// }
end else writeln('Libraries did not load... ;-(');


Expand All @@ -129,10 +134,11 @@ TuosConsole = class(TCustomApplication)
procedure TuosConsole.doRun;
begin
ConsolePlay;
writeln('Press a key to exit...');
readln;
Terminate;
uos_free();
// writeln('Press a key to exit...');
// readln;
uos_free();
Terminate;

end;

constructor TuosConsole.Create(TheOwner: TComponent);
Expand All @@ -145,7 +151,7 @@ constructor TuosConsole.Create(TheOwner: TComponent);
Application: TUOSConsole;
begin
Application := TUOSConsole.Create(nil);
Application.Title := 'Console Player from Buffer-Memory';
Application.Title := 'Console BPM finder Buffer-Memory';
Application.Run;
Application.Free;
end.
Expand Down
32 changes: 19 additions & 13 deletions examples/consolebpmdetect.prj
Original file line number Diff line number Diff line change
Expand Up @@ -514,13 +514,13 @@ makeoptionson=8
63
63
3
34
52
42
60
63
compilerusedon=29
4094
4086
1
0
8
0
0
0
Expand Down Expand Up @@ -919,9 +919,10 @@ findhistory=20
uos_unloadlib()
play()
findoptions=1
editpos=5
editpos=6
0,-1073741823
64,98
0,-1073741823
0,14
0,-1073741823
0,-1073741823
0,-1073741823
Expand All @@ -930,19 +931,23 @@ bookmarks1=0
bookmarks2=0
bookmarks3=0
bookmarks4=0
sourcefiles=5
bookmarks5=0
sourcefiles=6
${PROJECTDIR}/uos.pas
${PROJECTDIR}/consolebpmdetect.pas
${PROJECTDIR}/uos_flat.pas
${PROJECTDIR}/uos_soundtouch.pas
${PROJECTDIR}/uos_shout.pas
relpaths=5
${PROJECTDIR}/uos.pas
relpaths=6
uos.pas
consolebpmdetect.pas
uos_flat.pas
uos_soundtouch.pas
uos_shout.pas
ismoduletexts=5
uos.pas
ismoduletexts=6
0
0
0
0
Expand All @@ -957,12 +962,13 @@ visiblemodules=1
nomenumodules=1
0
[sourcefo.files_tab]
order=5
order=6
0
4
1
2
3
5
firsttab=0
index=2
[layout]
Expand Down Expand Up @@ -1437,16 +1443,16 @@ windowlayout=560
mdistate=0
nx=0
ny=0
ncx=1113
ncy=53
ncx=1111
ncy=52
x=0
y=0
cx=1113
cy=53
rcx=0
rcy=0
[debuggerfo.project_options]
value=1
value=2
[debuggerfo.edit_options]
value=X
[debuggerfo.edit_compilernum]
Expand Down
11 changes: 6 additions & 5 deletions examples/consoleplay.pas
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ TuosConsole = class(TCustomApplication)
writeln('Artist: ' + uos_InputGetTagArtist(PlayerIndex1, InputIndex1));
writeln;

sleep(3000);
sleep(2000);
end;
end;
end;
Expand All @@ -149,10 +149,11 @@ TuosConsole = class(TCustomApplication)
procedure TuosConsole.doRun;
begin
ConsolePlay;
writeln('Press a key to exit...');
readln;
Terminate;
uos_free(); // Do not forget this !
// writeln('Press a key to exit...');
// readln;
writeln('Ciao...');
uos_free(); // Do not forget this !
Terminate;
end;

constructor TuosConsole.Create(TheOwner: TComponent);
Expand Down
12 changes: 6 additions & 6 deletions examples/consoleplay.prj
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ findhistory=20
PPmpg123_id3v1
findoptions=1
editpos=1
0,0
0,131
bookmarks0=0
sourcefiles=1
${PROJECTDIR}/consoleplay.pas
Expand Down Expand Up @@ -1000,7 +1000,7 @@ windowlayout=560
rcy=0
wsize=0
active=0
visible=0
visible=1
[threadsfo]
splitdir=0
useroptions=805322857
Expand All @@ -1022,7 +1022,7 @@ windowlayout=560
[memoryfo]
splitdir=0
useroptions=805322875
stackedunder=about_form
stackedunder=dialogfilesfo
parent=
mdistate=0
nx=0
Expand Down Expand Up @@ -1068,7 +1068,7 @@ windowlayout=560
[findinfilefo]
splitdir=0
useroptions=268451947
stackedunder=mainfo
stackedunder=
parent=
mdistate=0
nx=0
Expand Down Expand Up @@ -1186,7 +1186,7 @@ windowlayout=560
[objectinspectorfo]
splitdir=0
useroptions=805322859
stackedunder=_mse_guitemplatesmo_mse_
stackedunder=
parent=
mdistate=0
nx=0
Expand Down Expand Up @@ -1455,7 +1455,7 @@ windowlayout=560
irqoff=0
splitdir=0
useroptions=268451947
stackedunder=objectinspectorfo
stackedunder=_mse_guitemplatesmo_mse_
parent=
mdistate=0
nx=0
Expand Down
4 changes: 1 addition & 3 deletions examples/consoleplayloop.pas
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ TuosConsole = class(TCustomApplication)
procedure TuosConsole.doRun;
begin
ConsolePlay;
writeln('Press a key to exit...');
readln;
Terminate;
uos_free();
Terminate;
end;

constructor TuosConsole.Create(TheOwner: TComponent);
Expand Down
54 changes: 27 additions & 27 deletions examples/consoleplayloop.prj
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ findoptions=1
editpos=5
0,-1073741823
0,-1073741823
0,107
0,133
0,-1073741823
0,-1073741823
bookmarks0=0
Expand Down Expand Up @@ -1012,7 +1012,7 @@ windowlayout=560
rcy=0
wsize=0
active=0
visible=0
visible=1
[threadsfo]
splitdir=0
useroptions=805322857
Expand All @@ -1034,7 +1034,7 @@ windowlayout=560
[memoryfo]
splitdir=0
useroptions=805322875
stackedunder=about_form
stackedunder=dialogfilesfo
parent=
mdistate=0
nx=0
Expand Down Expand Up @@ -1080,7 +1080,7 @@ windowlayout=560
[findinfilefo]
splitdir=0
useroptions=268451947
stackedunder=mainfo
stackedunder=
parent=
mdistate=0
nx=0
Expand Down Expand Up @@ -1156,14 +1156,14 @@ windowlayout=560
active=0
visible=0
[watchpointsfo.grid]
propcolwidthref=352
propcolwidthref=332
sortdescend0=0
values1=0
values1_ci=-1
width1=33
sortdescend1=0
values2=0
width2=158
width2=149
sortdescend2=0
width4=34
sortdescend4=0
Expand All @@ -1172,7 +1172,7 @@ windowlayout=560
width5=38
sortdescend5=0
values6=0
width6=184
width6=172
sortdescend6=0
[breakpointsfo]
splitdir=0
Expand All @@ -1198,7 +1198,7 @@ windowlayout=560
[objectinspectorfo]
splitdir=0
useroptions=805322859
stackedunder=targetconsolefo
stackedunder=
parent=
mdistate=0
nx=0
Expand Down Expand Up @@ -1278,7 +1278,7 @@ windowlayout=560
rcx=1262
rcy=583
[watchfo.grid]
propcolwidthref=111
propcolwidthref=121
values0=2
-1
-1
Expand Down Expand Up @@ -1467,7 +1467,7 @@ windowlayout=560
irqoff=0
splitdir=0
useroptions=268451947
stackedunder=objectinspectorfo
stackedunder=_mse_guitemplatesmo_mse_
parent=
mdistate=0
nx=0
Expand All @@ -1483,10 +1483,26 @@ windowlayout=560
wsize=0
active=0
visible=0
[mainfo.panel1]
splitdir=1
useroptions=838958571
parent=mainfo.basedock
visible=1
mdistate=0
nx=0
ny=0
ncx=0
ncy=0
x=0
y=54
cx=1113
cy=455
rcx=0
rcy=0
[_mse_guitemplatesmo_mse_]
splitdir=0
useroptions=805322875
stackedunder=findinfilefo
stackedunder=targetconsolefo
parent=
mdistate=0
nx=0
Expand All @@ -1502,22 +1518,6 @@ windowlayout=560
wsize=0
active=0
visible=0
[mainfo.panel1]
splitdir=1
useroptions=838958571
parent=mainfo.basedock
visible=1
mdistate=0
nx=0
ny=0
ncx=0
ncy=0
x=0
y=54
cx=1113
cy=455
rcx=0
rcy=0
[targetconsole]
finddtext=Input from memory
findhistory=1
Expand Down
Loading

0 comments on commit 014d46b

Please sign in to comment.