Implements Module Player working in Form

* Implements Embedding .xm music in Final Application
This commit is contained in:
2025-06-02 15:15:16 +05:30
parent c09c434653
commit 6a1d80d3b8
342 changed files with 137595 additions and 146 deletions

View File

@@ -0,0 +1,150 @@
program SimplePlayer_MSE;
{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
{$ifdef FPC}
{$ifdef mswindows}{$apptype gui}{$endif}
{$endif}
uses
{$ifdef FPC} {$ifdef unix} cthreads, {$endif} {$endif}
msegui,
mainmse_sp,
SysUtils;
var
ordir: string;
begin
application.createform(tmainfo, mainfo);
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
{$IFDEF Windows}
{$if defined(cpu64)}
mainfo.padir.value := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
mainfo.sfdir.value := ordir + 'lib\Windows\64bit\LibSndFile-64.dll';
mainfo.mpdir.value := ordir + 'lib\Windows\64bit\LibMpg123-64.dll';
mainfo.xmdir.value := ordir + 'lib\Windows\64bit\libxmp-64.dll';
mainfo.stdir.value := ordir + 'lib\Windows\64bit\plugin\LibSoundTouch-64.dll';
{$else}
mainfo.padir.value := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
mainfo.sfdir.value := ordir + 'lib\Windows\32bit\LibSndFile-32.dll';
mainfo.mpdir.value := ordir + 'lib\Windows\32bit\LibMpg123-32.dll';
mainfo.m4dir.value := ordir + 'lib\Windows\32bit\LibMp4ff-32.dll';
mainfo.fadir.value := ordir + 'lib\Windows\32bit\LibFaad2-32.dll';
mainfo.ofdir.value := ordir + 'lib\Windows\32bit\LibOpusFile-32.dll';
mainfo.xmdir.value := ordir + 'lib\Windows\32bit\libxmp-32.dll';
mainfo.stdir.value := ordir + 'lib\Windows\32bit\plugin\libSoundTouch-32.dll';
mainfo.bsdir.value := ordir + 'lib\Windows\32bit\plugin\LibBs2b-32.dll';
{$endif}
mainfo.songdir.value := ordir + 'sound\test.ogg';
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
mainfo.padir.value := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
mainfo.sfdir.value := ordir + 'lib/Linux/64bit/LibSndFile-64.so';
mainfo.mpdir.value := ordir + 'lib/Linux/64bit/LibMpg123-64.so';
mainfo.m4dir.value := ordir + 'lib/Linux/64bit/LibMp4ff-64.so';
mainfo.fadir.value := ordir + 'lib/Linux/64bit/LibFaad2-64.so';
mainfo.ofdir.value := ordir + 'lib/Linux/64bit/LibOpusFile-64.so';
mainfo.xmdir.value := ordir + 'lib/Linux/64bit/libxmp-64.so';
mainfo.stdir.value := ordir + 'lib/Linux/64bit/plugin/LibSoundTouch-64.so';
mainfo.bsdir.value := ordir + 'lib/Linux/64bit/plugin/libbs2b-64.so';
mainfo.songdir.value := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(CPUAMD64) and defined(openbsd) }
mainfo.padir.value := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so';
mainfo.sfdir.value := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so';
mainfo.mpdir.value := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so';
mainfo.m4dir.value := '' ;
mainfo.fadir.value := '' ;
mainfo.ofdir.value := '' ;
mainfo.stdir.value := ordir + 'lib/OpenBSD/64bit/plugin/LibSoundTouch-64.so';
mainfo.bsdir.value := '' ;
mainfo.songdir.value := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(cpu86) and defined(linux)}
mainfo.padir.value := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
mainfo.sfdir.value := ordir + 'lib/Linux/32bit/LibSndFile-32.so';
mainfo.mpdir.value := ordir + 'lib/Linux/32bit/LibMpg123-32.so';
mainfo.m4dir.value := ordir + 'lib/Linux/32bit/LibMp4ff-32.so';
mainfo.fadir.value := ordir + 'lib/Linux/32bit/LibFaad2-32.so';
mainfo.xmdir.value := ordir + 'lib/Linux/32bit/libxmp-32.so';
mainfo.stdir.value := ordir + 'lib/Linux/32bit/plugin/LibSoundTouch-32.so';
mainfo.bsdir.value := ordir + 'lib/Linux/32bit/plugin/libbs2b-32.so';
mainfo.songdir.value := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(linux) and defined(cpuarm)}
mainfo.padir.value := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
mainfo.sfdir.value := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';
mainfo.mpdir.value := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so';
mainfo.xmdir.value := ordir + 'lib/Linux/arm_raspberrypi/libxmp-arm.so';
mainfo.stdir.value := ordir + 'lib/Linux/arm_raspberrypi/plugin/soundtouch-arm.so';
mainfo.songdir.value := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(linux) and defined(cpuaarch64)}
mainfo.padir.value := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
mainfo.sfdir.value := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so';
mainfo.mpdir.value := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so';
mainfo.xmdir.value := ordir + 'lib/Linux/aarch64_raspberrypi/libxmp_aarch64.so';
mainfo.stdir.value := ordir + 'lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so';
mainfo.songdir.value := ordir + 'sound/test.ogg';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
mainfo.padir.value := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
mainfo.sfdir.value := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so';
mainfo.mpdir.value := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so';
mainfo.m4dir.value := ordir + 'lib/FreeBSD/64bit/libmp4ff-64.so';
mainfo.fadir.value := ordir + 'lib/FreeBSD/64bit/libfaad2-64.so';
mainfo.bsdir.value := ordir + 'lib/FreeBSD/64bit/plugin/libbs2b-64.so';
mainfo.stdir.value := ordir + 'lib/FreeBSD/64bit/plugin/libsoundtouch-64.so';
mainfo.opdir.value := ordir + 'lib/FreeBSD/64bit/libopus-64.so';
{$else}
mainfo.padir.value := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
mainfo.sfdir.value := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so';
mainfo.mpdir.value := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so';
{$endif}
mainfo.songdir.value := ordir + 'sound/test.ogg';
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/uos', opath) - 1);
mainfo.padir.value := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
mainfo.sfdir.value := opath + '/lib/Mac/32bit/LibSndFile-32.dylib';
mainfo.mpdir.value := opath + '/lib/Mac/32bit/LibMpg123-32.dylib';
mainfo.stdir.value := opath + '/lib/Mac/32bit/plugin/LibSoundTouch-32.dylib';
mainfo.songdir.value := ordir + '/sound/test.ogg';
{$ENDIF}
{$IFDEF CPU64}
opath := ordir;
opath := copy(opath, 1, Pos('/uos', opath) - 1);
mainfo.padir.value := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib';
mainfo.sfdir.value := opath + '/lib/Mac/64bit/LibSndFile-64.dylib';
mainfo.mpdir.value := opath + '/lib/Mac/64bit/LibMpg123-64.dylib';
mainfo.xmdir.value := opath + '/lib/Mac/64bit/libxmp-64.dylib';
mainfo.stdir.value := opath + '/lib/Mac/64bit/plugin/libSoundTouchDLL-64.dylib';
mainfo.songdir.value := ordir + '/sound/test.ogg';
{$ENDIF}
{$ENDIF}
mainfo.songdir.controller.lastdir := ordir + 'sound';
mainfo.Height := 400;
mainfo.vuLeft.Visible := False;
mainfo.vuRight.Visible := False;
mainfo.vuright.Height := 0;
mainfo.vuleft.Height := 0;
application.run;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="consolebpmdetect"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="consolebpmdetect.pas"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="consolebpmdetect"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<SmallerCode Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<WriteFPCLogo Value="False"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,193 @@
program consolebpmdetect;
///WARNING : if FPC version < 2.7.1 => Do not forget to uncoment {$DEFINE consoleapp} in uos_define.inc !
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
{$IFDEF UNIX}
cthreads,
cwstring, {$ENDIF}
Classes,
ctypes,
SysUtils,
CustApp,
uos_soundtouch,
uos_flat;
type
{ TUOSConsole }
TuosConsole = class(TCustomApplication)
private
procedure ConsolePlay;
protected
procedure doRun; override;
public
constructor Create(TheOwner: TComponent); override;
end;
var
res, res2, i: integer;
ordir, opath, st, SoundFilename, PA_FileName, SF_FileName, MP_FileName, ST_FileName: string;
PlayerIndex1, input1 : integer;
// BPMhandle, SThandle : THandle;
thebuffer : array of cfloat;
thebufferinfos : TuosF_BufferInfos;
{ TuosConsole }
procedure TuosConsole.ConsolePlay;
begin
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
{$IFDEF Windows}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
SF_FileName := ordir + 'lib\Windows\64bit\LibSndFile-64.dll';
MP_FileName := ordir + 'lib\Windows\64bit\LibMpg123-64.dll';
ST_FileName := ordir + 'lib\Windows\64bit\plugin\LibSoundTouch-64.dll';
{$else}
PA_FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
SF_FileName := ordir + 'lib\Windows\32bit\LibSndFile-32.dll';
ST_FileName := ordir + 'lib\Windows\32bit\plugin\libSoundTouch-32.dll';
MP_FileName := ordir + 'lib\Windows\32bit\LibMpg123-32.dll';
{$endif}
// new soundtouch.dll not yet compiled for Windows
SF_FileName := '';
SoundFilename := ordir + 'sound\test.mp3';
{$ENDIF}
{$if defined(CPUAMD64) and defined(openbsd) }
SF_FileName := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so';
PA_FileName := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so';
MP_FileName := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so';
ST_FileName := ordir + 'lib/OpenBSD/64bit/plugin/LibSoundTouch-64.so';
SoundFilename := ordir + 'sound/test.mp3';
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
SF_FileName := ordir + 'lib/Linux/64bit/LibSndFile-64.so';
ST_FileName := ordir + 'lib/Linux/64bit/plugin/LibSoundTouch-64.so';
MP_FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so';
SoundFilename := ordir + 'sound/test.mp3';
{$ENDIF}
{$if defined(cpu86) and defined(linux)}
PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
SF_FileName := ordir + 'lib/Linux/32bit/LibSndFile-32.so';
MP_FileName := ordir + 'lib/Linux/32bit/LibMpg123-32.so';
ST_FileName := ordir + 'lib/Linux/32bit/plugin/LibSoundTouch-32.so';
SoundFilename := ordir + 'sound/test.mp3';
{$ENDIF}
{$if defined(linux) and defined(cpuaarch64)}
PA_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
SF_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so';
MP_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so';
ST_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so';
SoundFilename := ordir + 'sound/test.mp3';
{$ENDIF}
{$if defined(linux) and defined(cpuarm)}
PA_FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
SF_FileName := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';
MP_FileName := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so';
ST_FileName := ordir + 'lib/Linux/arm_raspberrypi/plugin/libsoundtouch-arm.so';
SoundFilename := ordir + 'sound/test.mp3';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
SF_FileName := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so';
ST_FileName := ordir + 'lib/FreeBSD/64bit/plugin/LibSoundTouch-64.so';
MP_FileName := ordir + 'lib/FreeBSD/64bit/LibMpg123-64.so';
{$else}
PA_FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
SF_FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so';
ST_FileName := ordir + 'lib/FreeBSD/32bit/plugin/LibSoundTouch-32.so';
MP_FileName := ordir + 'lib/FreeBSD/32bit/LibMpg123-32.so';
ST_FileName := '';
{$endif}
SoundFilename := ordir + 'sound/test.mp3';
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
SF_FileName := opath + '/lib/Mac/32bit/LibSndFile-32.dylib';
MP_FileName := opath + '/lib/Mac/32bit/LibMpg123.dylib';
ST_FileName := := opath + '/lib/Mac/32bit/plugin/libSoundTouch-32.dylib';
SoundFilename := opath + '/sound/test.mp3';
{$ENDIF}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
// For Linux amd64, check libsndfile.so
if (SF_FileName <> 'system') and (SF_FileName <> '') then
if uos_TestLoadLibrary(PChar(SF_FileName)) = false then
SF_FileName := SF_FileName + '.2';
{$endif}
// Load the libraries
// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;
res := uos_LoadLib(Pchar(PA_FileName), Pchar(SF_FileName), Pchar(MP_FileName), nil, 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
writeln('soundtouch_getVersionId = ' + inttostr(soundtouch_getVersionId()));
writeln('soundtouch_getVersionString = ' + (soundtouch_getVersionString()));
// Create a memory buffer from a audio file from begining with 1024 frames.
thebuffer := uos_File2Buffer(pchar(SoundFilename), 0, thebufferinfos, -1, 1024);
writeln('length(thebuffer) = ' + inttostr(length(thebuffer)));
writeln('BPM = ' + floattostr(uos_GetBPM(thebuffer,thebufferinfos.channels,thebufferinfos.samplerate)));
// }
end else writeln('Libraries did not load... ;-(');
end;
procedure TuosConsole.doRun;
begin
ConsolePlay;
// writeln('Press a key to exit...');
// readln;
uos_free();
Terminate;
end;
constructor TuosConsole.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException := True;
end;
var
Application: TUOSConsole;
begin
Application := TUOSConsole.Create(nil);
Application.Title := 'Console BPM finder Buffer-Memory';
Application.Run;
Application.Free;
end.
begin
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="consoleplay"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="consoleplay.pas"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="consoleplay"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<SmallerCode Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<WriteFPCLogo Value="False"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,225 @@
program consoleplay;
///WARNING : if FPC version < 2.7.1 => Do not forget to uncoment {$DEFINE consoleapp} in uos_define.inc !
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
{$IFDEF UNIX}
cthreads,
cwstring, {$ENDIF}
Classes,
SysUtils,
CustApp,
uos_flat;
type
{ TUOSConsole }
TuosConsole = class(TCustomApplication)
private
procedure ConsolePlay;
protected
procedure doRun;
override;
public
constructor Create(TheOwner: TComponent);
override;
end;
var
res: integer;
ordir, opath, SoundFilename, PA_FileName, PC_FileName, SF_FileName, MP_FileName: string;
PlayerIndex1, InputIndex1, OutputIndex1: integer;
{ TuosConsole }
procedure TuosConsole.ConsolePlay;
begin
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
{$IFDEF Windows}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
SF_FileName := ordir + 'lib\Windows\64bit\LibSndFile-64.dll';
{$else}
PA_FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
SF_FileName := ordir + 'lib\Windows\32bit\LibSndFile-32.dll';
{$endif}
SoundFilename := ordir + 'sound\test.ogg';
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
SF_FileName := ordir + 'lib/Linux/64bit/LibSndFile-64.so';
PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
// MP_FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(CPUAMD64) and defined(openbsd) }
SF_FileName := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so';
PA_FileName := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so';
// MP_FileName := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(cpu86) and defined(linux)}
PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
SF_FileName := ordir + 'lib/Linux/32bit/LibSndFile-32.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(linux) and defined(cpuaarch64)}
PA_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
SF_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(linux) and defined(cpuarm)}
PA_FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
SF_FileName := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
SF_FileName := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so';
{$else}
PA_FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
SF_FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so';
{$endif}
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
SF_FileName := opath + '/lib/Mac/32bit/LibSndFile-32.dylib';
SoundFilename := ordir + '/sound/test.ogg';
{$ENDIF}
{$IFDEF CPU64}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib';
SF_FileName := opath + '/lib/Mac/64bit/LibSndFile-64.dylib';
SoundFilename := ordir + '/sound/test.ogg';
{$ENDIF}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
// For Linux amd64, check libsndfile.so
if (SF_FileName <> 'system') and (SF_FileName <> '') then
if uos_TestLoadLibrary(PChar(SF_FileName)) = false then
SF_FileName := SF_FileName + '.2';
{$endif}
// Load the libraries
// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;
res := uos_LoadLib(PChar(PA_FileName), PChar(SF_FileName), Nil, Nil, Nil, Nil, nil);
writeln;
if res = 0 then
writeln('Libraries are loaded.')
else
writeln('Libraries did not load.');
if res = 0 then
begin
writeln();
// writeln('Libraries version: '+ uos_GetInfoLibraries());
//// Create the player.
//// PlayerIndex : from 0 to what your computer can do !
//// If PlayerIndex exists already, it will be overwriten...
PlayerIndex1 := 0;
if uos_CreatePlayer(PlayerIndex1) then
begin
//// add a Input from audio-file with default parameters
//////////// PlayerIndex : Index of a existing Player
////////// FileName : filename of audio file
// result : -1 nothing created, otherwise Input Index in array
InputIndex1 := uos_AddFromFile(PlayerIndex1, PChar((SoundFilename)), -1, -1, -1);
writeln('InputIndex1 = ' + IntToStr(InputIndex1));
if InputIndex1 > -1 then
begin
//// add a Output into device with default parameters
//////////// PlayerIndex : Index of a existing Player
// result : -1 nothing created, otherwise Output Index in array
{$if defined(cpuarm) or defined(cpuaarch64)}
// need a lower latency
OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, -1, -1, -1, -1, -1) ;
{$else}
//OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1);
OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, -1, -1, -1, -1, -1, -1);
{$endif}
writeln('OutputIndex1 = ' + IntToStr(OutputIndex1));
// uos_AddIntoFile(PlayerIndex1,pchar('/home/fred/mytest.ogg'), -1, -1, -1, -1, 3);
if OutputIndex1 > -1 then
begin
/////// everything is ready, here we are, lets play it...
uos_Play(PlayerIndex1);
sleep(1000);
writeln;
writeln('Title: ' + uos_InputGetTagTitle(PlayerIndex1, InputIndex1));
sleep(1500);
writeln();
writeln('Artist: ' + uos_InputGetTagArtist(PlayerIndex1, InputIndex1));
writeln;
sleep(2000);
end;
end;
end;
end;
end;
procedure TuosConsole.doRun;
begin
ConsolePlay;
// writeln('Press a key to exit...');
// readln;
writeln('Ciao...');
uos_free();
// Do not forget this !
Terminate;
end;
constructor TuosConsole.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException := True;
end;
var
Application: TUOSConsole;
begin
Application := TUOSConsole.Create(Nil);
Application.Title := 'Console Player';
Application.Run;
Application.Free;
end.

2142
UOS/examples/consoleplay.prj Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="consoleplayloop"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="consoleplayloop.pas"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="consoleplayloop"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<SmallerCode Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<WriteFPCLogo Value="False"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,178 @@
program consoleplayloop;
///WARNING : if FPC version < 2.7.1 => Do not forget to uncoment {$DEFINE consoleapp} in uos_define.inc !
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
{$IFDEF UNIX}
cthreads,
cwstring, {$ENDIF}
Classes,
SysUtils,
CustApp,
uos_flat;
type
{ TUOSConsole }
TuosConsole = class(TCustomApplication)
private
procedure consoleplay;
protected
procedure doRun; override;
public
constructor Create(TheOwner: TComponent); override;
end;
var
res: integer;
ordir, opath, SoundFilename, PA_FileName, SF_FileName: string;
PlayerIndex1 : integer;
{ TuosConsole }
procedure TuosConsole.ConsolePlay;
begin
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
{$IFDEF Windows}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
SF_FileName := ordir + 'lib\Windows\64bit\LibSndFile-64.dll';
{$else}
PA_FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
SF_FileName := ordir + 'lib\Windows\32bit\LibSndFile-32.dll';
{$endif}
SoundFilename := ordir + 'sound\test.flac';
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
SF_FileName := ordir + 'lib/Linux/64bit/LibSndFile-64.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$if defined(cpu86) and defined(linux)}
PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
SF_FileName := ordir + 'lib/Linux/32bit/LibSndFile-32.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$if defined(CPUAMD64) and defined(openbsd) }
SF_FileName := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so';
PA_FileName := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$if defined(linux) and defined(cpuaarch64)}
PA_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
SF_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$if defined(linux) and defined(cpuarm)}
PA_FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
SF_FileName := ordir + ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
SF_FileName := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so';
{$else}
PA_FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
SF_FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so';
{$endif}
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
SF_FileName := opath + '/lib/Mac/32bit/LibSndFile-32.dylib';
SoundFilename := ordir + '/sound/test.flac';
{$ENDIF}
{$IFDEF CPU64}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib';
SF_FileName := opath + '/lib/Mac/64bit/LibSndFile-64.dylib';
SoundFilename := ordir + '/sound/test.flac';
{$ENDIF}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
// For Linux amd64, check libsndfile.so
if (SF_FileName <> 'system') and (SF_FileName <> '') then
if uos_TestLoadLibrary(PChar(SF_FileName)) = false then
SF_FileName := SF_FileName + '.2';
{$endif}
// Load the libraries
// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;
res := uos_LoadLib(Pchar(PA_FileName), Pchar(SF_FileName), nil, nil, nil, nil, nil) ;
writeln('Result of loading (if 0 => ok ) : ' + IntToStr(res));
if res = 0 then begin
//// Create the player.
//// PlayerIndex : from 0 to what your computer can do !
//// If PlayerIndex exists already, it will be overwriten...
PlayerIndex1 := 0;
if uos_CreatePlayer(PlayerIndex1) then
//// add a Input from audio-file with default parameters
//////////// PlayerIndex : Index of a existing Player
////////// FileName : filename of audio file
// result : -1 nothing created, otherwise Input Index in array
if uos_AddFromFile(PlayerIndex1,(pchar(SoundFilename))) > -1 then
//// add a Output into device with default parameters
//////////// PlayerIndex : Index of a existing Player
// result : -1 nothing created, otherwise Output Index in array
{$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency
if uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, -1, -1, -1, -1, -1) > -1 then
{$else}
if uos_AddIntoDevOut(PlayerIndex1) > -1 then
{$endif}
/////// everything is ready, here we are, lets play it 3 times...
uos_Play(PlayerIndex1, 3);
sleep(5000);
end;
end;
procedure TuosConsole.doRun;
begin
ConsolePlay;
uos_free();
Terminate;
end;
constructor TuosConsole.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException := True;
end;
var
Application: TUOSConsole;
begin
Application := TUOSConsole.Create(nil);
Application.Title := 'Console Player';
Application.Run;
Application.Free;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="consoleplaymemorybuffer"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="consoleplaymemorybuffer.pas"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="consoleplaymemorybuffer"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<UseHeaptrc Value="True"/>
</Debugging>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,191 @@
program consoleplaymemorybuffer;
///WARNING : if FPC version < 2.7.1 => Do not forget to uncoment {$DEFINE consoleapp} in uos_define.inc !
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
{$IFDEF UNIX}
cthreads,
cwstring, {$ENDIF}
Classes,
ctypes,
SysUtils,
CustApp,
uos_flat;
type
{ TUOSConsole }
TuosConsole = class(TCustomApplication)
private
procedure ConsolePlay;
protected
procedure doRun; override;
public
constructor Create(TheOwner: TComponent); override;
end;
var
res, i: integer;
ordir, opath, st, SoundFilename, PA_FileName, SF_FileName: string;
PlayerIndex1, input1: integer;
thebuffer: array of cfloat;
thebufferinfos: TuosF_BufferInfos;
{ TuosConsole }
procedure TuosConsole.ConsolePlay;
begin
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
{$IFDEF Windows}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
SF_FileName := ordir + 'lib\Windows\64bit\LibSndFile-64.dll';
{$else}
PA_FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
SF_FileName := ordir + 'lib\Windows\32bit\LibSndFile-32.dll';
{$endif}
SoundFilename := ordir + 'sound\test.flac';
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
SF_FileName := ordir + 'lib/Linux/64bit/LibSndFile-64.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$if defined(CPUAMD64) and defined(openbsd) }
SF_FileName := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so';
PA_FileName := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$if defined(cpu86) and defined(linux)}
PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
SF_FileName := ordir + 'lib/Linux/32bit/LibSndFile-32.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$if defined(linux) and defined(cpuaarch64)}
PA_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
SF_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$if defined(linux) and defined(cpuarm)}
PA_FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
SF_FileName := ordir + ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
SF_FileName := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so';
{$else}
PA_FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
SF_FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so';
{$endif}
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
SF_FileName := opath + '/lib/Mac/32bit/LibSndFile-32.dylib';
SoundFilename := ordir + '/sound/test.flac';
{$ENDIF}
{$IFDEF CPU64}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib';
SF_FileName := opath + '/lib/Mac/64bit/LibSndFile-64.dylib';
SoundFilename := ordir + '/sound/test.flac';
{$ENDIF}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
// For Linux amd64, check libsndfile.so
if (SF_FileName <> 'system') and (SF_FileName <> '') then
if uos_TestLoadLibrary(PChar(SF_FileName)) = false then
SF_FileName := SF_FileName + '.2';
{$endif}
// Load the libraries
// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;
res := uos_LoadLib(PChar(PA_FileName), PChar(SF_FileName), nil, nil, nil, nil, nil);
writeln('Result of loading (if 0 => ok ) : ' + IntToStr(res));
if res = 0 then
begin
PlayerIndex1 := 0;
// Create a memory buffer from a audio file
thebuffer := uos_File2Buffer(PChar(SoundFilename), 1, thebufferinfos, -1, -1);
// You may store that buffer into ressource...
// ... and when you get the buffer from ressource....
uos_CreatePlayer(PlayerIndex1);
// Add a input from memory buffer with custom parameters
input1 := uos_AddFromMemoryBuffer(PlayerIndex1, thebuffer, thebufferinfos, -1, 1024);
// add a Output into device with default parameters
{$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency
uos_AddIntoDevOut(PlayerIndex1, -1, 0,3, uos_inputgetSampleRate(PlayerIndex1,input1),
uos_inputgetChannels(PlayerIndex1,input1) , 1, 1024, -1);
{$else}
uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_inputgetSampleRate(PlayerIndex1, input1),
uos_inputgetChannels(PlayerIndex1, input1), 1, 1024, -1);
{$endif}
{ // Save to file
uos_addIntoFile(PlayerIndex1, Pchar(ordir + 'testwav.wav'),
uos_inputgetSampleRate(PlayerIndex1,input1),
uos_inputgetChannels(PlayerIndex1,input1),1,1024,-1 ); //
//}
/////// everything is ready, here we are, lets play it...
uos_Play(PlayerIndex1);
sleep(2000);
end;
end;
procedure TuosConsole.doRun;
begin
ConsolePlay;
uos_free();
Terminate;
end;
constructor TuosConsole.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException := True;
end;
var
Application: TUOSConsole;
begin
Application := TUOSConsole.Create(nil);
Application.Title := 'Console Player from Buffer-Memory';
Application.Run;
Application.Free;
end.
begin
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="consoleplaymemorystream"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="consoleplaymemorystream.pas"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="consoleplaymemorystream"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,231 @@
program consoleplaymemorystream;
///WARNING : if FPC version < 2.7.1 => Do not forget to uncoment {$DEFINE consoleapp} in uos_define.inc !
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
{$IFDEF UNIX}
cthreads,
cwstring, {$ENDIF}
Classes,
ctypes,
SysUtils,
CustApp,
uos_flat;
type
{ TUOSConsole }
TuosConsole = class(TCustomApplication)
private
procedure ConsolePlay;
protected
procedure doRun; override;
public
constructor Create(TheOwner: TComponent); override;
end;
var
res: integer;
ordir, opath, SoundFilename, PA_FileName, SF_FileName, MP_FileName: string;
PlayerIndex1, InputIndex1: integer;
thememorystream1, thememorystream2: Tmemorystream;
{ TuosConsole }
procedure TuosConsole.ConsolePlay;
begin
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
{$IFDEF Windows}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
SF_FileName := ordir + 'lib\Windows\64bit\LibSndFile-64.dll';
MP_FileName := ordir + 'lib\Windows\64bit\LibMpg123-64.dll';
{$else}
PA_FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
SF_FileName := ordir + 'lib\Windows\32bit\LibSndFile-32.dll';
MP_FileName := ordir + 'lib\Windows\32bit\LibMpg123-32.dll';
{$endif}
SoundFilename := ordir + 'sound\test.flac';
{$ENDIF}
{$IFDEF linux}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
SF_FileName := ordir + 'lib/Linux/64bit/LibSndFile-64.so';
MP_FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so';
{$else}
PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
SF_FileName := ordir + 'lib/Linux/32bit/LibSndFile-32.so';
MP_FileName := ordir + 'lib/Linux/32bit/LibMpg123-32.so';
{$endif}
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
SF_FileName := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so';
MP_FileName := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so';
{$else}
PA_FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
SF_FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so';
MP_FileName := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so';
{$endif}
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$if defined(CPUAMD64) and defined(openbsd) }
SF_FileName := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so';
PA_FileName := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so';
MP_FileName := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so';
SoundFilename := ordir + 'sound/test.flac';
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
SF_FileName := opath + '/lib/Mac/32bit/LibSndFile-32.dylib';
MP_FileName := opath + '/lib/Mac/32bit/LibMpg123-32.dylib';
SoundFilename := ordir + '/sound/test.flac';
{$ENDIF}
{$IFDEF CPU64}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib';
SF_FileName := opath + '/lib/Mac/64bit/LibSndFile-64.dylib';
MP_FileName := opath + '/lib/Mac/64bit/LibMpg123-64.dylib';
SoundFilename := ordir + '/sound/test.flac';
{$ENDIF}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
// For Linux amd64, check libsndfile.so
if (SF_FileName <> 'system') and (SF_FileName <> '') then
if uos_TestLoadLibrary(PChar(SF_FileName)) = false then
SF_FileName := SF_FileName + '.2';
{$endif}
// Load the libraries
// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;
res := uos_LoadLib(PChar(PA_FileName), PChar(SF_FileName), PChar(MP_FileName), nil, nil, nil, nil);
writeln('Result of loading (if 0 => ok ) : ' + IntToStr(res));
if res = 0 then
begin
InputIndex1 := -1;
PlayerIndex1 := 0;
// Create a memory stream from a audio file wav, ogg, flac, mp3, opus.
thememorystream1 := TMemoryStream.Create;
thememorystream1.LoadFromFile(PChar(SoundFilename));
thememorystream1.Position := 0;
if uos_CreatePlayer(PlayerIndex1) then
// Add a input from device mic with custom parameters
// InputIndex1 := uos_AddFromDevIN(PlayerIndex1, -1, -1, -1, -1, 0, 1024 * 8, -1);
InputIndex1 := uos_AddFromMemoryStream(PlayerIndex1, thememorystream1, -1, -1, 2, 1024 * 8);
// Add a input from memory stream with custom parameters
// MemoryStream : Memory stream of encoded audio.
// TypeAudio : default : -1 --> 0 (0: flac, ogg, wav; 1: mp3; 2:opus)
// OutputIndex : Output index of used output
// -1: all output, -2: no output, other a existing OutputIndex
// (if multi-output then OutName = name of each output separeted by ';')
// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
// FramesCount : default : -1 (4096)
// Result : Input Index in array -1 = error
// example : InputIndex1 := uos_AddFromMemoryStream(mymemorystream,-1,-1,2,44100,0,1024);
if InputIndex1 > -1 then
begin
writeln('uos_InputLength = ' + IntToStr(uos_inputlength(0, 0)));
// add a Output into device with custom parameters
{$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency
uos_AddIntoDevOut(PlayerIndex1, -1, 0,3, uos_inputgetSampleRate(PlayerIndex1,InputIndex1),
uos_inputgetChannels(PlayerIndex1,input1) , 0, 1024 * 8, -1);
{$else}
uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_inputgetSampleRate(PlayerIndex1, InputIndex1),
uos_inputgetChannels(PlayerIndex1, InputIndex1), 2, 1024 * 8, -1);
{$endif}
// create a other memorystream from the first one encoding in ogg format.
uos_AddIntoMemoryStream(PlayerIndex1, thememorystream2, -1, 2, 2, 1024 * 8, 1);
/////// everything is ready, here we are, lets play it...
uos_Play(PlayerIndex1);
sleep(3000);
uos_Stop(PlayerIndex1); // This if device mic was used
sleep(500);
// OK, let's use the new ogg-memorystream.
PlayerIndex1 := 1;
thememorystream2.Position := 0;
// creata a new player
if uos_CreatePlayer(PlayerIndex1) then
uos_AddFromMemoryStream(PlayerIndex1, thememorystream2, -1, -1, 2, 1024 * 4);
// Add a input from memory stream with custom parameters
// MemoryStream : Memory stream of encoded audio.
// TypeAudio : default : -1 --> 0 (0: flac, ogg, wav; 1: mp3; 2:opus)
// OutputIndex : Output index of used output// -1: all output, -2: no output, other cint32 refer to a existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
// FramesCount : default : -1 (4096)
// result : Input Index in array -1 = error
// example : InputIndex1 := uos_AddFromMemoryStream(mymemorystream,-1,-1,2,44100,0,1024);
// add a Output into device with custom parameters
uos_AddIntoDevOut(PlayerIndex1, -1, -1, -1, 2, 2, 1024 * 4, -1);
/////// everything is ready, here we are, lets play it...
uos_Play(PlayerIndex1);
sleep(3000);
end
else
writeln('uos_AddFromMemoryStream(...) did not work... ');
end;
end;
procedure TuosConsole.doRun;
begin
ConsolePlay;
uos_free();
Terminate;
end;
constructor TuosConsole.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException := True;
end;
var
Application: TUOSConsole;
begin
Application := TUOSConsole.Create(nil);
Application.Title := 'Console Player from MemoryStream';
Application.Run;
Application.Free;
end.
begin
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="consolespectrum"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="consolespectrum.pas"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="consolespectrum"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<SmallerCode Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<WriteFPCLogo Value="False"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,253 @@
program consolespectrum;
///WARNING : if FPC version < 2.7.1 => Do not forget to uncoment {$DEFINE consoleapp} in uos_define.inc !
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
{$IFDEF UNIX}
cthreads,
cwstring, {$ENDIF}
Classes,
ctypes,
SysUtils,
CustApp,
uos_flat;
type
{ TUOSConsole }
TuosConsole = class(TCustomApplication)
private
procedure ConsolePlay;
protected
procedure doRun; override;
public
constructor Create(TheOwner: TComponent); override;
end;
var
res, x, y,z: integer;
thearray : array of cfloat;
ordir, opath, SoundFilename, PA_FileName, SF_FileName, MP_FileName: string;
PlayerIndex1, InputIndex1, OutputIndex1 : integer;
{ TuosConsole }
procedure TuosConsole.ConsolePlay;
begin
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
{$IFDEF Windows}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
SF_FileName := ordir + 'lib\Windows\64bit\LibSndFile-64.dll';
{$else}
PA_FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
SF_FileName := ordir + 'lib\Windows\32bit\LibSndFile-32.dll';
{$endif}
SoundFilename := ordir + 'sound\test.ogg';
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
SF_FileName := ordir + 'lib/Linux/64bit/LibSndFile-64.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(cpu86) and defined(linux)}
PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
SF_FileName := ordir + 'lib/Linux/32bit/LibSndFile-32.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(linux) and defined(cpuaarch64)}
PA_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
SF_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(linux) and defined(cpuarm)}
PA_FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
SF_FileName := ordir + ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
SF_FileName := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so';
{$else}
PA_FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
SF_FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so';
{$endif}
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(CPUAMD64) and defined(openbsd) }
SF_FileName := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so';
PA_FileName := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
SF_FileName := opath + '/lib/Mac/32bit/LibSndFile-32.dylib';
SoundFilename := ordir + '/sound/test.ogg';
{$ENDIF}
{$IFDEF CPU64}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib';
SF_FileName := opath + '/lib/Mac/64bit/LibSndFile-64.dylib';
SoundFilename := ordir + '/sound/test.ogg';
{$ENDIF}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
// For Linux amd64, check libsndfile.so
if (SF_FileName <> 'system') and (SF_FileName <> '') then
if uos_TestLoadLibrary(PChar(SF_FileName)) = false then
SF_FileName := SF_FileName + '.2';
{$endif}
// Load the libraries
// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;
res := uos_LoadLib(Pchar(PA_FileName), Pchar(SF_FileName), nil, nil, nil, nil, nil) ;
writeln;
if res = 0 then
writeln('Libraries are loaded.')
else
writeln('Libraries did not load.');
if res = 0 then begin
writeln();
// writeln('Libraries version: '+ uos_GetInfoLibraries());
//// Create the player.
//// PlayerIndex : from 0 to what your computer can do !
//// If PlayerIndex exists already, it will be overwriten...
PlayerIndex1 := 0;
if uos_CreatePlayer(PlayerIndex1) then
begin
//// add a Input from audio-file with default parameters
//////////// PlayerIndex : Index of a existing Player
////////// FileName : filename of audio file
// result : -1 nothing created, otherwise Input Index in array
InputIndex1 := uos_AddFromFile(PlayerIndex1,(pchar(SoundFilename)));
if InputIndex1 > -1 then
//// add a Output into device with default parameters
//////////// PlayerIndex : Index of a existing Player
// result : -1 nothing created, otherwise Output Index in array
OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, -1, -1, -1, -1, -1) ;
if OutputIndex1 > -1 then
begin
// Spectrum : create bandpass filters with alsobuf set to false, how many you want:
uos_InputAddFilter(PlayerIndex1, InputIndex1,
3, 10000,20000, 1,
3, 10000,20000, 1, False, nil);
uos_InputAddFilter(PlayerIndex1, InputIndex1,
3, 6000,10000, 1,
3, 6000,10000, 1, False, nil);
uos_InputAddFilter(PlayerIndex1, InputIndex1,
3, 4000,6000, 1,
3, 4000,6000, 1, False, nil);
uos_InputAddFilter(PlayerIndex1, InputIndex1,
3, 2500,4000, 1,
3, 2500,4000, 1, False, nil);
uos_InputAddFilter(PlayerIndex1, InputIndex1,
3, 1000, 2500, 1,
3, 1000, 2500, 1, False, nil);
uos_InputAddFilter(PlayerIndex1, InputIndex1,
3, 700,1000, 1,
3, 700,1000, 1, False, nil);
uos_InputAddFilter(PlayerIndex1, InputIndex1,
3, 500,700, 1,
3, 500,700, 1, False, nil);
uos_InputAddFilter(PlayerIndex1, InputIndex1,
3, 300,500, 1,
3, 300,500, 1, False, nil);
/////// everything is ready, here we are, lets play it...
uos_Play(PlayerIndex1);
writeln();
// you may, of course, use a player-loop procedure insteed.
while uos_getstatus(PlayerIndex1) > 0 do
begin
sleep(200);
writeln();
writeln('GetLevelArray() left|right by band:');
// list of left|right levels separed by $ character of each virtual filter:
// writeln(uos_InputFiltersGetLevelString(PlayerIndex1,InputIndex1));
// you may also use uos_InputFiltersGetLevelArray and get a array of float:
thearray := uos_InputFiltersGetLevelArray(PlayerIndex1,InputIndex1);
x := 0;
while x < length(thearray) -1 do
begin
writeln('Band' + inttostr(x div 2) + ' = ' + floattostr(thearray[x]) + '|' + floattostr(thearray[x+1]));
x := x +2;
end;
end;
end;
end;
end;
end;
procedure TuosConsole.doRun;
begin
ConsolePlay;
// writeln('Press a key to exit...');
// readln;
writeln('');
writeln('Ciao...');
uos_free(); // Do not forget this !
Terminate;
end;
constructor TuosConsole.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException := True;
end;
var
Application: TUOSConsole;
begin
Application := TUOSConsole.Create(nil);
Application.Title := 'Console Player';
Application.Run;
Application.Free;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="consolesynth"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="consolesynth.pas"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="consolesynth"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<SmallerCode Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<WriteFPCLogo Value="False"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,234 @@
program consolesynth;
///WARNING : if FPC version < 2.7.1 => Do not forget to uncoment {$DEFINE consoleapp} in uos_define.inc !
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Classes,
SysUtils,
CustApp,
uos_flat;
type
{ TUOSConsole }
TuosConsole = class(TCustomApplication)
private
procedure ConsolePlay;
protected
procedure doRun; override;
public
constructor Create(TheOwner: TComponent); override;
end;
var
res: integer;
ordir, opath, PA_FileName: string;
PlayerIndex1, inindex1: integer;
{ TuosConsole }
procedure TuosConsole.ConsolePlay;
begin
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
{$IFDEF Windows}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
{$else}
PA_FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
{$endif}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
{$ENDIF}
{$if defined(CPUAMD64) and defined(openbsd) }
PA_FileName := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so';
{$ENDIF}
{$if defined(cpu86) and defined(linux)}
PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
{$ENDIF}
{$if defined(linux) and defined(cpuarm)}
PA_FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
{$ENDIF}
{$if defined(linux) and defined(cpuaarch64)}
PA_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
{$else}
PA_FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
{$endif}
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
{$ENDIF}
{$IFDEF CPU64}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib';
{$ENDIF}
{$ENDIF}
// Load the libraries (here only portaudio is needed)
// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;
res := uos_LoadLib(PChar(PA_FileName), nil, nil, nil, nil, nil, nil);
writeln('Result of loading (if 0 => ok ) : ' + IntToStr(res));
writeln((uos_getinfolibraries()));
if res = 0 then
begin
//// Create the player.
//// PlayerIndex : from 0 to what your computer can do !
//// If PlayerIndex exists already, it will be overwriten...
PlayerIndex1 := 0;
inindex1 := -1;
if uos_CreatePlayer(PlayerIndex1) then
inindex1 :=
uos_AddFromSynth(PlayerIndex1, -1, -1, -1, 420, 420, -1, -1, -1, -1, -1, 0, -1, -1, -1);
{ function uos_AddFromSynth(PlayerIndex: cint32; Channels: integer; WaveTypeL, WaveTypeR: integer;
FrequencyL, FrequencyR: float; VolumeL, VolumeR: float;
duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32;
OutputIndex: cint32; SampleFormat: cint32 ;
SampleRate: cint32 ; FramesCount : cint32): cint32;
// Add a input from Synthesizer with custom parameters
// Channels: default: -1 (2) (1 = mono, 2 = stereo)
// WaveTypeL: default: -1 (0) (0 = sine-wave 1 = square-wave, used for mono and stereo)
// WaveTypeR: default: -1 (0) (0 = sine-wave 1 = square-wave, used for stereo, ignored for mono)
// FrequencyL: default: -1 (440 htz) (Left frequency, used for mono)
// FrequencyR: default: -1 (440 htz) (Right frequency, used for stereo, ignored for mono)
// VolumeL: default: -1 (= 1) (from 0 to 1) => volume left
// VolumeR: default: -1 (= 1) (from 0 to 1) => volume rigth (ignored for mono)
// Duration: default: -1 (= 1000) => duration in msec (0 = endless)
// NbHarmonics: default: -1 (= 0) Number of Harmonics
// EvenHarmonics: default: -1 (= 0) (0 = all harmonics, 1 = Only even harmonics)
// OutputIndex: Output index of used output
// -1: all output, -2: no output, other cint32 refer to
// a existing OutputIndex
// (if multi-output then OutName = name of each output separeted by ';')
// SampleFormat: default : -1 (0: Float32) (0: Float32, 1:Int32, 2:Int16)
// SampleRate: delault : -1 (44100)
// FramesCount: -1 default : 1024
// result: Input Index in array -1 = error
}
{$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency
if uos_AddIntoDevOut(PlayerIndex1,-1,0.3,-1,-1, 0,-1,-1) > - 1 then
{$else}
if uos_AddIntoDevOut(PlayerIndex1, -1, -1, -1, -1, 0, -1, -1) > -1 then
{$endif}
//// add a Output into device with custom parameters
//////////// PlayerIndex : Index of a existing Player
// result : -1 nothing created, otherwise Output Index in array
begin
/////// everything is ready, here we are, lets play it...
uos_Play(PlayerIndex1);
sleep(150);
uos_InputSetSynth(PlayerIndex1, inindex1, -1, -1, 880, 880, -1, -1, 0, 0, -1, True);
{
procedure InputSetSynth(InputIndex: cint32; WaveTypeL, WaveTypeR: integer;
FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; duration: cint32;
NbHarmonic: cint32; EvenHarmonics: cint32; Enable: boolean);
// InputIndex: one existing input index
// WaveTypeL: do not change: -1 (0 = sine-wave 1 = square-wave, used for mono and stereo)
// WaveTypeR: do not change: -1 (0 = sine-wave 1 = square-wave, used for stereo, ignored for mono)
// FrequencyL: do not change: -1 (Left frequency, used for mono)
// FrequencyR: do not change: -1 (440 htz) (Right frequency, used for stereo, ignored for mono)
// VolumeL: do not change: -1 (= 1) (from 0 to 1) => volume left
// VolumeR: do not change: -1 (from 0 to 1) => volume rigth (ignored for mono)
// Duration: in msec (-1 = do not change)
// NbHarmonic: Number of Harmonics (-1 not change)
// EvenHarmonics: default: -1 (= 0) (0 = all harmonics, 1 = Only even harmonics)
// Enable: true or false ;
}
sleep(175);
uos_InputSetSynth(PlayerIndex1, inindex1, -1, -1, 610, 610 * 0.99, -1, -1, -1, 0, -1, True);
sleep(300);
uos_InputSetSynth(PlayerIndex1, inindex1, -1, -1, la3, la3 * 0.99, -1, -1, -1, 0, -1, True);
sleep(150);
uos_InputSetSynth(PlayerIndex1, inindex1, -1, -1, 420, 420 * 0.99, -1, -1, -1, 0, -1, True);
sleep(300);
uos_InputSetSynth(PlayerIndex1, inindex1, -1, -1, 320, 320 * 0.99, -1, -1, -1, 0, -1, True);
sleep(150);
uos_InputSetSynth(PlayerIndex1, inindex1, -1, -1, 660, 660 * 0.99, -1, -1, -1, 0, -1, True);
sleep(300);
uos_InputSetSynth(PlayerIndex1, inindex1, -1, -1, la3, la3 * 0.99, -1, -1, -1, 0, 1, True);
sleep(300);
uos_InputSetSynth(PlayerIndex1, inindex1, -1, -1, la3, la3 * 1.01, -1, -1, -1, 0, 0, True);
sleep(300);
uos_InputSetSynth(PlayerIndex1, inindex1, -1, -1, la3, la3 * 0.99, -1, -1, -1, 0, 1, True);
sleep(300);
uos_InputSetSynth(PlayerIndex1, inindex1, -1, -1, la3, la3 * 1.01, -1, -1, -1, 0, 0, True);
sleep(1500);
uos_stop(PlayerIndex1);
writeln(IntToStr(GetCPUCount()));
end;
end;
end;
procedure TuosConsole.doRun;
begin
ConsolePlay;
uos_free;
Terminate;
end;
constructor TuosConsole.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException := True;
end;
var
Application: TUOSConsole;
begin
Application := TUOSConsole.Create(nil);
Application.Title := 'Console Synthesizer';
Application.Run;
Application.Free;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="conswebstream"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="conswebstream.pas"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="conswebstream"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<SmallerCode Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<StripSymbols Value="True"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<WriteFPCLogo Value="False"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,197 @@
program conswebstream;
///WARNING : needs FPC version > 3.0.1
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
cmem,
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Classes,
// ctypes,
SysUtils,
//uos_opusurl,
uos_flat;
var
res, res2: integer;
ordir, opath, PA_FileName, MP_FileName, OF_FileName, theurl: string;
theicytag: PChar;
PlayerIndex1: integer;
begin
ordir := (ExtractFilePath(ParamStr(0)));
{$IFDEF Windows}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
MP_FileName := ordir + 'lib\Windows\64bit\LibMpg123-64.dll';
{$else}
PA_FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
MP_FileName := ordir + 'lib\Windows\32bit\LibMpg123-32.dll';
{$endif}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
MP_FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so';
OF_FileName := ordir + 'lib/Linux/64bit/LibOpusFile-64.so';
{$endif}
{$if defined(cpu86) and defined(linux)}
PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
MP_FileName := ordir + 'lib/Linux/32bit/LibMpg123-32.so';
{$endif}
{$if defined(linux) and defined(cpuaarch64)}
PA_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
MP_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so';
{$ENDIF}
{$if defined(linux) and defined(cpuarm)}
PA_FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
MP_FileName := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so';
{$ENDIF}
{$if defined(CPUAMD64) and defined(openbsd) }
SF_FileName := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so';
MP_FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
MP_FileName := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so';
{$else}
PA_FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
MP_FileName := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so';
{$endif}
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
MP_FileName := opath + '/lib/Mac/32bit/LibMpg123-32.dylib';
{$ENDIF}
{$IFDEF CPU64}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib';
MP_FileName := opath + '/lib/Mac/64bit/LibMpg123-64.dylib';
{$ENDIF}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
// For Linux amd64, check libsndfile.so
if (SF_FileName <> 'system') and (SF_FileName <> '') then
if uos_TestLoadLibrary(PChar(SF_FileName)) = false then
SF_FileName := SF_FileName + '.2';
{$endif}
// Load the libraries
// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;
// for web streaming => Mpg123 is needed
res := uos_LoadLib(PChar(PA_FileName), nil, PChar(MP_FileName), nil, nil, PChar(OF_FileName), nil);
writeln('');
if res = 0 then
writeln('===> Libraries are loaded.')
else
writeln('===> Libraries are NOT loaded.');
PlayerIndex1 := 0;
uos_CreatePlayer(PlayerIndex1); //// Create the player
writeln('===> uos_CreatePlayer => ok');
// theurl := 'http://broadcast.infomaniak.net:80/alouette-high.mp3';
// theurl := 'http://www.alouette.fr/alouette.m3u' ;
// theurl := 'http://broadcast.infomaniak.net/start-latina-high.mp3' ;
// theurl := 'http://www.hubharp.com/web_sound/BachGavotteShort.mp3' ;
// theurl := 'http://www.jerryradio.com/downloads/BMB-64-03-06-MP3/jg1964-03-06t01.mp3' ;
// theurl := 'https://sites.google.com/site/fredvsbinaries/willi.opus';
theurl := 'http://stream-uk1.radioparadise.com/mp3-128';
// for opus file, set AudioFormat = 1 in AddFromURL()
// theurl := 'https://sites.google.com/site/fredvsbinaries/guit_kungs.opus';
{
with TfpHttpClient.Create(nil) do
try WriteLn(Get(theurl));
finally Free;
end;
}
writeln('Try to connect to ' + theurl);
// res := uos_AddFromURL(PlayerIndex1,pchar(theurl)) ;
res := uos_AddFromURL(PlayerIndex1, PChar(theurl), -1, -1, -1, -1, False);
////////// URL : URL of audio file
////////// OutputIndex : OutputIndex of existing Output // -1: all output, -2: no output, other LongInt : existing Output
////////// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16)
//////////// FramesCount : default : -1 (1024)
//////////// AudioFormat : default : -1 (mp3) (0: mp3, 1: opus)
///////////// ICY data enabled
if res < 0 then
writeln('===> uos_AddFromURL => NOT OK:' + IntToStr(res))
else
begin
writeln('===> uos_AddFromURL => OK :' + IntToStr(res));
//// add a Output => change framecount => 1024
{$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency
res2 := uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, res), -1, -1, 1024, -1);
{$else}
res2 := uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, res), -1, -1, 1024, -1);
{$endif}
////// Add a Output into Device Output
//////////// Device ( -1 is default device )
//////////// Latency ( -1 is latency suggested )
//////////// SampleRate : delault : -1 (44100)
//////////// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
//////////// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
//////////// FramesCount : default : -1 (= 4096)
// ChunkCount : default : -1 (= 512)
if res2 <> -1 then
writeln('===> uos_AddIntoDevOut => ok :' + IntToStr(res2))
else
writeln('===> uos_AddIntoDevOut => NOT ok');
if res <> -1 then
begin
writeln('===> All ready to play.');
writeln('Press a key to play...');
writeln('After, press a key to exit...');
end
else
writeln();
readln;
/// OK, let play it.
if res <> -1 then
uos_Play(PlayerIndex1);
{
sleep(3000);
uos_inputupdateicy(PlayerIndex1,0,theicytag);
writeln('icy = ' + (theicytag));
sleep(3000);
uos_inputupdateicy(PlayerIndex1,0,theicytag);
writeln('icy = ' + (theicytag));
// }
writeln('Press a key to exit...');
end;
readln;
uos_free;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,587 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<Title Value="deviceinfos"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<CustomData Count="15">
<Item0 Name="lazpackager/copyright" Value="2012 Fred van Stappen"/>
<Item1 Name="lazpackager/deb/ppa" Value="ppa:fiens/uos"/>
<Item2 Name="lazpackager/deb/series" Value="precise"/>
<Item3 Name="lazpackager/deb/tpl_changelog" Value="?PACKAGE_NAME? (?FULLVERSION?) ?SERIES?; urgency=low
* Original version ?VERSION? packaged with lazdebian
-- ?MAINTAINER? &lt;?MAINTAINER_EMAIL?> ?DATER?
"/>
<Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME?
Maintainer: ?MAINTAINER? &lt;?MAINTAINER_EMAIL?>
Section: misc
Priority: optional
Standards-Version: 3.9.3
Build-Depends: fpc, lcl, lcl-utils, lazarus, debhelper (>= 8)
Package: ?PACKAGE_NAME?
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
Description: ?DESCRIPTION?
?DESCRIPTION_LONG?
"/>
<Item5 Name="lazpackager/deb/tpl_copyright" Value="Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files: *
Copyright: ?COPYRIGHT?
License: GPL-2+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
/usr/share/common-licenses/GPL-2
"/>
<Item6 Name="lazpackager/deb/tpl_rules" Value="#!/usr/bin/make -f
# see http://www.debian.org/doc/manuals/maint-guide/dreq.en.html
override_dh_auto_build:
dh_auto_build -- PREFIX=/usr
override_dh_auto_install:
dh_auto_install -- PREFIX=/usr
%:
dh $@
"/>
<Item7 Name="lazpackager/description" Value="United Openlib of Sound"/>
<Item8 Name="lazpackager/description_long" Value="United Openlib of Sound is a Pascal linker for Portaudio, Sndfile and MPG123 audio libraries.
With UOS audio life is easier..."/>
<Item9 Name="lazpackager/export_cmd" Value="?CP? *.lpi ?TEMPFOLDER?/
?CP? *.lpr ?TEMPFOLDER?/
?CP? *.pas ?TEMPFOLDER?/
?CP? *.lfm ?TEMPFOLDER?/
?CP? *.ico ?TEMPFOLDER?/
"/>
<Item10 Name="lazpackager/maintainer" Value="Fred van Stappen"/>
<Item11 Name="lazpackager/maintainer_email" Value="fiens@hotmail.com"/>
<Item12 Name="lazpackager/package_name" Value="united_openlib_sound"/>
<Item13 Name="lazpackager/tpl_makefile" Value="PREFIX = /usr/local
# debuild will set DESTDIR to the fakeroot path and
# in the override rules we will change PREFIX to /usr
BINDIR = $(DESTDIR)$(PREFIX)/bin
.PHONY : all
all:
lazbuild ?PROJECT?
.PHONY : clean
clean:
$(RM) -r lib
$(RM) *.res
$(RM) ?EXECUTABLE?
.PHONY : install
install:
mkdir -p $(BINDIR)
install -s ?EXECUTABLE? $(BINDIR)/
"/>
<Item14 Name="lazpackager/use_existing_makefile" Value="False"/>
</CustomData>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="45">
<Unit0>
<Filename Value="deviceinfos.lpr"/>
<IsPartOfProject Value="True"/>
<CursorPos X="3" Y="7"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="main_di.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="249"/>
<CursorPos X="22" Y="262"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="lazdyn_portaudio.pas"/>
<TopLine Value="371"/>
<CursorPos X="89" Y="4"/>
<UsageCount Value="99"/>
</Unit2>
<Unit3>
<Filename Value="Lazdyn_SoundTouch.pas"/>
<CursorPos X="59" Y="12"/>
<UsageCount Value="6"/>
</Unit3>
<Unit4>
<Filename Value="u_os.pas"/>
<TopLine Value="445"/>
<CursorPos X="10" Y="402"/>
<UsageCount Value="81"/>
</Unit4>
<Unit5>
<Filename Value="../firstprognew/mainmixxl.pas"/>
<TopLine Value="4347"/>
<CursorPos X="9" Y="4364"/>
<UsageCount Value="10"/>
</Unit5>
<Unit6>
<Filename Value="../dynmpg123/waveutils.pas"/>
<TopLine Value="3"/>
<CursorPos X="45" Y="43"/>
<UsageCount Value="6"/>
</Unit6>
<Unit7>
<Filename Value="kPGtest.pas"/>
<TopLine Value="111"/>
<CursorPos X="32" Y="128"/>
<UsageCount Value="8"/>
</Unit7>
<Unit8>
<Filename Value="kPGtestSF.pas"/>
<TopLine Value="27"/>
<CursorPos X="29" Y="32"/>
<UsageCount Value="8"/>
</Unit8>
<Unit9>
<Filename Value="lazdyn_mpg123.pas"/>
<TopLine Value="244"/>
<CursorPos X="102" Y="250"/>
<UsageCount Value="99"/>
</Unit9>
<Unit10>
<Filename Value="../OpenC2Pas/src/main.pas"/>
<TopLine Value="193"/>
<CursorPos Y="232"/>
<UsageCount Value="5"/>
</Unit10>
<Unit11>
<Filename Value="lazdyn_libsndfile.pas"/>
<CursorPos Y="12"/>
<UsageCount Value="99"/>
</Unit11>
<Unit12>
<Filename Value="../U_OS_Test (copie)/u_os.pas"/>
<TopLine Value="72"/>
<CursorPos X="34" Y="236"/>
<UsageCount Value="1"/>
</Unit12>
<Unit13>
<Filename Value="PA_SF_MP.pas"/>
<TopLine Value="77"/>
<CursorPos X="20" Y="10"/>
<UsageCount Value="3"/>
</Unit13>
<Unit14>
<Filename Value="/lib/codetyphon/fpcsrc/rtl/objpas/sysutils/sysstrh.inc"/>
<TopLine Value="100"/>
<CursorPos X="10" Y="112"/>
<UsageCount Value="6"/>
</Unit14>
<Unit15>
<Filename Value="../lazarus64/examples/multithreading/mainunit.pas"/>
<TopLine Value="70"/>
<UsageCount Value="6"/>
</Unit15>
<Unit16>
<Filename Value="../lazarus64/examples/pascalstream/componentstreampas.pas"/>
<TopLine Value="33"/>
<UsageCount Value="9"/>
</Unit16>
<Unit17>
<Filename Value="../firstprognewssbpm/mainmixxl.pas"/>
<ComponentName Value="MiXimumLP"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="2775"/>
<CursorPos X="20" Y="2792"/>
<UsageCount Value="8"/>
</Unit17>
<Unit18>
<Filename Value="/media/Windows7/dynsndfile/libsndfilestrings.pas"/>
<UsageCount Value="6"/>
</Unit18>
<Unit19>
<Filename Value="/media/Windows7/dynsndfile/lazdyn_libsndfile.pas"/>
<UsageCount Value="6"/>
</Unit19>
<Unit20>
<Filename Value="../logouos/unit1.pas"/>
<TopLine Value="67"/>
<CursorPos X="51" Y="83"/>
<UsageCount Value="6"/>
</Unit20>
<Unit21>
<Filename Value="/lib/codetyphon/lazarus/lcl/graphics.pp"/>
<TopLine Value="1168"/>
<CursorPos X="49" Y="1181"/>
<UsageCount Value="8"/>
</Unit21>
<Unit22>
<Filename Value="/lib/codetyphon/fpcsrc/rtl/objpas/objpas.pp"/>
<TopLine Value="119"/>
<CursorPos X="8" Y="28"/>
<UsageCount Value="6"/>
</Unit22>
<Unit23>
<Filename Value="uos.pas"/>
<EditorIndex Value="2"/>
<TopLine Value="4663"/>
<CursorPos X="2" Y="4673"/>
<UsageCount Value="100"/>
<Loaded Value="True"/>
</Unit23>
<Unit24>
<Filename Value="uos_new.pas"/>
<TopLine Value="310"/>
<CursorPos X="29" Y="478"/>
<UsageCount Value="80"/>
</Unit24>
<Unit25>
<Filename Value="../firstprognew/bass.pas"/>
<TopLine Value="810"/>
<UsageCount Value="5"/>
</Unit25>
<Unit26>
<Filename Value="../onenamevar/unit1.pas"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="81"/>
<CursorPos X="44" Y="100"/>
<UsageCount Value="8"/>
</Unit26>
<Unit27>
<Filename Value="/lib/codetyphon/lazarus/packager/registration/fcllaz.pas"/>
<CursorPos Y="4"/>
<UsageCount Value="2"/>
</Unit27>
<Unit28>
<Filename Value="../lazarus32/packager/registration/fcllaz.pas"/>
<UsageCount Value="2"/>
</Unit28>
<Unit29>
<Filename Value="../U_OS_Testnewonetype/uos.pas"/>
<TopLine Value="444"/>
<CursorPos X="79" Y="452"/>
<UsageCount Value="7"/>
</Unit29>
<Unit30>
<Filename Value="/media/Windows7/UOS/uos.pas"/>
<TopLine Value="747"/>
<CursorPos X="5" Y="750"/>
<UsageCount Value="3"/>
</Unit30>
<Unit31>
<Filename Value="/lib/codetyphon/lazarus/components/codetools/codebeautifier.pas"/>
<TopLine Value="405"/>
<UsageCount Value="5"/>
</Unit31>
<Unit32>
<Filename Value="../dynportaudio/mainunitsine.pas"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="463"/>
<CursorPos Y="483"/>
<UsageCount Value="17"/>
</Unit32>
<Unit33>
<Filename Value="../dynportaudio/unit1.pas"/>
<TopLine Value="81"/>
<CursorPos X="16" Y="91"/>
<UsageCount Value="10"/>
</Unit33>
<Unit34>
<Filename Value="/media/Windows7/hollytray/unit1.pas"/>
<TopLine Value="48"/>
<UsageCount Value="9"/>
</Unit34>
<Unit35>
<Filename Value="../DynSynthDemo/umain.pas"/>
<TopLine Value="260"/>
<CursorPos X="100" Y="281"/>
<UsageCount Value="9"/>
</Unit35>
<Unit36>
<Filename Value="uos_portaudio.pas"/>
<EditorIndex Value="3"/>
<TopLine Value="65"/>
<CursorPos X="5" Y="76"/>
<UsageCount Value="17"/>
<Loaded Value="True"/>
</Unit36>
<Unit37>
<Filename Value="main_sp.pas"/>
<TopLine Value="213"/>
<CursorPos Y="230"/>
<UsageCount Value="10"/>
</Unit37>
<Unit38>
<Filename Value="../../firstprognew (copie)/mainmixxl.pas"/>
<TopLine Value="5842"/>
<CursorPos X="66" Y="5861"/>
<UsageCount Value="12"/>
</Unit38>
<Unit39>
<Filename Value="../../lazarus32/packager/registration/fcllaz.pas"/>
<UsageCount Value="10"/>
</Unit39>
<Unit40>
<Filename Value="../../lazarus64/packager/registration/fcllaz.pas"/>
<UsageCount Value="10"/>
</Unit40>
<Unit41>
<Filename Value="deviceinfos_fpGUI.lpr"/>
<TopLine Value="149"/>
<CursorPos X="35" Y="170"/>
<UsageCount Value="10"/>
</Unit41>
<Unit42>
<Filename Value="filterplayer.lpi"/>
<UsageCount Value="10"/>
<DefaultSyntaxHighlighter Value="XML"/>
</Unit42>
<Unit43>
<Filename Value="uos_flat.pas"/>
<EditorIndex Value="4"/>
<TopLine Value="568"/>
<CursorPos X="3" Y="580"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit43>
<Unit44>
<Filename Value="../../lazarus/2.0.6/lcl/forms/timepopup.pas"/>
<ComponentName Value="TimePopupForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TimePopup"/>
<EditorIndex Value="-1"/>
<CursorPos X="94" Y="13"/>
<UsageCount Value="10"/>
</Unit44>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="uos_flat.pas"/>
<Caret Line="370" Column="91" TopLine="367"/>
</Position1>
<Position2>
<Filename Value="uos_flat.pas"/>
<Caret Line="984" Column="53" TopLine="976"/>
</Position2>
<Position3>
<Filename Value="uos_flat.pas"/>
<Caret Line="989" Column="19" TopLine="977"/>
</Position3>
<Position4>
<Filename Value="uos.pas"/>
<Caret Line="597" Column="17" TopLine="590"/>
</Position4>
<Position5>
<Filename Value="uos_flat.pas"/>
<Caret Line="8" Column="57"/>
</Position5>
<Position6>
<Filename Value="main_di.pas"/>
<Caret Line="9" Column="76"/>
</Position6>
<Position7>
<Filename Value="main_di.pas"/>
<Caret Line="82" Column="11" TopLine="67"/>
</Position7>
<Position8>
<Filename Value="main_di.pas"/>
<Caret Line="157" Column="45" TopLine="144"/>
</Position8>
<Position9>
<Filename Value="main_di.pas"/>
<Caret Line="158" Column="44" TopLine="143"/>
</Position9>
<Position10>
<Filename Value="uos.pas"/>
<Caret Line="3014" Column="51" TopLine="3007"/>
</Position10>
<Position11>
<Filename Value="uos.pas"/>
<Caret Line="4212" Column="80" TopLine="4185"/>
</Position11>
<Position12>
<Filename Value="uos.pas"/>
<Caret Line="4442" Column="47" TopLine="4424"/>
</Position12>
<Position13>
<Filename Value="uos.pas"/>
<Caret Line="4447" Column="31" TopLine="4424"/>
</Position13>
<Position14>
<Filename Value="main_di.pas"/>
<Caret Line="111" Column="67" TopLine="111"/>
</Position14>
<Position15>
<Filename Value="uos_flat.pas"/>
<Caret Line="580" Column="3" TopLine="568"/>
</Position15>
<Position16>
<Filename Value="uos.pas"/>
<Caret Line="214" Column="15" TopLine="208"/>
</Position16>
<Position17>
<Filename Value="uos.pas"/>
<Caret Line="4673" Column="33" TopLine="4654"/>
</Position17>
<Position18>
<Filename Value="uos.pas"/>
<Caret Line="4723" Column="42" TopLine="4703"/>
</Position18>
<Position19>
<Filename Value="uos.pas"/>
<Caret Line="214" Column="15" TopLine="202"/>
</Position19>
<Position20>
<Filename Value="uos.pas"/>
<Caret Line="4673" Column="33" TopLine="4654"/>
</Position20>
<Position21>
<Filename Value="uos.pas"/>
<Caret Line="4723" Column="42" TopLine="4703"/>
</Position21>
<Position22>
<Filename Value="uos.pas"/>
<Caret Line="214" Column="15" TopLine="202"/>
</Position22>
<Position23>
<Filename Value="uos.pas"/>
<Caret Line="4676" Column="101" TopLine="4654"/>
</Position23>
<Position24>
<Filename Value="uos.pas"/>
<Caret Line="4675" Column="2" TopLine="4654"/>
</Position24>
<Position25>
<Filename Value="uos.pas"/>
<Caret Line="4673" Column="2" TopLine="4663"/>
</Position25>
<Position26>
<Filename Value="main_di.pas"/>
<Caret Line="48" Column="41" TopLine="25"/>
</Position26>
<Position27>
<Filename Value="main_di.pas"/>
<Caret Line="47" Column="41" TopLine="25"/>
</Position27>
<Position28>
<Filename Value="main_di.pas"/>
<Caret Line="262" Column="3" TopLine="249"/>
</Position28>
<Position29>
<Filename Value="main_di.pas"/>
<Caret Line="22" Column="25" TopLine="22"/>
</Position29>
<Position30>
<Filename Value="main_di.pas"/>
<Caret Line="262" Column="21" TopLine="249"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="deviceinfos"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<SmallerCode Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<UseLineInfoUnit Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<WriteFPCLogo Value="False"/>
</Other>
</CompilerOptions>
<Debugging>
<BreakPoints Count="1">
<Item1>
<Kind Value="bpkSource"/>
<WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="u_os.pas"/>
<Line Value="42"/>
</Item1>
</BreakPoints>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,22 @@
program deviceinfos;
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
{$IFDEF UNIX} {$IFDEF UseCThreads}
cthreads,
cwstring, {$ENDIF} {$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms,
main_di { you can add units after this };
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="UOS Devices Infos"/>
<UseAppBundle Value="False"/>
</General>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="fpgui_toolkit"/>
</Item1>
</RequiredPackages>
<Units Count="1">
<Unit0>
<Filename Value="deviceinfos_fpGUI.pas"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="Device_Infos"/>
</Target>
<SearchPaths>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<WriteFPCLogo Value="False"/>
<CustomOptions Value="-FUunits"/>
</Other>
</CompilerOptions>
</CONFIG>

View File

@@ -0,0 +1,358 @@
program deviceinfos_fpGUI;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
cwstring,
{$ENDIF}
SysUtils,
fpg_base,
fpg_main,
fpg_form,
uos_flat,
fpg_style_chrome_silver_flatmenu,
fpg_stylemanager,
Classes,
fpg_button,
fpg_widget,
fpg_label,
fpg_Editbtn,
fpg_grid { you can add units after this };
type
TDevicesInfos = class(TfpgForm)
procedure UOS_logo(Sender: TObject);
private
{@VFD_HEAD_BEGIN: DevicesInfos}
infos_grid: TfpgStringGrid;
Custom1: TfpgWidget;
Labelport: TfpgLabel;
btnLoad: TfpgButton;
FilenameEdit1: TfpgFileNameEdit;
btnReLoad: TfpgButton;
Label1: TfpgLabel;
Label2: TfpgLabel;
Label3: TfpgLabel;
{@VFD_HEAD_END: DevicesInfos}
public
procedure AfterCreate; override;
procedure btnLoadClick(Sender: TObject);
procedure CloseClick(Sender: TObject);
procedure btnReLoadClick(Sender: TObject);
procedure CheckInfos();
end;
{@VFD_NEWFORM_DECL}
{@VFD_NEWFORM_IMPL}
var
ordir: string;
procedure TDevicesInfos.CheckInfos();
var
x: integer;
begin
UOS_GetInfoDevice();
label1.Text := 'Devices Count = ' + IntToStr(UOSDeviceCount);
label2.Text := 'Def Dev IN = ' + IntToStr(UOSDefaultDeviceIN);
label3.Text := 'Def Dev OUT = ' + IntToStr(UOSDefaultDeviceOUT);
infos_grid.rowcount := UOSDeviceCount;
x := 0;
while x < UOSDeviceCount do
begin
infos_grid.Cells[0, x] := IntToStr(UOSDeviceInfos[x].DeviceNum);
infos_grid.Cells[1, x] := UOSDeviceInfos[x].DeviceName;
if UOSDeviceInfos[x].DefaultDevIn = True then
infos_grid.Cells[2, x] := 'Yes'
else
infos_grid.Cells[2, x] := 'No';
if UOSDeviceInfos[x].DefaultDevOut = True then
infos_grid.Cells[3, x] := 'Yes'
else
infos_grid.Cells[3, x] := 'No';
infos_grid.Cells[4, x] := IntToStr(UOSDeviceInfos[x].ChannelsIn);
infos_grid.Cells[5, x] := IntToStr(UOSDeviceInfos[x].ChannelsOut);
infos_grid.Cells[6, x] := floattostrf(UOSDeviceInfos[x].SampleRate, ffFixed, 15, 0);
infos_grid.Cells[7, x] := floattostrf(UOSDeviceInfos[x].LatencyHighIn, ffFixed, 15, 8);
infos_grid.Cells[8, x] := floattostrf(UOSDeviceInfos[x].LatencyHighOut, ffFixed, 15, 8);
infos_grid.Cells[9, x] := floattostrf(UOSDeviceInfos[x].LatencyLowIn, ffFixed, 15, 8);
infos_grid.Cells[10, x] := floattostrf(UOSDeviceInfos[x].LatencyLowOut, ffFixed, 15, 8);
infos_grid.Cells[11, x] := UOSDeviceInfos[x].HostAPIName;
infos_grid.Cells[12, x] := UOSDeviceInfos[x].DeviceType;
Inc(x);
end;
end;
procedure TDevicesInfos.CloseClick(Sender: TObject);
begin
if btnLoad.Enabled = False then
uos_UnloadLib();
end;
procedure TDevicesInfos.btnLoadClick(Sender: TObject);
begin
// Load the library
// function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;
if uos_LoadLib(PChar(FilenameEdit1.FileName), nil, nil, nil, nil, nil, nil) = 0 then
begin
hide;
Height := 385;
btnReLoad.Enabled := True;
btnLoad.Enabled := False;
FilenameEdit1.ReadOnly := True;
UpdateWindowPosition;
btnLoad.Text := 'PortAudio library is loaded...';
CheckInfos();
WindowPosition := wpScreenCenter;
fpgapplication.ProcessMessages;
sleep(500);
Show;
end;
end;
procedure TDevicesInfos.btnReLoadClick(Sender: TObject);
begin
CheckInfos();
end;
procedure TDevicesInfos.AfterCreate;
begin
{%region 'Auto-generated GUI code' -fold}
{@VFD_BODY_BEGIN: DevicesInfos}
Name := 'DevicesInfos';
SetPosition(320, 168, 502, 385);
WindowTitle := 'Devices Infos ';
Hint := '';
BackGroundColor := $80000001;
WindowPosition := wpScreenCenter;
Ondestroy := @CloseClick;
infos_grid := TfpgStringGrid.Create(self);
with infos_grid do
begin
Name := 'infos_grid';
SetPosition(10, 160, 480, 180);
BackgroundColor := TfpgColor($80000002);
FontDesc := '#Grid';
HeaderFontDesc := '#GridHeader';
Hint := '';
RowCount := 1;
ColumnCount := 0;
RowSelect := False;
TabOrder := 0;
AddColumn('Dev', 40);
AddColumn('Name', 200);
AddColumn('Default IN', 80);
AddColumn('Default OUT', 80);
AddColumn('Chan IN', 60);
AddColumn('Chan OUT', 60);
AddColumn('S Rate', 63);
AddColumn('Latency High In', 120);
AddColumn('Latency High Out', 120);
AddColumn('Latency Low In', 120);
AddColumn('Latency Low Out', 120);
AddColumn('Host API', 80);
AddColumn('Type', 80);
DefaultRowHeight := 24;
end;
Custom1 := TfpgWidget.Create(self);
with Custom1 do
begin
Name := 'Custom1';
SetPosition(10, 8, 115, 115);
OnPaint := @UOS_logo;
end;
Labelport := TfpgLabel.Create(self);
with Labelport do
begin
Name := 'Labelport';
SetPosition(136, 40, 320, 15);
Alignment := taCenter;
FontDesc := '#Label1';
Hint := '';
Text := 'Folder + filename of PortAudio Library';
end;
btnLoad := TfpgButton.Create(self);
with btnLoad do
begin
Name := 'btnLoad';
SetPosition(16, 128, 470, 23);
FontDesc := '#Label1';
Hint := '';
ImageName := '';
TabOrder := 0;
Text := 'Load that library';
onclick := @btnLoadClick;
end;
FilenameEdit1 := TfpgFileNameEdit.Create(self);
with FilenameEdit1 do
begin
Name := 'FilenameEdit1';
SetPosition(136, 56, 356, 24);
ExtraHint := '';
FileName := '';
Filter := '';
InitialDir := '';
TabOrder := 3;
end;
btnReLoad := TfpgButton.Create(self);
with btnReLoad do
begin
Name := 'btnReLoad';
SetPosition(430, 353, 60, 23);
Enabled := False;
FontDesc := '#Label1';
Hint := '';
ImageName := '';
TabOrder := 6;
Text := 'Re-load';
onclick := @btnReLoadClick;
end;
Label1 := TfpgLabel.Create(self);
with Label1 do
begin
Name := 'Label1';
SetPosition(15, 355, 120, 20);
FontDesc := '#Label1';
Hint := '';
Text := 'Devices Count';
end;
Label2 := TfpgLabel.Create(self);
with Label2 do
begin
Name := 'Label2';
SetPosition(155, 355, 120, 20);
FontDesc := '#Label1';
Hint := '';
Text := 'Default Dev IN';
end;
Label3 := TfpgLabel.Create(self);
with Label3 do
begin
Name := 'Label3';
SetPosition(290, 355, 120, 20);
FontDesc := '#Label1';
Hint := '';
Text := 'Default Dev OUT';
end;
{@VFD_BODY_END: DevicesInfos}
{%endregion}
//////////////////////
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
Height := 157;
{$IFDEF Windows}
{$if defined(cpu64)}
FilenameEdit1.FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
{$else}
FilenameEdit1.FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
{$endif}
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
FilenameEdit1.FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
{$ENDIF}
{$IFDEF CPU64}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
FilenameEdit1.FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib';
{$ENDIF}
{$ENDIF}
{$IFDEF freebsd}
{$if defined(CPUAMD64)}
FilenameEdit1.FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
{$else}
FilenameEdit1.FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
{$endif}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
FilenameEdit1.FileName := ordir + '/lib/Linux/64bit/LibPortaudio-64.so';
{$ENDIF}
{$if defined(cpu86) and defined(linux)}
FilenameEdit1.FileName := ordir + '/lib/Linux/32bit/LibPortaudio-32.so';
{$endif}
{$if defined(linux) and defined(cpuarm)}
FilenameEdit1.FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
{$endif}
{$if defined(linux) and defined(cpuaarch64)}
FilenameEdit1.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
{$ENDIF}
FilenameEdit1.Initialdir := ordir + 'lib';
end;
procedure TDevicesInfos.UOS_logo(Sender: TObject);
begin
with Custom1 do
begin
Canvas.GradientFill(GetClientRect, clgreen, clBlack, gdVertical);
Canvas.TextColor := clWhite;
Canvas.DrawText(60, 20, 'UOS');
end;
end;
procedure MainProc;
var
frm: TDevicesInfos;
begin
fpgApplication.Initialize;
if fpgStyleManager.SetStyle('Chrome silver flat menu') then
fpgStyle := fpgStyleManager.Style;
frm := TDevicesInfos.Create(nil);
try
frm.Show;
fpgApplication.Run;
finally
uos_free;
frm.Free;
end;
end;
begin
MainProc;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,574 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<MainUnit Value="0"/>
<Title Value="filterplayer"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<CustomData Count="15">
<Item0 Name="lazpackager/copyright" Value="2012 Fred van Stappen"/>
<Item1 Name="lazpackager/deb/ppa" Value="ppa:fiens/uos"/>
<Item2 Name="lazpackager/deb/series" Value="precise"/>
<Item3 Name="lazpackager/deb/tpl_changelog" Value="?PACKAGE_NAME? (?FULLVERSION?) ?SERIES?; urgency=low
* Original version ?VERSION? packaged with lazdebian
-- ?MAINTAINER? &lt;?MAINTAINER_EMAIL?> ?DATER?
"/>
<Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME?
Maintainer: ?MAINTAINER? &lt;?MAINTAINER_EMAIL?>
Section: misc
Priority: optional
Standards-Version: 3.9.3
Build-Depends: fpc, lcl, lcl-utils, lazarus, debhelper (>= 8)
Package: ?PACKAGE_NAME?
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
Description: ?DESCRIPTION?
?DESCRIPTION_LONG?
"/>
<Item5 Name="lazpackager/deb/tpl_copyright" Value="Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files: *
Copyright: ?COPYRIGHT?
License: GPL-2+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
/usr/share/common-licenses/GPL-2
"/>
<Item6 Name="lazpackager/deb/tpl_rules" Value="#!/usr/bin/make -f
# see http://www.debian.org/doc/manuals/maint-guide/dreq.en.html
override_dh_auto_build:
dh_auto_build -- PREFIX=/usr
override_dh_auto_install:
dh_auto_install -- PREFIX=/usr
%:
dh $@
"/>
<Item7 Name="lazpackager/description" Value="United Openlib of Sound"/>
<Item8 Name="lazpackager/description_long" Value="United Openlib of Sound is a Pascal linker for Portaudio, Sndfile and MPG123 audio libraries.
With UOS audio life is easier..."/>
<Item9 Name="lazpackager/export_cmd" Value="?CP? *.lpi ?TEMPFOLDER?/
?CP? *.lpr ?TEMPFOLDER?/
?CP? *.pas ?TEMPFOLDER?/
?CP? *.lfm ?TEMPFOLDER?/
?CP? *.ico ?TEMPFOLDER?/
"/>
<Item10 Name="lazpackager/maintainer" Value="Fred van Stappen"/>
<Item11 Name="lazpackager/maintainer_email" Value="fiens@hotmail.com"/>
<Item12 Name="lazpackager/package_name" Value="united_openlib_sound"/>
<Item13 Name="lazpackager/tpl_makefile" Value="PREFIX = /usr/local
# debuild will set DESTDIR to the fakeroot path and
# in the override rules we will change PREFIX to /usr
BINDIR = $(DESTDIR)$(PREFIX)/bin
.PHONY : all
all:
lazbuild ?PROJECT?
.PHONY : clean
clean:
$(RM) -r lib
$(RM) *.res
$(RM) ?EXECUTABLE?
.PHONY : install
install:
mkdir -p $(BINDIR)
install -s ?EXECUTABLE? $(BINDIR)/
"/>
<Item14 Name="lazpackager/use_existing_makefile" Value="False"/>
</CustomData>
<BuildModes Count="1" Active="Default">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="42">
<Unit0>
<Filename Value="filterplayer.lpr"/>
<IsPartOfProject Value="True"/>
<CursorPos X="3" Y="7"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="main_fp.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="477"/>
<CursorPos X="12" Y="495"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="lazdyn_portaudio.pas"/>
<TopLine Value="60"/>
<CursorPos X="10" Y="60"/>
<UsageCount Value="97"/>
</Unit2>
<Unit3>
<Filename Value="Lazdyn_SoundTouch.pas"/>
<CursorPos X="59" Y="12"/>
<UsageCount Value="7"/>
</Unit3>
<Unit4>
<Filename Value="u_os.pas"/>
<TopLine Value="445"/>
<CursorPos X="10" Y="402"/>
<UsageCount Value="82"/>
</Unit4>
<Unit5>
<Filename Value="../firstprognew/mainmixxl.pas"/>
<TopLine Value="4347"/>
<CursorPos X="9" Y="4364"/>
<UsageCount Value="1"/>
</Unit5>
<Unit6>
<Filename Value="../dynmpg123/waveutils.pas"/>
<TopLine Value="3"/>
<CursorPos X="45" Y="43"/>
<UsageCount Value="7"/>
</Unit6>
<Unit7>
<Filename Value="kPGtest.pas"/>
<TopLine Value="111"/>
<CursorPos X="32" Y="128"/>
<UsageCount Value="9"/>
</Unit7>
<Unit8>
<Filename Value="kPGtestSF.pas"/>
<TopLine Value="27"/>
<CursorPos X="29" Y="32"/>
<UsageCount Value="9"/>
</Unit8>
<Unit9>
<Filename Value="lazdyn_mpg123.pas"/>
<TopLine Value="103"/>
<CursorPos X="83" Y="113"/>
<UsageCount Value="97"/>
</Unit9>
<Unit10>
<Filename Value="../OpenC2Pas/src/main.pas"/>
<TopLine Value="193"/>
<CursorPos Y="232"/>
<UsageCount Value="6"/>
</Unit10>
<Unit11>
<Filename Value="lazdyn_libsndfile.pas"/>
<TopLine Value="288"/>
<CursorPos X="24" Y="305"/>
<UsageCount Value="97"/>
</Unit11>
<Unit12>
<Filename Value="../U_OS_Test (copie)/u_os.pas"/>
<TopLine Value="72"/>
<CursorPos X="34" Y="236"/>
<UsageCount Value="2"/>
</Unit12>
<Unit13>
<Filename Value="PA_SF_MP.pas"/>
<TopLine Value="77"/>
<CursorPos X="20" Y="10"/>
<UsageCount Value="4"/>
</Unit13>
<Unit14>
<Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/objpas/sysutils/sysstrh.inc"/>
<TopLine Value="100"/>
<CursorPos X="10" Y="112"/>
<UsageCount Value="7"/>
</Unit14>
<Unit15>
<Filename Value="../lazarus64/examples/multithreading/mainunit.pas"/>
<TopLine Value="70"/>
<UsageCount Value="7"/>
</Unit15>
<Unit16>
<Filename Value="../lazarus64/examples/pascalstream/componentstreampas.pas"/>
<TopLine Value="33"/>
<UsageCount Value="10"/>
</Unit16>
<Unit17>
<Filename Value="../firstprognewssbpm/mainmixxl.pas"/>
<ComponentName Value="MiXimumLP"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="2775"/>
<CursorPos X="20" Y="2792"/>
<UsageCount Value="9"/>
</Unit17>
<Unit18>
<Filename Value="/media/Windows7/dynsndfile/libsndfilestrings.pas"/>
<UsageCount Value="7"/>
</Unit18>
<Unit19>
<Filename Value="/media/Windows7/dynsndfile/lazdyn_libsndfile.pas"/>
<UsageCount Value="7"/>
</Unit19>
<Unit20>
<Filename Value="../logouos/unit1.pas"/>
<TopLine Value="67"/>
<CursorPos X="51" Y="83"/>
<UsageCount Value="7"/>
</Unit20>
<Unit21>
<Filename Value="/usr/lib/codetyphon/lazarus/lcl/graphics.pp"/>
<TopLine Value="1168"/>
<CursorPos X="49" Y="1181"/>
<UsageCount Value="9"/>
</Unit21>
<Unit22>
<Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/objpas/objpas.pp"/>
<TopLine Value="119"/>
<CursorPos X="8" Y="28"/>
<UsageCount Value="7"/>
</Unit22>
<Unit23>
<Filename Value="uos.pas"/>
<EditorIndex Value="3"/>
<TopLine Value="2987"/>
<CursorPos X="33" Y="2987"/>
<UsageCount Value="100"/>
<Loaded Value="True"/>
</Unit23>
<Unit24>
<Filename Value="uos_new.pas"/>
<TopLine Value="310"/>
<CursorPos X="29" Y="478"/>
<UsageCount Value="81"/>
</Unit24>
<Unit25>
<Filename Value="../firstprognew/bass.pas"/>
<TopLine Value="810"/>
<UsageCount Value="6"/>
</Unit25>
<Unit26>
<Filename Value="../onenamevar/unit1.pas"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="81"/>
<CursorPos X="44" Y="100"/>
<UsageCount Value="9"/>
</Unit26>
<Unit27>
<Filename Value="/usr/lib/codetyphon/lazarus/packager/registration/fcllaz.pas"/>
<CursorPos Y="4"/>
<UsageCount Value="3"/>
</Unit27>
<Unit28>
<Filename Value="../lazarus32/packager/registration/fcllaz.pas"/>
<UsageCount Value="3"/>
</Unit28>
<Unit29>
<Filename Value="../U_OS_Testnewonetype/uos.pas"/>
<TopLine Value="444"/>
<CursorPos X="79" Y="452"/>
<UsageCount Value="8"/>
</Unit29>
<Unit30>
<Filename Value="/media/Windows7/UOS/uos.pas"/>
<TopLine Value="747"/>
<CursorPos X="5" Y="750"/>
<UsageCount Value="4"/>
</Unit30>
<Unit31>
<Filename Value="/usr/lib/codetyphon/lazarus/components/codetools/codebeautifier.pas"/>
<TopLine Value="405"/>
<UsageCount Value="6"/>
</Unit31>
<Unit32>
<Filename Value="../dynportaudio/mainunitsine.pas"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="463"/>
<CursorPos Y="483"/>
<UsageCount Value="18"/>
</Unit32>
<Unit33>
<Filename Value="../dynportaudio/unit1.pas"/>
<TopLine Value="81"/>
<CursorPos X="16" Y="91"/>
<UsageCount Value="11"/>
</Unit33>
<Unit34>
<Filename Value="filterplayer_fpGUI.lpr"/>
<TopLine Value="727"/>
<CursorPos X="21" Y="731"/>
<UsageCount Value="11"/>
</Unit34>
<Unit35>
<Filename Value="../../development/lazarus/lcl/stdctrls.pp"/>
<TopLine Value="1050"/>
<CursorPos X="24" Y="1065"/>
<UsageCount Value="11"/>
</Unit35>
<Unit36>
<Filename Value="main_sp.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="317"/>
<CursorPos X="104" Y="333"/>
<UsageCount Value="11"/>
</Unit36>
<Unit37>
<Filename Value="/usr/lib/codetyphon/typhon/lcl/interfaces/gtk2/gtk2wsforms.pp"/>
<UnitName Value="Gtk2WSForms"/>
<EditorIndex Value="-1"/>
<TopLine Value="1002"/>
<CursorPos X="8" Y="1016"/>
<UsageCount Value="11"/>
</Unit37>
<Unit38>
<Filename Value="/usr/lib/codetyphon/typhon/ide/sourcefilemanager.pas"/>
<UnitName Value="SourceFileManager"/>
<EditorIndex Value="-1"/>
<TopLine Value="241"/>
<CursorPos X="4" Y="255"/>
<UsageCount Value="11"/>
</Unit38>
<Unit39>
<Filename Value="/usr/lib/codetyphon/typhon/lcl/customtimer.pas"/>
<UnitName Value="CustomTimer"/>
<EditorIndex Value="-1"/>
<TopLine Value="146"/>
<CursorPos X="24" Y="160"/>
<UsageCount Value="10"/>
</Unit39>
<Unit40>
<Filename Value="uos_flat.pas"/>
<EditorIndex Value="2"/>
<TopLine Value="112"/>
<CursorPos X="22" Y="119"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit40>
<Unit41>
<Filename Value="define.inc"/>
<EditorIndex Value="4"/>
<CursorPos X="3" Y="16"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit41>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="main_fp.pas"/>
<Caret Line="363" Column="19" TopLine="358"/>
</Position1>
<Position2>
<Filename Value="main_fp.pas"/>
<Caret Line="206" Column="23" TopLine="195"/>
</Position2>
<Position3>
<Filename Value="main_fp.pas"/>
<Caret Line="102" Column="3" TopLine="98"/>
</Position3>
<Position4>
<Filename Value="main_fp.pas"/>
<Caret Line="238" Column="3" TopLine="234"/>
</Position4>
<Position5>
<Filename Value="main_fp.pas"/>
<Caret Line="221" Column="3" TopLine="217"/>
</Position5>
<Position6>
<Filename Value="main_fp.pas"/>
<Caret Line="142" TopLine="121"/>
</Position6>
<Position7>
<Filename Value="main_fp.pas"/>
<Caret Line="221" Column="4" TopLine="214"/>
</Position7>
<Position8>
<Filename Value="main_fp.pas"/>
<Caret Line="237" Column="4" TopLine="232"/>
</Position8>
<Position9>
<Filename Value="main_fp.pas"/>
<Caret Line="81" Column="28" TopLine="72"/>
</Position9>
<Position10>
<Filename Value="main_fp.pas"/>
<Caret Line="241" Column="2" TopLine="231"/>
</Position10>
<Position11>
<Filename Value="main_fp.pas"/>
<Caret Line="177" Column="3" TopLine="177"/>
</Position11>
<Position12>
<Filename Value="main_fp.pas"/>
<Caret Line="220" Column="4" TopLine="215"/>
</Position12>
<Position13>
<Filename Value="main_fp.pas"/>
<Caret Line="238" Column="4" TopLine="233"/>
</Position13>
<Position14>
<Filename Value="main_fp.pas"/>
<Caret Line="390" Column="16" TopLine="375"/>
</Position14>
<Position15>
<Filename Value="main_fp.pas"/>
<Caret Line="469" TopLine="451"/>
</Position15>
<Position16>
<Filename Value="main_fp.pas"/>
<Caret Line="272" Column="15" TopLine="250"/>
</Position16>
<Position17>
<Filename Value="main_fp.pas"/>
<Caret Line="255" TopLine="222"/>
</Position17>
<Position18>
<Filename Value="main_fp.pas"/>
<Caret Line="91" Column="3" TopLine="91"/>
</Position18>
<Position19>
<Filename Value="main_fp.pas"/>
<Caret Line="416" Column="87" TopLine="409"/>
</Position19>
<Position20>
<Filename Value="main_fp.pas"/>
<Caret Line="205" Column="26" TopLine="198"/>
</Position20>
<Position21>
<Filename Value="main_fp.pas"/>
<Caret Line="204" Column="16" TopLine="198"/>
</Position21>
<Position22>
<Filename Value="main_fp.pas"/>
<Caret Line="206" Column="16" TopLine="200"/>
</Position22>
<Position23>
<Filename Value="main_fp.pas"/>
<Caret Line="222" Column="3" TopLine="200"/>
</Position23>
<Position24>
<Filename Value="main_fp.pas"/>
<Caret Line="223" Column="3" TopLine="201"/>
</Position24>
<Position25>
<Filename Value="main_fp.pas"/>
<Caret Line="224" Column="3" TopLine="202"/>
</Position25>
<Position26>
<Filename Value="main_fp.pas"/>
<Caret Line="261" Column="25" TopLine="254"/>
</Position26>
<Position27>
<Filename Value="main_fp.pas"/>
<Caret Line="262" Column="12" TopLine="243"/>
</Position27>
<Position28>
<Filename Value="main_fp.pas"/>
<Caret Line="122" Column="45" TopLine="122"/>
</Position28>
<Position29>
<Filename Value="main_fp.pas"/>
<Caret Line="288" TopLine="272"/>
</Position29>
<Position30>
<Filename Value="main_fp.pas"/>
<Caret Line="123" TopLine="101"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="FilterPlayer"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<SmallerCode Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<WriteFPCLogo Value="False"/>
</Other>
</CompilerOptions>
<Debugging>
<BreakPoints Count="1">
<Item1>
<Kind Value="bpkSource"/>
<WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="u_os.pas"/>
<Line Value="42"/>
</Item1>
</BreakPoints>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,22 @@
program filterplayer;
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
{$IFDEF UNIX} {$IFDEF UseCThreads}
cthreads,
cwstring, {$ENDIF} {$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms,
main_fp { you can add units after this };
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="UOS Simple Filter fpGUI"/>
<UseAppBundle Value="False"/>
</General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="fpgui_toolkit"/>
</Item1>
</RequiredPackages>
<Units Count="1">
<Unit0>
<Filename Value="filterplayer_fpGUI.pas"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="FilterPlayer_FPG"/>
</Target>
<SearchPaths>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<WriteFPCLogo Value="False"/>
<CustomOptions Value="-FUunits"/>
</Other>
</CompilerOptions>
</CONFIG>

View File

@@ -0,0 +1,942 @@
program filterplayer_fpGUI;
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}
uses
{$IFDEF UNIX} {$IFDEF UseCThreads}
cthreads,
cwstring, {$ENDIF} {$ENDIF}
SysUtils,
uos_flat,
fpg_style_chrome_silver_flatmenu,
fpg_stylemanager,
ctypes,
Math,
Classes,
fpg_button,
fpg_edit,
fpg_widget,
fpg_label,
fpg_Editbtn,
fpg_RadioButton,
fpg_trackbar,
fpg_CheckBox,
fpg_base,
fpg_main,
fpg_form { you can add units after this };
type
TFilterplayer = class(TfpgForm)
procedure uos_logo(Sender: TObject);
private
{@VFD_HEAD_BEGIN: Filterplayer}
Custom1: TfpgWidget;
Labelport: TfpgLabel;
btnLoad: TfpgButton;
FilenameEdit1: TfpgFileNameEdit;
FilenameEdit2: TfpgFileNameEdit;
FilenameEdit4: TfpgFileNameEdit;
btnStart: TfpgButton;
btnStop: TfpgButton;
lposition: TfpgLabel;
Labelsnf: TfpgLabel;
Labelmpg: TfpgLabel;
FilenameEdit3: TfpgFileNameEdit;
Llength: TfpgLabel;
btnpause: TfpgButton;
btnresume: TfpgButton;
CheckBox1: TfpgCheckBox;
RadioButton1: TfpgRadioButton;
RadioButton2: TfpgRadioButton;
RadioButton3: TfpgRadioButton;
Label2: TfpgLabel;
TrackBar1: TfpgTrackBar;
TrackBar2: TfpgTrackBar;
TrackBar3: TfpgTrackBar;
Label3: TfpgLabel;
Label4: TfpgLabel;
Label5: TfpgLabel;
RadioButton4: TfpgRadioButton;
Edit1: TfpgEdit;
Edit2: TfpgEdit;
CheckBox2: TfpgCheckBox;
{@VFD_HEAD_END: Filterplayer}
public
procedure AfterCreate; override;
procedure btnLoadClick(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
procedure btnStartClick(Sender: TObject);
procedure btnStopClick(Sender: TObject);
procedure btnResumeClick(Sender: TObject);
procedure btnPauseClick(Sender: TObject);
procedure TrackBar3Change(Sender: TObject; tmp: integer);
procedure TrackBar2Change(Sender: TObject; tmp: integer);
procedure TrackBar1Change(Sender: TObject; tmp: integer);
procedure RadioButton1Change(Sender: TObject);
procedure CheckBox1Change(Sender: TObject);
procedure TrackBar3proc;
procedure TrackBar2proc;
procedure TrackBar1proc;
procedure ClosePlayer1;
end;
{@VFD_NEWFORM_DECL}
{@VFD_NEWFORM_IMPL}
var
PlayerIndex1: cardinal;
ordir, opath: string;
Out1Index, In1Index, EQIndex1, EQIndex2, EQIndex3, FTIndex1: integer;
procedure TFilterplayer.btnResumeClick(Sender: TObject);
begin
uos_RePlay(PlayerIndex1);
btnStart.Enabled := False;
btnStop.Enabled := True;
btnPause.Enabled := True;
btnresume.Enabled := False;
end;
procedure TFilterplayer.btnPauseClick(Sender: TObject);
begin
uos_Pause(PlayerIndex1);
btnStart.Enabled := False;
btnStop.Enabled := True;
btnPause.Enabled := False;
btnresume.Enabled := True;
end;
procedure TFilterplayer.btnCloseClick(Sender: TObject);
begin
if (btnstart.Enabled = False) then
begin
uos_stop(PlayerIndex1);
sleep(100);
end;
if btnLoad.Enabled = False then
uos_UnloadLib();
end;
procedure TFilterplayer.btnLoadClick(Sender: TObject);
var
str: string;
begin
{$if defined(CPUAMD64) and defined(linux) }
// For Linux amd64, check libsndfile.so
if (FilenameEdit2.FileName <> 'system') and (FilenameEdit2.FileName <> '') then
if uos_TestLoadLibrary(PChar(FilenameEdit2.FileName)) = false then
FilenameEdit2.FileName := FilenameEdit2.FileName + '.2';
{$endif}
// Load the libraries
// function uos_LoadLib(PortAudioFileName: PChar; SndF // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt;ileFileName: PChar; Mpg123FileName, opusfilefilename: PChar) : integer;
if uos_LoadLib(PChar(FilenameEdit1.FileName), PChar(FilenameEdit2.FileName), PChar(FilenameEdit3.FileName), nil, nil, nil, nil) = 0 then
begin
hide;
Height := 345;
btnStart.Enabled := True;
btnLoad.Enabled := False;
FilenameEdit1.ReadOnly := True;
FilenameEdit2.ReadOnly := True;
FilenameEdit3.ReadOnly := True;
UpdateWindowPosition;
btnLoad.Text := 'PortAudio, SndFile and Mpg123 libraries are loaded...';
WindowPosition := wpScreenCenter;
fpgapplication.ProcessMessages;
sleep(500);
Show;
end;
end;
procedure TFilterplayer.ClosePlayer1;
begin
radiobutton1.Enabled := True;
radiobutton2.Enabled := True;
radiobutton3.Enabled := True;
radiobutton4.Enabled := True;
btnStart.Enabled := True;
btnStop.Enabled := False;
btnPause.Enabled := False;
btnresume.Enabled := False;
end;
procedure TFilterplayer.btnStopClick(Sender: TObject);
begin
uos_Stop(PlayerIndex1);
closeplayer1;
end;
procedure TFilterplayer.btnStartClick(Sender: TObject);
var
EqGain: double;
typfilt: shortint;
begin
PlayerIndex1 := 0; // PlayerIndex : from 0 to what your computer can do ! (depends of ram, cpu, ...)
// If PlayerIndex exists already, it will be overwritten...
{$IF (FPC_FULLVERSION>=20701) or DEFINED(LCL) or DEFINED(consoleapp) or DEFINED(Library) or DEFINED(Windows)}
uos_CreatePlayer(PlayerIndex1);
{$else}
uos_CreatePlayer(PlayerIndex1,sender);
{$endif}
//// Create the player.
//// PlayerIndex : from 0 to what your computer can do !
//// If PlayerIndex exists already, it will be overwriten...
In1Index := uos_AddFromFile(PlayerIndex1, PChar(filenameEdit4.filename), -1, 0, -1);
//// add input from audio file with custom parameters
////////// FileName : filename of audio file
//////////// PlayerIndex : Index of a existing Player
////////// OutputIndex : OutputIndex of existing Output // -1 : all output, -2: no output, other integer : existing output)
////////// SampleFormat : -1 default : Int16 : (0: Float32, 1:Int32, 2:Int16) SampleFormat of Input can be <= SampleFormat float of Output
//////////// FramesCount : default : -1 (65536)
// result : -1 nothing created, otherwise Input Index in array
{$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency
Out1Index :=uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, In1Index), -1, 0, -1, -1);
{$else}
Out1Index := uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, In1Index), -1, 0, -1, -1);
{$endif}
//// add a Output into device with custom parameters
//////////// PlayerIndex : Index of a existing Player
//////////// Device ( -1 is default Output device )
//////////// Latency ( -1 is latency suggested ) )
//////////// SampleRate : delault : -1 (44100)
//////////// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
//////////// SampleFormat : -1 default : Int16 : (0: Float32, 1:Int32, 2:Int16)
//////////// FramesCount : default : -1 (= 65536)
// ChunkCount : default : -1 (= 512)
EQIndex1 := uos_InputAddFilter(PlayerIndex1, In1Index,
1, 50, 800, 1,
1, 50, 800, 1, True, nil);
// Player Index add filter
// InputIndex : InputIndex of a existing Input
// TypeFilterL: Type of filter left:
// ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
// fBandPass = 3, fLowPass = 4, fHighPass = 5)
// LowFrequencyL : Lowest frequency left( -1 : current LowFrequency )
// HighFrequencyL : Highest frequency left( -1 : current HighFrequency )
// GainL : gain left to apply to filter
// TypeFilterR: Type of filter right (ignored if mono):
// ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
// LowFrequencyR : Lowest frequency Right (ignored if mono) ( -1 : current LowFrequency )
// HighFrequencyR : Highest frequency left( -1 : current HighFrequency )
// GainR : gain right (ignored if mono) to apply to filter ( 0 to what reasonable )
// AlsoBuf : The filter alter buffer aswell ( otherwise, only result is filled in fft.data )
// result : index of DSPIn in array
EQIndex2 := uos_InputAddFilter(PlayerIndex1, In1Index, 1, 801, 3000, 1,
1, 801, 3000, 1, True, nil);
EQIndex3 := uos_InputAddFilter(PlayerIndex1, In1Index, 1, 3001, 10000, 1,
1, 3001, 10000, 1, True, nil);
if radiobutton1.Checked = True then
typfilt := 2;
if radiobutton2.Checked = True then
typfilt := 3;
if radiobutton3.Checked = True then
typfilt := 5;
if radiobutton4.Checked = True then
typfilt := 4;
FTIndex1 := uos_InputAddFilter(PlayerIndex1, In1Index,
typfilt, StrToInt(edit2.Text), StrToInt(edit1.Text), 1,
typfilt, StrToInt(edit2.Text), StrToInt(edit1.Text), 1,
True, nil);
uos_InputSetFilter(PlayerIndex1, In1Index, FTIndex1, -1, -1, -1, -1, -1, -1, -1, -1, True, nil, checkbox2.Checked);
// InputIndex : InputIndex of a existing Input
// DSPInIndex : DSPInIndex of existing DSPIn
// TypeFilterL: Type of filter left:
// ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
// fBandPass = 3, fLowPass = 4, fHighPass = 5)
// LowFrequencyL : Lowest frequency left( -1 : current LowFrequency )
// HighFrequencyL : Highest frequency left( -1 : current HighFrequency )
// GainL : gain left to apply to filter
// TypeFilterR: Type of filter right (ignored if mono):
// ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
// LowFrequencyR : Lowest frequency Right (ignored if mono) ( -1 : current LowFrequency )
// HighFrequencyR : Highest frequency left( -1 : current HighFrequency )
// GainR : gain right (ignored if mono) to apply to filter ( 0 to what reasonable )
// AlsoBuf : The filter alter buffer aswell ( otherwise, only result is filled in fft.data )
// LoopProc : external procedure of object to synchronize after DSP done
// Enable : Filter enabled
uos_EndProc(PlayerIndex1, @ClosePlayer1);
///// Assign the procedure of object to execute at end
//////////// PlayerIndex : Index of a existing Player
//////////// ClosePlayer1 : procedure of object to execute inside the loop
/////// procedure to execute when stream is terminated
uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets play it...
btnStart.Enabled := False;
btnPause.Enabled := True;
btnResume.Enabled := False;
btnStop.Enabled := True;
TrackBar1proc;
TrackBar2proc;
TrackBar3proc;
end;
procedure TFilterplayer.CheckBox1Change(Sender: TObject);
begin
uos_InputSetFilter(PlayerIndex1, In1Index, EQIndex1, -1, -1, -1, -1, -1, -1, -1, -1, True, nil, checkbox1.Checked);
uos_InputSetFilter(PlayerIndex1, In1Index, EQIndex2, -1, -1, -1, -1, -1, -1, -1, -1, True, nil, checkbox1.Checked);
uos_InputSetFilter(PlayerIndex1, In1Index, EQIndex3, -1, -1, -1, -1, -1, -1, -1, -1, True, nil, checkbox1.Checked);
end;
procedure TFilterplayer.RadioButton1Change(Sender: TObject);
var
typfilt: shortint;
begin
if radiobutton1.Checked = True then
typfilt := 2;
if radiobutton2.Checked = True then
typfilt := 3;
if radiobutton3.Checked = True then
typfilt := 5;
if radiobutton4.Checked = True then
typfilt := 4;
// if (btnstart.Enabled = False) then
uos_InputSetFilter(PlayerIndex1, In1Index, FTIndex1,
typfilt, StrToInt(edit2.Text), StrToInt(edit1.Text), 1,
typfilt, StrToInt(edit2.Text), StrToInt(edit1.Text), 1,
True, nil, checkbox2.Checked);
end;
procedure TFilterplayer.TrackBar3proc;
var
gain: double;
tracpos: integer;
begin
tracpos := -1 * trackBar3.Position;
if (tracpos) = 0 then
gain := 1
else if tracpos > 0 then
gain := 1 + (tracpos / 20)
else
gain := ((100 + tracpos) / 100);
// if (btnStart.Enabled = true) then
uos_InputSetFilter(PlayerIndex1, In1Index, EQIndex3, -1, -1, -1, Gain, -1, -1, -1, Gain,
True, nil, checkbox1.Checked);
end;
procedure TFilterplayer.TrackBar2proc;
var
gain: double;
tracpos: integer;
begin
tracpos := -1 * trackBar2.Position;
if (tracpos) = 0 then
gain := 1
else if tracpos > 0 then
gain := 1 + (tracpos / 33)
else
gain := ((100 + tracpos) / 100);
// if (btnStart.Enabled = true) then
uos_InputSetFilter(PlayerIndex1, In1Index, EQIndex2, -1, -1, -1, Gain, -1, -1, -1, Gain,
True, nil, checkbox1.Checked);
end;
procedure TFilterplayer.TrackBar1proc;
var
gain: double;
tracpos: integer;
begin
tracpos := -1 * trackBar1.Position;
if (tracpos) = 0 then
gain := 1
else if tracpos > 0 then
gain := 1 + (tracpos / 33)
else
gain := ((100 + tracpos) / 100);
// if (btnStart.Enabled = true) then
// if (btnStart.Enabled = true) then
uos_InputSetFilter(PlayerIndex1, In1Index, EQIndex1, -1, -1, -1, Gain, -1, -1, -1, Gain,
True, nil, checkbox1.Checked);
end;
procedure TFilterplayer.TrackBar1Change(Sender: TObject; tmp: integer);
begin
TrackBar1proc;
end;
procedure TFilterplayer.TrackBar2Change(Sender: TObject; tmp: integer);
begin
Trackbar2proc;
end;
procedure TFilterplayer.TrackBar3Change(Sender: TObject; tmp: integer);
begin
trackbar3proc;
end;
procedure TFilterplayer.AfterCreate;
begin
{%region 'Auto-generated GUI code' -fold}
{@VFD_BODY_BEGIN: Filterplayer}
Name := 'Filterplayer';
SetPosition(419, 72, 502, 371);
WindowTitle := 'Filter player ';
IconName := '';
BackGroundColor := $80000001;
Hint := '';
WindowPosition := wpScreenCenter;
Ondestroy := @btnCloseClick;
Custom1 := TfpgWidget.Create(self);
with Custom1 do
begin
Name := 'Custom1';
SetPosition(10, 8, 115, 115);
OnPaint := @uos_logo;
end;
Labelport := TfpgLabel.Create(self);
with Labelport do
begin
Name := 'Labelport';
SetPosition(136, 0, 320, 15);
Alignment := taCenter;
FontDesc := '#Label1';
ParentShowHint := False;
Text := 'Folder + filename of PortAudio Library';
Hint := '';
end;
btnLoad := TfpgButton.Create(self);
with btnLoad do
begin
Name := 'btnLoad';
SetPosition(16, 128, 476, 23);
Text := 'Load that libraries';
FontDesc := '#Label1';
ImageName := '';
ParentShowHint := False;
TabOrder := 0;
Hint := '';
onclick := @btnLoadClick;
end;
FilenameEdit1 := TfpgFileNameEdit.Create(self);
with FilenameEdit1 do
begin
Name := 'FilenameEdit1';
SetPosition(136, 16, 356, 24);
ExtraHint := '';
FileName := '';
Filter := '';
InitialDir := '';
TabOrder := 3;
end;
FilenameEdit2 := TfpgFileNameEdit.Create(self);
with FilenameEdit2 do
begin
Name := 'FilenameEdit2';
SetPosition(136, 56, 356, 24);
ExtraHint := '';
FileName := '';
Filter := '';
InitialDir := '';
TabOrder := 4;
end;
FilenameEdit4 := TfpgFileNameEdit.Create(self);
with FilenameEdit4 do
begin
Name := 'FilenameEdit4';
SetPosition(16, 280, 472, 24);
ExtraHint := '';
FileName := '';
Filter := '';
InitialDir := '';
TabOrder := 5;
end;
btnStart := TfpgButton.Create(self);
with btnStart do
begin
Name := 'btnStart';
SetPosition(104, 312, 44, 23);
Text := 'Play';
Enabled := False;
FontDesc := '#Label1';
ImageName := '';
ParentShowHint := False;
TabOrder := 6;
Hint := '';
onclick := @btnstartClick;
end;
btnStop := TfpgButton.Create(self);
with btnStop do
begin
Name := 'btnStop';
SetPosition(316, 312, 80, 23);
Text := 'Stop';
Enabled := False;
FontDesc := '#Label1';
ImageName := '';
ParentShowHint := False;
TabOrder := 7;
Hint := '';
onclick := @btnStopClick;
end;
lposition := TfpgLabel.Create(self);
with lposition do
begin
Name := 'lposition';
SetPosition(372, 157, 104, 19);
Alignment := taCenter;
FontDesc := '#Label1';
ParentShowHint := False;
Text := 'High Frequency';
Hint := '';
end;
Labelsnf := TfpgLabel.Create(self);
with Labelsnf do
begin
Name := 'Labelsnf';
SetPosition(140, 40, 316, 15);
Alignment := taCenter;
FontDesc := '#Label1';
ParentShowHint := False;
Text := 'Folder + filename of SndFile Library';
Hint := '';
end;
Labelmpg := TfpgLabel.Create(self);
with Labelmpg do
begin
Name := 'Labelmpg';
SetPosition(136, 80, 316, 15);
Alignment := taCenter;
FontDesc := '#Label1';
ParentShowHint := False;
Text := 'Folder + filename of Mpg123 Library';
Hint := '';
end;
FilenameEdit3 := TfpgFileNameEdit.Create(self);
with FilenameEdit3 do
begin
Name := 'FilenameEdit3';
SetPosition(136, 96, 356, 24);
ExtraHint := '';
FileName := '';
Filter := '';
InitialDir := '';
TabOrder := 12;
end;
Llength := TfpgLabel.Create(self);
with Llength do
begin
Name := 'Llength';
SetPosition(376, 201, 104, 15);
Alignment := taCenter;
FontDesc := '#Label1';
ParentShowHint := False;
Text := 'Low Frequency';
Hint := '';
end;
btnpause := TfpgButton.Create(self);
with btnpause do
begin
Name := 'btnpause';
SetPosition(164, 312, 52, 23);
Text := 'Pause';
Enabled := False;
FontDesc := '#Label1';
ImageName := '';
ParentShowHint := False;
TabOrder := 15;
Hint := '';
onclick := @btnPauseClick;
end;
btnresume := TfpgButton.Create(self);
with btnresume do
begin
Name := 'btnresume';
SetPosition(232, 312, 64, 23);
Text := 'Resume';
Enabled := False;
FontDesc := '#Label1';
ImageName := '';
ParentShowHint := False;
TabOrder := 16;
Hint := '';
onclick := @btnResumeClick;
end;
CheckBox1 := TfpgCheckBox.Create(self);
with CheckBox1 do
begin
Name := 'CheckBox1';
SetPosition(32, 252, 156, 19);
Checked := True;
FontDesc := '#Label1';
ParentShowHint := False;
TabOrder := 17;
Text := 'Enable Equalizer';
Hint := '';
onchange := @CheckBox1Change;
end;
RadioButton1 := TfpgRadioButton.Create(self);
with RadioButton1 do
begin
Name := 'RadioButton1';
SetPosition(216, 176, 96, 19);
Checked := True;
FontDesc := '#Label1';
GroupIndex := 0;
ParentShowHint := False;
TabOrder := 18;
Text := 'BandReject';
Hint := '';
onchange := @RadioButton1Change;
end;
RadioButton2 := TfpgRadioButton.Create(self);
with RadioButton2 do
begin
Name := 'RadioButton2';
SetPosition(216, 200, 100, 19);
FontDesc := '#Label1';
GroupIndex := 0;
ParentShowHint := False;
TabOrder := 19;
Text := 'BandPass';
Hint := '';
onchange := @RadioButton1Change;
end;
RadioButton3 := TfpgRadioButton.Create(self);
with RadioButton3 do
begin
Name := 'RadioButton3';
SetPosition(216, 246, 100, 19);
FontDesc := '#Label1';
GroupIndex := 0;
ParentShowHint := False;
TabOrder := 20;
Text := 'HighPass';
Hint := '';
onchange := @RadioButton1Change;
end;
Label2 := TfpgLabel.Create(self);
with Label2 do
begin
Name := 'Label2';
SetPosition(220, 160, 72, 19);
FontDesc := '#Label1';
ParentShowHint := False;
Text := 'Filters';
Hint := '';
end;
TrackBar1 := TfpgTrackBar.Create(self);
with TrackBar1 do
begin
Name := 'TrackBar1';
SetPosition(24, 160, 36, 74);
Max := 100;
min := -100;
Orientation := orVertical;
ParentShowHint := False;
Position := 0;
TabOrder := 22;
Hint := '';
onchange := @TrackBar1Change;
end;
TrackBar2 := TfpgTrackBar.Create(self);
with TrackBar2 do
begin
Name := 'TrackBar2';
SetPosition(80, 160, 32, 74);
Max := 100;
min := -100;
Orientation := orVertical;
ParentShowHint := False;
Position := 0;
TabOrder := 23;
Hint := '';
onchange := @TrackBar2Change;
end;
TrackBar3 := TfpgTrackBar.Create(self);
with TrackBar3 do
begin
Name := 'TrackBar3';
SetPosition(136, 160, 28, 74);
Max := 100;
min := -100;
Orientation := orVertical;
ParentShowHint := False;
Position := 0;
TabOrder := 24;
Hint := '';
onchange := @TrackBar3Change;
end;
Label3 := TfpgLabel.Create(self);
with Label3 do
begin
Name := 'Label3';
SetPosition(68, 232, 52, 15);
Alignment := taCenter;
FontDesc := '#Label1';
ParentShowHint := False;
Text := 'Medium';
Hint := '';
end;
Label4 := TfpgLabel.Create(self);
with Label4 do
begin
Name := 'Label4';
SetPosition(20, 232, 40, 15);
Alignment := taCenter;
FontDesc := '#Label1';
ParentShowHint := False;
Text := 'Low';
Hint := '';
end;
Label5 := TfpgLabel.Create(self);
with Label5 do
begin
Name := 'Label5';
SetPosition(128, 232, 36, 19);
Alignment := taCenter;
FontDesc := '#Label1';
ParentShowHint := False;
Text := 'High';
Hint := '';
end;
RadioButton4 := TfpgRadioButton.Create(self);
with RadioButton4 do
begin
Name := 'RadioButton4';
SetPosition(216, 224, 92, 19);
FontDesc := '#Label1';
GroupIndex := 0;
ParentShowHint := False;
TabOrder := 28;
Text := 'LowPass';
Hint := '';
onchange := @RadioButton1Change;
end;
Edit1 := TfpgEdit.Create(self);
with Edit1 do
begin
Name := 'Edit1';
SetPosition(368, 172, 116, 24);
ExtraHint := '';
FontDesc := '#Edit1';
ParentShowHint := False;
TabOrder := 29;
Text := '15000';
Hint := '';
end;
Edit2 := TfpgEdit.Create(self);
with Edit2 do
begin
Name := 'Edit2';
SetPosition(368, 216, 116, 24);
ExtraHint := '';
FontDesc := '#Edit1';
ParentShowHint := False;
TabOrder := 29;
Text := '5000';
Hint := '';
end;
CheckBox2 := TfpgCheckBox.Create(self);
with CheckBox2 do
begin
Name := 'CheckBox2';
SetPosition(368, 244, 120, 19);
FontDesc := '#Label1';
ParentShowHint := False;
TabOrder := 30;
Text := 'Enable Filter';
Hint := '';
onchange := @RadioButton1Change;
end;
{@VFD_BODY_END: Filterplayer}
{%endregion}
//////////////////////
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
RadioButton1.Checked := True;
Height := 157;
{$IFDEF Windows}
{$if defined(cpu64)}
FilenameEdit1.FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
FilenameEdit2.FileName := ordir + 'lib\Windows\64bit\LibSndFile-64.dll';
FilenameEdit3.FileName := ordir + 'lib\Windows\64bit\LibMpg123-64.dll';
{$else}
FilenameEdit1.FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
FilenameEdit2.FileName := ordir + 'lib\Windows\32bit\LibSndFile-32.dll';
FilenameEdit3.FileName := ordir + 'lib\Windows\32bit\LibMpg123-32.dll';
{$endif}
FilenameEdit4.FileName := ordir + 'sound\test.mp3';
{$ENDIF}
{$IFDEF Darwin}
opath := ordir;
opath := copy(opath, 1, Pos('/uos', opath) - 1);
FilenameEdit1.FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
FilenameEdit2.FileName := opath + '/lib/Mac/32bit/LibSndFile-32.dylib';
FilenameEdit3.FileName := opath + '/lib/Mac/32bit/LibMpg123-32.dylib';
FilenameEdit4.FileName := opath + 'sound/test.mp3';
{$ENDIF}
{$IFDEF Darwin}
{$IFDEF CPU32}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
FilenameEdit1.FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
FilenameEdit2.FileName := opath + '/lib/Mac/32bit/LibSndFile-32.dylib';
FilenameEdit3.FileName := opath + '/lib/Mac/32bit/LibMpg123-32.dylib';
FilenameEdit4.FileName := opath + 'sound/test.mp3';
{$ENDIF}
{$IFDEF CPU64}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
FilenameEdit2.FileName := opath + '/lib/Mac/64bit/LibSndFile-64.dylib';
FilenameEdit3.FileName := opath + '/lib/Mac/64bit/LibMpg123-64.dylib';
FilenameEdit4.FileName := opath + 'sound/test.mp3';
FilenameEdit1.FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib';
{$ENDIF}
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
FilenameEdit1.FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
FilenameEdit2.FileName := ordir + 'lib/Linux/64bit/LibSndFile-64.so';
FilenameEdit3.FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so';
FilenameEdit4.FileName := ordir + 'sound/test.mp3';
{$ENDIF}
{$if defined(cpu86) and defined(linux)}
FilenameEdit1.FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
FilenameEdit2.FileName := ordir + 'lib/Linux/32bit/LibSndFile-32.so';
FilenameEdit3.FileName := ordir + 'lib/Linux/32bit/LibMpg123-32.so';
FilenameEdit4.FileName := ordir + 'sound/test.mp3';
{$ENDIF}
{$if defined(linux) and defined(cpuaarch64)}
FilenameEdit1 := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
FilenameEdit2 := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so';
FilenameEdit3 := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so';
FilenameEdit4 := ordir + 'sound/test.mp3';
{$ENDIF}
{$if defined(linux) and defined(cpuarm)}
FilenameEdit1.FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
FilenameEdit2.FileName := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';
FilenameEdit3.FileName := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so';
FilenameEdit4.FileName := ordir + 'sound/test.mp3';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
FilenameEdit1.FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
FilenameEdit2.FileName := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so';
FilenameEdit3.FileName := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so';
{$else}
FilenameEdit1.FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-64.so';
FilenameEdit2.FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-64.so';
FilenameEdit3.FileName := ordir + 'lib/FreeBSD/32bit/libmpg123-64.so';
{$endif}
FilenameEdit4.FileName := ordir + 'sound/test.mp3';
{$ENDIF}
FilenameEdit4.Initialdir := ordir + 'sound';
FilenameEdit1.Initialdir := ordir + 'lib';
FilenameEdit2.Initialdir := ordir + 'lib';
FilenameEdit3.Initialdir := ordir + 'lib';
end;
procedure TFilterplayer.uos_logo(Sender: TObject);
var
xpos, ypos, pbwidth, pbheight: integer;
ratio: double;
begin
xpos := 0;
ypos := 0;
ratio := 1;
pbwidth := 115;
pbheight := 115;
with Custom1 do
begin
Canvas.GradientFill(GetClientRect, clgreen, clBlack, gdVertical);
Canvas.TextColor := clWhite;
Canvas.DrawText(60, 20, 'uos');
end;
end;
procedure MainProc;
var
frm: TFilterplayer;
begin
fpgApplication.Initialize;
if fpgStyleManager.SetStyle('Chrome silver flat menu') then
fpgStyle := fpgStyleManager.Style;
frm := TFilterplayer.Create(nil);
try
frm.Show;
fpgApplication.Run;
finally
uos_free;
frm.Free;
end;
end;
begin
MainProc;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<Title Value="formspectrum"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
</General>
<BuildModes Count="3">
<Item1 Name="Default" Default="True"/>
<Item2 Name="Debug">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="formspectrum"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
<UseHeaptrc Value="True"/>
<TrashVariables Value="True"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item2>
<Item3 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="formspectrum"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item3>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<DestinationDirectory Value="c:\uos_filter"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="formspectrum.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="formspectrum_unit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="formspectrum"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="units"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="2"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</CONFIG>

View File

@@ -0,0 +1,23 @@
program formspectrum;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, formspectrum_unit
{ you can add units after this };
{$R *.res}
begin
// RequireDerivedFormResource:=True;
// Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,12 @@
program formspectrum_mse;
{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
{$ifdef FPC}
{$ifdef mswindows}{$apptype gui}{$endif}
{$endif}
uses
{$ifdef FPC}{$ifdef unix} cthreads,{$endif}{$endif}
msegui,main_spectrum_mse;
begin
application.createform(tmainfo,mainfo);
application.run;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,161 @@
object Form1: TForm1
Left = 477
Height = 258
Top = 265
Width = 268
Caption = 'Filter Spectrum'
ClientHeight = 258
ClientWidth = 268
OnActivate = FormActivate
OnDestroy = FormDestroy
LCLVersion = '3.0.0.3'
object ProgressBar2: TProgressBar
Left = 44
Height = 228
Top = 28
Width = 19
Orientation = pbVertical
ParentShowHint = False
ShowHint = True
Smooth = True
TabOrder = 0
end
object ProgressBar3: TProgressBar
Left = 67
Height = 228
Top = 28
Width = 19
Orientation = pbVertical
ParentShowHint = False
ShowHint = True
Smooth = True
TabOrder = 1
end
object ProgressBar4: TProgressBar
Left = 90
Height = 228
Top = 28
Width = 19
Orientation = pbVertical
ParentShowHint = False
ShowHint = True
Smooth = True
TabOrder = 2
end
object ProgressBar5: TProgressBar
Left = 113
Height = 228
Top = 28
Width = 19
Orientation = pbVertical
ParentShowHint = False
ShowHint = True
Smooth = True
TabOrder = 3
end
object ProgressBar6: TProgressBar
Left = 136
Height = 228
Top = 28
Width = 19
Orientation = pbVertical
ParentShowHint = False
ShowHint = True
Smooth = True
TabOrder = 4
end
object ProgressBar7: TProgressBar
Left = 158
Height = 228
Top = 28
Width = 19
Orientation = pbVertical
ParentShowHint = False
ShowHint = True
Smooth = True
TabOrder = 5
end
object ProgressBar8: TProgressBar
Left = 181
Height = 228
Top = 28
Width = 19
Orientation = pbVertical
ParentShowHint = False
ShowHint = True
Smooth = True
TabOrder = 6
end
object ProgressBar9: TProgressBar
Left = 204
Height = 228
Top = 28
Width = 19
Orientation = pbVertical
ParentShowHint = False
ShowHint = True
Smooth = True
TabOrder = 7
end
object ProgressBar10: TProgressBar
Left = 227
Height = 228
Top = 28
Width = 19
Orientation = pbVertical
ParentShowHint = False
ShowHint = True
Smooth = True
TabOrder = 8
end
object Button1: TButton
Left = 164
Height = 17
Top = 7
Width = 45
Caption = 'Start'
TabOrder = 9
OnClick = Button1Click
end
object Label1: TLabel
Left = 262
Height = 1
Top = 76
Width = 1
ParentColor = False
end
object FileNameEdit1: TFileNameEdit
Left = 7
Height = 27
Top = 0
Width = 156
FileName = 'FileNameEdit1'
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
NumGlyphs = 1
MaxLength = 0
TabOrder = 10
Text = 'FileNameEdit1'
end
object Button2: TButton
Left = 213
Height = 17
Top = 7
Width = 45
Caption = 'Stop'
TabOrder = 11
OnClick = Button2Click
end
object ProgressBar1: TProgressBar
Left = 21
Height = 228
Top = 28
Width = 19
Orientation = pbVertical
ParentShowHint = False
ShowHint = True
Smooth = True
TabOrder = 12
end
end

View File

@@ -0,0 +1,287 @@
unit formspectrum_unit;
{$mode objfpc}{$H+}
interface
uses
Classes,
ctypes,
SysUtils,
uos_flat,
Forms,
Controls,
Graphics,
Dialogs,
ComCtrls,
StdCtrls,
EditBtn, Types;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
FileNameEdit1: TFileNameEdit;
Label1: TLabel;
ProgressBar10: TProgressBar;
ProgressBar1: TProgressBar;
ProgressBar2: TProgressBar;
ProgressBar3: TProgressBar;
ProgressBar4: TProgressBar;
ProgressBar5: TProgressBar;
ProgressBar6: TProgressBar;
ProgressBar7: TProgressBar;
ProgressBar8: TProgressBar;
ProgressBar9: TProgressBar;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure closeplayer;
procedure FormDestroy(Sender: TObject);
procedure LoopProcPlayer;
procedure endprocedure;
private
public
end;
equalizer_band_type = record
lo_freq, hi_freq: integer;
Text: string[10];
end;
var
Equalizer_Bands: array[1..10] of equalizer_band_type;
Form1: TForm1;
res, x, y, z: integer;
thearray: array of cfloat;
ordir, opath, SoundFilename, PA_FileName, SF_FileName, MP_FileName: string;
PlayerIndex1, InputIndex1, OutputIndex1: integer;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.ClosePlayer;
begin
button1.Enabled := True;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
uos_stop(0);
uos_free();
end;
procedure TForm1.LoopProcPlayer;
var
i, v: integer;
begin
if uos_getstatus(PlayerIndex1) > 0 then
begin
i := 1;
thearray := uos_InputFiltersGetLevelArray(PlayerIndex1, InputIndex1);
x := 0;
while x < length(thearray) - 1 do
begin
if i <= 10 then
begin
v := trunc((thearray[x] + thearray[x + 1]) * 50);
TProgressBar(findcomponent('ProgressBar' + IntToStr(i))).position := v;
end;
x := x + 2;
Inc(i);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
begin
PlayerIndex1 := 0;
if uos_CreatePlayer(PlayerIndex1) then
begin
SoundFilename := FileNameEdit1.FileName;
InputIndex1 := uos_AddFromFile(PlayerIndex1, (PChar(SoundFilename)), -1, -1, 4096);
if InputIndex1 > -1 then
begin
OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, -1, -1, -1, 4096, -1);
if OutputIndex1 > -1 then
begin
// Spectrum : create bandpass filters with alsobuf set to false, how many you want:
for i := 1 to 10 do
uos_InputAddFilter(PlayerIndex1, InputIndex1,
3, Equalizer_Bands[i].lo_freq, Equalizer_Bands[i].hi_freq, 1,
3, Equalizer_Bands[i].lo_freq, Equalizer_Bands[i].hi_freq, 1, False, nil);
uos_Endproc(PlayerIndex1,@endprocedure);
uos_LoopProcIn(PlayerIndex1, InputIndex1, @LoopProcPlayer);
/////// everything is ready, here we are, lets play it...
uos_Play(PlayerIndex1);
Button1.Enabled := False;
end;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
uos_stop(PlayerIndex1);
Button1.Enabled := True;
end;
procedure TForm1.endprocedure;
begin
Button1.Enabled := True;
end;
procedure TForm1.FormActivate(Sender: TObject);
var
i: integer = 1;
begin
ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));
{$IFDEF Windows}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll';
SF_FileName := ordir + 'lib\Windows\64bit\LibSndFile-64.dll';
MP_FileName := ordir + 'lib\Windows\64bit\LibMpg123-64.dll';
{$else}
PA_FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll';
SF_FileName := ordir + 'lib\Windows\32bit\LibSndFile-32.dll';
MP_FileName := ordir + 'lib\Windows\32bit\LibMpg123-32.dll';
{$endif}
SoundFilename := ordir + 'sound\test.ogg';
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
SF_FileName := ordir + 'lib/Linux/64bit/LibSndFile-64.so';
PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so';
MP_FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(cpu86) and defined(linux)}
PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so';
SF_FileName := ordir + 'lib/Linux/32bit/LibSndFile-32.so';
MP_FileName := ordir + 'lib/Linux/32bit/LibMpg123-32.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(linux) and defined(cpuaarch64)}
PA_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so';
SF_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so';
MP_FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$if defined(linux) and defined(cpuarm)}
PA_FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so';
SF_FileName := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so';
MP_FileName := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so';
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$IFDEF freebsd}
{$if defined(cpu64)}
PA_FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so';
SF_FileName := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so';
MP_FileName := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so';
{$else}
PA_FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so';
SF_FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so';
MP_FileName := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so';
{$endif}
SoundFilename := ordir + 'sound/test.ogg';
{$ENDIF}
{$IFDEF Darwin}
opath := ordir;
opath := copy(opath, 1, Pos('/UOS', opath) - 1);
PA_FileName := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib';
SF_FileName := opath + '/lib/Mac/32bit/LibSndFile-32.dylib';
MP_FileName := ordir + 'lib/Mac/32bit/LibMpg123-32.dylib';
SoundFilename := opath + '/sound/test.ogg';
{$ENDIF}
{$if defined(CPUAMD64) and defined(linux) }
// For Linux amd64, check libsndfile.so
if (SF_FileName <> 'system') and (SF_FileName <> '') then
if uos_TestLoadLibrary(PChar(SF_FileName)) = false then
SF_FileName := SF_FileName + '.2';
{$endif}
FileNameEdit1.FileName := SoundFilename;
res := uos_LoadLib(PChar(PA_FileName), PChar(SF_FileName), PChar(MP_FileName), nil, nil, nil, nil);
if Res <> 0 then
begin
label1.Caption := 'UOS library in Error';
Button1.Enabled := False;
end
else
Button1.Enabled := True;
Equalizer_Bands[1].lo_freq := 18;
Equalizer_Bands[1].hi_freq := 46;
Equalizer_Bands[1].Text := '31.25';
Equalizer_Bands[2].lo_freq := 47;
Equalizer_Bands[2].hi_freq := 94;
Equalizer_Bands[2].Text := '62.5';
Equalizer_Bands[3].lo_freq := 95;
Equalizer_Bands[3].hi_freq := 188;
Equalizer_Bands[3].Text := '125';
Equalizer_Bands[4].lo_freq := 189;
Equalizer_Bands[4].hi_freq := 375;
Equalizer_Bands[4].Text := '250';
Equalizer_Bands[5].lo_freq := 376;
Equalizer_Bands[5].hi_freq := 750;
Equalizer_Bands[5].Text := '500';
Equalizer_Bands[6].lo_freq := 751;
Equalizer_Bands[6].hi_freq := 1500;
Equalizer_Bands[6].Text := '1K';
Equalizer_Bands[7].lo_freq := 1501;
Equalizer_Bands[7].hi_freq := 3000;
Equalizer_Bands[7].Text := '2K';
Equalizer_Bands[8].lo_freq := 3001;
Equalizer_Bands[8].hi_freq := 6000;
Equalizer_Bands[8].Text := '4K';
Equalizer_Bands[9].lo_freq := 6001;
Equalizer_Bands[9].hi_freq := 12000;
Equalizer_Bands[9].Text := '8K';
Equalizer_Bands[10].lo_freq := 12001;
Equalizer_Bands[10].hi_freq := 20000;
Equalizer_Bands[10].Text := '16K';
while i < 11 do
begin
TProgressBar(findcomponent('ProgressBar' + IntToStr(i))).hint :=
'Freq: ' + Equalizer_Bands[i].Text;
Inc(i);
end;
end;
end.

View File

@@ -0,0 +1,167 @@
{ Chrome Style with flat menu
by Fred van Stappen
fiens@hotmail.com
}
unit fpg_style_chrome_silver_flatmenu;
{$mode objfpc}{$H+}
/// for custom compil, like using fpgui-dvelop => edit define.inc
//{$I define.inc}
interface
uses
Classes, fpg_main, fpg_base;
type
TExtStyle = class(TfpgStyle)
public
constructor Create; override;
{ General }
procedure DrawControlFrame(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord); override;
{ Buttons }
procedure DrawButtonFace(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord;
AFlags: TfpgButtonFlags); override;
{ Menus }
procedure DrawMenuRow(ACanvas: TfpgCanvas; r: TfpgRect;
AFlags: TfpgMenuItemFlags); override;
function HasButtonHoverEffect: boolean; override;
end;
implementation
uses
fpg_stylemanager;
{ TExtStyle }
constructor TExtStyle.Create;
begin
inherited Create;
fpgSetNamedColor(clWindowBackground, clLightGray);
end;
function TExtStyle.HasButtonHoverEffect: boolean;
begin
Result := True;
end;
procedure TExtStyle.DrawControlFrame(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord);
var
r: TfpgRect;
begin
r.SetRect(x, y, w, h);
ACanvas.SetColor(cldarkgray);
ACanvas.DrawRectangle(r);
r.SetRect(x+1, y+1, w-2, h-2);
ACanvas.SetColor(clwhite);
ACanvas.DrawRectangle(r);
end;
procedure TExtStyle.DrawButtonFace(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord;
AFlags: TfpgButtonFlags);
var
r, r21, r22: TfpgRect;
begin
r.SetRect(x, y, w, h);
r21.SetRect(x, y, w, h div 2);
r22.SetRect(x, y + (h div 2), w, h div 2);
if btfIsDefault in AFlags then
begin
ACanvas.SetColor(TfpgColor($7b7b7b));
ACanvas.SetLineStyle(1, lsSolid);
ACanvas.DrawRectangle(r);
InflateRect(r, -1, -1);
Exclude(AFlags, btfIsDefault);
fpgStyle.DrawButtonFace(ACanvas, r.Left, r.Top, r.Width, r.Height, AFlags);
Exit; //==>
end;
// Clear the canvas
ACanvas.SetColor(clWindowBackground);
ACanvas.FillRectangle(r);
if (btfFlat in AFlags) and not (btfIsPressed in AFlags) then
Exit; // no need to go further
InflateRect(r, -1, -1);
// outer rectangle
ACanvas.SetLineStyle(1, lsSolid);
// ACanvas.SetColor(TfpgColor($a6a6a6));
ACanvas.SetColor(clblack);
ACanvas.DrawRectangle(r);
// so we don't paint over the border
// now paint the face of the button
if (btfIsPressed in AFlags) or (btfHover in AFlags) and not (btfDisabled in AFlags) then
begin
ACanvas.GradientFill(r21, clHilite1, clwhite, gdVertical);
ACanvas.GradientFill(r22, clwhite, clHilite1, gdVertical);
// ACanvas.SetColor(clblack);
ACanvas.SetColor(cldarkgray);
ACanvas.DrawRectangle(r);
InflateRect(r, -1, -1);
if (btfHover in AFlags) then ACanvas.SetColor(clyellow) else ACanvas.SetColor(cllime);
ACanvas.DrawRectangle(r);
end
else
begin
ACanvas.GradientFill(r21, clsilver, $E6E6E6, gdVertical);
ACanvas.GradientFill(r22, $E6E6E6, clsilver, gdVertical);
// ACanvas.SetColor(clblack);
ACanvas.SetColor(cldarkgray);
ACanvas.DrawRectangle(r);
end;
end;
procedure TExtStyle.DrawMenuRow(ACanvas: TfpgCanvas; r: TfpgRect;
AFlags: TfpgMenuItemFlags);
var
r21, r22: TfpgRect;
begin
r21.Height := r.Height div 2;
r21.Width := r.Width;
r21.Top := r.top;
r21.Left := r.Left;
r22.Height := r.Height div 2;
r22.Width := r.Width;
r22.Top := r.top + r22.Height;
r22.Left := r.Left;
ACanvas.SetColor(clwhite);
ACanvas.FillRectangle(r);
inherited DrawMenuRow(ACanvas, r, AFlags);
if (mifSelected in AFlags) and not (mifSeparator in AFlags) then
begin
ACanvas.GradientFill(r21, clsilver, clwhite, gdVertical);
ACanvas.GradientFill(r22, clwhite, clsilver, gdVertical);
ACanvas.SetColor(cldarkgray);
ACanvas.SetTextColor(clblack);
ACanvas.DrawRectangle(r);
InflateRect(r, -1, -1);
ACanvas.SetColor(cllime);
ACanvas.DrawRectangle(r);
end;
end;
initialization
fpgStyleManager.RegisterClass('Chrome silver flat menu', TExtStyle);
end.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More