diff --git a/LibPortaudio-64.dll b/LibPortaudio-64.dll new file mode 100644 index 0000000..2f2319e Binary files /dev/null and b/LibPortaudio-64.dll differ diff --git a/UOS.zip b/UOS.zip new file mode 100644 index 0000000..2720979 Binary files /dev/null and b/UOS.zip differ diff --git a/UOS/contributors.txt b/UOS/contributors.txt new file mode 100644 index 0000000..7bdf1da --- /dev/null +++ b/UOS/contributors.txt @@ -0,0 +1,33 @@ +Here are the great contributors of uos: + +Andrew Haines : All audio web streaming of uos => he did it. + +BigChimp : He is the one who converts me to oop. He never stops to help people. + +Blaazen : He knows digital audio and explains how it works. He is the Professor Audio, the uos-synthesizer is him. + +Dibo : Shows the best way to calculate time. + +DomingoGP: introduced roundmath() vs round(). + +Franklyn A. Harlow : AAC and CD audio -> he did it. + +KpjComp : He gives the way to link PortAudio with SndFile and shows the best way to pause a thread. + +Leledumbo : Helps me with threads managing and gives courage to continue uos. + +Martin Schreiber : He converts me to change thread-uos_player into class-uos_player. + +Sandro Cumerlato : He gives the DSPLevel procedure and lot of others, did SounTouch wrapper and other perfect codes and ideas. + +José Mejuto : He gives the right way to record and save the data to file. + +Phoenix : He decrypts sf_open_virtual to enable TMemoryStream as input. + +Andrei Borovsky : FFT code of uos_filters is from him. + +Winni: The synthesizer waves type (sine, square, triangle, sawtooth). + +And many others from fpc, fpGUI, MSE, Lazarus, CodeTyphon forum. + +Fred van Stappen : fiens@hotmail.com diff --git a/UOS/credits.txt b/UOS/credits.txt new file mode 100644 index 0000000..8ee2574 --- /dev/null +++ b/UOS/credits.txt @@ -0,0 +1,35 @@ +Here are the open source libraries used by uos: + +=> SoundTouch audio processing library. + Copyright (c) Olli Parviainen. + http://www.surina.net/soundtouch/ + +=> PortAudio Cross-Platform Audio API. + Copyright (c) Ross Bencina and Phil Burk + http://www.portaudio.com/ + +=> SndFile audio processing library. + Copyright (c) Erik de Castro Lopo + http://www.mega-nerd.com/libsndfile/ + +=> Mpg123 audio processing library. + Copyright (c) Thomas Orgis + http://www.mpg123.de/ + +=> Bs2b stereo to binaural library. + Copyright (c) Boris Mikhaylov + http://bs2b.sourceforge.net/ + +=> FAAD2 (AAC) audio processing library. + Copyright (C) M. Bakker, Nero AG. + http://www.nero.com/ + +=> Opus audio processing library. + http://opus-codec.org + +=> Libxmp audio processing library. + https://xmp.sourceforge.net/ + +=> Libfdk-aac audio processing library. + https://github.com/mstorsjo/fdk-aac + diff --git a/UOS/examples/SimplePlayer_MSE.pas b/UOS/examples/SimplePlayer_MSE.pas new file mode 100644 index 0000000..fd79b8b --- /dev/null +++ b/UOS/examples/SimplePlayer_MSE.pas @@ -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. + diff --git a/UOS/examples/SimplePlayer_MSE.prj b/UOS/examples/SimplePlayer_MSE.prj new file mode 100644 index 0000000..4f2f82a --- /dev/null +++ b/UOS/examples/SimplePlayer_MSE.prj @@ -0,0 +1,2211 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos_xmp/examples +projectfilename=/home/fred/uos_xmp/examples/SimplePlayer_MSE.prj +findinfiledialog=70 + [findinfileadialogfo.dir] + filenames=1 + /home/fred/uos_xmp/examples/ + filenamescust=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir=/home/fred/uos_xmp/examples/ + filehistory=0 + filefilterindex=0 + filefilter= + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=0 + [findinfileadialogfo.inprojectdir] + value=1 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=1 + "*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=if FilenameEdit2.FileName <> 'system' then + history=18 + if FilenameEdit2.FileName <> 'system' then + if (FilenameEdit2.FileName <> 'system') and (FilenameEdit2.FileName <> '') then + oadLibrary(PChar(FilenameEdit2.FileN + oadLibrary(PChar(edit2.Text) + TestLoadLibrary(PChar(mainfo.sfdir.Value) + if SF_FileName <> 'system' then + if SF_FileName <> 'system' + if Edit2.Text <> 'system' then + TestLoadLibrary(PChar(mainfo.sfdir + uos_TestLoadLibrary(PChar(lib2)) + uos_TestLoadLibrary(PChar(FilenameEdit2.FileName + uos_TestLoadLibrary(PChar(SF_FileName)) + TestLoadLibrary(PChar(mainfo.sfdir.Value)) + if uos_TestLoadLibrary(PChar(mainfo.sfdir.Value)) + uos_TestLoadLibrary(PChar(mainfo.sfdir.Value)) + f uos_TestLoadLibrary(PChar(edit2.Text)) + uos_LoadLib( + + [findinfileadialogfo] + stackedunder= + x=573 + y=142 + cx=437 + cy=334 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=740 + y=520 + cx=298 + cy=291 +replacedialog=15 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=// + history=2 + // + + [replacedialogfo] + stackedunder= + x=447 + y=253 + cx=389 + cy=216 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=786 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=107 + sortdescend4=0 + width5=95 + sortdescend5=0 + width6=88 + sortdescend6=0 + width7=79 + sortdescend7=0 + width8=40 + sortdescend8=0 + width9=293 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=614 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=100 + sortdescend2=0 + width3=296 + sortdescend3=0 + width4=309 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=19 + [projectoptionsfo.newfile] + firsttab=0 + index=0 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=337 + width0=143 + sortdescend0=0 + width1=326 + sortdescend1=0 + width2=66 + sortdescend2=0 + width3=54 + sortdescend3=0 + width4=62 + sortdescend4=0 + width5=70 + sortdescend5=0 + width6=103 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=200 + xprop=1 + yprop=0.37384898710866 + [projectoptionsfo.macrogrid] + propcolwidthref=559 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=543 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=747 + width0=77 + sortdescend0=0 + width1=741 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=660 + width0=186 + sortdescend0=0 + width1=653 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=0 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=237 + y=195 + cx=837 + cy=606 +settings=8 + [settings_form] + x=492 + y=41 + cx=482 + cy=724 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=SimplePlayer_MSE.pas +targetfile=SimplePlayer_MSE${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=3 + ${MSELIBDIR}kernel/windows + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=6 + -l -Mobjfpc -Sh -Fcutf8 + -ghl -O- + -B + -FUunits + -O2 -XX -CX -Xs + -WC +makeoptpurpose=6 + + + + + + +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=0 +enablepurpose=0 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=1 + SIMPLE_PLAYER +moduletypes=1 + TMAINFO +modulefiles=1 + /home/fred/uos_xmp/examples/mainmse_sp.mfm +befcommandon=0 +makeoptionson=6 + 4095 + 4035 + 4095 + 4095 + 236 + 192 +compilerusedon=29 + 3895 + 0 + 8 + 0 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 4095 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=05:54:09 20/11/22 +project_comment= +aftcommandon=0 +unitdirson=3 + 65728 + 69439 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=28 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=28 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas + /home/fred/uos_xmp/examples/uos.pas +line=28 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 + 12211 +address=28 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 + 0 +addbkpt=28 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=28 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=28 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=/// +findhistory=20 + /// + //// + ///// + ////// + //////// + /////// + ///////// + ////////// + /////////// + //////////// + unloadlib + xmp_play_buffer + fromfile( + SampleFormat + CvFloat32toInt32 + fromfile + format + ratio + ratio + xmp_start_player +findoptions=1 +editpos=66 + 0,132 + 0,334 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,166 + 0,333 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,317 + 0,317 + 0,264 + 0,190 + 0,336 + 0,188 + 0,184 + 0,187 + 0,247 + 0,132 + 0,119 + 0,111 + 0,114 + 0,109 + 0,113 + 0,91 + 0,228 + 0,178 + 0,125 + 0,134 + 0,596 + 0,113 + 0,257 + 0,258 + 0,306 + 0,214 + 79,216 + 0,122 +bookmarks0=0 +bookmarks1=0 +bookmarks2=0 +bookmarks3=0 +bookmarks4=0 +bookmarks5=0 +bookmarks6=0 +bookmarks7=0 +bookmarks8=0 +bookmarks9=0 +bookmarks10=0 +bookmarks11=0 +bookmarks12=0 +bookmarks13=0 +bookmarks14=0 +bookmarks15=0 +bookmarks16=0 +bookmarks17=0 +bookmarks18=0 +bookmarks19=0 +bookmarks20=0 +bookmarks21=0 +bookmarks22=0 +bookmarks23=0 +bookmarks24=0 +bookmarks25=0 +bookmarks26=0 +bookmarks27=0 +bookmarks28=0 +bookmarks29=0 +bookmarks30=0 +bookmarks31=0 +bookmarks32=0 +bookmarks33=0 +bookmarks34=0 +bookmarks35=0 +bookmarks36=0 +bookmarks37=0 +bookmarks38=0 +bookmarks39=0 +bookmarks40=0 +bookmarks41=0 +bookmarks42=0 +bookmarks43=0 +bookmarks44=0 +bookmarks45=0 +bookmarks46=0 +bookmarks47=0 +bookmarks48=0 +bookmarks49=0 +bookmarks50=0 +bookmarks51=0 +bookmarks52=0 +bookmarks53=0 +bookmarks54=0 +bookmarks55=0 +bookmarks56=0 +bookmarks57=0 +bookmarks58=0 +bookmarks59=0 +bookmarks60=0 +bookmarks61=0 +bookmarks62=0 +bookmarks63=0 +bookmarks64=0 +bookmarks65=0 +sourcefiles=66 + ${PROJECTDIR}/SimplePlayer_MSE.pas + ${PROJECTDIR}/mainmse_sp.pas + ${PROJECTDIR}/consolebpmdetect.pas + ${PROJECTDIR}/consoleplay.pas + ${PROJECTDIR}/consoleplayloop.pas + ${PROJECTDIR}/consoleplaymemorybuffer.pas + ${PROJECTDIR}/consoleplaymemorystream.pas + ${PROJECTDIR}/consolespectrum.pas + ${PROJECTDIR}/consolesynth.pas + ${PROJECTDIR}/conswebstream.pas + ${PROJECTDIR}/deviceinfos_fpGUI.pas + ${PROJECTDIR}/filterplayer_fpGUI.pas + ${PROJECTDIR}/formspectrum_unit.pas + ${PROJECTDIR}/main_di.pas + ${PROJECTDIR}/main_fp.pas + ${PROJECTDIR}/main_mi.pas + ${PROJECTDIR}/main_mp.pas + ${PROJECTDIR}/main_mt.pas + ${PROJECTDIR}/main_nr.pas + ${PROJECTDIR}/main_sd.pas + ${PROJECTDIR}/main_sp.pas + ${PROJECTDIR}/main_sp_nf.pas + ${PROJECTDIR}/main_spectrum_mse.pas + ${PROJECTDIR}/main_sr.pas + ${PROJECTDIR}/main_wf.pas + ${PROJECTDIR}/main_wfvrt.pas + ${PROJECTDIR}/main_wsp.pas + ${PROJECTDIR}/morseTL_fpGUI.pas + ${PROJECTDIR}/testfpguistream.pas + ${PROJECTDIR}/noiseremover_fpGUI.pas + ${PROJECTDIR}/simpledrums_fpGUI.pas + ${PROJECTDIR}/simpleplayer_fpGUI.pas + ${PROJECTDIR}/simpleplayer_fpGUI_noflat.pas + ${PROJECTDIR}/simplerecorder_fpGUI.pas + ${PROJECTDIR}/simplewebplayer_fpGUI.pas + ${PROJECTDIR}/simplewebserver_fpGUI.pas + ${PROJECTDIR}/waveform_fpGUI.pas + ${PROJECTDIR}/multiplayer_fpGUI.pas + ${PROJECTDIR}/main_fp.pas + ${PROJECTDIR}/main_mi.pas + ${PROJECTDIR}/main_mp.pas + ${PROJECTDIR}/main_nr.pas + ${PROJECTDIR}/main_sp_nf.pas + ${PROJECTDIR}/main_sr.pas + ${PROJECTDIR}/main_wf.pas + ${PROJECTDIR}/main_wfvrt.pas + ${PROJECTDIR}/main_wsp.pas + ${PROJECTDIR}/consolebpmdetect.pas + ${PROJECTDIR}/consoleplay.pas + ${PROJECTDIR}/consoleplayloop.pas + ${PROJECTDIR}/consoleplaymemorybuffer.pas + ${PROJECTDIR}/consoleplaymemorystream.pas + ${PROJECTDIR}/consolespectrum.pas + ${PROJECTDIR}/conswebstream.pas + ${PROJECTDIR}/formspectrum_unit.pas + ${PROJECTDIR}/main_spectrum_mse.pas + ${PROJECTDIR}/testfpguistream.pas + ${PROJECTDIR}/filterplayer_fpGUI.pas + ${PROJECTDIR}/multiplayer_fpGUI.pas + ${PROJECTDIR}/noiseremover_fpGUI.pas + ${PROJECTDIR}/simpleplayer_fpGUI.pas + ${PROJECTDIR}/simpleplayer_fpGUI_noflat.pas + ${PROJECTDIR}/simplerecorder_fpGUI.pas + ${PROJECTDIR}/simplewebplayer_fpGUI.pas + ${PROJECTDIR}/simplewebserver_fpGUI.pas + ${PROJECTDIR}/simpledrums_fpGUI.pas +relpaths=66 + SimplePlayer_MSE.pas + mainmse_sp.pas + consolebpmdetect.pas + consoleplay.pas + consoleplayloop.pas + consoleplaymemorybuffer.pas + consoleplaymemorystream.pas + consolespectrum.pas + consolesynth.pas + conswebstream.pas + deviceinfos_fpGUI.pas + filterplayer_fpGUI.pas + formspectrum_unit.pas + main_di.pas + main_fp.pas + main_mi.pas + main_mp.pas + main_mt.pas + main_nr.pas + main_sd.pas + main_sp.pas + main_sp_nf.pas + main_spectrum_mse.pas + main_sr.pas + main_wf.pas + main_wfvrt.pas + main_wsp.pas + morseTL_fpGUI.pas + testfpguistream.pas + noiseremover_fpGUI.pas + simpledrums_fpGUI.pas + simpleplayer_fpGUI.pas + simpleplayer_fpGUI_noflat.pas + simplerecorder_fpGUI.pas + simplewebplayer_fpGUI.pas + simplewebserver_fpGUI.pas + waveform_fpGUI.pas + multiplayer_fpGUI.pas + main_fp.pas + main_mi.pas + main_mp.pas + main_nr.pas + main_sp_nf.pas + main_sr.pas + main_wf.pas + main_wfvrt.pas + main_wsp.pas + consolebpmdetect.pas + consoleplay.pas + consoleplayloop.pas + consoleplaymemorybuffer.pas + consoleplaymemorystream.pas + consolespectrum.pas + conswebstream.pas + formspectrum_unit.pas + main_spectrum_mse.pas + testfpguistream.pas + filterplayer_fpGUI.pas + multiplayer_fpGUI.pas + noiseremover_fpGUI.pas + simpleplayer_fpGUI.pas + simpleplayer_fpGUI_noflat.pas + simplerecorder_fpGUI.pas + simplewebplayer_fpGUI.pas + simplewebserver_fpGUI.pas + simpledrums_fpGUI.pas +ismoduletexts=66 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +modules=1 + /home/fred/uos_xmp/examples/mainmse_sp.mfm +moduleoptions=1 + 0 +visiblemodules=1 + -1 +nomenumodules=1 + 0 +[sourcefo.files_tab] +order=66 + 0 + 1 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 16 + 18 + 19 + 65 + 20 + 42 + 43 + 44 + 45 + 46 + 38 + 39 + 40 + 41 + 21 + 22 + 23 + 24 + 25 + 17 + 27 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 26 + 28 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 37 + 11 + 12 + 13 + 14 + 15 +firsttab=15 +index=19 +[layout] +windowlayout=612 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=34 + y=45 + cx=1194 + cy=673 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=3 + not inlined + linux + used + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder=mainfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=370 + y=252 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=conflangfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=27 + width0=141 + sortdescend0=0 + width1=25 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=projecttreefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=468 + width0=112 + sortdescend0=0 + width1=350 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=562 + cx=1181 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=confdebuggerfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1181 + cy=58 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1190 + ncy=63 + x=0 + y=0 + cx=1181 + cy=67 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos_xmp/examples/simplewebserver_fpGUI.pas + history=3 + /home/fred/uos_xmp/examples/simpledrums_fpGUI.pas + /home/fred/ideU/src/main.pas + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1181 + cy=498 + rcx=0 + rcy=0 + [sourcefo.files_tab] + order=66 + 0 + 1 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 16 + 18 + 19 + 65 + 20 + 42 + 43 + 44 + 45 + 46 + 38 + 39 + 40 + 41 + 21 + 22 + 23 + 24 + 25 + 17 + 27 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 26 + 28 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 37 + 11 + 12 + 13 + 14 + 15 + firsttab=15 + index=19 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=61 + cx=1181 + cy=498 + rcx=0 + rcy=0 + [_mse_simple_player_mse_] + splitdir=0 + useroptions=268451963 + stackedunder=findinfilefo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=810 + y=58 + cx=491 + cy=400 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=1 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/consolebpmdetect.lpi b/UOS/examples/consolebpmdetect.lpi new file mode 100644 index 0000000..8c98716 --- /dev/null +++ b/UOS/examples/consolebpmdetect.lpi @@ -0,0 +1,77 @@ + + + + + + + + + + + + + <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> diff --git a/UOS/examples/consolebpmdetect.pas b/UOS/examples/consolebpmdetect.pas new file mode 100644 index 0000000..f479a5a --- /dev/null +++ b/UOS/examples/consolebpmdetect.pas @@ -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. + diff --git a/UOS/examples/consolebpmdetect.prj b/UOS/examples/consolebpmdetect.prj new file mode 100644 index 0000000..8ebbcfd --- /dev/null +++ b/UOS/examples/consolebpmdetect.prj @@ -0,0 +1,2129 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/consolebpmdetect.prj +findinfiledialog=94 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=17 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + + "*.pas" "*.pp" "*.inc" "*.sh" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.prj" + "*.pas" "*.pp" "*.inc" "*.mfm + "*.pas" "*.pp" "*.inc" "*.prj" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/lazarus/ + filecolwidth=150 + x=466 + y=190 + cx=608 + cy=346 + filehistory=20 + /home/fred/lazarus/ + /home/fred/fpc-ootb_322/ + /home/fred/mseide-msegui/ + /home/fred/strumpract/ + /home/fred/bgrabitmap-11.4/ + /home/fred/fpc-ootb_322/installer/ + /home/fred/ideu_po/ + /home/fred/ideu_bin/ + /home/fred/fpc331trunk/ + /home/fred/strumpract/src/ + /home/fred/ideu_github/ + /home/fred/mseuniverse/ + /home/fred/freepascal-ootb_320test/ + /home/fred/biotray/ + /home/fred/A Alphabetical listing of command line options_files/ + /home/fred/svnfpc32/fixes_3_2/ + /home/fred/mseide-msegui-avantcircular/ + /home/fred/CodeTyphonIns700/CodeTyphonIns/ + /home/fred/freepascal-ootb/ + /home/fred/eschecs_mse/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=DEFAULT_PITCH + history=20 + DEFAULT_PITCH + Screen.Fonts + fonts. + Screen + lfFaceName + EnumFontFamilies + screen + customsetLangFilePattern + LangDir + fixrows + messagefontname + usedefaulteditoroptions + editfontname + deflayout + encoding + fontname + backupfilecount + confideufo.encoding + fonts + TMSEFontRenderer + [findinfileadialogfo] + stackedunder= + x=594 + y=247 + cx=346 + cy=308 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=789 + y=197 + cx=298 + cy=269 +replacedialog=33 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=' | ' + history=20 + ' | ' + ] + strz ; + ] + str2 ; + " + " + " + msgid " + lang_stockcaption[ord( + lang_actionsmodule[ord( + )]; + lang_projectoptionscon[Ord( + lang_projectoptions[Ord( + lang_sourceform[ord( + lang_mainform[ord( + lang_modalresultnoshortcut[Ord( + lang_modalresult[Ord( + ]; + lang_settings[Ord( + @es + @pt + [replacedialogfo] + stackedunder= + x=281 + y=237 + cx=389 + cy=200 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=869 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=118 + sortdescend4=0 + width5=93 + sortdescend5=0 + width6=62 + sortdescend6=0 + width7=62 + sortdescend7=0 + width8=90 + sortdescend8=0 + width9=354 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=704 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=337 + sortdescend3=0 + width4=357 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=2 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=550 + width0=98 + sortdescend0=0 + width1=539 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=209 + xprop=1 + yprop=0.39700374531835 + [projectoptionsfo.macrogrid] + propcolwidthref=642 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=626 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=860 + width0=47 + sortdescend0=0 + width1=854 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=779 + width0=112 + sortdescend0=0 + width1=772 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=275 + y=66 + cx=920 + cy=593 +settaborder=15 + [setcreateorderfo.grid] + propcolwidthref=331 + width0=165 + sortdescend0=0 + width1=159 + sortdescend1=0 + [setcreateorderfo] + stackedunder= + x=223 + y=264 + cx=381 + cy=340 + wsize=0 + active=1 + visible=1 +programparameters=18 + [programparametersfo.grid] + propcolwidthref=304 + width0=20 + sortdescend0=0 + width1=103 + sortdescend1=0 + width2=194 + sortdescend2=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [programparametersfo] + stackedunder= + x=388 + y=191 + cx=328 + cy=348 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imageselector=9 + [imageselectorfo] + stackedunder= + x=631 + y=239 + cx=320 + cy=244 + wsize=0 + active=1 + visible=1 +fadeeditor=35 + [fadeeditfo.filedialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [fadeeditfo.splitter] + x=0 + y=180 + xprop=1 + yprop=0.53649635036496 + [fadeeditfo] + x=150 + y=221 + cx=519 + cy=443 + wsize=0 + active=1 + visible=1 +stringlisteditor=5 + [stringlisteditor] + x=177 + y=203 + cx=275 + cy=237 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +colordialog=5 + [colordialogfo] + x=902 + y=152 + cx=338 + cy=298 +compnamedialog=5 + [compnametreefo] + x=527 + y=204 + cx=303 + cy=205 +bmpfiledialog=46 + [filedialog] + filenames=1 + /home/fred/Pictures/imagesideu/ideu64.png + filenamescust=0 + filecolwidth=150 + x=497 + y=203 + cx=608 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=242 + splitterlateral=126 + lastdir=/home/fred/Pictures/imagesideu/ + filehistory=21 + /home/fred/Pictures/imagesideu/ideu64.png + /home/fred/Pictures/imagesideu/beauty.png + /home/fred/ideu/src/ideu24.png + /home/fred/ideu/src/ideu.png + /home/fred/Pictures/tab_but2.png + /home/fred/Pictures/tab_but.png + /home/fred/Pictures/document-openprj.png + /home/fred/Pictures/document-open2.png + /home/fred/Pictures/document-open.png + /home/fred/Pictures/imagesideu/config3_64.png + /home/fred/Pictures/imagesideu/fileopen.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/ideu/src/ideu64.png + /home/fred/Pictures/imagesideu/linenum.png + /home/fred/Pictures/imagesideu/bulbin.png + /home/fred/Pictures/imagesideu/terminal.png + /home/fred/Pictures/imagesideu/searchindir.png + /home/fred/Pictures/imagesideu/save641proj.png + /home/fred/Pictures/imagesideu/switch.png + /home/fred/Pictures/imagesideu/searchinfile.png + /home/fred/Pictures/imagesideu/projectopen.png + filefilterindex=0 + filefilter="*.jpg" "*.jpeg" "*.bmp" "*.ico" "*.png" "*.pnm" "*.pgm" "*.pbm" "*.tga" "*.tif" "*.tiff" "*.xpm" +codetemplateselect=21 + [msetemplateselectfo.grid] + propcolwidthref=528 + width0=60 + sortdescend0=0 + width1=252 + sortdescend1=0 + width2=51 + sortdescend2=0 + width3=51 + sortdescend3=0 + width4=51 + sortdescend4=0 + width5=51 + sortdescend5=0 + sortdescend6=0 + [msetemplateselectfo] + stackedunder= + x=398 + y=233 + cx=569 + cy=277 +codetemplateedit=38 + [templateeditorfo.savefiledialog] + filenames=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/ideu/src/templates/ + filehistory=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filefilterindex=0 + filefilter=*.mct + [templateeditorfo.tsplitter2] + x=109 + y=16 + xprop=0.23678646934461 + yprop=0.112781954887218 + [templateeditorfo.tsplitter1] + x=0 + y=168 + xprop=1 + yprop=0.42857142857143 + [templateeditorfo.paramgrid] + propcolwidthref=343 + width0=100 + sortdescend0=0 + width1=336 + sortdescend1=0 + [templateeditorfo] + stackedunder= + x=147 + y=120 + cx=473 + cy=399 + wsize=0 + active=1 + visible=1 +mainfile=consolebpmdetect.pas +targetfile=consolebpmdetect${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=8 + /usr/lib/gcc/x86_64-linux-gnu/10/32 + /usr/lib/gcc/x86_64-linux-gnu/10 + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/windows + ${MSELIBDIR}kernel/linux + ${MSELIBDIR}kernel/$TARGETOSDIR + ${MSELIBDIR}kernel/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=15 + -Mobjfpc -Sh -Fcutf8 + -dmse_with_zeoslib + -gl + -B + -Xs -CX -XX + -O1 + -WG + -Cg -k-pie -k-znow + -k--gc-sections + -dmorecomponents + -dmse_dynpo + -SIcorba + -FUunits + -vewinhq + -dclass_bridge +makeoptpurpose=15 + Define Object Pascal + Zeos components + Debug infos + Re-build all + Optimizations + Optimizations + Windows application + Make a PIE executable + Garbage collector + Add extended components + Use dynamic loading of po files + Cobra Interface + Output of units + Verbosity + Use Class Briddge +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=4 + ${TEMPLATEDIR}fpc_mse/default/project.pas + ${TEMPLATEDIR}fpc_mse/default/main.pas + ${TEMPLATEDIR}fpc_mse/default/main.mfm + ${TEMPLATEDIR}fpc_mse/default/main_mfm.pas +newprojectfilesdest=4 + ${%PROJECTNAME%}.pas + + + +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}fpc_mse/default/program.pas + ${TEMPLATEDIR}fpc_mse/default/unit.pas + +newfonames=10 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Report + Scriptform + Inherited Form +newfonamebases=10 + form + form + form + module + form + form + form + report + script + form +newfosources=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=1 +copymessages=0 +closemessages=0 +enablepurpose=1 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612724 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=15 + 4095 + 4095 + 17 + 130 + 2046 + 4095 + 192 + 0 + 0 + 0 + 4095 + 4095 + 2047 + 4095 + 0 +compilerusedon=29 + 1591 + 0 + 8 + 256 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2048 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3602 + 1 + 0 + 0 + 0 + 492 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=20:25:05 03/02/2012 +project_comment= +aftcommandon=0 +unitdirson=8 + 983048 + 983095 + 198655 + 196800 + 65536 + 65855 + 198655 + 67583 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=4 + 1 + 1 + 1 + 0 +loadprojectfile=4 + 1 + 1 + 1 + 0 +newinheritedforms=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" + *.mfm + * +showgrid=0 +snaptogrid=0 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=1 +gridsizey=1 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=0 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=Auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=11 + + ${FPCSRCDIR}/ + ${FPCSRCDIR}/*/ + ${FPCSRCDIR}/*/*/ + ${FPCSRCDIR}/*/*/*/ + ${MSELIBDIR}*/ + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}/ + ${MSELIBDIR}kernel/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=4 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8245,6,Pascal Units + c=12 + ( + capt= + file=./ + kind=4 + a=0,8192,6,./ + ) + ( + file=actionsmodule.pas + kind=1 + a=0,8213,2,actionsmodule.pas + c=1 + ( + file=actionsmodule.mfm + kind=0 + a=0,0,0,actionsmodule + ) + ) + ( + file=beauty.pas + kind=1 + a=0,8213,2,beauty.pas + c=1 + ( + file=beauty.mfm + kind=0 + a=0,0,0,beauty + ) + ) + ( + file=commandorform.pas + kind=1 + a=0,8213,2,commandorform.pas + c=1 + ( + file=commandorform.mfm + kind=0 + a=0,0,0,commandorform + ) + ) + ( + file=confideu.pas + kind=1 + a=0,8212,2,confideu.pas + c=1 + ( + file=confideu.mfm + kind=0 + a=0,0,0,confideu + ) + ) + ( + file=define.inc + kind=1 + a=0,8196,0,define.inc + ) + ( + file=ideU.pas + kind=1 + a=0,8196,0,ideU.pas + ) + ( + file=main.pas + kind=1 + a=0,8212,2,main.pas + c=1 + ( + file=main.mfm + kind=0 + a=0,1,0,main + ) + ) + ( + file=projectoptionsform.pas + kind=1 + a=0,8213,2,projectoptionsform.pas + c=1 + ( + file=projectoptionsform.mfm + kind=0 + a=0,0,0,projectoptionsform + ) + ) + ( + file=sak_mse.pas + kind=1 + a=0,8196,0,sak_mse.pas + ) + ( + file=sourceform.pas + kind=1 + a=0,8212,2,sourceform.pas + c=1 + ( + file=sourceform.mfm + kind=0 + a=0,1,0,sourceform + ) + ) + ( + file=sourcepage.pas + kind=1 + a=0,8213,2,sourcepage.pas + c=1 + ( + file=sourcepage.mfm + kind=0 + a=0,0,0,sourcepage + ) + ) + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8245,6,Text Files + c=1 + ( + file=../README.TXT + kind=1 + a=0,8196,0,README.TXT + ) + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=caption +findhistory=20 + caption + ANSI_CHARSET + GetCharSet + EnumFontsNoDups + EnableEvents + DEFAULT_PITCH + defaultfontname + enumfontfamiliesex + fontenumcallback + defaultfontinfo + se_fontname + font name + po_ + po_font + createnewlang + font + conflangfo.sh + conflangfo.ok + setlangi + uses +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/consolebpmdetect.pas +relpaths=1 + consolebpmdetect.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/consolebpmdetect.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/consoleplay.lpi b/UOS/examples/consoleplay.lpi new file mode 100644 index 0000000..cab78a8 --- /dev/null +++ b/UOS/examples/consoleplay.lpi @@ -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> diff --git a/UOS/examples/consoleplay.pas b/UOS/examples/consoleplay.pas new file mode 100644 index 0000000..14e3428 --- /dev/null +++ b/UOS/examples/consoleplay.pas @@ -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. diff --git a/UOS/examples/consoleplay.prj b/UOS/examples/consoleplay.prj new file mode 100644 index 0000000..a77779e --- /dev/null +++ b/UOS/examples/consoleplay.prj @@ -0,0 +1,2142 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/consoleplay.prj +findinfiledialog=94 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=17 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + + "*.pas" "*.pp" "*.inc" "*.sh" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.prj" + "*.pas" "*.pp" "*.inc" "*.mfm + "*.pas" "*.pp" "*.inc" "*.prj" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/mseide-msegui/ + filecolwidth=150 + x=466 + y=190 + cx=608 + cy=346 + filehistory=20 + /home/fred/mseide-msegui/ + /home/fred/lazarus/ + /home/fred/fpc-ootb_322/ + /home/fred/strumpract/ + /home/fred/bgrabitmap-11.4/ + /home/fred/fpc-ootb_322/installer/ + /home/fred/ideu_po/ + /home/fred/ideu_bin/ + /home/fred/fpc331trunk/ + /home/fred/strumpract/src/ + /home/fred/ideu_github/ + /home/fred/mseuniverse/ + /home/fred/freepascal-ootb_320test/ + /home/fred/biotray/ + /home/fred/A Alphabetical listing of command line options_files/ + /home/fred/svnfpc32/fixes_3_2/ + /home/fred/mseide-msegui-avantcircular/ + /home/fred/CodeTyphonIns700/CodeTyphonIns/ + /home/fred/freepascal-ootb/ + /home/fred/eschecs_mse/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=cfloat + history=20 + cfloat + invalid_ + invalid + invalidpoint + invalid pointer + DEFAULT_PITCH + Screen.Fonts + fonts. + Screen + lfFaceName + EnumFontFamilies + screen + customsetLangFilePattern + LangDir + fixrows + messagefontname + usedefaulteditoroptions + editfontname + deflayout + encoding + [findinfileadialogfo] + stackedunder= + x=594 + y=247 + cx=346 + cy=308 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=808 + y=461 + cx=298 + cy=269 +replacedialog=33 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=' | ' + history=20 + ' | ' + ] + strz ; + ] + str2 ; + " + " + " + msgid " + lang_stockcaption[ord( + lang_actionsmodule[ord( + )]; + lang_projectoptionscon[Ord( + lang_projectoptions[Ord( + lang_sourceform[ord( + lang_mainform[ord( + lang_modalresultnoshortcut[Ord( + lang_modalresult[Ord( + ]; + lang_settings[Ord( + @es + @pt + [replacedialogfo] + stackedunder= + x=281 + y=237 + cx=389 + cy=200 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=869 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=118 + sortdescend4=0 + width5=93 + sortdescend5=0 + width6=62 + sortdescend6=0 + width7=62 + sortdescend7=0 + width8=90 + sortdescend8=0 + width9=354 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=704 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=337 + sortdescend3=0 + width4=357 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=2 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=550 + width0=98 + sortdescend0=0 + width1=539 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=209 + xprop=1 + yprop=0.39700374531835 + [projectoptionsfo.macrogrid] + propcolwidthref=642 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=626 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=860 + width0=47 + sortdescend0=0 + width1=854 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=779 + width0=112 + sortdescend0=0 + width1=772 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=275 + y=66 + cx=920 + cy=593 +settaborder=15 + [setcreateorderfo.grid] + propcolwidthref=331 + width0=165 + sortdescend0=0 + width1=159 + sortdescend1=0 + [setcreateorderfo] + stackedunder= + x=223 + y=264 + cx=381 + cy=340 + wsize=0 + active=1 + visible=1 +programparameters=18 + [programparametersfo.grid] + propcolwidthref=304 + width0=20 + sortdescend0=0 + width1=103 + sortdescend1=0 + width2=194 + sortdescend2=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [programparametersfo] + stackedunder= + x=388 + y=191 + cx=328 + cy=348 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imageselector=9 + [imageselectorfo] + stackedunder= + x=631 + y=239 + cx=320 + cy=244 + wsize=0 + active=1 + visible=1 +fadeeditor=35 + [fadeeditfo.filedialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [fadeeditfo.splitter] + x=0 + y=180 + xprop=1 + yprop=0.53649635036496 + [fadeeditfo] + x=150 + y=221 + cx=519 + cy=443 + wsize=0 + active=1 + visible=1 +stringlisteditor=5 + [stringlisteditor] + x=177 + y=203 + cx=275 + cy=237 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +colordialog=5 + [colordialogfo] + x=902 + y=152 + cx=338 + cy=298 +compnamedialog=5 + [compnametreefo] + x=527 + y=204 + cx=303 + cy=205 +bmpfiledialog=46 + [filedialog] + filenames=1 + /home/fred/Pictures/imagesideu/ideu64.png + filenamescust=0 + filecolwidth=150 + x=497 + y=203 + cx=608 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=242 + splitterlateral=126 + lastdir=/home/fred/Pictures/imagesideu/ + filehistory=21 + /home/fred/Pictures/imagesideu/ideu64.png + /home/fred/Pictures/imagesideu/beauty.png + /home/fred/ideu/src/ideu24.png + /home/fred/ideu/src/ideu.png + /home/fred/Pictures/tab_but2.png + /home/fred/Pictures/tab_but.png + /home/fred/Pictures/document-openprj.png + /home/fred/Pictures/document-open2.png + /home/fred/Pictures/document-open.png + /home/fred/Pictures/imagesideu/config3_64.png + /home/fred/Pictures/imagesideu/fileopen.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/ideu/src/ideu64.png + /home/fred/Pictures/imagesideu/linenum.png + /home/fred/Pictures/imagesideu/bulbin.png + /home/fred/Pictures/imagesideu/terminal.png + /home/fred/Pictures/imagesideu/searchindir.png + /home/fred/Pictures/imagesideu/save641proj.png + /home/fred/Pictures/imagesideu/switch.png + /home/fred/Pictures/imagesideu/searchinfile.png + /home/fred/Pictures/imagesideu/projectopen.png + filefilterindex=0 + filefilter="*.jpg" "*.jpeg" "*.bmp" "*.ico" "*.png" "*.pnm" "*.pgm" "*.pbm" "*.tga" "*.tif" "*.tiff" "*.xpm" +codetemplateselect=21 + [msetemplateselectfo.grid] + propcolwidthref=528 + width0=60 + sortdescend0=0 + width1=252 + sortdescend1=0 + width2=51 + sortdescend2=0 + width3=51 + sortdescend3=0 + width4=51 + sortdescend4=0 + width5=51 + sortdescend5=0 + sortdescend6=0 + [msetemplateselectfo] + stackedunder= + x=398 + y=233 + cx=569 + cy=277 +codetemplateedit=38 + [templateeditorfo.savefiledialog] + filenames=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/ideu/src/templates/ + filehistory=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filefilterindex=0 + filefilter=*.mct + [templateeditorfo.tsplitter2] + x=109 + y=16 + xprop=0.23678646934461 + yprop=0.112781954887218 + [templateeditorfo.tsplitter1] + x=0 + y=168 + xprop=1 + yprop=0.42857142857143 + [templateeditorfo.paramgrid] + propcolwidthref=343 + width0=100 + sortdescend0=0 + width1=336 + sortdescend1=0 + [templateeditorfo] + stackedunder= + x=147 + y=120 + cx=473 + cy=399 + wsize=0 + active=1 + visible=1 +mainfile=consoleplay.pas +targetfile=consoleplay${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=8 + /usr/lib/gcc/x86_64-linux-gnu/10/32 + /usr/lib/gcc/x86_64-linux-gnu/10 + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/windows + ${MSELIBDIR}kernel/linux + ${MSELIBDIR}kernel/$TARGETOSDIR + ${MSELIBDIR}kernel/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=15 + -Mobjfpc -Sh -Fcutf8 + -dmse_with_zeoslib + -gl + -B + -Xs -CX -XX + -O1 + -WG + -Cg -k-pie -k-znow + -k--gc-sections + -dmorecomponents + -dmse_dynpo + -SIcorba + -FUunits + -vewinhq + -dclass_bridge +makeoptpurpose=15 + Define Object Pascal + Zeos components + Debug infos + Re-build all + Optimizations + Optimizations + Windows application + Make a PIE executable + Garbage collector + Add extended components + Use dynamic loading of po files + Cobra Interface + Output of units + Verbosity + Use Class Briddge +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=4 + ${TEMPLATEDIR}fpc_mse/default/project.pas + ${TEMPLATEDIR}fpc_mse/default/main.pas + ${TEMPLATEDIR}fpc_mse/default/main.mfm + ${TEMPLATEDIR}fpc_mse/default/main_mfm.pas +newprojectfilesdest=4 + ${%PROJECTNAME%}.pas + + + +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}fpc_mse/default/program.pas + ${TEMPLATEDIR}fpc_mse/default/unit.pas + +newfonames=10 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Report + Scriptform + Inherited Form +newfonamebases=10 + form + form + form + module + form + form + form + report + script + form +newfosources=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=1 +copymessages=0 +closemessages=0 +enablepurpose=1 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612724 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=15 + 4095 + 4091 + 17 + 134 + 2046 + 4095 + 192 + 0 + 0 + 0 + 4091 + 4091 + 2047 + 4095 + 0 +compilerusedon=29 + 1591 + 0 + 8 + 256 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2048 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3602 + 1 + 0 + 0 + 0 + 492 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=20:25:05 03/02/2012 +project_comment= +aftcommandon=0 +unitdirson=8 + 983048 + 983091 + 198651 + 196800 + 65536 + 65851 + 198651 + 67576 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=4 + 1 + 1 + 1 + 0 +loadprojectfile=4 + 1 + 1 + 1 + 0 +newinheritedforms=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" + *.mfm + * +showgrid=0 +snaptogrid=0 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=1 +gridsizey=1 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=0 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=Auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=11 + + ${FPCSRCDIR}/ + ${FPCSRCDIR}/*/ + ${FPCSRCDIR}/*/*/ + ${FPCSRCDIR}/*/*/*/ + ${MSELIBDIR}*/ + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}/ + ${MSELIBDIR}kernel/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=4 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8245,6,Pascal Units + c=12 + ( + capt= + file=./ + kind=4 + a=0,8192,6,./ + ) + ( + file=actionsmodule.pas + kind=1 + a=0,8213,2,actionsmodule.pas + c=1 + ( + file=actionsmodule.mfm + kind=0 + a=0,0,0,actionsmodule + ) + ) + ( + file=beauty.pas + kind=1 + a=0,8213,2,beauty.pas + c=1 + ( + file=beauty.mfm + kind=0 + a=0,0,0,beauty + ) + ) + ( + file=commandorform.pas + kind=1 + a=0,8213,2,commandorform.pas + c=1 + ( + file=commandorform.mfm + kind=0 + a=0,0,0,commandorform + ) + ) + ( + file=confideu.pas + kind=1 + a=0,8212,2,confideu.pas + c=1 + ( + file=confideu.mfm + kind=0 + a=0,0,0,confideu + ) + ) + ( + file=define.inc + kind=1 + a=0,8196,0,define.inc + ) + ( + file=ideU.pas + kind=1 + a=0,8196,0,ideU.pas + ) + ( + file=main.pas + kind=1 + a=0,8212,2,main.pas + c=1 + ( + file=main.mfm + kind=0 + a=0,1,0,main + ) + ) + ( + file=projectoptionsform.pas + kind=1 + a=0,8213,2,projectoptionsform.pas + c=1 + ( + file=projectoptionsform.mfm + kind=0 + a=0,0,0,projectoptionsform + ) + ) + ( + file=sak_mse.pas + kind=1 + a=0,8196,0,sak_mse.pas + ) + ( + file=sourceform.pas + kind=1 + a=0,8212,2,sourceform.pas + c=1 + ( + file=sourceform.mfm + kind=0 + a=0,1,0,sourceform + ) + ) + ( + file=sourcepage.pas + kind=1 + a=0,8213,2,sourcepage.pas + c=1 + ( + file=sourcepage.mfm + kind=0 + a=0,0,0,sourcepage + ) + ) + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8245,6,Text Files + c=1 + ( + file=../README.TXT + kind=1 + a=0,8196,0,README.TXT + ) + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=uos_MemStream2Wavfile +findhistory=20 + samplerate + inline + InputUpdateTag + Data.comment + MPinfo + album + caption + ANSI_CHARSET + GetCharSet + EnumFontsNoDups + EnableEvents + DEFAULT_PITCH + defaultfontname + enumfontfamiliesex + fontenumcallback + defaultfontinfo + se_fontname + font name + po_ + po_font +findoptions=1 +editpos=3 + 0,150 + 0,27 + 0,8144 +bookmarks0=0 +bookmarks1=0 +bookmarks2=0 +sourcefiles=3 + ${PROJECTDIR}/consoleplay.pas + ${PROJECTDIR}/uos_flat.pas + ${PROJECTDIR}/uos.pas +relpaths=3 + consoleplay.pas + uos_flat.pas + uos.pas +ismoduletexts=3 + 0 + 0 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=2 +[layout] +windowlayout=524 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=88 + y=29 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=855 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=1 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=914 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=componentpalettefo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=28 + width0=141 + sortdescend0=0 + width1=26 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=16 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=242 + width0=58 + sortdescend0=0 + width1=178 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1219 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=objectinspectorfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1219 + cy=54 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=60 + x=0 + y=0 + cx=1219 + cy=60 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/uos.pas + history=4 + /home/fred/uos/examples/consoleplay.pas + /home/fred/uos/examples/uos_flat.pas + /home/fred/uos/examples/uos.pas + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1219 + cy=452 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=2 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=projecttreefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=57 + cx=1219 + cy=452 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/consoleplayloop.lpi b/UOS/examples/consoleplayloop.lpi new file mode 100644 index 0000000..20fbd32 --- /dev/null +++ b/UOS/examples/consoleplayloop.lpi @@ -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> diff --git a/UOS/examples/consoleplayloop.pas b/UOS/examples/consoleplayloop.pas new file mode 100644 index 0000000..28ee097 --- /dev/null +++ b/UOS/examples/consoleplayloop.pas @@ -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. diff --git a/UOS/examples/consoleplayloop.prj b/UOS/examples/consoleplayloop.prj new file mode 100644 index 0000000..a4a2cfe --- /dev/null +++ b/UOS/examples/consoleplayloop.prj @@ -0,0 +1,2129 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/consoleplayloop.prj +findinfiledialog=94 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=17 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + + "*.pas" "*.pp" "*.inc" "*.sh" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.prj" + "*.pas" "*.pp" "*.inc" "*.mfm + "*.pas" "*.pp" "*.inc" "*.prj" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/lazarus/ + filecolwidth=150 + x=466 + y=190 + cx=608 + cy=346 + filehistory=20 + /home/fred/lazarus/ + /home/fred/fpc-ootb_322/ + /home/fred/mseide-msegui/ + /home/fred/strumpract/ + /home/fred/bgrabitmap-11.4/ + /home/fred/fpc-ootb_322/installer/ + /home/fred/ideu_po/ + /home/fred/ideu_bin/ + /home/fred/fpc331trunk/ + /home/fred/strumpract/src/ + /home/fred/ideu_github/ + /home/fred/mseuniverse/ + /home/fred/freepascal-ootb_320test/ + /home/fred/biotray/ + /home/fred/A Alphabetical listing of command line options_files/ + /home/fred/svnfpc32/fixes_3_2/ + /home/fred/mseide-msegui-avantcircular/ + /home/fred/CodeTyphonIns700/CodeTyphonIns/ + /home/fred/freepascal-ootb/ + /home/fred/eschecs_mse/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=DEFAULT_PITCH + history=20 + DEFAULT_PITCH + Screen.Fonts + fonts. + Screen + lfFaceName + EnumFontFamilies + screen + customsetLangFilePattern + LangDir + fixrows + messagefontname + usedefaulteditoroptions + editfontname + deflayout + encoding + fontname + backupfilecount + confideufo.encoding + fonts + TMSEFontRenderer + [findinfileadialogfo] + stackedunder= + x=594 + y=247 + cx=346 + cy=308 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=789 + y=197 + cx=298 + cy=269 +replacedialog=33 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=' | ' + history=20 + ' | ' + ] + strz ; + ] + str2 ; + " + " + " + msgid " + lang_stockcaption[ord( + lang_actionsmodule[ord( + )]; + lang_projectoptionscon[Ord( + lang_projectoptions[Ord( + lang_sourceform[ord( + lang_mainform[ord( + lang_modalresultnoshortcut[Ord( + lang_modalresult[Ord( + ]; + lang_settings[Ord( + @es + @pt + [replacedialogfo] + stackedunder= + x=281 + y=237 + cx=389 + cy=200 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=869 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=118 + sortdescend4=0 + width5=93 + sortdescend5=0 + width6=62 + sortdescend6=0 + width7=62 + sortdescend7=0 + width8=90 + sortdescend8=0 + width9=354 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=704 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=337 + sortdescend3=0 + width4=357 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=2 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=550 + width0=98 + sortdescend0=0 + width1=539 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=209 + xprop=1 + yprop=0.39700374531835 + [projectoptionsfo.macrogrid] + propcolwidthref=642 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=626 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=860 + width0=47 + sortdescend0=0 + width1=854 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=779 + width0=112 + sortdescend0=0 + width1=772 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=275 + y=66 + cx=920 + cy=593 +settaborder=15 + [setcreateorderfo.grid] + propcolwidthref=331 + width0=165 + sortdescend0=0 + width1=159 + sortdescend1=0 + [setcreateorderfo] + stackedunder= + x=223 + y=264 + cx=381 + cy=340 + wsize=0 + active=1 + visible=1 +programparameters=18 + [programparametersfo.grid] + propcolwidthref=304 + width0=20 + sortdescend0=0 + width1=103 + sortdescend1=0 + width2=194 + sortdescend2=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [programparametersfo] + stackedunder= + x=388 + y=191 + cx=328 + cy=348 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imageselector=9 + [imageselectorfo] + stackedunder= + x=631 + y=239 + cx=320 + cy=244 + wsize=0 + active=1 + visible=1 +fadeeditor=35 + [fadeeditfo.filedialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [fadeeditfo.splitter] + x=0 + y=180 + xprop=1 + yprop=0.53649635036496 + [fadeeditfo] + x=150 + y=221 + cx=519 + cy=443 + wsize=0 + active=1 + visible=1 +stringlisteditor=5 + [stringlisteditor] + x=177 + y=203 + cx=275 + cy=237 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +colordialog=5 + [colordialogfo] + x=902 + y=152 + cx=338 + cy=298 +compnamedialog=5 + [compnametreefo] + x=527 + y=204 + cx=303 + cy=205 +bmpfiledialog=46 + [filedialog] + filenames=1 + /home/fred/Pictures/imagesideu/ideu64.png + filenamescust=0 + filecolwidth=150 + x=497 + y=203 + cx=608 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=242 + splitterlateral=126 + lastdir=/home/fred/Pictures/imagesideu/ + filehistory=21 + /home/fred/Pictures/imagesideu/ideu64.png + /home/fred/Pictures/imagesideu/beauty.png + /home/fred/ideu/src/ideu24.png + /home/fred/ideu/src/ideu.png + /home/fred/Pictures/tab_but2.png + /home/fred/Pictures/tab_but.png + /home/fred/Pictures/document-openprj.png + /home/fred/Pictures/document-open2.png + /home/fred/Pictures/document-open.png + /home/fred/Pictures/imagesideu/config3_64.png + /home/fred/Pictures/imagesideu/fileopen.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/ideu/src/ideu64.png + /home/fred/Pictures/imagesideu/linenum.png + /home/fred/Pictures/imagesideu/bulbin.png + /home/fred/Pictures/imagesideu/terminal.png + /home/fred/Pictures/imagesideu/searchindir.png + /home/fred/Pictures/imagesideu/save641proj.png + /home/fred/Pictures/imagesideu/switch.png + /home/fred/Pictures/imagesideu/searchinfile.png + /home/fred/Pictures/imagesideu/projectopen.png + filefilterindex=0 + filefilter="*.jpg" "*.jpeg" "*.bmp" "*.ico" "*.png" "*.pnm" "*.pgm" "*.pbm" "*.tga" "*.tif" "*.tiff" "*.xpm" +codetemplateselect=21 + [msetemplateselectfo.grid] + propcolwidthref=528 + width0=60 + sortdescend0=0 + width1=252 + sortdescend1=0 + width2=51 + sortdescend2=0 + width3=51 + sortdescend3=0 + width4=51 + sortdescend4=0 + width5=51 + sortdescend5=0 + sortdescend6=0 + [msetemplateselectfo] + stackedunder= + x=398 + y=233 + cx=569 + cy=277 +codetemplateedit=38 + [templateeditorfo.savefiledialog] + filenames=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/ideu/src/templates/ + filehistory=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filefilterindex=0 + filefilter=*.mct + [templateeditorfo.tsplitter2] + x=109 + y=16 + xprop=0.23678646934461 + yprop=0.112781954887218 + [templateeditorfo.tsplitter1] + x=0 + y=168 + xprop=1 + yprop=0.42857142857143 + [templateeditorfo.paramgrid] + propcolwidthref=343 + width0=100 + sortdescend0=0 + width1=336 + sortdescend1=0 + [templateeditorfo] + stackedunder= + x=147 + y=120 + cx=473 + cy=399 + wsize=0 + active=1 + visible=1 +mainfile=consoleplayloop.pas +targetfile=consoleplayloop${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=8 + /usr/lib/gcc/x86_64-linux-gnu/10/32 + /usr/lib/gcc/x86_64-linux-gnu/10 + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/windows + ${MSELIBDIR}kernel/linux + ${MSELIBDIR}kernel/$TARGETOSDIR + ${MSELIBDIR}kernel/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=15 + -Mobjfpc -Sh -Fcutf8 + -dmse_with_zeoslib + -gl + -B + -Xs -CX -XX + -O1 + -WG + -Cg -k-pie -k-znow + -k--gc-sections + -dmorecomponents + -dmse_dynpo + -SIcorba + -FUunits + -vewinhq + -dclass_bridge +makeoptpurpose=15 + Define Object Pascal + Zeos components + Debug infos + Re-build all + Optimizations + Optimizations + Windows application + Make a PIE executable + Garbage collector + Add extended components + Use dynamic loading of po files + Cobra Interface + Output of units + Verbosity + Use Class Briddge +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=4 + ${TEMPLATEDIR}fpc_mse/default/project.pas + ${TEMPLATEDIR}fpc_mse/default/main.pas + ${TEMPLATEDIR}fpc_mse/default/main.mfm + ${TEMPLATEDIR}fpc_mse/default/main_mfm.pas +newprojectfilesdest=4 + ${%PROJECTNAME%}.pas + + + +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}fpc_mse/default/program.pas + ${TEMPLATEDIR}fpc_mse/default/unit.pas + +newfonames=10 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Report + Scriptform + Inherited Form +newfonamebases=10 + form + form + form + module + form + form + form + report + script + form +newfosources=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=1 +copymessages=0 +closemessages=0 +enablepurpose=1 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612724 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=15 + 4095 + 4095 + 17 + 130 + 2046 + 4095 + 192 + 0 + 0 + 0 + 4095 + 4095 + 2047 + 4095 + 0 +compilerusedon=29 + 1591 + 0 + 8 + 256 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2048 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3602 + 1 + 0 + 0 + 0 + 492 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=20:25:05 03/02/2012 +project_comment= +aftcommandon=0 +unitdirson=8 + 983048 + 983095 + 198655 + 196800 + 65536 + 65855 + 198655 + 67583 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=4 + 1 + 1 + 1 + 0 +loadprojectfile=4 + 1 + 1 + 1 + 0 +newinheritedforms=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" + *.mfm + * +showgrid=0 +snaptogrid=0 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=1 +gridsizey=1 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=0 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=Auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=11 + + ${FPCSRCDIR}/ + ${FPCSRCDIR}/*/ + ${FPCSRCDIR}/*/*/ + ${FPCSRCDIR}/*/*/*/ + ${MSELIBDIR}*/ + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}/ + ${MSELIBDIR}kernel/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=4 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8245,6,Pascal Units + c=12 + ( + capt= + file=./ + kind=4 + a=0,8192,6,./ + ) + ( + file=actionsmodule.pas + kind=1 + a=0,8213,2,actionsmodule.pas + c=1 + ( + file=actionsmodule.mfm + kind=0 + a=0,0,0,actionsmodule + ) + ) + ( + file=beauty.pas + kind=1 + a=0,8213,2,beauty.pas + c=1 + ( + file=beauty.mfm + kind=0 + a=0,0,0,beauty + ) + ) + ( + file=commandorform.pas + kind=1 + a=0,8213,2,commandorform.pas + c=1 + ( + file=commandorform.mfm + kind=0 + a=0,0,0,commandorform + ) + ) + ( + file=confideu.pas + kind=1 + a=0,8212,2,confideu.pas + c=1 + ( + file=confideu.mfm + kind=0 + a=0,0,0,confideu + ) + ) + ( + file=define.inc + kind=1 + a=0,8196,0,define.inc + ) + ( + file=ideU.pas + kind=1 + a=0,8196,0,ideU.pas + ) + ( + file=main.pas + kind=1 + a=0,8212,2,main.pas + c=1 + ( + file=main.mfm + kind=0 + a=0,1,0,main + ) + ) + ( + file=projectoptionsform.pas + kind=1 + a=0,8213,2,projectoptionsform.pas + c=1 + ( + file=projectoptionsform.mfm + kind=0 + a=0,0,0,projectoptionsform + ) + ) + ( + file=sak_mse.pas + kind=1 + a=0,8196,0,sak_mse.pas + ) + ( + file=sourceform.pas + kind=1 + a=0,8212,2,sourceform.pas + c=1 + ( + file=sourceform.mfm + kind=0 + a=0,1,0,sourceform + ) + ) + ( + file=sourcepage.pas + kind=1 + a=0,8213,2,sourcepage.pas + c=1 + ( + file=sourcepage.mfm + kind=0 + a=0,0,0,sourcepage + ) + ) + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8245,6,Text Files + c=1 + ( + file=../README.TXT + kind=1 + a=0,8196,0,README.TXT + ) + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=caption +findhistory=20 + caption + ANSI_CHARSET + GetCharSet + EnumFontsNoDups + EnableEvents + DEFAULT_PITCH + defaultfontname + enumfontfamiliesex + fontenumcallback + defaultfontinfo + se_fontname + font name + po_ + po_font + createnewlang + font + conflangfo.sh + conflangfo.ok + setlangi + uses +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/consoleplayloop.pas +relpaths=1 + consoleplayloop.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/consoleplayloop.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/consoleplaymemorybuffer.lpi b/UOS/examples/consoleplaymemorybuffer.lpi new file mode 100644 index 0000000..dc4a3bf --- /dev/null +++ b/UOS/examples/consoleplaymemorybuffer.lpi @@ -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> diff --git a/UOS/examples/consoleplaymemorybuffer.pas b/UOS/examples/consoleplaymemorybuffer.pas new file mode 100644 index 0000000..ed9f6cd --- /dev/null +++ b/UOS/examples/consoleplaymemorybuffer.pas @@ -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. + diff --git a/UOS/examples/consoleplaymemorybuffer.prj b/UOS/examples/consoleplaymemorybuffer.prj new file mode 100644 index 0000000..c586cad --- /dev/null +++ b/UOS/examples/consoleplaymemorybuffer.prj @@ -0,0 +1,2129 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/consoleplaymemorybuffer.prj +findinfiledialog=94 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=17 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + + "*.pas" "*.pp" "*.inc" "*.sh" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.prj" + "*.pas" "*.pp" "*.inc" "*.mfm + "*.pas" "*.pp" "*.inc" "*.prj" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/lazarus/ + filecolwidth=150 + x=466 + y=190 + cx=608 + cy=346 + filehistory=20 + /home/fred/lazarus/ + /home/fred/fpc-ootb_322/ + /home/fred/mseide-msegui/ + /home/fred/strumpract/ + /home/fred/bgrabitmap-11.4/ + /home/fred/fpc-ootb_322/installer/ + /home/fred/ideu_po/ + /home/fred/ideu_bin/ + /home/fred/fpc331trunk/ + /home/fred/strumpract/src/ + /home/fred/ideu_github/ + /home/fred/mseuniverse/ + /home/fred/freepascal-ootb_320test/ + /home/fred/biotray/ + /home/fred/A Alphabetical listing of command line options_files/ + /home/fred/svnfpc32/fixes_3_2/ + /home/fred/mseide-msegui-avantcircular/ + /home/fred/CodeTyphonIns700/CodeTyphonIns/ + /home/fred/freepascal-ootb/ + /home/fred/eschecs_mse/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=DEFAULT_PITCH + history=20 + DEFAULT_PITCH + Screen.Fonts + fonts. + Screen + lfFaceName + EnumFontFamilies + screen + customsetLangFilePattern + LangDir + fixrows + messagefontname + usedefaulteditoroptions + editfontname + deflayout + encoding + fontname + backupfilecount + confideufo.encoding + fonts + TMSEFontRenderer + [findinfileadialogfo] + stackedunder= + x=594 + y=247 + cx=346 + cy=308 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=789 + y=197 + cx=298 + cy=269 +replacedialog=33 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=' | ' + history=20 + ' | ' + ] + strz ; + ] + str2 ; + " + " + " + msgid " + lang_stockcaption[ord( + lang_actionsmodule[ord( + )]; + lang_projectoptionscon[Ord( + lang_projectoptions[Ord( + lang_sourceform[ord( + lang_mainform[ord( + lang_modalresultnoshortcut[Ord( + lang_modalresult[Ord( + ]; + lang_settings[Ord( + @es + @pt + [replacedialogfo] + stackedunder= + x=281 + y=237 + cx=389 + cy=200 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=869 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=118 + sortdescend4=0 + width5=93 + sortdescend5=0 + width6=62 + sortdescend6=0 + width7=62 + sortdescend7=0 + width8=90 + sortdescend8=0 + width9=354 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=704 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=337 + sortdescend3=0 + width4=357 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=2 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=550 + width0=98 + sortdescend0=0 + width1=539 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=209 + xprop=1 + yprop=0.39700374531835 + [projectoptionsfo.macrogrid] + propcolwidthref=642 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=626 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=860 + width0=47 + sortdescend0=0 + width1=854 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=779 + width0=112 + sortdescend0=0 + width1=772 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=275 + y=66 + cx=920 + cy=593 +settaborder=15 + [setcreateorderfo.grid] + propcolwidthref=331 + width0=165 + sortdescend0=0 + width1=159 + sortdescend1=0 + [setcreateorderfo] + stackedunder= + x=223 + y=264 + cx=381 + cy=340 + wsize=0 + active=1 + visible=1 +programparameters=18 + [programparametersfo.grid] + propcolwidthref=304 + width0=20 + sortdescend0=0 + width1=103 + sortdescend1=0 + width2=194 + sortdescend2=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [programparametersfo] + stackedunder= + x=388 + y=191 + cx=328 + cy=348 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imageselector=9 + [imageselectorfo] + stackedunder= + x=631 + y=239 + cx=320 + cy=244 + wsize=0 + active=1 + visible=1 +fadeeditor=35 + [fadeeditfo.filedialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [fadeeditfo.splitter] + x=0 + y=180 + xprop=1 + yprop=0.53649635036496 + [fadeeditfo] + x=150 + y=221 + cx=519 + cy=443 + wsize=0 + active=1 + visible=1 +stringlisteditor=5 + [stringlisteditor] + x=177 + y=203 + cx=275 + cy=237 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +colordialog=5 + [colordialogfo] + x=902 + y=152 + cx=338 + cy=298 +compnamedialog=5 + [compnametreefo] + x=527 + y=204 + cx=303 + cy=205 +bmpfiledialog=46 + [filedialog] + filenames=1 + /home/fred/Pictures/imagesideu/ideu64.png + filenamescust=0 + filecolwidth=150 + x=497 + y=203 + cx=608 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=242 + splitterlateral=126 + lastdir=/home/fred/Pictures/imagesideu/ + filehistory=21 + /home/fred/Pictures/imagesideu/ideu64.png + /home/fred/Pictures/imagesideu/beauty.png + /home/fred/ideu/src/ideu24.png + /home/fred/ideu/src/ideu.png + /home/fred/Pictures/tab_but2.png + /home/fred/Pictures/tab_but.png + /home/fred/Pictures/document-openprj.png + /home/fred/Pictures/document-open2.png + /home/fred/Pictures/document-open.png + /home/fred/Pictures/imagesideu/config3_64.png + /home/fred/Pictures/imagesideu/fileopen.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/ideu/src/ideu64.png + /home/fred/Pictures/imagesideu/linenum.png + /home/fred/Pictures/imagesideu/bulbin.png + /home/fred/Pictures/imagesideu/terminal.png + /home/fred/Pictures/imagesideu/searchindir.png + /home/fred/Pictures/imagesideu/save641proj.png + /home/fred/Pictures/imagesideu/switch.png + /home/fred/Pictures/imagesideu/searchinfile.png + /home/fred/Pictures/imagesideu/projectopen.png + filefilterindex=0 + filefilter="*.jpg" "*.jpeg" "*.bmp" "*.ico" "*.png" "*.pnm" "*.pgm" "*.pbm" "*.tga" "*.tif" "*.tiff" "*.xpm" +codetemplateselect=21 + [msetemplateselectfo.grid] + propcolwidthref=528 + width0=60 + sortdescend0=0 + width1=252 + sortdescend1=0 + width2=51 + sortdescend2=0 + width3=51 + sortdescend3=0 + width4=51 + sortdescend4=0 + width5=51 + sortdescend5=0 + sortdescend6=0 + [msetemplateselectfo] + stackedunder= + x=398 + y=233 + cx=569 + cy=277 +codetemplateedit=38 + [templateeditorfo.savefiledialog] + filenames=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/ideu/src/templates/ + filehistory=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filefilterindex=0 + filefilter=*.mct + [templateeditorfo.tsplitter2] + x=109 + y=16 + xprop=0.23678646934461 + yprop=0.112781954887218 + [templateeditorfo.tsplitter1] + x=0 + y=168 + xprop=1 + yprop=0.42857142857143 + [templateeditorfo.paramgrid] + propcolwidthref=343 + width0=100 + sortdescend0=0 + width1=336 + sortdescend1=0 + [templateeditorfo] + stackedunder= + x=147 + y=120 + cx=473 + cy=399 + wsize=0 + active=1 + visible=1 +mainfile=consoleplaymemorybuffer.pas +targetfile=consoleplaymemorybuffer${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=8 + /usr/lib/gcc/x86_64-linux-gnu/10/32 + /usr/lib/gcc/x86_64-linux-gnu/10 + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/windows + ${MSELIBDIR}kernel/linux + ${MSELIBDIR}kernel/$TARGETOSDIR + ${MSELIBDIR}kernel/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=15 + -Mobjfpc -Sh -Fcutf8 + -dmse_with_zeoslib + -gl + -B + -Xs -CX -XX + -O1 + -WG + -Cg -k-pie -k-znow + -k--gc-sections + -dmorecomponents + -dmse_dynpo + -SIcorba + -FUunits + -vewinhq + -dclass_bridge +makeoptpurpose=15 + Define Object Pascal + Zeos components + Debug infos + Re-build all + Optimizations + Optimizations + Windows application + Make a PIE executable + Garbage collector + Add extended components + Use dynamic loading of po files + Cobra Interface + Output of units + Verbosity + Use Class Briddge +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=4 + ${TEMPLATEDIR}fpc_mse/default/project.pas + ${TEMPLATEDIR}fpc_mse/default/main.pas + ${TEMPLATEDIR}fpc_mse/default/main.mfm + ${TEMPLATEDIR}fpc_mse/default/main_mfm.pas +newprojectfilesdest=4 + ${%PROJECTNAME%}.pas + + + +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}fpc_mse/default/program.pas + ${TEMPLATEDIR}fpc_mse/default/unit.pas + +newfonames=10 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Report + Scriptform + Inherited Form +newfonamebases=10 + form + form + form + module + form + form + form + report + script + form +newfosources=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=1 +copymessages=0 +closemessages=0 +enablepurpose=1 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612724 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=15 + 4095 + 4095 + 17 + 130 + 2046 + 4095 + 192 + 0 + 0 + 0 + 4095 + 4095 + 2047 + 4095 + 0 +compilerusedon=29 + 1591 + 0 + 8 + 256 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2048 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3602 + 1 + 0 + 0 + 0 + 492 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=20:25:05 03/02/2012 +project_comment= +aftcommandon=0 +unitdirson=8 + 983048 + 983095 + 198655 + 196800 + 65536 + 65855 + 198655 + 67583 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=4 + 1 + 1 + 1 + 0 +loadprojectfile=4 + 1 + 1 + 1 + 0 +newinheritedforms=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" + *.mfm + * +showgrid=0 +snaptogrid=0 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=1 +gridsizey=1 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=0 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=Auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=11 + + ${FPCSRCDIR}/ + ${FPCSRCDIR}/*/ + ${FPCSRCDIR}/*/*/ + ${FPCSRCDIR}/*/*/*/ + ${MSELIBDIR}*/ + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}/ + ${MSELIBDIR}kernel/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=4 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8245,6,Pascal Units + c=12 + ( + capt= + file=./ + kind=4 + a=0,8192,6,./ + ) + ( + file=actionsmodule.pas + kind=1 + a=0,8213,2,actionsmodule.pas + c=1 + ( + file=actionsmodule.mfm + kind=0 + a=0,0,0,actionsmodule + ) + ) + ( + file=beauty.pas + kind=1 + a=0,8213,2,beauty.pas + c=1 + ( + file=beauty.mfm + kind=0 + a=0,0,0,beauty + ) + ) + ( + file=commandorform.pas + kind=1 + a=0,8213,2,commandorform.pas + c=1 + ( + file=commandorform.mfm + kind=0 + a=0,0,0,commandorform + ) + ) + ( + file=confideu.pas + kind=1 + a=0,8212,2,confideu.pas + c=1 + ( + file=confideu.mfm + kind=0 + a=0,0,0,confideu + ) + ) + ( + file=define.inc + kind=1 + a=0,8196,0,define.inc + ) + ( + file=ideU.pas + kind=1 + a=0,8196,0,ideU.pas + ) + ( + file=main.pas + kind=1 + a=0,8212,2,main.pas + c=1 + ( + file=main.mfm + kind=0 + a=0,1,0,main + ) + ) + ( + file=projectoptionsform.pas + kind=1 + a=0,8213,2,projectoptionsform.pas + c=1 + ( + file=projectoptionsform.mfm + kind=0 + a=0,0,0,projectoptionsform + ) + ) + ( + file=sak_mse.pas + kind=1 + a=0,8196,0,sak_mse.pas + ) + ( + file=sourceform.pas + kind=1 + a=0,8212,2,sourceform.pas + c=1 + ( + file=sourceform.mfm + kind=0 + a=0,1,0,sourceform + ) + ) + ( + file=sourcepage.pas + kind=1 + a=0,8213,2,sourcepage.pas + c=1 + ( + file=sourcepage.mfm + kind=0 + a=0,0,0,sourcepage + ) + ) + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8245,6,Text Files + c=1 + ( + file=../README.TXT + kind=1 + a=0,8196,0,README.TXT + ) + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=caption +findhistory=20 + caption + ANSI_CHARSET + GetCharSet + EnumFontsNoDups + EnableEvents + DEFAULT_PITCH + defaultfontname + enumfontfamiliesex + fontenumcallback + defaultfontinfo + se_fontname + font name + po_ + po_font + createnewlang + font + conflangfo.sh + conflangfo.ok + setlangi + uses +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/consoleplaymemorybuffer.pas +relpaths=1 + consoleplaymemorybuffer.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/consoleplaymemorybuffer.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/consoleplaymemorystream.lpi b/UOS/examples/consoleplaymemorystream.lpi new file mode 100644 index 0000000..58f0eb2 --- /dev/null +++ b/UOS/examples/consoleplaymemorystream.lpi @@ -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> diff --git a/UOS/examples/consoleplaymemorystream.pas b/UOS/examples/consoleplaymemorystream.pas new file mode 100644 index 0000000..63e2d49 --- /dev/null +++ b/UOS/examples/consoleplaymemorystream.pas @@ -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. + diff --git a/UOS/examples/consoleplaymemorystream.prj b/UOS/examples/consoleplaymemorystream.prj new file mode 100644 index 0000000..c493dd8 --- /dev/null +++ b/UOS/examples/consoleplaymemorystream.prj @@ -0,0 +1,2130 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/consoleplaymemorystream.prj +findinfiledialog=94 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=17 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + + "*.pas" "*.pp" "*.inc" "*.sh" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.prj" + "*.pas" "*.pp" "*.inc" "*.mfm + "*.pas" "*.pp" "*.inc" "*.prj" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/lazarus/ + filecolwidth=150 + x=466 + y=190 + cx=608 + cy=346 + filehistory=20 + /home/fred/lazarus/ + /home/fred/fpc-ootb_322/ + /home/fred/mseide-msegui/ + /home/fred/strumpract/ + /home/fred/bgrabitmap-11.4/ + /home/fred/fpc-ootb_322/installer/ + /home/fred/ideu_po/ + /home/fred/ideu_bin/ + /home/fred/fpc331trunk/ + /home/fred/strumpract/src/ + /home/fred/ideu_github/ + /home/fred/mseuniverse/ + /home/fred/freepascal-ootb_320test/ + /home/fred/biotray/ + /home/fred/A Alphabetical listing of command line options_files/ + /home/fred/svnfpc32/fixes_3_2/ + /home/fred/mseide-msegui-avantcircular/ + /home/fred/CodeTyphonIns700/CodeTyphonIns/ + /home/fred/freepascal-ootb/ + /home/fred/eschecs_mse/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=DEFAULT_PITCH + history=20 + DEFAULT_PITCH + Screen.Fonts + fonts. + Screen + lfFaceName + EnumFontFamilies + screen + customsetLangFilePattern + LangDir + fixrows + messagefontname + usedefaulteditoroptions + editfontname + deflayout + encoding + fontname + backupfilecount + confideufo.encoding + fonts + TMSEFontRenderer + [findinfileadialogfo] + stackedunder= + x=594 + y=247 + cx=346 + cy=308 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=789 + y=197 + cx=298 + cy=269 +replacedialog=33 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=' | ' + history=20 + ' | ' + ] + strz ; + ] + str2 ; + " + " + " + msgid " + lang_stockcaption[ord( + lang_actionsmodule[ord( + )]; + lang_projectoptionscon[Ord( + lang_projectoptions[Ord( + lang_sourceform[ord( + lang_mainform[ord( + lang_modalresultnoshortcut[Ord( + lang_modalresult[Ord( + ]; + lang_settings[Ord( + @es + @pt + [replacedialogfo] + stackedunder= + x=281 + y=237 + cx=389 + cy=200 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=869 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=118 + sortdescend4=0 + width5=93 + sortdescend5=0 + width6=62 + sortdescend6=0 + width7=62 + sortdescend7=0 + width8=90 + sortdescend8=0 + width9=354 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=704 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=337 + sortdescend3=0 + width4=357 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=2 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=550 + width0=98 + sortdescend0=0 + width1=539 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=209 + xprop=1 + yprop=0.39700374531835 + [projectoptionsfo.macrogrid] + propcolwidthref=642 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=626 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=860 + width0=47 + sortdescend0=0 + width1=854 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=779 + width0=112 + sortdescend0=0 + width1=772 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=275 + y=66 + cx=920 + cy=593 +settaborder=15 + [setcreateorderfo.grid] + propcolwidthref=331 + width0=165 + sortdescend0=0 + width1=159 + sortdescend1=0 + [setcreateorderfo] + stackedunder= + x=223 + y=264 + cx=381 + cy=340 + wsize=0 + active=1 + visible=1 +programparameters=18 + [programparametersfo.grid] + propcolwidthref=304 + width0=20 + sortdescend0=0 + width1=103 + sortdescend1=0 + width2=194 + sortdescend2=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [programparametersfo] + stackedunder= + x=388 + y=191 + cx=328 + cy=348 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imageselector=9 + [imageselectorfo] + stackedunder= + x=631 + y=239 + cx=320 + cy=244 + wsize=0 + active=1 + visible=1 +fadeeditor=35 + [fadeeditfo.filedialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [fadeeditfo.splitter] + x=0 + y=180 + xprop=1 + yprop=0.53649635036496 + [fadeeditfo] + x=150 + y=221 + cx=519 + cy=443 + wsize=0 + active=1 + visible=1 +stringlisteditor=5 + [stringlisteditor] + x=177 + y=203 + cx=275 + cy=237 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +colordialog=5 + [colordialogfo] + x=902 + y=152 + cx=338 + cy=298 +compnamedialog=5 + [compnametreefo] + x=527 + y=204 + cx=303 + cy=205 +bmpfiledialog=46 + [filedialog] + filenames=1 + /home/fred/Pictures/imagesideu/ideu64.png + filenamescust=0 + filecolwidth=150 + x=497 + y=203 + cx=608 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=242 + splitterlateral=126 + lastdir=/home/fred/Pictures/imagesideu/ + filehistory=21 + /home/fred/Pictures/imagesideu/ideu64.png + /home/fred/Pictures/imagesideu/beauty.png + /home/fred/ideu/src/ideu24.png + /home/fred/ideu/src/ideu.png + /home/fred/Pictures/tab_but2.png + /home/fred/Pictures/tab_but.png + /home/fred/Pictures/document-openprj.png + /home/fred/Pictures/document-open2.png + /home/fred/Pictures/document-open.png + /home/fred/Pictures/imagesideu/config3_64.png + /home/fred/Pictures/imagesideu/fileopen.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/ideu/src/ideu64.png + /home/fred/Pictures/imagesideu/linenum.png + /home/fred/Pictures/imagesideu/bulbin.png + /home/fred/Pictures/imagesideu/terminal.png + /home/fred/Pictures/imagesideu/searchindir.png + /home/fred/Pictures/imagesideu/save641proj.png + /home/fred/Pictures/imagesideu/switch.png + /home/fred/Pictures/imagesideu/searchinfile.png + /home/fred/Pictures/imagesideu/projectopen.png + filefilterindex=0 + filefilter="*.jpg" "*.jpeg" "*.bmp" "*.ico" "*.png" "*.pnm" "*.pgm" "*.pbm" "*.tga" "*.tif" "*.tiff" "*.xpm" +codetemplateselect=21 + [msetemplateselectfo.grid] + propcolwidthref=528 + width0=60 + sortdescend0=0 + width1=252 + sortdescend1=0 + width2=51 + sortdescend2=0 + width3=51 + sortdescend3=0 + width4=51 + sortdescend4=0 + width5=51 + sortdescend5=0 + sortdescend6=0 + [msetemplateselectfo] + stackedunder= + x=398 + y=233 + cx=569 + cy=277 +codetemplateedit=38 + [templateeditorfo.savefiledialog] + filenames=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/ideu/src/templates/ + filehistory=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filefilterindex=0 + filefilter=*.mct + [templateeditorfo.tsplitter2] + x=109 + y=16 + xprop=0.23678646934461 + yprop=0.112781954887218 + [templateeditorfo.tsplitter1] + x=0 + y=168 + xprop=1 + yprop=0.42857142857143 + [templateeditorfo.paramgrid] + propcolwidthref=343 + width0=100 + sortdescend0=0 + width1=336 + sortdescend1=0 + [templateeditorfo] + stackedunder= + x=147 + y=120 + cx=473 + cy=399 + wsize=0 + active=1 + visible=1 +mainfile=consoleplaymemorystream.pas +targetfile=consoleplaymemorystream${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=8 + /usr/lib/gcc/x86_64-linux-gnu/10/32 + /usr/lib/gcc/x86_64-linux-gnu/10 + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/windows + ${MSELIBDIR}kernel/linux + ${MSELIBDIR}kernel/$TARGETOSDIR + ${MSELIBDIR}kernel/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=15 + -Mobjfpc -Sh -Fcutf8 + -dmse_with_zeoslib + -gl + -B + -Xs -CX -XX + -O1 + -WG + -Cg -k-pie -k-znow + -k--gc-sections + -dmorecomponents + -dmse_dynpo + -SIcorba + -FUunits + -vewinhq + -dclass_bridge +makeoptpurpose=15 + Define Object Pascal + Zeos components + Debug infos + Re-build all + Optimizations + Optimizations + Windows application + Make a PIE executable + Garbage collector + Add extended components + Use dynamic loading of po files + Cobra Interface + Output of units + Verbosity + Use Class Briddge +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=4 + ${TEMPLATEDIR}fpc_mse/default/project.pas + ${TEMPLATEDIR}fpc_mse/default/main.pas + ${TEMPLATEDIR}fpc_mse/default/main.mfm + ${TEMPLATEDIR}fpc_mse/default/main_mfm.pas +newprojectfilesdest=4 + ${%PROJECTNAME%}.pas + + + +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}fpc_mse/default/program.pas + ${TEMPLATEDIR}fpc_mse/default/unit.pas + +newfonames=10 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Report + Scriptform + Inherited Form +newfonamebases=10 + form + form + form + module + form + form + form + report + script + form +newfosources=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=1 +copymessages=0 +closemessages=0 +enablepurpose=1 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612724 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=15 + 4095 + 4095 + 17 + 130 + 2046 + 4095 + 192 + 0 + 0 + 0 + 4095 + 4095 + 2047 + 4095 + 0 +compilerusedon=29 + 1591 + 0 + 8 + 256 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2048 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3602 + 1 + 0 + 0 + 0 + 492 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=20:25:05 03/02/2012 +project_comment= +aftcommandon=0 +unitdirson=8 + 983048 + 983095 + 198655 + 196800 + 65536 + 65855 + 198655 + 67583 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=4 + 1 + 1 + 1 + 0 +loadprojectfile=4 + 1 + 1 + 1 + 0 +newinheritedforms=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" + *.mfm + * +showgrid=0 +snaptogrid=0 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=1 +gridsizey=1 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=0 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=Auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=11 + + ${FPCSRCDIR}/ + ${FPCSRCDIR}/*/ + ${FPCSRCDIR}/*/*/ + ${FPCSRCDIR}/*/*/*/ + ${MSELIBDIR}*/ + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}/ + ${MSELIBDIR}kernel/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=4 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8245,6,Pascal Units + c=12 + ( + capt= + file=./ + kind=4 + a=0,8192,6,./ + ) + ( + file=actionsmodule.pas + kind=1 + a=0,8213,2,actionsmodule.pas + c=1 + ( + file=actionsmodule.mfm + kind=0 + a=0,0,0,actionsmodule + ) + ) + ( + file=beauty.pas + kind=1 + a=0,8213,2,beauty.pas + c=1 + ( + file=beauty.mfm + kind=0 + a=0,0,0,beauty + ) + ) + ( + file=commandorform.pas + kind=1 + a=0,8213,2,commandorform.pas + c=1 + ( + file=commandorform.mfm + kind=0 + a=0,0,0,commandorform + ) + ) + ( + file=confideu.pas + kind=1 + a=0,8212,2,confideu.pas + c=1 + ( + file=confideu.mfm + kind=0 + a=0,0,0,confideu + ) + ) + ( + file=define.inc + kind=1 + a=0,8196,0,define.inc + ) + ( + file=ideU.pas + kind=1 + a=0,8196,0,ideU.pas + ) + ( + file=main.pas + kind=1 + a=0,8212,2,main.pas + c=1 + ( + file=main.mfm + kind=0 + a=0,1,0,main + ) + ) + ( + file=projectoptionsform.pas + kind=1 + a=0,8213,2,projectoptionsform.pas + c=1 + ( + file=projectoptionsform.mfm + kind=0 + a=0,0,0,projectoptionsform + ) + ) + ( + file=sak_mse.pas + kind=1 + a=0,8196,0,sak_mse.pas + ) + ( + file=sourceform.pas + kind=1 + a=0,8212,2,sourceform.pas + c=1 + ( + file=sourceform.mfm + kind=0 + a=0,1,0,sourceform + ) + ) + ( + file=sourcepage.pas + kind=1 + a=0,8213,2,sourcepage.pas + c=1 + ( + file=sourcepage.mfm + kind=0 + a=0,0,0,sourcepage + ) + ) + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8245,6,Text Files + c=1 + ( + file=../README.TXT + kind=1 + a=0,8196,0,README.TXT + ) + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=caption +findhistory=20 + caption + ANSI_CHARSET + GetCharSet + EnumFontsNoDups + EnableEvents + DEFAULT_PITCH + defaultfontname + enumfontfamiliesex + fontenumcallback + defaultfontinfo + se_fontname + font name + po_ + po_font + createnewlang + font + conflangfo.sh + conflangfo.ok + setlangi + uses +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/consoleplaymemorystream.pas +relpaths=1 + consoleplaymemorystream.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=522 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=conflangfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=projecttreefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=242 + width0=58 + sortdescend0=0 + width1=178 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=54 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1219 + ncy=62 + x=0 + y=0 + cx=1221 + cy=62 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/consoleplaymemorystream.pas + history=2 + /home/fred/uos/examples/consoleplaymemorystream.pas + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=452 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=mainfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=57 + cx=1221 + cy=452 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/consolespectrum.lpi b/UOS/examples/consolespectrum.lpi new file mode 100644 index 0000000..86814fe --- /dev/null +++ b/UOS/examples/consolespectrum.lpi @@ -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> diff --git a/UOS/examples/consolespectrum.pas b/UOS/examples/consolespectrum.pas new file mode 100644 index 0000000..08648eb --- /dev/null +++ b/UOS/examples/consolespectrum.pas @@ -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. diff --git a/UOS/examples/consolespectrum.prj b/UOS/examples/consolespectrum.prj new file mode 100644 index 0000000..6762eba --- /dev/null +++ b/UOS/examples/consolespectrum.prj @@ -0,0 +1,2147 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/consolespectrum.prj +findinfiledialog=94 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=17 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + + "*.pas" "*.pp" "*.inc" "*.sh" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.prj" + "*.pas" "*.pp" "*.inc" "*.mfm + "*.pas" "*.pp" "*.inc" "*.prj" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/strumpract/src/ + filecolwidth=150 + x=466 + y=190 + cx=608 + cy=346 + filehistory=20 + /home/fred/strumpract/src/ + /home/fred/lazarus/ + /home/fred/fpc-ootb_322/ + /home/fred/mseide-msegui/ + /home/fred/strumpract/ + /home/fred/bgrabitmap-11.4/ + /home/fred/fpc-ootb_322/installer/ + /home/fred/ideu_po/ + /home/fred/ideu_bin/ + /home/fred/fpc331trunk/ + /home/fred/ideu_github/ + /home/fred/mseuniverse/ + /home/fred/freepascal-ootb_320test/ + /home/fred/biotray/ + /home/fred/A Alphabetical listing of command line options_files/ + /home/fred/svnfpc32/fixes_3_2/ + /home/fred/mseide-msegui-avantcircular/ + /home/fred/CodeTyphonIns700/CodeTyphonIns/ + /home/fred/freepascal-ootb/ + /home/fred/eschecs_mse/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=uos_InputAddFilter + history=20 + uos_InputAddFilter + DEFAULT_PITCH + Screen.Fonts + fonts. + Screen + lfFaceName + EnumFontFamilies + screen + customsetLangFilePattern + LangDir + fixrows + messagefontname + usedefaulteditoroptions + editfontname + deflayout + encoding + fontname + backupfilecount + confideufo.encoding + fonts + [findinfileadialogfo] + stackedunder= + x=594 + y=247 + cx=346 + cy=308 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=789 + y=197 + cx=298 + cy=269 +replacedialog=33 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=' | ' + history=20 + ' | ' + ] + strz ; + ] + str2 ; + " + " + " + msgid " + lang_stockcaption[ord( + lang_actionsmodule[ord( + )]; + lang_projectoptionscon[Ord( + lang_projectoptions[Ord( + lang_sourceform[ord( + lang_mainform[ord( + lang_modalresultnoshortcut[Ord( + lang_modalresult[Ord( + ]; + lang_settings[Ord( + @es + @pt + [replacedialogfo] + stackedunder= + x=281 + y=237 + cx=389 + cy=200 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=869 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=118 + sortdescend4=0 + width5=93 + sortdescend5=0 + width6=62 + sortdescend6=0 + width7=62 + sortdescend7=0 + width8=90 + sortdescend8=0 + width9=354 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=704 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=337 + sortdescend3=0 + width4=357 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=2 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=550 + width0=98 + sortdescend0=0 + width1=539 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=209 + xprop=1 + yprop=0.39700374531835 + [projectoptionsfo.macrogrid] + propcolwidthref=642 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=626 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=860 + width0=47 + sortdescend0=0 + width1=854 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=779 + width0=112 + sortdescend0=0 + width1=772 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=275 + y=66 + cx=920 + cy=593 +settaborder=15 + [setcreateorderfo.grid] + propcolwidthref=331 + width0=165 + sortdescend0=0 + width1=159 + sortdescend1=0 + [setcreateorderfo] + stackedunder= + x=223 + y=264 + cx=381 + cy=340 + wsize=0 + active=1 + visible=1 +programparameters=18 + [programparametersfo.grid] + propcolwidthref=304 + width0=20 + sortdescend0=0 + width1=103 + sortdescend1=0 + width2=194 + sortdescend2=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [programparametersfo] + stackedunder= + x=388 + y=191 + cx=328 + cy=348 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imageselector=9 + [imageselectorfo] + stackedunder= + x=631 + y=239 + cx=320 + cy=244 + wsize=0 + active=1 + visible=1 +fadeeditor=35 + [fadeeditfo.filedialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [fadeeditfo.splitter] + x=0 + y=180 + xprop=1 + yprop=0.53649635036496 + [fadeeditfo] + x=150 + y=221 + cx=519 + cy=443 + wsize=0 + active=1 + visible=1 +stringlisteditor=5 + [stringlisteditor] + x=177 + y=203 + cx=275 + cy=237 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +colordialog=5 + [colordialogfo] + x=902 + y=152 + cx=338 + cy=298 +compnamedialog=5 + [compnametreefo] + x=527 + y=204 + cx=303 + cy=205 +bmpfiledialog=46 + [filedialog] + filenames=1 + /home/fred/Pictures/imagesideu/ideu64.png + filenamescust=0 + filecolwidth=150 + x=497 + y=203 + cx=608 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=242 + splitterlateral=126 + lastdir=/home/fred/Pictures/imagesideu/ + filehistory=21 + /home/fred/Pictures/imagesideu/ideu64.png + /home/fred/Pictures/imagesideu/beauty.png + /home/fred/ideu/src/ideu24.png + /home/fred/ideu/src/ideu.png + /home/fred/Pictures/tab_but2.png + /home/fred/Pictures/tab_but.png + /home/fred/Pictures/document-openprj.png + /home/fred/Pictures/document-open2.png + /home/fred/Pictures/document-open.png + /home/fred/Pictures/imagesideu/config3_64.png + /home/fred/Pictures/imagesideu/fileopen.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/ideu/src/ideu64.png + /home/fred/Pictures/imagesideu/linenum.png + /home/fred/Pictures/imagesideu/bulbin.png + /home/fred/Pictures/imagesideu/terminal.png + /home/fred/Pictures/imagesideu/searchindir.png + /home/fred/Pictures/imagesideu/save641proj.png + /home/fred/Pictures/imagesideu/switch.png + /home/fred/Pictures/imagesideu/searchinfile.png + /home/fred/Pictures/imagesideu/projectopen.png + filefilterindex=0 + filefilter="*.jpg" "*.jpeg" "*.bmp" "*.ico" "*.png" "*.pnm" "*.pgm" "*.pbm" "*.tga" "*.tif" "*.tiff" "*.xpm" +codetemplateselect=21 + [msetemplateselectfo.grid] + propcolwidthref=528 + width0=60 + sortdescend0=0 + width1=252 + sortdescend1=0 + width2=51 + sortdescend2=0 + width3=51 + sortdescend3=0 + width4=51 + sortdescend4=0 + width5=51 + sortdescend5=0 + sortdescend6=0 + [msetemplateselectfo] + stackedunder= + x=398 + y=233 + cx=569 + cy=277 +codetemplateedit=38 + [templateeditorfo.savefiledialog] + filenames=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/ideu/src/templates/ + filehistory=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filefilterindex=0 + filefilter=*.mct + [templateeditorfo.tsplitter2] + x=109 + y=16 + xprop=0.23678646934461 + yprop=0.112781954887218 + [templateeditorfo.tsplitter1] + x=0 + y=168 + xprop=1 + yprop=0.42857142857143 + [templateeditorfo.paramgrid] + propcolwidthref=343 + width0=100 + sortdescend0=0 + width1=336 + sortdescend1=0 + [templateeditorfo] + stackedunder= + x=147 + y=120 + cx=473 + cy=399 + wsize=0 + active=1 + visible=1 +mainfile=consolespectrum.pas +targetfile=consolespectrum${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=8 + /usr/lib/gcc/x86_64-linux-gnu/10/32 + /usr/lib/gcc/x86_64-linux-gnu/10 + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/windows + ${MSELIBDIR}kernel/linux + ${MSELIBDIR}kernel/$TARGETOSDIR + ${MSELIBDIR}kernel/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=14 + -Mobjfpc -Sh -Fcutf8 + -dmse_with_zeoslib + -gl + -B + -Xs -CX -XX + -O1 + -WG + -Cg -k-pie -k-znow + -k--gc-sections + -dmorecomponents + -SIcorba + -FUunits + -vewinhq + -dclass_bridge +makeoptpurpose=14 + Define Object Pascal + Zeos components + Debug infos + Re-build all + Optimizations + Optimizations + Windows application + Make a PIE executable + Garbage collector + Add extended components + Cobra Interface + Output of units + Verbosity + Use Class Briddge +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=4 + ${TEMPLATEDIR}fpc_mse/default/project.pas + ${TEMPLATEDIR}fpc_mse/default/main.pas + ${TEMPLATEDIR}fpc_mse/default/main.mfm + ${TEMPLATEDIR}fpc_mse/default/main_mfm.pas +newprojectfilesdest=4 + ${%PROJECTNAME%}.pas + + + +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}fpc_mse/default/program.pas + ${TEMPLATEDIR}fpc_mse/default/unit.pas + +newfonames=10 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Report + Scriptform + Inherited Form +newfonamebases=10 + form + form + form + module + form + form + form + report + script + form +newfosources=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=1 +copymessages=0 +closemessages=0 +enablepurpose=1 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612724 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=14 + 4095 + 4095 + 17 + 130 + 2046 + 4095 + 192 + 0 + 0 + 0 + 4095 + 2047 + 4095 + 0 +compilerusedon=29 + 1591 + 0 + 8 + 256 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2048 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3602 + 1 + 0 + 0 + 0 + 492 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=20:25:05 03/02/2012 +project_comment= +aftcommandon=0 +unitdirson=8 + 983048 + 983095 + 198655 + 196800 + 65536 + 65855 + 198655 + 67583 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=4 + 1 + 1 + 1 + 0 +loadprojectfile=4 + 1 + 1 + 1 + 0 +newinheritedforms=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" + *.mfm + * +showgrid=0 +snaptogrid=0 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=1 +gridsizey=1 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=0 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=Auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=11 + + ${FPCSRCDIR}/ + ${FPCSRCDIR}/*/ + ${FPCSRCDIR}/*/*/ + ${FPCSRCDIR}/*/*/*/ + ${MSELIBDIR}*/ + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}/ + ${MSELIBDIR}kernel/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=4 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8245,6,Pascal Units + c=12 + ( + capt= + file=./ + kind=4 + a=0,8192,6,./ + ) + ( + file=actionsmodule.pas + kind=1 + a=0,8213,2,actionsmodule.pas + c=1 + ( + file=actionsmodule.mfm + kind=0 + a=0,0,0,actionsmodule + ) + ) + ( + file=beauty.pas + kind=1 + a=0,8213,2,beauty.pas + c=1 + ( + file=beauty.mfm + kind=0 + a=0,0,0,beauty + ) + ) + ( + file=commandorform.pas + kind=1 + a=0,8213,2,commandorform.pas + c=1 + ( + file=commandorform.mfm + kind=0 + a=0,0,0,commandorform + ) + ) + ( + file=confideu.pas + kind=1 + a=0,8212,2,confideu.pas + c=1 + ( + file=confideu.mfm + kind=0 + a=0,0,0,confideu + ) + ) + ( + file=define.inc + kind=1 + a=0,8196,0,define.inc + ) + ( + file=ideU.pas + kind=1 + a=0,8196,0,ideU.pas + ) + ( + file=main.pas + kind=1 + a=0,8212,2,main.pas + c=1 + ( + file=main.mfm + kind=0 + a=0,1,0,main + ) + ) + ( + file=projectoptionsform.pas + kind=1 + a=0,8213,2,projectoptionsform.pas + c=1 + ( + file=projectoptionsform.mfm + kind=0 + a=0,0,0,projectoptionsform + ) + ) + ( + file=sak_mse.pas + kind=1 + a=0,8196,0,sak_mse.pas + ) + ( + file=sourceform.pas + kind=1 + a=0,8212,2,sourceform.pas + c=1 + ( + file=sourceform.mfm + kind=0 + a=0,1,0,sourceform + ) + ) + ( + file=sourcepage.pas + kind=1 + a=0,8213,2,sourcepage.pas + c=1 + ( + file=sourcepage.mfm + kind=0 + a=0,0,0,sourcepage + ) + ) + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8245,6,Text Files + c=1 + ( + file=../README.TXT + kind=1 + a=0,8196,0,README.TXT + ) + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=uos_InputAddFilter +findhistory=20 + uos_InputAddFilter + caption + ANSI_CHARSET + GetCharSet + EnumFontsNoDups + EnableEvents + DEFAULT_PITCH + defaultfontname + enumfontfamiliesex + fontenumcallback + defaultfontinfo + se_fontname + font name + po_ + po_font + createnewlang + font + conflangfo.sh + conflangfo.ok + setlangi +findoptions=1 +editpos=5 + 0,173 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 4,133 +bookmarks0=0 +bookmarks1=0 +bookmarks2=0 +bookmarks3=0 +bookmarks4=0 +sourcefiles=5 + ${PROJECTDIR}/consolespectrum.pas + /home/fred/strumpract/src/recorder.pas + /home/fred/strumpract/src/recorder.mfm + ${PROJECTDIR}/main_spectrum_mse.pas + ${PROJECTDIR}/formspectrum_unit.pas +relpaths=5 + consolespectrum.pas + strumpract/src/recorder.pas + strumpract/src/recorder.mfm + main_spectrum_mse.pas + formspectrum_unit.pas +ismoduletexts=5 + 0 + 0 + -1 + 0 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=522 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=conflangfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=28 + width0=141 + sortdescend0=0 + width1=26 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=16 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=projecttreefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=242 + width0=58 + sortdescend0=0 + width1=178 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1219 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1219 + cy=56 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1219 + cy=64 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/consolespectrum.pas + history=2 + /home/fred/uos/examples/formspectrum_unit.pas + /home/fred/uos/examples/main_spectrum_mse.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1219 + cy=450 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=objectinspectorfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=59 + cx=1219 + cy=450 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/consolesynth.lpi b/UOS/examples/consolesynth.lpi new file mode 100644 index 0000000..0d25618 --- /dev/null +++ b/UOS/examples/consolesynth.lpi @@ -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> diff --git a/UOS/examples/consolesynth.pas b/UOS/examples/consolesynth.pas new file mode 100644 index 0000000..478429d --- /dev/null +++ b/UOS/examples/consolesynth.pas @@ -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. + diff --git a/UOS/examples/consolesynth.prj b/UOS/examples/consolesynth.prj new file mode 100644 index 0000000..7ae06e7 --- /dev/null +++ b/UOS/examples/consolesynth.prj @@ -0,0 +1,2129 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/consolesynth.prj +findinfiledialog=94 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=17 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + + "*.pas" "*.pp" "*.inc" "*.sh" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.prj" + "*.pas" "*.pp" "*.inc" "*.mfm + "*.pas" "*.pp" "*.inc" "*.prj" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/lazarus/ + filecolwidth=150 + x=466 + y=190 + cx=608 + cy=346 + filehistory=20 + /home/fred/lazarus/ + /home/fred/fpc-ootb_322/ + /home/fred/mseide-msegui/ + /home/fred/strumpract/ + /home/fred/bgrabitmap-11.4/ + /home/fred/fpc-ootb_322/installer/ + /home/fred/ideu_po/ + /home/fred/ideu_bin/ + /home/fred/fpc331trunk/ + /home/fred/strumpract/src/ + /home/fred/ideu_github/ + /home/fred/mseuniverse/ + /home/fred/freepascal-ootb_320test/ + /home/fred/biotray/ + /home/fred/A Alphabetical listing of command line options_files/ + /home/fred/svnfpc32/fixes_3_2/ + /home/fred/mseide-msegui-avantcircular/ + /home/fred/CodeTyphonIns700/CodeTyphonIns/ + /home/fred/freepascal-ootb/ + /home/fred/eschecs_mse/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=DEFAULT_PITCH + history=20 + DEFAULT_PITCH + Screen.Fonts + fonts. + Screen + lfFaceName + EnumFontFamilies + screen + customsetLangFilePattern + LangDir + fixrows + messagefontname + usedefaulteditoroptions + editfontname + deflayout + encoding + fontname + backupfilecount + confideufo.encoding + fonts + TMSEFontRenderer + [findinfileadialogfo] + stackedunder= + x=594 + y=247 + cx=346 + cy=308 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=789 + y=197 + cx=298 + cy=269 +replacedialog=33 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=' | ' + history=20 + ' | ' + ] + strz ; + ] + str2 ; + " + " + " + msgid " + lang_stockcaption[ord( + lang_actionsmodule[ord( + )]; + lang_projectoptionscon[Ord( + lang_projectoptions[Ord( + lang_sourceform[ord( + lang_mainform[ord( + lang_modalresultnoshortcut[Ord( + lang_modalresult[Ord( + ]; + lang_settings[Ord( + @es + @pt + [replacedialogfo] + stackedunder= + x=281 + y=237 + cx=389 + cy=200 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=869 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=118 + sortdescend4=0 + width5=93 + sortdescend5=0 + width6=62 + sortdescend6=0 + width7=62 + sortdescend7=0 + width8=90 + sortdescend8=0 + width9=354 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=704 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=337 + sortdescend3=0 + width4=357 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=2 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=550 + width0=98 + sortdescend0=0 + width1=539 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=209 + xprop=1 + yprop=0.39700374531835 + [projectoptionsfo.macrogrid] + propcolwidthref=642 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=626 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=860 + width0=47 + sortdescend0=0 + width1=854 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=779 + width0=112 + sortdescend0=0 + width1=772 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=275 + y=66 + cx=920 + cy=593 +settaborder=15 + [setcreateorderfo.grid] + propcolwidthref=331 + width0=165 + sortdescend0=0 + width1=159 + sortdescend1=0 + [setcreateorderfo] + stackedunder= + x=223 + y=264 + cx=381 + cy=340 + wsize=0 + active=1 + visible=1 +programparameters=18 + [programparametersfo.grid] + propcolwidthref=304 + width0=20 + sortdescend0=0 + width1=103 + sortdescend1=0 + width2=194 + sortdescend2=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [programparametersfo] + stackedunder= + x=388 + y=191 + cx=328 + cy=348 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imageselector=9 + [imageselectorfo] + stackedunder= + x=631 + y=239 + cx=320 + cy=244 + wsize=0 + active=1 + visible=1 +fadeeditor=35 + [fadeeditfo.filedialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [fadeeditfo.splitter] + x=0 + y=180 + xprop=1 + yprop=0.53649635036496 + [fadeeditfo] + x=150 + y=221 + cx=519 + cy=443 + wsize=0 + active=1 + visible=1 +stringlisteditor=5 + [stringlisteditor] + x=177 + y=203 + cx=275 + cy=237 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +colordialog=5 + [colordialogfo] + x=902 + y=152 + cx=338 + cy=298 +compnamedialog=5 + [compnametreefo] + x=527 + y=204 + cx=303 + cy=205 +bmpfiledialog=46 + [filedialog] + filenames=1 + /home/fred/Pictures/imagesideu/ideu64.png + filenamescust=0 + filecolwidth=150 + x=497 + y=203 + cx=608 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=242 + splitterlateral=126 + lastdir=/home/fred/Pictures/imagesideu/ + filehistory=21 + /home/fred/Pictures/imagesideu/ideu64.png + /home/fred/Pictures/imagesideu/beauty.png + /home/fred/ideu/src/ideu24.png + /home/fred/ideu/src/ideu.png + /home/fred/Pictures/tab_but2.png + /home/fred/Pictures/tab_but.png + /home/fred/Pictures/document-openprj.png + /home/fred/Pictures/document-open2.png + /home/fred/Pictures/document-open.png + /home/fred/Pictures/imagesideu/config3_64.png + /home/fred/Pictures/imagesideu/fileopen.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/ideu/src/ideu64.png + /home/fred/Pictures/imagesideu/linenum.png + /home/fred/Pictures/imagesideu/bulbin.png + /home/fred/Pictures/imagesideu/terminal.png + /home/fred/Pictures/imagesideu/searchindir.png + /home/fred/Pictures/imagesideu/save641proj.png + /home/fred/Pictures/imagesideu/switch.png + /home/fred/Pictures/imagesideu/searchinfile.png + /home/fred/Pictures/imagesideu/projectopen.png + filefilterindex=0 + filefilter="*.jpg" "*.jpeg" "*.bmp" "*.ico" "*.png" "*.pnm" "*.pgm" "*.pbm" "*.tga" "*.tif" "*.tiff" "*.xpm" +codetemplateselect=21 + [msetemplateselectfo.grid] + propcolwidthref=528 + width0=60 + sortdescend0=0 + width1=252 + sortdescend1=0 + width2=51 + sortdescend2=0 + width3=51 + sortdescend3=0 + width4=51 + sortdescend4=0 + width5=51 + sortdescend5=0 + sortdescend6=0 + [msetemplateselectfo] + stackedunder= + x=398 + y=233 + cx=569 + cy=277 +codetemplateedit=38 + [templateeditorfo.savefiledialog] + filenames=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/ideu/src/templates/ + filehistory=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filefilterindex=0 + filefilter=*.mct + [templateeditorfo.tsplitter2] + x=109 + y=16 + xprop=0.23678646934461 + yprop=0.112781954887218 + [templateeditorfo.tsplitter1] + x=0 + y=168 + xprop=1 + yprop=0.42857142857143 + [templateeditorfo.paramgrid] + propcolwidthref=343 + width0=100 + sortdescend0=0 + width1=336 + sortdescend1=0 + [templateeditorfo] + stackedunder= + x=147 + y=120 + cx=473 + cy=399 + wsize=0 + active=1 + visible=1 +mainfile=consolesynth.pas +targetfile=consolesynth${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=8 + /usr/lib/gcc/x86_64-linux-gnu/10/32 + /usr/lib/gcc/x86_64-linux-gnu/10 + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/windows + ${MSELIBDIR}kernel/linux + ${MSELIBDIR}kernel/$TARGETOSDIR + ${MSELIBDIR}kernel/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=15 + -Mobjfpc -Sh -Fcutf8 + -dmse_with_zeoslib + -gl + -B + -Xs -CX -XX + -O1 + -WG + -Cg -k-pie -k-znow + -k--gc-sections + -dmorecomponents + -dmse_dynpo + -SIcorba + -FUunits + -vewinhq + -dclass_bridge +makeoptpurpose=15 + Define Object Pascal + Zeos components + Debug infos + Re-build all + Optimizations + Optimizations + Windows application + Make a PIE executable + Garbage collector + Add extended components + Use dynamic loading of po files + Cobra Interface + Output of units + Verbosity + Use Class Briddge +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=4 + ${TEMPLATEDIR}fpc_mse/default/project.pas + ${TEMPLATEDIR}fpc_mse/default/main.pas + ${TEMPLATEDIR}fpc_mse/default/main.mfm + ${TEMPLATEDIR}fpc_mse/default/main_mfm.pas +newprojectfilesdest=4 + ${%PROJECTNAME%}.pas + + + +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}fpc_mse/default/program.pas + ${TEMPLATEDIR}fpc_mse/default/unit.pas + +newfonames=10 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Report + Scriptform + Inherited Form +newfonamebases=10 + form + form + form + module + form + form + form + report + script + form +newfosources=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=1 +copymessages=0 +closemessages=0 +enablepurpose=1 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612724 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=15 + 4095 + 4095 + 17 + 130 + 2046 + 4095 + 192 + 0 + 0 + 0 + 4095 + 4095 + 2047 + 4095 + 0 +compilerusedon=29 + 1591 + 0 + 8 + 256 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2048 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3602 + 1 + 0 + 0 + 0 + 492 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=20:25:05 03/02/2012 +project_comment= +aftcommandon=0 +unitdirson=8 + 983048 + 983095 + 198655 + 196800 + 65536 + 65855 + 198655 + 67583 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=4 + 1 + 1 + 1 + 0 +loadprojectfile=4 + 1 + 1 + 1 + 0 +newinheritedforms=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" + *.mfm + * +showgrid=0 +snaptogrid=0 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=1 +gridsizey=1 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=0 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=Auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=11 + + ${FPCSRCDIR}/ + ${FPCSRCDIR}/*/ + ${FPCSRCDIR}/*/*/ + ${FPCSRCDIR}/*/*/*/ + ${MSELIBDIR}*/ + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}/ + ${MSELIBDIR}kernel/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=4 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8245,6,Pascal Units + c=12 + ( + capt= + file=./ + kind=4 + a=0,8192,6,./ + ) + ( + file=actionsmodule.pas + kind=1 + a=0,8213,2,actionsmodule.pas + c=1 + ( + file=actionsmodule.mfm + kind=0 + a=0,0,0,actionsmodule + ) + ) + ( + file=beauty.pas + kind=1 + a=0,8213,2,beauty.pas + c=1 + ( + file=beauty.mfm + kind=0 + a=0,0,0,beauty + ) + ) + ( + file=commandorform.pas + kind=1 + a=0,8213,2,commandorform.pas + c=1 + ( + file=commandorform.mfm + kind=0 + a=0,0,0,commandorform + ) + ) + ( + file=confideu.pas + kind=1 + a=0,8212,2,confideu.pas + c=1 + ( + file=confideu.mfm + kind=0 + a=0,0,0,confideu + ) + ) + ( + file=define.inc + kind=1 + a=0,8196,0,define.inc + ) + ( + file=ideU.pas + kind=1 + a=0,8196,0,ideU.pas + ) + ( + file=main.pas + kind=1 + a=0,8212,2,main.pas + c=1 + ( + file=main.mfm + kind=0 + a=0,1,0,main + ) + ) + ( + file=projectoptionsform.pas + kind=1 + a=0,8213,2,projectoptionsform.pas + c=1 + ( + file=projectoptionsform.mfm + kind=0 + a=0,0,0,projectoptionsform + ) + ) + ( + file=sak_mse.pas + kind=1 + a=0,8196,0,sak_mse.pas + ) + ( + file=sourceform.pas + kind=1 + a=0,8212,2,sourceform.pas + c=1 + ( + file=sourceform.mfm + kind=0 + a=0,1,0,sourceform + ) + ) + ( + file=sourcepage.pas + kind=1 + a=0,8213,2,sourcepage.pas + c=1 + ( + file=sourcepage.mfm + kind=0 + a=0,0,0,sourcepage + ) + ) + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8245,6,Text Files + c=1 + ( + file=../README.TXT + kind=1 + a=0,8196,0,README.TXT + ) + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=caption +findhistory=20 + caption + ANSI_CHARSET + GetCharSet + EnumFontsNoDups + EnableEvents + DEFAULT_PITCH + defaultfontname + enumfontfamiliesex + fontenumcallback + defaultfontinfo + se_fontname + font name + po_ + po_font + createnewlang + font + conflangfo.sh + conflangfo.ok + setlangi + uses +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/consolesynth.pas +relpaths=1 + consolesynth.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/consolesynth.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/conswebstream.lpi b/UOS/examples/conswebstream.lpi new file mode 100644 index 0000000..48a5ae2 --- /dev/null +++ b/UOS/examples/conswebstream.lpi @@ -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> diff --git a/UOS/examples/conswebstream.pas b/UOS/examples/conswebstream.pas new file mode 100644 index 0000000..953f38d --- /dev/null +++ b/UOS/examples/conswebstream.pas @@ -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. + diff --git a/UOS/examples/conswebstream.prj b/UOS/examples/conswebstream.prj new file mode 100644 index 0000000..2c4fbb3 --- /dev/null +++ b/UOS/examples/conswebstream.prj @@ -0,0 +1,2129 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/conswebstream.prj +findinfiledialog=94 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=17 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + + "*.pas" "*.pp" "*.inc" "*.sh" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.prj" + "*.pas" "*.pp" "*.inc" "*.mfm + "*.pas" "*.pp" "*.inc" "*.prj" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/lazarus/ + filecolwidth=150 + x=466 + y=190 + cx=608 + cy=346 + filehistory=20 + /home/fred/lazarus/ + /home/fred/fpc-ootb_322/ + /home/fred/mseide-msegui/ + /home/fred/strumpract/ + /home/fred/bgrabitmap-11.4/ + /home/fred/fpc-ootb_322/installer/ + /home/fred/ideu_po/ + /home/fred/ideu_bin/ + /home/fred/fpc331trunk/ + /home/fred/strumpract/src/ + /home/fred/ideu_github/ + /home/fred/mseuniverse/ + /home/fred/freepascal-ootb_320test/ + /home/fred/biotray/ + /home/fred/A Alphabetical listing of command line options_files/ + /home/fred/svnfpc32/fixes_3_2/ + /home/fred/mseide-msegui-avantcircular/ + /home/fred/CodeTyphonIns700/CodeTyphonIns/ + /home/fred/freepascal-ootb/ + /home/fred/eschecs_mse/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=DEFAULT_PITCH + history=20 + DEFAULT_PITCH + Screen.Fonts + fonts. + Screen + lfFaceName + EnumFontFamilies + screen + customsetLangFilePattern + LangDir + fixrows + messagefontname + usedefaulteditoroptions + editfontname + deflayout + encoding + fontname + backupfilecount + confideufo.encoding + fonts + TMSEFontRenderer + [findinfileadialogfo] + stackedunder= + x=594 + y=247 + cx=346 + cy=308 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=789 + y=197 + cx=298 + cy=269 +replacedialog=33 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=' | ' + history=20 + ' | ' + ] + strz ; + ] + str2 ; + " + " + " + msgid " + lang_stockcaption[ord( + lang_actionsmodule[ord( + )]; + lang_projectoptionscon[Ord( + lang_projectoptions[Ord( + lang_sourceform[ord( + lang_mainform[ord( + lang_modalresultnoshortcut[Ord( + lang_modalresult[Ord( + ]; + lang_settings[Ord( + @es + @pt + [replacedialogfo] + stackedunder= + x=281 + y=237 + cx=389 + cy=200 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=869 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=118 + sortdescend4=0 + width5=93 + sortdescend5=0 + width6=62 + sortdescend6=0 + width7=62 + sortdescend7=0 + width8=90 + sortdescend8=0 + width9=354 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=704 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=337 + sortdescend3=0 + width4=357 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=2 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=550 + width0=98 + sortdescend0=0 + width1=539 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=209 + xprop=1 + yprop=0.39700374531835 + [projectoptionsfo.macrogrid] + propcolwidthref=642 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=626 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=860 + width0=47 + sortdescend0=0 + width1=854 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=779 + width0=112 + sortdescend0=0 + width1=772 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=275 + y=66 + cx=920 + cy=593 +settaborder=15 + [setcreateorderfo.grid] + propcolwidthref=331 + width0=165 + sortdescend0=0 + width1=159 + sortdescend1=0 + [setcreateorderfo] + stackedunder= + x=223 + y=264 + cx=381 + cy=340 + wsize=0 + active=1 + visible=1 +programparameters=18 + [programparametersfo.grid] + propcolwidthref=304 + width0=20 + sortdescend0=0 + width1=103 + sortdescend1=0 + width2=194 + sortdescend2=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [programparametersfo] + stackedunder= + x=388 + y=191 + cx=328 + cy=348 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imageselector=9 + [imageselectorfo] + stackedunder= + x=631 + y=239 + cx=320 + cy=244 + wsize=0 + active=1 + visible=1 +fadeeditor=35 + [fadeeditfo.filedialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [fadeeditfo.splitter] + x=0 + y=180 + xprop=1 + yprop=0.53649635036496 + [fadeeditfo] + x=150 + y=221 + cx=519 + cy=443 + wsize=0 + active=1 + visible=1 +stringlisteditor=5 + [stringlisteditor] + x=177 + y=203 + cx=275 + cy=237 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +colordialog=5 + [colordialogfo] + x=902 + y=152 + cx=338 + cy=298 +compnamedialog=5 + [compnametreefo] + x=527 + y=204 + cx=303 + cy=205 +bmpfiledialog=46 + [filedialog] + filenames=1 + /home/fred/Pictures/imagesideu/ideu64.png + filenamescust=0 + filecolwidth=150 + x=497 + y=203 + cx=608 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=242 + splitterlateral=126 + lastdir=/home/fred/Pictures/imagesideu/ + filehistory=21 + /home/fred/Pictures/imagesideu/ideu64.png + /home/fred/Pictures/imagesideu/beauty.png + /home/fred/ideu/src/ideu24.png + /home/fred/ideu/src/ideu.png + /home/fred/Pictures/tab_but2.png + /home/fred/Pictures/tab_but.png + /home/fred/Pictures/document-openprj.png + /home/fred/Pictures/document-open2.png + /home/fred/Pictures/document-open.png + /home/fred/Pictures/imagesideu/config3_64.png + /home/fred/Pictures/imagesideu/fileopen.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/ideu/src/ideu64.png + /home/fred/Pictures/imagesideu/linenum.png + /home/fred/Pictures/imagesideu/bulbin.png + /home/fred/Pictures/imagesideu/terminal.png + /home/fred/Pictures/imagesideu/searchindir.png + /home/fred/Pictures/imagesideu/save641proj.png + /home/fred/Pictures/imagesideu/switch.png + /home/fred/Pictures/imagesideu/searchinfile.png + /home/fred/Pictures/imagesideu/projectopen.png + filefilterindex=0 + filefilter="*.jpg" "*.jpeg" "*.bmp" "*.ico" "*.png" "*.pnm" "*.pgm" "*.pbm" "*.tga" "*.tif" "*.tiff" "*.xpm" +codetemplateselect=21 + [msetemplateselectfo.grid] + propcolwidthref=528 + width0=60 + sortdescend0=0 + width1=252 + sortdescend1=0 + width2=51 + sortdescend2=0 + width3=51 + sortdescend3=0 + width4=51 + sortdescend4=0 + width5=51 + sortdescend5=0 + sortdescend6=0 + [msetemplateselectfo] + stackedunder= + x=398 + y=233 + cx=569 + cy=277 +codetemplateedit=38 + [templateeditorfo.savefiledialog] + filenames=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/ideu/src/templates/ + filehistory=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filefilterindex=0 + filefilter=*.mct + [templateeditorfo.tsplitter2] + x=109 + y=16 + xprop=0.23678646934461 + yprop=0.112781954887218 + [templateeditorfo.tsplitter1] + x=0 + y=168 + xprop=1 + yprop=0.42857142857143 + [templateeditorfo.paramgrid] + propcolwidthref=343 + width0=100 + sortdescend0=0 + width1=336 + sortdescend1=0 + [templateeditorfo] + stackedunder= + x=147 + y=120 + cx=473 + cy=399 + wsize=0 + active=1 + visible=1 +mainfile=conswebstream.pas +targetfile=conswebstream${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=8 + /usr/lib/gcc/x86_64-linux-gnu/10/32 + /usr/lib/gcc/x86_64-linux-gnu/10 + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/windows + ${MSELIBDIR}kernel/linux + ${MSELIBDIR}kernel/$TARGETOSDIR + ${MSELIBDIR}kernel/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=15 + -Mobjfpc -Sh -Fcutf8 + -dmse_with_zeoslib + -gl + -B + -Xs -CX -XX + -O1 + -WG + -Cg -k-pie -k-znow + -k--gc-sections + -dmorecomponents + -dmse_dynpo + -SIcorba + -FUunits + -vewinhq + -dclass_bridge +makeoptpurpose=15 + Define Object Pascal + Zeos components + Debug infos + Re-build all + Optimizations + Optimizations + Windows application + Make a PIE executable + Garbage collector + Add extended components + Use dynamic loading of po files + Cobra Interface + Output of units + Verbosity + Use Class Briddge +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=4 + ${TEMPLATEDIR}fpc_mse/default/project.pas + ${TEMPLATEDIR}fpc_mse/default/main.pas + ${TEMPLATEDIR}fpc_mse/default/main.mfm + ${TEMPLATEDIR}fpc_mse/default/main_mfm.pas +newprojectfilesdest=4 + ${%PROJECTNAME%}.pas + + + +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}fpc_mse/default/program.pas + ${TEMPLATEDIR}fpc_mse/default/unit.pas + +newfonames=10 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Report + Scriptform + Inherited Form +newfonamebases=10 + form + form + form + module + form + form + form + report + script + form +newfosources=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=1 +copymessages=0 +closemessages=0 +enablepurpose=1 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612724 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=15 + 4095 + 4095 + 17 + 130 + 2046 + 4095 + 192 + 0 + 0 + 0 + 4095 + 4095 + 2047 + 4095 + 0 +compilerusedon=29 + 1591 + 0 + 8 + 256 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2048 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3602 + 1 + 0 + 0 + 0 + 492 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=20:25:05 03/02/2012 +project_comment= +aftcommandon=0 +unitdirson=8 + 983048 + 983095 + 198655 + 196800 + 65536 + 65855 + 198655 + 67583 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=4 + 1 + 1 + 1 + 0 +loadprojectfile=4 + 1 + 1 + 1 + 0 +newinheritedforms=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" + *.mfm + * +showgrid=0 +snaptogrid=0 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=1 +gridsizey=1 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=0 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=Auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=11 + + ${FPCSRCDIR}/ + ${FPCSRCDIR}/*/ + ${FPCSRCDIR}/*/*/ + ${FPCSRCDIR}/*/*/*/ + ${MSELIBDIR}*/ + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}/ + ${MSELIBDIR}kernel/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=4 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8245,6,Pascal Units + c=12 + ( + capt= + file=./ + kind=4 + a=0,8192,6,./ + ) + ( + file=actionsmodule.pas + kind=1 + a=0,8213,2,actionsmodule.pas + c=1 + ( + file=actionsmodule.mfm + kind=0 + a=0,0,0,actionsmodule + ) + ) + ( + file=beauty.pas + kind=1 + a=0,8213,2,beauty.pas + c=1 + ( + file=beauty.mfm + kind=0 + a=0,0,0,beauty + ) + ) + ( + file=commandorform.pas + kind=1 + a=0,8213,2,commandorform.pas + c=1 + ( + file=commandorform.mfm + kind=0 + a=0,0,0,commandorform + ) + ) + ( + file=confideu.pas + kind=1 + a=0,8212,2,confideu.pas + c=1 + ( + file=confideu.mfm + kind=0 + a=0,0,0,confideu + ) + ) + ( + file=define.inc + kind=1 + a=0,8196,0,define.inc + ) + ( + file=ideU.pas + kind=1 + a=0,8196,0,ideU.pas + ) + ( + file=main.pas + kind=1 + a=0,8212,2,main.pas + c=1 + ( + file=main.mfm + kind=0 + a=0,1,0,main + ) + ) + ( + file=projectoptionsform.pas + kind=1 + a=0,8213,2,projectoptionsform.pas + c=1 + ( + file=projectoptionsform.mfm + kind=0 + a=0,0,0,projectoptionsform + ) + ) + ( + file=sak_mse.pas + kind=1 + a=0,8196,0,sak_mse.pas + ) + ( + file=sourceform.pas + kind=1 + a=0,8212,2,sourceform.pas + c=1 + ( + file=sourceform.mfm + kind=0 + a=0,1,0,sourceform + ) + ) + ( + file=sourcepage.pas + kind=1 + a=0,8213,2,sourcepage.pas + c=1 + ( + file=sourcepage.mfm + kind=0 + a=0,0,0,sourcepage + ) + ) + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8245,6,Text Files + c=1 + ( + file=../README.TXT + kind=1 + a=0,8196,0,README.TXT + ) + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=caption +findhistory=20 + caption + ANSI_CHARSET + GetCharSet + EnumFontsNoDups + EnableEvents + DEFAULT_PITCH + defaultfontname + enumfontfamiliesex + fontenumcallback + defaultfontinfo + se_fontname + font name + po_ + po_font + createnewlang + font + conflangfo.sh + conflangfo.ok + setlangi + uses +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/conswebstream.pas +relpaths=1 + conswebstream.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/conswebstream.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/deviceinfos.lpi b/UOS/examples/deviceinfos.lpi new file mode 100644 index 0000000..22504d0 --- /dev/null +++ b/UOS/examples/deviceinfos.lpi @@ -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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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> diff --git a/UOS/examples/deviceinfos.lpr b/UOS/examples/deviceinfos.lpr new file mode 100644 index 0000000..af80af1 --- /dev/null +++ b/UOS/examples/deviceinfos.lpr @@ -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. + + diff --git a/UOS/examples/deviceinfos_fpGUI.lpi b/UOS/examples/deviceinfos_fpGUI.lpi new file mode 100644 index 0000000..da05d9f --- /dev/null +++ b/UOS/examples/deviceinfos_fpGUI.lpi @@ -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> diff --git a/UOS/examples/deviceinfos_fpGUI.pas b/UOS/examples/deviceinfos_fpGUI.pas new file mode 100644 index 0000000..ec4545a --- /dev/null +++ b/UOS/examples/deviceinfos_fpGUI.pas @@ -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. + diff --git a/UOS/examples/deviceinfos_fpGUI.prj b/UOS/examples/deviceinfos_fpGUI.prj new file mode 100644 index 0000000..05317c5 --- /dev/null +++ b/UOS/examples/deviceinfos_fpGUI.prj @@ -0,0 +1,2166 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/deviceinfos_fpGUI.prj +findinfiledialog=94 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=17 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + + "*.pas" "*.pp" "*.inc" "*.sh" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.prj" + "*.pas" "*.pp" "*.inc" "*.mfm + "*.pas" "*.pp" "*.inc" "*.prj" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/fpc-ootb_322ok/ + filecolwidth=150 + x=466 + y=190 + cx=608 + cy=346 + filehistory=20 + /home/fred/fpc-ootb_322ok/ + /home/fred/mseide-msegui/ + /home/fred/fpGUI-maint/ + /home/fred/lazarus/ + /home/fred/fpc-ootb_322/ + /home/fred/strumpract/ + /home/fred/bgrabitmap-11.4/ + /home/fred/fpc-ootb_322/installer/ + /home/fred/ideu_po/ + /home/fred/ideu_bin/ + /home/fred/fpc331trunk/ + /home/fred/strumpract/src/ + /home/fred/ideu_github/ + /home/fred/mseuniverse/ + /home/fred/freepascal-ootb_320test/ + /home/fred/biotray/ + /home/fred/A Alphabetical listing of command line options_files/ + /home/fred/svnfpc32/fixes_3_2/ + /home/fred/mseide-msegui-avantcircular/ + /home/fred/CodeTyphonIns700/CodeTyphonIns/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=XC_arrow + history=20 + XC_arrow + crarrow + crNone + crnone + XC_crosshair + mcDefault + SetMouseCursor + DEFAULT_PITCH + Screen.Fonts + fonts. + Screen + lfFaceName + EnumFontFamilies + screen + customsetLangFilePattern + LangDir + fixrows + messagefontname + usedefaulteditoroptions + editfontname + [findinfileadialogfo] + stackedunder= + x=594 + y=247 + cx=346 + cy=308 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=835 + y=206 + cx=298 + cy=269 +replacedialog=33 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=' | ' + history=20 + ' | ' + ] + strz ; + ] + str2 ; + " + " + " + msgid " + lang_stockcaption[ord( + lang_actionsmodule[ord( + )]; + lang_projectoptionscon[Ord( + lang_projectoptions[Ord( + lang_sourceform[ord( + lang_mainform[ord( + lang_modalresultnoshortcut[Ord( + lang_modalresult[Ord( + ]; + lang_settings[Ord( + @es + @pt + [replacedialogfo] + stackedunder= + x=281 + y=237 + cx=389 + cy=200 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=869 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=118 + sortdescend4=0 + width5=93 + sortdescend5=0 + width6=62 + sortdescend6=0 + width7=62 + sortdescend7=0 + width8=90 + sortdescend8=0 + width9=354 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=704 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=337 + sortdescend3=0 + width4=357 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=2 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=550 + width0=98 + sortdescend0=0 + width1=539 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=209 + xprop=1 + yprop=0.39700374531835 + [projectoptionsfo.macrogrid] + propcolwidthref=642 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=626 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=860 + width0=47 + sortdescend0=0 + width1=854 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=1 + [projectoptionsfo.filefiltergrid] + propcolwidthref=779 + width0=112 + sortdescend0=0 + width1=772 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=262 + y=50 + cx=920 + cy=593 +settaborder=15 + [setcreateorderfo.grid] + propcolwidthref=331 + width0=165 + sortdescend0=0 + width1=159 + sortdescend1=0 + [setcreateorderfo] + stackedunder= + x=223 + y=264 + cx=381 + cy=340 + wsize=0 + active=1 + visible=1 +programparameters=18 + [programparametersfo.grid] + propcolwidthref=304 + width0=20 + sortdescend0=0 + width1=103 + sortdescend1=0 + width2=194 + sortdescend2=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [programparametersfo] + stackedunder= + x=388 + y=191 + cx=328 + cy=348 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imageselector=9 + [imageselectorfo] + stackedunder= + x=631 + y=239 + cx=320 + cy=244 + wsize=0 + active=1 + visible=1 +fadeeditor=35 + [fadeeditfo.filedialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [fadeeditfo.splitter] + x=0 + y=180 + xprop=1 + yprop=0.53649635036496 + [fadeeditfo] + x=150 + y=221 + cx=519 + cy=443 + wsize=0 + active=1 + visible=1 +stringlisteditor=5 + [stringlisteditor] + x=177 + y=203 + cx=275 + cy=237 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +colordialog=5 + [colordialogfo] + x=902 + y=152 + cx=338 + cy=298 +compnamedialog=5 + [compnametreefo] + x=527 + y=204 + cx=303 + cy=205 +bmpfiledialog=46 + [filedialog] + filenames=1 + /home/fred/Pictures/imagesideu/ideu64.png + filenamescust=0 + filecolwidth=150 + x=497 + y=203 + cx=608 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=242 + splitterlateral=126 + lastdir=/home/fred/Pictures/imagesideu/ + filehistory=21 + /home/fred/Pictures/imagesideu/ideu64.png + /home/fred/Pictures/imagesideu/beauty.png + /home/fred/ideu/src/ideu24.png + /home/fred/ideu/src/ideu.png + /home/fred/Pictures/tab_but2.png + /home/fred/Pictures/tab_but.png + /home/fred/Pictures/document-openprj.png + /home/fred/Pictures/document-open2.png + /home/fred/Pictures/document-open.png + /home/fred/Pictures/imagesideu/config3_64.png + /home/fred/Pictures/imagesideu/fileopen.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/ideu/src/ideu64.png + /home/fred/Pictures/imagesideu/linenum.png + /home/fred/Pictures/imagesideu/bulbin.png + /home/fred/Pictures/imagesideu/terminal.png + /home/fred/Pictures/imagesideu/searchindir.png + /home/fred/Pictures/imagesideu/save641proj.png + /home/fred/Pictures/imagesideu/switch.png + /home/fred/Pictures/imagesideu/searchinfile.png + /home/fred/Pictures/imagesideu/projectopen.png + filefilterindex=0 + filefilter="*.jpg" "*.jpeg" "*.bmp" "*.ico" "*.png" "*.pnm" "*.pgm" "*.pbm" "*.tga" "*.tif" "*.tiff" "*.xpm" +codetemplateselect=21 + [msetemplateselectfo.grid] + propcolwidthref=528 + width0=60 + sortdescend0=0 + width1=252 + sortdescend1=0 + width2=51 + sortdescend2=0 + width3=51 + sortdescend3=0 + width4=51 + sortdescend4=0 + width5=51 + sortdescend5=0 + sortdescend6=0 + [msetemplateselectfo] + stackedunder= + x=398 + y=233 + cx=569 + cy=277 +codetemplateedit=38 + [templateeditorfo.savefiledialog] + filenames=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/ideu/src/templates/ + filehistory=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filefilterindex=0 + filefilter=*.mct + [templateeditorfo.tsplitter2] + x=109 + y=16 + xprop=0.23678646934461 + yprop=0.112781954887218 + [templateeditorfo.tsplitter1] + x=0 + y=168 + xprop=1 + yprop=0.42857142857143 + [templateeditorfo.paramgrid] + propcolwidthref=343 + width0=100 + sortdescend0=0 + width1=336 + sortdescend1=0 + [templateeditorfo] + stackedunder= + x=147 + y=120 + cx=473 + cy=399 + wsize=0 + active=1 + visible=1 +mainfile=deviceinfos_fpGUI.pas +targetfile=deviceinfos_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=8 + /usr/lib/gcc/x86_64-linux-gnu/10/32 + /usr/lib/gcc/x86_64-linux-gnu/10 + ${FPGUIDIR}/src/corelib/x11 + ${FPGUIDIR}/src/corelib/gdi + ${FPGUIDIR}/src/corelib + ${FPGUIDIR}/src/* + ${FPGUIDIR}/src + ${FPGUIDIR}/src/3rdparty/regex +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=15 + -Mobjfpc -Sh -Fcutf8 + -dmse_with_zeoslib + -gl + -B + -Xs -CX -XX + -O1 + -WG + -Cg -k-pie -k-znow + -k--gc-sections + -dmorecomponents + -dmse_dynpo + -SIcorba + -FUunits + -vewinhq + -dclass_bridge +makeoptpurpose=15 + Define Object Pascal + Zeos components + Debug infos + Re-build all + Optimizations + Optimizations + Windows application + Make a PIE executable + Garbage collector + Add extended components + Use dynamic loading of po files + Cobra Interface + Output of units + Verbosity + Use Class Briddge +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=4 + ${TEMPLATEDIR}fpc_mse/default/project.pas + ${TEMPLATEDIR}fpc_mse/default/main.pas + ${TEMPLATEDIR}fpc_mse/default/main.mfm + ${TEMPLATEDIR}fpc_mse/default/main_mfm.pas +newprojectfilesdest=4 + ${%PROJECTNAME%}.pas + + + +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}fpc_mse/default/program.pas + ${TEMPLATEDIR}fpc_mse/default/unit.pas + +newfonames=10 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Report + Scriptform + Inherited Form +newfonamebases=10 + form + form + form + module + form + form + form + report + script + form +newfosources=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=1 +copymessages=0 +closemessages=0 +enablepurpose=1 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612724 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=15 + 4095 + 4095 + 17 + 130 + 2046 + 4095 + 192 + 0 + 0 + 0 + 4095 + 4095 + 2047 + 4095 + 0 +compilerusedon=29 + 1591 + 0 + 8 + 256 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2048 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3602 + 1 + 0 + 0 + 0 + 492 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=20:25:05 03/02/2012 +project_comment= +aftcommandon=0 +unitdirson=8 + 983048 + 983095 + 198463 + 196800 + 196815 + 66047 + 198655 + 67583 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=4 + 1 + 1 + 1 + 0 +loadprojectfile=4 + 1 + 1 + 1 + 0 +newinheritedforms=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" + *.mfm + * +showgrid=0 +snaptogrid=0 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=1 +gridsizey=1 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=0 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=Auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=13 + ${FPGUIDIR}/src/corelib/x11/ + ${FPGUIDIR}/src/corelib/ + ${FPGUIDIR}/src/ + ${FPCSRCDIR}/ + ${FPCSRCDIR}/*/ + ${FPCSRCDIR}/*/*/ + ${FPCSRCDIR}/*/*/*/ + ${MSELIBDIR}*/ + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}/ + ${MSELIBDIR}kernel/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=4 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8245,6,Pascal Units + c=12 + ( + capt= + file=./ + kind=4 + a=0,8192,6,./ + ) + ( + file=actionsmodule.pas + kind=1 + a=0,8213,2,actionsmodule.pas + c=1 + ( + file=actionsmodule.mfm + kind=0 + a=0,0,0,actionsmodule + ) + ) + ( + file=beauty.pas + kind=1 + a=0,8213,2,beauty.pas + c=1 + ( + file=beauty.mfm + kind=0 + a=0,0,0,beauty + ) + ) + ( + file=commandorform.pas + kind=1 + a=0,8213,2,commandorform.pas + c=1 + ( + file=commandorform.mfm + kind=0 + a=0,0,0,commandorform + ) + ) + ( + file=confideu.pas + kind=1 + a=0,8212,2,confideu.pas + c=1 + ( + file=confideu.mfm + kind=0 + a=0,0,0,confideu + ) + ) + ( + file=define.inc + kind=1 + a=0,8196,0,define.inc + ) + ( + file=ideU.pas + kind=1 + a=0,8196,0,ideU.pas + ) + ( + file=main.pas + kind=1 + a=0,8212,2,main.pas + c=1 + ( + file=main.mfm + kind=0 + a=0,1,0,main + ) + ) + ( + file=projectoptionsform.pas + kind=1 + a=0,8213,2,projectoptionsform.pas + c=1 + ( + file=projectoptionsform.mfm + kind=0 + a=0,0,0,projectoptionsform + ) + ) + ( + file=sak_mse.pas + kind=1 + a=0,8196,0,sak_mse.pas + ) + ( + file=sourceform.pas + kind=1 + a=0,8212,2,sourceform.pas + c=1 + ( + file=sourceform.mfm + kind=0 + a=0,1,0,sourceform + ) + ) + ( + file=sourcepage.pas + kind=1 + a=0,8213,2,sourcepage.pas + c=1 + ( + file=sourcepage.mfm + kind=0 + a=0,0,0,sourcepage + ) + ) + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8245,6,Text Files + c=1 + ( + file=../README.TXT + kind=1 + a=0,8196,0,README.TXT + ) + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=uos_GetInfoDevice +findhistory=20 + uos_GetInfoDevice + uos_LoadLib + var + none + DoSetMouseCursor + TMouseCursor + case FMouseCursor of + FMouseCursor + caption + ANSI_CHARSET + GetCharSet + EnumFontsNoDups + EnableEvents + DEFAULT_PITCH + defaultfontname + enumfontfamiliesex + fontenumcallback + defaultfontinfo + se_fontname + font name +findoptions=1 +editpos=5 + 0,0 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 +bookmarks0=0 +bookmarks1=0 +bookmarks2=0 +bookmarks3=0 +bookmarks4=0 +sourcefiles=5 + /home/fred/mseide-msegui/lib/common/kernel/linux/mseguiintf.pas + /home/fred/fpGUI/src/corelib/gdi/fpg_gdi.pas + ${PROJECTDIR}/uos_flat.pas + ${PROJECTDIR}/uos.pas + ${PROJECTDIR}/uos_portaudio.pas +relpaths=5 + ../mseide-msegui/lib/common/kernel/linux/mseguiintf.pas + fpGUI/src/corelib/gdi/fpg_gdi.pas + uos/examples/uos_flat.pas + uos/examples/uos.pas + uos/examples/uos_portaudio.pas +ismoduletexts=5 + 0 + 0 + 0 + 0 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=536 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=95 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=29 + cx=1366 + cy=711 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=targetconsolefo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=28 + width0=141 + sortdescend0=0 + width1=26 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=16 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=242 + width0=58 + sortdescend0=0 + width1=178 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1219 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=projecttreefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1219 + cy=54 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1204 + ncy=62 + x=0 + y=0 + cx=1219 + cy=62 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/mseide-msegui/lib/common/kernel/linux/mseguiintf.pas + history=16 + /home/fred/mseide-msegui/lib/common/kernel/linux/mseguiintf.pas + /home/fred/uos/examples/uos.pas + /home/fred/mseide-msegui/lib/common/kernel/msectypes.pas + /home/fred/strumpract/src/uos_soundtouch.pas + /home/fred/testfpc/dbfilter2/main.pas + /home/fred/testfpc/dbfilter2/dbfilter.pas + /home/fred/testfpc/dbfilter3/msedbedit.pas + /home/fred/mseide-msegui/lib/common/dialogx/msefiledialogx.pas + /home/fred/mseide-msegui/lib/common/kernel/msegui.pas + /home/fred/mseide-msegui/lib/common/dialogs/msefiledialog.pas + /home/fred/mseide-msegui/apps/ide/sourcepage.pas + /home/fred/mseide-msegui/lib/common/dialogs/msedirtreesub_mfm.pas + /home/fred/mseide-msegui/apps/ide/make.pas + /home/fred/ideU/src/msefiledialogx.pas + /home/fred/mseide-msegui/apps/ide/sourceform.pas + /home/fred/strumpract/src/drums.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1219 + cy=452 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=57 + cx=1219 + cy=452 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/filterplayer.lpi b/UOS/examples/filterplayer.lpi new file mode 100644 index 0000000..7fd05a9 --- /dev/null +++ b/UOS/examples/filterplayer.lpi @@ -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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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> diff --git a/UOS/examples/filterplayer.lpr b/UOS/examples/filterplayer.lpr new file mode 100644 index 0000000..e9e1e7b --- /dev/null +++ b/UOS/examples/filterplayer.lpr @@ -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. + + diff --git a/UOS/examples/filterplayer_fpGUI.lpi b/UOS/examples/filterplayer_fpGUI.lpi new file mode 100644 index 0000000..a2c5231 --- /dev/null +++ b/UOS/examples/filterplayer_fpGUI.lpi @@ -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> diff --git a/UOS/examples/filterplayer_fpGUI.pas b/UOS/examples/filterplayer_fpGUI.pas new file mode 100644 index 0000000..ae9687d --- /dev/null +++ b/UOS/examples/filterplayer_fpGUI.pas @@ -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. + diff --git a/UOS/examples/filterplayer_fpGUI.prj b/UOS/examples/filterplayer_fpGUI.prj new file mode 100644 index 0000000..774410e --- /dev/null +++ b/UOS/examples/filterplayer_fpGUI.prj @@ -0,0 +1,2129 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/filterplayer_fpGUI.prj +findinfiledialog=94 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=17 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" "*.po" + "*.pas" "*.pp" "*.inc" "*.*" + + "*.pas" "*.pp" "*.inc" "*.sh" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.*" + "*.pas" "*.pp" "*.inc" "*.mfm" "*.prj" + "*.pas" "*.pp" "*.inc" "*.mfm + "*.pas" "*.pp" "*.inc" "*.prj" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/lazarus/ + filecolwidth=150 + x=466 + y=190 + cx=608 + cy=346 + filehistory=20 + /home/fred/lazarus/ + /home/fred/fpc-ootb_322/ + /home/fred/mseide-msegui/ + /home/fred/strumpract/ + /home/fred/bgrabitmap-11.4/ + /home/fred/fpc-ootb_322/installer/ + /home/fred/ideu_po/ + /home/fred/ideu_bin/ + /home/fred/fpc331trunk/ + /home/fred/strumpract/src/ + /home/fred/ideu_github/ + /home/fred/mseuniverse/ + /home/fred/freepascal-ootb_320test/ + /home/fred/biotray/ + /home/fred/A Alphabetical listing of command line options_files/ + /home/fred/svnfpc32/fixes_3_2/ + /home/fred/mseide-msegui-avantcircular/ + /home/fred/CodeTyphonIns700/CodeTyphonIns/ + /home/fred/freepascal-ootb/ + /home/fred/eschecs_mse/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=DEFAULT_PITCH + history=20 + DEFAULT_PITCH + Screen.Fonts + fonts. + Screen + lfFaceName + EnumFontFamilies + screen + customsetLangFilePattern + LangDir + fixrows + messagefontname + usedefaulteditoroptions + editfontname + deflayout + encoding + fontname + backupfilecount + confideufo.encoding + fonts + TMSEFontRenderer + [findinfileadialogfo] + stackedunder= + x=594 + y=247 + cx=346 + cy=308 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=789 + y=197 + cx=298 + cy=269 +replacedialog=33 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=' | ' + history=20 + ' | ' + ] + strz ; + ] + str2 ; + " + " + " + msgid " + lang_stockcaption[ord( + lang_actionsmodule[ord( + )]; + lang_projectoptionscon[Ord( + lang_projectoptions[Ord( + lang_sourceform[ord( + lang_mainform[ord( + lang_modalresultnoshortcut[Ord( + lang_modalresult[Ord( + ]; + lang_settings[Ord( + @es + @pt + [replacedialogfo] + stackedunder= + x=281 + y=237 + cx=389 + cy=200 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=869 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=118 + sortdescend4=0 + width5=93 + sortdescend5=0 + width6=62 + sortdescend6=0 + width7=62 + sortdescend7=0 + width8=90 + sortdescend8=0 + width9=354 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=704 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=337 + sortdescend3=0 + width4=357 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=2 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=550 + width0=98 + sortdescend0=0 + width1=539 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=209 + xprop=1 + yprop=0.39700374531835 + [projectoptionsfo.macrogrid] + propcolwidthref=642 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=626 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=860 + width0=47 + sortdescend0=0 + width1=854 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=779 + width0=112 + sortdescend0=0 + width1=772 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=275 + y=66 + cx=920 + cy=593 +settaborder=15 + [setcreateorderfo.grid] + propcolwidthref=331 + width0=165 + sortdescend0=0 + width1=159 + sortdescend1=0 + [setcreateorderfo] + stackedunder= + x=223 + y=264 + cx=381 + cy=340 + wsize=0 + active=1 + visible=1 +programparameters=18 + [programparametersfo.grid] + propcolwidthref=304 + width0=20 + sortdescend0=0 + width1=103 + sortdescend1=0 + width2=194 + sortdescend2=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [programparametersfo] + stackedunder= + x=388 + y=191 + cx=328 + cy=348 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imageselector=9 + [imageselectorfo] + stackedunder= + x=631 + y=239 + cx=320 + cy=244 + wsize=0 + active=1 + visible=1 +fadeeditor=35 + [fadeeditfo.filedialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [fadeeditfo.splitter] + x=0 + y=180 + xprop=1 + yprop=0.53649635036496 + [fadeeditfo] + x=150 + y=221 + cx=519 + cy=443 + wsize=0 + active=1 + visible=1 +stringlisteditor=5 + [stringlisteditor] + x=177 + y=203 + cx=275 + cy=237 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +colordialog=5 + [colordialogfo] + x=902 + y=152 + cx=338 + cy=298 +compnamedialog=5 + [compnametreefo] + x=527 + y=204 + cx=303 + cy=205 +bmpfiledialog=46 + [filedialog] + filenames=1 + /home/fred/Pictures/imagesideu/ideu64.png + filenamescust=0 + filecolwidth=150 + x=497 + y=203 + cx=608 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=242 + splitterlateral=126 + lastdir=/home/fred/Pictures/imagesideu/ + filehistory=21 + /home/fred/Pictures/imagesideu/ideu64.png + /home/fred/Pictures/imagesideu/beauty.png + /home/fred/ideu/src/ideu24.png + /home/fred/ideu/src/ideu.png + /home/fred/Pictures/tab_but2.png + /home/fred/Pictures/tab_but.png + /home/fred/Pictures/document-openprj.png + /home/fred/Pictures/document-open2.png + /home/fred/Pictures/document-open.png + /home/fred/Pictures/imagesideu/config3_64.png + /home/fred/Pictures/imagesideu/fileopen.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/ideu/src/ideu64.png + /home/fred/Pictures/imagesideu/linenum.png + /home/fred/Pictures/imagesideu/bulbin.png + /home/fred/Pictures/imagesideu/terminal.png + /home/fred/Pictures/imagesideu/searchindir.png + /home/fred/Pictures/imagesideu/save641proj.png + /home/fred/Pictures/imagesideu/switch.png + /home/fred/Pictures/imagesideu/searchinfile.png + /home/fred/Pictures/imagesideu/projectopen.png + filefilterindex=0 + filefilter="*.jpg" "*.jpeg" "*.bmp" "*.ico" "*.png" "*.pnm" "*.pgm" "*.pbm" "*.tga" "*.tif" "*.tiff" "*.xpm" +codetemplateselect=21 + [msetemplateselectfo.grid] + propcolwidthref=528 + width0=60 + sortdescend0=0 + width1=252 + sortdescend1=0 + width2=51 + sortdescend2=0 + width3=51 + sortdescend3=0 + width4=51 + sortdescend4=0 + width5=51 + sortdescend5=0 + sortdescend6=0 + [msetemplateselectfo] + stackedunder= + x=398 + y=233 + cx=569 + cy=277 +codetemplateedit=38 + [templateeditorfo.savefiledialog] + filenames=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/ideu/src/templates/ + filehistory=1 + /home/fred/ideu/src/templates/fpgui_app.mct + filefilterindex=0 + filefilter=*.mct + [templateeditorfo.tsplitter2] + x=109 + y=16 + xprop=0.23678646934461 + yprop=0.112781954887218 + [templateeditorfo.tsplitter1] + x=0 + y=168 + xprop=1 + yprop=0.42857142857143 + [templateeditorfo.paramgrid] + propcolwidthref=343 + width0=100 + sortdescend0=0 + width1=336 + sortdescend1=0 + [templateeditorfo] + stackedunder= + x=147 + y=120 + cx=473 + cy=399 + wsize=0 + active=1 + visible=1 +mainfile=filterplayer_fpGUI.pas +targetfile=filterplayer_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=8 + /usr/lib/gcc/x86_64-linux-gnu/10/32 + /usr/lib/gcc/x86_64-linux-gnu/10 + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/windows + ${MSELIBDIR}kernel/linux + ${MSELIBDIR}kernel/$TARGETOSDIR + ${MSELIBDIR}kernel/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=15 + -Mobjfpc -Sh -Fcutf8 + -dmse_with_zeoslib + -gl + -B + -Xs -CX -XX + -O1 + -WG + -Cg -k-pie -k-znow + -k--gc-sections + -dmorecomponents + -dmse_dynpo + -SIcorba + -FUunits + -vewinhq + -dclass_bridge +makeoptpurpose=15 + Define Object Pascal + Zeos components + Debug infos + Re-build all + Optimizations + Optimizations + Windows application + Make a PIE executable + Garbage collector + Add extended components + Use dynamic loading of po files + Cobra Interface + Output of units + Verbosity + Use Class Briddge +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=4 + ${TEMPLATEDIR}fpc_mse/default/project.pas + ${TEMPLATEDIR}fpc_mse/default/main.pas + ${TEMPLATEDIR}fpc_mse/default/main.mfm + ${TEMPLATEDIR}fpc_mse/default/main_mfm.pas +newprojectfilesdest=4 + ${%PROJECTNAME%}.pas + + + +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}fpc_mse/default/program.pas + ${TEMPLATEDIR}fpc_mse/default/unit.pas + +newfonames=10 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Report + Scriptform + Inherited Form +newfonamebases=10 + form + form + form + module + form + form + form + report + script + form +newfosources=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=10 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=1 +copymessages=0 +closemessages=0 +enablepurpose=1 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612724 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=15 + 4095 + 4095 + 17 + 130 + 2046 + 4095 + 192 + 0 + 0 + 0 + 4095 + 4095 + 2047 + 4095 + 0 +compilerusedon=29 + 1591 + 0 + 8 + 256 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2048 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3602 + 1 + 0 + 0 + 0 + 492 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=20:25:05 03/02/2012 +project_comment= +aftcommandon=0 +unitdirson=8 + 983048 + 983095 + 198655 + 196800 + 65536 + 65855 + 198655 + 67583 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=4 + 1 + 1 + 1 + 0 +loadprojectfile=4 + 1 + 1 + 1 + 0 +newinheritedforms=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" + *.mfm + * +showgrid=0 +snaptogrid=0 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=1 +gridsizey=1 +autoindent=1 +blockindent=1 +linenumberson=1 +rightmarginon=0 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=Auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=11 + + ${FPCSRCDIR}/ + ${FPCSRCDIR}/*/ + ${FPCSRCDIR}/*/*/ + ${FPCSRCDIR}/*/*/*/ + ${MSELIBDIR}*/ + ${MSEDIR}lib/addon/*/ + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}/ + ${MSELIBDIR}kernel/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=4 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8245,6,Pascal Units + c=12 + ( + capt= + file=./ + kind=4 + a=0,8192,6,./ + ) + ( + file=actionsmodule.pas + kind=1 + a=0,8213,2,actionsmodule.pas + c=1 + ( + file=actionsmodule.mfm + kind=0 + a=0,0,0,actionsmodule + ) + ) + ( + file=beauty.pas + kind=1 + a=0,8213,2,beauty.pas + c=1 + ( + file=beauty.mfm + kind=0 + a=0,0,0,beauty + ) + ) + ( + file=commandorform.pas + kind=1 + a=0,8213,2,commandorform.pas + c=1 + ( + file=commandorform.mfm + kind=0 + a=0,0,0,commandorform + ) + ) + ( + file=confideu.pas + kind=1 + a=0,8212,2,confideu.pas + c=1 + ( + file=confideu.mfm + kind=0 + a=0,0,0,confideu + ) + ) + ( + file=define.inc + kind=1 + a=0,8196,0,define.inc + ) + ( + file=ideU.pas + kind=1 + a=0,8196,0,ideU.pas + ) + ( + file=main.pas + kind=1 + a=0,8212,2,main.pas + c=1 + ( + file=main.mfm + kind=0 + a=0,1,0,main + ) + ) + ( + file=projectoptionsform.pas + kind=1 + a=0,8213,2,projectoptionsform.pas + c=1 + ( + file=projectoptionsform.mfm + kind=0 + a=0,0,0,projectoptionsform + ) + ) + ( + file=sak_mse.pas + kind=1 + a=0,8196,0,sak_mse.pas + ) + ( + file=sourceform.pas + kind=1 + a=0,8212,2,sourceform.pas + c=1 + ( + file=sourceform.mfm + kind=0 + a=0,1,0,sourceform + ) + ) + ( + file=sourcepage.pas + kind=1 + a=0,8213,2,sourcepage.pas + c=1 + ( + file=sourcepage.mfm + kind=0 + a=0,0,0,sourcepage + ) + ) + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8245,6,Text Files + c=1 + ( + file=../README.TXT + kind=1 + a=0,8196,0,README.TXT + ) + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext=caption +findhistory=20 + caption + ANSI_CHARSET + GetCharSet + EnumFontsNoDups + EnableEvents + DEFAULT_PITCH + defaultfontname + enumfontfamiliesex + fontenumcallback + defaultfontinfo + se_fontname + font name + po_ + po_font + createnewlang + font + conflangfo.sh + conflangfo.ok + setlangi + uses +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/filterplayer_fpGUI.pas +relpaths=1 + filterplayer_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/filterplayer_fpGUI.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/formspectrum.lpi b/UOS/examples/formspectrum.lpi new file mode 100644 index 0000000..ece000b --- /dev/null +++ b/UOS/examples/formspectrum.lpi @@ -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> diff --git a/UOS/examples/formspectrum.lpr b/UOS/examples/formspectrum.lpr new file mode 100644 index 0000000..b8bfac5 --- /dev/null +++ b/UOS/examples/formspectrum.lpr @@ -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. + diff --git a/UOS/examples/formspectrum_mse.pas b/UOS/examples/formspectrum_mse.pas new file mode 100644 index 0000000..5623084 --- /dev/null +++ b/UOS/examples/formspectrum_mse.pas @@ -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. diff --git a/UOS/examples/formspectrum_mse.prj b/UOS/examples/formspectrum_mse.prj new file mode 100644 index 0000000..56bf0a9 --- /dev/null +++ b/UOS/examples/formspectrum_mse.prj @@ -0,0 +1,1594 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/formspectrum_mse.prj +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=764 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=104 + sortdescend4=0 + width5=92 + sortdescend5=0 + width6=86 + sortdescend6=0 + width7=77 + sortdescend7=0 + width8=39 + sortdescend8=0 + width9=285 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=572 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=100 + sortdescend2=0 + width3=275 + sortdescend3=0 + width4=287 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=0 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=315 + width0=143 + sortdescend0=0 + width1=304 + sortdescend1=0 + width2=66 + sortdescend2=0 + width3=54 + sortdescend3=0 + width4=62 + sortdescend4=0 + width5=70 + sortdescend5=0 + width6=103 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=201 + xprop=1 + yprop=0.37294332723949 + [projectoptionsfo.macrogrid] + propcolwidthref=537 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=521 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=725 + width0=77 + sortdescend0=0 + width1=719 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=660 + width0=186 + sortdescend0=0 + width1=653 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=0 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=212 + y=56 + cx=815 + cy=606 +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=formspectrum_mse.pas +targetfile=formspectrum_mse${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=5 + + + + + +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=0 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4047 + 4063 + 4095 + 32 +compilerusedon=29 + 4095 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 4095 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 4095 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=00:53:32 25/07/22 +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/formspectrum_mse.pas +relpaths=1 + formspectrum_mse.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=522 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=29 + cx=1360 + cy=708 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=conflangfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=projecttreefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=242 + width0=58 + sortdescend0=0 + width1=178 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=599 + cx=1350 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1350 + cy=57 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1348 + ncy=65 + x=0 + y=0 + cx=1350 + cy=65 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/formspectrum_mse.pas + history=2 + /home/fred/uos/examples/formspectrum_mse.pas + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1350 + cy=536 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=mainfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=60 + cx=1350 + cy=536 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/formspectrum_unit.lfm b/UOS/examples/formspectrum_unit.lfm new file mode 100644 index 0000000..28ddb37 --- /dev/null +++ b/UOS/examples/formspectrum_unit.lfm @@ -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 diff --git a/UOS/examples/formspectrum_unit.pas b/UOS/examples/formspectrum_unit.pas new file mode 100644 index 0000000..db37aef --- /dev/null +++ b/UOS/examples/formspectrum_unit.pas @@ -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. + diff --git a/UOS/examples/fpg_style_chrome_silver_flatmenu.pas b/UOS/examples/fpg_style_chrome_silver_flatmenu.pas new file mode 100644 index 0000000..414f4f1 --- /dev/null +++ b/UOS/examples/fpg_style_chrome_silver_flatmenu.pas @@ -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. diff --git a/UOS/examples/lib/FreeBSD/32bit/libmpg123-32.so b/UOS/examples/lib/FreeBSD/32bit/libmpg123-32.so new file mode 100644 index 0000000..c45d52a Binary files /dev/null and b/UOS/examples/lib/FreeBSD/32bit/libmpg123-32.so differ diff --git a/UOS/examples/lib/FreeBSD/32bit/libportaudio-32.so b/UOS/examples/lib/FreeBSD/32bit/libportaudio-32.so new file mode 100644 index 0000000..63f2623 Binary files /dev/null and b/UOS/examples/lib/FreeBSD/32bit/libportaudio-32.so differ diff --git a/UOS/examples/lib/FreeBSD/32bit/libsndfile-32.so b/UOS/examples/lib/FreeBSD/32bit/libsndfile-32.so new file mode 100644 index 0000000..bf96387 Binary files /dev/null and b/UOS/examples/lib/FreeBSD/32bit/libsndfile-32.so differ diff --git a/UOS/examples/lib/FreeBSD/64bit/libfaad2-64.so b/UOS/examples/lib/FreeBSD/64bit/libfaad2-64.so new file mode 100644 index 0000000..19ac3e4 Binary files /dev/null and b/UOS/examples/lib/FreeBSD/64bit/libfaad2-64.so differ diff --git a/UOS/examples/lib/FreeBSD/64bit/libmp4ff-64.so b/UOS/examples/lib/FreeBSD/64bit/libmp4ff-64.so new file mode 100644 index 0000000..f04f450 Binary files /dev/null and b/UOS/examples/lib/FreeBSD/64bit/libmp4ff-64.so differ diff --git a/UOS/examples/lib/FreeBSD/64bit/libmpg123-64.so b/UOS/examples/lib/FreeBSD/64bit/libmpg123-64.so new file mode 100644 index 0000000..bb567fb Binary files /dev/null and b/UOS/examples/lib/FreeBSD/64bit/libmpg123-64.so differ diff --git a/UOS/examples/lib/FreeBSD/64bit/libopus.so b/UOS/examples/lib/FreeBSD/64bit/libopus.so new file mode 100644 index 0000000..0d61948 Binary files /dev/null and b/UOS/examples/lib/FreeBSD/64bit/libopus.so differ diff --git a/UOS/examples/lib/FreeBSD/64bit/libopusfile-64.so b/UOS/examples/lib/FreeBSD/64bit/libopusfile-64.so new file mode 100644 index 0000000..691d973 Binary files /dev/null and b/UOS/examples/lib/FreeBSD/64bit/libopusfile-64.so differ diff --git a/UOS/examples/lib/FreeBSD/64bit/libportaudio-64.so b/UOS/examples/lib/FreeBSD/64bit/libportaudio-64.so new file mode 100644 index 0000000..572f41c Binary files /dev/null and b/UOS/examples/lib/FreeBSD/64bit/libportaudio-64.so differ diff --git a/UOS/examples/lib/FreeBSD/64bit/libshout-64.so b/UOS/examples/lib/FreeBSD/64bit/libshout-64.so new file mode 100644 index 0000000..9a075f8 Binary files /dev/null and b/UOS/examples/lib/FreeBSD/64bit/libshout-64.so differ diff --git a/UOS/examples/lib/FreeBSD/64bit/libsndfile-64.so b/UOS/examples/lib/FreeBSD/64bit/libsndfile-64.so new file mode 100644 index 0000000..5907572 Binary files /dev/null and b/UOS/examples/lib/FreeBSD/64bit/libsndfile-64.so differ diff --git a/UOS/examples/lib/FreeBSD/64bit/plugin/libbs2b-64.so b/UOS/examples/lib/FreeBSD/64bit/plugin/libbs2b-64.so new file mode 100644 index 0000000..74d8cc4 Binary files /dev/null and b/UOS/examples/lib/FreeBSD/64bit/plugin/libbs2b-64.so differ diff --git a/UOS/examples/lib/FreeBSD/64bit/plugin/libsoundtouch-64.so b/UOS/examples/lib/FreeBSD/64bit/plugin/libsoundtouch-64.so new file mode 100644 index 0000000..d071599 Binary files /dev/null and b/UOS/examples/lib/FreeBSD/64bit/plugin/libsoundtouch-64.so differ diff --git a/UOS/examples/lib/Linux/32bit/LibFaad2-32.so b/UOS/examples/lib/Linux/32bit/LibFaad2-32.so new file mode 100644 index 0000000..d4f9166 Binary files /dev/null and b/UOS/examples/lib/Linux/32bit/LibFaad2-32.so differ diff --git a/UOS/examples/lib/Linux/32bit/LibMp4ff-32.so b/UOS/examples/lib/Linux/32bit/LibMp4ff-32.so new file mode 100644 index 0000000..ae30205 Binary files /dev/null and b/UOS/examples/lib/Linux/32bit/LibMp4ff-32.so differ diff --git a/UOS/examples/lib/Linux/32bit/LibMpg123-32.so b/UOS/examples/lib/Linux/32bit/LibMpg123-32.so new file mode 100644 index 0000000..f1a7ddd Binary files /dev/null and b/UOS/examples/lib/Linux/32bit/LibMpg123-32.so differ diff --git a/UOS/examples/lib/Linux/32bit/LibPortaudio-32.so b/UOS/examples/lib/Linux/32bit/LibPortaudio-32.so new file mode 100644 index 0000000..d7a518c Binary files /dev/null and b/UOS/examples/lib/Linux/32bit/LibPortaudio-32.so differ diff --git a/UOS/examples/lib/Linux/32bit/LibSndFile-32.so b/UOS/examples/lib/Linux/32bit/LibSndFile-32.so new file mode 100644 index 0000000..c6825c9 Binary files /dev/null and b/UOS/examples/lib/Linux/32bit/LibSndFile-32.so differ diff --git a/UOS/examples/lib/Linux/32bit/libxmp-32.so b/UOS/examples/lib/Linux/32bit/libxmp-32.so new file mode 100644 index 0000000..aa49875 Binary files /dev/null and b/UOS/examples/lib/Linux/32bit/libxmp-32.so differ diff --git a/UOS/examples/lib/Linux/32bit/plugin/LibSoundTouch-32.so b/UOS/examples/lib/Linux/32bit/plugin/LibSoundTouch-32.so new file mode 100644 index 0000000..77b4a2f Binary files /dev/null and b/UOS/examples/lib/Linux/32bit/plugin/LibSoundTouch-32.so differ diff --git a/UOS/examples/lib/Linux/32bit/plugin/libbs2b-32.so b/UOS/examples/lib/Linux/32bit/plugin/libbs2b-32.so new file mode 100644 index 0000000..20e26bf Binary files /dev/null and b/UOS/examples/lib/Linux/32bit/plugin/libbs2b-32.so differ diff --git a/UOS/examples/lib/Linux/64bit/LibFaad2-64.so b/UOS/examples/lib/Linux/64bit/LibFaad2-64.so new file mode 100644 index 0000000..12ce685 Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/LibFaad2-64.so differ diff --git a/UOS/examples/lib/Linux/64bit/LibMp4ff-64.so b/UOS/examples/lib/Linux/64bit/LibMp4ff-64.so new file mode 100644 index 0000000..7fdb21e Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/LibMp4ff-64.so differ diff --git a/UOS/examples/lib/Linux/64bit/LibMpg123-64.so b/UOS/examples/lib/Linux/64bit/LibMpg123-64.so new file mode 100644 index 0000000..8d56b7f Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/LibMpg123-64.so differ diff --git a/UOS/examples/lib/Linux/64bit/LibOpusFile-64.so b/UOS/examples/lib/Linux/64bit/LibOpusFile-64.so new file mode 100644 index 0000000..d51437a Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/LibOpusFile-64.so differ diff --git a/UOS/examples/lib/Linux/64bit/LibPortaudio-64.so b/UOS/examples/lib/Linux/64bit/LibPortaudio-64.so new file mode 100644 index 0000000..da259ad Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/LibPortaudio-64.so differ diff --git a/UOS/examples/lib/Linux/64bit/LibShout-64.so b/UOS/examples/lib/Linux/64bit/LibShout-64.so new file mode 100644 index 0000000..313a2a5 Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/LibShout-64.so differ diff --git a/UOS/examples/lib/Linux/64bit/LibSndFile-64.so b/UOS/examples/lib/Linux/64bit/LibSndFile-64.so new file mode 100644 index 0000000..4634c0f Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/LibSndFile-64.so differ diff --git a/UOS/examples/lib/Linux/64bit/LibSndFile-64.so.2 b/UOS/examples/lib/Linux/64bit/LibSndFile-64.so.2 new file mode 100644 index 0000000..4460652 Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/LibSndFile-64.so.2 differ diff --git a/UOS/examples/lib/Linux/64bit/libfdk-aac-64.so b/UOS/examples/lib/Linux/64bit/libfdk-aac-64.so new file mode 100644 index 0000000..5383d2f Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/libfdk-aac-64.so differ diff --git a/UOS/examples/lib/Linux/64bit/libopus.so b/UOS/examples/lib/Linux/64bit/libopus.so new file mode 100644 index 0000000..2ed841f Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/libopus.so differ diff --git a/UOS/examples/lib/Linux/64bit/libxmp-64.so b/UOS/examples/lib/Linux/64bit/libxmp-64.so new file mode 100644 index 0000000..1d7af37 Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/libxmp-64.so differ diff --git a/UOS/examples/lib/Linux/64bit/plugin/LibSoundTouch-64.so b/UOS/examples/lib/Linux/64bit/plugin/LibSoundTouch-64.so new file mode 100644 index 0000000..a8319b0 Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/plugin/LibSoundTouch-64.so differ diff --git a/UOS/examples/lib/Linux/64bit/plugin/libbs2b-64.so b/UOS/examples/lib/Linux/64bit/plugin/libbs2b-64.so new file mode 100644 index 0000000..1c97c15 Binary files /dev/null and b/UOS/examples/lib/Linux/64bit/plugin/libbs2b-64.so differ diff --git a/UOS/examples/lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so b/UOS/examples/lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so new file mode 100644 index 0000000..d65ea7f Binary files /dev/null and b/UOS/examples/lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so differ diff --git a/UOS/examples/lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so b/UOS/examples/lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so new file mode 100644 index 0000000..a5b006a Binary files /dev/null and b/UOS/examples/lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so differ diff --git a/UOS/examples/lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so b/UOS/examples/lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so new file mode 100644 index 0000000..eba5134 Binary files /dev/null and b/UOS/examples/lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so differ diff --git a/UOS/examples/lib/Linux/aarch64_raspberrypi/libxmp_aarch64.so b/UOS/examples/lib/Linux/aarch64_raspberrypi/libxmp_aarch64.so new file mode 100644 index 0000000..b7bba7c Binary files /dev/null and b/UOS/examples/lib/Linux/aarch64_raspberrypi/libxmp_aarch64.so differ diff --git a/UOS/examples/lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so b/UOS/examples/lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so new file mode 100644 index 0000000..8d04d46 Binary files /dev/null and b/UOS/examples/lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so differ diff --git a/UOS/examples/lib/Linux/arm_raspberrypi/libmpg123-arm.so b/UOS/examples/lib/Linux/arm_raspberrypi/libmpg123-arm.so new file mode 100644 index 0000000..2714ebe Binary files /dev/null and b/UOS/examples/lib/Linux/arm_raspberrypi/libmpg123-arm.so differ diff --git a/UOS/examples/lib/Linux/arm_raspberrypi/libportaudio-arm.so b/UOS/examples/lib/Linux/arm_raspberrypi/libportaudio-arm.so new file mode 100644 index 0000000..a52e6e3 Binary files /dev/null and b/UOS/examples/lib/Linux/arm_raspberrypi/libportaudio-arm.so differ diff --git a/UOS/examples/lib/Linux/arm_raspberrypi/libsndfile-arm.so b/UOS/examples/lib/Linux/arm_raspberrypi/libsndfile-arm.so new file mode 100644 index 0000000..c51989e Binary files /dev/null and b/UOS/examples/lib/Linux/arm_raspberrypi/libsndfile-arm.so differ diff --git a/UOS/examples/lib/Linux/arm_raspberrypi/libxmp-arm.so b/UOS/examples/lib/Linux/arm_raspberrypi/libxmp-arm.so new file mode 100644 index 0000000..4fc6363 Binary files /dev/null and b/UOS/examples/lib/Linux/arm_raspberrypi/libxmp-arm.so differ diff --git a/UOS/examples/lib/Linux/arm_raspberrypi/plugin/libsoundtouch-arm.so b/UOS/examples/lib/Linux/arm_raspberrypi/plugin/libsoundtouch-arm.so new file mode 100644 index 0000000..d6c13ef Binary files /dev/null and b/UOS/examples/lib/Linux/arm_raspberrypi/plugin/libsoundtouch-arm.so differ diff --git a/UOS/examples/lib/Mac/32bit/LibMpg123-32.dylib b/UOS/examples/lib/Mac/32bit/LibMpg123-32.dylib new file mode 100644 index 0000000..a83207c Binary files /dev/null and b/UOS/examples/lib/Mac/32bit/LibMpg123-32.dylib differ diff --git a/UOS/examples/lib/Mac/32bit/LibPortaudio-32.dylib b/UOS/examples/lib/Mac/32bit/LibPortaudio-32.dylib new file mode 100644 index 0000000..d45612c Binary files /dev/null and b/UOS/examples/lib/Mac/32bit/LibPortaudio-32.dylib differ diff --git a/UOS/examples/lib/Mac/32bit/LibSndFile-32.dylib b/UOS/examples/lib/Mac/32bit/LibSndFile-32.dylib new file mode 100644 index 0000000..39d2477 Binary files /dev/null and b/UOS/examples/lib/Mac/32bit/LibSndFile-32.dylib differ diff --git a/UOS/examples/lib/Mac/32bit/plugin/LibSoundTouch-32.dylib b/UOS/examples/lib/Mac/32bit/plugin/LibSoundTouch-32.dylib new file mode 100644 index 0000000..1d19242 Binary files /dev/null and b/UOS/examples/lib/Mac/32bit/plugin/LibSoundTouch-32.dylib differ diff --git a/UOS/examples/lib/Mac/64bit/LibMpg123-64.dylib b/UOS/examples/lib/Mac/64bit/LibMpg123-64.dylib new file mode 100644 index 0000000..7ce9f3e Binary files /dev/null and b/UOS/examples/lib/Mac/64bit/LibMpg123-64.dylib differ diff --git a/UOS/examples/lib/Mac/64bit/LibPortaudio-64.dylib b/UOS/examples/lib/Mac/64bit/LibPortaudio-64.dylib new file mode 100644 index 0000000..845b3df Binary files /dev/null and b/UOS/examples/lib/Mac/64bit/LibPortaudio-64.dylib differ diff --git a/UOS/examples/lib/Mac/64bit/LibSndfile-64.dylib b/UOS/examples/lib/Mac/64bit/LibSndfile-64.dylib new file mode 100644 index 0000000..a9dbf76 Binary files /dev/null and b/UOS/examples/lib/Mac/64bit/LibSndfile-64.dylib differ diff --git a/UOS/examples/lib/Mac/64bit/libSoundTouchDLL-64.dylib b/UOS/examples/lib/Mac/64bit/libSoundTouchDLL-64.dylib new file mode 100644 index 0000000..6e2a833 Binary files /dev/null and b/UOS/examples/lib/Mac/64bit/libSoundTouchDLL-64.dylib differ diff --git a/UOS/examples/lib/Mac/64bit/libxmp-64.dylib b/UOS/examples/lib/Mac/64bit/libxmp-64.dylib new file mode 100644 index 0000000..af8c974 Binary files /dev/null and b/UOS/examples/lib/Mac/64bit/libxmp-64.dylib differ diff --git a/UOS/examples/lib/OpenBSD/64bit/LibMpg123-64.so b/UOS/examples/lib/OpenBSD/64bit/LibMpg123-64.so new file mode 100644 index 0000000..2dfc855 Binary files /dev/null and b/UOS/examples/lib/OpenBSD/64bit/LibMpg123-64.so differ diff --git a/UOS/examples/lib/OpenBSD/64bit/LibPortaudio-64.so b/UOS/examples/lib/OpenBSD/64bit/LibPortaudio-64.so new file mode 100644 index 0000000..ffeb66a Binary files /dev/null and b/UOS/examples/lib/OpenBSD/64bit/LibPortaudio-64.so differ diff --git a/UOS/examples/lib/OpenBSD/64bit/LibSndFile-64.so b/UOS/examples/lib/OpenBSD/64bit/LibSndFile-64.so new file mode 100644 index 0000000..77e3b32 Binary files /dev/null and b/UOS/examples/lib/OpenBSD/64bit/LibSndFile-64.so differ diff --git a/UOS/examples/lib/OpenBSD/64bit/plugin/libSoundTouchDll-64.so b/UOS/examples/lib/OpenBSD/64bit/plugin/libSoundTouchDll-64.so new file mode 100644 index 0000000..e573ca9 Binary files /dev/null and b/UOS/examples/lib/OpenBSD/64bit/plugin/libSoundTouchDll-64.so differ diff --git a/UOS/examples/lib/Windows/32bit/LibFaad2-32.dll b/UOS/examples/lib/Windows/32bit/LibFaad2-32.dll new file mode 100644 index 0000000..f8ec29c Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/LibFaad2-32.dll differ diff --git a/UOS/examples/lib/Windows/32bit/LibMp4ff-32.dll b/UOS/examples/lib/Windows/32bit/LibMp4ff-32.dll new file mode 100644 index 0000000..32d149c Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/LibMp4ff-32.dll differ diff --git a/UOS/examples/lib/Windows/32bit/LibMpg123-32.dll b/UOS/examples/lib/Windows/32bit/LibMpg123-32.dll new file mode 100644 index 0000000..6840cf2 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/LibMpg123-32.dll differ diff --git a/UOS/examples/lib/Windows/32bit/LibOpusFile-32.dll b/UOS/examples/lib/Windows/32bit/LibOpusFile-32.dll new file mode 100644 index 0000000..57dacb5 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/LibOpusFile-32.dll differ diff --git a/UOS/examples/lib/Windows/32bit/LibPortaudio-32.dll b/UOS/examples/lib/Windows/32bit/LibPortaudio-32.dll new file mode 100644 index 0000000..ed09b05 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/LibPortaudio-32.dll differ diff --git a/UOS/examples/lib/Windows/32bit/LibPortaudio-32old.dll b/UOS/examples/lib/Windows/32bit/LibPortaudio-32old.dll new file mode 100644 index 0000000..d661fd9 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/LibPortaudio-32old.dll differ diff --git a/UOS/examples/lib/Windows/32bit/LibSndFile-32.dll b/UOS/examples/lib/Windows/32bit/LibSndFile-32.dll new file mode 100644 index 0000000..e3aa44e Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/LibSndFile-32.dll differ diff --git a/UOS/examples/lib/Windows/32bit/libfdk-aac-32.dll b/UOS/examples/lib/Windows/32bit/libfdk-aac-32.dll new file mode 100644 index 0000000..dc0d7e1 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/libfdk-aac-32.dll differ diff --git a/UOS/examples/lib/Windows/32bit/libgcc_s_dw2-1.dll b/UOS/examples/lib/Windows/32bit/libgcc_s_dw2-1.dll new file mode 100644 index 0000000..99a76cf Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/libgcc_s_dw2-1.dll differ diff --git a/UOS/examples/lib/Windows/32bit/libgcc_s_sjlj-1.dll b/UOS/examples/lib/Windows/32bit/libgcc_s_sjlj-1.dll new file mode 100644 index 0000000..11b8826 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/libgcc_s_sjlj-1.dll differ diff --git a/UOS/examples/lib/Windows/32bit/libogg-0.dll b/UOS/examples/lib/Windows/32bit/libogg-0.dll new file mode 100644 index 0000000..ab7fa5a Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/libogg-0.dll differ diff --git a/UOS/examples/lib/Windows/32bit/libopus-0.dll b/UOS/examples/lib/Windows/32bit/libopus-0.dll new file mode 100644 index 0000000..f867793 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/libopus-0.dll differ diff --git a/UOS/examples/lib/Windows/32bit/libwinpthread-1.dll b/UOS/examples/lib/Windows/32bit/libwinpthread-1.dll new file mode 100644 index 0000000..dfd10c0 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/libwinpthread-1.dll differ diff --git a/UOS/examples/lib/Windows/32bit/libxmp-32.dll b/UOS/examples/lib/Windows/32bit/libxmp-32.dll new file mode 100644 index 0000000..1979407 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/libxmp-32.dll differ diff --git a/UOS/examples/lib/Windows/32bit/plugin/LibBs2b-32.dll b/UOS/examples/lib/Windows/32bit/plugin/LibBs2b-32.dll new file mode 100644 index 0000000..efa882d Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/plugin/LibBs2b-32.dll differ diff --git a/UOS/examples/lib/Windows/32bit/plugin/LibSoundTouch-32.dll b/UOS/examples/lib/Windows/32bit/plugin/LibSoundTouch-32.dll new file mode 100644 index 0000000..2d2bc52 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/plugin/LibSoundTouch-32.dll differ diff --git a/UOS/examples/lib/Windows/32bit/plugin/libgcc_s_dw2-1.dll b/UOS/examples/lib/Windows/32bit/plugin/libgcc_s_dw2-1.dll new file mode 100644 index 0000000..9e32dc2 Binary files /dev/null and b/UOS/examples/lib/Windows/32bit/plugin/libgcc_s_dw2-1.dll differ diff --git a/UOS/examples/lib/Windows/64bit/LibMpg123-64.dll b/UOS/examples/lib/Windows/64bit/LibMpg123-64.dll new file mode 100644 index 0000000..5035e53 Binary files /dev/null and b/UOS/examples/lib/Windows/64bit/LibMpg123-64.dll differ diff --git a/UOS/examples/lib/Windows/64bit/LibPortaudio-64.dll b/UOS/examples/lib/Windows/64bit/LibPortaudio-64.dll new file mode 100644 index 0000000..2aa127e Binary files /dev/null and b/UOS/examples/lib/Windows/64bit/LibPortaudio-64.dll differ diff --git a/UOS/examples/lib/Windows/64bit/LibPortaudio-64old.dll b/UOS/examples/lib/Windows/64bit/LibPortaudio-64old.dll new file mode 100644 index 0000000..55b22fb Binary files /dev/null and b/UOS/examples/lib/Windows/64bit/LibPortaudio-64old.dll differ diff --git a/UOS/examples/lib/Windows/64bit/LibSndFile-64.dll b/UOS/examples/lib/Windows/64bit/LibSndFile-64.dll new file mode 100644 index 0000000..5c92b95 Binary files /dev/null and b/UOS/examples/lib/Windows/64bit/LibSndFile-64.dll differ diff --git a/UOS/examples/lib/Windows/64bit/libfdk-aac-64.dll b/UOS/examples/lib/Windows/64bit/libfdk-aac-64.dll new file mode 100644 index 0000000..9b55822 Binary files /dev/null and b/UOS/examples/lib/Windows/64bit/libfdk-aac-64.dll differ diff --git a/UOS/examples/lib/Windows/64bit/libxmp-64.dll b/UOS/examples/lib/Windows/64bit/libxmp-64.dll new file mode 100644 index 0000000..d5a743f Binary files /dev/null and b/UOS/examples/lib/Windows/64bit/libxmp-64.dll differ diff --git a/UOS/examples/lib/Windows/64bit/plugin/LibSoundTouch-64.dll b/UOS/examples/lib/Windows/64bit/plugin/LibSoundTouch-64.dll new file mode 100644 index 0000000..a446f0b Binary files /dev/null and b/UOS/examples/lib/Windows/64bit/plugin/LibSoundTouch-64.dll differ diff --git a/UOS/examples/librarytester_fpGUI.lpi b/UOS/examples/librarytester_fpGUI.lpi new file mode 100644 index 0000000..7c73ee2 --- /dev/null +++ b/UOS/examples/librarytester_fpGUI.lpi @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasTitleStatement Value="False"/> + <LRSInOutputDirectory Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="UOS Library Tester 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="librarytester_fpGUI.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="librarytester_fpGUI"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="librarytester_fpGUI"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <Optimizations> + <OptimizationLevel Value="3"/> + </Optimizations> + </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> diff --git a/UOS/examples/librarytester_fpGUI.pas b/UOS/examples/librarytester_fpGUI.pas new file mode 100644 index 0000000..06dd9b2 --- /dev/null +++ b/UOS/examples/librarytester_fpGUI.pas @@ -0,0 +1,345 @@ +program librarytester_fpGUI; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} + cthreads, + cwstring, + {$ENDIF} + SysUtils, + dynlibs, + uos_bs2b, + ctypes, + Math, + Classes, + fpg_button, + fpg_widget, + fpg_label, + fpg_Editbtn, + fpg_Panel, + fpg_base, + fpg_main, + fpg_form { you can add units after this }; + +type + TSimpleplayer = class(TfpgForm) + procedure uos_logo(Sender: TObject); + private + {@VFD_HEAD_BEGIN: Simpleplayer} + Custom1: TfpgWidget; + Labelport: TfpgLabel; + btnLoad: TfpgButton; + FilenameEdit1: TfpgFileNameEdit; + FilenameEdit2: TfpgFileNameEdit; + Labelsnf: TfpgLabel; + Labelmpg: TfpgLabel; + Labelst: TfpgLabel; + FilenameEdit3: TfpgFileNameEdit; + FilenameEdit5: TfpgFileNameEdit; + {@VFD_HEAD_END: Simpleplayer} + public + procedure AfterCreate; override; + procedure btnCloseClick(Sender: TObject); + procedure btnLoadClick(Sender: TObject); + end; + + {@VFD_NEWFORM_DECL} + + {@VFD_NEWFORM_IMPL} + +var + ordir, opath: string; + Pa_Handle: TLibHandle = dynlibs.NilHandle; + + procedure TSimpleplayer.btnCloseClick(Sender: TObject); + begin + if Pa_Handle <> DynLibs.NilHandle then + DynLibs.UnloadLibrary(Pa_Handle); + Pa_Handle := DynLibs.NilHandle; + end; + + procedure TSimpleplayer.btnLoadClick(Sender: TObject); + begin + + Pa_Handle := DynLibs.SafeLoadLibrary(FilenameEdit1.FileName); // obtain the handle we want + if Pa_Handle <> DynLibs.NilHandle then + + btnLoad.Text := 'PortAudio=OK ' + else + btnLoad.Text := 'PortAudio not load '; + + if Pa_Handle <> DynLibs.NilHandle then + DynLibs.UnloadLibrary(Pa_Handle); + + Pa_Handle := DynLibs.SafeLoadLibrary(FilenameEdit2.FileName); // obtain the handle we want + if Pa_Handle <> DynLibs.NilHandle then + btnLoad.Text := btnLoad.Text + 'SndFile=OK ' + else + btnLoad.Text := btnLoad.Text + 'SndFile not load '; + + if Pa_Handle <> DynLibs.NilHandle then + DynLibs.UnloadLibrary(Pa_Handle); + + Pa_Handle := DynLibs.SafeLoadLibrary(FilenameEdit3.FileName); // obtain the handle we want + if Pa_Handle <> DynLibs.NilHandle then + btnLoad.Text := btnLoad.Text + 'MPG123=OK ' + else + btnLoad.Text := btnLoad.Text + 'MPG123 not load '; + + if Pa_Handle <> DynLibs.NilHandle then + DynLibs.UnloadLibrary(Pa_Handle); + + Pa_Handle := DynLibs.SafeLoadLibrary(FilenameEdit5.FileName); // obtain the handle we want + if Pa_Handle <> DynLibs.NilHandle then + btnLoad.Text := btnLoad.Text + 'SoundTouch=OK' + else + btnLoad.Text := btnLoad.Text + 'SoundTouch not load'; + + if Pa_Handle <> DynLibs.NilHandle then + DynLibs.UnloadLibrary(Pa_Handle); + + end; + + procedure TSimpleplayer.AfterCreate; + begin + {%region 'Auto-generated GUI code' -fold} + + {@VFD_BODY_BEGIN: Simpleplayer} + Name := 'Simpleplayer'; + SetPosition(491, 214, 502, 206); + WindowTitle := 'Libraries Tester'; + IconName := ''; + BackGroundColor := $80000001; + Hint := ''; + WindowPosition := wpScreenCenter; + Ondestroy := @btnCloseClick; + + Custom1 := TfpgWidget.Create(self); + with Custom1 do + begin + Name := 'Custom1'; + SetPosition(10, 8, 115, 155); + 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, 168, 476, 31); + Text := 'Test to 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; + + 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; + + Labelst := TfpgLabel.Create(self); + with Labelst do + begin + Name := 'Labelst'; + SetPosition(136, 120, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of SoundTouch 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; + + FilenameEdit5 := TfpgFileNameEdit.Create(self); + with FilenameEdit5 do + begin + Name := 'FilenameEdit5'; + SetPosition(136, 136, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 12; + end; + + {@VFD_BODY_END: Simpleplayer} + {%endregion} + + ////////////////////// + + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + Height := 197; + {$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'; + FilenameEdit5.FileName := ordir + 'lib\Windows\64bit\LibSoundTouch-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'; + FilenameEdit5.FileName := ordir + 'lib\Windows\32bit\LibSoundTouch-32.dll'; + {$endif} + + {$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'; + FilenameEdit5.FileName := opath + '/lib/Mac/32bit/LibSoundTouch-32.dylib'; + {$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'; + FilenameEdit5.FileName := ordir + 'lib/Linux/64bit/plugin/LibSoundTouch-64.so'; + {$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'; + FilenameEdit5.FileName := ordir + 'lib/Linux/32bit/plugin/LibSoundTouch-32.so'; + {$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'; + {$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'; + FilenameEdit5 := ordir + 'lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so'; + {$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'; + FilenameEdit5.FileName := ordir + 'lib/FreeBSD/64bit/LibSoundTouch-64.so'; + {$else} + FilenameEdit1.FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + FilenameEdit2.FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + FilenameEdit3.FileName := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + FilenameEdit5.FileName := ordir + 'lib/FreeBSD/32bit/LibSoundTouch-32.so'; +{$endif} + + {$ENDIF} + + FilenameEdit1.Initialdir := ordir + 'lib'; + FilenameEdit2.Initialdir := ordir + 'lib'; + FilenameEdit3.Initialdir := ordir + 'lib'; + FilenameEdit5.Initialdir := ordir + 'lib'; + + end; + + procedure TSimpleplayer.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: TSimpleplayer; + begin + fpgApplication.Initialize; + // frm := TSimpleplayer.Create(nil); + fpgApplication.CreateForm(TSimpleplayer, frm); + try + frm.Show; + fpgApplication.Run; + finally + frm.Free; + end; + end; + +begin + MainProc; +end. + diff --git a/UOS/examples/librarytester_fpGUI.prj b/UOS/examples/librarytester_fpGUI.prj new file mode 100644 index 0000000..5e220c5 --- /dev/null +++ b/UOS/examples/librarytester_fpGUI.prj @@ -0,0 +1,1403 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/librarytester_fpGUI.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=librarytester_fpGUI.pas +targetfile=librarytester_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/librarytester_fpGUI.pas +relpaths=1 + librarytester_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/librarytester_fpGUI.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/main_di.lfm b/UOS/examples/main_di.lfm new file mode 100644 index 0000000..a1fafc8 --- /dev/null +++ b/UOS/examples/main_di.lfm @@ -0,0 +1,234 @@ +object Form1: TForm1 + Left = 112 + Height = 687 + Top = 21 + Width = 1374 + BorderIcons = [biSystemMenu] + Caption = 'Devices Infos' + ClientHeight = 687 + ClientWidth = 1374 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '3.0.0.3' + object Edit1: TEdit + Left = 424 + Height = 27 + Top = 32 + Width = 552 + Alignment = taCenter + AutoSize = False + TabOrder = 1 + end + object Label1: TLabel + Left = 524 + Height = 18 + Top = 16 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object PaintBox1: TPaintBox + Left = 280 + Height = 105 + Top = 8 + Width = 105 + OnPaint = PaintBox1Paint + end + object Button1: TButton + Left = 424 + Height = 28 + Top = 71 + Width = 554 + Caption = 'Load that library' + TabOrder = 0 + OnClick = Button1Click + end + object StringGrid1: TStringGrid + Left = 8 + Height = 504 + Top = 128 + Width = 1360 + ColCount = 13 + FixedCols = 0 + Font.Height = 12 + ParentFont = False + TabOrder = 2 + ColWidths = ( + 36 + 262 + 83 + 95 + 61 + 73 + 64 + 110 + 121 + 106 + 121 + 142 + 64 + ) + Cells = ( + 13 + 0 + 0 + 'Dev ' + 1 + 0 + 'Name' + 2 + 0 + 'Default IN' + 3 + 0 + 'Default OUT' + 4 + 0 + 'Chan IN' + 5 + 0 + 'Chan OUT' + 6 + 0 + 'S Rate' + 7 + 0 + 'Latency High In' + 8 + 0 + 'Latency High Out' + 9 + 0 + 'Latency Low In' + 10 + 0 + 'Latency Low Out' + 11 + 0 + 'Host API' + 12 + 0 + 'Type' + ) + end + object Button2: TButton + Left = 960 + Height = 25 + Top = 640 + Width = 83 + Caption = 'Re-load' + TabOrder = 3 + OnClick = Button2Click + end + object Label2: TLabel + Left = 176 + Height = 15 + Top = 650 + Width = 118 + Caption = 'Device Count = 99' + Font.Height = 12 + ParentColor = False + ParentFont = False + end + object Label3: TLabel + Left = 440 + Height = 15 + Top = 650 + Width = 146 + Caption = 'Default Device IN = 99' + Font.Height = 12 + ParentColor = False + ParentFont = False + end + object Label4: TLabel + Left = 672 + Height = 15 + Top = 650 + Width = 158 + Caption = 'Default Device OUT = 99' + Font.Height = 12 + ParentColor = False + ParentFont = False + end +end diff --git a/UOS/examples/main_di.pas b/UOS/examples/main_di.pas new file mode 100644 index 0000000..755cfa0 --- /dev/null +++ b/UOS/examples/main_di.pas @@ -0,0 +1,276 @@ + +/////////////////// Demo how to use United Openlib of Sound //////////////////// + + +unit main_di; + +{$mode objfpc}{$H+} + +interface + +uses + uos_flat, + Forms, + Dialogs, + SysUtils, + Graphics, + StdCtrls, + ExtCtrls, + Grids, + Classes; + +type + { TForm1 } + TForm1 = class(TForm) + Button1: TButton; + Button2: TButton; + Edit1: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + PaintBox1: TPaintBox; + StringGrid1: TStringGrid; + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + procedure CheckInfos(); + private + { private declarations } + public + { public declarations } + end; + + +procedure uos_logo(); + +var + Form1: TForm1; + BufferBMP: TBitmap; + +implementation + +{$R *.lfm} + +{ TForm1 } + + +procedure TForm1.FormActivate(Sender: TObject); +{$IFDEF Darwin} +var + opath: string; + {$ENDIF} +begin + uos_logo(); + {$IFDEF Windows} + {$if defined(cpu64)} + edit1.Text := application.Location + 'lib\Windows\64bit\LibPortaudio-64.dll'; +{$else} + edit1.Text := application.Location + 'lib\Windows\32bit\LibPortaudio-32.dll'; + {$endif} + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := application.Location; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + {$ENDIF} + {$IFDEF CPU64} + opath := application.Location; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + {$ENDIF} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + edit1.Text := application.Location + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + edit1.Text := application.Location + 'lib/Linux/64bit/LibPortaudio-64.so'; + {$endif} + +{$if defined(cpu86) and defined(linux)} + edit1.Text := application.Location + 'lib/Linux/32bit/LibPortaudio-32.so'; +{$endif} + + {$if defined(linux) and defined(cpuarm)} + edit1.Text := application.Location + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; +{$endif} + + {$if defined(linux) and defined(cpuaarch64)} + edit1.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + edit1.Text := application.Location + 'lib/FreeBSD/64bit/libportaudio-64.so'; +{$else} + edit1.Text := application.Location + 'lib/FreeBSD/32bit/libportaudio-32.so'; +{$endif} + + {$ENDIF} + ////////////////////////////////////////////////////////////////////////// + +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.CheckInfos(); +var + x: integer; +begin + + uos_GetInfoDevice(); + + label2.Caption := 'Devices Count = ' + IntToStr(uosDeviceCount); + + label3.Caption := 'Default Device IN = ' + IntToStr(uosDefaultDeviceIN); + + label4.Caption := 'Default Device OUT = ' + IntToStr(uosDefaultDeviceOUT); + + stringgrid1.rowcount := uosDeviceCount + 1; + + + x := 1; + + while x < uosDeviceCount + 1 do + begin + + stringgrid1.Cells[0, x] := IntToStr(uosDeviceInfos[x - 1].DeviceNum); + stringgrid1.Cells[1, x] := uosDeviceInfos[x - 1].DeviceName; + if uosDeviceInfos[x - 1].DefaultDevIn = True then + stringgrid1.Cells[2, x] := 'Yes' + else + stringgrid1.Cells[2, x] := 'No'; + + if uosDeviceInfos[x - 1].DefaultDevOut = True then + stringgrid1.Cells[3, x] := 'Yes' + else + stringgrid1.Cells[3, x] := 'No'; + + stringgrid1.Cells[4, x] := IntToStr(uosDeviceInfos[x - 1].ChannelsIn); + stringgrid1.Cells[5, x] := IntToStr(uosDeviceInfos[x - 1].ChannelsOut); + stringgrid1.Cells[6, x] := floattostrf(uosDeviceInfos[x - 1].SampleRate, ffFixed, 15, 0); + stringgrid1.Cells[7, x] := floattostrf(uosDeviceInfos[x - 1].LatencyHighIn, ffFixed, 15, 8); + stringgrid1.Cells[8, x] := floattostrf(uosDeviceInfos[x - 1].LatencyHighOut, + ffFixed, 15, 8); + stringgrid1.Cells[9, x] := floattostrf(uosDeviceInfos[x - 1].LatencyLowIn, ffFixed, 15, 8); + stringgrid1.Cells[10, x] := + floattostrf(uosDeviceInfos[x - 1].LatencyLowOut, ffFixed, 15, 8); + stringgrid1.Cells[11, x] := uosDeviceInfos[x - 1].HostAPIName; + stringgrid1.Cells[12, x] := uosDeviceInfos[x - 1].DeviceType; + + Inc(x); + end; + +end; + + +procedure TForm1.Button1Click(Sender: TObject); +begin + // Load the library + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + + if uos_LoadLib(PChar(edit1.Text), nil, nil, nil, nil, nil, nil) = 0 then + begin + form1.hide; + button1.Caption := 'PortAudio is loaded...'; + button1.Enabled := False; + edit1.ReadOnly := True; + + CheckInfos(); + form1.Height := 688; + form1.Position := poScreenCenter; + form1.Show; + end + else + begin + if uosLoadResult.PAloaderror = 1 then + MessageDlg(edit1.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.PAloaderror = 2 then + MessageDlg(edit1.Text + ' do not load...', mtWarning, [mbYes], 0); + end; +end; + +procedure TForm1.Button2Click(Sender: TObject); +begin + CheckInfos(); +end; + + +procedure uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + Form1.Height := 126; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + if button1.Enabled = False then + uos_free; +end; + +end. + diff --git a/UOS/examples/main_fp.lfm b/UOS/examples/main_fp.lfm new file mode 100644 index 0000000..03deedb --- /dev/null +++ b/UOS/examples/main_fp.lfm @@ -0,0 +1,527 @@ +object Form1: TForm1 + Left = 232 + Height = 363 + Top = 133 + Width = 506 + BorderIcons = [biSystemMenu] + Caption = 'Player with Filters U0S PortAudio + SndFile + Mpg123' + ClientHeight = 363 + ClientWidth = 506 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '2.0.10.0' + object Shape3: TShape + Left = 8 + Height = 65 + Top = 284 + Width = 490 + Brush.Color = clSilver + end + object Shape2: TShape + Left = 240 + Height = 130 + Top = 147 + Width = 250 + Brush.Color = clSilver + end + object Shape1: TShape + Left = 32 + Height = 130 + Top = 147 + Width = 200 + Brush.Color = clSilver + OnChangeBounds = Shape1ChangeBounds + end + object RadioGroup1: TRadioGroup + Left = 248 + Height = 119 + Top = 151 + Width = 140 + AutoFill = True + Caption = 'Filters' + ChildSizing.LeftRightSpacing = 6 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize + ChildSizing.EnlargeVertical = crsHomogenousChildResize + ChildSizing.ShrinkHorizontal = crsScaleChilds + ChildSizing.ShrinkVertical = crsScaleChilds + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 1 + ClientHeight = 98 + ClientWidth = 136 + TabOrder = 16 + object RadioButton1: TRadioButton + Tag = 2 + Left = 6 + Height = 22 + Top = 6 + Width = 124 + Caption = 'BandReject' + Checked = True + OnChange = RadioButton1Change + TabOrder = 0 + TabStop = True + end + object RadioButton2: TRadioButton + Tag = 3 + Left = 6 + Height = 22 + Top = 28 + Width = 124 + Caption = 'BandPass' + OnChange = RadioButton1Change + TabOrder = 1 + end + object RadioButton3: TRadioButton + Tag = 4 + Left = 6 + Height = 21 + Top = 50 + Width = 124 + Caption = 'LowPass' + OnChange = RadioButton1Change + TabOrder = 2 + end + object RadioButton4: TRadioButton + Tag = 5 + Left = 6 + Height = 21 + Top = 71 + Width = 124 + Caption = 'HighPass' + OnChange = RadioButton1Change + TabOrder = 3 + end + end + object Edit1: TEdit + Left = 132 + Height = 27 + Top = 14 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 2 + end + object Edit2: TEdit + Left = 132 + Height = 27 + Top = 54 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 4 + end + object Edit3: TEdit + Left = 132 + Height = 27 + Top = 94 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 5 + end + object Label1: TLabel + Left = 130 + Height = 18 + Top = 0 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label2: TLabel + Left = 130 + Height = 18 + Top = 40 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of SndFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label3: TLabel + Left = 132 + Height = 18 + Top = 80 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Mpg123 Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit4: TEdit + Left = 12 + Height = 27 + Top = 288 + Width = 474 + Alignment = taCenter + AutoSize = False + TabOrder = 3 + end + object CheckBox1: TCheckBox + Left = 55 + Height = 18 + Top = 256 + Width = 163 + Caption = 'Enable Stereo Equalizer' + Checked = True + Font.Height = 12 + OnChange = CheckBox1Change + ParentFont = False + State = cbChecked + TabOrder = 6 + end + object PaintBox1: TPaintBox + Left = 17 + Height = 105 + Top = 8 + Width = 105 + OnPaint = PaintBox1Paint + end + object Label4: TLabel + Left = 56 + Height = 14 + Top = 244 + Width = 22 + Alignment = taCenter + Caption = 'Low' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object TrackBar1: TTrackBar + Left = 40 + Height = 90 + Hint = 'Right Channel' + Top = 152 + Width = 25 + Max = 100 + Min = -100 + OnChange = TrackBar1Change + Orientation = trVertical + Position = 0 + Reversed = True + TickStyle = tsNone + ParentShowHint = False + ShowHint = True + TabOrder = 7 + end + object Button1: TButton + Left = 11 + Height = 20 + Top = 125 + Width = 483 + Caption = 'Load that libraries' + OnClick = Button1Click + TabOrder = 1 + end + object Button3: TButton + Left = 176 + Height = 23 + Top = 322 + Width = 42 + Caption = 'Play' + Font.Height = 12 + OnClick = Button3Click + ParentFont = False + TabOrder = 0 + end + object Button4: TButton + Left = 306 + Height = 23 + Top = 322 + Width = 66 + Caption = 'Resume' + Enabled = False + Font.Height = 12 + OnClick = Button4Click + ParentFont = False + TabOrder = 8 + end + object Button5: TButton + Left = 248 + Height = 23 + Top = 322 + Width = 44 + Caption = 'Pause' + Enabled = False + Font.Height = 12 + OnClick = Button5Click + ParentFont = False + TabOrder = 9 + end + object Button6: TButton + Left = 375 + Height = 23 + Top = 322 + Width = 47 + Caption = 'Stop' + Enabled = False + Font.Height = 12 + OnClick = Button6Click + ParentFont = False + TabOrder = 10 + end + object Button2: TButton + Left = 24 + Height = 23 + Top = 320 + Width = 58 + Caption = 'Choose' + Font.Height = 12 + OnClick = Button2Click + ParentFont = False + TabOrder = 11 + end + object TrackBar2: TTrackBar + Left = 112 + Height = 90 + Hint = 'Left Channel' + Top = 152 + Width = 23 + Max = 100 + Min = -100 + OnChange = TrackBar2Change + Orientation = trVertical + Position = 0 + Reversed = True + TickStyle = tsNone + ParentShowHint = False + ShowHint = True + TabOrder = 12 + end + object Label5: TLabel + Left = 112 + Height = 14 + Top = 244 + Width = 44 + Alignment = taCenter + Caption = 'Medium' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object TrackBar3: TTrackBar + Left = 176 + Height = 90 + Hint = 'Left Channel' + Top = 152 + Width = 22 + Max = 100 + Min = -100 + OnChange = TrackBar3Change + Orientation = trVertical + Position = 0 + Reversed = True + TickStyle = tsNone + ParentShowHint = False + ShowHint = True + TabOrder = 13 + end + object Label6: TLabel + Left = 184 + Height = 14 + Top = 244 + Width = 25 + Alignment = taCenter + Caption = 'High' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit5: TEdit + Left = 400 + Height = 29 + Top = 168 + Width = 80 + TabOrder = 14 + Text = '15000' + end + object Label7: TLabel + Left = 397 + Height = 14 + Top = 154 + Width = 87 + Alignment = taCenter + Caption = 'High Frequency' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit6: TEdit + Left = 400 + Height = 29 + Top = 216 + Width = 80 + TabOrder = 15 + Text = '5000' + end + object Label8: TLabel + Left = 400 + Height = 14 + Top = 200 + Width = 84 + Alignment = taCenter + Caption = 'Low Frequency' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object CheckBox2: TCheckBox + Left = 390 + Height = 18 + Top = 252 + Width = 94 + Caption = 'Enable Filter' + Font.Height = 12 + OnChange = RadioButton1Change + ParentFont = False + TabOrder = 17 + end + object TrackBar3R: TTrackBar + Left = 200 + Height = 90 + Hint = 'Right Channel' + Top = 152 + Width = 22 + Max = 100 + Min = -100 + OnChange = TrackBar3Change + Orientation = trVertical + Position = 0 + Reversed = True + TickStyle = tsNone + ParentShowHint = False + ShowHint = True + TabOrder = 18 + end + object TrackBar2R: TTrackBar + Left = 136 + Height = 90 + Hint = 'Right Channel' + Top = 152 + Width = 23 + Max = 100 + Min = -100 + OnChange = TrackBar2Change + Orientation = trVertical + Position = 0 + Reversed = True + TickStyle = tsNone + ParentShowHint = False + ShowHint = True + TabOrder = 19 + end + object TrackBar1R: TTrackBar + Left = 64 + Height = 90 + Hint = 'Left Channel' + Top = 152 + Width = 25 + Max = 100 + Min = -100 + OnChange = TrackBar1Change + Orientation = trVertical + Position = 0 + Reversed = True + TickStyle = tsNone + ParentShowHint = False + ShowHint = True + TabOrder = 20 + end + object OpenDialog1: TOpenDialog + Left = 76 + Top = 36 + end +end diff --git a/UOS/examples/main_fp.pas b/UOS/examples/main_fp.pas new file mode 100644 index 0000000..471933b --- /dev/null +++ b/UOS/examples/main_fp.pas @@ -0,0 +1,580 @@ + +/////////////////// Demo how to use United Openlib of Sound //////////////////// + + +unit main_fp; + +{$mode objfpc}{$H+} + +interface + +uses + uos_flat, + Forms, + Dialogs, + SysUtils, + Graphics, + StdCtrls, + ComCtrls, + ExtCtrls, + Classes, + Controls; + +type + { TForm1 } + TForm1 = class(TForm) + Button1: TButton; + Button2: TButton; + Button3: TButton; + Button4: TButton; + Button5: TButton; + Button6: TButton; + CheckBox1: TCheckBox; + CheckBox2: TCheckBox; + Edit1: TEdit; + Edit2: TEdit; + Edit3: TEdit; + Edit4: TEdit; + Edit5: TEdit; + Edit6: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + OpenDialog1: TOpenDialog; + PaintBox1: TPaintBox; + RadioButton1: TRadioButton; + RadioButton2: TRadioButton; + RadioButton3: TRadioButton; + RadioButton4: TRadioButton; + RadioGroup1: TRadioGroup; + Shape1: TShape; + Shape2: TShape; + Shape3: TShape; + TrackBar1: TTrackBar; + TrackBar2: TTrackBar; + TrackBar3: TTrackBar; + TrackBar3R: TTrackBar; + TrackBar2R: TTrackBar; + TrackBar1R: TTrackBar; + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure Button5Click(Sender: TObject); + procedure Button6Click(Sender: TObject); + procedure CheckBox1Change(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + procedure RadioButton1Change(Sender: TObject); + procedure Shape1ChangeBounds(Sender: TObject); + procedure TrackBar1Change(Sender: TObject); + procedure TrackBar2Change(Sender: TObject); + procedure ClosePlayer1; + procedure TrackBar3Change(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +procedure uos_logo(); + +var + test: ttimer; + Form1: TForm1; + BufferBMP: TBitmap; + PlayerIndex1: cardinal; + Out1Index, In1Index, EQIndex1, EQIndex2, EQIndex3, FTIndex1: integer; + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.ClosePlayer1; +begin + Form1.button3.Enabled := True; + Form1.button4.Enabled := False; + Form1.button5.Enabled := False; + Form1.button6.Enabled := False; +end; + +procedure TForm1.TrackBar3Change(Sender: TObject); +var + gainl, gainr: double; + tracposl, tracposr: integer; +begin + tracposl := trackBar3.Position; + tracposr := trackBar3r.Position; + + if (tracposl) = 0 then + gainl := 1 + else if tracposl > 0 then + gainl := 1 + (tracposl / 33) + else + gainl := ((100 + tracposl) / 100); + + if (tracposr) = 0 then + gainr := 1 + else if tracposr > 0 then + gainr := 1 + (tracposr / 33) + else + gainr := ((100 + tracposr) / 100); + + uos_InputSetFilter(PlayerIndex1, In1Index, EQIndex3, -1, -1, -1, Gainl, -1, -1, -1, Gainr, + True, nil, checkbox1.Checked); + +end; + +procedure TForm1.FormActivate(Sender: TObject); +var + ordir: string; +{$IFDEF Darwin} + opath: string; +{$ENDIF} +begin + ordir := application.Location; + uos_logo(); + {$IFDEF Windows} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + Edit2.Text := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + Edit3.Text := ordir + 'lib\Windows\64bit\LibMpg123-64.dll'; + {$else} + Edit1.Text := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + Edit2.Text := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + Edit3.Text := ordir + 'lib\Windows\32bit\LibMpg123-32.dll'; + {$endif} + Edit4.Text := ordir + 'sound\test.mp3'; + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + Edit2.Text := opath + '/lib/Mac/32bit/LibSndFile-32.dylib'; + Edit3.Text := opath + '/lib/Mac/32bit/LibMpg123-32.dylib'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + Edit2.Text := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + Edit3.Text := opath + '/lib/Mac/64bit/LibMpg123-64.dylib'; + Edit4.Text := ordir + 'sound/test.ogg'; + {$ENDIF} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + Edit1.Text := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/Linux/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + Edit1.Text := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + +{$if defined(cpu86) and defined(linux)} + Edit1.Text := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + Edit2.Text := ordir + 'lib/Linux/32bit/LibSndFile-32.so'; + Edit3.Text := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + {$if defined(linux) and defined(cpuaarch64)} + Edit1.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + Edit2.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + Edit3.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + {$if defined(linux) and defined(cpuarm)} + Edit1.Text := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + Edit2.Text := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + Edit3.Text := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + Edit3.Text := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so'; + Edit2.Text := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + {$else} + Edit1.Text := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + Edit2.Text := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + Edit3.Text := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + {$endif} + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + + opendialog1.Initialdir := application.Location + 'sound'; +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.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; + + uos_InputSetFilter(PlayerIndex1, In1Index, FTIndex1, + typfilt, StrToInt(edit6.Text), StrToInt(edit5.Text), 1, + typfilt, StrToInt(edit6.Text), StrToInt(edit5.Text), 1, + True, nil, checkbox2.Checked); +end; + +procedure TForm1.Shape1ChangeBounds(Sender: TObject); +begin + +end; + + +procedure TForm1.TrackBar1Change(Sender: TObject); +var + gainl, gainr: double; + tracposl, tracposr: integer; +begin + tracposl := trackBar1.Position; + tracposr := trackBar1r.Position; + + if (tracposl) = 0 then + gainl := 1 + else if tracposl > 0 then + gainl := 1 + (tracposl / 33) + else + gainl := ((100 + tracposl) / 100); + + if (tracposr) = 0 then + gainr := 1 + else if tracposr > 0 then + gainr := 1 + (tracposr / 33) + else + gainr := ((100 + tracposr) / 100); + + // if (btnStart.Enabled = true) then + uos_InputSetFilter(PlayerIndex1, In1Index, EQIndex1, -1, -1, -1, Gainl, -1, -1, -1, Gainr, + True, nil, checkbox1.Checked); + +end; + + +procedure TForm1.TrackBar2Change(Sender: TObject); +var + gainl, gainr: double; + tracposl, tracposr: integer; +begin + tracposl := trackBar2.Position; + tracposr := trackBar2r.Position; + + if (tracposl) = 0 then + gainl := 1 + else if tracposl > 0 then + gainl := 1 + (tracposl / 33) + else + gainl := ((100 + tracposl) / 100); + + if (tracposr) = 0 then + gainr := 1 + else if tracposr > 0 then + gainr := 1 + (tracposr / 33) + else + gainr := ((100 + tracposr) / 100); + + uos_InputSetFilter(PlayerIndex1, In1Index, EQIndex2, -1, -1, -1, Gainl, -1, -1, -1, Gainr, + True, nil, checkbox1.Checked); +end; + +procedure TForm1.Button1Click(Sender: TObject); +begin + +{$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so +if (Edit2.Text <> 'system') and (Edit2.Text <> '') then + if uos_TestLoadLibrary(PChar(edit2.Text)) = false then + edit2.Text := edit2.Text + '.2'; +{$endif} + + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + if uos_LoadLib(PChar(edit1.Text), PChar(edit2.Text), PChar(edit3.Text), nil, nil, nil, nil) = 0 then + begin + form1.hide; + button1.Caption := 'PortAudio, SndFile and Mpg123 libraries are loaded...'; + button1.Enabled := False; + edit1.ReadOnly := True; + edit2.ReadOnly := True; + edit3.ReadOnly := True; + form1.Height := 352; + form1.Position := poScreenCenter; + form1.Show; + end + else + begin + if uosLoadResult.PAloaderror = 1 then + MessageDlg(edit1.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.PAloaderror = 2 then + MessageDlg(edit1.Text + ' do not load...', mtWarning, [mbYes], 0); + if uosLoadResult.SFloaderror = 1 then + MessageDlg(edit2.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.SFloaderror = 2 then + MessageDlg(edit2.Text + ' do not load...', mtWarning, [mbYes], 0); + if uosLoadResult.MPloaderror = 1 then + MessageDlg(edit3.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.MPloaderror = 2 then + MessageDlg(edit3.Text + ' do not load...', mtWarning, [mbYes], 0); + end; +end; + +procedure TForm1.Button5Click(Sender: TObject); +begin + uos_Pause(PlayerIndex1); + Button4.Enabled := True; + Button5.Enabled := False; +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin + uos_RePlay(PlayerIndex1); + ; + Button4.Enabled := False; + Button5.Enabled := True; + Button6.Enabled := True; +end; + +procedure TForm1.Button3Click(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... + + uos_CreatePlayer(PlayerIndex1); + //// 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(Edit4.Text), -1, 0, -1); + //// add input from audio file with custom parameters + //////////// PlayerIndex : Index of a existing Player + ////////// FileName : filename of audio file + ////////// 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) + + if In1Index > -1 then + begin + + {$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 := 4; + if radiobutton4.Checked = True then + typfilt := 5; + + FTIndex1 := uos_InputAddFilter(PlayerIndex1, In1Index, + typfilt, StrToInt(edit6.Text), StrToInt(edit5.Text), 1, + typfilt, StrToInt(edit6.Text), StrToInt(edit5.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 + + TrackBar1Change(Sender); + TrackBar2Change(Sender); + TrackBar3Change(Sender); + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets play it... + + trackbar2.Enabled := True; + Button3.Enabled := False; + Button4.Enabled := False; + Button6.Enabled := True; + Button5.Enabled := True; + CheckBox1.Enabled := True; + + end; +end; + +procedure TForm1.Button6Click(Sender: TObject); +begin + uos_Stop(PlayerIndex1); +end; + +procedure TForm1.Button2Click(Sender: TObject); +begin + if opendialog1.Execute then + Edit4.Text := opendialog1.FileName; +end; + +procedure TForm1.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 uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + Form1.Height := 150; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + if (button3.Enabled = False) then + begin + button6.Click; + sleep(500); + end; + if button1.Enabled = False then + uos_free; +end; + +end. + diff --git a/UOS/examples/main_mi.lfm b/UOS/examples/main_mi.lfm new file mode 100644 index 0000000..8bfab0c --- /dev/null +++ b/UOS/examples/main_mi.lfm @@ -0,0 +1,728 @@ +object Form1: TForm1 + Left = 236 + Height = 476 + Top = 103 + Width = 993 + BorderIcons = [biSystemMenu] + Caption = 'Multi Input into one Player' + ClientHeight = 476 + ClientWidth = 993 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '2.0.10.0' + object Shape6: TShape + Left = 502 + Height = 65 + Top = 360 + Width = 481 + Brush.Color = clYellow + end + object Shape5: TShape + Left = 11 + Height = 44 + Top = 428 + Width = 972 + Brush.Color = clRed + end + object Shape4: TShape + Left = 12 + Height = 65 + Top = 360 + Width = 483 + Brush.Color = clYellow + end + object Shape3: TShape + Left = 11 + Height = 65 + Top = 292 + Width = 483 + Brush.Color = clLime + end + object Shape2: TShape + Left = 10 + Height = 68 + Top = 220 + Width = 483 + Brush.Color = clFuchsia + end + object Shape1: TShape + Left = 11 + Height = 66 + Top = 150 + Width = 483 + Brush.Color = clAqua + end + object Edit1: TEdit + Left = 389 + Height = 27 + Top = 14 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 1 + end + object Edit2: TEdit + Left = 389 + Height = 27 + Top = 54 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 2 + end + object Label1: TLabel + Left = 376 + Height = 18 + Top = 0 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label2: TLabel + Left = 384 + Height = 18 + Top = 40 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of SndFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit4: TEdit + Left = 101 + Height = 27 + Top = 158 + Width = 387 + Alignment = taCenter + AutoSize = False + TabOrder = 3 + end + object Button3: TButton + Left = 856 + Height = 25 + Top = 438 + Width = 54 + Caption = 'Stop' + Enabled = False + OnClick = Button3Click + TabOrder = 4 + end + object Button4: TButton + Left = 26 + Height = 25 + Top = 158 + Width = 70 + Caption = 'Choose' + OnClick = Button4Click + TabOrder = 5 + end + object Edit5: TEdit + Left = 100 + Height = 27 + Top = 226 + Width = 387 + Alignment = taCenter + AutoSize = False + TabOrder = 6 + end + object Button7: TButton + Left = 22 + Height = 25 + Top = 228 + Width = 70 + Caption = 'Choose' + OnClick = Button7Click + TabOrder = 7 + end + object Edit6: TEdit + Left = 100 + Height = 27 + Top = 296 + Width = 387 + Alignment = taCenter + AutoSize = False + TabOrder = 8 + end + object Button10: TButton + Left = 24 + Height = 25 + Top = 296 + Width = 70 + Caption = 'Choose' + OnClick = Button10Click + TabOrder = 9 + end + object Edit7: TEdit + Left = 100 + Height = 27 + Top = 365 + Width = 387 + Alignment = taCenter + AutoSize = False + TabOrder = 10 + end + object Button14: TButton + Left = 488 + Height = 25 + Top = 438 + Width = 176 + Caption = 'Play All Together' + OnClick = Button14Click + TabOrder = 11 + end + object Button15: TButton + Left = 680 + Height = 25 + Top = 438 + Width = 62 + Caption = 'Pause' + Enabled = False + OnClick = Button15Click + TabOrder = 12 + end + object Button16: TButton + Left = 760 + Height = 25 + Top = 438 + Width = 73 + Caption = 'Resume' + Enabled = False + OnClick = Button16Click + TabOrder = 13 + end + object PaintBox1: TPaintBox + Left = 184 + Height = 105 + Top = 24 + Width = 105 + OnPaint = PaintBox1Paint + end + object Button1: TButton + Left = 389 + Height = 24 + Top = 124 + Width = 360 + Caption = 'Load that libraries' + OnClick = Button1Click + TabOrder = 0 + end + object Button13: TButton + Left = 28 + Height = 25 + Top = 367 + Width = 64 + Caption = 'Choose' + OnClick = Button13Click + TabOrder = 14 + end + object TrackBar1: TTrackBar + Left = 150 + Height = 41 + Top = 178 + Width = 230 + Max = 100 + OnChange = TrackBar1Change + Position = 100 + TickStyle = tsNone + TabOrder = 15 + end + object TrackBar2: TTrackBar + Left = 156 + Height = 41 + Top = 250 + Width = 230 + Max = 100 + OnChange = TrackBar2Change + Position = 100 + TickStyle = tsNone + TabOrder = 16 + end + object TrackBar3: TTrackBar + Left = 158 + Height = 41 + Top = 320 + Width = 230 + Max = 100 + OnChange = TrackBar3Change + Position = 100 + TickStyle = tsNone + TabOrder = 17 + end + object TrackBar4: TTrackBar + Left = 158 + Height = 41 + Top = 384 + Width = 230 + Max = 100 + OnChange = TrackBar4Change + Position = 100 + TickStyle = tsNone + TabOrder = 18 + end + object Label4: TLabel + Left = 54 + Height = 14 + Top = 192 + Width = 85 + Alignment = taCenter + Caption = 'Volume Input 1' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label5: TLabel + Left = 58 + Height = 14 + Top = 262 + Width = 85 + Alignment = taCenter + Caption = 'Volume Input 2' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label6: TLabel + Left = 58 + Height = 14 + Top = 334 + Width = 85 + Alignment = taCenter + Caption = 'Volume Input 3' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label7: TLabel + Left = 58 + Height = 14 + Top = 400 + Width = 85 + Alignment = taCenter + Caption = 'Volume Input 4' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object TrackBar5: TTrackBar + Left = 647 + Height = 41 + Top = 384 + Width = 230 + Max = 100 + OnChange = TrackBar5Change + Position = 100 + TickStyle = tsNone + TabOrder = 19 + end + object Shape7: TShape + Left = 500 + Height = 65 + Top = 292 + Width = 483 + Brush.Color = clLime + end + object Shape8: TShape + Left = 500 + Height = 68 + Top = 220 + Width = 483 + Brush.Color = clFuchsia + end + object Shape9: TShape + Left = 500 + Height = 66 + Top = 150 + Width = 483 + Brush.Color = clAqua + end + object Edit8: TEdit + Left = 590 + Height = 27 + Top = 158 + Width = 387 + Alignment = taCenter + AutoSize = False + TabOrder = 20 + end + object Button5: TButton + Left = 515 + Height = 25 + Top = 158 + Width = 70 + Caption = 'Choose' + OnClick = Button5Click + TabOrder = 21 + end + object Edit9: TEdit + Left = 589 + Height = 27 + Top = 226 + Width = 387 + Alignment = taCenter + AutoSize = False + TabOrder = 22 + end + object Button8: TButton + Left = 511 + Height = 25 + Top = 228 + Width = 70 + Caption = 'Choose' + OnClick = Button8Click + TabOrder = 23 + end + object Edit10: TEdit + Left = 589 + Height = 27 + Top = 296 + Width = 387 + Alignment = taCenter + AutoSize = False + TabOrder = 24 + end + object Button11: TButton + Left = 513 + Height = 25 + Top = 296 + Width = 70 + Caption = 'Choose' + OnClick = Button11Click + TabOrder = 25 + end + object Edit11: TEdit + Left = 589 + Height = 27 + Top = 365 + Width = 387 + Alignment = taCenter + AutoSize = False + TabOrder = 26 + end + object Button17: TButton + Left = 517 + Height = 25 + Top = 367 + Width = 64 + Caption = 'Choose' + OnClick = Button17Click + TabOrder = 27 + end + object TrackBar6: TTrackBar + Left = 647 + Height = 41 + Top = 175 + Width = 230 + Max = 100 + OnChange = TrackBar6Change + Position = 100 + TickStyle = tsNone + TabOrder = 28 + end + object TrackBar7: TTrackBar + Left = 647 + Height = 41 + Top = 248 + Width = 230 + Max = 100 + OnChange = TrackBar7Change + Position = 100 + TickStyle = tsNone + TabOrder = 29 + end + object TrackBar8: TTrackBar + Left = 648 + Height = 41 + Top = 320 + Width = 230 + Max = 100 + OnChange = TrackBar8Change + Position = 100 + TickStyle = tsNone + TabOrder = 30 + end + object Label8: TLabel + Left = 543 + Height = 14 + Top = 192 + Width = 85 + Alignment = taCenter + Caption = 'Volume Input 5' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label9: TLabel + Left = 547 + Height = 14 + Top = 262 + Width = 85 + Alignment = taCenter + Caption = 'Volume Input 6' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label10: TLabel + Left = 547 + Height = 14 + Top = 334 + Width = 85 + Alignment = taCenter + Caption = 'Volume Input 7' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label11: TLabel + Left = 547 + Height = 14 + Top = 400 + Width = 85 + Alignment = taCenter + Caption = 'Volume Input 8' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Button2: TButton + Left = 416 + Height = 25 + Top = 438 + Width = 55 + Caption = 'Load' + OnClick = Button2Click + TabOrder = 31 + end + object CheckBox1: TCheckBox + Left = 396 + Height = 21 + Top = 188 + Width = 87 + Caption = 'Enabled' + Checked = True + OnChange = CheckBox1Change + State = cbChecked + TabOrder = 32 + end + object CheckBox2: TCheckBox + Left = 396 + Height = 21 + Top = 258 + Width = 87 + Caption = 'Enabled' + Checked = True + OnChange = CheckBox2Change + State = cbChecked + TabOrder = 33 + end + object CheckBox3: TCheckBox + Left = 890 + Height = 21 + Top = 186 + Width = 87 + Caption = 'Enabled' + Checked = True + OnChange = CheckBox3Change + State = cbChecked + TabOrder = 34 + end + object CheckBox4: TCheckBox + Left = 890 + Height = 21 + Top = 258 + Width = 87 + Caption = 'Enabled' + Checked = True + OnChange = CheckBox4Change + State = cbChecked + TabOrder = 35 + end + object CheckBox5: TCheckBox + Left = 396 + Height = 21 + Top = 328 + Width = 87 + Caption = 'Enabled' + Checked = True + OnChange = CheckBox5Change + State = cbChecked + TabOrder = 36 + end + object CheckBox6: TCheckBox + Left = 396 + Height = 21 + Top = 394 + Width = 87 + Caption = 'Enabled' + Checked = True + OnChange = CheckBox6Change + State = cbChecked + TabOrder = 37 + end + object CheckBox7: TCheckBox + Left = 892 + Height = 21 + Top = 328 + Width = 87 + Caption = 'Enabled' + Checked = True + OnChange = CheckBox7Change + State = cbChecked + TabOrder = 38 + end + object CheckBox8: TCheckBox + Left = 892 + Height = 21 + Top = 394 + Width = 87 + Caption = 'Enabled' + Checked = True + OnChange = CheckBox8Change + State = cbChecked + TabOrder = 39 + end + object Edit3: TEdit + Left = 389 + Height = 27 + Top = 94 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 40 + end + object Label3: TLabel + Left = 389 + Height = 18 + Top = 80 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Mpg123 Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object mp3input: TCheckBox + Left = 136 + Height = 21 + Top = 432 + Width = 158 + Caption = 'MP3 input files' + Color = clNone + Font.Color = clWhite + Font.Style = [fsBold] + ParentColor = False + ParentFont = False + TabOrder = 41 + end + object Label12: TLabel + Left = 88 + Height = 14 + Top = 452 + Width = 261 + Alignment = taCenter + Caption = 'If enabled all input must be must be mp3 files' + Font.Color = clWhite + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object OpenDialog1: TOpenDialog + Left = 312 + Top = 36 + end +end diff --git a/UOS/examples/main_mi.pas b/UOS/examples/main_mi.pas new file mode 100644 index 0000000..cd106a7 --- /dev/null +++ b/UOS/examples/main_mi.pas @@ -0,0 +1,648 @@ +/////////////////// Demo how to use Multi-Input with uos //////////////////// + +unit main_mi; + +{$mode objfpc}{$H+} + +interface + +uses + uos_flat, + Forms, + Dialogs, + SysUtils, + fileutil, + Graphics, + ctypes, + StdCtrls, + ComCtrls, + ExtCtrls, + Classes, + Controls; + +type + + { TForm1 } + + TForm1 = class(TForm) + Button1: TButton; + Button10: TButton; + Button11: TButton; + Button13: TButton; + Button14: TButton; + Button15: TButton; + Button16: TButton; + Button17: TButton; + Button2: TButton; + Button3: TButton; + Button4: TButton; + Button5: TButton; + Button7: TButton; + Button8: TButton; + CheckBox1: TCheckBox; + CheckBox2: TCheckBox; + CheckBox3: TCheckBox; + CheckBox4: TCheckBox; + CheckBox5: TCheckBox; + CheckBox6: TCheckBox; + CheckBox7: TCheckBox; + CheckBox8: TCheckBox; + Label12: TLabel; + mp3input: TCheckBox; + Edit1: TEdit; + Edit10: TEdit; + Edit11: TEdit; + Edit2: TEdit; + Edit3: TEdit; + Edit4: TEdit; + Edit5: TEdit; + Edit6: TEdit; + Edit7: TEdit; + Edit8: TEdit; + Edit9: TEdit; + Label1: TLabel; + Label10: TLabel; + Label11: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + OpenDialog1: TOpenDialog; + PaintBox1: TPaintBox; + Shape1: TShape; + Shape2: TShape; + Shape3: TShape; + Shape4: TShape; + Shape5: TShape; + Shape6: TShape; + Shape7: TShape; + Shape8: TShape; + Shape9: TShape; + TrackBar1: TTrackBar; + TrackBar2: TTrackBar; + TrackBar3: TTrackBar; + TrackBar4: TTrackBar; + TrackBar5: TTrackBar; + TrackBar6: TTrackBar; + TrackBar7: TTrackBar; + TrackBar8: TTrackBar; + procedure Button11Click(Sender: TObject); + procedure Button17Click(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Button10Click(Sender: TObject); + procedure Button13Click(Sender: TObject); + procedure Button14Click(Sender: TObject); + procedure Button15Click(Sender: TObject); + procedure Button16Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure Button5Click(Sender: TObject); + procedure Button7Click(Sender: TObject); + procedure Button8Click(Sender: TObject); + procedure CheckBox1Change(Sender: TObject); + procedure CheckBox2Change(Sender: TObject); + procedure CheckBox3Change(Sender: TObject); + procedure CheckBox4Change(Sender: TObject); + procedure CheckBox5Change(Sender: TObject); + procedure CheckBox6Change(Sender: TObject); + procedure CheckBox7Change(Sender: TObject); + procedure CheckBox8Change(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + + procedure ClosePlayer0; + procedure TrackBar1Change(Sender: TObject); + procedure TrackBar2Change(Sender: TObject); + procedure TrackBar3Change(Sender: TObject); + procedure TrackBar4Change(Sender: TObject); + procedure TrackBar5Change(Sender: TObject); + procedure TrackBar6Change(Sender: TObject); + procedure TrackBar7Change(Sender: TObject); + procedure TrackBar8Change(Sender: TObject); + + + private + { private declarations } + public + + { public declarations } + end; + +procedure uos_logo(); + + +var + Form1: TForm1; + BufferBMP: TBitmap; + PlayerIndex0, inindex1, inindex2, inindex3, inindex4, mut, inindex5, inindex6, inindex7, inindex8, channels: cardinal; + + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.ClosePlayer0; +begin + button16.Enabled := False; + button15.Enabled := False; + button3.Enabled := False; + button14.Enabled := False; + button2.Enabled := True; +end; + +procedure TForm1.TrackBar1Change(Sender: TObject); +begin + if (button14.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex0, InIndex1, TrackBar1.position / 100, + TrackBar1.position / 100, True); +end; + +procedure TForm1.TrackBar2Change(Sender: TObject); +begin + if (button14.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex0, InIndex2, TrackBar2.position / 100, + TrackBar2.position / 100, True); +end; + +procedure TForm1.TrackBar3Change(Sender: TObject); +begin + if (button14.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex0, InIndex3, TrackBar3.position / 100, + TrackBar3.position / 100, True); +end; + +procedure TForm1.TrackBar4Change(Sender: TObject); +begin + if (button14.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex0, InIndex4, TrackBar4.position / 100, + TrackBar4.position / 100, True); +end; + +procedure TForm1.TrackBar5Change(Sender: TObject); +begin + if (button14.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex0, InIndex8, TrackBar5.position / 100, + TrackBar5.position / 100, True); +end; + +procedure TForm1.TrackBar6Change(Sender: TObject); +begin + if (button14.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex0, InIndex5, TrackBar6.position / 100, + TrackBar6.position / 100, True); +end; + +procedure TForm1.TrackBar7Change(Sender: TObject); +begin + if (button14.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex0, InIndex6, TrackBar7.position / 100, + TrackBar7.position / 100, True); +end; + +procedure TForm1.TrackBar8Change(Sender: TObject); +begin + if (button14.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex0, InIndex7, TrackBar8.position / 100, + TrackBar8.position / 100, True); +end; + + +procedure TForm1.FormActivate(Sender: TObject); +var + ordir: string; +{$IFDEF Darwin} + opath: string; + {$ENDIF} +begin + uos_logo(); + ordir := application.Location; + {$IFDEF Windows} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + Edit2.Text := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + Edit3.Text := ordir + 'lib\Windows\64bit\LibMpg123-64.dll'; + {$else} + Edit1.Text := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + Edit2.Text := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + Edit3.Text := ordir + 'lib\Windows\32bit\LibMpg123-32.dll'; + {$endif} + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + Edit2.Text := opath + '/lib/Mac/32bit/LibSndFile-32.dylib'; + Edit3.Text := opath + '/lib/Mac/32bit/LibMpg123-32.dylib'; + + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + Edit2.Text := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + Edit3.Text := opath + '/lib/Mac/64bit/LibMpg123-64.dylib'; + {$ENDIF} + {$ENDIF} + + {$if defined(cpu64) and defined(linux) } + Edit1.Text := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/Linux/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + Edit1.Text := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so'; + {$ENDIF} + +{$if defined(cpu86) and defined(linux)} + Edit1.Text := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + Edit2.Text := ordir + 'lib/Linux/32bit/LibSndFile-32.so'; + Edit3.Text := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; + {$ENDIF} + {$if defined(linux) and defined(cpuarm)} + Edit1.Text := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + Edit2.Text := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + Edit3.Text := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so'; + {$ENDIF} + +{$IFDEF freebsd} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + Edit2.Text := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + Edit3.Text := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so'; + {$else} + Edit1.Text := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + Edit2.Text := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + Edit3.Text := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + {$endif} + {$ENDIF} + + opendialog1.Initialdir := application.Location + 'sound'; + + Edit4.Text := application.Location + 'sound' + directoryseparator + 'test.wav'; + Edit5.Text := application.Location + 'sound' + directoryseparator + 'test.ogg'; + Edit6.Text := application.Location + 'sound' + directoryseparator + 'test.wav'; + Edit7.Text := application.Location + 'sound' + directoryseparator + 'test.flac'; + Edit8.Text := application.Location + 'sound' + directoryseparator + 'test.ogg'; + Edit9.Text := application.Location + 'sound' + directoryseparator + 'test.flac'; + Edit10.Text := application.Location + 'sound' + directoryseparator + 'test.wav'; + Edit11.Text := application.Location + 'sound' + directoryseparator + 'test.ogg'; + +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.Button1Click(Sender: TObject); +begin + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + +{$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so +if (Edit2.Text <> 'system') and (Edit2.Text <> '') then + if uos_TestLoadLibrary(PChar(edit2.Text)) = false then + edit2.Text := edit2.Text + '.2'; +{$endif} + + if uos_LoadLib(PChar(edit1.Text), PChar(edit2.Text), PChar(edit3.Text), nil, nil, nil, nil) = 0 then + begin + form1.hide; + form1.Position := podefault; + button1.Caption := 'Libraries are loaded...'; + button1.Enabled := False; + edit1.ReadOnly := True; + edit2.ReadOnly := True; + edit3.ReadOnly := True; + form1.Height := 478; + form1.Position := poScreenCenter; + button2.click; + form1.Show; + end + else + begin + + if uosLoadResult.PAloaderror = 1 then + MessageDlg(edit1.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.PAloaderror = 2 then + MessageDlg(edit1.Text + ' do not load...', mtWarning, [mbYes], 0); + if uosLoadResult.SFloaderror = 1 then + MessageDlg(edit2.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.SFloaderror = 2 then + MessageDlg(edit2.Text + ' do not load...', mtWarning, [mbYes], 0); + + end; + +end; + +procedure TForm1.Button11Click(Sender: TObject); +begin + if opendialog1.Execute then + edit10.Text := opendialog1.FileName; +end; + +procedure TForm1.Button17Click(Sender: TObject); +begin + if opendialog1.Execute then + edit11.Text := opendialog1.FileName; +end; + +procedure TForm1.Button10Click(Sender: TObject); +begin + if opendialog1.Execute then + edit6.Text := opendialog1.FileName; +end; + +procedure TForm1.Button13Click(Sender: TObject); +begin + if opendialog1.Execute then + edit7.Text := opendialog1.FileName; +end; + +procedure TForm1.Button14Click(Sender: TObject); +begin + + button15.Enabled := True; + button3.Enabled := True; + button14.Enabled := False; + button16.Enabled := False; + button2.Enabled := False; + + // set the volume from the sliders. + TrackBar1Change(self); + TrackBar2Change(self); + TrackBar3Change(self); + TrackBar4Change(self); + TrackBar5Change(self); + TrackBar6Change(self); + TrackBar7Change(self); + TrackBar8Change(self); + + // Ok let start it + uos_Play(PlayerIndex0); + end; + +procedure TForm1.Button15Click(Sender: TObject); +begin + uos_Pause(PlayerIndex0); + button15.Enabled := False; + button16.Enabled := True; +end; + + +procedure TForm1.Button16Click(Sender: TObject); +begin + uos_RePlay(PlayerIndex0); + button16.Enabled := False; + button15.Enabled := True; +end; + +procedure TForm1.Button2Click(Sender: TObject); +var + ratioendlessloop: shortint; +begin + PlayerIndex0 := 0; + + channels := 2; // (stereo output) + + uos_Stop(PlayerIndex0); + sleep(100); + application.ProcessMessages; + + uos_CreatePlayer(PlayerIndex0); + + if mp3input.Checked then + ratioendlessloop := 4 + else + ratioendlessloop := 1; + + //// add input from audio file with custom parameters + //////////// PlayerIndex : Index of a existing Player + ////////// FileName : filename of audio file + ////////// 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 + inindex1 := uos_AddFromFile(PlayerIndex0, PChar(Edit4.Text), -1, 0, 1024); + inindex2 := uos_AddFromFile(PlayerIndex0, PChar(Edit5.Text), -1, 0, 1024); + inindex3 := uos_AddFromFile(PlayerIndex0, PChar(Edit6.Text), -1, 0, 1024); + inindex4 := uos_AddFromFile(PlayerIndex0, PChar(Edit7.Text), -1, 0, 1024); + inindex5 := uos_AddFromFile(PlayerIndex0, PChar(Edit8.Text), -1, 0, 1024); + inindex6 := uos_AddFromFile(PlayerIndex0, PChar(Edit9.Text), -1, 0, 1024); + inindex7 := uos_AddFromFile(PlayerIndex0, PChar(Edit10.Text), -1, 0, 1024); + inindex8 := uos_AddFromFile(PlayerIndex0, PChar(Edit11.Text), -1, 0, 1024); + + // This for a dummy endless input, set enable to true, must be last input + // Needed to make all input reach the end. + + mut := uos_AddFromEndlessMuted(PlayerIndex0, 2, 1024 div ratioendlessloop); + uos_inputsetenable(PlayerIndex0, mut, True); + + ///// DSP Volume changer + ////////// PlayerIndex1 : Index of a existing Player + ////////// In1Index : InputIndex of a existing input + ////////// VolLeft : Left volume ( from 0 to 1 => gain > 1 ) + ////////// VolRight : Right volume + + uos_InputAddDSPVolume(PlayerIndex0, InIndex1, 1, 1); + uos_InputAddDSPVolume(PlayerIndex0, InIndex2, 1, 1); + uos_InputAddDSPVolume(PlayerIndex0, InIndex3, 1, 1); + uos_InputAddDSPVolume(PlayerIndex0, InIndex4, 1, 1); + uos_InputAddDSPVolume(PlayerIndex0, InIndex5, 1, 1); + uos_InputAddDSPVolume(PlayerIndex0, InIndex6, 1, 1); + uos_InputAddDSPVolume(PlayerIndex0, InIndex7, 1, 1); + uos_InputAddDSPVolume(PlayerIndex0, InIndex8, 1, 1); + + //// 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) + // result : -1 nothing created, otherwise Output Index in array + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + uos_AddIntoDevOut(PlayerIndex0, -1, 0.3, -1, -1, 0, 1024, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex0, -1, 0.3, -1, -1, 0, 1024, -1); + {$endif} + + CheckBox1Change(Sender); + CheckBox2Change(Sender); + CheckBox3Change(Sender); + CheckBox4Change(Sender); + CheckBox5Change(Sender); + CheckBox6Change(Sender); + CheckBox7Change(Sender); + CheckBox8Change(Sender); + + /////// procedure to execute when stream is terminated + uos_EndProc(PlayerIndex0, @ClosePlayer0); + ///// Assign the procedure of object to execute at end + //////////// PlayerIndex : Index of a existing Player + //////////// ClosePlayer1 : procedure of object to execute inside the loop + + application.ProcessMessages; + + button14.Enabled := True; +end; + + +procedure TForm1.Button3Click(Sender: TObject); +begin + uos_Stop(PlayerIndex0); + sleep(100); + button2.Enabled := True; + button3.Enabled := False; + ClosePlayer0; +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin + if opendialog1.Execute then + edit4.Text := opendialog1.FileName; +end; + +procedure TForm1.Button5Click(Sender: TObject); +begin + if opendialog1.Execute then + edit8.Text := opendialog1.FileName; +end; + + +procedure TForm1.Button7Click(Sender: TObject); +begin + if opendialog1.Execute then + edit5.Text := opendialog1.FileName; +end; + +procedure TForm1.Button8Click(Sender: TObject); +begin + if opendialog1.Execute then + edit9.Text := opendialog1.FileName; +end; + +procedure TForm1.CheckBox1Change(Sender: TObject); +begin + uos_InputSetEnable(PlayerIndex0, InIndex1, checkbox1.Checked); +end; + +procedure TForm1.CheckBox2Change(Sender: TObject); +begin + uos_InputSetEnable(PlayerIndex0, InIndex2, checkbox2.Checked); +end; + +procedure TForm1.CheckBox3Change(Sender: TObject); +begin + uos_InputSetEnable(PlayerIndex0, InIndex5, checkbox3.Checked); +end; + +procedure TForm1.CheckBox4Change(Sender: TObject); +begin + uos_InputSetEnable(PlayerIndex0, InIndex6, checkbox4.Checked); +end; + +procedure TForm1.CheckBox5Change(Sender: TObject); +begin + uos_InputSetEnable(PlayerIndex0, InIndex3, checkbox5.Checked); +end; + +procedure TForm1.CheckBox6Change(Sender: TObject); +begin + uos_InputSetEnable(PlayerIndex0, InIndex4, checkbox6.Checked); +end; + +procedure TForm1.CheckBox7Change(Sender: TObject); +begin + uos_InputSetEnable(PlayerIndex0, InIndex7, checkbox7.Checked); +end; + +procedure TForm1.CheckBox8Change(Sender: TObject); +begin + uos_InputSetEnable(PlayerIndex0, InIndex8, checkbox8.Checked); +end; + + +procedure uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + form1.Height := 148; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + uos_free; +end; + +end. \ No newline at end of file diff --git a/UOS/examples/main_mp.lfm b/UOS/examples/main_mp.lfm new file mode 100644 index 0000000..d143812 --- /dev/null +++ b/UOS/examples/main_mp.lfm @@ -0,0 +1,491 @@ +object Form1: TForm1 + Left = 497 + Height = 231 + Top = 15 + Width = 501 + BorderIcons = [biSystemMenu] + Caption = 'Multi Player U0S Portaudio + SndFile + Mpg123' + ClientHeight = 231 + ClientWidth = 501 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '1.4.4.0' + object Shape5: TShape + Left = 9 + Height = 44 + Top = 512 + Width = 483 + Brush.Color = clRed + end + object Shape4: TShape + Left = 9 + Height = 65 + Top = 443 + Width = 483 + Brush.Color = clYellow + end + object Shape3: TShape + Left = 9 + Height = 65 + Top = 375 + Width = 483 + Brush.Color = clLime + end + object Shape2: TShape + Left = 9 + Height = 68 + Top = 303 + Width = 483 + Brush.Color = clFuchsia + end + object Shape1: TShape + Left = 9 + Height = 66 + Top = 233 + Width = 483 + Brush.Color = clAqua + end + object Edit1: TEdit + Left = 132 + Height = 27 + Top = 14 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 1 + end + object Edit2: TEdit + Left = 132 + Height = 27 + Top = 54 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 2 + end + object Edit3: TEdit + Left = 132 + Height = 27 + Top = 94 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 3 + end + object Button2: TButton + Left = 141 + Height = 25 + Top = 269 + Width = 62 + Caption = 'Play' + OnClick = Button2Click + TabOrder = 4 + end + object Label1: TLabel + Left = 130 + Height = 18 + Top = 0 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label2: TLabel + Left = 130 + Height = 18 + Top = 40 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of SndFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label3: TLabel + Left = 132 + Height = 18 + Top = 80 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Mpg123 Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit4: TEdit + Left = 15 + Height = 27 + Top = 239 + Width = 471 + Alignment = taCenter + AutoSize = False + TabOrder = 5 + end + object Button3: TButton + Left = 369 + Height = 25 + Top = 269 + Width = 54 + Caption = 'Stop' + Enabled = False + OnClick = Button3Click + TabOrder = 6 + end + object Button4: TButton + Left = 64 + Height = 25 + Top = 269 + Width = 70 + Caption = 'Choose' + OnClick = Button4Click + TabOrder = 7 + end + object Button5: TButton + Left = 141 + Height = 25 + Top = 341 + Width = 62 + Caption = 'Play' + OnClick = Button5Click + TabOrder = 8 + end + object Edit5: TEdit + Left = 16 + Height = 27 + Top = 309 + Width = 471 + Alignment = taCenter + AutoSize = False + TabOrder = 9 + end + object Button6: TButton + Left = 369 + Height = 25 + Top = 341 + Width = 54 + Caption = 'Stop' + Enabled = False + OnClick = Button6Click + TabOrder = 10 + end + object Button7: TButton + Left = 64 + Height = 25 + Top = 341 + Width = 70 + Caption = 'Choose' + OnClick = Button7Click + TabOrder = 11 + end + object Button8: TButton + Left = 141 + Height = 25 + Top = 409 + Width = 62 + Caption = 'Play' + OnClick = Button8Click + TabOrder = 12 + end + object Edit6: TEdit + Left = 16 + Height = 27 + Top = 379 + Width = 471 + Alignment = taCenter + AutoSize = False + TabOrder = 13 + end + object Button9: TButton + Left = 369 + Height = 25 + Top = 409 + Width = 54 + Caption = 'Stop' + Enabled = False + OnClick = Button9Click + TabOrder = 14 + end + object Button10: TButton + Left = 64 + Height = 25 + Top = 409 + Width = 70 + Caption = 'Choose' + OnClick = Button10Click + TabOrder = 15 + end + object Edit7: TEdit + Left = 16 + Height = 27 + Top = 448 + Width = 471 + Alignment = taCenter + AutoSize = False + TabOrder = 16 + end + object Button14: TButton + Left = 140 + Height = 25 + Top = 521 + Width = 212 + Caption = 'Play All Together' + OnClick = Button14Click + TabOrder = 17 + end + object Button15: TButton + Left = 215 + Height = 25 + Top = 269 + Width = 62 + Caption = 'Pause' + Enabled = False + OnClick = Button15Click + TabOrder = 18 + end + object Button16: TButton + Left = 285 + Height = 25 + Top = 269 + Width = 73 + Caption = 'Resume' + Enabled = False + OnClick = Button16Click + TabOrder = 19 + end + object Button17: TButton + Left = 215 + Height = 25 + Top = 341 + Width = 62 + Caption = 'Pause' + Enabled = False + OnClick = Button17Click + TabOrder = 20 + end + object Button18: TButton + Left = 285 + Height = 25 + Top = 341 + Width = 73 + Caption = 'Resume' + Enabled = False + OnClick = Button18Click + TabOrder = 21 + end + object Button19: TButton + Left = 215 + Height = 25 + Top = 409 + Width = 62 + Caption = 'Pause' + Enabled = False + OnClick = Button19Click + TabOrder = 22 + end + object Button20: TButton + Left = 285 + Height = 25 + Top = 409 + Width = 73 + Caption = 'Resume' + Enabled = False + OnClick = Button20Click + TabOrder = 23 + end + object PaintBox1: TPaintBox + Left = 16 + Height = 105 + Top = 54 + Width = 105 + OnPaint = PaintBox1Paint + end + object Button1: TButton + Left = 9 + Height = 20 + Top = 208 + Width = 483 + Caption = 'Load that libraries' + OnClick = Button1Click + TabOrder = 0 + end + object Button11: TButton + Left = 141 + Height = 25 + Top = 477 + Width = 62 + Caption = 'Play' + OnClick = Button11Click + TabOrder = 24 + end + object Button22: TButton + Left = 285 + Height = 25 + Top = 477 + Width = 73 + Caption = 'Resume' + Enabled = False + OnClick = Button22Click + TabOrder = 25 + end + object Button21: TButton + Left = 215 + Height = 25 + Top = 477 + Width = 62 + Caption = 'Pause' + Enabled = False + OnClick = Button21Click + TabOrder = 26 + end + object Button12: TButton + Left = 369 + Height = 25 + Top = 477 + Width = 54 + Caption = 'Stop' + Enabled = False + OnClick = Button12Click + TabOrder = 27 + end + object Button13: TButton + Left = 64 + Height = 25 + Top = 477 + Width = 64 + Caption = 'Choose' + OnClick = Button13Click + TabOrder = 28 + end + object Edit8: TEdit + Left = 132 + Height = 27 + Top = 134 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 29 + end + object Label4: TLabel + Left = 132 + Height = 18 + Top = 120 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Mp4ff Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label5: TLabel + Left = 132 + Height = 18 + Top = 160 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Faac2 Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit9: TEdit + Left = 132 + Height = 27 + Top = 174 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 30 + end + object OpenDialog1: TOpenDialog + left = 76 + top = 36 + end +end diff --git a/UOS/examples/main_mp.pas b/UOS/examples/main_mp.pas new file mode 100644 index 0000000..48a1f23 --- /dev/null +++ b/UOS/examples/main_mp.pas @@ -0,0 +1,683 @@ + +/////////////////// Demo how to use United Openlib of Sound //////////////////// + + +unit main_mp; + +{$mode objfpc}{$H+} + +interface + +uses + uos_flat, + Forms, + Dialogs, + Graphics, + StdCtrls, + ExtCtrls, + Classes; + +type + + { TForm1 } + + TForm1 = class(TForm) + Button1: TButton; + Button10: TButton; + Button11: TButton; + Button12: TButton; + Button13: TButton; + Button14: TButton; + Button15: TButton; + Button16: TButton; + Button17: TButton; + Button18: TButton; + Button19: TButton; + Button2: TButton; + Button20: TButton; + Button21: TButton; + Button22: TButton; + Button3: TButton; + Button4: TButton; + Button5: TButton; + Button6: TButton; + Button7: TButton; + Button8: TButton; + Button9: TButton; + Edit1: TEdit; + Edit2: TEdit; + Edit3: TEdit; + Edit4: TEdit; + Edit5: TEdit; + Edit6: TEdit; + Edit7: TEdit; + Edit8: TEdit; + Edit9: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + OpenDialog1: TOpenDialog; + PaintBox1: TPaintBox; + Shape1: TShape; + Shape2: TShape; + Shape3: TShape; + Shape4: TShape; + Shape5: TShape; + + procedure Button10Click(Sender: TObject); + procedure Button11Click(Sender: TObject); + procedure Button12Click(Sender: TObject); + procedure Button13Click(Sender: TObject); + procedure Button14Click(Sender: TObject); + procedure Button15Click(Sender: TObject); + procedure Button16Click(Sender: TObject); + procedure Button17Click(Sender: TObject); + procedure Button18Click(Sender: TObject); + procedure Button19Click(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Button20Click(Sender: TObject); + procedure Button21Click(Sender: TObject); + procedure Button22Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure Button5Click(Sender: TObject); + procedure Button6Click(Sender: TObject); + procedure Button7Click(Sender: TObject); + procedure Button8Click(Sender: TObject); + procedure Button9Click(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormClose(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + + procedure ClosePlayer0; + procedure ClosePlayer1; + procedure ClosePlayer2; + procedure ClosePlayer3; + + private + { private declarations } + public + + { public declarations } + end; + +procedure uos_logo(); + + +var + Form1: TForm1; + BufferBMP: TBitmap; + PlayerIndex0, PlayerIndex1, PlayerIndex2, PlayerIndex3: cardinal; + + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.ClosePlayer0; +begin + button16.Enabled := False; + button15.Enabled := False; + button3.Enabled := False; +end; + +procedure TForm1.ClosePlayer1; +begin + button17.Enabled := False; + button18.Enabled := False; + button6.Enabled := False; +end; + +procedure TForm1.ClosePlayer2; +begin + button19.Enabled := False; + button20.Enabled := False; + button9.Enabled := False; +end; + +procedure TForm1.ClosePlayer3; +begin + button21.Enabled := False; + button22.Enabled := False; + button12.Enabled := False; +end; + +procedure TForm1.FormActivate(Sender: TObject); +var + ordir: string; +{$IFDEF Darwin} + opath: string; + {$ENDIF} +begin + uos_logo(); + ordir := application.Location; + {$IFDEF Windows} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + Edit2.Text := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + Edit3.Text := ordir + 'lib\Windows\64bit\LibMpg123-64.dll'; + {$else} + Edit1.Text := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + Edit2.Text := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + Edit3.Text := ordir + 'lib\Windows\32bit\LibMpg123-32.dll'; + Edit8.text := ordir + 'lib\Windows\32bit\LibMp4ff-32.dll'; + Edit9.text := ordir + 'lib\Windows\32bit\LibFaad2-32.dll'; + {$endif} + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + Edit2.Text := opath + '/lib/Mac/32bit/LibSndFile-32.dylib'; + Edit3.Text := opath + '/lib/Mac/32bit/LibMpg123-32.dylib'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + Edit2.Text := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + Edit3.Text := opath + '/lib/Mac/64bit/LibMpg123-64.dylib'; + {$ENDIF} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + Edit1.Text := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/Linux/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + Edit8.text := ordir + 'lib/Linux/64bit/LibMp4ff-64.so'; + Edit9.text := ordir + 'lib/Linux/64bit/LibFaad2-64.so'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + Edit1.Text := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so'; + {$ENDIF} + + {$if defined(cpu86) and defined(linux)} + Edit1.Text := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + Edit2.Text := ordir + 'lib/Linux/32bit/LibSndFile-32.so'; + Edit3.Text := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; + Edit8.text := ordir + 'lib/Linux/32bit/LibMp4ff-32.so'; + Edit9.text := ordir + 'lib/Linux/32bit/LibFaad2-32.so'; + {$endif} + + {$if defined(linux) and defined(cpuaarch64)} + Edit1.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + Edit2.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + Edit3.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + {$ENDIF} + + {$if defined(linux) and defined(cpuarm)} + Edit1.Text := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + Edit2.Text := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + Edit3.Text := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so'; + {$ENDIF} + +{$IFDEF freebsd} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + Edit3.Text := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so'; + Edit2.Text := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + {$else} + Edit1.Text := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + Edit2.Text := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + Edit3.Text := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + {$endif} + {$ENDIF} + + + opendialog1.Initialdir := application.Location + 'sound'; + + Edit4.Text := application.Location + 'sound' + directoryseparator + 'test.mp3'; + Edit5.Text := application.Location + 'sound' + directoryseparator + 'test.ogg'; + Edit6.Text := application.Location + 'sound' + directoryseparator + 'test.wav'; + Edit7.Text := application.Location + 'sound' + directoryseparator + 'test.flac'; + +end; + +procedure TForm1.FormClose(Sender: TObject); +begin + +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.Button1Click(Sender: TObject); +begin + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + +{$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so +if (Edit2.Text <> 'system') and (Edit2.Text <> '') then + if uos_TestLoadLibrary(PChar(edit2.Text)) = false then + edit2.Text := edit2.Text + '.2'; +{$endif} + + if uos_LoadLib(PChar(Edit1.Text), PChar(Edit2.Text), + PChar(Edit3.Text), PChar(Edit8.Text), PChar(Edit9.Text), nil, nil) = 0 then + begin + form1.hide; + form1.Position := podefault; + button1.Caption := 'PortAudio, SndFile and Mpg123 libraries are loaded...'; + button1.Enabled := False; + edit1.ReadOnly := True; + edit2.ReadOnly := True; + edit3.ReadOnly := True; + form1.Height := 566; + form1.Position := poScreenCenter; + form1.Show; + end + else + begin + if uosLoadResult.PAloaderror = 1 then + MessageDlg(edit1.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.PAloaderror = 2 then + MessageDlg(edit1.Text + ' do not load...', mtWarning, [mbYes], 0); + if uosLoadResult.SFloaderror = 1 then + MessageDlg(edit2.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.SFloaderror = 2 then + MessageDlg(edit2.Text + ' do not load...', mtWarning, [mbYes], 0); + if uosLoadResult.MPloaderror = 1 then + MessageDlg(edit3.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.MPloaderror = 2 then + MessageDlg(edit3.Text + ' do not load...', mtWarning, [mbYes], 0); + end; + +end; + +procedure TForm1.Button20Click(Sender: TObject); +begin + uos_RePlay(PlayerIndex2); + button20.Enabled := False; + button19.Enabled := True; +end; + +procedure TForm1.Button21Click(Sender: TObject); +begin + uos_Pause(PlayerIndex3); + button22.Enabled := True; + button21.Enabled := False; +end; + +procedure TForm1.Button22Click(Sender: TObject); +begin + uos_RePlay(PlayerIndex3); + button22.Enabled := False; + button21.Enabled := True; +end; + + +procedure TForm1.Button10Click(Sender: TObject); +begin + if opendialog1.Execute then + edit6.Text := opendialog1.FileName; +end; + +procedure TForm1.Button11Click(Sender: TObject); +var + InIndex: integer; +begin + PlayerIndex3 := 3; + + uos_CreatePlayer(PlayerIndex3); + + InIndex := uos_AddFromFile(PlayerIndex3, PChar(Edit7.Text), -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 + uos_AddIntoDevOut(PlayerIndex3, -1, 0.3, uos_InputGetSampleRate(PlayerIndex3, InIndex), -1, 0, -1, -1,); + {$else} + uos_AddIntoDevOut(PlayerIndex3, -1, -1, uos_InputGetSampleRate(PlayerIndex3, InIndex), -1, 0, -1, -1); + {$endif} + + //// add a Output with custom parameters + //// 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) + // result : -1 nothing created, otherwise Output Index in array + + + /////// procedure to execute when stream is terminated + uos_EndProc(PlayerIndex3, @ClosePlayer3); + ///// Assign the procedure of object to execute at end + //////////// PlayerIndex : Index of a existing Player + //////////// ClosePlayer1 : procedure of object to execute inside the loop + + uos_Play(PlayerIndex3); + ////// Ok let start it + + button22.Enabled := False; + button21.Enabled := True; + button12.Enabled := True; +end; + +procedure TForm1.Button12Click(Sender: TObject); +begin + uos_Stop(PlayerIndex3); +end; + +procedure TForm1.Button13Click(Sender: TObject); +begin + if opendialog1.Execute then + edit7.Text := opendialog1.FileName; +end; + +procedure TForm1.Button14Click(Sender: TObject); +begin + Button2.Click; + Button5.Click; + Button8.Click; + Button11.Click; +end; + +procedure TForm1.Button15Click(Sender: TObject); +begin + uos_Pause(PlayerIndex0); + button16.Enabled := True; + button15.Enabled := False; +end; + + +procedure TForm1.Button16Click(Sender: TObject); +begin + uos_RePlay(PlayerIndex0); + button16.Enabled := False; + button15.Enabled := True; +end; + +procedure TForm1.Button17Click(Sender: TObject); +begin + uos_Pause(PlayerIndex1); + button18.Enabled := True; + button17.Enabled := False; +end; + +procedure TForm1.Button18Click(Sender: TObject); +begin + uos_RePlay(PlayerIndex1); + button18.Enabled := False; + button17.Enabled := True; +end; + +procedure TForm1.Button19Click(Sender: TObject); +begin + uos_Pause(PlayerIndex2); + button20.Enabled := True; + button19.Enabled := False; +end; + +procedure TForm1.Button2Click(Sender: TObject); +var + InIndex: integer; +begin + PlayerIndex0 := 0; + + uos_CreatePlayer(PlayerIndex0); + + InIndex := uos_AddFromFile(PlayerIndex0, PChar(Edit4.Text), -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 + uos_AddIntoDevOut(PlayerIndex0, -1, 0.3, uos_InputGetSampleRate(PlayerIndex0, InIndex), -1, 0, -1, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex0, -1, -1, uos_InputGetSampleRate(PlayerIndex0, InIndex), -1, 0, -1, -1); + {$endif} + + //// add a Output with custom parameters + //// 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) + // result : -1 nothing created, otherwise Output Index in array + + + /////// procedure to execute when stream is terminated + uos_EndProc(PlayerIndex0, @ClosePlayer0); + ///// Assign the procedure of object to execute at end + //////////// PlayerIndex : Index of a existing Player + //////////// ClosePlayer1 : procedure of object to execute inside the loop + + uos_Play(PlayerIndex0); + ////// Ok let start it + + + button15.Enabled := True; + button3.Enabled := True; +end; + +procedure TForm1.Button3Click(Sender: TObject); +begin + uos_Stop(PlayerIndex0); +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin + if opendialog1.Execute then + edit4.Text := opendialog1.FileName; +end; + +procedure TForm1.Button5Click(Sender: TObject); +var + InIndex: integer; +begin + PlayerIndex1 := 1; + + uos_CreatePlayer(PlayerIndex1); + + InIndex := uos_AddFromFile(PlayerIndex1, PChar(Edit5.Text), -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 + uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, InIndex), -1, 0,-1, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, InIndex), -1, 0, -1, -1); + {$endif} + + //// add a Output with custom parameters + //// 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) + // result : -1 nothing created, otherwise Output Index in array + /////// procedure to execute when stream is terminated + + 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 + + uos_Play(PlayerIndex1); + ////// Ok let start it + + button17.Enabled := True; + button6.Enabled := True; +end; + +procedure TForm1.Button6Click(Sender: TObject); +begin + uos_Stop(PlayerIndex1); +end; + +procedure TForm1.Button7Click(Sender: TObject); +begin + if opendialog1.Execute then + edit5.Text := opendialog1.FileName; +end; + +procedure TForm1.Button8Click(Sender: TObject); +var + InIndex: integer; +begin + PlayerIndex2 := 2; + + uos_CreatePlayer(PlayerIndex2); + + InIndex := uos_AddFromFile(PlayerIndex2, PChar(Edit6.Text), -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 + uos_AddIntoDevOut(PlayerIndex2, -1, 0.3, uos_InputGetSampleRate(PlayerIndex2, InIndex), -1, 0, -1, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex2, -1, -1, uos_InputGetSampleRate(PlayerIndex2, InIndex), -1, 0, -1, -1); + {$endif} + + //// add a Output with custom parameters + //// 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) + // result : -1 nothing created, otherwise Output Index in array + + /////// procedure to execute when stream is terminated + uos_EndProc(PlayerIndex2, @ClosePlayer2); + ///// Assign the procedure of object to execute at end + //////////// PlayerIndex : Index of a existing Player + //////////// ClosePlayer1 : procedure of object to execute inside the loop + + uos_Play(PlayerIndex2); + ////// Ok let start it + ////// Ok let start it + button19.Enabled := True; + button9.Enabled := True; +end; + +procedure TForm1.Button9Click(Sender: TObject); +begin + uos_Stop(PlayerIndex2); +end; + +procedure uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + form1.Height := 230; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + if button3.Enabled = True then + uos_Stop(PlayerIndex0); + if button6.Enabled = True then + uos_Stop(PlayerIndex1); + if button9.Enabled = True then + uos_Stop(PlayerIndex2); + if button12.Enabled = True then + uos_Stop(PlayerIndex3); + if button1.Enabled = False then + uos_free; + BufferBMP.Free; +end; + +end. + diff --git a/UOS/examples/main_mt.lfm b/UOS/examples/main_mt.lfm new file mode 100644 index 0000000..b61f25a --- /dev/null +++ b/UOS/examples/main_mt.lfm @@ -0,0 +1,221 @@ +object Form1: TForm1 + Left = 389 + Height = 331 + Top = 109 + Width = 420 + Caption = 'Morse translator' + ClientHeight = 331 + ClientWidth = 420 + Font.Height = -20 + OnActivate = FormActivate + LCLVersion = '5.7' + object BitBtnPlay: TBitBtn + Left = 30 + Height = 47 + Top = 270 + Width = 173 + Caption = 'Listen' + Glyph.Data = { + 36100000424D3610000000000000360000002800000020000000200000000100 + 2000000000000010000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF005C515C2F5E52 + 5A41624E4E0DFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF005A535A445B54 + 5B4C5A505A33FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00666666055B515781594F564DFFFFFF00FFFFFF005C5555275B51 + 574C5C52584B664D660AFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF0059505650595056FF595056FA554D551EFFFFFF00555555065B50 + 57495B51574C5B4F552DFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00564F5647565055BA5C525219FFFFFF00FFFFFF0055555506FFFF + FF00FFFFFF00594E5917574F55F8574F55FF564F5494FFFFFF00FFFFFF00594D + 532B5751544C564F534A49494907FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF005555 + 5503574D5384564D53FE564D53FF574D544FFFFFFF00564E547D564D53FA574D + 5464FFFFFF00FFFFFF00574D5396564D53FF564D53F7554A5518FFFFFF005555 + 5509554B524B574D544C554E5527FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0052475219554C + 51BF554C52FF554C52FF554C52FF564D5350FFFFFF00554B529F554C52FF554C + 52EC4E4E4E0DFFFFFF0058505020554C52FB554C52FF544B538BFFFFFF00FFFF + FF00534E5331544D514C544B543DFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0054485043544A50E8534A + 50FF534A50FF534A50FF534A50FF53495050FFFFFF00554B5033534A50FF534A + 50FF5449507DFFFFFF00FFFFFF00534A50A2534A50FF534A50EAFFFFFF00FFFF + FF00554D4D21544A514C554A5148FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF005555550953464D2855495515FFFFFF005349506952494FFD52494FFF5249 + 4FFF52494FFF52494FFF52494FFF53495050FFFFFF00FFFFFF0052494FB15249 + 4FFF52494FEF66336605FFFFFF0051484E5852494FFF52494FFF55475512FFFF + FF0051465116514A514C514A514C40404008FFFFFF00FFFFFF00FFFFFF00FFFF + FF004F474D8450484EFF50494EBAFFFFFF0050494FD350484EFF50484EFF5048 + 4EFF50484EFF50484EFF50484EFF51474D4FFFFFFF00FFFFFF0051474E485048 + 4EFF50484EFF514B5129FFFFFF004E494E3150484EFF50484EFF52494D38FFFF + FF005D46460B51464D4C51464D4C51435113FFFFFF00FFFFFF00FFFFFF00FFFF + FF004F464D924F464CFF4F464CB5FFFFFF004F464CDB4F464CFF4F464CFF4F46 + 4CFF4F464CFF4F464CFF4F464CFF50464D50FFFFFF00FFFFFF004F464F1D4F46 + 4CFF4F464CFF4E484B52FFFFFF004646460B4F464CFE4F464CFF4F474C5EFFFF + FF00000000014E474B4B51464D4C55444D1EFFFFFF00FFFFFF00FFFFFF00FFFF + FF004E464B9A4D454BFF4D454BADFFFFFF004E454BE34D454BFF4D454BFF4D45 + 4BFF4D454BFF4D454BFF4D454BFF4D464D50FFFFFF00FFFFFF00FFFFFF004D45 + 4BF34D454BFF4D444B7BFFFFFF00FFFFFF004E454BE34D454BFF4D464B84FFFF + FF00FFFFFF004E474B414D464A4C4F43492AFFFFFF00FFFFFF00FFFFFF00FFFF + FF004B434A9C4C4349FF4C4349ABFFFFFF004C4349E44C4349FF4C4349FF4C43 + 49FF4C4349FF4C4349FF4C4349FF4D434950FFFFFF00FFFFFF00000000014C43 + 49F34C4349FF4D42497BFFFFFF00FFFFFF004C4349E34C4349FF4B444984FFFF + FF00FFFFFF004B4347414D434A4C4F43492AFFFFFF00FFFFFF00FFFFFF00FFFF + FF004A4148944A4248FF4A4249B3FFFFFF004A4248DD4A4248FF4A4248FF4A42 + 48FF4A4248FF4A4248FF4A4248FF49434950FFFFFF00FFFFFF004646461D4A42 + 48FF4A4248FF4B414852FFFFFF004646460B4A4248FE4A4248FF4941495EFFFF + FF00000000014B41474B4A43464C4D444D1EFFFFFF00FFFFFF00FFFFFF00FFFF + FF004940458C494046FF4A4046BBFFFFFF00493F45D5494046FF494046FF4940 + 46FF494046FF494046FF494046FF49404650FFFFFF00FFFFFF004841454A4940 + 46FF494046FF4B3E4429FFFFFF00493E4431494046FF494046FF49404438FFFF + FF004646460B4A40464C4A40464C43434313FFFFFF00FFFFFF00FFFFFF00FFFF + FF00443E44294740447047404348FFFFFF00484045A0473F45FF473F45FF473F + 45FF473F45FF473F45FF473F45FF4741444FFFFFFF00FFFFFF00463F45B5473F + 45FF473F45EF33333305FFFFFF0048404658473F45FF473F45FF47394712FFFF + FF00463A46164640464C4640464C40404008FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0040404004473D4589463E44FE463E + 44FF463E44FF463E44FF463E44FF463D4350FFFFFF00463C4637463E44FF463E + 44FF463E447CFFFFFF00FFFFFF00453D44A2463E44FF463E44EAFFFFFF00FFFF + FF00463E4621463C434C47404348FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00443D414B443C + 42ED443C42FF443C42FF443C42FF433D4350FFFFFF00433C4290443C42FF443C + 42EB4040400CFFFFFF00463E4621443C42FB443C42FF443B438AFFFFFF00FFFF + FF00423D4232433C434C433B433DFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00443C + 441E433B41C7433B41FF433B41FF433D4050FFFFFF00423A4060433B41E9443C + 415AFFFFFF00FFFFFF00433A4199433B41FF433B41F643374317FFFFFF003939 + 3909443A414B433C404C413B4127FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF0033333305413A3F8D42393FFD42393E3AFFFFFF00FFFFFF0000000001FFFF + FF00FFFFFF004337431742393FF942393FFF423A3F92FFFFFF00FFFFFF00403A + 402C4339404C42383F492B2B2B06FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF004040400CFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF003F3A3F3940383EFF3F383EF94037401CFFFFFF002B2B2B063F38 + 3F4940393C4C403A402CFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00555555033F373C6A41383D3BFFFFFF00FFFFFF00413441274036 + 3C4C3D363D4B3333330AFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF003D353D3F3C36 + 3C4C3D333D32FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF003D373D2A3E35 + 3A3E402B400CFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + OnClick = BitBtnPlayClick + TabOrder = 0 + end + object Label1: TLabel + Left = 98 + Height = 24 + Top = 4 + Width = 223 + Caption = 'Write something here:' + ParentColor = False + end + object ButtonQuit: TButton + Left = 258 + Height = 39 + Top = 274 + Width = 108 + Caption = 'Quit' + OnClick = ButtonQuitClick + TabOrder = 1 + end + object interchar: TEdit + Left = 46 + Height = 34 + Top = 212 + Width = 108 + Alignment = taCenter + TabOrder = 2 + Text = '250' + end + object Memo1: TMemo + Left = 12 + Height = 144 + Top = 30 + Width = 394 + Lines.Strings = ( + 'Memo1' + ) + ScrollBars = ssAutoBoth + TabOrder = 3 + end + object interspace: TEdit + Left = 242 + Height = 34 + Top = 212 + Width = 108 + Alignment = taCenter + TabOrder = 4 + Text = '1500' + end + object Label2: TLabel + Left = 18 + Height = 14 + Top = 190 + Width = 160 + Caption = 'Pause for character in msec' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label3: TLabel + Left = 226 + Height = 14 + Top = 190 + Width = 139 + Caption = 'Pause for space in msec' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end +end diff --git a/UOS/examples/main_mt.pas b/UOS/examples/main_mt.pas new file mode 100644 index 0000000..e46718c --- /dev/null +++ b/UOS/examples/main_mt.pas @@ -0,0 +1,179 @@ +unit main_mt; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, + Forms, + StdCtrls, + Buttons, + uos_flat, + Classes; + +type + + { TForm1 } + + TForm1 = class(TForm) + BitBtnPlay: TBitBtn; + ButtonQuit: TButton; + interchar: TEdit; + interspace: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Memo1: TMemo; + + procedure BitBtnPlayClick(Sender: TObject); + procedure ButtonQuitClick(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure CreateMorsePlayer(); + + private + { private declarations } + public + { public declarations } + end; + +var + Form1: TForm1; + i: cardinal; + ordir: string; + +implementation + +{$R *.lfm} + + +procedure TForm1.CreateMorsePlayer(); +var + filetoplay, fileerror: string; + chara: string; + player: cardinal; +begin + if i <= length(Memo1.Text) then + begin + chara := copy(Memo1.Text, i, 1); + + fileerror := ordir + 'sound' + directoryseparator + 'morse_audio' + directoryseparator + '0.mp3'; + + if odd(i) then + player := 0 + else + player := 1; ///// to switch between player1 <> player2 + + if chara <> ' ' then + begin + uos_CreatePlayer(player); + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + uos_AddIntoDevOut(player, -1, 0.08, -1, -1, -1, -1, -1) ; + {$else} + uos_AddIntoDevOut(player); + {$endif} + + filetoplay := ordir + 'sound' + directoryseparator + 'morse_audio' + directoryseparator + lowercase(chara) + '.mp3'; + + if fileexists(PChar(filetoplay)) then + uos_AddFromFile(player, PChar(filetoplay)) + else + uos_AddFromFile(player, PChar(fileerror)); /// if not existing char + if length(Memo1.Text) > i then + uos_EndProc(player, @CreateMorsePlayer); /// assign EndProc + sleep(StrToInt(interchar.Text)); ///// the pause between each character + uos_Play(player); + Inc(i); + end + else + begin + sleep(StrToInt(interspace.Text)); ///// the pause if space character + Inc(i); + if length(Memo1.Text) >= i then + CreateMorsePlayer; + end; + + end; +end; + +procedure TForm1.BitBtnPlayClick(Sender: TObject); +var + charac: string; +begin + if Memo1.Text <> '' then + begin + i := 1; + CreateMorsePlayer(); + end; + +end; + +procedure TForm1.ButtonQuitClick(Sender: TObject); +begin + Close; +end; + +procedure TForm1.FormActivate(Sender: TObject); +var + PA_FileName, MP_FileName: string; +begin + memo1.Text := ''; + ordir := IncludeTrailingBackslash(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(openbsd) } + PA_FileName := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + MP_FileName := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so'; + {$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'; + {$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(cpuarm)} + PA_FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + MP_FileName := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.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} + + + {$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} + + uos_LoadLib(PChar(PA_FileName), nil, PChar(MP_FileName), nil, nil, nil, nil); + +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + uos_free; /// for release dynamic loaded libraries +end; + +end. + diff --git a/UOS/examples/main_nr.lfm b/UOS/examples/main_nr.lfm new file mode 100644 index 0000000..a8eba97 --- /dev/null +++ b/UOS/examples/main_nr.lfm @@ -0,0 +1,234 @@ +object Form1: TForm1 + Left = 610 + Height = 121 + Top = 194 + Width = 499 + BorderIcons = [biSystemMenu] + Caption = 'Noise Remover' + ClientHeight = 121 + ClientWidth = 499 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '2.0.6.0' + object Edit1: TEdit + Left = 130 + Height = 27 + Top = 14 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 1 + end + object Edit2: TEdit + Left = 130 + Height = 27 + Top = 54 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 2 + end + object Label1: TLabel + Left = 130 + Height = 18 + Top = 0 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label2: TLabel + Left = 130 + Height = 18 + Top = 40 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of SndFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object PaintBox1: TPaintBox + Left = 12 + Height = 105 + Top = 6 + Width = 105 + OnPaint = PaintBox1Paint + end + object Button1: TButton + Left = 134 + Height = 26 + Top = 88 + Width = 355 + Caption = 'Load that libraries' + OnClick = Button1Click + TabOrder = 0 + end + object Panel1: TPanel + Left = 2 + Height = 82 + Top = 2 + Width = 498 + ClientHeight = 82 + ClientWidth = 498 + Color = clMoneyGreen + ParentColor = False + TabOrder = 3 + Visible = False + OnClick = Panel1Click + object Edit4: TEdit + Left = 118 + Height = 27 + Top = 9 + Width = 286 + Alignment = taCenter + AutoSize = False + TabOrder = 0 + end + object Button3: TButton + Left = 130 + Height = 23 + Top = 46 + Width = 75 + Caption = 'Play' + OnClick = Button3Click + TabOrder = 1 + end + object Button4: TButton + Left = 324 + Height = 23 + Top = 46 + Width = 80 + Caption = 'Resume' + Enabled = False + OnClick = Button4Click + TabOrder = 2 + end + object Button5: TButton + Left = 234 + Height = 23 + Top = 46 + Width = 76 + Caption = 'Pause' + Enabled = False + OnClick = Button5Click + TabOrder = 3 + end + object Button6: TButton + Left = 416 + Height = 23 + Top = 46 + Width = 63 + Caption = 'Stop' + Enabled = False + OnClick = Button6Click + TabOrder = 4 + end + object Button2: TButton + Left = 406 + Height = 26 + Top = 10 + Width = 66 + Caption = 'Choose' + OnClick = Button2Click + TabOrder = 5 + end + object Chknoise: TCheckBox + Left = 6 + Height = 18 + Top = 30 + Width = 108 + Caption = 'Noise Remover' + Font.Height = 12 + OnChange = ChknoiseChange + ParentFont = False + TabOrder = 6 + end + end + object OpenDialog1: TOpenDialog + left = 76 + top = 36 + end +end diff --git a/UOS/examples/main_nr.pas b/UOS/examples/main_nr.pas new file mode 100644 index 0000000..fa900f2 --- /dev/null +++ b/UOS/examples/main_nr.pas @@ -0,0 +1,409 @@ + +/////////////////// Demo how to use United Openlib of Sound //////////////////// + +unit main_nr; + +{$mode objfpc}{$H+} + +interface + +uses + uos_flat, + Forms, + Dialogs, + SysUtils, + fileutil, + Graphics, + ctypes, + StdCtrls, + ComCtrls, + ExtCtrls, + Classes, + Controls; + +type + { TForm1 } + TForm1 = class(TForm) + Button1: TButton; + Button2: TButton; + Button3: TButton; + Button4: TButton; + Button5: TButton; + Button6: TButton; + Chknoise: TCheckBox; + Edit1: TEdit; + Edit10: TEdit; + Edit2: TEdit; + Edit4: TEdit; + Edit5: TEdit; + Label1: TLabel; + Label14: TLabel; + Label2: TLabel; + Label6: TLabel; + OpenDialog1: TOpenDialog; + PaintBox1: TPaintBox; + Panel1: TPanel; + Shape1: TShape; + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure Button5Click(Sender: TObject); + procedure Button6Click(Sender: TObject); + procedure ChknoiseChange(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + procedure Panel1Click(Sender: TObject); + procedure ClosePlayer1; + private + { private declarations } + public + { public declarations } + end; + + +procedure uos_logo(); + +var + Form1: TForm1; + BufferBMP: TBitmap; + PlayerIndex1: integer; + OutputIndex1, InputIndex1, DSPIndex1, DSPIndex2, PluginIndex1, PluginIndex2: integer; + plugsoundtouch: Boolean = False; + plugbs2b: Boolean = False; + +implementation + +{$R *.lfm} + +{ TForm1 } + + +procedure TForm1.ClosePlayer1; +begin + button3.Enabled := True; + button4.Enabled := False; + button5.Enabled := False; + button6.Enabled := False; +end; + +procedure TForm1.FormActivate(Sender: TObject); +var + ordir: string; +{$IFDEF Darwin} + opath: string; +{$ENDIF} +begin + ordir := application.Location; + uos_logo(); + {$IFDEF Windows} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + Edit2.Text := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + {$else} + Edit1.Text := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + Edit2.Text := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + {$endif} + Edit4.Text := ordir + 'sound\noisyvoice.ogg'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + Edit2.Text := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + {$else} + Edit1.Text := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + Edit2.Text := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + {$endif} + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + Edit2.Text := opath + '/lib/Mac/32bit/LibSndFile-32.dylib'; + Edit4.Text := ordir + '/sound/noisyvoice.ogg'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + Edit2.Text := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + Edit4.Text := ordir + '/sound/noisyvoice.ogg'; + {$ENDIF} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + Edit1.Text := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/Linux/64bit/LibSndFile-64.so'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + Edit1.Text := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + + {$if defined(cpu86) and defined(linux)} + Edit1.Text := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + Edit2.Text := ordir + 'lib/Linux/32bit/LibSndFile-32.so'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + {$if defined(linux) and defined(cpuarm)} + Edit1.Text := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + Edit2.Text := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + Edit1.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + Edit2.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + + opendialog1.Initialdir := application.Location + 'sound'; + +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.Panel1Click(Sender: TObject); +begin + +end; + + +procedure TForm1.Button1Click(Sender: TObject); +var + loadok: Boolean = False; +begin + +{$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so +if (Edit2.Text <> 'system') and (Edit2.Text <> '') then + if uos_TestLoadLibrary(PChar(edit2.Text)) = false then + edit2.Text := edit2.Text + '.2'; +{$endif} + + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + + if uos_LoadLib(PChar(Edit1.Text), PChar(Edit2.Text), nil, nil, nil, nil, nil) = 0 then + // You may load one or more libraries . When you want... : + begin + form1.hide; + loadok := True; + button1.Enabled := False; + edit1.ReadOnly := True; + edit2.ReadOnly := True; + + button1.Caption := + 'PortAudio and SndFile libraries are loaded...'; + Height := 82; + panel1.left := 0; + panel1.top := 0; + panel1.Height := form1.Height; + panel1.Width := form1.Width; + panel1.Visible := True; + Position := poScreenCenter; + Caption := 'Noise Remover. uos version ' + IntToStr(uos_getversion()); + Show; + end + else + MessageDlg('Error while loading libraries...', mtWarning, [mbYes], 0); +end; + + +procedure TForm1.Button5Click(Sender: TObject); +begin + uos_Pause(PlayerIndex1); + Button4.Enabled := True; + Button5.Enabled := False; +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin + Button4.Enabled := False; + Button5.Enabled := True; + Button6.Enabled := True; + application.ProcessMessages; + uos_RePlay(PlayerIndex1); +end; + +procedure TForm1.Button3Click(Sender: TObject); +var + samformat: shortint; +begin + + samformat := 0; + + 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(Windows)} + uos_CreatePlayer(PlayerIndex1); + {$else} + uos_CreatePlayer(PlayerIndex1,self); + {$endif} + //// Create the player. + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + InputIndex1 := uos_AddFromFile(PlayerIndex1, PChar(Edit4.Text), -1, + samformat, -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 div channels) + // result : -1 nothing created, otherwise Input Index in array + + if InputIndex1 > -1 then + begin + + // OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1) ; + //// add a Output into device with default parameters + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, -1,-1); + {$else} + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, -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) /// here default samplerate of input + //////////// 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) + // result : -1 nothing created, otherwise Output Index in array + + + uos_InputAddDSPNoiseRemoval(PlayerIndex1, InputIndex1); + uos_InputSetDSPNoiseRemoval(PlayerIndex1, InputIndex1, chknoise.Checked); + /// Add DSP Noise removal. First chunck will be the noise sample. + + /////// procedure to execute when stream is terminated + 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 general loop + + button3.Enabled := False; + button6.Enabled := True; + button5.Enabled := True; + button4.Enabled := False; + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets play it... + end; + +end; + +procedure TForm1.Button6Click(Sender: TObject); +begin + uos_Stop(PlayerIndex1); +end; + +procedure TForm1.Button2Click(Sender: TObject); +begin + if opendialog1.Execute then + Edit4.Text := opendialog1.FileName; +end; + + +procedure TForm1.ChknoiseChange(Sender: TObject); +begin + if button3.Enabled = False then + uos_InputSetDSPNoiseRemoval(PlayerIndex1, InputIndex1, chknoise.Checked); +end; + + +procedure uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + + +procedure TForm1.FormCreate(Sender: TObject); +begin + +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + if (button3.Enabled = False) then + begin + button6.Click; + sleep(500); + end; + uos_free; + BufferBMP.Free; +end; + + +end. + diff --git a/UOS/examples/main_sd.lfm b/UOS/examples/main_sd.lfm new file mode 100644 index 0000000..9802752 --- /dev/null +++ b/UOS/examples/main_sd.lfm @@ -0,0 +1,54 @@ +object Form1: TForm1 + Left = 696 + Height = 148 + Top = 246 + Width = 221 + Caption = 'Simple Drums' + ClientHeight = 148 + ClientWidth = 221 + OnActivate = FormActivate + OnClose = FormClose + LCLVersion = '3.0.0.3' + object Button1: TButton + Left = 76 + Height = 25 + Top = 76 + Width = 75 + Caption = 'Play' + TabOrder = 0 + OnClick = Button1Click + end + object Button2: TButton + Left = 76 + Height = 25 + Top = 112 + Width = 75 + Caption = 'Stop' + TabOrder = 1 + OnClick = Button2Click + end + object Edit1: TEdit + Left = 84 + Height = 27 + Top = 38 + Width = 56 + Alignment = taCenter + TabOrder = 2 + Text = '100' + end + object Label1: TLabel + Left = 72 + Height = 17 + Top = 6 + Width = 90 + Caption = 'Interval in ms' + ParentColor = False + end + object Timer1: TTimer + Enabled = False + Interval = 100 + OnTimer = Timer1Timer + Left = 272 + Top = 232 + end +end diff --git a/UOS/examples/main_sd.pas b/UOS/examples/main_sd.pas new file mode 100644 index 0000000..e1fffb3 --- /dev/null +++ b/UOS/examples/main_sd.pas @@ -0,0 +1,237 @@ +unit main_sd; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, + Forms, + Classes, + StdCtrls, + ExtCtrls, + uos_flat; + +type + + { TForm1 } + + TForm1 = class(TForm) + Button1: TButton; + Button2: TButton; + Edit1: TEdit; + Label1: TLabel; + Timer1: TTimer; + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); + procedure Timer1Timer(Sender: TObject); + private + { private declarations } + sound: array[0..2] of string; + ms: array[0..2] of Tmemorystream; + posi: integer; + drum_beats: array[0..2] of string; + public + { public declarations } + end; + +var + Form1: TForm1; + stopit: Boolean = False; + allok: Boolean = False; + x: integer = 0; + channels: cardinal = 2; // stereo output + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.Timer1Timer(Sender: TObject); +var + i: integer; + ge: Boolean = False; +begin + Timer1.Enabled := False; + if stopit = False then + begin + + for i := 0 to 2 do + if (Copy(drum_beats[i], posi, 1) = 'x') then + uos_PlaynofreePaused(i)// uos_InputSetDSPVolume(i,0,0.5,0.5,true); + ; + + application.ProcessMessages; // yes or no ? + + // if uos_SetGlobalEvent(true) was executed --> This set events (like pause/replay threads) to global. + // One event (for example uos_replay) will have impact on all players. + for i := 0 to 2 do + if (ge = False) and (Copy(drum_beats[i], posi, 1) = 'x') then + begin + uos_RePlay(i); + ge := True; // A uos_replay() of each player will have impact on all players. + end; + + Inc(posi); + if (posi > 16) then + posi := 1; + Timer1.Enabled := True; + end; + +end; + +procedure TForm1.Button1Click(Sender: TObject); +begin + Timer1.interval := StrToInt(edit1.Text); + stopit := False; + posi := 1; + Timer1.Enabled := True; + edit1.Enabled:=false; +end; + +procedure TForm1.Button2Click(Sender: TObject); +begin + stopit := True; + edit1.Enabled:=true; +end; + +procedure TForm1.FormActivate(Sender: TObject); +var + ordir: string; + lib1, lib2: string; + i: integer; +begin + ordir := Application.Location; + + {$IFDEF Windows} + {$if defined(cpu64)} + lib1 := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + lib2 := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + {$else} + lib1 := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + lib2 := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + {$endif} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + lib1 := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + lib2 := ordir + 'lib/Linux/64bit/LibSndFile-64.so'; + {$ENDIF} + {$if defined(cpu86) and defined(linux)} + lib1 := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + lib2 := ordir + 'lib/Linux/32bit/LibSndFile-32.so'; + {$ENDIF} + {$if defined(linux) and defined(cpuarm)} + lib1 := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + lib2 := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + lib1 := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + lib2 := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + lib1 := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + lib2 := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + lib1 := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so' ; + lib2 := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so' ; + {$else} + lib1 := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + lib2 := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so' ; + {$endif} + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + ordir := copy(ordir, 1, Pos('/UOS', ordir) - 1); + lib1 := ordir + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + lib2 := ordir + '/lib/Mac/32bit/LibSndFile-32.dylib'; + {$ENDIF} + {$IFDEF CPU64} + ordir := copy(ordir, 1, Pos('/UOS', ordir) - 1); + lib1 := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + lib2 := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + {$ENDIF} + {$ENDIF} + +{$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so +if lib2 <> 'system' then + if uos_TestLoadLibrary(PChar(lib2)) = false then + lib2 := lib2 + '.2'; +{$endif} + + uos_LoadLib(PChar(lib1), PChar(lib2), nil, nil, nil, nil, nil); + + sound[0] := Application.Location + 'sound' + directoryseparator + 'drums' + directoryseparator + 'HH.wav'; + sound[1] := Application.Location + 'sound' + directoryseparator + 'drums' + directoryseparator + 'SD.wav'; + sound[2] := Application.Location + 'sound' + directoryseparator + 'drums' + directoryseparator + 'BD.wav'; + + // { // using memorystream + ms[0] := TMemoryStream.Create; + ms[0].LoadFromFile(PChar(sound[0])); + ms[0].Position := 0; + + ms[1] := TMemoryStream.Create; + ms[1].LoadFromFile(PChar(sound[1])); + ms[1].Position := 0; + + ms[2] := TMemoryStream.Create; + ms[2].LoadFromFile(PChar(sound[2])); + ms[2].Position := 0; + // } + + drum_beats[0] := 'x0x0x0x0x0x0x0x0'; // hat + drum_beats[1] := '0000x0000000x000'; // snare + drum_beats[2] := 'x0000000x0x00000'; // kick + + posi := 1; + + for i := 0 to 2 do + if uos_CreatePlayer(i) then + + if uos_SetGlobalEvent(i, True) then + // This set events (like pause/replay thread) to global. + //One event (for example replay) will have impact on all players. + + // using memorystream + if uos_AddFromMemoryStream(i, ms[i], 0, -1, 0, 256) > -1 then + + // using file + // if uos_AddFromfile(i,pchar(sound[i]),-1,0,256) > -1 then + // if uos_InputAddDSPVolume(i,0,1,1) > -1 then + + if uos_AddFromEndlessMuted(i, channels, 256) > -1 then + // this for a dummy endless input, must be last input + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + if uos_AddIntoDevOut(i, -1, 0.08, -1, -1, 0, 256, -1) > -1 then // stereo output + {$else} + if uos_AddIntoDevOut(i, -1, 0.03, -1, -1, 0, 256, -1) > -1 then // stereo output + {$endif} + begin + uos_PlayNoFree(i); + sleep(250); + allok := True; + end + else + allok := False; + + // if allok = false then application.terminate; +end; + +procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction); +begin + uos_free(); +end; + +end. + diff --git a/UOS/examples/main_sp.lfm b/UOS/examples/main_sp.lfm new file mode 100644 index 0000000..ea1f569 --- /dev/null +++ b/UOS/examples/main_sp.lfm @@ -0,0 +1,652 @@ +object Form1: TForm1 + Left = 86 + Height = 422 + Top = 205 + Width = 499 + BorderIcons = [biSystemMenu] + Caption = 'Simple Player U0S PortAudio + SndFile + Mpg123' + ClientHeight = 422 + ClientWidth = 499 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '3.4.0.0' + object Edit1: TEdit + Left = 130 + Height = 27 + Top = 14 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 1 + end + object Edit2: TEdit + Left = 130 + Height = 27 + Top = 54 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 2 + end + object Edit3: TEdit + Left = 130 + Height = 27 + Top = 94 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 3 + end + object Label1: TLabel + Left = 130 + Height = 18 + Top = 0 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label2: TLabel + Left = 130 + Height = 18 + Top = 40 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of SndFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label3: TLabel + Left = 130 + Height = 18 + Top = 80 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Mpg123 Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object PaintBox1: TPaintBox + Left = 14 + Height = 105 + Top = 200 + Width = 105 + OnPaint = PaintBox1Paint + end + object Button1: TButton + Left = 8 + Height = 26 + Top = 384 + Width = 483 + Caption = 'Load that libraries' + TabOrder = 0 + OnClick = Button1Click + end + object Edit5: TEdit + Left = 130 + Height = 27 + Top = 270 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 4 + end + object Label6: TLabel + Left = 130 + Height = 18 + Top = 255 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Plugin SoundTouch Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label10: TLabel + Left = 130 + Height = 18 + Top = 296 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Plugin bs2b Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit6: TEdit + Left = 130 + Height = 27 + Top = 312 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 5 + end + object Label11: TLabel + Left = 130 + Height = 18 + Top = 120 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Mp4ff Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit7: TEdit + Left = 130 + Height = 27 + Top = 136 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 6 + end + object Label12: TLabel + Left = 130 + Height = 18 + Top = 161 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Faad2 Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit8: TEdit + Left = 130 + Height = 27 + Top = 176 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 7 + end + object Label14: TLabel + Left = 130 + Height = 18 + Top = 208 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of OpusFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit10: TEdit + Left = 130 + Height = 27 + Top = 224 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 8 + OnChange = Edit10Change + end + object Edit11: TEdit + Left = 130 + Height = 27 + Top = 352 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 10 + end + object Label15: TLabel + Left = 131 + Height = 18 + Top = 338 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of XMP Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Panel1: TPanel + Left = -248 + Height = 232 + Top = 48 + Width = 498 + ClientHeight = 232 + ClientWidth = 498 + Color = clMoneyGreen + ParentBackground = False + ParentColor = False + TabOrder = 9 + Visible = False + object Edit4: TEdit + Left = 118 + Height = 27 + Top = 9 + Width = 286 + Alignment = taCenter + AutoSize = False + TabOrder = 0 + end + object CheckBox1: TCheckBox + Left = 122 + Height = 21 + Top = 138 + Width = 98 + Caption = 'Play Reverse' + Font.Height = 12 + ParentFont = False + TabOrder = 1 + OnChange = CheckBox1Change + end + object TrackBar2: TTrackBar + Left = 120 + Height = 36 + Top = 35 + Width = 355 + Max = 100 + Position = 0 + TickStyle = tsNone + Enabled = False + OnMouseDown = TrackBar2MouseDown + OnMouseUp = TrackBar2MouseUp + TabOrder = 2 + end + object Label4: TLabel + Left = 12 + Height = 14 + Top = 115 + Width = 26 + Alignment = taCenter + Caption = 'Vol L' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Button3: TButton + Left = 128 + Height = 23 + Top = 187 + Width = 75 + Caption = 'Play' + TabOrder = 3 + OnClick = Button3Click + end + object Button4: TButton + Left = 304 + Height = 23 + Top = 188 + Width = 80 + Caption = 'Resume' + Enabled = False + TabOrder = 4 + OnClick = Button4Click + end + object Button5: TButton + Left = 216 + Height = 23 + Top = 187 + Width = 76 + Caption = 'Pause' + Enabled = False + TabOrder = 5 + OnClick = Button5Click + end + object Button6: TButton + Left = 400 + Height = 23 + Top = 187 + Width = 63 + Caption = 'Stop' + Enabled = False + TabOrder = 6 + OnClick = Button6Click + end + object Button2: TButton + Left = 406 + Height = 26 + Top = 10 + Width = 66 + Caption = 'Choose' + TabOrder = 7 + OnClick = Button2Click + end + object TrackBar3: TTrackBar + Left = 76 + Height = 100 + Top = 10 + Width = 31 + Max = 100 + OnChange = TrackBar1Change + Orientation = trVertical + Position = 100 + Reversed = True + TickStyle = tsNone + TabOrder = 8 + end + object Label5: TLabel + Left = 76 + Height = 14 + Top = 115 + Width = 28 + Alignment = taCenter + Caption = 'Vol R' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object RadioGroup1: TRadioGroup + Left = 8 + Height = 78 + Top = 132 + Width = 107 + AutoFill = True + Caption = 'Sample Format' + ChildSizing.LeftRightSpacing = 6 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize + ChildSizing.EnlargeVertical = crsHomogenousChildResize + ChildSizing.ShrinkHorizontal = crsScaleChilds + ChildSizing.ShrinkVertical = crsScaleChilds + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 1 + ClientHeight = 61 + ClientWidth = 103 + Color = clMoneyGreen + Font.Height = 12 + ParentBackground = False + ParentFont = False + ParentColor = False + TabOrder = 9 + object RadioButton1: TRadioButton + Left = 6 + Height = 16 + Top = 6 + Width = 91 + Caption = 'Float 32 bit' + Checked = True + Color = clMoneyGreen + ParentColor = False + TabOrder = 0 + TabStop = True + end + object RadioButton2: TRadioButton + Left = 6 + Height = 16 + Top = 22 + Width = 91 + Caption = 'Int 32 bit' + Color = clMoneyGreen + ParentColor = False + TabOrder = 1 + end + object RadioButton3: TRadioButton + Left = 6 + Height = 17 + Top = 38 + Width = 91 + Caption = 'Int 16 bit' + Color = clMoneyGreen + ParentColor = False + TabOrder = 2 + end + end + object llength: TLabel + Left = 304 + Height = 15 + Top = 75 + Width = 84 + Caption = '00:00:00.000' + Font.Height = 12 + ParentColor = False + ParentFont = False + end + object lposition: TLabel + Left = 200 + Height = 15 + Top = 75 + Width = 84 + Caption = '00:00:00.000' + Font.Height = 12 + ParentColor = False + ParentFont = False + end + object Label8: TLabel + Left = 294 + Height = 15 + Top = 75 + Width = 4 + Caption = '/' + Font.Height = 12 + ParentColor = False + ParentFont = False + end + object ShapeRight: TShape + Left = 62 + Height = 92 + Top = 15 + Width = 8 + Brush.Color = clLime + end + object ShapeLeft: TShape + Left = 48 + Height = 92 + Top = 15 + Width = 8 + Brush.Color = clLime + end + object CheckBox2: TCheckBox + Left = 266 + Height = 21 + Top = 94 + Width = 183 + Caption = 'Enable SoundTouch Plugin' + Font.Height = 12 + ParentFont = False + TabOrder = 10 + OnChange = ChangePlugSet + end + object Button7: TButton + Left = 270 + Height = 25 + Top = 145 + Width = 55 + Caption = 'Reset' + TabOrder = 11 + OnClick = ResetPlugClick + end + object Label7: TLabel + Left = 270 + Height = 15 + Top = 121 + Width = 67 + Caption = 'Tempo: 1.0' + Font.Height = 12 + ParentColor = False + ParentFont = False + end + object Label9: TLabel + Left = 382 + Height = 15 + Top = 120 + Width = 58 + Caption = 'Pitch: 1.0' + Font.Height = 12 + ParentColor = False + ParentFont = False + end + object TrackBar4: TTrackBar + Left = 342 + Height = 66 + Top = 118 + Width = 34 + Max = 100 + OnChange = ChangePlugSet + Orientation = trVertical + Position = 50 + Reversed = True + TickStyle = tsNone + TabOrder = 12 + end + object TrackBar5: TTrackBar + Left = 444 + Height = 66 + Top = 118 + Width = 34 + Max = 100 + OnChange = ChangePlugSet + Orientation = trVertical + Position = 50 + Reversed = True + TickStyle = tsNone + TabOrder = 13 + end + object CheckBox3: TCheckBox + Left = 122 + Height = 21 + Top = 96 + Width = 132 + Caption = 'Stereo to BinAural' + Font.Height = 12 + ParentFont = False + TabOrder = 14 + OnChange = CheckBox3Change + end + object Chknoise: TCheckBox + Left = 122 + Height = 21 + Top = 160 + Width = 112 + Caption = 'Noise Remover' + Font.Height = 12 + ParentFont = False + TabOrder = 15 + Visible = False + OnChange = ChknoiseChange + end + object chkstereo2mono: TCheckBox + Left = 122 + Height = 21 + Top = 115 + Width = 114 + Caption = 'Stereo to Mono' + Font.Height = 12 + ParentFont = False + TabOrder = 16 + OnChange = chkstereo2monoChange + end + object TrackBar1: TTrackBar + Left = 8 + Height = 100 + Top = 9 + Width = 31 + Max = 100 + OnChange = TrackBar1Change + Orientation = trVertical + Position = 100 + Reversed = True + TickStyle = tsNone + TabOrder = 17 + end + end + object OpenDialog1: TOpenDialog + Left = 76 + Top = 36 + end +end diff --git a/UOS/examples/main_sp.pas b/UOS/examples/main_sp.pas new file mode 100644 index 0000000..c55dba5 --- /dev/null +++ b/UOS/examples/main_sp.pas @@ -0,0 +1,814 @@ + +{ Demo how to use United Openlib of Sound (uos) } + +unit main_sp; + +{$mode objfpc}{$H+} + +interface + +uses + uos_flat, + Forms, + Dialogs, + SysUtils, + fileutil, + Graphics, + ctypes, + StdCtrls, + ComCtrls, + ExtCtrls, + Classes, + Controls; + +type + { TForm1 } + TForm1 = class(TForm) + Button1: TButton; + Button2: TButton; + Button3: TButton; + Button4: TButton; + Button5: TButton; + Button6: TButton; + Button7: TButton; + CheckBox1: TCheckBox; + CheckBox2: TCheckBox; + CheckBox3: TCheckBox; + Chknoise: TCheckBox; + chkstereo2mono: TCheckBox; + Edit1: TEdit; + Edit10: TEdit; + Edit11: TEdit; + Edit2: TEdit; + Edit3: TEdit; + Edit4: TEdit; + Edit5: TEdit; + Edit6: TEdit; + Edit7: TEdit; + Edit8: TEdit; + Label1: TLabel; + Label10: TLabel; + Label11: TLabel; + Label12: TLabel; + Label14: TLabel; + Label15: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + llength: TLabel; + lposition: TLabel; + OpenDialog1: TOpenDialog; + PaintBox1: TPaintBox; + Panel1: TPanel; + RadioButton1: TRadioButton; + RadioButton2: TRadioButton; + RadioButton3: TRadioButton; + RadioGroup1: TRadioGroup; + Shape1: TShape; + ShapeLeft: TShape; + ShapeRight: TShape; + TrackBar1: TTrackBar; + TrackBar2: TTrackBar; + TrackBar3: TTrackBar; + TrackBar4: TTrackBar; + TrackBar5: TTrackBar; + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure Button5Click(Sender: TObject); + procedure Button6Click(Sender: TObject); + procedure CheckBox1Change(Sender: TObject); + procedure CheckBox3Change(Sender: TObject); + procedure ChknoiseChange(Sender: TObject); + procedure chkstereo2monoChange(Sender: TObject); + procedure Edit10Change(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + procedure TrackBar1Change(Sender: TObject); + procedure TrackBar2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); + procedure TrackBar2MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); + procedure ClosePlayer1; + procedure LoopProcPlayer1; + procedure ShowPosition; + procedure ShowLevel; + procedure ChangePlugSet(Sender: TObject); + procedure ResetPlugClick(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + + // This is the "standart" DSP procedure look. +function DSPReverseBefore(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; +function DSPReverseAfter(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; + +function DSPStereo2Mono(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; + +procedure uos_logo(); + +var + Form1: TForm1; + BufferBMP: TBitmap; + PlayerIndex1: integer; + OutputIndex1, InputIndex1, DSPIndex1, DSPIndex2, PluginIndex1, PluginIndex2: integer; + plugsoundtouch: Boolean = False; + plugbs2b: Boolean = False; + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.ChangePlugSet(Sender: TObject); +var + tempo, rate: cfloat; +begin + if (trim(PChar(edit5.Text)) <> '') and fileexists(edit5.Text) then + begin + if (2 * (TrackBar4.Position / 100)) < 0.3 then + tempo := 0.3 + else + tempo := (2 * (TrackBar4.Position / 100)); + if (2 * (TrackBar5.Position / 100)) < 0.3 then + rate := 0.3 + else + rate := (2 * (TrackBar5.Position / 100)); + + label7.Caption := 'Tempo: ' + floattostrf(tempo, ffFixed, 15, 1); + label9.Caption := 'Pitch: ' + floattostrf(rate, ffFixed, 15, 1); + + if radiogroup1.Enabled = False then // player1 was created + uos_SetPluginSoundTouch(PlayerIndex1, PluginIndex2, tempo, rate, checkbox2.Checked); + end; + +end; + +procedure TForm1.ResetPlugClick(Sender: TObject); +begin + TrackBar4.Position := 50; + TrackBar5.Position := 50; + if radiogroup1.Enabled = False then // player1 was created + uos_SetPluginSoundTouch(PlayerIndex1, PluginIndex2, 1, 1, checkbox2.Checked); + +end; + +procedure TForm1.ClosePlayer1; +begin + button3.Enabled := True; + button4.Enabled := False; + button5.Enabled := False; + button6.Enabled := False; + trackbar2.Enabled := False; + radiogroup1.Enabled := True; + TrackBar2.Position := 0; + ShapeLeft.Height := 0; + ShapeRight.Height := 0; + ShapeLeft.top := 118 - ShapeLeft.Height; + ShapeRight.top := 118 - ShapeRight.Height; + lposition.Caption := '00:00:00.000'; +end; + +procedure TForm1.FormActivate(Sender: TObject); +var + ordir: string; +{$IFDEF Darwin} + opath: string; +{$ENDIF} +begin + ordir := application.Location; + uos_logo(); + {$IFDEF Windows} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + Edit2.Text := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + Edit3.Text := ordir + 'lib\Windows\64bit\LibMpg123-64.dll'; + Edit11.text := ordir + 'lib\Windows\64bit\libxmp-64.dll'; + Edit5.Text := ordir + 'lib\Windows\64bit\plugin\LibSoundTouch-64.dll'; + {$else} + Edit1.Text := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + Edit2.Text := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + Edit3.Text := ordir + 'lib\Windows\32bit\LibMpg123-32.dll'; + Edit11.text := ordir + 'lib\Windows\32bit\libxmp-32.dll'; + Edit7.text := ordir + 'lib\Windows\32bit\LibMp4ff-32.dll'; + Edit10.text := ordir + 'lib\Windows\32bit\LibOpusFile-32.dll'; + Edit8.text := ordir + 'lib\Windows\32bit\LibFaad2-32.dll'; + Edit5.Text := ordir + 'lib\Windows\32bit\plugin\LibSoundTouch-32.dll'; + // Error on Windows10 with libbs2b --> when closing application. + //Edit6.Text := ordir + 'lib\Windows\32bit\plugin\Libbs2b-32.dll'; + {$endif} + Edit4.Text := ordir + 'sound\test.ogg'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + Edit2.Text := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + Edit3.Text := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so'; + Edit5.text := ordir + 'lib/FreeBSD/64bit/plugin/libsoundtouch-64.so'; + Edit6.text := ordir + 'lib/FreeBSD/64bit/plugin/libbs2b-64.so'; + Edit10.text := ordir + 'lib/FreeBSD/64bit/libopusfile-64.so'; + + {$else} + Edit1.Text := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + Edit2.Text := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + Edit3.Text := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + Edit5.Text := '' ; +{$endif} + Edit4.Text := ordir + 'sound/test.ogg'; +{$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + Edit2.Text := opath + '/lib/Mac/32bit/LibSndFile-32.dylib'; + Edit3.Text := opath + '/lib/Mac/32bit/LibMpg123-32.dylib'; + Edit5.Text := opath + '/lib/Mac/32bit/plugin/LibSoundTouch-32.dylib'; + Edit4.Text := ordir + '/sound/test.ogg'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + Edit2.Text := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + Edit3.Text := opath + '/lib/Mac/64bit/LibMpg123-64.dylib'; + Edit11.Text := opath + '/lib/Mac/64bit/libxmp-64.dylib'; + Edit5.Text := opath + '/lib/Mac/64bit/plugin/libSoundTouchDLL-64.dylib'; + Edit4.Text := ordir + '/sound/test.ogg'; + {$ENDIF} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + Edit1.Text := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so'; + Edit5.Text := ordir + 'lib/OpenBSD/64bit/plugin/LibSoundTouch-64.so'; + Edit4.Text := ordir + '/sound/test.ogg'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + Edit1.Text := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/Linux/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + Edit7.text := ordir + 'lib/Linux/64bit/LibMp4ff-64.so'; + Edit8.text := ordir + 'lib/Linux/64bit/LibFaad2-64.so'; + Edit10.text := ordir + 'lib/Linux/64bit/LibOpusFile-64.so'; + Edit11.text := ordir + 'lib/Linux/64bit/libxmp-64.so'; + Edit5.Text := ordir + 'lib/Linux/64bit/plugin/LibSoundTouch-64.so'; + Edit6.Text := ordir + 'lib/Linux/64bit/plugin/libbs2b-64.so'; + Edit4.Text := ordir + 'sound/test.ogg'; + {$ENDIF} + + {$if defined(cpu86) and defined(linux)} + Edit1.Text := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + Edit2.Text := ordir + 'lib/Linux/32bit/LibSndFile-32.so'; + Edit3.Text := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; + Edit7.text := ordir + 'lib/Linux/32bit/LibMp4ff-32.so'; + Edit8.text := ordir + 'lib/Linux/32bit/LibFaad2-32.so'; + Edit5.Text := ordir + 'lib/Linux/32bit/plugin/LibSoundTouch-32.so'; + Edit11.text := ordir + 'lib/Linux/32bit/libxmp-32.so'; + Edit4.Text := ordir + 'sound/test.ogg'; + {$ENDIF} + + {$if defined(linux) and defined(cpuarm)} + Edit1.Text := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + Edit2.Text := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + Edit3.Text := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so'; + Edit11.Text := ordir + 'lib/Linux/arm_raspberrypi/libxmp-arm.so'; + Edit5.Text := ordir + 'lib/Linux/arm_raspberrypi/plugin/libsoundtouch-32.so'; + Edit4.Text := ordir + 'sound/test.ogg'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + Edit1.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + Edit2.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + Edit3.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + Edit11.text := ordir + 'lib/Linux/aarch64_raspberrypi/libxmp-aarch64.so'; + Edit5.Text := ordir + 'lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so'; + Edit4.Text := ordir + 'sound/test.ogg'; + {$ENDIF} + + opendialog1.Initialdir := application.Location + 'sound'; + +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.TrackBar1Change(Sender: TObject); +begin + uos_InputSetDSPVolume(PlayerIndex1, InputIndex1, TrackBar1.position / 100, + TrackBar3.position / 100, True); +end; + +procedure TForm1.TrackBar2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); +begin + TrackBar2.Tag := 1; +end; + +procedure TForm1.TrackBar2MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); +begin + uos_InputSeek(PlayerIndex1, InputIndex1, TrackBar2.position); + TrackBar2.Tag := 0; +end; + +procedure TForm1.Button1Click(Sender: TObject); +var + loadok: Boolean = False; +begin + {$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so + if (Edit2.Text <> 'system') and (Edit2.Text <> '') then + if uos_TestLoadLibrary(PChar(Edit2.Text)) = false then + begin + Edit2.Text := Edit2.Text + '.2'; + if uos_TestLoadLibrary(PChar(Edit2.Text)) = false then + MessageDlg('Error while loading SndFile library...', mtWarning, [mbYes], 0); + end; + {$endif} + + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, xmpfilename: PChar) : LongInt; + + if uos_LoadLib(PChar(Edit1.Text), PChar(Edit2.Text), + PChar(Edit3.Text), PChar(Edit7.Text), PChar(Edit8.Text), PChar(Edit10.Text), PChar(Edit11.Text)) = 0 then + // You may load one or more libraries . When you want... : + begin + form1.hide; + loadok := True; + button1.Enabled := False; + edit1.ReadOnly := True; + edit2.ReadOnly := True; + edit3.ReadOnly := True; + edit7.ReadOnly := True; + edit8.ReadOnly := True; + edit10.ReadOnly := True; + edit11.ReadOnly := True; + button1.Caption := + 'PortAudio, SndFile, Mpg123, AAC, Opus, XMP libraries are loaded...'; + end + else + MessageDlg('Error while loading libraries...', mtWarning, [mbYes], 0); + + if loadok = True then + begin + if ((trim(PChar(edit5.Text)) <> '') and fileexists(edit5.Text)) and (uos_LoadPlugin('soundtouch', PChar(Edit5.Text)) = 0) then + begin + plugsoundtouch := True; + button1.Caption := + 'PortAudio, SndFile, Mpg123, AAC, Opus, XMP and Plugin are loaded...'; + end + else + begin + TrackBar4.Enabled := False; + TrackBar5.Enabled := False; + CheckBox2.Enabled := False; + Button7.Enabled := False; + label9.Enabled := False; + label7.Enabled := False; + end; + + if ((trim(PChar(edit6.Text)) <> '') and fileexists(edit6.Text)) and (uos_LoadPlugin('bs2b', PChar(edit6.Text)) = 0) then + plugbs2b := True + else + CheckBox3.Enabled := False; + + Height := 232; + panel1.left := 0; + panel1.top := 0; + panel1.Height := form1.Height; + panel1.Width := form1.Width; + panel1.Visible := True; + Position := poScreenCenter; + Caption := 'Simple Player. uos version ' + IntToStr(uos_getversion()); + Show; + end; + +end; + +procedure TForm1.Button5Click(Sender: TObject); +begin + uos_Pause(PlayerIndex1); + Button4.Enabled := True; + Button5.Enabled := False; + ShapeLeft.Height := 0; + ShapeRight.Height := 0; + ShapeLeft.top := 118 - ShapeLeft.Height; + ShapeRight.top := 118 - ShapeRight.Height; +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin + Button4.Enabled := False; + Button5.Enabled := True; + Button6.Enabled := True; + application.ProcessMessages; + uos_RePlay(PlayerIndex1); +end; + +procedure TForm1.Button3Click(Sender: TObject); +var + samformat: shortint; + temptime: ttime; + ho, mi, se, ms: word; +begin + + if fileexists(Edit4.Text) then + begin + + if radiobutton1.Checked = True then + samformat := 0; + if radiobutton2.Checked = True then + samformat := 1; + if radiobutton3.Checked = True then + samformat := 2; + radiogroup1.Enabled := False; + InputIndex1 := -1; + + PlayerIndex1 := 0; + // PlayerIndex : from 0 to what your computer can do ! (depends of ram, cpu, ...) + // If PlayerIndex exists already, it will be overwritten... + + if uos_CreatePlayer(PlayerIndex1) then + // Create the player. + // PlayerIndex : from 0 to what your computer can do ! + // If PlayerIndex exists already, it will be overwriten... + + // InputIndex1 := uos_AddFromFile(PlayerIndex1, Edit4.Text); + // add input from audio file with default parameters + + InputIndex1 := uos_AddFromFile(PlayerIndex1, PChar(Edit4.Text), -1, samformat, -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 InputIndex1 > -1 then + begin + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, -1, -1); + {$else} + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, -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) // here default samplerate of input + // 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) + // result : -1 nothing created, otherwise Output Index in array + + uos_InputSetLevelEnable(PlayerIndex1, InputIndex1, 2); + // set calculation of level/volume (usefull for showvolume procedure) + // set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + // 3 => calcul before and after all DSP procedures. + + uos_InputSetPositionEnable(PlayerIndex1, InputIndex1, 1); + // set calculation of position (usefull for positions procedure) + // set position calculation (default is 0) + // 0 => no calcul + // 1 => calcul position. + + uos_LoopProcIn(PlayerIndex1, InputIndex1, @LoopProcPlayer1); + // Assign the procedure of object to execute inside the loop for a Input + // PlayerIndex : Index of a existing Player + // InIndex : Index of a existing Input + // LoopProcPlayer1 : procedure of object to execute inside the loop + + uos_InputAddDSPVolume(PlayerIndex1, InputIndex1, 1, 1); + // DSP Volume changer + // PlayerIndex1 : Index of a existing Player + // InputIndex1 : InputIndex of a existing input + // VolLeft : Left volume ( from 0 to 1 => gain > 1 ) + // VolRight : Right volume + + uos_InputSetDSPVolume(PlayerIndex1, InputIndex1, TrackBar1.position / 100, + TrackBar3.position / 100, True); // Set volume + // PlayerIndex1 : Index of a existing Player + // InputIndex1 : InputIndex of a existing Input + // VolLeft : Left volume + // VolRight : Right volume + // Enable : Enabled + + DSPIndex1 := uos_InputAddDSP(PlayerIndex1, InputIndex1, @DSPReverseBefore, @DSPReverseAfter, nil, nil); + // add a custom DSP procedure for input + // PlayerIndex1 : Index of a existing Player + // InputIndex1: InputIndex of existing input + // BeforeFunc : function to do before the buffer is filled + // AfterFunc : function to do after the buffer is filled + // EndedFunc : function to do at end of thread + // LoopProc : external procedure to do after the buffer is filled + // result = DSPIndex of the custom DSP + + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex1, checkbox1.Checked); + // set the parameters of custom DSP; + + // This is a other custom DSP...stereo to mono to show how to do a DSP ;-) + DSPIndex2 := uos_InputAddDSP(PlayerIndex1, InputIndex1, nil, @DSPStereo2Mono, nil, nil); + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex2, chkstereo2mono.Checked); + + // add bs2b plugin with samplerate_of_input1 / channels(2 = stereo) + if plugbs2b = True then + begin + PlugInIndex1 := uos_AddPlugin(PlayerIndex1, 'bs2b', uos_InputGetSampleRate(PlayerIndex1, InputIndex1), -1); + uos_SetPluginbs2b(PlayerIndex1, PluginIndex1, -1, -1, -1, checkbox3.Checked); + end; + + // add SoundTouch plugin with samplerate_of_input1 / channels(2 = stereo) + if plugsoundtouch = True then + begin + PluginIndex2 := uos_AddPlugin(PlayerIndex1, 'soundtouch', uos_InputGetSampleRate(PlayerIndex1, InputIndex1), -1); + ChangePlugSet(self); // Change plugin settings + end; + + trackbar2.Max := uos_InputLength(PlayerIndex1, InputIndex1); + // Length of Input in samples + + if trackbar2.Max > 0 then // mod's can not calculate length + begin + trackbar2.enabled := true; + temptime := uos_InputLengthTime(PlayerIndex1, InputIndex1); + // Length of input in time + + DecodeTime(temptime, ho, mi, se, ms); + + llength.Caption := format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); + end else + begin + trackbar2.enabled := false; + llength.Caption := '??:??:??.???'; + end; + + // procedure to execute when stream is terminated + 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 + + TrackBar2.position := 0; + + Button3.Enabled := False; + Button4.Enabled := False; + Button6.Enabled := True; + Button5.Enabled := True; + CheckBox1.Enabled := True; + + uos_Play(PlayerIndex1); // everything is ready, here we are, lets play it... + end; + end + else + MessageDlg(edit4.Text + ' do not exist...', mtWarning, [mbYes], 0); + +end; + +procedure TForm1.Button6Click(Sender: TObject); +begin + uos_Stop(PlayerIndex1); +end; + +procedure TForm1.Button2Click(Sender: TObject); +begin + if opendialog1.Execute then + Edit4.Text := opendialog1.FileName; +end; + +procedure TForm1.CheckBox1Change(Sender: TObject); +begin + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex1, checkbox1.Checked); +end; + +procedure TForm1.CheckBox3Change(Sender: TObject); +begin + uos_SetPluginbs2b(PlayerIndex1, PluginIndex1, -1, -1, -1, checkbox3.Checked); +end; + +procedure TForm1.ChknoiseChange(Sender: TObject); +begin + uos_InputSetDSPNoiseRemoval(PlayerIndex1, InputIndex1, chknoise.Checked); +end; + +procedure TForm1.chkstereo2monoChange(Sender: TObject); +begin + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex2, chkstereo2mono.Checked); +end; + +procedure TForm1.Edit10Change(Sender: TObject); +begin + +end; + +procedure uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + +procedure TForm1.ShowPosition; +var + temptime: ttime; + ho, mi, se, ms: word; +begin + if TrackBar2.Tag = 0 then + begin + if trackbar2.Max > 0 then + TrackBar2.Position := uos_InputPosition(PlayerIndex1, InputIndex1); + temptime := uos_InputPositionTime(PlayerIndex1, InputIndex1); + // Length of input in time + DecodeTime(temptime, ho, mi, se, ms); + lposition.Caption := format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); + end; +end; + +procedure Tform1.ShowLevel; +begin + ShapeLeft.Height := round(uos_InputGetLevelLeft(PlayerIndex1, InputIndex1) * 92); + ShapeRight.Height := round(uos_InputGetLevelRight(PlayerIndex1, InputIndex1) * 92); + ShapeLeft.top := 118 - ShapeLeft.Height; + ShapeRight.top := 118 - ShapeRight.Height; +end; + +procedure Tform1.LoopProcPlayer1; +begin + ShowPosition; + ShowLevel; +end; + +function DSPReverseBefore(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; +begin + + if (Data.position > Data.OutFrames div Data.channels) then + uos_InputSeek(PlayerIndex1, InputIndex1, Data.position - (Data.OutFrames div Data.channels)); +end; + +function DSPReverseAfter(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; +var + x: integer = 0; + arfl: TDArFloat; +begin + if (Data.position > Data.OutFrames div Data.channels) then + begin + SetLength(arfl, Data.outframes); + + while x < Data.outframes - 1 do + begin + arfl[x] := Data.Buffer[Data.outframes - x - 1]; + arfl[x + 1] := Data.Buffer[Data.outframes - x]; + x := x + 2; + end; + Result := arfl; + end + else + Result := Data.Buffer; +end; + +function DSPStereo2Mono(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; +var + x: integer = 0; + ps: PDArShort; // if input is Int16 format + pl: PDArLong; // if input is Int32 format + pf: PDArFloat; // if input is Float32 format + samplef: cFloat; + samplei: integer; +begin + if (Data.channels = 2) then + begin + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + while x < Data.OutFrames do + begin + samplei := round((ps^[x] + ps^[x + 1]) / 2); + ps^[x] := samplei; + ps^[x + 1] := samplei; + x := x + 2; + end; + end; + + 1: + begin + pl := @Data.Buffer; + while x < Data.OutFrames do + begin + samplei := round((pl^[x] + pl^[x + 1]) / 2); + pl^[x] := samplei; + pl^[x + 1] := samplei; + x := x + 2; + end; + end; + + 0: + begin + pf := @Data.Buffer; + while x < Data.OutFrames do + begin + samplef := (pf^[x] + pf^[x + 1]) / 2; + pf^[x] := samplef; + pf^[x + 1] := samplef; + x := x + 2; + end; + end; + + end; + Result := Data.Buffer; + end + else + Result := Data.Buffer; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + Height := 422; + ShapeLeft.Height := 0; + ShapeRight.Height := 0; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + if (button3.Enabled = False) then + begin + button6.Click; + sleep(200); + application.ProcessMessages; + end; + uos_free(); + BufferBMP.Free; +end; + +end. + diff --git a/UOS/examples/main_sp_nf.lfm b/UOS/examples/main_sp_nf.lfm new file mode 100644 index 0000000..41a975e --- /dev/null +++ b/UOS/examples/main_sp_nf.lfm @@ -0,0 +1,610 @@ +object Form1: TForm1 + Left = 824 + Height = 620 + Top = 167 + Width = 505 + BorderIcons = [biSystemMenu] + Caption = 'Simple Player U0S PortAudio + SndFile + Mpg123' + ClientHeight = 620 + ClientWidth = 505 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '3.4.0.0' + object Shape1: TShape + Left = 10 + Height = 216 + Top = 400 + Width = 489 + Brush.Color = clSilver + end + object TrackBar1: TTrackBar + Left = 25 + Height = 98 + Top = 408 + Width = 26 + Max = 100 + OnChange = TrackBar1Change + Orientation = trVertical + Position = 100 + Reversed = True + TickStyle = tsNone + TabOrder = 8 + end + object Edit1: TEdit + Left = 132 + Height = 27 + Top = 14 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 3 + end + object Edit2: TEdit + Left = 132 + Height = 27 + Top = 56 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 4 + end + object Edit3: TEdit + Left = 132 + Height = 27 + Top = 94 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 5 + end + object Label1: TLabel + Left = 130 + Height = 18 + Top = 0 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label2: TLabel + Left = 130 + Height = 18 + Top = 40 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of SndFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label3: TLabel + Left = 132 + Height = 18 + Top = 80 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Mpg123 Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit4: TEdit + Left = 138 + Height = 27 + Top = 449 + Width = 278 + Alignment = taCenter + AutoSize = False + TabOrder = 0 + end + object CheckBox1: TCheckBox + Left = 132 + Height = 21 + Top = 553 + Width = 108 + Caption = 'Play Reverse' + TabOrder = 6 + OnChange = CheckBox1Change + end + object PaintBox1: TPaintBox + Left = 16 + Height = 105 + Top = 99 + Width = 105 + OnPaint = PaintBox1Paint + end + object TrackBar2: TTrackBar + Left = 118 + Height = 36 + Top = 404 + Width = 369 + Max = 100 + Position = 0 + TickStyle = tsNone + Enabled = False + OnMouseDown = TrackBar2MouseDown + OnMouseUp = TrackBar2MouseUp + TabOrder = 7 + end + object Label4: TLabel + Left = 24 + Height = 14 + Top = 514 + Width = 26 + Alignment = taCenter + Caption = 'Vol L' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Button1: TButton + Left = 13 + Height = 26 + Top = 368 + Width = 483 + Caption = 'Load that libraries' + TabOrder = 2 + OnClick = Button1Click + end + object Button3: TButton + Left = 137 + Height = 23 + Top = 585 + Width = 75 + Caption = 'Play' + TabOrder = 1 + OnClick = Button3Click + end + object Button4: TButton + Left = 313 + Height = 23 + Top = 586 + Width = 80 + Caption = 'Resume' + Enabled = False + TabOrder = 9 + OnClick = Button4Click + end + object Button5: TButton + Left = 225 + Height = 23 + Top = 585 + Width = 76 + Caption = 'Pause' + Enabled = False + TabOrder = 10 + OnClick = Button5Click + end + object Button6: TButton + Left = 409 + Height = 23 + Top = 585 + Width = 63 + Caption = 'Stop' + Enabled = False + TabOrder = 11 + OnClick = Button6Click + end + object Button2: TButton + Left = 423 + Height = 26 + Top = 450 + Width = 66 + Caption = 'Choose' + TabOrder = 12 + OnClick = Button2Click + end + object TrackBar3: TTrackBar + Left = 84 + Height = 100 + Top = 408 + Width = 26 + Max = 100 + OnChange = TrackBar1Change + Orientation = trVertical + Position = 0 + Reversed = True + TickStyle = tsNone + TabOrder = 13 + end + object Label5: TLabel + Left = 81 + Height = 14 + Top = 514 + Width = 28 + Alignment = taCenter + Caption = 'Vol R' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object RadioGroup1: TRadioGroup + Left = 17 + Height = 78 + Top = 531 + Width = 107 + AutoFill = True + Caption = 'Sample Format' + ChildSizing.LeftRightSpacing = 6 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize + ChildSizing.EnlargeVertical = crsHomogenousChildResize + ChildSizing.ShrinkHorizontal = crsScaleChilds + ChildSizing.ShrinkVertical = crsScaleChilds + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 1 + ClientHeight = 59 + ClientWidth = 103 + Color = clSilver + ParentBackground = False + ParentColor = False + TabOrder = 14 + object RadioButton1: TRadioButton + Left = 6 + Height = 15 + Top = 6 + Width = 91 + Caption = 'Float 32 bit' + Checked = True + TabOrder = 0 + TabStop = True + end + object RadioButton2: TRadioButton + Left = 6 + Height = 16 + Top = 21 + Width = 91 + Caption = 'Int 32 bit' + TabOrder = 1 + end + object RadioButton3: TRadioButton + Left = 6 + Height = 16 + Top = 37 + Width = 91 + Caption = 'Int 16 bit' + TabOrder = 2 + end + end + object llength: TLabel + Left = 314 + Height = 17 + Top = 428 + Width = 84 + Caption = '00:00:00.000' + ParentColor = False + end + object lposition: TLabel + Left = 192 + Height = 17 + Top = 428 + Width = 84 + Caption = '00:00:00.000' + ParentColor = False + end + object Label8: TLabel + Left = 304 + Height = 17 + Top = 428 + Width = 4 + Caption = '/' + ParentColor = False + end + object ShapeRight: TShape + Left = 70 + Height = 92 + Top = 414 + Width = 8 + Brush.Color = clLime + end + object ShapeLeft: TShape + Left = 54 + Height = 92 + Top = 414 + Width = 8 + Brush.Color = clLime + end + object Edit5: TEdit + Left = 130 + Height = 27 + Top = 256 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 15 + OnChange = Edit5Change + end + object Label6: TLabel + Left = 130 + Height = 18 + Top = 242 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Plugin SoundTouch Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object CheckBox2: TCheckBox + Left = 288 + Height = 21 + Top = 480 + Width = 192 + Caption = 'Enable SoundTouch Plugin' + TabOrder = 16 + OnChange = ChangePlugSet + end + object Button7: TButton + Left = 289 + Height = 25 + Top = 546 + Width = 55 + Caption = 'Reset' + TabOrder = 17 + OnClick = ResetPlugClick + end + object Label7: TLabel + Left = 279 + Height = 17 + Top = 519 + Width = 71 + Caption = 'Tempo: 1.0' + ParentColor = False + end + object Label9: TLabel + Left = 385 + Height = 17 + Top = 520 + Width = 60 + Caption = 'Pitch: 1.0' + ParentColor = False + end + object TrackBar4: TTrackBar + Left = 349 + Height = 66 + Top = 505 + Width = 34 + Max = 100 + OnChange = ChangePlugSet + Orientation = trVertical + Position = 50 + Reversed = True + TickStyle = tsNone + TabOrder = 18 + end + object TrackBar5: TTrackBar + Left = 454 + Height = 66 + Top = 505 + Width = 34 + Max = 100 + OnChange = ChangePlugSet + Orientation = trVertical + Position = 50 + Reversed = True + TickStyle = tsNone + TabOrder = 19 + end + object CheckBox3: TCheckBox + Left = 132 + Height = 21 + Top = 488 + Width = 141 + Caption = 'Stereo to BinAural' + TabOrder = 20 + OnChange = CheckBox3Change + end + object Label10: TLabel + Left = 136 + Height = 18 + Top = 282 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Plugin bs2b Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit6: TEdit + Left = 132 + Height = 27 + Top = 296 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 21 + end + object chkstereo2mono: TCheckBox + Left = 132 + Height = 21 + Top = 519 + Width = 122 + Caption = 'Stereo to Mono' + TabOrder = 22 + OnChange = chkstereo2monoChange + end + object Label11: TLabel + Left = 130 + Height = 18 + Top = 120 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Mp4ff Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit7: TEdit + Left = 132 + Height = 27 + Top = 136 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 23 + OnChange = Edit5Change + end + object Label12: TLabel + Left = 130 + Height = 18 + Top = 161 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Faad2 Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit8: TEdit + Left = 130 + Height = 27 + Top = 177 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 24 + end + object Edit11: TEdit + Left = 132 + Height = 27 + Top = 336 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 25 + OnChange = Edit11Change + end + object Label13: TLabel + Left = 132 + Height = 18 + Top = 322 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of XMP library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit10: TEdit + Left = 130 + Height = 27 + Top = 216 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 26 + end + object Label14: TLabel + Left = 132 + Height = 18 + Top = 204 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of OpusFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object OpenDialog1: TOpenDialog + Left = 76 + Top = 36 + end +end diff --git a/UOS/examples/main_sp_nf.pas b/UOS/examples/main_sp_nf.pas new file mode 100644 index 0000000..4111dad --- /dev/null +++ b/UOS/examples/main_sp_nf.pas @@ -0,0 +1,819 @@ + +/////////////////// Demo how to use United Openlib of Sound //////////////////// + +unit main_sp_nf; + +{$mode objfpc}{$H+} + +interface + +uses + uos, + Forms, + Dialogs, + SysUtils, + fileutil, + Graphics, + ctypes, + StdCtrls, + ComCtrls, + ExtCtrls, + Classes, + Controls; + +type + { TForm1 } + TForm1 = class(TForm) + Button1: TButton; + Button2: TButton; + Button3: TButton; + Button4: TButton; + Button5: TButton; + Button6: TButton; + Button7: TButton; + CheckBox1: TCheckBox; + CheckBox2: TCheckBox; + CheckBox3: TCheckBox; + chkstereo2mono: TCheckBox; + Edit1: TEdit; + Edit10: TEdit; + Edit2: TEdit; + Edit3: TEdit; + Edit4: TEdit; + Edit5: TEdit; + Edit6: TEdit; + Edit7: TEdit; + Edit8: TEdit; + Edit11: TEdit; + Label1: TLabel; + Label10: TLabel; + Label11: TLabel; + Label12: TLabel; + Label13: TLabel; + Label14: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label9: TLabel; + llength: TLabel; + lposition: TLabel; + Label8: TLabel; + OpenDialog1: TOpenDialog; + PaintBox1: TPaintBox; + RadioButton1: TRadioButton; + RadioButton2: TRadioButton; + RadioButton3: TRadioButton; + RadioGroup1: TRadioGroup; + Shape1: TShape; + ShapeRight: TShape; + ShapeLeft: TShape; + TrackBar2: TTrackBar; + TrackBar1: TTrackBar; + TrackBar3: TTrackBar; + TrackBar4: TTrackBar; + TrackBar5: TTrackBar; + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure Button5Click(Sender: TObject); + procedure Button6Click(Sender: TObject); + procedure Button8Click(Sender: TObject); + procedure CheckBox1Change(Sender: TObject); + procedure CheckBox3Change(Sender: TObject); + procedure chkstereo2monoChange(Sender: TObject); + procedure Edit5Change(Sender: TObject); + procedure Edit11Change(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + procedure TrackBar1Change(Sender: TObject); + procedure TrackBar2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); + procedure TrackBar2MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); + procedure ClosePlayer1; + procedure LoopProcPlayer1; + procedure ShowPosition; + procedure ShowLevel; + procedure ChangePlugSet(Sender: TObject); + procedure ResetPlugClick(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + + ////// This is the "standart" DSP procedure look. +function DSPReverseBefore(var Data: Tuos_Data; var fft: Tuos_FFT): TDArFloat; +function DSPReverseAfter(var Data: Tuos_Data; var fft: Tuos_FFT): TDArFloat; + +function DSPStereo2Mono(var Data: Tuos_Data; var fft: Tuos_FFT): TDArFloat; + +procedure uos_logo(); + +var + Form1: TForm1; + BufferBMP: TBitmap; + plugsoundtouch: Boolean = False; + plugbs2b: Boolean = False; + + PlayerIndex1: Tuos_Player; + + OutputIndex1, InputIndex1, DSPIndex1, DSPIndex2, DSPVolume, PluginIndex1, PluginIndex2: integer; + + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.ChangePlugSet(Sender: TObject); +var + tempo, rate: cfloat; +begin + if (trim(PChar(edit5.Text)) <> '') and fileexists(edit5.Text) then + begin + if (2 * (TrackBar4.Position / 100)) < 0.3 then + tempo := 0.3 + else + tempo := (2 * (TrackBar4.Position / 100)); + if (2 * (TrackBar5.Position / 100)) < 0.3 then + rate := 0.3 + else + rate := (2 * (TrackBar5.Position / 100)); + + label7.Caption := 'Tempo: ' + floattostrf(tempo, ffFixed, 15, 1); + label9.Caption := 'Pitch: ' + floattostrf(rate, ffFixed, 15, 1); + + if radiogroup1.Enabled = False then /// player1 was created + PlayerIndex1.SetPluginSoundTouch(PluginIndex2, tempo, rate, checkbox2.Checked); + end; + +end; + +procedure TForm1.ResetPlugClick(Sender: TObject); +begin + TrackBar4.Position := 50; + TrackBar5.Position := 50; + if radiogroup1.Enabled = False then /// player1 was created + PlayerIndex1.SetPluginSoundTouch(PluginIndex2, 1, 1, checkbox2.Checked); + +end; + +procedure TForm1.ClosePlayer1; +begin + Form1.button3.Enabled := True; + Form1.button4.Enabled := False; + Form1.button5.Enabled := False; + Form1.button6.Enabled := False; + Form1.trackbar2.Enabled := False; + Form1.radiogroup1.Enabled := True; + Form1.TrackBar2.Position := 0; + Form1.ShapeLeft.Height := 0; + Form1.ShapeRight.Height := 0; + Form1.ShapeLeft.top := 414; + Form1.ShapeRight.top := 414; + form1.lposition.Caption := '00:00:00.000'; +end; + +procedure TForm1.FormActivate(Sender: TObject); +var + ordir: string; +{$IFDEF Darwin} + opath: string; +{$ENDIF} +begin + ordir := application.Location; + uos_logo(); + {$IFDEF Windows} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + Edit2.Text := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + Edit3.Text := ordir + 'lib\Windows\64bit\LibMpg123-64.dll'; + Edit11.text := ordir + 'lib\Windows\64bit\libxmp-64.dll'; + Edit5.Text := ordir + 'lib\Windows\64bit\plugin\LibSoundTouch-64.dll'; + {$else} + Edit1.Text := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + Edit2.Text := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + Edit3.Text := ordir + 'lib\Windows\32bit\LibMpg123-32.dll'; + Edit11.text := ordir + 'lib\Windows\32bit\libxmp-32.dll'; + Edit7.text := ordir + 'lib\Windows\32bit\LibMp4ff-32.dll'; + Edit10.text := ordir + 'lib\Windows\32bit\LibOpusFile-32.dll'; + Edit8.text := ordir + 'lib\Windows\32bit\LibFaad2-32.dll'; + Edit5.Text := ordir + 'lib\Windows\32bit\plugin\LibSoundTouch-32.dll'; + // Error on Windows10 with libbs2b --> when closing application. + //Edit6.Text := ordir + 'lib\Windows\32bit\plugin\Libbs2b-32.dll'; + {$endif} + Edit4.Text := ordir + 'sound\test.ogg'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + Edit2.Text := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + Edit3.Text := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so'; + Edit5.text := ordir + 'lib/FreeBSD/64bit/plugin/libsoundtouch-64.so'; + Edit6.text := ordir + 'lib/FreeBSD/64bit/plugin/libbs2b-64.so'; + Edit10.text := ordir + 'lib/FreeBSD/64bit/libopusfile-64.so'; + + {$else} + Edit1.Text := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + Edit2.Text := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + Edit3.Text := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + Edit5.Text := '' ; +{$endif} + Edit4.Text := ordir + 'sound/test.ogg'; +{$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + Edit2.Text := opath + '/lib/Mac/32bit/LibSndFile-32.dylib'; + Edit3.Text := opath + '/lib/Mac/32bit/LibMpg123-32.dylib'; + Edit5.Text := opath + '/lib/Mac/32bit/plugin/LibSoundTouch-32.dylib'; + Edit4.Text := ordir + '/sound/test.ogg'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + Edit2.Text := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + Edit3.Text := opath + '/lib/Mac/64bit/LibMpg123-64.dylib'; + Edit11.Text := opath + '/lib/Mac/64bit/libxmp-64.dylib'; + Edit5.Text := opath + '/lib/Mac/64bit/plugin/libSoundTouchDLL-64.dylib'; + Edit4.Text := ordir + '/sound/test.ogg'; + {$ENDIF} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + Edit1.Text := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so'; + Edit5.Text := ordir + 'lib/OpenBSD/64bit/plugin/LibSoundTouch-64.so'; + Edit4.Text := ordir + '/sound/test.ogg'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + Edit1.Text := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/Linux/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + Edit7.text := ordir + 'lib/Linux/64bit/LibMp4ff-64.so'; + Edit8.text := ordir + 'lib/Linux/64bit/LibFaad2-64.so'; + Edit10.text := ordir + 'lib/Linux/64bit/LibOpusFile-64.so'; + Edit11.text := ordir + 'lib/Linux/64bit/libxmp-64.so'; + Edit5.Text := ordir + 'lib/Linux/64bit/plugin/LibSoundTouch-64.so'; + Edit6.Text := ordir + 'lib/Linux/64bit/plugin/libbs2b-64.so'; + Edit4.Text := ordir + 'sound/test.ogg'; + {$ENDIF} + + {$if defined(cpu86) and defined(linux)} + Edit1.Text := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + Edit2.Text := ordir + 'lib/Linux/32bit/LibSndFile-32.so'; + Edit3.Text := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; + Edit7.text := ordir + 'lib/Linux/32bit/LibMp4ff-32.so'; + Edit8.text := ordir + 'lib/Linux/32bit/LibFaad2-32.so'; + Edit5.Text := ordir + 'lib/Linux/32bit/plugin/LibSoundTouch-32.so'; + Edit11.text := ordir + 'lib/Linux/32bit/libxmp-32.so'; + Edit4.Text := ordir + 'sound/test.ogg'; + {$ENDIF} + + {$if defined(linux) and defined(cpuarm)} + Edit1.Text := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + Edit2.Text := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + Edit3.Text := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so'; + Edit11.Text := ordir + 'lib/Linux/arm_raspberrypi/libxmp-arm.so'; + Edit5.Text := ordir + 'lib/Linux/arm_raspberrypi/plugin/libsoundtouch-32.so'; + Edit4.Text := ordir + 'sound/test.ogg'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + Edit1.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + Edit2.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + Edit3.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + Edit11.text := ordir + 'lib/Linux/aarch64_raspberrypi/libxmp-aarch64.so'; + Edit5.Text := ordir + 'lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so'; + Edit4.Text := ordir + 'sound/test.ogg'; + {$ENDIF} + + opendialog1.Initialdir := application.Location + 'sound'; + +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.TrackBar1Change(Sender: TObject); +begin + if (button3.Enabled = False) then + PlayerIndex1.InputSetDSPVolume(InputIndex1, DSPVolume, TrackBar1.position / 100, + TrackBar3.position / 100, True); +end; + +procedure TForm1.TrackBar2MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); +begin + TrackBar2.Tag := 1; +end; + +procedure TForm1.TrackBar2MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer); +begin + PlayerIndex1.InputSeek(InputIndex1, TrackBar2.position); + TrackBar2.Tag := 0; +end; + +procedure TForm1.Button1Click(Sender: TObject); +var + loadok: Boolean = False; +begin + {$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so +if (Edit2.Text <> 'system') and (Edit2.Text <> '') then + if uos_TestLoadLibrary(PChar(Edit2.Text)) = false then + begin + Edit2.Text := Edit2.Text + '.2'; + if uos_TestLoadLibrary(PChar(Edit2.Text)) = false then + MessageDlg('Error while loading SndFile library...', mtWarning, [mbYes], 0); + end; + {$endif} + + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, xmpfilename: PChar) : LongInt; + + if uos_LoadLib(PChar(Edit1.Text), PChar(Edit2.Text), + PChar(Edit3.Text), PChar(Edit7.Text), PChar(Edit8.Text), PChar(Edit10.Text), PChar(Edit11.Text)) = 0 then + // You may load one or more libraries . When you want... : + begin + form1.hide; + loadok := True; + button1.Enabled := False; + edit1.ReadOnly := True; + edit2.ReadOnly := True; + edit3.ReadOnly := True; + edit5.ReadOnly := True; + button1.Caption := + 'PortAudio, SndFile and Mpg123 libraries are loaded...'; + end + else + MessageDlg('Error while loading libraries...', mtWarning, [mbYes], 0); + + if loadok = True then + begin + if ((trim(PChar(edit5.Text)) <> '') and fileexists(edit5.Text)) and (uos_LoadPlugin('soundtouch', PChar(Edit5.Text)) = 0) then + begin + plugsoundtouch := True; + button1.Caption := + 'PortAudio, SndFile, Mpg123 and Plugin are loaded...'; + end + else + begin + TrackBar4.Enabled := False; + TrackBar5.Enabled := False; + CheckBox2.Enabled := False; + Button7.Enabled := False; + label9.Enabled := False; + label7.Enabled := False; + end; + + if ((trim(PChar(edit6.Text)) <> '') and fileexists(edit6.Text)) and (uos_LoadPlugin('bs2b', PChar(edit6.Text)) = 0) then + plugbs2b := True + else + CheckBox3.Enabled := False; + + form1.Height := 626; + form1.Position := poScreenCenter; + form1.Caption := 'Simple Player. uos version ' + IntToStr(uos_getversion()); + form1.Show; + end; + +end; + +procedure TForm1.Button5Click(Sender: TObject); +begin + PlayerIndex1.Pause(); + Button4.Enabled := True; + Button5.Enabled := False; + Form1.ShapeLeft.Height := 0; + Form1.ShapeRight.Height := 0; + Form1.ShapeLeft.top := 414; + Form1.ShapeRight.top := 414; +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin + Button4.Enabled := False; + Button5.Enabled := True; + Button6.Enabled := True; + application.ProcessMessages; + PlayerIndex1.RePlay(); +end; + +procedure TForm1.Button3Click(Sender: TObject); +var + samformat: shortint; + temptime: ttime; + ho, mi, se, ms: word; +begin + + if fileexists(Edit4.Text) then + begin + + // PlayerIndex : from 0 to what your computer can do ! (depends of ram, cpu, ...) + // If PlayerIndex exists already, it will be overwritten... + + if radiobutton1.Checked = True then + samformat := 0; + if radiobutton2.Checked = True then + samformat := 1; + if radiobutton3.Checked = True then + samformat := 2; + + radiogroup1.Enabled := False; + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + PlayerIndex1 := Tuos_Player.Create(); + {$else} + PlayerIndex1 := Tuos_Player.Create(true,self); + {$endif} + + //// Create the player. + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + InputIndex1 := PlayerIndex1.AddFromFile(PChar(Edit4.Text), -1, samformat, -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 div channels) + // result : -1 nothing created, otherwise Input Index in array + + if InputIndex1 > -1 then + begin + + // OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1) ; + //// add a Output into device with default parameters + + OutputIndex1 := PlayerIndex1.AddIntoDevOut(-1, -1, PlayerIndex1.StreamIn[InputIndex1].Data.SampleRate, -1, samformat, -1, -1); + // 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 (= 65536) + // ChunkCount : default : -1 (= 512) + // result : Output Index in array -1 = error + // example : OutputIndex1 := AddIntoDevOut(-1,-1,-1,-1,0,-1,-1); + + // PlayerIndex1.StreamIn[In1Index].Data.levelEnable:=2 ; + PlayerIndex1.InputSetLevelEnable(InputIndex1, 2); + ///// set calculation of level/volume (usefull for showvolume procedure) + ///////// set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + // 3 => calcul before and after all DSP procedures. + + // PlayerIndex1.StreamIn[In1Index].Data.PositionEnable:= 1 ; + PlayerIndex1.InputSetPositionEnable(InputIndex1, 1); + ///// set calculation of position (usefull for positions procedure) + ///////// set position calculation (default is 0) + // 0 => no calcul + // 1 => calcul position. + + PlayerIndex1.StreamIn[InputIndex1].LoopProc := @LoopProcPlayer1; + ///// Assign the procedure of object to execute inside the loop + //////////// PlayerIndex : Index of a existing Player + //////////// InputIndex1 : Index of a existing Input + //////////// LoopProcPlayer1 : procedure of object to execute inside the loop + + DSPVolume := PlayerIndex1.InputAddDSPVolume(InputIndex1, 1, 1); + ///// DSP Volume changer + ////////// PlayerIndex1 : Index of a existing Player + ////////// InputIndex1 : Index of a existing input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + + PlayerIndex1.InputSetDSPVolume(InputIndex1, DSPVolume, TrackBar1.position / 100, + TrackBar3.position / 100, True); /// Set volume + ////////// PlayerIndex1 : Index of a existing Player + ////////// DSPVolume : Index of a existing dsp + ////////// InputIndex1 : InputIndex of a existing Input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + ////////// Enable : Enabled + + DSPIndex1 := PlayerIndex1.InputAddDSP(InputIndex1, @DSPReverseBefore, @DSPReverseAfter, nil, nil); + ///// add a custom DSP procedure for input + ////////// PlayerIndex1 : Index of a existing Player + ////////// InputIndex1: InputIndex of existing input + ////////// BeforeFunc : function to do before the buffer is filled + ////////// AfterFunc : function to do after the buffer is filled + ////////// EndedFunc : function to do at end of thread + ////////// LoopProc : external procedure to do after the buffer is filled + + //// set the parameters of custom DSP + PlayerIndex1.InputSetDSP(InputIndex1, DSPIndex1, checkbox1.Checked); + + // This is a other custom DSP...stereo to mono to show how to do a DSP ;-) + DSPIndex2 := PlayerIndex1.InputAddDSP(InputIndex1, nil, @DSPStereo2Mono, nil, nil); + PlayerIndex1.InputSetDSP(InputIndex1, DSPIndex2, chkstereo2mono.Checked); + + ///// add bs2b plugin with samplerate_of_input1 / default channels (2 = stereo) + if plugbs2b = True then + begin + PlugInIndex1 := PlayerIndex1.AddPlugin('bs2b', PlayerIndex1.StreamIn[InputIndex1].Data.SampleRate, -1); + PlayerIndex1.SetPluginbs2b(PluginIndex1, -1, -1, -1, checkbox3.Checked); + end; + + /// add SoundTouch plugin with samplerate of input1 / default channels (2 = stereo) + /// SoundTouch plugin should be the last added. + if plugsoundtouch = True then + begin + PlugInIndex2 := PlayerIndex1.AddPlugin('soundtouch', + PlayerIndex1.StreamIn[InputIndex1].Data.SampleRate, -1); + ChangePlugSet(self); //// custom procedure to Change plugin settings + end; + + trackbar2.Max := PlayerIndex1.InputLength(InputIndex1); + ////// Length of Input in samples + + if trackbar2.Max > 0 then // mod's can not calculate length + begin + trackbar2.enabled := true; + + temptime := PlayerIndex1.InputLengthTime(InputIndex1); + ////// Length of input in time + + DecodeTime(temptime, ho, mi, se, ms); + + llength.Caption := format('%d:%d:%d.%d', [ho, mi, se, ms]); + + end else + begin + trackbar2.enabled := false; + llength.Caption := '??:??:??.???'; + end; + + /////// procedure to execute when stream is terminated + PlayerIndex1.EndProc := @ClosePlayer1; + ///// Assign the procedure of object to execute at end + //////////// PlayerIndex : Index of a existing Player + //////////// ClosePlayer1 : procedure of object to execute inside the general loop + + TrackBar2.position := 0; + + CheckBox1.Enabled := True; + + button3.Enabled := False; + button6.Enabled := True; + button5.Enabled := True; + button4.Enabled := False; + + PlayerIndex1.Play(); + end; + end; + +end; + +procedure TForm1.Button6Click(Sender: TObject); +begin + PlayerIndex1.Stop(); +end; + +procedure TForm1.Button8Click(Sender: TObject); +begin + PlayerIndex1.PlayNoFree(); +end; + +procedure TForm1.Button2Click(Sender: TObject); +begin + if opendialog1.Execute then + Edit4.Text := opendialog1.FileName; +end; + +procedure TForm1.CheckBox1Change(Sender: TObject); +begin + if (button3.Enabled = False) then + PlayerIndex1.InputSetDSP(InputIndex1, DSPIndex1, checkbox1.Checked); +end; + +procedure TForm1.CheckBox3Change(Sender: TObject); +begin + if radiogroup1.Enabled = False then /// player1 was created + PlayerIndex1.SetPluginbs2b(PluginIndex1, -1, -1, -1, checkbox3.Checked); +end; + +procedure TForm1.chkstereo2monoChange(Sender: TObject); +begin + if radiogroup1.Enabled = False then + PlayerIndex1.InputSetDSP(InputIndex1, DSPIndex2, chkstereo2mono.Checked); +end; + +procedure TForm1.Edit5Change(Sender: TObject); +begin + +end; + +procedure TForm1.Edit11Change(Sender: TObject); +begin + +end; + +procedure uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + +procedure TForm1.ShowPosition; +var + temptime: ttime; + ho, mi, se, ms: word; +begin + if form1.TrackBar2.Tag = 0 then + begin + if trackbar2.Max > 0 then + form1.TrackBar2.Position := PlayerIndex1.InputPosition(InputIndex1); + temptime := PlayerIndex1.InputPositionTime(InputIndex1); + ////// Length of input in time + DecodeTime(temptime, ho, mi, se, ms); + form1.lposition.Caption := format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); + end; +end; + +procedure Tform1.ShowLevel; +begin + ShapeLeft.Height := round(PlayerIndex1.InputGetLevelLeft(InputIndex1) * 92); + ShapeRight.Height := round(PlayerIndex1.InputGetLevelRight(InputIndex1) * 92); + ShapeLeft.top := 506 - ShapeLeft.Height; + ShapeRight.top := 506 - ShapeRight.Height; +end; + +procedure Tform1.LoopProcPlayer1; +begin + ShowPosition; + ShowLevel; +end; +//{ +function DSPReverseBefore(var Data: Tuos_Data; var fft: Tuos_FFT): TDArFloat; +begin + if Data.position > Data.OutFrames div Data.ratio then + PlayerIndex1.InputSeek(InputIndex1, Data.position - (Data.OutFrames div (Data.Ratio))); +end; + +function DSPReverseAfter(var Data: Tuos_Data; var fft: Tuos_FFT): TDArFloat; +var + x: integer; + arfl: TDArFloat; +begin + SetLength(arfl, length(Data.Buffer)); + + for x := 0 to ((Data.OutFrames * Data.Ratio) - 1) do + if odd(x) then + arfl[x] := Data.Buffer[((Data.OutFrames * Data.Ratio) - 1) - x - 1] + else + arfl[x] := Data.Buffer[((Data.OutFrames * Data.Ratio) - 1) - x + 1]; + Result := arfl; +end; +//} + +function DSPStereo2Mono(var Data: Tuos_Data; var fft: Tuos_FFT): TDArFloat; +var + x: integer = 0; + ps: PDArShort; //////// if input is Int16 format + pl: PDArLong; //////// if input is Int32 format + pf: PDArFloat; //////// if input is Float32 format + samplef: cFloat; + samplei: integer; +begin + if (Data.channels = 2) then + begin + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + while x < Data.OutFrames do + begin + samplei := round((ps^[x] + ps^[x + 1]) / 2); + ps^[x] := samplei; + ps^[x + 1] := samplei; + x := x + 2; + end; + end; + + 1: + begin + pl := @Data.Buffer; + while x < Data.OutFrames do + begin + samplei := round((pl^[x] + pl^[x + 1]) / 2); + pl^[x] := samplei; + pl^[x + 1] := samplei; + x := x + 2; + end; + end; + + 0: + begin + pf := @Data.Buffer; + while x < Data.OutFrames do + begin + samplef := (pf^[x] + pf^[x + 1]) / 2; + pf^[x] := samplef; + pf^[x + 1] := samplef; + x := x + 2; + end; + end; + + end; + Result := Data.Buffer; + end + else + Result := Data.Buffer; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + Form1.Height := 396; + ShapeLeft.Height := 0; + ShapeRight.Height := 0; + trackbar1.Position := 100; + trackbar3.Position := 100; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + if (button3.Enabled = False) then + begin + button6.Click; + sleep(500); + end; + if button1.Enabled = False then + begin + PlayerIndex1.Free; + uos_free; + end; +end; + + +end. + diff --git a/UOS/examples/main_spectrum_mse.pas b/UOS/examples/main_spectrum_mse.pas new file mode 100644 index 0000000..5d3e87c --- /dev/null +++ b/UOS/examples/main_spectrum_mse.pas @@ -0,0 +1,312 @@ +unit main_spectrum_mse; + +{$ifdef FPC}{$mode objfpc}{$h+}{$endif} +interface + +uses + msetypes, + mseglob, + mseguiglob, + mseguiintf, + mseapplication, + msestat, + msemenus, + msegui, + msegraphics, + msegraphutils, + mseevent, + mseclasses, + msewidgets, + mseforms, + ctypes, + msegraphedits, + mseificomp, + mseificompglob, + mseifiglob, + msescrollbar, + mseact, + msebitmap, + msedataedits, + msedatanodes, + msedropdownlist, + mseedit, + msefiledialog, + msegrids, + mselistbrowser, + msestatfile, + msestream, + msesys, + SysUtils, + msesimplewidgets; + +type + tmainfo = class(tmainform) + tprogressbar1: tprogressbar; + tprogressbar2: tprogressbar; + tprogressbar3: tprogressbar; + tprogressbar4: tprogressbar; + tprogressbar5: tprogressbar; + tprogressbar6: tprogressbar; + tprogressbar7: tprogressbar; + tprogressbar8: tprogressbar; + tprogressbar9: tprogressbar; + tprogressbar10: tprogressbar; + tfilenameedit1: tfilenameedit; + button1: TButton; + tbutton2: TButton; + + label1: tlabel; + procedure formcreated(const Sender: TObject); + + procedure closeplayer; + procedure FormDestroy(Sender: TObject); + procedure LoopProcPlayer; + procedure button1click(const Sender: TObject); + procedure butstopclick(const Sender: TObject); + end; + + equalizer_band_type = record + lo_freq, hi_freq: integer; + Text: string[10]; + end; + +var + mainfo: tmainfo; + Equalizer_Bands: array[1..10] of equalizer_band_type; + UOSLoaded: Boolean = False; + + res, x, y, z: integer; + thearray: array of cfloat; + ordir, SoundFilename, PA_FileName, SF_FileName, MP_FileName: string; + PlayerIndex1, InputIndex1, OutputIndex1: integer; + + +implementation + +uses + main_spectrum_mse_mfm, + uos_flat; + +procedure tmainfo.formcreated(const 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.mp3'; + {$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.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'; + 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'; + 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'; + 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'; + 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'; + 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.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-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'; + MP_FileName := opath + '/lib/Mac/64bit/LibMpg123-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} + + tfilenameedit1.Value := 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 libraries 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('tprogressbar' + IntToStr(i))).frame.Caption := + Equalizer_Bands[i].Text; + Inc(i); + end; +end; + +procedure tmainfo.button1click(const Sender: TObject); +var + i: integer; +begin + + PlayerIndex1 := 0; + + SoundFilename := tfilenameedit1.Value; + + if uos_CreatePlayer(PlayerIndex1) then + begin + 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, @ClosePlayer); + + 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 tmainfo.ClosePlayer; +begin + button1.Enabled := True; +end; + +procedure tmainfo.FormDestroy(Sender: TObject); +begin + uos_stop(PlayerIndex1); + uos_free(); +end; + +procedure tmainfo.LoopProcPlayer; +var + i: integer; + v: cfloat; +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 := (thearray[x] + thearray[x + 1]) / 2; + TProgressBar(findcomponent('Tprogressbar' + IntToStr(i))).Value := v; + end; + x := x + 2; + Inc(i); + end; + end; +end; + +procedure tmainfo.butstopclick(const Sender: TObject); +begin + uos_stop(PlayerIndex1); +end; + +end. + diff --git a/UOS/examples/main_spectrum_mse_mfm.pas b/UOS/examples/main_spectrum_mse_mfm.pas new file mode 100644 index 0000000..f3756fe --- /dev/null +++ b/UOS/examples/main_spectrum_mse_mfm.pas @@ -0,0 +1,411 @@ +unit main_spectrum_mse_mfm; +{$ifdef FPC}{$mode objfpc}{$h+}{$endif} + +interface + +implementation +uses + mseclasses,main_spectrum_mse; + +const + objdata: record size: integer; data: array[0..7879] of byte end = + (size: 7880; data: ( + 84,80,70,48,7,116,109,97,105,110,102,111,6,109,97,105,110,102,111,8, + 98,111,117,110,100,115,95,120,3,169,2,8,98,111,117,110,100,115,95,121, + 3,14,1,9,98,111,117,110,100,115,95,99,120,3,82,1,9,98,111,117, + 110,100,115,95,99,121,3,253,0,26,99,111,110,116,97,105,110,101,114,46, + 102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,0,27,99, + 111,110,116,97,105,110,101,114,46,102,114,97,109,101,46,108,111,99,97,108, + 112,114,111,112,115,49,11,0,16,99,111,110,116,97,105,110,101,114,46,98, + 111,117,110,100,115,1,2,0,2,0,3,82,1,3,253,0,0,7,99,97, + 112,116,105,111,110,6,16,70,105,108,116,101,114,115,32,83,112,101,99,116, + 114,117,109,15,105,99,111,110,46,111,114,105,103,102,111,114,109,97,116,6, + 3,112,110,103,13,119,105,110,100,111,119,111,112,97,99,105,116,121,5,0, + 0,0,0,0,0,0,128,255,255,9,111,110,99,114,101,97,116,101,100,7, + 11,102,111,114,109,99,114,101,97,116,101,100,15,109,111,100,117,108,101,99, + 108,97,115,115,110,97,109,101,6,9,116,109,97,105,110,102,111,114,109,0, + 12,116,112,114,111,103,114,101,115,115,98,97,114,13,116,112,114,111,103,114, + 101,115,115,98,97,114,49,22,102,114,97,109,101,46,99,97,112,116,105,111, + 110,116,101,120,116,102,108,97,103,115,11,9,116,102,95,98,111,116,116,111, + 109,0,17,102,114,97,109,101,46,102,111,110,116,46,104,101,105,103,104,116, + 2,8,15,102,114,97,109,101,46,102,111,110,116,46,110,97,109,101,6,11, + 115,116,102,95,100,101,102,97,117,108,116,21,102,114,97,109,101,46,102,111, + 110,116,46,108,111,99,97,108,112,114,111,112,115,11,10,102,108,112,95,104, + 101,105,103,104,116,0,16,102,114,97,109,101,46,108,111,99,97,108,112,114, + 111,112,115,11,10,102,114,108,95,102,105,108,101,102,116,9,102,114,108,95, + 102,105,116,111,112,11,102,114,108,95,102,105,114,105,103,104,116,12,102,114, + 108,95,102,105,98,111,116,116,111,109,0,17,102,114,97,109,101,46,108,111, + 99,97,108,112,114,111,112,115,49,11,11,102,114,108,49,95,102,111,108,101, + 102,116,10,102,114,108,49,95,102,111,116,111,112,12,102,114,108,49,95,102, + 111,114,105,103,104,116,13,102,114,108,49,95,102,111,98,111,116,116,111,109, + 0,8,98,111,117,110,100,115,95,120,2,8,8,98,111,117,110,100,115,95, + 121,2,60,9,98,111,117,110,100,115,95,99,120,2,30,9,98,111,117,110, + 100,115,95,99,121,3,180,0,9,100,105,114,101,99,116,105,111,110,7,5, + 103,100,95,117,112,23,98,97,114,95,102,97,99,101,46,102,97,100,101,95, + 112,111,115,46,99,111,117,110,116,2,1,23,98,97,114,95,102,97,99,101, + 46,102,97,100,101,95,112,111,115,46,105,116,101,109,115,1,2,0,0,25, + 98,97,114,95,102,97,99,101,46,102,97,100,101,95,99,111,108,111,114,46, + 99,111,117,110,116,2,1,25,98,97,114,95,102,97,99,101,46,102,97,100, + 101,95,99,111,108,111,114,46,105,116,101,109,115,1,4,21,0,0,160,0, + 23,98,97,114,95,102,97,99,101,46,102,97,100,101,95,100,105,114,101,99, + 116,105,111,110,7,5,103,100,95,117,112,19,98,97,114,95,102,97,99,101, + 46,108,111,99,97,108,112,114,111,112,115,11,15,102,97,108,95,102,97,100, + 105,114,101,99,116,105,111,110,0,20,98,97,114,95,102,114,97,109,101,46, + 108,111,99,97,108,112,114,111,112,115,11,10,102,114,108,95,102,105,108,101, + 102,116,9,102,114,108,95,102,105,116,111,112,11,102,114,108,95,102,105,114, + 105,103,104,116,12,102,114,108,95,102,105,98,111,116,116,111,109,0,21,98, + 97,114,95,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,49, + 11,11,102,114,108,49,95,102,111,108,101,102,116,10,102,114,108,49,95,102, + 111,116,111,112,12,102,114,108,49,95,102,111,114,105,103,104,116,13,102,114, + 108,49,95,102,111,98,111,116,116,111,109,0,10,118,97,108,117,101,114,97, + 110,103,101,2,100,10,118,97,108,117,101,115,116,97,114,116,2,0,5,118, + 97,108,117,101,2,0,6,102,111,114,109,97,116,6,0,0,0,12,116,112, + 114,111,103,114,101,115,115,98,97,114,13,116,112,114,111,103,114,101,115,115, + 98,97,114,50,17,102,114,97,109,101,46,102,111,110,116,46,104,101,105,103, + 104,116,2,8,15,102,114,97,109,101,46,102,111,110,116,46,110,97,109,101, + 6,11,115,116,102,95,100,101,102,97,117,108,116,21,102,114,97,109,101,46, + 102,111,110,116,46,108,111,99,97,108,112,114,111,112,115,11,10,102,108,112, + 95,104,101,105,103,104,116,0,16,102,114,97,109,101,46,108,111,99,97,108, + 112,114,111,112,115,11,10,102,114,108,95,102,105,108,101,102,116,9,102,114, + 108,95,102,105,116,111,112,11,102,114,108,95,102,105,114,105,103,104,116,12, + 102,114,108,95,102,105,98,111,116,116,111,109,0,17,102,114,97,109,101,46, + 108,111,99,97,108,112,114,111,112,115,49,11,11,102,114,108,49,95,102,111, + 108,101,102,116,10,102,114,108,49,95,102,111,116,111,112,12,102,114,108,49, + 95,102,111,114,105,103,104,116,13,102,114,108,49,95,102,111,98,111,116,116, + 111,109,0,8,116,97,98,111,114,100,101,114,2,1,8,98,111,117,110,100, + 115,95,120,2,40,8,98,111,117,110,100,115,95,121,2,60,9,98,111,117, + 110,100,115,95,99,120,2,30,9,98,111,117,110,100,115,95,99,121,3,180, + 0,9,100,105,114,101,99,116,105,111,110,7,5,103,100,95,117,112,23,98, + 97,114,95,102,97,99,101,46,102,97,100,101,95,112,111,115,46,99,111,117, + 110,116,2,1,23,98,97,114,95,102,97,99,101,46,102,97,100,101,95,112, + 111,115,46,105,116,101,109,115,1,2,0,0,25,98,97,114,95,102,97,99, + 101,46,102,97,100,101,95,99,111,108,111,114,46,99,111,117,110,116,2,1, + 25,98,97,114,95,102,97,99,101,46,102,97,100,101,95,99,111,108,111,114, + 46,105,116,101,109,115,1,4,21,0,0,160,0,23,98,97,114,95,102,97, + 99,101,46,102,97,100,101,95,100,105,114,101,99,116,105,111,110,7,5,103, + 100,95,117,112,19,98,97,114,95,102,97,99,101,46,108,111,99,97,108,112, + 114,111,112,115,11,15,102,97,108,95,102,97,100,105,114,101,99,116,105,111, + 110,0,20,98,97,114,95,102,114,97,109,101,46,108,111,99,97,108,112,114, + 111,112,115,11,10,102,114,108,95,102,105,108,101,102,116,9,102,114,108,95, + 102,105,116,111,112,11,102,114,108,95,102,105,114,105,103,104,116,12,102,114, + 108,95,102,105,98,111,116,116,111,109,0,21,98,97,114,95,102,114,97,109, + 101,46,108,111,99,97,108,112,114,111,112,115,49,11,11,102,114,108,49,95, + 102,111,108,101,102,116,10,102,114,108,49,95,102,111,116,111,112,12,102,114, + 108,49,95,102,111,114,105,103,104,116,13,102,114,108,49,95,102,111,98,111, + 116,116,111,109,0,10,118,97,108,117,101,114,97,110,103,101,2,100,10,118, + 97,108,117,101,115,116,97,114,116,2,0,5,118,97,108,117,101,2,0,6, + 102,111,114,109,97,116,6,0,0,0,12,116,112,114,111,103,114,101,115,115, + 98,97,114,13,116,112,114,111,103,114,101,115,115,98,97,114,51,17,102,114, + 97,109,101,46,102,111,110,116,46,104,101,105,103,104,116,2,8,15,102,114, + 97,109,101,46,102,111,110,116,46,110,97,109,101,6,11,115,116,102,95,100, + 101,102,97,117,108,116,21,102,114,97,109,101,46,102,111,110,116,46,108,111, + 99,97,108,112,114,111,112,115,11,10,102,108,112,95,104,101,105,103,104,116, + 0,16,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,10, + 102,114,108,95,102,105,108,101,102,116,9,102,114,108,95,102,105,116,111,112, + 11,102,114,108,95,102,105,114,105,103,104,116,12,102,114,108,95,102,105,98, + 111,116,116,111,109,0,17,102,114,97,109,101,46,108,111,99,97,108,112,114, + 111,112,115,49,11,11,102,114,108,49,95,102,111,108,101,102,116,10,102,114, + 108,49,95,102,111,116,111,112,12,102,114,108,49,95,102,111,114,105,103,104, + 116,13,102,114,108,49,95,102,111,98,111,116,116,111,109,0,8,116,97,98, + 111,114,100,101,114,2,2,8,98,111,117,110,100,115,95,120,2,72,8,98, + 111,117,110,100,115,95,121,2,60,9,98,111,117,110,100,115,95,99,120,2, + 30,9,98,111,117,110,100,115,95,99,121,3,180,0,9,100,105,114,101,99, + 116,105,111,110,7,5,103,100,95,117,112,23,98,97,114,95,102,97,99,101, + 46,102,97,100,101,95,112,111,115,46,99,111,117,110,116,2,1,23,98,97, + 114,95,102,97,99,101,46,102,97,100,101,95,112,111,115,46,105,116,101,109, + 115,1,2,0,0,25,98,97,114,95,102,97,99,101,46,102,97,100,101,95, + 99,111,108,111,114,46,99,111,117,110,116,2,1,25,98,97,114,95,102,97, + 99,101,46,102,97,100,101,95,99,111,108,111,114,46,105,116,101,109,115,1, + 4,21,0,0,160,0,23,98,97,114,95,102,97,99,101,46,102,97,100,101, + 95,100,105,114,101,99,116,105,111,110,7,5,103,100,95,117,112,19,98,97, + 114,95,102,97,99,101,46,108,111,99,97,108,112,114,111,112,115,11,15,102, + 97,108,95,102,97,100,105,114,101,99,116,105,111,110,0,20,98,97,114,95, + 102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,10,102,114, + 108,95,102,105,108,101,102,116,9,102,114,108,95,102,105,116,111,112,11,102, + 114,108,95,102,105,114,105,103,104,116,12,102,114,108,95,102,105,98,111,116, + 116,111,109,0,21,98,97,114,95,102,114,97,109,101,46,108,111,99,97,108, + 112,114,111,112,115,49,11,11,102,114,108,49,95,102,111,108,101,102,116,10, + 102,114,108,49,95,102,111,116,111,112,12,102,114,108,49,95,102,111,114,105, + 103,104,116,13,102,114,108,49,95,102,111,98,111,116,116,111,109,0,10,118, + 97,108,117,101,114,97,110,103,101,2,100,10,118,97,108,117,101,115,116,97, + 114,116,2,0,5,118,97,108,117,101,2,0,6,102,111,114,109,97,116,6, + 0,0,0,12,116,112,114,111,103,114,101,115,115,98,97,114,13,116,112,114, + 111,103,114,101,115,115,98,97,114,52,17,102,114,97,109,101,46,102,111,110, + 116,46,104,101,105,103,104,116,2,8,15,102,114,97,109,101,46,102,111,110, + 116,46,110,97,109,101,6,11,115,116,102,95,100,101,102,97,117,108,116,21, + 102,114,97,109,101,46,102,111,110,116,46,108,111,99,97,108,112,114,111,112, + 115,11,10,102,108,112,95,104,101,105,103,104,116,0,16,102,114,97,109,101, + 46,108,111,99,97,108,112,114,111,112,115,11,10,102,114,108,95,102,105,108, + 101,102,116,9,102,114,108,95,102,105,116,111,112,11,102,114,108,95,102,105, + 114,105,103,104,116,12,102,114,108,95,102,105,98,111,116,116,111,109,0,17, + 102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11,11,102, + 114,108,49,95,102,111,108,101,102,116,10,102,114,108,49,95,102,111,116,111, + 112,12,102,114,108,49,95,102,111,114,105,103,104,116,13,102,114,108,49,95, + 102,111,98,111,116,116,111,109,0,8,116,97,98,111,114,100,101,114,2,3, + 8,98,111,117,110,100,115,95,120,2,104,8,98,111,117,110,100,115,95,121, + 2,60,9,98,111,117,110,100,115,95,99,120,2,30,9,98,111,117,110,100, + 115,95,99,121,3,180,0,9,100,105,114,101,99,116,105,111,110,7,5,103, + 100,95,117,112,23,98,97,114,95,102,97,99,101,46,102,97,100,101,95,112, + 111,115,46,99,111,117,110,116,2,1,23,98,97,114,95,102,97,99,101,46, + 102,97,100,101,95,112,111,115,46,105,116,101,109,115,1,2,0,0,25,98, + 97,114,95,102,97,99,101,46,102,97,100,101,95,99,111,108,111,114,46,99, + 111,117,110,116,2,1,25,98,97,114,95,102,97,99,101,46,102,97,100,101, + 95,99,111,108,111,114,46,105,116,101,109,115,1,4,21,0,0,160,0,23, + 98,97,114,95,102,97,99,101,46,102,97,100,101,95,100,105,114,101,99,116, + 105,111,110,7,5,103,100,95,117,112,19,98,97,114,95,102,97,99,101,46, + 108,111,99,97,108,112,114,111,112,115,11,15,102,97,108,95,102,97,100,105, + 114,101,99,116,105,111,110,0,20,98,97,114,95,102,114,97,109,101,46,108, + 111,99,97,108,112,114,111,112,115,11,10,102,114,108,95,102,105,108,101,102, + 116,9,102,114,108,95,102,105,116,111,112,11,102,114,108,95,102,105,114,105, + 103,104,116,12,102,114,108,95,102,105,98,111,116,116,111,109,0,21,98,97, + 114,95,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11, + 11,102,114,108,49,95,102,111,108,101,102,116,10,102,114,108,49,95,102,111, + 116,111,112,12,102,114,108,49,95,102,111,114,105,103,104,116,13,102,114,108, + 49,95,102,111,98,111,116,116,111,109,0,10,118,97,108,117,101,114,97,110, + 103,101,2,100,10,118,97,108,117,101,115,116,97,114,116,2,0,5,118,97, + 108,117,101,2,0,6,102,111,114,109,97,116,6,0,0,0,12,116,112,114, + 111,103,114,101,115,115,98,97,114,13,116,112,114,111,103,114,101,115,115,98, + 97,114,53,17,102,114,97,109,101,46,102,111,110,116,46,104,101,105,103,104, + 116,2,8,15,102,114,97,109,101,46,102,111,110,116,46,110,97,109,101,6, + 11,115,116,102,95,100,101,102,97,117,108,116,21,102,114,97,109,101,46,102, + 111,110,116,46,108,111,99,97,108,112,114,111,112,115,11,10,102,108,112,95, + 104,101,105,103,104,116,0,16,102,114,97,109,101,46,108,111,99,97,108,112, + 114,111,112,115,11,10,102,114,108,95,102,105,108,101,102,116,9,102,114,108, + 95,102,105,116,111,112,11,102,114,108,95,102,105,114,105,103,104,116,12,102, + 114,108,95,102,105,98,111,116,116,111,109,0,17,102,114,97,109,101,46,108, + 111,99,97,108,112,114,111,112,115,49,11,11,102,114,108,49,95,102,111,108, + 101,102,116,10,102,114,108,49,95,102,111,116,111,112,12,102,114,108,49,95, + 102,111,114,105,103,104,116,13,102,114,108,49,95,102,111,98,111,116,116,111, + 109,0,8,116,97,98,111,114,100,101,114,2,4,8,98,111,117,110,100,115, + 95,120,3,136,0,8,98,111,117,110,100,115,95,121,2,60,9,98,111,117, + 110,100,115,95,99,120,2,30,9,98,111,117,110,100,115,95,99,121,3,180, + 0,9,100,105,114,101,99,116,105,111,110,7,5,103,100,95,117,112,23,98, + 97,114,95,102,97,99,101,46,102,97,100,101,95,112,111,115,46,99,111,117, + 110,116,2,1,23,98,97,114,95,102,97,99,101,46,102,97,100,101,95,112, + 111,115,46,105,116,101,109,115,1,2,0,0,25,98,97,114,95,102,97,99, + 101,46,102,97,100,101,95,99,111,108,111,114,46,99,111,117,110,116,2,1, + 25,98,97,114,95,102,97,99,101,46,102,97,100,101,95,99,111,108,111,114, + 46,105,116,101,109,115,1,4,21,0,0,160,0,23,98,97,114,95,102,97, + 99,101,46,102,97,100,101,95,100,105,114,101,99,116,105,111,110,7,5,103, + 100,95,117,112,19,98,97,114,95,102,97,99,101,46,108,111,99,97,108,112, + 114,111,112,115,11,15,102,97,108,95,102,97,100,105,114,101,99,116,105,111, + 110,0,20,98,97,114,95,102,114,97,109,101,46,108,111,99,97,108,112,114, + 111,112,115,11,10,102,114,108,95,102,105,108,101,102,116,9,102,114,108,95, + 102,105,116,111,112,11,102,114,108,95,102,105,114,105,103,104,116,12,102,114, + 108,95,102,105,98,111,116,116,111,109,0,21,98,97,114,95,102,114,97,109, + 101,46,108,111,99,97,108,112,114,111,112,115,49,11,11,102,114,108,49,95, + 102,111,108,101,102,116,10,102,114,108,49,95,102,111,116,111,112,12,102,114, + 108,49,95,102,111,114,105,103,104,116,13,102,114,108,49,95,102,111,98,111, + 116,116,111,109,0,10,118,97,108,117,101,114,97,110,103,101,2,100,10,118, + 97,108,117,101,115,116,97,114,116,2,0,5,118,97,108,117,101,2,0,6, + 102,111,114,109,97,116,6,0,0,0,12,116,112,114,111,103,114,101,115,115, + 98,97,114,13,116,112,114,111,103,114,101,115,115,98,97,114,54,17,102,114, + 97,109,101,46,102,111,110,116,46,104,101,105,103,104,116,2,8,15,102,114, + 97,109,101,46,102,111,110,116,46,110,97,109,101,6,11,115,116,102,95,100, + 101,102,97,117,108,116,21,102,114,97,109,101,46,102,111,110,116,46,108,111, + 99,97,108,112,114,111,112,115,11,10,102,108,112,95,104,101,105,103,104,116, + 0,16,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,10, + 102,114,108,95,102,105,108,101,102,116,9,102,114,108,95,102,105,116,111,112, + 11,102,114,108,95,102,105,114,105,103,104,116,12,102,114,108,95,102,105,98, + 111,116,116,111,109,0,17,102,114,97,109,101,46,108,111,99,97,108,112,114, + 111,112,115,49,11,11,102,114,108,49,95,102,111,108,101,102,116,10,102,114, + 108,49,95,102,111,116,111,112,12,102,114,108,49,95,102,111,114,105,103,104, + 116,13,102,114,108,49,95,102,111,98,111,116,116,111,109,0,8,116,97,98, + 111,114,100,101,114,2,5,8,98,111,117,110,100,115,95,120,3,168,0,8, + 98,111,117,110,100,115,95,121,2,60,9,98,111,117,110,100,115,95,99,120, + 2,30,9,98,111,117,110,100,115,95,99,121,3,180,0,9,100,105,114,101, + 99,116,105,111,110,7,5,103,100,95,117,112,23,98,97,114,95,102,97,99, + 101,46,102,97,100,101,95,112,111,115,46,99,111,117,110,116,2,1,23,98, + 97,114,95,102,97,99,101,46,102,97,100,101,95,112,111,115,46,105,116,101, + 109,115,1,2,0,0,25,98,97,114,95,102,97,99,101,46,102,97,100,101, + 95,99,111,108,111,114,46,99,111,117,110,116,2,1,25,98,97,114,95,102, + 97,99,101,46,102,97,100,101,95,99,111,108,111,114,46,105,116,101,109,115, + 1,4,21,0,0,160,0,23,98,97,114,95,102,97,99,101,46,102,97,100, + 101,95,100,105,114,101,99,116,105,111,110,7,5,103,100,95,117,112,19,98, + 97,114,95,102,97,99,101,46,108,111,99,97,108,112,114,111,112,115,11,15, + 102,97,108,95,102,97,100,105,114,101,99,116,105,111,110,0,20,98,97,114, + 95,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,10,102, + 114,108,95,102,105,108,101,102,116,9,102,114,108,95,102,105,116,111,112,11, + 102,114,108,95,102,105,114,105,103,104,116,12,102,114,108,95,102,105,98,111, + 116,116,111,109,0,21,98,97,114,95,102,114,97,109,101,46,108,111,99,97, + 108,112,114,111,112,115,49,11,11,102,114,108,49,95,102,111,108,101,102,116, + 10,102,114,108,49,95,102,111,116,111,112,12,102,114,108,49,95,102,111,114, + 105,103,104,116,13,102,114,108,49,95,102,111,98,111,116,116,111,109,0,10, + 118,97,108,117,101,114,97,110,103,101,2,100,10,118,97,108,117,101,115,116, + 97,114,116,2,0,5,118,97,108,117,101,2,0,6,102,111,114,109,97,116, + 6,0,0,0,12,116,112,114,111,103,114,101,115,115,98,97,114,13,116,112, + 114,111,103,114,101,115,115,98,97,114,55,17,102,114,97,109,101,46,102,111, + 110,116,46,104,101,105,103,104,116,2,8,15,102,114,97,109,101,46,102,111, + 110,116,46,110,97,109,101,6,11,115,116,102,95,100,101,102,97,117,108,116, + 21,102,114,97,109,101,46,102,111,110,116,46,108,111,99,97,108,112,114,111, + 112,115,11,10,102,108,112,95,104,101,105,103,104,116,0,16,102,114,97,109, + 101,46,108,111,99,97,108,112,114,111,112,115,11,10,102,114,108,95,102,105, + 108,101,102,116,9,102,114,108,95,102,105,116,111,112,11,102,114,108,95,102, + 105,114,105,103,104,116,12,102,114,108,95,102,105,98,111,116,116,111,109,0, + 17,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11,11, + 102,114,108,49,95,102,111,108,101,102,116,10,102,114,108,49,95,102,111,116, + 111,112,12,102,114,108,49,95,102,111,114,105,103,104,116,13,102,114,108,49, + 95,102,111,98,111,116,116,111,109,0,8,116,97,98,111,114,100,101,114,2, + 6,8,98,111,117,110,100,115,95,120,3,200,0,8,98,111,117,110,100,115, + 95,121,2,60,9,98,111,117,110,100,115,95,99,120,2,30,9,98,111,117, + 110,100,115,95,99,121,3,180,0,9,100,105,114,101,99,116,105,111,110,7, + 5,103,100,95,117,112,23,98,97,114,95,102,97,99,101,46,102,97,100,101, + 95,112,111,115,46,99,111,117,110,116,2,1,23,98,97,114,95,102,97,99, + 101,46,102,97,100,101,95,112,111,115,46,105,116,101,109,115,1,2,0,0, + 25,98,97,114,95,102,97,99,101,46,102,97,100,101,95,99,111,108,111,114, + 46,99,111,117,110,116,2,1,25,98,97,114,95,102,97,99,101,46,102,97, + 100,101,95,99,111,108,111,114,46,105,116,101,109,115,1,4,21,0,0,160, + 0,23,98,97,114,95,102,97,99,101,46,102,97,100,101,95,100,105,114,101, + 99,116,105,111,110,7,5,103,100,95,117,112,19,98,97,114,95,102,97,99, + 101,46,108,111,99,97,108,112,114,111,112,115,11,15,102,97,108,95,102,97, + 100,105,114,101,99,116,105,111,110,0,20,98,97,114,95,102,114,97,109,101, + 46,108,111,99,97,108,112,114,111,112,115,11,10,102,114,108,95,102,105,108, + 101,102,116,9,102,114,108,95,102,105,116,111,112,11,102,114,108,95,102,105, + 114,105,103,104,116,12,102,114,108,95,102,105,98,111,116,116,111,109,0,21, + 98,97,114,95,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115, + 49,11,11,102,114,108,49,95,102,111,108,101,102,116,10,102,114,108,49,95, + 102,111,116,111,112,12,102,114,108,49,95,102,111,114,105,103,104,116,13,102, + 114,108,49,95,102,111,98,111,116,116,111,109,0,10,118,97,108,117,101,114, + 97,110,103,101,2,100,10,118,97,108,117,101,115,116,97,114,116,2,0,5, + 118,97,108,117,101,2,0,6,102,111,114,109,97,116,6,0,0,0,12,116, + 112,114,111,103,114,101,115,115,98,97,114,13,116,112,114,111,103,114,101,115, + 115,98,97,114,56,17,102,114,97,109,101,46,102,111,110,116,46,104,101,105, + 103,104,116,2,8,15,102,114,97,109,101,46,102,111,110,116,46,110,97,109, + 101,6,11,115,116,102,95,100,101,102,97,117,108,116,21,102,114,97,109,101, + 46,102,111,110,116,46,108,111,99,97,108,112,114,111,112,115,11,10,102,108, + 112,95,104,101,105,103,104,116,0,16,102,114,97,109,101,46,108,111,99,97, + 108,112,114,111,112,115,11,10,102,114,108,95,102,105,108,101,102,116,9,102, + 114,108,95,102,105,116,111,112,11,102,114,108,95,102,105,114,105,103,104,116, + 12,102,114,108,95,102,105,98,111,116,116,111,109,0,17,102,114,97,109,101, + 46,108,111,99,97,108,112,114,111,112,115,49,11,11,102,114,108,49,95,102, + 111,108,101,102,116,10,102,114,108,49,95,102,111,116,111,112,12,102,114,108, + 49,95,102,111,114,105,103,104,116,13,102,114,108,49,95,102,111,98,111,116, + 116,111,109,0,8,116,97,98,111,114,100,101,114,2,7,8,98,111,117,110, + 100,115,95,120,3,232,0,8,98,111,117,110,100,115,95,121,2,60,9,98, + 111,117,110,100,115,95,99,120,2,30,9,98,111,117,110,100,115,95,99,121, + 3,180,0,9,100,105,114,101,99,116,105,111,110,7,5,103,100,95,117,112, + 23,98,97,114,95,102,97,99,101,46,102,97,100,101,95,112,111,115,46,99, + 111,117,110,116,2,1,23,98,97,114,95,102,97,99,101,46,102,97,100,101, + 95,112,111,115,46,105,116,101,109,115,1,2,0,0,25,98,97,114,95,102, + 97,99,101,46,102,97,100,101,95,99,111,108,111,114,46,99,111,117,110,116, + 2,1,25,98,97,114,95,102,97,99,101,46,102,97,100,101,95,99,111,108, + 111,114,46,105,116,101,109,115,1,4,21,0,0,160,0,23,98,97,114,95, + 102,97,99,101,46,102,97,100,101,95,100,105,114,101,99,116,105,111,110,7, + 5,103,100,95,117,112,19,98,97,114,95,102,97,99,101,46,108,111,99,97, + 108,112,114,111,112,115,11,15,102,97,108,95,102,97,100,105,114,101,99,116, + 105,111,110,0,20,98,97,114,95,102,114,97,109,101,46,108,111,99,97,108, + 112,114,111,112,115,11,10,102,114,108,95,102,105,108,101,102,116,9,102,114, + 108,95,102,105,116,111,112,11,102,114,108,95,102,105,114,105,103,104,116,12, + 102,114,108,95,102,105,98,111,116,116,111,109,0,21,98,97,114,95,102,114, + 97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11,11,102,114,108, + 49,95,102,111,108,101,102,116,10,102,114,108,49,95,102,111,116,111,112,12, + 102,114,108,49,95,102,111,114,105,103,104,116,13,102,114,108,49,95,102,111, + 98,111,116,116,111,109,0,10,118,97,108,117,101,114,97,110,103,101,2,100, + 10,118,97,108,117,101,115,116,97,114,116,2,0,5,118,97,108,117,101,2, + 0,6,102,111,114,109,97,116,6,0,0,0,12,116,112,114,111,103,114,101, + 115,115,98,97,114,13,116,112,114,111,103,114,101,115,115,98,97,114,57,17, + 102,114,97,109,101,46,102,111,110,116,46,104,101,105,103,104,116,2,8,15, + 102,114,97,109,101,46,102,111,110,116,46,110,97,109,101,6,11,115,116,102, + 95,100,101,102,97,117,108,116,21,102,114,97,109,101,46,102,111,110,116,46, + 108,111,99,97,108,112,114,111,112,115,11,10,102,108,112,95,104,101,105,103, + 104,116,0,16,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115, + 11,10,102,114,108,95,102,105,108,101,102,116,9,102,114,108,95,102,105,116, + 111,112,11,102,114,108,95,102,105,114,105,103,104,116,12,102,114,108,95,102, + 105,98,111,116,116,111,109,0,17,102,114,97,109,101,46,108,111,99,97,108, + 112,114,111,112,115,49,11,11,102,114,108,49,95,102,111,108,101,102,116,10, + 102,114,108,49,95,102,111,116,111,112,12,102,114,108,49,95,102,111,114,105, + 103,104,116,13,102,114,108,49,95,102,111,98,111,116,116,111,109,0,8,116, + 97,98,111,114,100,101,114,2,8,8,98,111,117,110,100,115,95,120,3,8, + 1,8,98,111,117,110,100,115,95,121,2,60,9,98,111,117,110,100,115,95, + 99,120,2,30,9,98,111,117,110,100,115,95,99,121,3,180,0,9,100,105, + 114,101,99,116,105,111,110,7,5,103,100,95,117,112,23,98,97,114,95,102, + 97,99,101,46,102,97,100,101,95,112,111,115,46,99,111,117,110,116,2,1, + 23,98,97,114,95,102,97,99,101,46,102,97,100,101,95,112,111,115,46,105, + 116,101,109,115,1,2,0,0,25,98,97,114,95,102,97,99,101,46,102,97, + 100,101,95,99,111,108,111,114,46,99,111,117,110,116,2,1,25,98,97,114, + 95,102,97,99,101,46,102,97,100,101,95,99,111,108,111,114,46,105,116,101, + 109,115,1,4,21,0,0,160,0,23,98,97,114,95,102,97,99,101,46,102, + 97,100,101,95,100,105,114,101,99,116,105,111,110,7,5,103,100,95,117,112, + 19,98,97,114,95,102,97,99,101,46,108,111,99,97,108,112,114,111,112,115, + 11,15,102,97,108,95,102,97,100,105,114,101,99,116,105,111,110,0,20,98, + 97,114,95,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11, + 10,102,114,108,95,102,105,108,101,102,116,9,102,114,108,95,102,105,116,111, + 112,11,102,114,108,95,102,105,114,105,103,104,116,12,102,114,108,95,102,105, + 98,111,116,116,111,109,0,21,98,97,114,95,102,114,97,109,101,46,108,111, + 99,97,108,112,114,111,112,115,49,11,11,102,114,108,49,95,102,111,108,101, + 102,116,10,102,114,108,49,95,102,111,116,111,112,12,102,114,108,49,95,102, + 111,114,105,103,104,116,13,102,114,108,49,95,102,111,98,111,116,116,111,109, + 0,10,118,97,108,117,101,114,97,110,103,101,2,100,10,118,97,108,117,101, + 115,116,97,114,116,2,0,5,118,97,108,117,101,2,0,6,102,111,114,109, + 97,116,6,0,0,0,12,116,112,114,111,103,114,101,115,115,98,97,114,14, + 116,112,114,111,103,114,101,115,115,98,97,114,49,48,17,102,114,97,109,101, + 46,102,111,110,116,46,104,101,105,103,104,116,2,8,15,102,114,97,109,101, + 46,102,111,110,116,46,110,97,109,101,6,11,115,116,102,95,100,101,102,97, + 117,108,116,21,102,114,97,109,101,46,102,111,110,116,46,108,111,99,97,108, + 112,114,111,112,115,11,10,102,108,112,95,104,101,105,103,104,116,0,16,102, + 114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,10,102,114,108, + 95,102,105,108,101,102,116,9,102,114,108,95,102,105,116,111,112,11,102,114, + 108,95,102,105,114,105,103,104,116,12,102,114,108,95,102,105,98,111,116,116, + 111,109,0,17,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115, + 49,11,11,102,114,108,49,95,102,111,108,101,102,116,10,102,114,108,49,95, + 102,111,116,111,112,12,102,114,108,49,95,102,111,114,105,103,104,116,13,102, + 114,108,49,95,102,111,98,111,116,116,111,109,0,8,116,97,98,111,114,100, + 101,114,2,9,8,98,111,117,110,100,115,95,120,3,40,1,8,98,111,117, + 110,100,115,95,121,2,60,9,98,111,117,110,100,115,95,99,120,2,30,9, + 98,111,117,110,100,115,95,99,121,3,180,0,9,100,105,114,101,99,116,105, + 111,110,7,5,103,100,95,117,112,23,98,97,114,95,102,97,99,101,46,102, + 97,100,101,95,112,111,115,46,99,111,117,110,116,2,1,23,98,97,114,95, + 102,97,99,101,46,102,97,100,101,95,112,111,115,46,105,116,101,109,115,1, + 2,0,0,25,98,97,114,95,102,97,99,101,46,102,97,100,101,95,99,111, + 108,111,114,46,99,111,117,110,116,2,1,25,98,97,114,95,102,97,99,101, + 46,102,97,100,101,95,99,111,108,111,114,46,105,116,101,109,115,1,4,21, + 0,0,160,0,23,98,97,114,95,102,97,99,101,46,102,97,100,101,95,100, + 105,114,101,99,116,105,111,110,7,5,103,100,95,117,112,19,98,97,114,95, + 102,97,99,101,46,108,111,99,97,108,112,114,111,112,115,11,15,102,97,108, + 95,102,97,100,105,114,101,99,116,105,111,110,0,20,98,97,114,95,102,114, + 97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,10,102,114,108,95, + 102,105,108,101,102,116,9,102,114,108,95,102,105,116,111,112,11,102,114,108, + 95,102,105,114,105,103,104,116,12,102,114,108,95,102,105,98,111,116,116,111, + 109,0,21,98,97,114,95,102,114,97,109,101,46,108,111,99,97,108,112,114, + 111,112,115,49,11,11,102,114,108,49,95,102,111,108,101,102,116,10,102,114, + 108,49,95,102,111,116,111,112,12,102,114,108,49,95,102,111,114,105,103,104, + 116,13,102,114,108,49,95,102,111,98,111,116,116,111,109,0,10,118,97,108, + 117,101,114,97,110,103,101,2,100,10,118,97,108,117,101,115,116,97,114,116, + 2,0,5,118,97,108,117,101,2,0,6,102,111,114,109,97,116,6,0,0, + 0,13,116,102,105,108,101,110,97,109,101,101,100,105,116,14,116,102,105,108, + 101,110,97,109,101,101,100,105,116,49,16,102,114,97,109,101,46,108,111,99, + 97,108,112,114,111,112,115,11,0,17,102,114,97,109,101,46,108,111,99,97, + 108,112,114,111,112,115,49,11,0,19,102,114,97,109,101,46,98,117,116,116, + 111,110,115,46,99,111,117,110,116,2,1,19,102,114,97,109,101,46,98,117, + 116,116,111,110,115,46,105,116,101,109,115,14,1,7,105,109,97,103,101,110, + 114,2,17,0,0,20,102,114,97,109,101,46,98,117,116,116,111,110,46,105, + 109,97,103,101,110,114,2,17,8,116,97,98,111,114,100,101,114,2,10,8, + 98,111,117,110,100,115,95,120,2,14,8,98,111,117,110,100,115,95,121,2, + 6,9,98,111,117,110,100,115,95,99,120,3,196,0,9,98,111,117,110,100, + 115,95,99,121,2,28,13,114,101,102,102,111,110,116,104,101,105,103,104,116, + 2,14,0,0,7,116,98,117,116,116,111,110,7,98,117,116,116,111,110,49, + 8,116,97,98,111,114,100,101,114,2,11,8,98,111,117,110,100,115,95,120, + 3,224,0,8,98,111,117,110,100,115,95,121,2,8,9,98,111,117,110,100, + 115,95,99,120,2,50,9,98,111,117,110,100,115,95,99,121,2,26,5,115, + 116,97,116,101,11,15,97,115,95,108,111,99,97,108,99,97,112,116,105,111, + 110,17,97,115,95,108,111,99,97,108,111,110,101,120,101,99,117,116,101,0, + 7,99,97,112,116,105,111,110,6,4,80,108,97,121,9,111,110,101,120,101, + 99,117,116,101,7,12,98,117,116,116,111,110,49,99,108,105,99,107,0,0, + 7,116,98,117,116,116,111,110,8,116,98,117,116,116,111,110,50,8,116,97, + 98,111,114,100,101,114,2,12,8,98,111,117,110,100,115,95,120,3,24,1, + 8,98,111,117,110,100,115,95,121,2,8,9,98,111,117,110,100,115,95,99, + 120,2,42,9,98,111,117,110,100,115,95,99,121,2,26,5,115,116,97,116, + 101,11,15,97,115,95,108,111,99,97,108,99,97,112,116,105,111,110,17,97, + 115,95,108,111,99,97,108,111,110,101,120,101,99,117,116,101,0,7,99,97, + 112,116,105,111,110,6,4,83,116,111,112,9,111,110,101,120,101,99,117,116, + 101,7,12,98,117,116,115,116,111,112,99,108,105,99,107,0,0,6,116,108, + 97,98,101,108,6,108,97,98,101,108,49,8,116,97,98,111,114,100,101,114, + 2,13,8,98,111,117,110,100,115,95,120,2,120,8,98,111,117,110,100,115, + 95,121,2,40,9,98,111,117,110,100,115,95,99,120,2,12,9,98,111,117, + 110,100,115,95,99,121,2,14,7,99,97,112,116,105,111,110,6,3,32,32, + 32,13,114,101,102,102,111,110,116,104,101,105,103,104,116,2,14,0,0,0) + ); + +initialization + registerobjectdata(@objdata,tmainfo,''); +end. diff --git a/UOS/examples/main_sr.lfm b/UOS/examples/main_sr.lfm new file mode 100644 index 0000000..f9fe8ce --- /dev/null +++ b/UOS/examples/main_sr.lfm @@ -0,0 +1,321 @@ +object Form1: TForm1 + Left = 680 + Height = 311 + Top = 266 + Width = 505 + BorderIcons = [biSystemMenu] + Caption = 'Simple Recorder U0S' + ClientHeight = 311 + ClientWidth = 505 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '2.2.4.0' + object Shape1: TShape + Left = 11 + Height = 158 + Top = 150 + Width = 483 + Brush.Color = clSilver + end + object Edit1: TEdit + Left = 132 + Height = 27 + Top = 30 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 2 + end + object Label1: TLabel + Left = 130 + Height = 18 + Top = 16 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label2: TLabel + Left = 130 + Height = 18 + Top = 56 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of SndFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object PaintBox1: TPaintBox + Left = 17 + Height = 105 + Top = 8 + Width = 105 + OnPaint = PaintBox1Paint + end + object Label4: TLabel + Left = 24 + Height = 14 + Top = 286 + Width = 26 + Alignment = taCenter + Caption = 'Vol L' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object TrackBar1: TTrackBar + Left = 16 + Height = 130 + Top = 154 + Width = 46 + Max = 100 + OnChange = TrackBar1Change + Orientation = trVertical + Position = 100 + Reversed = True + TickStyle = tsNone + TabOrder = 3 + end + object Button1: TButton + Left = 12 + Height = 20 + Top = 122 + Width = 483 + Caption = 'Load that libraries' + OnClick = Button1Click + TabOrder = 1 + end + object Button2: TButton + Left = 338 + Height = 30 + Top = 235 + Width = 72 + Caption = 'Start' + OnClick = Button2Click + TabOrder = 0 + end + object Button3: TButton + Left = 416 + Height = 30 + Top = 235 + Width = 67 + Caption = 'Stop' + Enabled = False + OnClick = Button3Click + TabOrder = 4 + end + object TrackBar3: TTrackBar + Left = 65 + Height = 130 + Top = 154 + Width = 46 + Max = 100 + OnChange = TrackBar1Change + Orientation = trVertical + Position = 100 + Reversed = True + TickStyle = tsNone + TabOrder = 5 + end + object Label5: TLabel + Left = 70 + Height = 14 + Top = 286 + Width = 28 + Alignment = taCenter + Caption = 'Vol R' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit3: TEdit + Left = 118 + Height = 27 + Top = 190 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 6 + end + object Label6: TLabel + Left = 112 + Height = 18 + Top = 175 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of wav saved file' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object CheckBox1: TCheckBox + Left = 112 + Height = 23 + Top = 224 + Width = 94 + Caption = 'Listen MIC' + Checked = True + OnChange = CheckBox1Change + State = cbChecked + TabOrder = 7 + end + object Label7: TLabel + Left = 102 + Height = 18 + Top = 155 + Width = 386 + Alignment = taCenter + AutoSize = False + Caption = 'WARNING : Use headphones or set volume to low...' + Font.Color = clRed + Font.Height = -13 + Font.Name = 'Sans' + Font.Style = [fsBold] + ParentColor = False + ParentFont = False + end + object Edit2: TEdit + Left = 132 + Height = 27 + Top = 70 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 8 + end + object CheckBox2: TCheckBox + Left = 112 + Height = 23 + Top = 248 + Width = 99 + Caption = 'Save to file' + Checked = True + State = cbChecked + TabOrder = 9 + end + object Button4: TButton + Left = 174 + Height = 25 + Top = 275 + Width = 153 + Caption = 'Play saved file' + Enabled = False + OnClick = Button4Click + TabOrder = 10 + end + object Button5: TButton + Left = 338 + Height = 25 + Top = 275 + Width = 148 + Caption = 'Stop saved file' + Enabled = False + OnClick = Button3Click + TabOrder = 11 + end + object bwav: TRadioButton + Left = 240 + Height = 23 + Top = 224 + Width = 57 + Caption = '.wav' + Checked = True + TabOrder = 13 + TabStop = True + end + object bogg: TRadioButton + Left = 240 + Height = 23 + Top = 248 + Width = 54 + Caption = '.ogg' + TabOrder = 12 + end +end diff --git a/UOS/examples/main_sr.pas b/UOS/examples/main_sr.pas new file mode 100644 index 0000000..b32fd1e --- /dev/null +++ b/UOS/examples/main_sr.pas @@ -0,0 +1,491 @@ + +/////////////////// Demo how to use United Openlib of Sound //////////////////// +unit main_sr; + +{$mode objfpc}{$H+} +interface + +uses + uos_flat, + uos, + ctypes, + Forms, + Dialogs, + SysUtils, + Graphics, + StdCtrls, + ComCtrls, + ExtCtrls, + Classes, + Controls, Grids; + +type + { TForm1 } + TForm1 = class(TForm) + Button1: TButton; + Button2: TButton; + Button3: TButton; + Button4: TButton; + Button5: TButton; + CheckBox1: TCheckBox; + CheckBox2: TCheckBox; + Edit1: TEdit; + Edit2: TEdit; + Edit3: TEdit; + Label1: TLabel; + Label2: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + PaintBox1: TPaintBox; + bwav: TRadioButton; + bogg: TRadioButton; + Shape1: TShape; + TrackBar1: TTrackBar; + TrackBar3: TTrackBar; + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure CheckBox1Change(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + procedure ClosePlayer1; + procedure TrackBar1Change(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +procedure uos_logo(); + +var + Form1: TForm1; + BufferBMP: TBitmap; + PlayerIndex1: cardinal; + In1Index, out1index: integer; + thebuffer: array of cfloat; + thebufferinfos: TuosF_BufferInfos; + thememorystream: Tmemorystream; + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.ClosePlayer1; +begin + sleep(500); + application.ProcessMessages; + button2.Enabled := True; + button3.Enabled := False; + button5.Enabled := False; + CheckBox1.Enabled := True; + CheckBox2.Enabled := True; + if CheckBox2.Checked = True then + Button4.Enabled := True; +end; + +procedure TForm1.TrackBar1Change(Sender: TObject); +begin + if (Button2.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex1, In1Index, TrackBar1.position / 100, + TrackBar3.position / 100, True); +end; + +procedure TForm1.FormActivate(Sender: TObject); +{$IFDEF Darwin} +var + opath: string; +{$ENDIF} +begin + uos_logo(); + {$IFDEF Windows} + {$if defined(cpu64)} + edit1.Text := application.Location + 'lib\Windows\64bit\LibPortaudio-64.dll'; + edit2.Text := application.Location + 'lib\Windows\64bit\LibSndFile-64.dll'; +{$else} + edit1.Text := application.Location + 'lib\Windows\32bit\LibPortaudio-32.dll'; + edit2.Text := application.Location + 'lib\Windows\32bit\LibSndFile-32.dll'; + {$endif} + Edit3.Text := application.Location + 'sound\testrecord.wav'; + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := application.location; + opath := copy(ordir, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + Edit2.Text := opath + '/lib/Mac/32bit/LibSndFile-32.dylib'; + Edit3.Text := application.Location + '/sound/testrecord.wav'; + {$ENDIF} + {$IFDEF CPU64} + opath := application.location; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + Edit2.Text := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + Edit3.Text := application.Location + '/sound/testrecord.wav'; + {$ENDIF} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + Edit1.Text := application.Location + 'lib/Linux/64bit/LibPortaudio-64.so'; + Edit2.Text := application.Location + 'lib/Linux/64bit/LibSndFile-64.so'; + Edit3.Text := application.Location + 'sound/testrecord.wav'; + {$ENDIF} + {$if defined(cpu86) and defined(linux)} + Edit1.Text := application.Location + 'lib/Linux/32bit/LibPortaudio-32.so'; + Edit2.Text := application.Location + 'lib/Linux/32bit/LibSndFile-32.so'; + Edit3.Text := application.Location + 'sound/testrecord.wav'; + {$ENDIF} + {$if defined(linux) and defined(cpuarm)} + Edit1.Text := application.Location + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + Edit2.Text := application.Location + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + Edit3.Text := application.Location + 'sound/testrecord.wav'; + {$ENDIF} + {$if defined(linux) and defined(cpuaarch64)} + Edit1.Text := application.Location + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + Edit2.Text := application.Location + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + Edit3.Text := application.Location + 'sound/testrecord.wav'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + Edit1.Text := application.Location + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + Edit2.Text := application.Location + 'lib/OpenBSD/64bit/LibSndFile-64.so'; + Edit3.Text := application.Location + 'sound/testrecord.wav'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + Edit1.Text := application.Location + 'lib/FreeBSD/64bit/libportaudio-64.so'; + Edit2.Text := application.Location + 'lib/FreeBSD/64bit/libsndfile-64.so'; + {$else} + Edit1.Text := application.Location + 'lib/FreeBSD/32bit/libportaudio-32.so'; + Edit2.Text := application.Location + 'lib/FreeBSD/32bit/libsndfile-32.so'; + {$endif} + Edit3.Text := application.Location + 'sound/testrecord.wav'; + {$ENDIF} + + + ////////////////////////////////////////////////////////////////////////// + +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.Button1Click(Sender: TObject); +begin + +{$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so +if (Edit2.Text <> 'system') and (Edit2.Text <> '') then + if uos_TestLoadLibrary(PChar(edit2.Text)) = false then + edit2.Text := edit2.Text + '.2'; +{$endif} + + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + if uos_LoadLib(PChar(edit1.Text), PChar(edit2.Text), nil, nil, nil, nil, nil) = 0 then + begin + form1.hide; + button1.Caption := 'PortAudio and SndFile libraries are loaded...'; + button1.Enabled := False; + edit1.ReadOnly := True; + edit2.ReadOnly := True; + form1.Height := 318; + form1.Position := poScreenCenter; + form1.Show; + end + else + begin + if uosLoadResult.PAloaderror = 1 then + MessageDlg(edit1.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.PAloaderror = 2 then + MessageDlg(edit1.Text + ' do not load...', mtWarning, [mbYes], 0); + if uosLoadResult.SFloaderror = 1 then + MessageDlg(edit2.Text + ' do not exist...', mtWarning, [mbYes], 0); + if uosLoadResult.SFloaderror = 2 then + MessageDlg(edit2.Text + ' do not load...', mtWarning, [mbYes], 0); + end; +end; + + +procedure TForm1.Button2Click(Sender: TObject); +var + outformatst : string; + outformat :integer; +begin + if (checkbox1.Checked = True) or (checkbox2.Checked = True) then + begin + + PlayerIndex1 := 0; + // PlayerIndex : from 0 to what your computer can do ! (depends of ram, cpu, ...) + // If PlayerIndex exists already, it will be overwritten... + + uos_CreatePlayer(PlayerIndex1); + //// Create the player. + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + //uos_AddIntoFileFromMem(PlayerIndex1, Pchar(edit3.Text)); + //// add Output into wav file (save record) from TMemoryStream with default parameters + + if bwav.checked then + begin + outformatst := '.wav'; + outformat := 0; + end else + begin + outformatst := '.ogg'; + outformat := 3; + end; + + edit3.Text := 'rec_' + UTF8Decode(formatdatetime('YY_MM_DD_HH_mm_ss', now)) + outformatst ; + + // saving in a file using a File-Stream: + + uos_AddIntoFile(PlayerIndex1, PChar(edit3.Text), -1, -1, -1, 4096, outformat); + +// function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar; SampleRate: cint32; +// Channels: cint32; SampleFormat: cint32 ; FramesCount: cint32 ; FileFormat: cint32): cint32; +// Add a Output into audio wav file with custom parameters from TFileStream +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : default : -1 (2:Int16) (1:Int32, 2:Int16) +// FramesCount : default : -1 (= 65536) +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg); + + // saving in a Memory-Buffer: + // SetLength(thebuffer, 0); + // uos_AddIntoMemoryBuffer(PlayerIndex1, @thebuffer); + + // saving in a Memory-Stream: + // if thememorystream = nil then thememorystream := tmemorystream.create; + // uos_AddIntoMemoryStream(PlayerIndex1, (thememorystream),-1,-1,-1,-1); + + // saving in a file using a Menory-Stream: + // uos_AddIntoFileFromMem(PlayerIndex1, Pchar(filenameEdit4.filename)); + //// add Output into wav file (save record) with default parameters + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + out1index := uos_AddIntoDevOut(PlayerIndex1, -1, 0.8, -1, -1, -1, -1, -1) ; + {$else} + out1index := uos_AddIntoDevOut(PlayerIndex1) ; + {$endif} + + uos_outputsetenable(PlayerIndex1, out1index, checkbox1.Checked); + + // uos_AddIntoDevOut(PlayerIndex1, -1, -1, 8000, -1, -1,65536, -1); //// 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 : -1 default : 65536 + // ChunkCount : default : -1 (= 512) + + In1Index := uos_AddFromDevIn(PlayerIndex1); + //// add input from mic with custom parameters + //////////// PlayerIndex : Index of a existing Player + //////////// Device ( -1 is default Input device ) + //////////// Latency ( -1 is latency suggested ) ) + //////////// SampleRate : delault : -1 (44100) + //////////// 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) + //////////// FramesCount : -1 default : 4096 ( > = safer, < = better latency ) + + uos_InputAddDSPVolume(PlayerIndex1, In1Index, 1, 1); + ///// DSP Volume changer + //////////// PlayerIndex : Index of a existing Player + ////////// In1Index : InputIndex of a existing input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + + uos_InputSetDSPVolume(PlayerIndex1, In1Index, TrackBar1.position / 100, + TrackBar3.position / 100, True); /// Set volume + + /////// procedure to execute when stream is terminated + // 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 + + uos_Play(PlayerIndex1); /////// everything is ready to play... + + Button2.Enabled := False; + Button3.Enabled := True; + Button4.Enabled := False; + //CheckBox1.Enabled := False; + CheckBox2.Enabled := False; + end; +end; + +procedure TForm1.Button3Click(Sender: TObject); +begin + uos_Stop(PlayerIndex1); + ClosePlayer1; +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin + PlayerIndex1 := 0; + // PlayerIndex : from 0 to what your computer can do ! (depends of ram, cpu, ...) + // If PlayerIndex exists already, it will be overwritten... + + uos_CreatePlayer(PlayerIndex1); + //// 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(Edit3.Text)); + //// add input from audio file with default parameters + // In1Index := Player1.AddFromFile(0, Edit3.Text, -1, 0); //// add input from audio file with custom parameters + //////////// PlayerIndex : Index of a existing Player + ////////// FileName : filename of audio file + ////////// 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 + + // uos_AddIntoDevOut(PlayerIndex1); //// add a Output into OUT device with default parameters + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, In1Index), + uos_InputGetChannels(PlayerIndex1, In1Index), -1, -1, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, In1Index), + uos_InputGetChannels(PlayerIndex1, In1Index), -1, -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 : -1 default : 65536 + // ChunkCount : default : -1 (= 512) + + uos_InputAddDSP1ChanTo2Chan(PlayerIndex1, In1Index); + ///// Convert mono channel to stereo channels. + //// If the input is stereo, original buffer is keeped. + ////////// InputIndex : InputIndex of a existing Input + // result : index of DSPIn in array + ////////// example DSPIndex1 := uos_InputAddDSP1ChanTo2Chan(PlayerIndex1, InputIndex1); + + uos_InputAddDSPVolume(PlayerIndex1, In1Index, 1, 1); + ///// DSP Volume changer + //////////// PlayerIndex : Index of a existing Player + ////////// In1Index : InputIndex of a existing input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + // result : -1 nothing created, otherwise index of DSPIn in array + + uos_InputSetDSPVolume(PlayerIndex1, In1Index, TrackBar1.position / 100, + TrackBar3.position / 100, True); /// Set volume + + /////// procedure to execute when stream is terminated + 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 + + uos_Play(PlayerIndex1); /////// everything is ready to play... + + button4.Enabled := False; + button5.Enabled := True; + button2.Enabled := False; + CheckBox1.Enabled := False; + CheckBox2.Enabled := False; +end; + +procedure TForm1.CheckBox1Change(Sender: TObject); +begin + uos_outputsetenable(0, out1index, checkbox1.Checked); +end; + +procedure uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + + +procedure TForm1.FormCreate(Sender: TObject); +begin + Form1.Height := 150; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + application.ProcessMessages; + if (Button2.Enabled = False) then + begin + Button3.Click; + sleep(500); + end; + if button1.Enabled = False then + uos_free; +end; + +end. + diff --git a/UOS/examples/main_wf.lfm b/UOS/examples/main_wf.lfm new file mode 100644 index 0000000..f547a69 --- /dev/null +++ b/UOS/examples/main_wf.lfm @@ -0,0 +1,248 @@ +object Form1: TForm1 + Left = 173 + Height = 207 + Top = 242 + Width = 1018 + BorderIcons = [biSystemMenu] + Caption = 'Wave Form Designer' + ClientHeight = 207 + ClientWidth = 1018 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '2.0.6.0' + object Edit1: TEdit + Left = 320 + Height = 27 + Top = 20 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 3 + end + object Edit2: TEdit + Left = 320 + Height = 27 + Top = 60 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 4 + end + object Edit3: TEdit + Left = 320 + Height = 27 + Top = 100 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 5 + end + object Label1: TLabel + Left = 318 + Height = 18 + Top = 6 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label2: TLabel + Left = 318 + Height = 18 + Top = 46 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of SndFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label3: TLabel + Left = 320 + Height = 18 + Top = 86 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Mpg123 Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit4: TEdit + Left = 88 + Height = 27 + Top = 171 + Width = 278 + Alignment = taCenter + AutoSize = False + TabOrder = 0 + end + object PaintBox1: TPaintBox + Left = 202 + Height = 105 + Top = 18 + Width = 105 + OnPaint = PaintBox1Paint + end + object Button1: TButton + Left = 197 + Height = 26 + Top = 134 + Width = 483 + Caption = 'Load that libraries' + Font.Height = 12 + OnClick = Button1Click + ParentFont = False + TabOrder = 2 + end + object Button3: TButton + Left = 464 + Height = 26 + Top = 171 + Width = 136 + Caption = 'Design Wave Form' + Font.Height = 12 + OnClick = Button3Click + ParentFont = False + TabOrder = 1 + end + object Button2: TButton + Left = 376 + Height = 26 + Top = 171 + Width = 66 + Caption = 'Choose' + Font.Height = 12 + OnClick = Button2Click + ParentFont = False + TabOrder = 6 + end + object PaintBox2: TPaintBox + Left = 0 + Height = 206 + Top = 206 + Width = 1024 + OnPaint = PaintBox2Paint + end + object TrackBar1: TTrackBar + Left = 0 + Height = 41 + Top = 408 + Width = 1024 + Position = 0 + TickMarks = tmTopLeft + TickStyle = tsNone + TabOrder = 7 + end + object Button4: TButton + Left = 620 + Height = 26 + Top = 171 + Width = 75 + Caption = 'Play' + Font.Height = 12 + OnClick = Button4Click + ParentFont = False + TabOrder = 8 + end + object Button5: TButton + Left = 710 + Height = 26 + Top = 171 + Width = 75 + Caption = 'Stop' + Enabled = False + Font.Height = 12 + OnClick = Button5Click + ParentFont = False + TabOrder = 9 + end + object OpenDialog1: TOpenDialog + left = 264 + top = 42 + end +end diff --git a/UOS/examples/main_wf.pas b/UOS/examples/main_wf.pas new file mode 100644 index 0000000..9a3f29f --- /dev/null +++ b/UOS/examples/main_wf.pas @@ -0,0 +1,455 @@ + + /////////////////// Demo how to use United Openlib of Sound //////////////////// + + //// Set debugger off => too much calcul... + +unit main_wf; + +{$mode objfpc}{$H+} + +interface + +uses + uos_flat, + Forms, + Dialogs, + SysUtils, + fileutil, + Graphics, + ctypes, + StdCtrls, + ComCtrls, + ExtCtrls, + Classes, + Controls; + +type + { TForm1 } + TForm1 = class(TForm) + Button1: TButton; + Button2: TButton; + Button3: TButton; + Button4: TButton; + Button5: TButton; + Edit1: TEdit; + Edit2: TEdit; + Edit3: TEdit; + Edit4: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + OpenDialog1: TOpenDialog; + PaintBox1: TPaintBox; + PaintBox2: TPaintBox; + TrackBar1: TTrackBar; + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure Button5Click(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + procedure PaintBox2Paint(Sender: TObject); + procedure DrawWaveForm; + procedure ShowPosition; + procedure ClosePlayer1; + + private + { private declarations } + public + { public declarations } + end; + +procedure uos_logo(); + +var + Form1: TForm1; + BufferBMP, waveformBMP: TBitmap; + PlayerIndex1, In1index, chan: integer; + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.FormActivate(Sender: TObject); +var + ordir: string; +{$IFDEF Darwin} + opath: string; +{$ENDIF} +begin + ordir := application.Location; + uos_logo(); + {$IFDEF Windows} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + Edit2.Text := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + Edit3.Text := ordir + 'lib\Windows\64bit\LibMpg123-64.dll'; + {$else} + Edit1.Text := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + Edit2.Text := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + Edit3.Text := ordir + 'lib\Windows\32bit\LibMpg123-32.dll'; + {$endif} + Edit4.Text := ordir + 'sound\test.mp3'; + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + Edit2.Text := opath + '/lib/Mac/32bit/LibSndFile-32.dylib'; + Edit3.Text := opath + '/lib/Mac/32bit/LibMpg123-32.dylib'; + Edit4.Text := ordir + '/sound/test.mp3'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + Edit2.Text := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + Edit3.Text := opath + '/lib/Mac/64bit/LibMpg123-64.dylib'; + Edit4.Text := ordir + '/sound/test.mp3'; + {$ENDIF} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + Edit1.Text := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + Edit1.Text := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/Linux/64bit/LibSndFile-64.so'; + Edit3.Text := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} +{$if defined(cpu86) and defined(linux)} + Edit1.Text := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + Edit2.Text := ordir + 'lib/Linux/32bit/LibSndFile-32.so'; + Edit3.Text := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$endif} + + {$if defined(linux) and defined(cpuaarch64)} + Edit1.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + Edit2.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + Edit3.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + + {$if defined(linux) and defined(cpuarm)} + Edit1.Text := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + Edit2.Text := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + Edit3.Text := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so'; + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + Edit3.Text := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so'; + Edit2.Text := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + {$else} + Edit1.Text := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + Edit2.Text := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + Edit3.Text := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + {$endif} + Edit4.Text := ordir + 'sound/test.mp3'; + {$ENDIF} + + opendialog1.Initialdir := application.Location + 'sound'; + +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.PaintBox2Paint(Sender: TObject); +begin + PaintBox2.Canvas.Draw(0, 0, waveformBMP); +end; + +procedure TForm1.Button1Click(Sender: TObject); +begin + +{$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so +if (Edit2.Text <> 'system') and (Edit2.Text <> '') then + if uos_TestLoadLibrary(PChar(edit2.Text)) = false then + edit2.Text := edit2.Text + '.2'; +{$endif} + + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + + // You may load one or more libraries . When you want... : + + if uos_LoadLib(PChar(edit1.Text), PChar(edit2.Text), PChar(edit3.Text), nil, nil, nil, nil) = 0 then + begin + form1.hide; + button1.Caption := + 'PortAudio, SndFile, Mpg123 libraries are loaded...'; + button1.Enabled := False; + edit1.ReadOnly := True; + edit2.ReadOnly := True; + edit3.ReadOnly := True; + form1.Height := 207; + form1.Position := poScreenCenter; + form1.Caption := 'Wave Form. uos version ' + IntToStr(uos_getversion()); + form1.Show; + end + else + MessageDlg('Error while loading libraries...', mtWarning, [mbYes], 0); + +end; + +procedure TForm1.ClosePlayer1; +begin + Form1.button3.Enabled := True; + Form1.button4.Enabled := True; + Form1.button5.Enabled := False; + Form1.trackbar1.Enabled := False; + Form1.TrackBar1.Position := 0; +end; + +procedure TForm1.Button3Click(Sender: TObject); +var + filelength, framewanted: integer; +begin + form1.Height := 456; + form1.Position := poScreenCenter; + if fileexists(Edit4.Text) then + begin + if Assigned(waveformBMP) then + waveformBMP.Free; + waveformBMP := TBitmap.Create; + PaintBox2.Parent.DoubleBuffered := True; + waveformBMP.Height := PaintBox2.Height; + waveformBMP.Width := PaintBox2.Width; + waveformBMP.Canvas.AntialiasingMode := amOn; + waveformBMP.Canvas.Pen.Width := 1; + waveformBMP.Canvas.brush.Color := clgray; + waveformBMP.Canvas.FillRect(0, 0, PaintBox2.Width, PaintBox2.Height); + PaintBox2.Refresh; + + PlayerIndex1 := 0; + + //// Create the player. + uos_CreatePlayer(PlayerIndex1); + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + //// add input from audio file with default parameters + In1Index := uos_AddFromFile(PlayerIndex1, PChar(Edit4.Text)); + + chan := uos_InputGetChannels(PlayerIndex1, In1Index); + //// no output because only decode the steam for wave form + + /// get the length of the audio file + filelength := uos_InputLength(PlayerIndex1, In1Index); + + ///// set calculation of level/volume into array (usefull for wave form procedure) + uos_InputSetLevelArrayEnable(PlayerIndex1, In1Index, 2); + ///////// set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + + //// determine how much frame will be designed + framewanted := filelength div paintbox2.Width; + uos_InputSetFrameCount(PlayerIndex1, In1Index, framewanted); + + ///// Assign the procedure of object to execute at end of stream + uos_EndProc(PlayerIndex1, @DrawWaveForm); + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets do it... + + end + else + MessageDlg(edit4.Text + ' do not exist...', mtWarning, [mbYes], 0); + +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin + if fileexists(Edit4.Text) then + begin + + PlayerIndex1 := 0; + + //// Create the player. + uos_CreatePlayer(PlayerIndex1); + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + //// add input from audio file with default parameters + In1Index := uos_AddFromFile(PlayerIndex1, PChar(Edit4.Text)); + + //// add a Output into device + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, In1Index), -1, -1, -1, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, In1Index), -1, -1, -1, -1); + {$endif} + + uos_InputSetPositionEnable(PlayerIndex1, In1Index, 1); + ///////// set position calculation (default is 0) + // 0 => no calcul + // 1 => calcul position. + + uos_LoopProcIn(PlayerIndex1, In1Index, @showposition); + ///// Assign the procedure of object to execute inside the loop for a Input + //////////// PlayerIndex : Index of a existing Player + //////////// InIndex : Index of a existing Input + //////////// showposition : procedure of object to execute inside the loop + + trackbar1.Max := uos_InputLength(PlayerIndex1, In1Index); + ////// Length of Input in samples + + /////// procedure to execute when stream is terminated + 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 at end of loop + + TrackBar1.position := 0; + trackbar1.Enabled := True; + Button3.Enabled := False; + Button4.Enabled := False; + Button5.Enabled := True; + + application.ProcessMessages; + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets play it... + + end + else + MessageDlg(edit4.Text + ' do not exist...', mtWarning, [mbYes], 0); + +end; + +procedure TForm1.Button5Click(Sender: TObject); +begin + uos_Stop(PlayerIndex1); +end; + + +procedure TForm1.Button2Click(Sender: TObject); +begin + if opendialog1.Execute then + Edit4.Text := opendialog1.FileName; +end; + + +procedure uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + +procedure TForm1.ShowPosition; +begin + form1.TrackBar1.Position := uos_InputPosition(PlayerIndex1, In1Index); +end; + +procedure Tform1.DrawWaveForm; +var + poswav: integer; + waveformdata: array of cfloat; +begin + sleep(250); + poswav := 0; + + waveformdata := uos_InputGetLevelArray(PlayerIndex1, In1Index); + + while poswav < length(waveformdata) div chan do + begin + if chan = 2 then + begin + waveformBMP.Canvas.Pen.Color := clyellow; + waveformBMP.Canvas.Line(poswav, paintbox2.Height div 2, poswav, ((paintbox2.Height div 2) - 1) - round((waveformdata[poswav * 2]) * (paintbox2.Height / 2) - 1)); + waveformBMP.Canvas.Pen.Color := clred; + waveformBMP.Canvas.Line(poswav, (paintbox2.Height div 2) + 2, poswav, ((paintbox2.Height div 2) + 1) + round((waveformdata[(poswav * 2) + 1]) * (paintbox2.Height / 2) + 1)); + end; + if chan = 1 then + begin + waveformBMP.Canvas.Pen.Color := clgreen; + waveformBMP.Canvas.Line(poswav, 0, poswav, ((paintbox2.Height) - 1) - round((waveformdata[poswav]) * (paintbox2.Height) - 1)); + end; + Inc(poswav); + end; + + paintbox2.Refresh; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + Form1.Height := 169; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + if button1.Enabled = False then + uos_free; +end; + +end. + diff --git a/UOS/examples/main_wfvrt.lfm b/UOS/examples/main_wfvrt.lfm new file mode 100644 index 0000000..b103642 --- /dev/null +++ b/UOS/examples/main_wfvrt.lfm @@ -0,0 +1,276 @@ +object Form1: TForm1 + Left = 173 + Height = 172 + Top = 242 + Width = 1018 + BorderIcons = [biSystemMenu] + Caption = 'Wave Form Designer' + ClientHeight = 172 + ClientWidth = 1018 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '2.2.4.0' + object PaintBox2: TPaintBox + Left = 0 + Height = 206 + Top = 206 + Width = 1024 + OnClick = PaintBox2Click + OnPaint = PaintBox2Paint + end + object Edit1: TEdit + Left = 320 + Height = 27 + Top = 20 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 3 + end + object Edit2: TEdit + Left = 320 + Height = 27 + Top = 60 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 4 + end + object Label1: TLabel + Left = 318 + Height = 18 + Top = 6 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label2: TLabel + Left = 318 + Height = 18 + Top = 46 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of SndFile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label3: TLabel + Left = 32 + Height = 24 + Top = 176 + Width = 968 + Alignment = taCenter + AutoSize = False + Caption = ' ' + Font.Height = 22 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + OnClick = Label3Click + end + object Edit4: TEdit + Left = 16 + Height = 27 + Top = 136 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 0 + end + object PaintBox1: TPaintBox + Left = 120 + Height = 105 + Top = 6 + Width = 105 + OnPaint = PaintBox1Paint + end + object Button1: TButton + Left = 320 + Height = 26 + Top = 92 + Width = 360 + Caption = 'Load that libraries' + Font.Height = 12 + OnClick = Button1Click + ParentFont = False + TabOrder = 2 + end + object Button3: TButton + Left = 568 + Height = 26 + Top = 137 + Width = 136 + Caption = 'Design Wave Form' + Font.Height = 12 + OnClick = Button3Click + ParentFont = False + TabOrder = 1 + end + object Button2: TButton + Left = 384 + Height = 26 + Top = 136 + Width = 66 + Caption = 'Choose' + Font.Height = 12 + OnClick = Button2Click + ParentFont = False + TabOrder = 5 + end + object TrackBar1: TTrackBar + Left = 0 + Height = 41 + Top = 408 + Width = 1024 + Position = 0 + TickMarks = tmTopLeft + TickStyle = tsNone + TabOrder = 6 + end + object Button4: TButton + Left = 728 + Height = 26 + Top = 138 + Width = 75 + Caption = 'Play' + Font.Height = 12 + OnClick = Button4Click + ParentFont = False + TabOrder = 7 + end + object Button5: TButton + Left = 816 + Height = 26 + Top = 137 + Width = 75 + Caption = 'Stop' + Enabled = False + Font.Height = 12 + OnClick = Button5Click + ParentFont = False + TabOrder = 8 + end + object Edit5: TEdit + Left = 480 + Height = 27 + Top = 137 + Width = 62 + Alignment = taCenter + AutoSize = False + OnChange = Edit5Change + TabOrder = 9 + Text = '0.2' + end + object Label4: TLabel + Left = 472 + Height = 16 + Top = 120 + Width = 80 + Alignment = taCenter + AutoSize = False + Caption = 'Threshold' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Button6: TButton + Left = 925 + Height = 24 + Top = 138 + Width = 75 + Caption = 'Quit' + Font.Height = 12 + OnClick = Button6Click + ParentFont = False + TabOrder = 10 + end + object OpenDialog1: TOpenDialog + Left = 264 + Top = 42 + end +end diff --git a/UOS/examples/main_wfvrt.pas b/UOS/examples/main_wfvrt.pas new file mode 100644 index 0000000..9a43ed1 --- /dev/null +++ b/UOS/examples/main_wfvrt.pas @@ -0,0 +1,509 @@ + + /////////////////// Demo how to use United Openlib of Sound //////////////////// + + //// Set debugger off => too much calcul... + +unit main_wfvrt; + +{$mode objfpc}{$H+} + +interface + +uses + uos_flat, + Forms, + Dialogs, + SysUtils, + fileutil, + Graphics, + ctypes, + StdCtrls, + ComCtrls, + ExtCtrls, + Classes, + Controls; + +type + { TForm1 } + TForm1 = class(TForm) + Button1: TButton; + Button2: TButton; + Button3: TButton; + Button4: TButton; + Button5: TButton; + Button6: TButton; + Edit1: TEdit; + Edit2: TEdit; + Edit4: TEdit; + Edit5: TEdit; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + OpenDialog1: TOpenDialog; + PaintBox1: TPaintBox; + PaintBox2: TPaintBox; + TrackBar1: TTrackBar; + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure Button5Click(Sender: TObject); + procedure Button6Click(Sender: TObject); + procedure Edit5Change(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure Label3Click(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + procedure PaintBox2Click(Sender: TObject); + procedure PaintBox2Paint(Sender: TObject); + procedure DrawWaveForm; + procedure ShowPosition; + procedure ClosePlayer1; + procedure LoopProcPlayer1; + + + private + { private declarations } + public + { public declarations } + end; + +procedure uos_logo(); + +var + Form1: TForm1; + BufferBMP, waveformBMP: TBitmap; + PlayerIndex1, In1index, chan, vrtpos, filelength: integer; + vrtfound: boolean = false; + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.FormActivate(Sender: TObject); +var + ordir: string; +{$IFDEF Darwin} + opath: string; +{$ENDIF} +begin + ordir := application.Location; + uos_logo(); + {$IFDEF Windows} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + Edit2.Text := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + {$else} + Edit1.Text := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + Edit2.Text := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + {$endif} + Edit4.Text := ordir + 'sound\noisyvoice.ogg'; + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + Edit2.Text := opath + '/lib/Mac/32bit/LibSndFile-32.dylib'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + Edit2.Text := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + Edit1.Text := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/Linux/64bit/LibSndFile-64.so'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} +{$if defined(cpu86) and defined(linux)} + Edit1.Text := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + Edit2.Text := ordir + 'lib/Linux/32bit/LibSndFile-32.so'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$endif} + + {$if defined(linux) and defined(cpuaarch64)} + Edit1.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + Edit2.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + + {$if defined(linux) and defined(cpuarm)} + Edit1.Text := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + Edit2.Text := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + + {$if defined(CPUAMD64) and defined(openbsd) } + Edit1.Text := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + Edit2.Text := ordir + 'lib/OpenBSD/64bit/LibSndFile-64.so'; + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + Edit2.Text := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + {$else} + Edit1.Text := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + Edit2.Text := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + {$endif} + Edit4.Text := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + + opendialog1.Initialdir := application.Location + 'sound'; + +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.PaintBox2Click(Sender: TObject); +begin + +end; + +procedure TForm1.PaintBox2Paint(Sender: TObject); +begin + PaintBox2.Canvas.Draw(0, 0, waveformBMP); +end; + +procedure TForm1.Button1Click(Sender: TObject); +begin + +{$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so +if (Edit2.Text <> 'system') and (Edit2.Text <> '') then + if uos_TestLoadLibrary(PChar(edit2.Text)) = false then + edit2.Text := edit2.Text + '.2'; +{$endif} + + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + // You may load one or more libraries . When you want... : + + if uos_LoadLib(PChar(edit1.Text), PChar(edit2.Text), nil, nil, nil, nil, nil) = 0 then + begin + form1.hide; + button1.Caption := + 'PortAudio, SndFile libraries are loaded...'; + button1.Enabled := False; + edit1.ReadOnly := True; + edit2.ReadOnly := True; + form1.Height := 172; + form1.Position := poScreenCenter; + form1.Caption := 'Wave Form. uos version ' + IntToStr(uos_getversion()); + form1.Show; + end + else + MessageDlg('Error while loading libraries...', mtWarning, [mbYes], 0); + +end; + +procedure TForm1.ClosePlayer1; +begin + Form1.button3.Enabled := True; + Form1.button4.Enabled := True; + Form1.button5.Enabled := False; + Form1.trackbar1.Enabled := False; + Form1.TrackBar1.Position := 0; +end; + +procedure Tform1.LoopProcPlayer1; ///this to seek begin of sound +var +volumeLR : cfloat; +temptime: ttime; +ho, mi, se, ms: word; + +begin +if vrtfound = false then + begin +volumeLR := (uos_InputGetLevelLeft(PlayerIndex1, In1Index) + + uos_InputGetLevelRight(PlayerIndex1, In1Index)) / 2; + + if volumeLR > strtofloat(edit5.text) then // you need to test/adjust the value + + + begin +temptime := uos_InputPositionTime(PlayerIndex1, In1Index); +vrtpos := uos_InputPosition(PlayerIndex1, In1Index); +DecodeTime(temptime, ho, mi, se, ms); +label3.Caption := 'With threshold ' + edit5.text + ': VRT = ' + format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); // here the time of begin of sound that you will use in text file +vrtfound := true; +end; +end; + end; + + +procedure TForm1.Button3Click(Sender: TObject); +var + framewanted: integer; +begin + form1.Height := 456; + form1.Position := poScreenCenter; + if fileexists(Edit4.Text) then + begin + vrtfound := false; + + label3.Caption := ''; + if Assigned(waveformBMP) then + waveformBMP.Free; + waveformBMP := TBitmap.Create; + PaintBox2.Parent.DoubleBuffered := True; + waveformBMP.Height := PaintBox2.Height; + waveformBMP.Width := PaintBox2.Width; + waveformBMP.Canvas.AntialiasingMode := amOn; + waveformBMP.Canvas.Pen.Width := 1; + waveformBMP.Canvas.brush.Color := clgray; + waveformBMP.Canvas.FillRect(0, 0, PaintBox2.Width, PaintBox2.Height); + PaintBox2.Refresh; + + PlayerIndex1 := 0; + + //// Create the player. + uos_CreatePlayer(PlayerIndex1); + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + //// add input from audio file with default parameters + In1Index := uos_AddFromFile(PlayerIndex1, PChar(Edit4.Text)); + + chan := uos_InputGetChannels(PlayerIndex1, In1Index); + //// no output because only decode the steam for wave form + + /// get the length of the audio file + filelength := uos_InputLength(PlayerIndex1, In1Index); + + ///// set calculation of level/volume into array (usefull for wave form procedure) + uos_InputSetLevelArrayEnable(PlayerIndex1, In1Index, 2); + ///////// set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + + //// determine how much frame will be designed + framewanted := filelength div paintbox2.Width; + uos_InputSetFrameCount(PlayerIndex1, In1Index, framewanted); + + uos_InputSetLevelEnable(PlayerIndex1, In1Index, 2); + uos_InputSetPositionEnable(PlayerIndex1, In1Index, 1); + + uos_LoopProcIn(PlayerIndex1, In1Index, @LoopProcPlayer1); // this to seek begin of sound + + ///// Assign the procedure of object to execute at end of stream + uos_EndProc(PlayerIndex1, @DrawWaveForm); + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets do it... + + end + else + MessageDlg(edit4.Text + ' do not exist...', mtWarning, [mbYes], 0); + +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin + if fileexists(Edit4.Text) then + begin + + PlayerIndex1 := 0; + + //// Create the player. + uos_CreatePlayer(PlayerIndex1); + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + //// add input from audio file with default parameters + In1Index := uos_AddFromFile(PlayerIndex1, PChar(Edit4.Text)); + + //// add a Output into device + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, In1Index), -1, -1, -1, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, In1Index), -1, -1, -1, -1); + {$endif} + + uos_InputSetPositionEnable(PlayerIndex1, In1Index, 1); + ///////// set position calculation (default is 0) + // 0 => no calcul + // 1 => calcul position. + + uos_LoopProcIn(PlayerIndex1, In1Index, @showposition); + ///// Assign the procedure of object to execute inside the loop for a Input + //////////// PlayerIndex : Index of a existing Player + //////////// InIndex : Index of a existing Input + //////////// showposition : procedure of object to execute inside the loop + + trackbar1.Max := uos_InputLength(PlayerIndex1, In1Index); + ////// Length of Input in samples + + /////// procedure to execute when stream is terminated + 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 at end of loop + + TrackBar1.position := 0; + trackbar1.Enabled := True; + Button3.Enabled := False; + Button4.Enabled := False; + Button5.Enabled := True; + + application.ProcessMessages; + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets play it... + + end + else + MessageDlg(edit4.Text + ' do not exist...', mtWarning, [mbYes], 0); + +end; + +procedure TForm1.Button5Click(Sender: TObject); +begin + uos_Stop(PlayerIndex1); +end; + +procedure TForm1.Button6Click(Sender: TObject); +begin + close; +end; + +procedure TForm1.Edit5Change(Sender: TObject); +begin + +end; + + +procedure TForm1.Button2Click(Sender: TObject); +begin + if opendialog1.Execute then + Edit4.Text := opendialog1.FileName; +end; + + +procedure uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + +procedure TForm1.ShowPosition; +begin + form1.TrackBar1.Position := uos_InputPosition(PlayerIndex1, In1Index); +end; + +procedure Tform1.DrawWaveForm; +var + poswav: integer; + waveformdata: array of cfloat; +begin + sleep(250); + poswav := 0; + + waveformdata := uos_InputGetLevelArray(PlayerIndex1, In1Index); + + while poswav < length(waveformdata) div chan do + begin + if chan = 2 then + begin + waveformBMP.Canvas.Pen.Color := clyellow; + waveformBMP.Canvas.Line(poswav, paintbox2.Height div 2, poswav, ((paintbox2.Height div 2) - 1) - round((waveformdata[poswav * 2]) * (paintbox2.Height / 2) - 1)); + waveformBMP.Canvas.Pen.Color := clred; + waveformBMP.Canvas.Line(poswav, (paintbox2.Height div 2) + 2, poswav, ((paintbox2.Height div 2) + 1) + round((waveformdata[(poswav * 2) + 1]) * (paintbox2.Height / 2) + 1)); + end; + if chan = 1 then + begin + waveformBMP.Canvas.Pen.Color := clgreen; + waveformBMP.Canvas.Line(poswav, 0, poswav, ((paintbox2.Height) - 1) - round((waveformdata[poswav]) * (paintbox2.Height) - 1)); + end; + Inc(poswav); + end; + + waveformBMP.Canvas.Pen.Color := clpurple; + + waveformBMP.Canvas.Line(round(paintbox2.width*vrtpos/filelength)-2, 0, round(paintbox2.width*vrtpos/filelength)-2, ((paintbox2.Height) - 1)); + + paintbox2.Refresh; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + Form1.Height := 123; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + if button1.Enabled = False then + uos_free; +end; + +procedure TForm1.Label3Click(Sender: TObject); +begin + +end; + +end. + diff --git a/UOS/examples/main_wsp.lfm b/UOS/examples/main_wsp.lfm new file mode 100644 index 0000000..f10819f --- /dev/null +++ b/UOS/examples/main_wsp.lfm @@ -0,0 +1,508 @@ +object Form1: TForm1 + Left = 252 + Height = 498 + Top = 181 + Width = 505 + BorderIcons = [biSystemMenu] + Caption = 'Simple Web Player U0S PortAudio + SndFile + Mpg123' + ClientHeight = 498 + ClientWidth = 505 + Color = clMoneyGreen + Icon.Data = { + BE0800000000010001002020000001000800A808000016000000280000002000 + 0000400000000100080000000000000000000000000000000000000000000000 + 0000000000000101010001020100010301000203020001040100020402000304 + 0300040404000405040005060500060706000409040007080700040A04000809 + 0800050C0500060D06000A0C0A00060E06000B0D0B000C0E0C000E100E000813 + 08000E110E000F110F000914090010121000091509000A180A00121512000B19 + 0B00141714000C1B0C000C1C0C00161916000C1D0C000D1E0D000F220F000F23 + 0F001C211C001F241F0020252000132B13002126210024292400252A2500272C + 2700282E28002A302A002B312B002B322B001D421D00323A3200333B33001E45 + 1E00353D3500373F3700204B2000214C2100224D22003B443B003D463D003E47 + 3E0023522300414A410025562500414B4100285B280045504500485348004A55 + 4A002D682D00306E3000306F3000327232005966590033763300596759003477 + 34005B685B005C695C005D6A5D00606E6000387F380063716300398339006473 + 64003A843A003A853A003B873B003B883B003D8C3D003F903F00419441007181 + 710072827200429742004398430077897700788A78007A8C7A007C8E7C007D8F + 7D007D907D007F927F00809380004BAB4B00839683004CAD4C004CAE4C008598 + 8500869986004DB04D004FB54F0050B650008A9F8A008BA08B008FA48F0053BD + 530090A5900053BE530091A6910054BF540054C1540055C2550055C3550058C9 + 580058CA58005ACD5A009CB39C009DB49D005BCF5B005BD05B005CD35C00A1B8 + A100A1B9A100A2B9A2005DD65D00A3BBA300A4BCA4005FD95F00A5BEA5005FDA + 5F00A6BEA600A6BFA60060DC6000A7C0A70061DD6100AAC3AA0062E06200ABC4 + AB0064E36400ADC6AD00AFC9AF0065E76500B0CAB000B1CAB100B1CBB10066E9 + 6600B2CCB200B3CDB300B4CEB400B6D1B60069F06900B9D4B900BAD5BA006BF5 + 6B00BAD6BA00BBD6BB00BCD8BC006CF86C00BDD8BD006DF86D00BDD9BD006DFA + 6D00BEDABE006EFB6E00BFDBBF00C0DCC000C0DDC000C1DDC1006FFE6F00C1DE + C100C2DEC20070FF700071FF710072FF7200C3DFC30073FF730074FF740075FF + 7500C3E0C30076FF7600C4E0C40077FF7700C4E1C400C5E1C5007CFF7C00C5E2 + C500C7E4C700C8E6C800C9E6C900C9E7C900CBE8CB00CCEACC00CEECCE00D1EF + D100D6F5D6000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000B3B3B3B3B3B3B3B3B3B3B3B5A5A19A9A9A9AA1A5B5B3B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B2B7B5763E1500000000153E76B5B7B2B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B2C29935070000000000000000073599C2B2B3B3B3B3B3 + B3B3B3B3B3B3B3B3B2B89E1600002B5BA49F9FA45B2B0000169EB8B2B3B3B3B3 + B3B3B3B3B3B3B3B3B29A2A000356BBBBB6B9B9B6BBBB5603002A9AB2B3B3B3B3 + B3B3B3B3B3B3B3B2B343001371C3B9B9B9B9B9B9B9B9C371130043B3B2B3B3B3 + B3B3B3B3B3B3B3B78C00005CC1B6B9B9B9B9B9B9B9B9B6C15C00008CB7B3B3B3 + B3B3B3B3B3B3B3CB390034ABB9B9B9B9BBBBBBBBB9B9B9B9AB340039CBB3B3B3 + B3B3B3B3B3B3B3C8000073B9B6B9B186484A495A98B9B6B9B9730000C8B3B3B3 + B3B3B3B3B3B3C563001C84B9B9B95800000000000C80BEB6B9841C0063C5B3B3 + B3B3B3B3B3B3C468002794B9B1540000253A3706001C7BBBB994270068C4B3B3 + B3B3B3B3B3B3C468002692B98D170042AFA7A78F1F003CADB992260068C4B3B3 + B3B3B3B3B3B3C468002692B959000296BAB9B6BF4D000E85B994260068C4B3B3 + B3B3B3B3B3B3C46800218AB940004FBFB6B9B9B6C600007CB981170068C4B3B3 + B3B3B3B3B3B3C468000079B94B007EBAB9B9B9B9C300007DB972000068C4B3B3 + B3B3B3B3B3B3C468000044B9A79BB6B6B9B9B9B9C300007DB944000068C4B3B3 + B3B3B3B3B3B3C4650000006DBBB6B9B9B9B9B9B9BF00007F6D00000065C4B3B3 + B3B3B3B3B3B2CB450000002494BEB9B9B9B9B9C16200106B2400000045CBB2B3 + B3B3B3B3B3B39E2800382300226EBFBDBEBDC17711001A1D00233800289EB3B3 + B3B3B3B3B3B566000169880000053B5E5D61130E00000000008869010066B5B3 + B3B3B3B3B2A8320012CFC28308040000000000000000010883C2CF120033A3B3 + B3B3B3B2C96F000074C2B2BCA62D0000000000000A2951B3BCB2C274000055CC + B2B3B3CD660B0047C7B2B3B2870900306C676766758ECBB4B3B3B2C747000F67 + CEB3AA5F140031A0B3B3B3B546002CB2B8B5B5B5B4BCC4B5B3B3B3B3A0310004 + 4CAC95000020A2B5B3B3B3B53F0052C7B3B3B3B3C06A4790B3B3B3B3B5A22000 + 0095A33D369CC0B2B3B3B3B72E0064C2B3B3B3B3CC1B0078B3B3B3B3B2C09C36 + 3DA3B5A2B7B5B2B3B3B3B3B5410050CAB2B3B3B2D000007AB3B3B3B3B3B2B5B7 + A2B5B2B3B3B3B3B3B3B3B3B357000297BCB2B2CC4E000D82B3B3B3B3B3B3B3B3 + B3B2B3B3B3B3B3B3B3B3B3B28B18001989A29D6001003EA8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3AE530000001E0000002D91B8B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B3B06C2F000000004793C4B2B3B3B3B3B3B3B3B3 + B3B3B3B3B3B3B3B3B3B3B3B3B2B3B5A3A070A09EA9B3B2B3B3B3B3B3B3B3B3B3 + B3B3000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000 + } + OnActivate = FormActivate + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poDesktopCenter + LCLVersion = '3.4.0.0' + object Shape1: TShape + Left = 10 + Height = 216 + Top = 272 + Width = 483 + Brush.Color = clSilver + end + object TrackBar1: TTrackBar + Left = 24 + Height = 160 + Top = 288 + Width = 26 + Max = 100 + OnChange = TrackBar1Change + Orientation = trVertical + Position = 100 + Reversed = True + TickStyle = tsNone + TabOrder = 5 + end + object Edit1: TEdit + Left = 132 + Height = 27 + Top = 32 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 3 + end + object Edit3: TEdit + Left = 132 + Height = 27 + Top = 70 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 4 + end + object Label1: TLabel + Left = 130 + Height = 18 + Top = 16 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of PortAudio Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Label3: TLabel + Left = 126 + Height = 18 + Top = 58 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Mpg123 Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit4: TEdit + Left = 124 + Height = 27 + Top = 296 + Width = 358 + Alignment = taCenter + AutoSize = False + TabOrder = 0 + Text = 'http://broadcast.infomaniak.net:80/alouette-high.mp3' + end + object PaintBox1: TPaintBox + Left = 18 + Height = 105 + Top = 56 + Width = 105 + OnPaint = PaintBox1Paint + end + object Label4: TLabel + Left = 24 + Height = 14 + Top = 454 + Width = 26 + Alignment = taCenter + Caption = 'Vol L' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Button1: TButton + Left = 10 + Height = 26 + Top = 232 + Width = 483 + Caption = 'Load that libraries' + TabOrder = 2 + OnClick = Button1Click + end + object Button3: TButton + Left = 128 + Height = 23 + Top = 454 + Width = 58 + Caption = 'Play' + Font.Height = 12 + ParentFont = False + TabOrder = 1 + OnClick = Button3Click + end + object Button4: TButton + Left = 316 + Height = 23 + Top = 454 + Width = 58 + Caption = 'Resume' + Enabled = False + Font.Height = 12 + ParentFont = False + TabOrder = 6 + OnClick = Button4Click + end + object Button5: TButton + Left = 218 + Height = 23 + Top = 454 + Width = 54 + Caption = 'Pause' + Enabled = False + Font.Height = 12 + ParentFont = False + TabOrder = 7 + OnClick = Button5Click + end + object Button6: TButton + Left = 410 + Height = 23 + Top = 454 + Width = 47 + Caption = 'Stop' + Enabled = False + Font.Height = 12 + ParentFont = False + TabOrder = 8 + OnClick = Button6Click + end + object TrackBar3: TTrackBar + Left = 89 + Height = 162 + Top = 288 + Width = 26 + Max = 100 + OnChange = TrackBar1Change + Orientation = trVertical + Position = 100 + Reversed = True + TickStyle = tsNone + TabOrder = 9 + end + object Label5: TLabel + Left = 88 + Height = 14 + Top = 456 + Width = 28 + Alignment = taCenter + Caption = 'Vol R' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object RadioGroup1: TRadioGroup + Left = 124 + Height = 86 + Top = 344 + Width = 120 + AutoFill = True + Caption = 'Sample Format' + ChildSizing.LeftRightSpacing = 6 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize + ChildSizing.EnlargeVertical = crsHomogenousChildResize + ChildSizing.ShrinkHorizontal = crsScaleChilds + ChildSizing.ShrinkVertical = crsScaleChilds + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 1 + ClientHeight = 69 + ClientWidth = 116 + Color = clSilver + Font.Height = 12 + ParentBackground = False + ParentFont = False + ParentColor = False + TabOrder = 10 + object RadioButton1: TRadioButton + Left = 6 + Height = 19 + Top = 6 + Width = 104 + Caption = 'Float 32 bit' + TabOrder = 0 + end + object RadioButton2: TRadioButton + Left = 6 + Height = 19 + Top = 25 + Width = 104 + Caption = 'Int 32 bit' + TabOrder = 1 + end + object RadioButton3: TRadioButton + Left = 6 + Height = 19 + Top = 44 + Width = 104 + Caption = 'Int 16 bit' + Checked = True + TabOrder = 2 + TabStop = True + end + end + object lposition: TLabel + Left = 204 + Height = 15 + Top = 280 + Width = 203 + Caption = 'HTTP location of mp3 or opus file.' + Font.Height = 12 + ParentColor = False + ParentFont = False + end + object ShapeRight: TShape + Left = 72 + Height = 146 + Top = 296 + Width = 8 + Brush.Color = clLime + end + object ShapeLeft: TShape + Left = 56 + Height = 146 + Top = 296 + Width = 8 + Brush.Color = clLime + end + object Edit5: TEdit + Left = 132 + Height = 27 + Top = 192 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 11 + end + object Label6: TLabel + Left = 133 + Height = 18 + Top = 176 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Plugin SoundTouch Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object CheckBox2: TCheckBox + Left = 274 + Height = 21 + Top = 354 + Width = 183 + Caption = 'Enable SoundTouch Plugin' + Font.Height = 12 + ParentFont = False + TabOrder = 12 + OnChange = ChangePlugSet + end + object Button7: TButton + Left = 280 + Height = 25 + Top = 410 + Width = 55 + Caption = 'Reset' + Font.Height = 12 + ParentFont = False + TabOrder = 13 + OnClick = ResetPlugClick + end + object Label7: TLabel + Left = 280 + Height = 15 + Top = 386 + Width = 67 + Caption = 'Tempo: 1.0' + Font.Height = 12 + ParentColor = False + ParentFont = False + end + object Label9: TLabel + Left = 396 + Height = 15 + Top = 386 + Width = 58 + Caption = 'Pitch: 1.0' + Font.Height = 12 + ParentColor = False + ParentFont = False + end + object TrackBar4: TTrackBar + Left = 350 + Height = 66 + Top = 372 + Width = 34 + Max = 100 + OnChange = ChangePlugSet + Orientation = trVertical + Position = 50 + Reversed = True + TickStyle = tsNone + TabOrder = 14 + end + object TrackBar5: TTrackBar + Left = 455 + Height = 66 + Top = 372 + Width = 34 + Max = 100 + OnChange = ChangePlugSet + Orientation = trVertical + Position = 50 + Reversed = True + TickStyle = tsNone + TabOrder = 15 + end + object lerror: TLabel + Left = 144 + Height = 1 + Top = 432 + Width = 1 + Color = clRed + Font.Color = clWhite + ParentColor = False + ParentFont = False + Transparent = False + end + object Label8: TLabel + Left = 132 + Height = 18 + Top = 96 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Opusfile Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end + object Edit6: TEdit + Left = 132 + Height = 27 + Top = 108 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 16 + end + object mp3format: TRadioButton + Left = 136 + Height = 21 + Top = 322 + Width = 100 + Caption = 'mp3 format' + Checked = True + TabOrder = 18 + TabStop = True + end + object opusformat: TRadioButton + Left = 248 + Height = 21 + Top = 322 + Width = 102 + Caption = 'opus format' + TabOrder = 17 + end + object aacformat: TRadioButton + Left = 376 + Height = 21 + Top = 322 + Width = 94 + Caption = 'aac format' + TabOrder = 19 + end + object Edit8: TEdit + Left = 132 + Height = 27 + Top = 148 + Width = 360 + Alignment = taCenter + AutoSize = False + TabOrder = 20 + end + object Label11: TLabel + Left = 132 + Height = 18 + Top = 134 + Width = 360 + Alignment = taCenter + AutoSize = False + Caption = 'Folder + filename of Fdk-aac Library' + Font.Height = -11 + Font.Name = 'Sans' + ParentColor = False + ParentFont = False + end +end diff --git a/UOS/examples/main_wsp.pas b/UOS/examples/main_wsp.pas new file mode 100644 index 0000000..5dc70ef --- /dev/null +++ b/UOS/examples/main_wsp.pas @@ -0,0 +1,547 @@ +/////////////////// Demo how to use United Openlib of Sound //////////////////// + +unit main_wsp; + +{$mode objfpc}{$H+} + +interface + +uses + uos_flat, + Forms, + Dialogs, + SysUtils, + fileutil, + Graphics, + ctypes, + StdCtrls, + ComCtrls, + ExtCtrls, + Classes, + Controls; + +type + { TForm1 } + TForm1 = class(TForm) + Button1: TButton; + Button3: TButton; + Button4: TButton; + Button5: TButton; + Button6: TButton; + Button7: TButton; + CheckBox2: TCheckBox; + Edit1: TEdit; + Edit3: TEdit; + Edit4: TEdit; + Edit5: TEdit; + Edit6: TEdit; + Edit8: TEdit; + Label1: TLabel; + Label11: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + lposition: TLabel; + lerror: TLabel; + opusformat: TRadioButton; + aacformat: TRadioButton; + PaintBox1: TPaintBox; + RadioButton1: TRadioButton; + RadioButton2: TRadioButton; + RadioButton3: TRadioButton; + mp3format: TRadioButton; + RadioGroup1: TRadioGroup; + Shape1: TShape; + ShapeRight: TShape; + ShapeLeft: TShape; + TrackBar1: TTrackBar; + TrackBar3: TTrackBar; + TrackBar4: TTrackBar; + TrackBar5: TTrackBar; + procedure Button1Click(Sender: TObject); + procedure Button3Click(Sender: TObject); + procedure Button4Click(Sender: TObject); + procedure Button5Click(Sender: TObject); + procedure Button6Click(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure PaintBox1Paint(Sender: TObject); + procedure TrackBar1Change(Sender: TObject); + procedure ClosePlayer1; + procedure LoopProcPlayer1; + procedure ShowLevel; + procedure ChangePlugSet(Sender: TObject); + procedure ResetPlugClick(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +procedure uos_logo(); + +var + Form1: TForm1; + BufferBMP: TBitmap; + PlayerIndex1: cardinal; + Out1Index, In1Index, DSP1Index, Plugin1Index: integer; + plugsoundtouch: Boolean = False; + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.ChangePlugSet(Sender: TObject); +var + tempo, rate: cfloat; +begin + if (trim(PChar(edit5.Text)) <> '') and fileexists(edit5.Text) then + begin + if (2 * (TrackBar4.Position / 100)) < 0.3 then + tempo := 0.3 + else + tempo := (2 * (TrackBar4.Position / 100)); + if (2 * (TrackBar5.Position / 100)) < 0.3 then + rate := 0.3 + else + rate := (2 * (TrackBar5.Position / 100)); + + label7.Caption := 'Tempo: ' + floattostrf(tempo, ffFixed, 15, 1); + label9.Caption := 'Pitch: ' + floattostrf(rate, ffFixed, 15, 1); + + if radiogroup1.Enabled = False then /// player1 was created + uos_SetPluginSoundTouch(PlayerIndex1, Plugin1Index, tempo, rate, checkbox2.Checked); + end; + +end; + +procedure TForm1.ResetPlugClick(Sender: TObject); +begin + TrackBar4.Position := 50; + TrackBar5.Position := 50; + if radiogroup1.Enabled = False then /// player1 was created + uos_SetPluginSoundTouch(PlayerIndex1, Plugin1Index, 1, 1, checkbox2.Checked); + +end; + +procedure TForm1.ClosePlayer1; +begin + Form1.button3.Enabled := True; + Form1.button4.Enabled := False; + Form1.button5.Enabled := False; + Form1.button6.Enabled := False; + Form1.radiogroup1.Enabled := True; + Form1.ShapeLeft.Height := 0; + Form1.ShapeRight.Height := 0; + Form1.ShapeLeft.top := 296; + Form1.ShapeRight.top := 296; +end; + +procedure TForm1.FormActivate(Sender: TObject); +var + ordir: string; +{$IFDEF Darwin} + opath: string; +{$ENDIF} +begin + {$if (defined(CPUAMD64) and defined(linux)) or (defined(CPUAMD64) and defined(windows))} + aacformat.visible := true; + {$else} + aacformat.visible := false; + {$endif} + + ordir := application.Location; + uos_logo(); + {$IFDEF Windows} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + Edit3.Text := ordir + 'lib\Windows\64bit\LibMpg123-64.dll'; + Edit5.Text := ordir + 'lib\Windows\64bit\plugin\LibSoundTouch-64.dll'; + edit8.Text := ordir + 'lib\Windows\64bit\libfdk-aac-64.dll'; + {$else} + Edit1.Text := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + Edit3.Text := ordir + 'lib\Windows\32bit\LibMpg123-32.dll'; + Edit5.Text := ordir + 'lib\Windows\32bit\plugin\LibSoundTouch-32.dll'; + edit8.Text := ordir + 'lib\Windows\32bit\libfdk-aac-32.dll'; + Edit6.Text := ordir + 'lib\Windows\32bit\LibOpusFile-32.dll'; + {$endif} + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/32bit/LibPortaudio-32.dylib'; + Edit3.Text := opath + '/lib/Mac/32bit/LibMpg123-32.dylib'; + Edit5.Text := opath + '/lib/Mac/32bit/plugin/LibSoundTouch-32.dylib'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + Edit1.Text := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + Edit3.Text := opath + '/lib/Mac/64bit/LibMpg123-64.dylib'; + {$ENDIF} + {$ENDIF} + + {$if defined(CPUAMD64) and defined(linux) } + Edit1.Text := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + Edit3.Text := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + edit8.Text := ordir + 'lib/Linux/64bit/libfdk-aac-64.so'; + Edit5.Text := ordir + 'lib/Linux/64bit/plugin/LibSoundTouch-64.so'; + Edit6.Text := ordir + 'lib/Linux/64bit/LibOpusFile-64.so'; +{$ENDIF} + {$if defined(cpu86) and defined(linux)} + Edit1.Text := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + Edit3.Text := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; + Edit5.Text := ordir + 'lib/Linux/32bit/plugin/LibSoundTouch-32.so'; +{$endif} + + {$if defined(linux) and defined(cpuaarch64)} + Edit1.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + Edit3.Text := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + Edit5.Text := ordir + 'lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so'; + {$ENDIF} + + {$if defined(linux) and defined(cpuarm)} + Edit1.Text := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + Edit3.Text := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so'; + Edit5.Text := ordir + 'lib/Linux/arm_raspberrypi/plugin/libsoundtouch-arm.so'; + {$ENDIF} + +{$if defined(CPUAMD64) and defined(openbsd) } + Edit1.Text := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + Edit3.Text := ordir + 'lib/OpenBSD/64bit/LibMpg123-64.so'; + Edit5.Text := ordir + 'lib/OpenBSD/64bit/plugin/LibSoundTouch-64.so'; + Edit6.Text := ordir + 'lib/OpenBSD/64bit/LibOpusFile-64.so'; +{$ENDIF} + +{$IFDEF freebsd} + {$if defined(cpu64)} + Edit1.Text := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + Edit3.Text := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so'; + Edit5.Text := ''; +{$else} + Edit1.Text := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + Edit3.Text := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + Edit5.Text := ''; +{$endif} +{$ENDIF} + +end; + +procedure TForm1.PaintBox1Paint(Sender: TObject); +begin + PaintBox1.Canvas.Draw(0, 0, BufferBMP); +end; + +procedure TForm1.TrackBar1Change(Sender: TObject); +begin + if (button3.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex1, In1Index, TrackBar1.position / 100, + TrackBar3.position / 100, True); +end; + + +procedure TForm1.Button1Click(Sender: TObject); +var + loadok: Boolean = False; +begin + + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename, fdkaac: PChar) : LongInt; + + if uos_LoadLib(PChar(edit1.Text), nil, PChar(edit3.Text), nil, nil, PChar(edit6.Text), nil, PChar(edit8.Text)) = 0 then + begin + form1.hide; + loadok := True; + button1.Caption := + 'PortAudio, Mpg123, OpusFile and fdkaac libraries are loaded...'; + end + else + MessageDlg('Error while loading libraries...', mtWarning, [mbYes], 0); + + if loadok = True then + begin + if (trim(PChar(edit5.Text)) <> '') and fileexists(edit5.Text) and (uos_LoadPlugin('soundtouch', PChar(edit5.Text)) = 0) then + begin + button1.Caption := + 'PortAudio, Mpg123, OpusFile, fdkaac and SoundTouch libraries are loaded...'; + plugsoundtouch := True; + end + else + begin + TrackBar4.Enabled := False; + TrackBar5.Enabled := False; + CheckBox2.Enabled := False; + Button7.Enabled := False; + label9.Enabled := False; + label7.Enabled := False; + end; + + button1.Enabled := False; + edit1.ReadOnly := True; + edit3.ReadOnly := True; + edit5.ReadOnly := True; + form1.Height := 498; + form1.Position := poScreenCenter; + form1.Caption := 'Simple Web Player. uos version ' + IntToStr(uos_getversion()); + + // Some audio web streaming + // edit4.text := 'https://radio.lotustechnologieslk.net:2020/stream/hirufmgarden'; + // edit4.Text := 'http://broadcast.infomaniak.net:80/alouette-high.mp3'; + edit4.text := 'http://stream-uk1.radioparadise.com/mp3-128' ; + // edit4.text := 'http://www.hubharp.com/web_sound/BachGavotteShort.mp3' ; + // edit4.text := 'http://www.jerryradio.com/downloads/BMB-64-03-06-MP3/jg1964-03-06t01.mp3' ; + // edit4.text := 'https://github.com/fredvs/test/releases/download/fpc323/test.opus'; + // edit4.text := 'https://radiorecord.hostingradio.ru/ps96.aacp'; + + form1.Show; + end; +end; + +procedure TForm1.Button5Click(Sender: TObject); +begin + uos_Pause(PlayerIndex1); + Button4.Enabled := True; + Button5.Enabled := False; + Form1.ShapeLeft.Height := 0; + Form1.ShapeRight.Height := 0; + Form1.ShapeLeft.top := 296; + Form1.ShapeRight.top := 296; +end; + +procedure TForm1.Button4Click(Sender: TObject); +begin + Button4.Enabled := False; + Button5.Enabled := True; + Button6.Enabled := True; + application.ProcessMessages; + uos_RePlay(PlayerIndex1); +end; + +procedure TForm1.Button3Click(Sender: TObject); +var + samformat, audioformat: shortint; + sizebuff: integer; +begin + lerror.Caption := ''; + PlayerIndex1 := 0; + // PlayerIndex : from 0 to what your computer can do ! (depends of ram, cpu, ...) + // If PlayerIndex exists already, it will be overwritten... + + sizebuff := 16384; + + if mp3format.Checked = True then + audioformat := 0 else + if opusformat.Checked = True then + audioformat := 1 else + if aacformat.Checked = True then + audioformat := 2; + + if radiobutton1.Checked = True then + samformat := 0; + if radiobutton2.Checked = True then + samformat := 1; + if radiobutton3.Checked = True then + samformat := 2; + + uos_CreatePlayer(PlayerIndex1); + //// Create the player. + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + In1Index := uos_AddFromURL(PlayerIndex1, PChar(edit4.Text), -1, samformat, sizebuff, audioformat, False); + /////// Add a Input from Audio URL with custom parameters + ////////// URL : URL of audio file (like 'http://someserver/somesound.mp3') + ////////// 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, 2: aac) + // ICY data on/off + ////////// example : InputIndex := AddFromFile(0,'http://someserver/somesound.mp3',-1,-1,-1); + // result : -1 nothing created, otherwise Input Index in array + + if In1Index <> -1 then + begin + + radiogroup1.Enabled := False; + + Out1Index := uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, In1Index), + uos_InputGetChannels(PlayerIndex1, In1Index), samformat, sizebuff, -1); + + //// 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) /// here default samplerate of input + //////////// 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) + // result : -1 nothing created, otherwise Output Index in array + + uos_InputSetLevelEnable(PlayerIndex1, In1Index, 2); + ///// set calculation of level/volume (usefull for showvolume procedure) + ///////// set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + // 3 => calcul before and after all DSP procedures. + + uos_LoopProcIn(PlayerIndex1, In1Index, @LoopProcPlayer1); + ///// Assign the procedure of object to execute inside the loop for a Input + //////////// PlayerIndex : Index of a existing Player + //////////// InIndex : Index of a existing Input + //////////// LoopProcPlayer1 : procedure of object to execute inside the loop + + uos_InputAddDSPVolume(PlayerIndex1, In1Index, 1, 1); + ///// DSP Volume changer + ////////// PlayerIndex1 : Index of a existing Player + ////////// In1Index : InputIndex of a existing input + ////////// VolLeft : Left volume ( from 0 to 1 => gain > 1 ) + ////////// VolRight : Right volume + + uos_InputSetDSPVolume(PlayerIndex1, In1Index, TrackBar1.position / 100, + TrackBar3.position / 100, True); /// Set volume + ////////// PlayerIndex1 : Index of a existing Player + ////////// In1Index : InputIndex of a existing Input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + ////////// Enable : Enabled +//{ + if plugsoundtouch = True then + begin + Plugin1Index := uos_AddPlugin(PlayerIndex1, 'soundtouch', uos_InputGetSampleRate(PlayerIndex1, In1Index), + uos_InputGetChannels(PlayerIndex1, In1Index)); + ///// add SoundTouch plugin with default samplerate(44100) / channels(2 = stereo) + + ChangePlugSet(self); //// Change plugin settings + end; +//} + /////// procedure to execute when stream is terminated + 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 + + Button3.Enabled := False; + Button4.Enabled := False; + Button6.Enabled := True; + Button5.Enabled := True; + + application.ProcessMessages; + + sleep(1000); + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets play it... + end + else + lerror.Caption := 'URL did not accessed'; + +end; + +procedure TForm1.Button6Click(Sender: TObject); +begin + ClosePlayer1; + uos_Stop(PlayerIndex1); +end; + +procedure uos_logo(); +var + xpos, ypos: integer; + ratio: double; +begin + xpos := 0; + ypos := 0; + ratio := 1; + BufferBMP := TBitmap.Create; + with form1 do + begin + form1.PaintBox1.Parent.DoubleBuffered := True; + PaintBox1.Height := round(ratio * 116); + PaintBox1.Width := round(ratio * 100); + BufferBMP.Height := PaintBox1.Height; + BufferBMP.Width := PaintBox1.Width; + BufferBMP.Canvas.AntialiasingMode := amOn; + BufferBMP.Canvas.Pen.Width := round(ratio * 6); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height); + BufferBMP.Canvas.Pen.Color := clblack; + BufferBMP.Canvas.brush.Color := $70FF70; + BufferBMP.Canvas.Ellipse(round(ratio * (22) + xpos), + round(ratio * (30) + ypos), round(ratio * (72) + xpos), + round(ratio * (80) + ypos)); + BufferBMP.Canvas.brush.Color := clmoneygreen; + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (8) + ypos), + round(ratio * (58) + xpos), round(ratio * (32) + ypos), round(ratio * (58) + xpos), + round(ratio * (20) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + xpos)); + BufferBMP.Canvas.Arc(round(ratio * (34) + xpos), round(ratio * (32) + ypos), + round(ratio * (58) + xpos), round(ratio * (60) + ypos), round(ratio * (34) + xpos), + round(ratio * (48) + ypos), round(ratio * (46) + xpos), + round(ratio * (32) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (-28) + xpos), round(ratio * (18) + ypos), + round(ratio * (23) + xpos), round(ratio * (80) + ypos), round(ratio * (20) + xpos), + round(ratio * (50) + ypos), round(ratio * (3) + xpos), round(ratio * (38) + ypos)); + BufferBMP.Canvas.Arc(round(ratio * (70) + xpos), round(ratio * (18) + ypos), + round(ratio * (122) + xpos), round(ratio * (80) + ypos), + round(ratio * (90 - xpos)), + round(ratio * (38) + ypos), round(ratio * (72) + xpos), + round(ratio * (50) + ypos)); + BufferBMP.Canvas.Font.Name := 'Arial'; + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (4) + xpos), + round(ratio * (83) + ypos), 'United Openlib'); + BufferBMP.Canvas.Font.Size := round(ratio * 7); + BufferBMP.Canvas.TextOut(round(ratio * (20) + xpos), + round(ratio * (101) + ypos), 'of'); + BufferBMP.Canvas.Font.Size := round(ratio * 10); + BufferBMP.Canvas.TextOut(round(ratio * (32) + xpos), + round(ratio * (98) + ypos), 'Sound'); + end; +end; + +procedure Tform1.ShowLevel; +begin + ShapeLeft.Height := round(uos_InputGetLevelLeft(PlayerIndex1, In1Index) * 146); + ShapeRight.Height := round(uos_InputGetLevelRight(PlayerIndex1, In1Index) * 146); + ShapeLeft.top := 450 - ShapeLeft.Height; + ShapeRight.top := 450 - ShapeRight.Height; +end; + +procedure Tform1.LoopProcPlayer1; +begin + ShowLevel; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + Form1.Height := 260; + ShapeLeft.Height := 0; + ShapeRight.Height := 0; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + if (button3.Enabled = False) then + begin + button6.Click; + sleep(500); + end; + if button1.Enabled = False then + begin + if plugsoundtouch then uos_UnloadPlugin('soundtouch'); + uos_free(); + end; + BufferBMP.free; +end; + +end. + diff --git a/UOS/examples/mainmse_sp.mfm b/UOS/examples/mainmse_sp.mfm new file mode 100644 index 0000000..b78fd55 --- /dev/null +++ b/UOS/examples/mainmse_sp.mfm @@ -0,0 +1,721 @@ +object simple_player: tmainfo + color = 10734762 + bounds_x = 810 + bounds_y = 58 + bounds_cx = 481 + bounds_cy = 400 + container.optionswidget1 = [] + container.frame.localprops = [] + container.frame.localprops1 = [] + container.frame.sbhorz.width = 0 + container.frame.sbhorz.buttonminlength = 10 + container.frame.sbvert.width = 0 + container.frame.sbvert.buttonminlength = 10 + container.bounds = ( + 0 + 0 + 481 + 400 + ) + options = [fo_main, fo_terminateonclose, fo_screencentered, fo_autoreadstat, fo_autowritestat, fo_savepos, fo_savezorder, fo_savestate] + caption = 'Simple Player' + windowopacity = -Inf + onclose = closeit + moduleclassname = 'tmainform' + object btnload: tbutton + color = 15132390 + bounds_x = 8 + bounds_y = 368 + bounds_cx = 466 + bounds_cy = 21 + state = [as_localcaption, as_localcolor, as_localonexecute] + caption = 'Load that libraries' + onexecute = loadlibr + end + object padir: tfilenameeditx + frame.caption = 'Folder + filename of PortAudio library' + frame.localprops = [] + frame.localprops1 = [] + frame.buttons.count = 1 + frame.buttons.items = < + item + imagenr = 17 + end> + frame.button.imagenr = 17 + frame.outerframe = ( + 0 + 18 + 0 + 0 + ) + taborder = 2 + bounds_x = 8 + bounds_y = -2 + bounds_cx = 460 + bounds_cy = 39 + controller.fontheight = 0 + controller.fontname = 'stf_default' + controller.fontcolor = -1610612734 + controller.backcolor = -2147483647 + controller.nopanel = False + controller.compact = False + controller.showoptions = False + controller.hidehistory = False + controller.hideicons = False + controller.showhidden = False + controller.options = [fdo_sysfilename, fdo_savelastdir] + reffontheight = 15 + end + object sfdir: tfilenameeditx + frame.caption = 'Folder + filename of SndFile library' + frame.localprops = [] + frame.localprops1 = [] + frame.buttons.count = 1 + frame.buttons.items = < + item + imagenr = 17 + end> + frame.button.imagenr = 17 + frame.outerframe = ( + 0 + 18 + 0 + 0 + ) + taborder = 3 + bounds_x = 8 + bounds_y = 42 + bounds_cx = 460 + bounds_cy = 39 + controller.fontheight = 0 + controller.fontname = 'stf_default' + controller.fontcolor = -1610612734 + controller.backcolor = -2147483647 + controller.nopanel = False + controller.compact = False + controller.showoptions = False + controller.hidehistory = False + controller.hideicons = False + controller.showhidden = False + controller.options = [fdo_sysfilename, fdo_savelastdir] + reffontheight = 15 + end + object mpdir: tfilenameeditx + frame.caption = 'Folder + filename of Mpg123 library' + frame.localprops = [] + frame.localprops1 = [] + frame.buttons.count = 1 + frame.buttons.items = < + item + imagenr = 17 + end> + frame.button.imagenr = 17 + frame.outerframe = ( + 0 + 18 + 0 + 0 + ) + taborder = 4 + bounds_x = 8 + bounds_y = 82 + bounds_cx = 460 + bounds_cy = 39 + controller.fontheight = 0 + controller.fontname = 'stf_default' + controller.fontcolor = -1610612734 + controller.backcolor = -2147483647 + controller.nopanel = False + controller.compact = False + controller.showoptions = False + controller.hidehistory = False + controller.hideicons = False + controller.showhidden = False + controller.options = [fdo_sysfilename, fdo_savelastdir] + reffontheight = 15 + end + object m4dir: tfilenameeditx + frame.caption = 'Folder + filename of mp4ff library' + frame.localprops = [] + frame.localprops1 = [] + frame.buttons.count = 1 + frame.buttons.items = < + item + imagenr = 17 + end> + frame.button.imagenr = 17 + frame.outerframe = ( + 0 + 18 + 0 + 0 + ) + taborder = 5 + bounds_x = 8 + bounds_y = 122 + bounds_cx = 460 + bounds_cy = 39 + controller.fontheight = 0 + controller.fontname = 'stf_default' + controller.fontcolor = -1610612734 + controller.backcolor = -2147483647 + controller.nopanel = False + controller.compact = False + controller.showoptions = False + controller.hidehistory = False + controller.hideicons = False + controller.showhidden = False + controller.options = [fdo_sysfilename, fdo_savelastdir] + reffontheight = 15 + end + object fadir: tfilenameeditx + frame.caption = 'Folder + filename of faad2 library' + frame.localprops = [] + frame.localprops1 = [] + frame.buttons.count = 1 + frame.buttons.items = < + item + imagenr = 17 + end> + frame.button.imagenr = 17 + frame.outerframe = ( + 0 + 18 + 0 + 0 + ) + taborder = 6 + bounds_x = 8 + bounds_y = 162 + bounds_cx = 460 + bounds_cy = 39 + controller.fontheight = 0 + controller.fontname = 'stf_default' + controller.fontcolor = -1610612734 + controller.backcolor = -2147483647 + controller.nopanel = False + controller.compact = False + controller.showoptions = False + controller.hidehistory = False + controller.hideicons = False + controller.showhidden = False + controller.options = [fdo_sysfilename, fdo_savelastdir] + reffontheight = 15 + end + object ofdir: tfilenameeditx + frame.caption = 'Folder + filename of OpusFile library' + frame.localprops = [] + frame.localprops1 = [] + frame.buttons.count = 1 + frame.buttons.items = < + item + imagenr = 17 + end> + frame.button.imagenr = 17 + frame.outerframe = ( + 0 + 18 + 0 + 0 + ) + taborder = 7 + bounds_x = 8 + bounds_y = 202 + bounds_cx = 460 + bounds_cy = 39 + controller.fontheight = 0 + controller.fontname = 'stf_default' + controller.fontcolor = -1610612734 + controller.backcolor = -2147483647 + controller.nopanel = False + controller.compact = False + controller.showoptions = False + controller.hidehistory = False + controller.hideicons = False + controller.showhidden = False + controller.options = [fdo_sysfilename, fdo_savelastdir] + reffontheight = 15 + end + object panel1: tdockpanel + taborder = 1 + visible = False + bounds_x = -8 + bounds_y = 0 + bounds_cx = 490 + bounds_cy = 210 + object tlabel3: tlabel + bounds_x = 88 + bounds_y = 107 + bounds_cx = 32 + bounds_cy = 15 + caption = 'Right' + reffontheight = 15 + end + object tlabel2: tlabel + taborder = 1 + bounds_x = 8 + bounds_y = 107 + bounds_cx = 23 + bounds_cy = 15 + caption = 'Left' + reffontheight = 15 + end + object tlabel1: tlabel + taborder = 2 + bounds_x = 40 + bounds_y = 0 + bounds_cx = 45 + bounds_cy = 15 + caption = 'Volume' + reffontheight = 15 + end + object TrackBar2: tslider + color = 15132390 + frame.localprops = [frl_fileft, frl_fitop, frl_firight, frl_fibottom] + frame.localprops1 = [] + taborder = 3 + bounds_x = 8 + bounds_y = 18 + bounds_cx = 28 + bounds_cy = 88 + onchange = changevolume + value = 1 + scrollbar.buttonendlength = 11 + scrollbar.face.localprops = [] + direction = gd_up + end + object TrackBar3: tslider + color = 15132390 + frame.localprops = [frl_fileft, frl_fitop, frl_firight, frl_fibottom] + frame.localprops1 = [] + taborder = 4 + bounds_x = 88 + bounds_y = 18 + bounds_cx = 28 + bounds_cy = 88 + onchange = changevolume + value = 1 + scrollbar.buttonendlength = 11 + scrollbar.face.localprops = [] + direction = gd_up + end + object trackbar1: tslider + color = 15132390 + frame.localprops = [frl_fileft, frl_fitop, frl_firight, frl_fibottom] + frame.localprops1 = [] + taborder = 5 + bounds_x = 120 + bounds_y = 66 + bounds_cx = 356 + scrollbar.options = [sbo_moveauto, sbo_showauto, sbo_valuekeys] + scrollbar.buttonendlength = 11 + scrollbar.face.localprops = [] + onsetvalue = changepos + end + object checkbox1: tbooleanedit + frame.caption = 'Play Reverse' + frame.localprops = [] + frame.localprops1 = [] + frame.outerframe = ( + 0 + 2 + 78 + 2 + ) + taborder = 6 + bounds_x = 144 + bounds_y = 161 + bounds_cx = 91 + bounds_cy = 17 + onchange = changereverse + end + object btnstart: tbutton + color = 15132390 + taborder = 7 + bounds_x = 128 + bounds_y = 189 + bounds_cx = 82 + bounds_cy = 16 + state = [as_localcaption, as_localcolor, as_localonexecute] + caption = 'Play' + onexecute = playit + end + object btnresume: tbutton + color = 15132390 + taborder = 8 + bounds_x = 312 + bounds_y = 189 + bounds_cx = 74 + bounds_cy = 16 + state = [as_disabled, as_localdisabled, as_localcaption, as_localcolor, as_localonexecute] + caption = 'Resume' + onexecute = resumeit + end + object btnpause: tbutton + color = 15132390 + taborder = 9 + bounds_x = 224 + bounds_y = 189 + bounds_cx = 74 + bounds_cy = 16 + state = [as_disabled, as_localdisabled, as_localcaption, as_localcolor, as_localonexecute] + caption = 'Pause' + onexecute = pauseit + end + object button1: tbutton + color = 15132390 + taborder = 10 + bounds_x = 280 + bounds_y = 157 + bounds_cx = 50 + bounds_cy = 21 + state = [as_localcaption, as_localcolor, as_localonexecute] + caption = 'Reset' + onexecute = resetplugst + end + object label6: tlabel + taborder = 11 + bounds_x = 280 + bounds_y = 131 + bounds_cx = 69 + bounds_cy = 15 + caption = 'Tempo: 1.0' + reffontheight = 15 + end + object TrackBar4: tslider + color = 15132390 + frame.localprops = [frl_fileft, frl_fitop, frl_firight, frl_fibottom] + frame.localprops1 = [] + taborder = 12 + bounds_x = 352 + bounds_y = 130 + bounds_cx = 28 + bounds_cy = 56 + onchange = changetempo + value = 0.5 + scrollbar.buttonendlength = 11 + scrollbar.face.localprops = [] + direction = gd_down + end + object label7: tlabel + taborder = 13 + bounds_x = 384 + bounds_y = 131 + bounds_cx = 58 + bounds_cy = 15 + caption = 'Pitch: 1.0' + reffontheight = 15 + end + object TrackBar5: tslider + color = 15132390 + frame.localprops = [frl_fileft, frl_fitop, frl_firight, frl_fibottom] + frame.localprops1 = [] + taborder = 14 + bounds_x = 448 + bounds_y = 130 + bounds_cx = 28 + bounds_cy = 56 + onchange = changetempo + value = 0.5 + scrollbar.buttonendlength = 11 + scrollbar.face.localprops = [] + direction = gd_down + end + object btnstop: tbutton + color = 15132390 + taborder = 15 + bounds_x = 400 + bounds_y = 189 + bounds_cx = 74 + bounds_cy = 16 + state = [as_disabled, as_localdisabled, as_localcaption, as_localcolor, as_localonexecute] + caption = 'Stop' + onexecute = stopit + end + object tgroupbox1: tgroupbox + frame.caption = 'Sample Format' + frame.captiontextflags = [tf_bottom] + frame.localprops = [] + frame.localprops1 = [] + frame.outerframe = ( + 0 + 8 + 0 + 0 + ) + taborder = 16 + bounds_x = 8 + bounds_y = 128 + bounds_cx = 106 + bounds_cy = 66 + object radiobutton3: tbooleaneditradio + frame.caption = 'Int 16 bit' + frame.localprops = [] + frame.localprops1 = [] + frame.outerframe = ( + 0 + 2 + 60 + 2 + ) + bounds_x = 8 + bounds_y = 47 + bounds_cx = 73 + bounds_cy = 17 + end + object radiobutton2: tbooleaneditradio + frame.caption = 'Int 32 bit' + frame.localprops = [] + frame.localprops1 = [] + frame.outerframe = ( + 0 + 2 + 60 + 2 + ) + taborder = 1 + bounds_x = 8 + bounds_y = 31 + bounds_cx = 73 + bounds_cy = 17 + end + object radiobutton1: tbooleaneditradio + frame.caption = 'Float 32 bit' + frame.localprops = [] + frame.localprops1 = [] + frame.outerframe = ( + 0 + 2 + 72 + 2 + ) + taborder = 2 + bounds_x = 8 + bounds_y = 15 + bounds_cx = 85 + bounds_cy = 17 + value = True + end + end + object llength: tlabel + taborder = 17 + bounds_x = 300 + bounds_y = 92 + bounds_cx = 96 + bounds_cy = 15 + caption = ' / 00:00:00.000' + reffontheight = 15 + end + object lposition: tlabel + taborder = 18 + bounds_x = 216 + bounds_y = 92 + bounds_cx = 84 + bounds_cy = 15 + caption = '00:00:00.000' + reffontheight = 15 + end + object chkstereo2mono: tbooleanedit + frame.caption = 'Stereo to Mono' + frame.localprops = [] + frame.localprops1 = [] + frame.outerframe = ( + 0 + 2 + 94 + 2 + ) + taborder = 19 + bounds_x = 144 + bounds_y = 110 + bounds_cx = 107 + bounds_cy = 17 + onchange = ChangeStereo2Mono + end + object chkst2b: tbooleanedit + frame.caption = 'Stereo to Binaural' + frame.localprops = [] + frame.localprops1 = [] + frame.outerframe = ( + 0 + 2 + 111 + 2 + ) + taborder = 20 + bounds_x = 144 + bounds_y = 134 + bounds_cx = 124 + bounds_cy = 17 + onchange = ChangePlugSetbs2b + end + object checkbox2: tbooleanedit + frame.caption = 'Enable SoundTouch Plugin' + frame.localprops = [] + frame.localprops1 = [] + frame.outerframe = ( + 0 + 2 + 165 + 2 + ) + taborder = 21 + bounds_x = 280 + bounds_y = 110 + bounds_cx = 178 + bounds_cy = 17 + end + object vuRight: tdockpanel + color = 976914 + taborder = 23 + bounds_x = 66 + bounds_y = 24 + bounds_cx = 18 + bounds_cy = 82 + end + object vuLeft: tdockpanel + color = 976914 + taborder = 22 + bounds_x = 40 + bounds_y = 24 + bounds_cx = 18 + bounds_cy = 82 + end + object songdir: tfilenameeditx + frame.caption = 'File to play' + frame.localprops = [] + frame.localprops1 = [] + frame.buttons.count = 1 + frame.buttons.items = < + item + imagenr = 17 + end> + frame.button.imagenr = 17 + frame.outerframe = ( + 0 + 18 + 0 + 0 + ) + taborder = 24 + bounds_x = 120 + bounds_y = 11 + bounds_cx = 356 + bounds_cy = 39 + controller.fontheight = 0 + controller.fontname = 'stf_default' + controller.fontcolor = -1610612734 + controller.backcolor = -2147483647 + controller.nopanel = False + controller.compact = False + controller.showoptions = False + controller.hidehistory = False + controller.hideicons = False + controller.showhidden = False + controller.options = [fdo_sysfilename, fdo_savelastdir] + reffontheight = 15 + end + end + object xmdir: tfilenameeditx + frame.caption = 'Folder + filename of XMP library' + frame.localprops = [] + frame.localprops1 = [] + frame.buttons.count = 1 + frame.buttons.items = < + item + imagenr = 17 + end> + frame.button.imagenr = 17 + frame.outerframe = ( + 0 + 18 + 0 + 0 + ) + taborder = 8 + bounds_x = 8 + bounds_y = 242 + bounds_cx = 460 + bounds_cy = 39 + controller.fontheight = 0 + controller.fontname = 'stf_default' + controller.fontcolor = -1610612734 + controller.backcolor = -2147483647 + controller.nopanel = False + controller.compact = False + controller.showoptions = False + controller.hidehistory = False + controller.hideicons = False + controller.showhidden = False + controller.options = [fdo_sysfilename, fdo_savelastdir] + reffontheight = 15 + end + object stdir: tfilenameeditx + frame.caption = 'Folder + filename of SoundTouch Plugin library' + frame.localprops = [] + frame.localprops1 = [] + frame.buttons.count = 1 + frame.buttons.items = < + item + imagenr = 17 + end> + frame.button.imagenr = 17 + frame.outerframe = ( + 0 + 18 + 0 + 0 + ) + taborder = 9 + bounds_x = 8 + bounds_y = 282 + bounds_cx = 460 + bounds_cy = 39 + controller.fontheight = 0 + controller.fontname = 'stf_default' + controller.fontcolor = -1610612734 + controller.backcolor = -2147483647 + controller.nopanel = False + controller.compact = False + controller.showoptions = False + controller.hidehistory = False + controller.hideicons = False + controller.showhidden = False + controller.options = [fdo_sysfilename, fdo_savelastdir] + reffontheight = 15 + end + object bsdir: tfilenameeditx + frame.caption = 'Folder + filename of bs2b Plugin library' + frame.localprops = [] + frame.localprops1 = [] + frame.buttons.count = 1 + frame.buttons.items = < + item + imagenr = 17 + end> + frame.button.imagenr = 17 + frame.outerframe = ( + 0 + 18 + 0 + 0 + ) + taborder = 10 + bounds_x = 8 + bounds_y = 322 + bounds_cx = 460 + bounds_cy = 39 + controller.fontheight = 0 + controller.fontname = 'stf_default' + controller.fontcolor = -1610612734 + controller.backcolor = -2147483647 + controller.nopanel = False + controller.compact = False + controller.showoptions = False + controller.hidehistory = False + controller.hideicons = False + controller.showhidden = False + controller.options = [fdo_sysfilename, fdo_savelastdir] + reffontheight = 15 + end +end diff --git a/UOS/examples/mainmse_sp.pas b/UOS/examples/mainmse_sp.pas new file mode 100644 index 0000000..0ca5480 --- /dev/null +++ b/UOS/examples/mainmse_sp.pas @@ -0,0 +1,651 @@ +unit mainmse_sp; + +{$ifdef FPC}{$mode objfpc}{$h+}{$endif} +interface + +uses + uos_flat, + ctypes, + msetypes, + mseglob, + mseguiglob, + mseguiintf, + mseapplication, + msestat, + msemenus, + msegui, + msegraphics, + msegraphutils, + mseevent, + mseclasses, + msewidgets, + mseforms, + msesimplewidgets, + msedataedits, + mseedit, + mseificomp, + mseificompglob, + mseifiglob, + msestatfile, + msestream, + msestrings, + SysUtils, + msegraphedits, + msescrollbar, + msefileutils, + msemenuwidgets, + msegrids, + msewidgetgrid, + msebitmap, + msedatanodes, + mselistbrowser, + msesys, + msesignal, + msebarcode, + msedock, + msedragglob, + mseact, + msedropdownlist, + msegridsglob, + msefiledialogx; + +type + tmainfo = class(tmainform) + btnload: TButton; + panel1: tdockpanel; + tlabel3: tlabel; + tlabel2: tlabel; + tlabel1: tlabel; + TrackBar2: tslider; + TrackBar3: tslider; + trackbar1: tslider; + checkbox1: tbooleanedit; + btnstart: TButton; + btnresume: TButton; + btnpause: TButton; + button1: TButton; + label6: tlabel; + TrackBar4: tslider; + label7: tlabel; + TrackBar5: tslider; + btnstop: TButton; + tgroupbox1: tgroupbox; + radiobutton3: tbooleaneditradio; + radiobutton2: tbooleaneditradio; + radiobutton1: tbooleaneditradio; + llength: tlabel; + lposition: tlabel; + chkstereo2mono: tbooleanedit; + chkst2b: tbooleanedit; + checkbox2: tbooleanedit; + vuLeft: tdockpanel; + vuRight: tdockpanel; + padir: tfilenameeditx; + sfdir: tfilenameeditx; + mpdir: tfilenameeditx; + m4dir: tfilenameeditx; + fadir: tfilenameeditx; + ofdir: tfilenameeditx; + xmdir: tfilenameeditx; + stdir: tfilenameeditx; + bsdir: tfilenameeditx; + songdir: tfilenameeditx; + procedure loadlibr(const Sender: TObject); + procedure playit(const Sender: TObject); + procedure ClosePlayer1; + procedure LoopProcPlayer1; + procedure ShowPosition; + procedure ShowLevel; + procedure changereverse(const Sender: TObject); + procedure ChangeStereo2Mono(const Sender: TObject); + procedure ChangePlugSetSoundTouch(const Sender: TObject); + procedure ChangePlugSetbs2b(const Sender: TObject); + procedure ResetPlugClick(const Sender: TObject); + procedure changevolume(const Sender: TObject); + procedure changetempo(const Sender: TObject); + procedure pauseit(const Sender: TObject); + procedure resumeit(const Sender: TObject); + procedure stopit(const Sender: TObject); + procedure closeit(const Sender: TObject); + procedure resetplugst(const Sender: TObject); + procedure changepos(const Sender: TObject; var avalue: realty; var accept: Boolean); + end; + +var + mainfo: tmainfo; + PlayerIndex1: integer; + OutputIndex1, InputIndex1, DSPIndex1, DSPIndex2, PluginIndex1, PluginIndex2: integer; + inputlength: integer; + plugsoundtouch: Boolean = False; + plugbs2b: Boolean = False; + +implementation + +uses + mainmse_sp_mfm; + +function DSPStereo2Mono(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; +var + x: integer = 0; + ps: PDArShort; // if input is Int16 format + pl: PDArLong; // if input is Int32 format + pf: PDArFloat; // if input is Float32 format + samplef: cFloat; + samplei: integer; +begin + if (Data.channels = 2) then + begin + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + while x < Data.OutFrames - 1 do + begin + samplei := round((ps^[x] + ps^[x + 1]) / 2); + ps^[x] := samplei; + ps^[x + 1] := samplei; + x := x + 2; + end; + end; + + 1: + begin + pl := @Data.Buffer; + while x < Data.OutFrames - 1 do + begin + samplei := round((pl^[x] + pl^[x + 1]) / 2); + pl^[x] := samplei; + pl^[x + 1] := samplei; + x := x + 2; + end; + end; + + 0: + begin + pf := @Data.Buffer; + while x < Data.OutFrames - 1 do + begin + samplef := (pf^[x] + pf^[x + 1]) / 2; + pf^[x] := samplef; + pf^[x + 1] := samplef; + x := x + 2; + end; + end; + + end; + Result := Data.Buffer; + end + else + Result := Data.Buffer; +end; + +function DSPReverseBefore(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; +begin + + if (Data.position > Data.OutFrames div Data.channels) then + uos_InputSeek(PlayerIndex1, InputIndex1, Data.position - + (Length(Data.buffer) div 4)); +end; + +function DSPReverseAfter(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; +var + x: integer = 0; + arfl: TDArFloat; +begin + if (Data.position > Data.OutFrames div Data.channels) then + begin + SetLength(arfl, Data.outframes); + + while x < (Data.outframes) - 1 do + begin + arfl[x] := Data.Buffer[(Data.outframes) - x - 1]; + arfl[x + 1] := Data.Buffer[(Data.outframes) - x]; + x := x + 2; + end; + Result := arfl; + end + else + Result := Data.Buffer; +end; + + +procedure tmainfo.ChangePlugSetBs2b(const Sender: TObject); +begin + uos_SetPluginBs2b(PlayerIndex1, PluginIndex1, -1, -1, -1, chkst2b.Value); + application.ProcessMessages; +end; + +procedure tmainfo.Changestereo2mono(const Sender: TObject); +begin + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex2, chkstereo2mono.Value); + application.ProcessMessages; +end; + +procedure tmainfo.ChangePlugSetSoundTouch(const Sender: TObject); +var + tempo, rate: cfloat; +begin + if (trim(PChar(ansistring(stdir.Value))) <> '') and fileexists(ansistring(stdir.Value)) then + begin + + if 2 - (2 * (TrackBar4.Value)) < 0.3 then + tempo := 0.3 + else + tempo := 2 - (2 * (TrackBar4.Value)); + if 2 - (2 * (TrackBar5.Value)) < 0.3 then + rate := 0.3 + else + rate := 2 - (2 * (TrackBar5.Value)); + + label6.Caption := 'Tempo: ' + floattostrf(tempo, ffFixed, 15, 1); + label7.Caption := 'Pitch: ' + floattostrf(rate, ffFixed, 15, 1); + + if radiobutton1.Enabled = False then // player1 was created + uos_SetPluginSoundTouch(PlayerIndex1, PluginIndex2, tempo, rate, checkbox2.Value); + application.ProcessMessages; + end; +end; + +procedure tmainfo.ResetPlugClick(const Sender: TObject); +begin + TrackBar4.Value := 0.5; + TrackBar5.Value := 0.5; + uos_SetPluginSoundTouch(PlayerIndex1, PluginIndex2, 1, 1, checkbox2.Value); + application.ProcessMessages; +end; + + +procedure tmainfo.changereverse(const Sender: TObject); +begin + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex1, checkbox1.Value); +end; + +procedure tmainfo.ShowLevel; +begin + + vuLeft.Visible := True; + vuRight.Visible := True; + if round(uos_InputGetLevelLeft(PlayerIndex1, InputIndex1) * 82) >= 0 then + vuLeft.Height := round(uos_InputGetLevelLeft(PlayerIndex1, InputIndex1) * 82); + if round(uos_InputGetLevelRight(PlayerIndex1, InputIndex1) * 82) >= 0 then + vuRight.Height := round(uos_InputGetLevelRight(PlayerIndex1, InputIndex1) * 82); + vuLeft.top := 105 - vuLeft.Height; + vuRight.top := 105 - vuRight.Height; + +end; + +procedure tmainfo.ShowPosition; +var + temptime: ttime; + ho, mi, se, ms: word; +begin + + if (TrackBar1.Tag = 0) then + if uos_InputPosition(PlayerIndex1, InputIndex1) > 0 then + begin + if inputlength > 0 then + TrackBar1.Value := uos_InputPosition(PlayerIndex1, InputIndex1) / inputlength; + temptime := uos_InputPositionTime(PlayerIndex1, InputIndex1); + // Length of input in time + DecodeTime(temptime, ho, mi, se, ms); + lposition.Caption := format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); + end; + +end; + + +procedure tmainfo.LoopProcPlayer1; +begin + ShowPosition; + ShowLevel; +end; + + +procedure tmainfo.ClosePlayer1; +begin + radiobutton1.Enabled := True; + radiobutton2.Enabled := True; + radiobutton3.Enabled := True; + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + + btnStart.Enabled := True; + btnStop.Enabled := False; + btnPause.Enabled := False; + btnresume.Enabled := False; + trackbar1.Value := 0; + lposition.Caption := '00:00:00.000'; +end; + + +procedure tmainfo.loadlibr(const Sender: TObject); +var + loadok: Boolean = False; +begin + +{$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so + if (sfdir.Value <> 'system') and (sfdir.Value <> '') then + if uos_TestLoadLibrary(PChar(ansistring(sfdir.Value))) = false then + begin + sfdir.Value := sfdir.Value + '.2'; + uos_TestLoadLibrary(PChar(ansistring(sfdir.Value))); + end; +{$endif} + + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + + if uos_LoadLib(PChar(ansistring(padir.Value)), + PChar(ansistring(sfdir.Value)), + PChar(ansistring(mpdir.Value)), + PChar(ansistring(m4dir.Value)), + PChar(ansistring(fadir.Value)), + PChar(ansistring(ofdir.Value)), + PChar(ansistring(xmdir.Value))) = 0 then + begin + hide; + loadok := True; + Height := 210; + panel1.Height := Height; + panel1.Width := Width; + panel1.left := 0; + panel1.top := 0; + panel1.Visible := True; + + btnStart.Enabled := True; + btnLoad.Enabled := False; + + padir.Enabled := False; + sfdir.Enabled := False; + mpdir.Enabled := False; + m4dir.Enabled := False; + stdir.Enabled := False; + fadir.Enabled := False; + bsdir.Enabled := False; + ofdir.Enabled := False; + xmdir.Enabled := False; + + btnLoad.Caption := + 'PortAudio, SndFile, Mpg123, AAC, Opus, XMP libraries are loaded...'; + end + else + btnLoad.Caption := + 'One or more libraries did not load, check filenames...'; + + if loadok = True then + begin + if ((trim(PChar(ansistring(stdir.Value))) <> '') and fileexists(ansistring(stdir.Value))) then + if (uos_LoadPlugin('soundtouch', PChar(ansistring(stdir.Value))) = 0) then + begin + plugsoundtouch := True; + btnLoad.Caption := + 'PortAudio, SndFile, Mpg123, AAC, Opus, Xmp and Plugin are loaded...'; + end + else + begin + TrackBar4.Enabled := False; + TrackBar5.Enabled := False; + CheckBox2.Enabled := False; + Button1.Enabled := False; + label6.Enabled := False; + label7.Enabled := False; + end; + + if ((trim(PChar(ansistring(bsdir.Value))) <> '') and fileexists(ansistring(bsdir.Value))) then + if (uos_LoadPlugin('bs2b', PChar(ansistring(bsdir.Value))) = 0) then + plugbs2b := True + else + chkst2b.Enabled := False; + + Caption := 'Simple Player. uos Version ' + IntToStr(uos_getversion()); + + Show; + end; +end; + +procedure tmainfo.playit(const Sender: TObject); +var + samformat, libused, devused: shortint; + temptime: ttime; + ho, mi, se, ms: word; +begin + + if radiobutton1.Value = True then + samformat := 0 + else if radiobutton2.Value = True then + samformat := 1 + else if radiobutton3.Value = True then + samformat := 2; + + radiobutton1.Enabled := False; + radiobutton2.Enabled := False; + radiobutton3.Enabled := False; + + InputIndex1 := -1; + + PlayerIndex1 := 0; + // PlayerIndex : from 0 to what your computer can do ! (depends of ram, cpu, ...) + // If PlayerIndex exists already, it will be overwritten... + + if uos_CreatePlayer(PlayerIndex1) then + // Create the player. + // PlayerIndex : from 0 to what your computer can do ! + // If PlayerIndex exists already, it will be overwriten... + + InputIndex1 := uos_AddFromFile(PlayerIndex1, PChar(ansistring(songdir.Value)), -1, samformat, 8192 * 4); + + // 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 div channels) + // result : -1 nothing created, otherwise Input Index in array + + if InputIndex1 > -1 then + begin + + devused := -1; + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, devused, 0.3, + uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, -1, -1) + {$else} + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, devused, -1, + uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, 8192 * 4, -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) // here default samplerate of input + // 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) + // result : -1 nothing created, otherwise Output Index in array + + uos_InputSetLevelEnable(PlayerIndex1, InputIndex1, 2); + // set calculation of level/volume (usefull for showvolume procedure) + // set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + // 3 => calcul before and after all DSP procedures. + + uos_InputSetPositionEnable(PlayerIndex1, InputIndex1, 1); + // set calculation of position (usefull for positions procedure) + // set position calculation (default is 0) + // 0 => no calcul + // 1 => calcul position. + + uos_LoopProcIn(PlayerIndex1, InputIndex1, @LoopProcPlayer1); + // Assign the procedure of object to execute inside the loop + // PlayerIndex : Index of a existing Player + // InputIndex1 : Index of a existing Input + // LoopProcPlayer1 : procedure of object to execute inside the loop + + uos_InputAddDSPVolume(PlayerIndex1, InputIndex1, 1, 1); + // DSP Volume changer + // PlayerIndex1 : Index of a existing Player + // InputIndex1 : Index of a existing input + // VolLeft : Left volume + // VolRight : Right volume + + uos_InputSetDSPVolume(PlayerIndex1, InputIndex1, TrackBar2.Value, TrackBar3.Value, True); + // Set volume + // PlayerIndex1 : Index of a existing Player + // InputIndex1 : InputIndex of a existing Input + // VolLeft : Left volume + // VolRight : Right volume + // Enable : Enabled + + DSPIndex1 := uos_InputAddDSP(PlayerIndex1, InputIndex1, @DSPReverseBefore, @DSPReverseAfter, nil, nil); + // add a custom DSP procedure for input + // PlayerIndex1 : Index of a existing Player + // InputIndex1: InputIndex of existing input + // BeforeFunc : function to do before the buffer is filled + // AfterFunc : function to do after the buffer is filled + // EndedFunc : function to do at end of thread + // LoopProc : external procedure to do after the buffer is filled + + // set the parameters of custom DSP + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex1, checkbox1.Value); + + // This is a other custom DSP...stereo to mono to show how to do a DSP ;-) + // DSPIndex2 := uos_InputAddDSP(PlayerIndex1, InputIndex1, nil, @DSPStereo2Mono, nil, nil); + // uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex2, chkstereo2mono.value); + + // add bs2b plugin with samplerate_of_input1 / default channels (2 = stereo) + if plugbs2b = True then + begin + PlugInIndex1 := uos_AddPlugin(PlayerIndex1, 'bs2b', + uos_InputGetSampleRate(PlayerIndex1, InputIndex1), -1); + uos_SetPluginbs2b(PlayerIndex1, PluginIndex1, -1, -1, -1, chkst2b.Value); + end; + + // add SoundTouch plugin with samplerate of input1 / default channels (2 = stereo) + // SoundTouch plugin should be the last added. + if plugsoundtouch = True then + begin + PlugInIndex2 := uos_AddPlugin(PlayerIndex1, 'soundtouch', + uos_InputGetSampleRate(PlayerIndex1, InputIndex1), -1); + ChangePlugSetSoundTouch(self); // custom procedure to Change plugin settings + end; + + inputlength := uos_InputLength(PlayerIndex1, InputIndex1); + // Length of Input in samples + + if inputlength > 0 then // mod's cannot calculate length + begin + trackbar1.enabled := true; + temptime := uos_InputLengthTime(PlayerIndex1, InputIndex1); + // Length of input in time + + DecodeTime(temptime, ho, mi, se, ms); + + llength.Caption := ' / ' + format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); + end + else + begin + trackbar1.enabled := false; + llength.Caption := ' / ??:??:??.???'; + end; + + // procedure to execute when stream is terminated + 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 general loop + + TrackBar1.Value := 0; + CheckBox1.Enabled := True; + + btnStop.Enabled := True; + btnStart.Enabled := False; + btnpause.Enabled := True; + btnresume.Enabled := False; + + uos_Play(PlayerIndex1); // everything is ready, here we are, lets play it... + end; +end; + +procedure tmainfo.changevolume(const Sender: TObject); +begin + uos_InputSetDSPVolume(PlayerIndex1, InputIndex1, (TrackBar2.Value), (TrackBar3.Value), True); +end; + +procedure tmainfo.changetempo(const Sender: TObject); +begin + if (trim(PChar(stdir.Value)) <> '') and fileexists(stdir.Value) then + ChangePlugSetSoundTouch(Sender); +end; + +procedure tmainfo.pauseit(const Sender: TObject); +begin + uos_Pause(PlayerIndex1); + btnStop.Enabled := True; + btnPause.Enabled := False; + btnresume.Enabled := True; + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; +end; + +procedure tmainfo.resumeit(const Sender: TObject); +begin + uos_RePlay(PlayerIndex1); + btnStop.Enabled := True; + btnPause.Enabled := True; + btnresume.Enabled := False; +end; + +procedure tmainfo.stopit(const Sender: TObject); +begin + uos_Stop(PlayerIndex1); + btnStart.Enabled := True; + btnStop.Enabled := False; + btnResume.Enabled := False; + btnPause.Enabled := False; +end; + +procedure tmainfo.closeit(const Sender: TObject); +begin + if (btnstart.Enabled = False) then + begin + uos_stop(PlayerIndex1); + sleep(200); + application.ProcessMessages; + end; + if btnLoad.Enabled = False then + begin + uos_UnloadPlugin('soundtouch'); + uos_UnloadPlugin('bs2b'); + end; + uos_free(); // do not forget this... +end; + +procedure tmainfo.resetplugst(const Sender: TObject); +begin + TrackBar4.Value := 0.5; + TrackBar5.Value := 0.5; + uos_SetPluginSoundTouch(PlayerIndex1, PluginIndex2, 1, 1, checkbox2.Value); +end; + +procedure tmainfo.changepos(const Sender: TObject; var avalue: realty; var accept: Boolean); +begin + if inputlength > 0 then // mod's cannot calculate length + uos_InputSeek(PlayerIndex1, InputIndex1, round(avalue * inputlength)); +end; + + +end. + diff --git a/UOS/examples/mainmse_sp_mfm.pas b/UOS/examples/mainmse_sp_mfm.pas new file mode 100644 index 0000000..1f8beec --- /dev/null +++ b/UOS/examples/mainmse_sp_mfm.pas @@ -0,0 +1,599 @@ +unit mainmse_sp_mfm; +{$ifdef FPC}{$mode objfpc}{$h+}{$endif} + +interface + +implementation +uses + mseclasses,mainmse_sp; + +const + objdata: record size: integer; data: array[0..11635] of byte end = + (size: 11636; data: ( + 84,80,70,48,7,116,109,97,105,110,102,111,13,115,105,109,112,108,101,95, + 112,108,97,121,101,114,5,99,111,108,111,114,4,170,204,163,0,8,98,111, + 117,110,100,115,95,120,3,42,3,8,98,111,117,110,100,115,95,121,2,58, + 9,98,111,117,110,100,115,95,99,120,3,225,1,9,98,111,117,110,100,115, + 95,99,121,3,144,1,24,99,111,110,116,97,105,110,101,114,46,111,112,116, + 105,111,110,115,119,105,100,103,101,116,49,11,0,26,99,111,110,116,97,105, + 110,101,114,46,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115, + 11,0,27,99,111,110,116,97,105,110,101,114,46,102,114,97,109,101,46,108, + 111,99,97,108,112,114,111,112,115,49,11,0,28,99,111,110,116,97,105,110, + 101,114,46,102,114,97,109,101,46,115,98,104,111,114,122,46,119,105,100,116, + 104,2,0,38,99,111,110,116,97,105,110,101,114,46,102,114,97,109,101,46, + 115,98,104,111,114,122,46,98,117,116,116,111,110,109,105,110,108,101,110,103, + 116,104,2,10,28,99,111,110,116,97,105,110,101,114,46,102,114,97,109,101, + 46,115,98,118,101,114,116,46,119,105,100,116,104,2,0,38,99,111,110,116, + 97,105,110,101,114,46,102,114,97,109,101,46,115,98,118,101,114,116,46,98, + 117,116,116,111,110,109,105,110,108,101,110,103,116,104,2,10,16,99,111,110, + 116,97,105,110,101,114,46,98,111,117,110,100,115,1,2,0,2,0,3,225, + 1,3,144,1,0,7,111,112,116,105,111,110,115,11,7,102,111,95,109,97, + 105,110,19,102,111,95,116,101,114,109,105,110,97,116,101,111,110,99,108,111, + 115,101,17,102,111,95,115,99,114,101,101,110,99,101,110,116,101,114,101,100, + 15,102,111,95,97,117,116,111,114,101,97,100,115,116,97,116,16,102,111,95, + 97,117,116,111,119,114,105,116,101,115,116,97,116,10,102,111,95,115,97,118, + 101,112,111,115,13,102,111,95,115,97,118,101,122,111,114,100,101,114,12,102, + 111,95,115,97,118,101,115,116,97,116,101,0,7,99,97,112,116,105,111,110, + 6,13,83,105,109,112,108,101,32,80,108,97,121,101,114,13,119,105,110,100, + 111,119,111,112,97,99,105,116,121,5,0,0,0,0,0,0,0,128,255,255, + 7,111,110,99,108,111,115,101,7,7,99,108,111,115,101,105,116,15,109,111, + 100,117,108,101,99,108,97,115,115,110,97,109,101,6,9,116,109,97,105,110, + 102,111,114,109,0,7,116,98,117,116,116,111,110,7,98,116,110,108,111,97, + 100,5,99,111,108,111,114,4,230,230,230,0,8,98,111,117,110,100,115,95, + 120,2,8,8,98,111,117,110,100,115,95,121,3,112,1,9,98,111,117,110, + 100,115,95,99,120,3,210,1,9,98,111,117,110,100,115,95,99,121,2,21, + 5,115,116,97,116,101,11,15,97,115,95,108,111,99,97,108,99,97,112,116, + 105,111,110,13,97,115,95,108,111,99,97,108,99,111,108,111,114,17,97,115, + 95,108,111,99,97,108,111,110,101,120,101,99,117,116,101,0,7,99,97,112, + 116,105,111,110,6,19,76,111,97,100,32,116,104,97,116,32,108,105,98,114, + 97,114,105,101,115,9,111,110,101,120,101,99,117,116,101,7,8,108,111,97, + 100,108,105,98,114,0,0,14,116,102,105,108,101,110,97,109,101,101,100,105, + 116,120,5,112,97,100,105,114,13,102,114,97,109,101,46,99,97,112,116,105, + 111,110,6,38,70,111,108,100,101,114,32,43,32,102,105,108,101,110,97,109, + 101,32,111,102,32,80,111,114,116,65,117,100,105,111,32,108,105,98,114,97, + 114,121,16,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11, + 0,17,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11, + 0,19,102,114,97,109,101,46,98,117,116,116,111,110,115,46,99,111,117,110, + 116,2,1,19,102,114,97,109,101,46,98,117,116,116,111,110,115,46,105,116, + 101,109,115,14,1,7,105,109,97,103,101,110,114,2,17,0,0,20,102,114, + 97,109,101,46,98,117,116,116,111,110,46,105,109,97,103,101,110,114,2,17, + 16,102,114,97,109,101,46,111,117,116,101,114,102,114,97,109,101,1,2,0, + 2,18,2,0,2,0,0,8,116,97,98,111,114,100,101,114,2,2,8,98, + 111,117,110,100,115,95,120,2,8,8,98,111,117,110,100,115,95,121,2,254, + 9,98,111,117,110,100,115,95,99,120,3,204,1,9,98,111,117,110,100,115, + 95,99,121,2,39,21,99,111,110,116,114,111,108,108,101,114,46,102,111,110, + 116,104,101,105,103,104,116,2,0,19,99,111,110,116,114,111,108,108,101,114, + 46,102,111,110,116,110,97,109,101,6,11,115,116,102,95,100,101,102,97,117, + 108,116,20,99,111,110,116,114,111,108,108,101,114,46,102,111,110,116,99,111, + 108,111,114,4,2,0,0,160,20,99,111,110,116,114,111,108,108,101,114,46, + 98,97,99,107,99,111,108,111,114,4,1,0,0,128,18,99,111,110,116,114, + 111,108,108,101,114,46,110,111,112,97,110,101,108,8,18,99,111,110,116,114, + 111,108,108,101,114,46,99,111,109,112,97,99,116,8,22,99,111,110,116,114, + 111,108,108,101,114,46,115,104,111,119,111,112,116,105,111,110,115,8,22,99, + 111,110,116,114,111,108,108,101,114,46,104,105,100,101,104,105,115,116,111,114, + 121,8,20,99,111,110,116,114,111,108,108,101,114,46,104,105,100,101,105,99, + 111,110,115,8,21,99,111,110,116,114,111,108,108,101,114,46,115,104,111,119, + 104,105,100,100,101,110,8,18,99,111,110,116,114,111,108,108,101,114,46,111, + 112,116,105,111,110,115,11,15,102,100,111,95,115,121,115,102,105,108,101,110, + 97,109,101,15,102,100,111,95,115,97,118,101,108,97,115,116,100,105,114,0, + 13,114,101,102,102,111,110,116,104,101,105,103,104,116,2,15,0,0,14,116, + 102,105,108,101,110,97,109,101,101,100,105,116,120,5,115,102,100,105,114,13, + 102,114,97,109,101,46,99,97,112,116,105,111,110,6,36,70,111,108,100,101, + 114,32,43,32,102,105,108,101,110,97,109,101,32,111,102,32,83,110,100,70, + 105,108,101,32,108,105,98,114,97,114,121,16,102,114,97,109,101,46,108,111, + 99,97,108,112,114,111,112,115,11,0,17,102,114,97,109,101,46,108,111,99, + 97,108,112,114,111,112,115,49,11,0,19,102,114,97,109,101,46,98,117,116, + 116,111,110,115,46,99,111,117,110,116,2,1,19,102,114,97,109,101,46,98, + 117,116,116,111,110,115,46,105,116,101,109,115,14,1,7,105,109,97,103,101, + 110,114,2,17,0,0,20,102,114,97,109,101,46,98,117,116,116,111,110,46, + 105,109,97,103,101,110,114,2,17,16,102,114,97,109,101,46,111,117,116,101, + 114,102,114,97,109,101,1,2,0,2,18,2,0,2,0,0,8,116,97,98, + 111,114,100,101,114,2,3,8,98,111,117,110,100,115,95,120,2,8,8,98, + 111,117,110,100,115,95,121,2,42,9,98,111,117,110,100,115,95,99,120,3, + 204,1,9,98,111,117,110,100,115,95,99,121,2,39,21,99,111,110,116,114, + 111,108,108,101,114,46,102,111,110,116,104,101,105,103,104,116,2,0,19,99, + 111,110,116,114,111,108,108,101,114,46,102,111,110,116,110,97,109,101,6,11, + 115,116,102,95,100,101,102,97,117,108,116,20,99,111,110,116,114,111,108,108, + 101,114,46,102,111,110,116,99,111,108,111,114,4,2,0,0,160,20,99,111, + 110,116,114,111,108,108,101,114,46,98,97,99,107,99,111,108,111,114,4,1, + 0,0,128,18,99,111,110,116,114,111,108,108,101,114,46,110,111,112,97,110, + 101,108,8,18,99,111,110,116,114,111,108,108,101,114,46,99,111,109,112,97, + 99,116,8,22,99,111,110,116,114,111,108,108,101,114,46,115,104,111,119,111, + 112,116,105,111,110,115,8,22,99,111,110,116,114,111,108,108,101,114,46,104, + 105,100,101,104,105,115,116,111,114,121,8,20,99,111,110,116,114,111,108,108, + 101,114,46,104,105,100,101,105,99,111,110,115,8,21,99,111,110,116,114,111, + 108,108,101,114,46,115,104,111,119,104,105,100,100,101,110,8,18,99,111,110, + 116,114,111,108,108,101,114,46,111,112,116,105,111,110,115,11,15,102,100,111, + 95,115,121,115,102,105,108,101,110,97,109,101,15,102,100,111,95,115,97,118, + 101,108,97,115,116,100,105,114,0,13,114,101,102,102,111,110,116,104,101,105, + 103,104,116,2,15,0,0,14,116,102,105,108,101,110,97,109,101,101,100,105, + 116,120,5,109,112,100,105,114,13,102,114,97,109,101,46,99,97,112,116,105, + 111,110,6,35,70,111,108,100,101,114,32,43,32,102,105,108,101,110,97,109, + 101,32,111,102,32,77,112,103,49,50,51,32,108,105,98,114,97,114,121,16, + 102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,0,17,102, + 114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11,0,19,102, + 114,97,109,101,46,98,117,116,116,111,110,115,46,99,111,117,110,116,2,1, + 19,102,114,97,109,101,46,98,117,116,116,111,110,115,46,105,116,101,109,115, + 14,1,7,105,109,97,103,101,110,114,2,17,0,0,20,102,114,97,109,101, + 46,98,117,116,116,111,110,46,105,109,97,103,101,110,114,2,17,16,102,114, + 97,109,101,46,111,117,116,101,114,102,114,97,109,101,1,2,0,2,18,2, + 0,2,0,0,8,116,97,98,111,114,100,101,114,2,4,8,98,111,117,110, + 100,115,95,120,2,8,8,98,111,117,110,100,115,95,121,2,82,9,98,111, + 117,110,100,115,95,99,120,3,204,1,9,98,111,117,110,100,115,95,99,121, + 2,39,21,99,111,110,116,114,111,108,108,101,114,46,102,111,110,116,104,101, + 105,103,104,116,2,0,19,99,111,110,116,114,111,108,108,101,114,46,102,111, + 110,116,110,97,109,101,6,11,115,116,102,95,100,101,102,97,117,108,116,20, + 99,111,110,116,114,111,108,108,101,114,46,102,111,110,116,99,111,108,111,114, + 4,2,0,0,160,20,99,111,110,116,114,111,108,108,101,114,46,98,97,99, + 107,99,111,108,111,114,4,1,0,0,128,18,99,111,110,116,114,111,108,108, + 101,114,46,110,111,112,97,110,101,108,8,18,99,111,110,116,114,111,108,108, + 101,114,46,99,111,109,112,97,99,116,8,22,99,111,110,116,114,111,108,108, + 101,114,46,115,104,111,119,111,112,116,105,111,110,115,8,22,99,111,110,116, + 114,111,108,108,101,114,46,104,105,100,101,104,105,115,116,111,114,121,8,20, + 99,111,110,116,114,111,108,108,101,114,46,104,105,100,101,105,99,111,110,115, + 8,21,99,111,110,116,114,111,108,108,101,114,46,115,104,111,119,104,105,100, + 100,101,110,8,18,99,111,110,116,114,111,108,108,101,114,46,111,112,116,105, + 111,110,115,11,15,102,100,111,95,115,121,115,102,105,108,101,110,97,109,101, + 15,102,100,111,95,115,97,118,101,108,97,115,116,100,105,114,0,13,114,101, + 102,102,111,110,116,104,101,105,103,104,116,2,15,0,0,14,116,102,105,108, + 101,110,97,109,101,101,100,105,116,120,5,109,52,100,105,114,13,102,114,97, + 109,101,46,99,97,112,116,105,111,110,6,34,70,111,108,100,101,114,32,43, + 32,102,105,108,101,110,97,109,101,32,111,102,32,109,112,52,102,102,32,108, + 105,98,114,97,114,121,16,102,114,97,109,101,46,108,111,99,97,108,112,114, + 111,112,115,11,0,17,102,114,97,109,101,46,108,111,99,97,108,112,114,111, + 112,115,49,11,0,19,102,114,97,109,101,46,98,117,116,116,111,110,115,46, + 99,111,117,110,116,2,1,19,102,114,97,109,101,46,98,117,116,116,111,110, + 115,46,105,116,101,109,115,14,1,7,105,109,97,103,101,110,114,2,17,0, + 0,20,102,114,97,109,101,46,98,117,116,116,111,110,46,105,109,97,103,101, + 110,114,2,17,16,102,114,97,109,101,46,111,117,116,101,114,102,114,97,109, + 101,1,2,0,2,18,2,0,2,0,0,8,116,97,98,111,114,100,101,114, + 2,5,8,98,111,117,110,100,115,95,120,2,8,8,98,111,117,110,100,115, + 95,121,2,122,9,98,111,117,110,100,115,95,99,120,3,204,1,9,98,111, + 117,110,100,115,95,99,121,2,39,21,99,111,110,116,114,111,108,108,101,114, + 46,102,111,110,116,104,101,105,103,104,116,2,0,19,99,111,110,116,114,111, + 108,108,101,114,46,102,111,110,116,110,97,109,101,6,11,115,116,102,95,100, + 101,102,97,117,108,116,20,99,111,110,116,114,111,108,108,101,114,46,102,111, + 110,116,99,111,108,111,114,4,2,0,0,160,20,99,111,110,116,114,111,108, + 108,101,114,46,98,97,99,107,99,111,108,111,114,4,1,0,0,128,18,99, + 111,110,116,114,111,108,108,101,114,46,110,111,112,97,110,101,108,8,18,99, + 111,110,116,114,111,108,108,101,114,46,99,111,109,112,97,99,116,8,22,99, + 111,110,116,114,111,108,108,101,114,46,115,104,111,119,111,112,116,105,111,110, + 115,8,22,99,111,110,116,114,111,108,108,101,114,46,104,105,100,101,104,105, + 115,116,111,114,121,8,20,99,111,110,116,114,111,108,108,101,114,46,104,105, + 100,101,105,99,111,110,115,8,21,99,111,110,116,114,111,108,108,101,114,46, + 115,104,111,119,104,105,100,100,101,110,8,18,99,111,110,116,114,111,108,108, + 101,114,46,111,112,116,105,111,110,115,11,15,102,100,111,95,115,121,115,102, + 105,108,101,110,97,109,101,15,102,100,111,95,115,97,118,101,108,97,115,116, + 100,105,114,0,13,114,101,102,102,111,110,116,104,101,105,103,104,116,2,15, + 0,0,14,116,102,105,108,101,110,97,109,101,101,100,105,116,120,5,102,97, + 100,105,114,13,102,114,97,109,101,46,99,97,112,116,105,111,110,6,34,70, + 111,108,100,101,114,32,43,32,102,105,108,101,110,97,109,101,32,111,102,32, + 102,97,97,100,50,32,108,105,98,114,97,114,121,16,102,114,97,109,101,46, + 108,111,99,97,108,112,114,111,112,115,11,0,17,102,114,97,109,101,46,108, + 111,99,97,108,112,114,111,112,115,49,11,0,19,102,114,97,109,101,46,98, + 117,116,116,111,110,115,46,99,111,117,110,116,2,1,19,102,114,97,109,101, + 46,98,117,116,116,111,110,115,46,105,116,101,109,115,14,1,7,105,109,97, + 103,101,110,114,2,17,0,0,20,102,114,97,109,101,46,98,117,116,116,111, + 110,46,105,109,97,103,101,110,114,2,17,16,102,114,97,109,101,46,111,117, + 116,101,114,102,114,97,109,101,1,2,0,2,18,2,0,2,0,0,8,116, + 97,98,111,114,100,101,114,2,6,8,98,111,117,110,100,115,95,120,2,8, + 8,98,111,117,110,100,115,95,121,3,162,0,9,98,111,117,110,100,115,95, + 99,120,3,204,1,9,98,111,117,110,100,115,95,99,121,2,39,21,99,111, + 110,116,114,111,108,108,101,114,46,102,111,110,116,104,101,105,103,104,116,2, + 0,19,99,111,110,116,114,111,108,108,101,114,46,102,111,110,116,110,97,109, + 101,6,11,115,116,102,95,100,101,102,97,117,108,116,20,99,111,110,116,114, + 111,108,108,101,114,46,102,111,110,116,99,111,108,111,114,4,2,0,0,160, + 20,99,111,110,116,114,111,108,108,101,114,46,98,97,99,107,99,111,108,111, + 114,4,1,0,0,128,18,99,111,110,116,114,111,108,108,101,114,46,110,111, + 112,97,110,101,108,8,18,99,111,110,116,114,111,108,108,101,114,46,99,111, + 109,112,97,99,116,8,22,99,111,110,116,114,111,108,108,101,114,46,115,104, + 111,119,111,112,116,105,111,110,115,8,22,99,111,110,116,114,111,108,108,101, + 114,46,104,105,100,101,104,105,115,116,111,114,121,8,20,99,111,110,116,114, + 111,108,108,101,114,46,104,105,100,101,105,99,111,110,115,8,21,99,111,110, + 116,114,111,108,108,101,114,46,115,104,111,119,104,105,100,100,101,110,8,18, + 99,111,110,116,114,111,108,108,101,114,46,111,112,116,105,111,110,115,11,15, + 102,100,111,95,115,121,115,102,105,108,101,110,97,109,101,15,102,100,111,95, + 115,97,118,101,108,97,115,116,100,105,114,0,13,114,101,102,102,111,110,116, + 104,101,105,103,104,116,2,15,0,0,14,116,102,105,108,101,110,97,109,101, + 101,100,105,116,120,5,111,102,100,105,114,13,102,114,97,109,101,46,99,97, + 112,116,105,111,110,6,37,70,111,108,100,101,114,32,43,32,102,105,108,101, + 110,97,109,101,32,111,102,32,79,112,117,115,70,105,108,101,32,108,105,98, + 114,97,114,121,16,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112, + 115,11,0,17,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115, + 49,11,0,19,102,114,97,109,101,46,98,117,116,116,111,110,115,46,99,111, + 117,110,116,2,1,19,102,114,97,109,101,46,98,117,116,116,111,110,115,46, + 105,116,101,109,115,14,1,7,105,109,97,103,101,110,114,2,17,0,0,20, + 102,114,97,109,101,46,98,117,116,116,111,110,46,105,109,97,103,101,110,114, + 2,17,16,102,114,97,109,101,46,111,117,116,101,114,102,114,97,109,101,1, + 2,0,2,18,2,0,2,0,0,8,116,97,98,111,114,100,101,114,2,7, + 8,98,111,117,110,100,115,95,120,2,8,8,98,111,117,110,100,115,95,121, + 3,202,0,9,98,111,117,110,100,115,95,99,120,3,204,1,9,98,111,117, + 110,100,115,95,99,121,2,39,21,99,111,110,116,114,111,108,108,101,114,46, + 102,111,110,116,104,101,105,103,104,116,2,0,19,99,111,110,116,114,111,108, + 108,101,114,46,102,111,110,116,110,97,109,101,6,11,115,116,102,95,100,101, + 102,97,117,108,116,20,99,111,110,116,114,111,108,108,101,114,46,102,111,110, + 116,99,111,108,111,114,4,2,0,0,160,20,99,111,110,116,114,111,108,108, + 101,114,46,98,97,99,107,99,111,108,111,114,4,1,0,0,128,18,99,111, + 110,116,114,111,108,108,101,114,46,110,111,112,97,110,101,108,8,18,99,111, + 110,116,114,111,108,108,101,114,46,99,111,109,112,97,99,116,8,22,99,111, + 110,116,114,111,108,108,101,114,46,115,104,111,119,111,112,116,105,111,110,115, + 8,22,99,111,110,116,114,111,108,108,101,114,46,104,105,100,101,104,105,115, + 116,111,114,121,8,20,99,111,110,116,114,111,108,108,101,114,46,104,105,100, + 101,105,99,111,110,115,8,21,99,111,110,116,114,111,108,108,101,114,46,115, + 104,111,119,104,105,100,100,101,110,8,18,99,111,110,116,114,111,108,108,101, + 114,46,111,112,116,105,111,110,115,11,15,102,100,111,95,115,121,115,102,105, + 108,101,110,97,109,101,15,102,100,111,95,115,97,118,101,108,97,115,116,100, + 105,114,0,13,114,101,102,102,111,110,116,104,101,105,103,104,116,2,15,0, + 0,10,116,100,111,99,107,112,97,110,101,108,6,112,97,110,101,108,49,8, + 116,97,98,111,114,100,101,114,2,1,7,118,105,115,105,98,108,101,8,8, + 98,111,117,110,100,115,95,120,2,248,8,98,111,117,110,100,115,95,121,2, + 0,9,98,111,117,110,100,115,95,99,120,3,234,1,9,98,111,117,110,100, + 115,95,99,121,3,210,0,0,6,116,108,97,98,101,108,7,116,108,97,98, + 101,108,51,8,98,111,117,110,100,115,95,120,2,88,8,98,111,117,110,100, + 115,95,121,2,107,9,98,111,117,110,100,115,95,99,120,2,32,9,98,111, + 117,110,100,115,95,99,121,2,15,7,99,97,112,116,105,111,110,6,5,82, + 105,103,104,116,13,114,101,102,102,111,110,116,104,101,105,103,104,116,2,15, + 0,0,6,116,108,97,98,101,108,7,116,108,97,98,101,108,50,8,116,97, + 98,111,114,100,101,114,2,1,8,98,111,117,110,100,115,95,120,2,8,8, + 98,111,117,110,100,115,95,121,2,107,9,98,111,117,110,100,115,95,99,120, + 2,23,9,98,111,117,110,100,115,95,99,121,2,15,7,99,97,112,116,105, + 111,110,6,4,76,101,102,116,13,114,101,102,102,111,110,116,104,101,105,103, + 104,116,2,15,0,0,6,116,108,97,98,101,108,7,116,108,97,98,101,108, + 49,8,116,97,98,111,114,100,101,114,2,2,8,98,111,117,110,100,115,95, + 120,2,40,8,98,111,117,110,100,115,95,121,2,0,9,98,111,117,110,100, + 115,95,99,120,2,45,9,98,111,117,110,100,115,95,99,121,2,15,7,99, + 97,112,116,105,111,110,6,6,86,111,108,117,109,101,13,114,101,102,102,111, + 110,116,104,101,105,103,104,116,2,15,0,0,7,116,115,108,105,100,101,114, + 9,84,114,97,99,107,66,97,114,50,5,99,111,108,111,114,4,230,230,230, + 0,16,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,10, + 102,114,108,95,102,105,108,101,102,116,9,102,114,108,95,102,105,116,111,112, + 11,102,114,108,95,102,105,114,105,103,104,116,12,102,114,108,95,102,105,98, + 111,116,116,111,109,0,17,102,114,97,109,101,46,108,111,99,97,108,112,114, + 111,112,115,49,11,0,8,116,97,98,111,114,100,101,114,2,3,8,98,111, + 117,110,100,115,95,120,2,8,8,98,111,117,110,100,115,95,121,2,18,9, + 98,111,117,110,100,115,95,99,120,2,28,9,98,111,117,110,100,115,95,99, + 121,2,88,8,111,110,99,104,97,110,103,101,7,12,99,104,97,110,103,101, + 118,111,108,117,109,101,5,118,97,108,117,101,2,1,25,115,99,114,111,108, + 108,98,97,114,46,98,117,116,116,111,110,101,110,100,108,101,110,103,116,104, + 2,11,25,115,99,114,111,108,108,98,97,114,46,102,97,99,101,46,108,111, + 99,97,108,112,114,111,112,115,11,0,9,100,105,114,101,99,116,105,111,110, + 7,5,103,100,95,117,112,0,0,7,116,115,108,105,100,101,114,9,84,114, + 97,99,107,66,97,114,51,5,99,111,108,111,114,4,230,230,230,0,16,102, + 114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,10,102,114,108, + 95,102,105,108,101,102,116,9,102,114,108,95,102,105,116,111,112,11,102,114, + 108,95,102,105,114,105,103,104,116,12,102,114,108,95,102,105,98,111,116,116, + 111,109,0,17,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115, + 49,11,0,8,116,97,98,111,114,100,101,114,2,4,8,98,111,117,110,100, + 115,95,120,2,88,8,98,111,117,110,100,115,95,121,2,18,9,98,111,117, + 110,100,115,95,99,120,2,28,9,98,111,117,110,100,115,95,99,121,2,88, + 8,111,110,99,104,97,110,103,101,7,12,99,104,97,110,103,101,118,111,108, + 117,109,101,5,118,97,108,117,101,2,1,25,115,99,114,111,108,108,98,97, + 114,46,98,117,116,116,111,110,101,110,100,108,101,110,103,116,104,2,11,25, + 115,99,114,111,108,108,98,97,114,46,102,97,99,101,46,108,111,99,97,108, + 112,114,111,112,115,11,0,9,100,105,114,101,99,116,105,111,110,7,5,103, + 100,95,117,112,0,0,7,116,115,108,105,100,101,114,9,116,114,97,99,107, + 98,97,114,49,5,99,111,108,111,114,4,230,230,230,0,16,102,114,97,109, + 101,46,108,111,99,97,108,112,114,111,112,115,11,10,102,114,108,95,102,105, + 108,101,102,116,9,102,114,108,95,102,105,116,111,112,11,102,114,108,95,102, + 105,114,105,103,104,116,12,102,114,108,95,102,105,98,111,116,116,111,109,0, + 17,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11,0, + 8,116,97,98,111,114,100,101,114,2,5,8,98,111,117,110,100,115,95,120, + 2,120,8,98,111,117,110,100,115,95,121,2,66,9,98,111,117,110,100,115, + 95,99,120,3,100,1,17,115,99,114,111,108,108,98,97,114,46,111,112,116, + 105,111,110,115,11,12,115,98,111,95,109,111,118,101,97,117,116,111,12,115, + 98,111,95,115,104,111,119,97,117,116,111,13,115,98,111,95,118,97,108,117, + 101,107,101,121,115,0,25,115,99,114,111,108,108,98,97,114,46,98,117,116, + 116,111,110,101,110,100,108,101,110,103,116,104,2,11,25,115,99,114,111,108, + 108,98,97,114,46,102,97,99,101,46,108,111,99,97,108,112,114,111,112,115, + 11,0,10,111,110,115,101,116,118,97,108,117,101,7,9,99,104,97,110,103, + 101,112,111,115,0,0,12,116,98,111,111,108,101,97,110,101,100,105,116,9, + 99,104,101,99,107,98,111,120,49,13,102,114,97,109,101,46,99,97,112,116, + 105,111,110,6,12,80,108,97,121,32,82,101,118,101,114,115,101,16,102,114, + 97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,0,17,102,114,97, + 109,101,46,108,111,99,97,108,112,114,111,112,115,49,11,0,16,102,114,97, + 109,101,46,111,117,116,101,114,102,114,97,109,101,1,2,0,2,2,2,78, + 2,2,0,8,116,97,98,111,114,100,101,114,2,6,8,98,111,117,110,100, + 115,95,120,3,144,0,8,98,111,117,110,100,115,95,121,3,161,0,9,98, + 111,117,110,100,115,95,99,120,2,91,9,98,111,117,110,100,115,95,99,121, + 2,17,8,111,110,99,104,97,110,103,101,7,13,99,104,97,110,103,101,114, + 101,118,101,114,115,101,0,0,7,116,98,117,116,116,111,110,8,98,116,110, + 115,116,97,114,116,5,99,111,108,111,114,4,230,230,230,0,8,116,97,98, + 111,114,100,101,114,2,7,8,98,111,117,110,100,115,95,120,3,128,0,8, + 98,111,117,110,100,115,95,121,3,189,0,9,98,111,117,110,100,115,95,99, + 120,2,82,9,98,111,117,110,100,115,95,99,121,2,16,5,115,116,97,116, + 101,11,15,97,115,95,108,111,99,97,108,99,97,112,116,105,111,110,13,97, + 115,95,108,111,99,97,108,99,111,108,111,114,17,97,115,95,108,111,99,97, + 108,111,110,101,120,101,99,117,116,101,0,7,99,97,112,116,105,111,110,6, + 4,80,108,97,121,9,111,110,101,120,101,99,117,116,101,7,6,112,108,97, + 121,105,116,0,0,7,116,98,117,116,116,111,110,9,98,116,110,114,101,115, + 117,109,101,5,99,111,108,111,114,4,230,230,230,0,8,116,97,98,111,114, + 100,101,114,2,8,8,98,111,117,110,100,115,95,120,3,56,1,8,98,111, + 117,110,100,115,95,121,3,189,0,9,98,111,117,110,100,115,95,99,120,2, + 74,9,98,111,117,110,100,115,95,99,121,2,16,5,115,116,97,116,101,11, + 11,97,115,95,100,105,115,97,98,108,101,100,16,97,115,95,108,111,99,97, + 108,100,105,115,97,98,108,101,100,15,97,115,95,108,111,99,97,108,99,97, + 112,116,105,111,110,13,97,115,95,108,111,99,97,108,99,111,108,111,114,17, + 97,115,95,108,111,99,97,108,111,110,101,120,101,99,117,116,101,0,7,99, + 97,112,116,105,111,110,6,6,82,101,115,117,109,101,9,111,110,101,120,101, + 99,117,116,101,7,8,114,101,115,117,109,101,105,116,0,0,7,116,98,117, + 116,116,111,110,8,98,116,110,112,97,117,115,101,5,99,111,108,111,114,4, + 230,230,230,0,8,116,97,98,111,114,100,101,114,2,9,8,98,111,117,110, + 100,115,95,120,3,224,0,8,98,111,117,110,100,115,95,121,3,189,0,9, + 98,111,117,110,100,115,95,99,120,2,74,9,98,111,117,110,100,115,95,99, + 121,2,16,5,115,116,97,116,101,11,11,97,115,95,100,105,115,97,98,108, + 101,100,16,97,115,95,108,111,99,97,108,100,105,115,97,98,108,101,100,15, + 97,115,95,108,111,99,97,108,99,97,112,116,105,111,110,13,97,115,95,108, + 111,99,97,108,99,111,108,111,114,17,97,115,95,108,111,99,97,108,111,110, + 101,120,101,99,117,116,101,0,7,99,97,112,116,105,111,110,6,5,80,97, + 117,115,101,9,111,110,101,120,101,99,117,116,101,7,7,112,97,117,115,101, + 105,116,0,0,7,116,98,117,116,116,111,110,7,98,117,116,116,111,110,49, + 5,99,111,108,111,114,4,230,230,230,0,8,116,97,98,111,114,100,101,114, + 2,10,8,98,111,117,110,100,115,95,120,3,24,1,8,98,111,117,110,100, + 115,95,121,3,157,0,9,98,111,117,110,100,115,95,99,120,2,50,9,98, + 111,117,110,100,115,95,99,121,2,21,5,115,116,97,116,101,11,15,97,115, + 95,108,111,99,97,108,99,97,112,116,105,111,110,13,97,115,95,108,111,99, + 97,108,99,111,108,111,114,17,97,115,95,108,111,99,97,108,111,110,101,120, + 101,99,117,116,101,0,7,99,97,112,116,105,111,110,6,5,82,101,115,101, + 116,9,111,110,101,120,101,99,117,116,101,7,11,114,101,115,101,116,112,108, + 117,103,115,116,0,0,6,116,108,97,98,101,108,6,108,97,98,101,108,54, + 8,116,97,98,111,114,100,101,114,2,11,8,98,111,117,110,100,115,95,120, + 3,24,1,8,98,111,117,110,100,115,95,121,3,131,0,9,98,111,117,110, + 100,115,95,99,120,2,69,9,98,111,117,110,100,115,95,99,121,2,15,7, + 99,97,112,116,105,111,110,6,10,84,101,109,112,111,58,32,49,46,48,13, + 114,101,102,102,111,110,116,104,101,105,103,104,116,2,15,0,0,7,116,115, + 108,105,100,101,114,9,84,114,97,99,107,66,97,114,52,5,99,111,108,111, + 114,4,230,230,230,0,16,102,114,97,109,101,46,108,111,99,97,108,112,114, + 111,112,115,11,10,102,114,108,95,102,105,108,101,102,116,9,102,114,108,95, + 102,105,116,111,112,11,102,114,108,95,102,105,114,105,103,104,116,12,102,114, + 108,95,102,105,98,111,116,116,111,109,0,17,102,114,97,109,101,46,108,111, + 99,97,108,112,114,111,112,115,49,11,0,8,116,97,98,111,114,100,101,114, + 2,12,8,98,111,117,110,100,115,95,120,3,96,1,8,98,111,117,110,100, + 115,95,121,3,130,0,9,98,111,117,110,100,115,95,99,120,2,28,9,98, + 111,117,110,100,115,95,99,121,2,56,8,111,110,99,104,97,110,103,101,7, + 11,99,104,97,110,103,101,116,101,109,112,111,5,118,97,108,117,101,5,0, + 0,0,0,0,0,0,128,254,63,25,115,99,114,111,108,108,98,97,114,46, + 98,117,116,116,111,110,101,110,100,108,101,110,103,116,104,2,11,25,115,99, + 114,111,108,108,98,97,114,46,102,97,99,101,46,108,111,99,97,108,112,114, + 111,112,115,11,0,9,100,105,114,101,99,116,105,111,110,7,7,103,100,95, + 100,111,119,110,0,0,6,116,108,97,98,101,108,6,108,97,98,101,108,55, + 8,116,97,98,111,114,100,101,114,2,13,8,98,111,117,110,100,115,95,120, + 3,128,1,8,98,111,117,110,100,115,95,121,3,131,0,9,98,111,117,110, + 100,115,95,99,120,2,58,9,98,111,117,110,100,115,95,99,121,2,15,7, + 99,97,112,116,105,111,110,6,10,80,105,116,99,104,58,32,49,46,48,13, + 114,101,102,102,111,110,116,104,101,105,103,104,116,2,15,0,0,7,116,115, + 108,105,100,101,114,9,84,114,97,99,107,66,97,114,53,5,99,111,108,111, + 114,4,230,230,230,0,16,102,114,97,109,101,46,108,111,99,97,108,112,114, + 111,112,115,11,10,102,114,108,95,102,105,108,101,102,116,9,102,114,108,95, + 102,105,116,111,112,11,102,114,108,95,102,105,114,105,103,104,116,12,102,114, + 108,95,102,105,98,111,116,116,111,109,0,17,102,114,97,109,101,46,108,111, + 99,97,108,112,114,111,112,115,49,11,0,8,116,97,98,111,114,100,101,114, + 2,14,8,98,111,117,110,100,115,95,120,3,192,1,8,98,111,117,110,100, + 115,95,121,3,130,0,9,98,111,117,110,100,115,95,99,120,2,28,9,98, + 111,117,110,100,115,95,99,121,2,56,8,111,110,99,104,97,110,103,101,7, + 11,99,104,97,110,103,101,116,101,109,112,111,5,118,97,108,117,101,5,0, + 0,0,0,0,0,0,128,254,63,25,115,99,114,111,108,108,98,97,114,46, + 98,117,116,116,111,110,101,110,100,108,101,110,103,116,104,2,11,25,115,99, + 114,111,108,108,98,97,114,46,102,97,99,101,46,108,111,99,97,108,112,114, + 111,112,115,11,0,9,100,105,114,101,99,116,105,111,110,7,7,103,100,95, + 100,111,119,110,0,0,7,116,98,117,116,116,111,110,7,98,116,110,115,116, + 111,112,5,99,111,108,111,114,4,230,230,230,0,8,116,97,98,111,114,100, + 101,114,2,15,8,98,111,117,110,100,115,95,120,3,144,1,8,98,111,117, + 110,100,115,95,121,3,189,0,9,98,111,117,110,100,115,95,99,120,2,74, + 9,98,111,117,110,100,115,95,99,121,2,16,5,115,116,97,116,101,11,11, + 97,115,95,100,105,115,97,98,108,101,100,16,97,115,95,108,111,99,97,108, + 100,105,115,97,98,108,101,100,15,97,115,95,108,111,99,97,108,99,97,112, + 116,105,111,110,13,97,115,95,108,111,99,97,108,99,111,108,111,114,17,97, + 115,95,108,111,99,97,108,111,110,101,120,101,99,117,116,101,0,7,99,97, + 112,116,105,111,110,6,4,83,116,111,112,9,111,110,101,120,101,99,117,116, + 101,7,6,115,116,111,112,105,116,0,0,9,116,103,114,111,117,112,98,111, + 120,10,116,103,114,111,117,112,98,111,120,49,13,102,114,97,109,101,46,99, + 97,112,116,105,111,110,6,13,83,97,109,112,108,101,32,70,111,114,109,97, + 116,22,102,114,97,109,101,46,99,97,112,116,105,111,110,116,101,120,116,102, + 108,97,103,115,11,9,116,102,95,98,111,116,116,111,109,0,16,102,114,97, + 109,101,46,108,111,99,97,108,112,114,111,112,115,11,0,17,102,114,97,109, + 101,46,108,111,99,97,108,112,114,111,112,115,49,11,0,16,102,114,97,109, + 101,46,111,117,116,101,114,102,114,97,109,101,1,2,0,2,8,2,0,2, + 0,0,8,116,97,98,111,114,100,101,114,2,16,8,98,111,117,110,100,115, + 95,120,2,8,8,98,111,117,110,100,115,95,121,3,128,0,9,98,111,117, + 110,100,115,95,99,120,2,106,9,98,111,117,110,100,115,95,99,121,2,66, + 0,17,116,98,111,111,108,101,97,110,101,100,105,116,114,97,100,105,111,12, + 114,97,100,105,111,98,117,116,116,111,110,51,13,102,114,97,109,101,46,99, + 97,112,116,105,111,110,6,10,73,110,116,32,49,54,32,98,105,116,16,102, + 114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,0,17,102,114, + 97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11,0,16,102,114, + 97,109,101,46,111,117,116,101,114,102,114,97,109,101,1,2,0,2,2,2, + 60,2,2,0,8,98,111,117,110,100,115,95,120,2,8,8,98,111,117,110, + 100,115,95,121,2,47,9,98,111,117,110,100,115,95,99,120,2,73,9,98, + 111,117,110,100,115,95,99,121,2,17,0,0,17,116,98,111,111,108,101,97, + 110,101,100,105,116,114,97,100,105,111,12,114,97,100,105,111,98,117,116,116, + 111,110,50,13,102,114,97,109,101,46,99,97,112,116,105,111,110,6,10,73, + 110,116,32,51,50,32,98,105,116,16,102,114,97,109,101,46,108,111,99,97, + 108,112,114,111,112,115,11,0,17,102,114,97,109,101,46,108,111,99,97,108, + 112,114,111,112,115,49,11,0,16,102,114,97,109,101,46,111,117,116,101,114, + 102,114,97,109,101,1,2,0,2,2,2,60,2,2,0,8,116,97,98,111, + 114,100,101,114,2,1,8,98,111,117,110,100,115,95,120,2,8,8,98,111, + 117,110,100,115,95,121,2,31,9,98,111,117,110,100,115,95,99,120,2,73, + 9,98,111,117,110,100,115,95,99,121,2,17,0,0,17,116,98,111,111,108, + 101,97,110,101,100,105,116,114,97,100,105,111,12,114,97,100,105,111,98,117, + 116,116,111,110,49,13,102,114,97,109,101,46,99,97,112,116,105,111,110,6, + 12,70,108,111,97,116,32,51,50,32,98,105,116,16,102,114,97,109,101,46, + 108,111,99,97,108,112,114,111,112,115,11,0,17,102,114,97,109,101,46,108, + 111,99,97,108,112,114,111,112,115,49,11,0,16,102,114,97,109,101,46,111, + 117,116,101,114,102,114,97,109,101,1,2,0,2,2,2,72,2,2,0,8, + 116,97,98,111,114,100,101,114,2,2,8,98,111,117,110,100,115,95,120,2, + 8,8,98,111,117,110,100,115,95,121,2,15,9,98,111,117,110,100,115,95, + 99,120,2,85,9,98,111,117,110,100,115,95,99,121,2,17,5,118,97,108, + 117,101,9,0,0,0,6,116,108,97,98,101,108,7,108,108,101,110,103,116, + 104,8,116,97,98,111,114,100,101,114,2,17,8,98,111,117,110,100,115,95, + 120,3,44,1,8,98,111,117,110,100,115,95,121,2,92,9,98,111,117,110, + 100,115,95,99,120,2,96,9,98,111,117,110,100,115,95,99,121,2,15,7, + 99,97,112,116,105,111,110,6,15,32,47,32,48,48,58,48,48,58,48,48, + 46,48,48,48,13,114,101,102,102,111,110,116,104,101,105,103,104,116,2,15, + 0,0,6,116,108,97,98,101,108,9,108,112,111,115,105,116,105,111,110,8, + 116,97,98,111,114,100,101,114,2,18,8,98,111,117,110,100,115,95,120,3, + 216,0,8,98,111,117,110,100,115,95,121,2,92,9,98,111,117,110,100,115, + 95,99,120,2,84,9,98,111,117,110,100,115,95,99,121,2,15,7,99,97, + 112,116,105,111,110,6,12,48,48,58,48,48,58,48,48,46,48,48,48,13, + 114,101,102,102,111,110,116,104,101,105,103,104,116,2,15,0,0,12,116,98, + 111,111,108,101,97,110,101,100,105,116,14,99,104,107,115,116,101,114,101,111, + 50,109,111,110,111,13,102,114,97,109,101,46,99,97,112,116,105,111,110,6, + 14,83,116,101,114,101,111,32,116,111,32,77,111,110,111,16,102,114,97,109, + 101,46,108,111,99,97,108,112,114,111,112,115,11,0,17,102,114,97,109,101, + 46,108,111,99,97,108,112,114,111,112,115,49,11,0,16,102,114,97,109,101, + 46,111,117,116,101,114,102,114,97,109,101,1,2,0,2,2,2,94,2,2, + 0,8,116,97,98,111,114,100,101,114,2,19,8,98,111,117,110,100,115,95, + 120,3,144,0,8,98,111,117,110,100,115,95,121,2,110,9,98,111,117,110, + 100,115,95,99,120,2,107,9,98,111,117,110,100,115,95,99,121,2,17,8, + 111,110,99,104,97,110,103,101,7,17,67,104,97,110,103,101,83,116,101,114, + 101,111,50,77,111,110,111,0,0,12,116,98,111,111,108,101,97,110,101,100, + 105,116,7,99,104,107,115,116,50,98,13,102,114,97,109,101,46,99,97,112, + 116,105,111,110,6,18,83,116,101,114,101,111,32,116,111,32,66,105,110,97, + 117,114,97,108,16,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112, + 115,11,0,17,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115, + 49,11,0,16,102,114,97,109,101,46,111,117,116,101,114,102,114,97,109,101, + 1,2,0,2,2,2,111,2,2,0,8,116,97,98,111,114,100,101,114,2, + 20,8,98,111,117,110,100,115,95,120,3,144,0,8,98,111,117,110,100,115, + 95,121,3,134,0,9,98,111,117,110,100,115,95,99,120,2,124,9,98,111, + 117,110,100,115,95,99,121,2,17,8,111,110,99,104,97,110,103,101,7,17, + 67,104,97,110,103,101,80,108,117,103,83,101,116,98,115,50,98,0,0,12, + 116,98,111,111,108,101,97,110,101,100,105,116,9,99,104,101,99,107,98,111, + 120,50,13,102,114,97,109,101,46,99,97,112,116,105,111,110,6,24,69,110, + 97,98,108,101,32,83,111,117,110,100,84,111,117,99,104,32,80,108,117,103, + 105,110,16,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11, + 0,17,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11, + 0,16,102,114,97,109,101,46,111,117,116,101,114,102,114,97,109,101,1,2, + 0,2,2,3,165,0,2,2,0,8,116,97,98,111,114,100,101,114,2,21, + 8,98,111,117,110,100,115,95,120,3,24,1,8,98,111,117,110,100,115,95, + 121,2,110,9,98,111,117,110,100,115,95,99,120,3,178,0,9,98,111,117, + 110,100,115,95,99,121,2,17,0,0,10,116,100,111,99,107,112,97,110,101, + 108,7,118,117,82,105,103,104,116,5,99,111,108,111,114,4,18,232,14,0, + 8,116,97,98,111,114,100,101,114,2,23,8,98,111,117,110,100,115,95,120, + 2,66,8,98,111,117,110,100,115,95,121,2,24,9,98,111,117,110,100,115, + 95,99,120,2,18,9,98,111,117,110,100,115,95,99,121,2,82,0,0,10, + 116,100,111,99,107,112,97,110,101,108,6,118,117,76,101,102,116,5,99,111, + 108,111,114,4,18,232,14,0,8,116,97,98,111,114,100,101,114,2,22,8, + 98,111,117,110,100,115,95,120,2,40,8,98,111,117,110,100,115,95,121,2, + 24,9,98,111,117,110,100,115,95,99,120,2,18,9,98,111,117,110,100,115, + 95,99,121,2,82,0,0,14,116,102,105,108,101,110,97,109,101,101,100,105, + 116,120,7,115,111,110,103,100,105,114,13,102,114,97,109,101,46,99,97,112, + 116,105,111,110,6,12,70,105,108,101,32,116,111,32,112,108,97,121,16,102, + 114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,0,17,102,114, + 97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11,0,19,102,114, + 97,109,101,46,98,117,116,116,111,110,115,46,99,111,117,110,116,2,1,19, + 102,114,97,109,101,46,98,117,116,116,111,110,115,46,105,116,101,109,115,14, + 1,7,105,109,97,103,101,110,114,2,17,0,0,20,102,114,97,109,101,46, + 98,117,116,116,111,110,46,105,109,97,103,101,110,114,2,17,16,102,114,97, + 109,101,46,111,117,116,101,114,102,114,97,109,101,1,2,0,2,18,2,0, + 2,0,0,8,116,97,98,111,114,100,101,114,2,24,8,98,111,117,110,100, + 115,95,120,2,120,8,98,111,117,110,100,115,95,121,2,11,9,98,111,117, + 110,100,115,95,99,120,3,100,1,9,98,111,117,110,100,115,95,99,121,2, + 39,21,99,111,110,116,114,111,108,108,101,114,46,102,111,110,116,104,101,105, + 103,104,116,2,0,19,99,111,110,116,114,111,108,108,101,114,46,102,111,110, + 116,110,97,109,101,6,11,115,116,102,95,100,101,102,97,117,108,116,20,99, + 111,110,116,114,111,108,108,101,114,46,102,111,110,116,99,111,108,111,114,4, + 2,0,0,160,20,99,111,110,116,114,111,108,108,101,114,46,98,97,99,107, + 99,111,108,111,114,4,1,0,0,128,18,99,111,110,116,114,111,108,108,101, + 114,46,110,111,112,97,110,101,108,8,18,99,111,110,116,114,111,108,108,101, + 114,46,99,111,109,112,97,99,116,8,22,99,111,110,116,114,111,108,108,101, + 114,46,115,104,111,119,111,112,116,105,111,110,115,8,22,99,111,110,116,114, + 111,108,108,101,114,46,104,105,100,101,104,105,115,116,111,114,121,8,20,99, + 111,110,116,114,111,108,108,101,114,46,104,105,100,101,105,99,111,110,115,8, + 21,99,111,110,116,114,111,108,108,101,114,46,115,104,111,119,104,105,100,100, + 101,110,8,18,99,111,110,116,114,111,108,108,101,114,46,111,112,116,105,111, + 110,115,11,15,102,100,111,95,115,121,115,102,105,108,101,110,97,109,101,15, + 102,100,111,95,115,97,118,101,108,97,115,116,100,105,114,0,13,114,101,102, + 102,111,110,116,104,101,105,103,104,116,2,15,0,0,0,14,116,102,105,108, + 101,110,97,109,101,101,100,105,116,120,5,120,109,100,105,114,13,102,114,97, + 109,101,46,99,97,112,116,105,111,110,6,32,70,111,108,100,101,114,32,43, + 32,102,105,108,101,110,97,109,101,32,111,102,32,88,77,80,32,108,105,98, + 114,97,114,121,16,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112, + 115,11,0,17,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115, + 49,11,0,19,102,114,97,109,101,46,98,117,116,116,111,110,115,46,99,111, + 117,110,116,2,1,19,102,114,97,109,101,46,98,117,116,116,111,110,115,46, + 105,116,101,109,115,14,1,7,105,109,97,103,101,110,114,2,17,0,0,20, + 102,114,97,109,101,46,98,117,116,116,111,110,46,105,109,97,103,101,110,114, + 2,17,16,102,114,97,109,101,46,111,117,116,101,114,102,114,97,109,101,1, + 2,0,2,18,2,0,2,0,0,8,116,97,98,111,114,100,101,114,2,8, + 8,98,111,117,110,100,115,95,120,2,8,8,98,111,117,110,100,115,95,121, + 3,242,0,9,98,111,117,110,100,115,95,99,120,3,204,1,9,98,111,117, + 110,100,115,95,99,121,2,39,21,99,111,110,116,114,111,108,108,101,114,46, + 102,111,110,116,104,101,105,103,104,116,2,0,19,99,111,110,116,114,111,108, + 108,101,114,46,102,111,110,116,110,97,109,101,6,11,115,116,102,95,100,101, + 102,97,117,108,116,20,99,111,110,116,114,111,108,108,101,114,46,102,111,110, + 116,99,111,108,111,114,4,2,0,0,160,20,99,111,110,116,114,111,108,108, + 101,114,46,98,97,99,107,99,111,108,111,114,4,1,0,0,128,18,99,111, + 110,116,114,111,108,108,101,114,46,110,111,112,97,110,101,108,8,18,99,111, + 110,116,114,111,108,108,101,114,46,99,111,109,112,97,99,116,8,22,99,111, + 110,116,114,111,108,108,101,114,46,115,104,111,119,111,112,116,105,111,110,115, + 8,22,99,111,110,116,114,111,108,108,101,114,46,104,105,100,101,104,105,115, + 116,111,114,121,8,20,99,111,110,116,114,111,108,108,101,114,46,104,105,100, + 101,105,99,111,110,115,8,21,99,111,110,116,114,111,108,108,101,114,46,115, + 104,111,119,104,105,100,100,101,110,8,18,99,111,110,116,114,111,108,108,101, + 114,46,111,112,116,105,111,110,115,11,15,102,100,111,95,115,121,115,102,105, + 108,101,110,97,109,101,15,102,100,111,95,115,97,118,101,108,97,115,116,100, + 105,114,0,13,114,101,102,102,111,110,116,104,101,105,103,104,116,2,15,0, + 0,14,116,102,105,108,101,110,97,109,101,101,100,105,116,120,5,115,116,100, + 105,114,13,102,114,97,109,101,46,99,97,112,116,105,111,110,6,46,70,111, + 108,100,101,114,32,43,32,102,105,108,101,110,97,109,101,32,111,102,32,83, + 111,117,110,100,84,111,117,99,104,32,80,108,117,103,105,110,32,108,105,98, + 114,97,114,121,16,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112, + 115,11,0,17,102,114,97,109,101,46,108,111,99,97,108,112,114,111,112,115, + 49,11,0,19,102,114,97,109,101,46,98,117,116,116,111,110,115,46,99,111, + 117,110,116,2,1,19,102,114,97,109,101,46,98,117,116,116,111,110,115,46, + 105,116,101,109,115,14,1,7,105,109,97,103,101,110,114,2,17,0,0,20, + 102,114,97,109,101,46,98,117,116,116,111,110,46,105,109,97,103,101,110,114, + 2,17,16,102,114,97,109,101,46,111,117,116,101,114,102,114,97,109,101,1, + 2,0,2,18,2,0,2,0,0,8,116,97,98,111,114,100,101,114,2,9, + 8,98,111,117,110,100,115,95,120,2,8,8,98,111,117,110,100,115,95,121, + 3,26,1,9,98,111,117,110,100,115,95,99,120,3,204,1,9,98,111,117, + 110,100,115,95,99,121,2,39,21,99,111,110,116,114,111,108,108,101,114,46, + 102,111,110,116,104,101,105,103,104,116,2,0,19,99,111,110,116,114,111,108, + 108,101,114,46,102,111,110,116,110,97,109,101,6,11,115,116,102,95,100,101, + 102,97,117,108,116,20,99,111,110,116,114,111,108,108,101,114,46,102,111,110, + 116,99,111,108,111,114,4,2,0,0,160,20,99,111,110,116,114,111,108,108, + 101,114,46,98,97,99,107,99,111,108,111,114,4,1,0,0,128,18,99,111, + 110,116,114,111,108,108,101,114,46,110,111,112,97,110,101,108,8,18,99,111, + 110,116,114,111,108,108,101,114,46,99,111,109,112,97,99,116,8,22,99,111, + 110,116,114,111,108,108,101,114,46,115,104,111,119,111,112,116,105,111,110,115, + 8,22,99,111,110,116,114,111,108,108,101,114,46,104,105,100,101,104,105,115, + 116,111,114,121,8,20,99,111,110,116,114,111,108,108,101,114,46,104,105,100, + 101,105,99,111,110,115,8,21,99,111,110,116,114,111,108,108,101,114,46,115, + 104,111,119,104,105,100,100,101,110,8,18,99,111,110,116,114,111,108,108,101, + 114,46,111,112,116,105,111,110,115,11,15,102,100,111,95,115,121,115,102,105, + 108,101,110,97,109,101,15,102,100,111,95,115,97,118,101,108,97,115,116,100, + 105,114,0,13,114,101,102,102,111,110,116,104,101,105,103,104,116,2,15,0, + 0,14,116,102,105,108,101,110,97,109,101,101,100,105,116,120,5,98,115,100, + 105,114,13,102,114,97,109,101,46,99,97,112,116,105,111,110,6,40,70,111, + 108,100,101,114,32,43,32,102,105,108,101,110,97,109,101,32,111,102,32,98, + 115,50,98,32,80,108,117,103,105,110,32,108,105,98,114,97,114,121,16,102, + 114,97,109,101,46,108,111,99,97,108,112,114,111,112,115,11,0,17,102,114, + 97,109,101,46,108,111,99,97,108,112,114,111,112,115,49,11,0,19,102,114, + 97,109,101,46,98,117,116,116,111,110,115,46,99,111,117,110,116,2,1,19, + 102,114,97,109,101,46,98,117,116,116,111,110,115,46,105,116,101,109,115,14, + 1,7,105,109,97,103,101,110,114,2,17,0,0,20,102,114,97,109,101,46, + 98,117,116,116,111,110,46,105,109,97,103,101,110,114,2,17,16,102,114,97, + 109,101,46,111,117,116,101,114,102,114,97,109,101,1,2,0,2,18,2,0, + 2,0,0,8,116,97,98,111,114,100,101,114,2,10,8,98,111,117,110,100, + 115,95,120,2,8,8,98,111,117,110,100,115,95,121,3,66,1,9,98,111, + 117,110,100,115,95,99,120,3,204,1,9,98,111,117,110,100,115,95,99,121, + 2,39,21,99,111,110,116,114,111,108,108,101,114,46,102,111,110,116,104,101, + 105,103,104,116,2,0,19,99,111,110,116,114,111,108,108,101,114,46,102,111, + 110,116,110,97,109,101,6,11,115,116,102,95,100,101,102,97,117,108,116,20, + 99,111,110,116,114,111,108,108,101,114,46,102,111,110,116,99,111,108,111,114, + 4,2,0,0,160,20,99,111,110,116,114,111,108,108,101,114,46,98,97,99, + 107,99,111,108,111,114,4,1,0,0,128,18,99,111,110,116,114,111,108,108, + 101,114,46,110,111,112,97,110,101,108,8,18,99,111,110,116,114,111,108,108, + 101,114,46,99,111,109,112,97,99,116,8,22,99,111,110,116,114,111,108,108, + 101,114,46,115,104,111,119,111,112,116,105,111,110,115,8,22,99,111,110,116, + 114,111,108,108,101,114,46,104,105,100,101,104,105,115,116,111,114,121,8,20, + 99,111,110,116,114,111,108,108,101,114,46,104,105,100,101,105,99,111,110,115, + 8,21,99,111,110,116,114,111,108,108,101,114,46,115,104,111,119,104,105,100, + 100,101,110,8,18,99,111,110,116,114,111,108,108,101,114,46,111,112,116,105, + 111,110,115,11,15,102,100,111,95,115,121,115,102,105,108,101,110,97,109,101, + 15,102,100,111,95,115,97,118,101,108,97,115,116,100,105,114,0,13,114,101, + 102,102,111,110,116,104,101,105,103,104,116,2,15,0,0,0) + ); + +initialization + registerobjectdata(@objdata,tmainfo,''); +end. diff --git a/UOS/examples/morseTL.lpi b/UOS/examples/morseTL.lpi new file mode 100644 index 0000000..f06d99d --- /dev/null +++ b/UOS/examples/morseTL.lpi @@ -0,0 +1,177 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="12"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <CompatibilityMode Value="True"/> + </Flags> + <Title Value="Morse Translator"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <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="3"> + <Unit0> + <Filename Value="morseTL.lpr"/> + <IsPartOfProject Value="True"/> + <CursorPos X="33" Y="9"/> + <UsageCount Value="30"/> + </Unit0> + <Unit1> + <Filename Value="main_mt.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <TopLine Value="124"/> + <CursorPos X="15" Y="146"/> + <UsageCount Value="30"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit1> + <Unit2> + <Filename Value="uos.pas"/> + <EditorIndex Value="1"/> + <TopLine Value="86"/> + <CursorPos X="27" Y="94"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit2> + </Units> + <JumpHistory Count="15" HistoryIndex="14"> + <Position1> + <Filename Value="uos.pas"/> + <Caret Line="3" Column="3"/> + </Position1> + <Position2> + <Filename Value="uos.pas"/> + <Caret Line="104" Column="20" TopLine="92"/> + </Position2> + <Position3> + <Filename Value="uos.pas"/> + <Caret Line="105" Column="23" TopLine="92"/> + </Position3> + <Position4> + <Filename Value="uos.pas"/> + <Caret Line="106" Column="23" TopLine="92"/> + </Position4> + <Position5> + <Filename Value="uos.pas"/> + <Caret Line="541" Column="20" TopLine="516"/> + </Position5> + <Position6> + <Filename Value="uos.pas"/> + <Caret Line="544" Column="23" TopLine="519"/> + </Position6> + <Position7> + <Filename Value="uos.pas"/> + <Caret Line="547" Column="23" TopLine="522"/> + </Position7> + <Position8> + <Filename Value="uos.pas"/> + <Caret Line="7" Column="107"/> + </Position8> + <Position9> + <Filename Value="uos.pas"/> + <Caret Line="117" Column="28" TopLine="102"/> + </Position9> + <Position10> + <Filename Value="uos.pas"/> + <Caret Line="3711" Column="18" TopLine="3699"/> + </Position10> + <Position11> + <Filename Value="uos.pas"/> + <Caret Line="3730" Column="24" TopLine="3719"/> + </Position11> + <Position12> + <Filename Value="uos.pas"/> + <Caret Line="3814" Column="23" TopLine="3802"/> + </Position12> + <Position13> + <Filename Value="uos.pas"/> + <Caret Line="3940" Column="26" TopLine="3927"/> + </Position13> + <Position14> + <Filename Value="main_mt.pas"/> + <Caret Line="5" Column="29"/> + </Position14> + <Position15> + <Filename Value="main_mt.pas"/> + <Caret Line="9" Column="20"/> + </Position15> + </JumpHistory> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="Morse_Transator"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="units"/> + </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"/> + </Other> + </CompilerOptions> + <Debugging> + <Watches Count="2"> + <Item1> + <Expression Value="key"/> + </Item1> + <Item2> + <Expression Value="i"/> + </Item2> + </Watches> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/UOS/examples/morseTL.lpr b/UOS/examples/morseTL.lpr new file mode 100644 index 0000000..b5bc2d0 --- /dev/null +++ b/UOS/examples/morseTL.lpr @@ -0,0 +1,19 @@ +program body; + +{$mode objfpc}{$H+} +{$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + cthreads, + cwstring, {$ENDIF} {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, main_mt, uos; + +begin + + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + \ No newline at end of file diff --git a/UOS/examples/morseTL_fpGUI.lpi b/UOS/examples/morseTL_fpGUI.lpi new file mode 100644 index 0000000..ee1707d --- /dev/null +++ b/UOS/examples/morseTL_fpGUI.lpi @@ -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="Morse Translator"/> + <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="morseTL_fpGUI.pas"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="Morse_Translator_fpGUI"/> + </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> diff --git a/UOS/examples/morseTL_fpGUI.pas b/UOS/examples/morseTL_fpGUI.pas new file mode 100644 index 0000000..0afe9c1 --- /dev/null +++ b/UOS/examples/morseTL_fpGUI.pas @@ -0,0 +1,335 @@ +program morseTL_fpGUI; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} + cthreads, + cwstring, {$ENDIF} + fpg_stylemanager, + fpg_style_chrome_silver_flatmenu, + SysUtils, + Classes, + fpg_base, + fpg_main, + fpg_form, + fpg_button, + fpg_label, + fpg_edit, + fpg_memo, + uos_flat; + +type + + Tform1 = class(TfpgForm) + private + {@VFD_HEAD_BEGIN: form1} + Label1: TfpgLabel; + TimerCount: TfpgTimer; + Memo1: TfpgMemo; + interchar: TfpgEdit; + interspace: TfpgEdit; + Label2: TfpgLabel; + Label3: TfpgLabel; + Button1: TfpgButton; + Button2: TfpgButton; + {@VFD_HEAD_END: form1} + public + procedure AfterCreate; override; + procedure CreateMorsePlayer(); + procedure PlayClick(Sender: TObject); + procedure QuitClick(Sender: TObject); + procedure onTimerCount(Sender: TObject); + + end; + + {@VFD_NEWFORM_DECL} + + {@VFD_NEWFORM_IMPL} + +var + i: cardinal; + ordir: string; + // AParent: TObject; + + + procedure TForm1.CreateMorsePlayer(); + var + filetoplay, fileeror: string; + chara: string; + player: cardinal; + begin + if i <= length(Memo1.Text) then + begin + Button1.Enabled := False; + TimerCount.Enabled := False; + chara := copy(Memo1.Text, i, 1); + + fileeror := PChar(ordir + 'sound' + directoryseparator + 'morse_audio' + directoryseparator + '0.mp3'); + + if odd(i) then + player := 0 + else + player := 1; ///// to switch between player1 <> player2 + + if chara <> ' ' then + begin + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + uos_CreatePlayer(player); + {$else} + uos_CreatePlayer(player,AParent); + {$endif} + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + uos_AddIntoDevOut(player, -1, 0.08, -1, -1, -1, -1, -1) ; + {$else} + uos_AddIntoDevOut(player); + {$endif} + + filetoplay := ordir + 'sound' + directoryseparator + 'morse_audio' + directoryseparator + lowercase(chara) + '.mp3'; + + if fileexists(PChar(filetoplay)) then + uos_AddFromFile(player, PChar(filetoplay)) + else + uos_AddFromFile(player, PChar(fileeror)); /// if not existing char + if length(Memo1.Text) > i then + uos_EndProc(player, @CreateMorsePlayer) + else + begin + Button1.Enabled := True; + TimerCount.Enabled := False; + end; + sleep(StrToInt(interchar.Text)); ///// the pause between each character + Inc(i); + + uos_Play(player); + TimerCount.Enabled := True; + end + else + begin + sleep(StrToInt(interspace.Text)); ///// the pause if space character + Inc(i); + if length(Memo1.Text) >= i then + CreateMorsePlayer; + end; + + end; + + end; + + + procedure TForm1.PlayClick(Sender: TObject); + begin + if Memo1.Text <> '' then + begin + i := 1; + CreateMorsePlayer(); + end; + end; + + procedure TForm1.onTimerCount(Sender: TObject); + begin + fpgapplication.ProcessMessages; + end; + + + procedure TForm1.QuitClick(Sender: TObject); + begin + TimerCount.Enabled := False; + Close; + end; + + procedure Tform1.AfterCreate; + var + PA_FileName, MP_FileName: string; + begin + {%region 'Auto-generated GUI code' -fold} + + {@VFD_BODY_BEGIN: form1} + Name := 'form1'; + SetPosition(294, 118, 502, 321); + WindowTitle := 'Morse Translator'; + Hint := ''; + + Label1 := TfpgLabel.Create(self); + with Label1 do + begin + Name := 'Label1'; + SetPosition(104, 20, 288, 27); + Alignment := taCenter; + FontDesc := '#Label2'; + Hint := ''; + Text := 'Write something here :'; + end; + + Memo1 := TfpgMemo.Create(self); + with Memo1 do + begin + Name := 'Memo1'; + SetPosition(40, 44, 432, 165); + FontDesc := '#Edit1'; + Hint := ''; + TabOrder := 2; + end; + + interchar := TfpgEdit.Create(self); + with interchar do + begin + Name := 'interchar'; + SetPosition(96, 236, 76, 24); + ExtraHint := ''; + FontDesc := '#Edit1'; + Hint := ''; + TabOrder := 3; + Text := '250'; + end; + + interspace := TfpgEdit.Create(self); + with interspace do + begin + Name := 'interspace'; + SetPosition(296, 236, 68, 24); + ExtraHint := ''; + FontDesc := '#Edit1'; + Hint := ''; + TabOrder := 4; + Text := '1500'; + end; + + Label2 := TfpgLabel.Create(self); + with Label2 do + begin + Name := 'Label2'; + SetPosition(56, 216, 172, 15); + FontDesc := '#Label1'; + Hint := ''; + Text := 'Pause inter char in msec'; + end; + + Label3 := TfpgLabel.Create(self); + with Label3 do + begin + Name := 'Label3'; + SetPosition(244, 216, 216, 15); + FontDesc := '#Label1'; + Hint := ''; + Text := 'Pause for space char in msec'; + end; + + Button1 := TfpgButton.Create(self); + with Button1 do + begin + Name := 'Button1'; + SetPosition(80, 276, 128, 27); + Text := 'Translate it'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 7; + onclick := @PlayClick; + end; + + Button2 := TfpgButton.Create(self); + with Button2 do + begin + Name := 'Button2'; + SetPosition(340, 276, 80, 23); + Text := 'Close'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 8; + OnClick := @QuitClick; + end; + + {@VFD_BODY_END: form1} + {%endregion} + memo1.Text := ''; + ordir := IncludeTrailingBackslash(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} + + {$IFDEF linux} + {$if defined(cpu64)} + PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + MP_FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + {$else} + PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + MP_FileName := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; + {$endif} + {$ENDIF} + + {$if defined(cpu64) and defined(linux) } + PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + MP_FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + {$ENDIF} + + {$if defined(cpu64) and defined(openbsd) } + PA_FileName := ordir + 'lib/OpenBSD/64bit/LibPortaudio-64.so'; + MP_FileName := ordir + 'lib/OpenBSD/64bit/LibMpg123-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} + + {$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} + + uos_LoadLib(PChar(PA_FileName), nil, PChar(MP_FileName), nil, nil, nil, nil); + + TimerCount := Tfpgtimer.Create(100); + TimerCount.Enabled := False; + timerCount.OnTimer := @ontimercount; + + end; + + procedure MainProc; + var + frm: Tform1; + begin + fpgApplication.Initialize; + if fpgStyleManager.SetStyle('Chrome silver flat menu') then + fpgStyle := fpgStyleManager.Style; + fpgApplication.CreateForm(Tform1, frm); + try + frm.Show; + frm.UpdateWindowPosition; + fpgApplication.Run; + finally + uos_free; + frm.Free; + end; + end; + +begin + MainProc; +end. + diff --git a/UOS/examples/morseTL_fpGUI.prj b/UOS/examples/morseTL_fpGUI.prj new file mode 100644 index 0000000..9c30ce3 --- /dev/null +++ b/UOS/examples/morseTL_fpGUI.prj @@ -0,0 +1,1403 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/morseTL_fpGUI.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=morseTL_fpGUI.pas +targetfile=morseTL_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/morseTL_fpGUI.pas +relpaths=1 + morseTL_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/morseTL_fpGUI.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/multiinput.lpi b/UOS/examples/multiinput.lpi new file mode 100644 index 0000000..ad5e4d6 --- /dev/null +++ b/UOS/examples/multiinput.lpi @@ -0,0 +1,419 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <General> + <Flags> + <SaveJumpHistory Value="False"/> + <SaveFoldState Value="False"/> + </Flags> + <MainUnit Value="0"/> + <Title Value="MultiInput"/> + <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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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="34"> + <Unit0> + <Filename Value="multiinput.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="3"/> + <CursorPos X="29" Y="14"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main_mi.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <TopLine Value="520"/> + <CursorPos X="48" Y="533"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit1> + <Unit2> + <Filename Value="lazdyn_portaudio.pas"/> + <UnitName Value="LazDyn_PortAudio"/> + <TopLine Value="110"/> + <CursorPos X="16" Y="117"/> + <UsageCount Value="100"/> + </Unit2> + <Unit3> + <Filename Value="Lazdyn_SoundTouch.pas"/> + <UnitName Value="SoundTouchDLL"/> + <CursorPos X="59" Y="12"/> + <UsageCount Value="4"/> + </Unit3> + <Unit4> + <Filename Value="u_os.pas"/> + <UnitName Value="U_OS"/> + <TopLine Value="445"/> + <CursorPos X="10" Y="402"/> + <UsageCount Value="89"/> + </Unit4> + <Unit5> + <Filename Value="../firstprognew/mainmixxl.pas"/> + <TopLine Value="4347"/> + <CursorPos X="9" Y="4364"/> + <UsageCount Value="8"/> + </Unit5> + <Unit6> + <Filename Value="../dynmpg123/waveutils.pas"/> + <UnitName Value="WaveUtils"/> + <TopLine Value="3"/> + <CursorPos X="45" Y="43"/> + <UsageCount Value="4"/> + </Unit6> + <Unit7> + <Filename Value="kPGtest.pas"/> + <UnitName Value="PlayMP3"/> + <TopLine Value="111"/> + <CursorPos X="32" Y="128"/> + <UsageCount Value="6"/> + </Unit7> + <Unit8> + <Filename Value="kPGtestSF.pas"/> + <UnitName Value="PlayWAV"/> + <TopLine Value="27"/> + <CursorPos X="29" Y="32"/> + <UsageCount Value="6"/> + </Unit8> + <Unit9> + <Filename Value="lazdyn_mpg123.pas"/> + <TopLine Value="1060"/> + <CursorPos Y="1072"/> + <UsageCount Value="100"/> + </Unit9> + <Unit10> + <Filename Value="../OpenC2Pas/src/main.pas"/> + <TopLine Value="193"/> + <CursorPos Y="232"/> + <UsageCount Value="3"/> + </Unit10> + <Unit11> + <Filename Value="lazdyn_libsndfile.pas"/> + <TopLine Value="62"/> + <CursorPos Y="540"/> + <UsageCount Value="100"/> + </Unit11> + <Unit12> + <Filename Value="../U_OS_Test (copie)/u_os.pas"/> + <UnitName Value="U_OS"/> + <TopLine Value="72"/> + <CursorPos X="34" Y="236"/> + <UsageCount Value="9"/> + </Unit12> + <Unit13> + <Filename Value="PA_SF_MP.pas"/> + <TopLine Value="77"/> + <CursorPos X="20" Y="10"/> + <UsageCount Value="1"/> + </Unit13> + <Unit14> + <Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/objpas/sysutils/sysstrh.inc"/> + <TopLine Value="100"/> + <CursorPos X="10" Y="112"/> + <UsageCount Value="4"/> + </Unit14> + <Unit15> + <Filename Value="../lazarus64/examples/multithreading/mainunit.pas"/> + <UnitName Value="MainUnit"/> + <TopLine Value="70"/> + <UsageCount Value="4"/> + </Unit15> + <Unit16> + <Filename Value="../lazarus64/examples/pascalstream/componentstreampas.pas"/> + <UnitName Value="ComponentStreamPas"/> + <TopLine Value="33"/> + <UsageCount Value="7"/> + </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="6"/> + </Unit17> + <Unit18> + <Filename Value="/media/Windows7/dynsndfile/libsndfilestrings.pas"/> + <UsageCount Value="4"/> + </Unit18> + <Unit19> + <Filename Value="/media/Windows7/dynsndfile/lazdyn_libsndfile.pas"/> + <UsageCount Value="4"/> + </Unit19> + <Unit20> + <Filename Value="../logouos/unit1.pas"/> + <UnitName Value="Unit1"/> + <TopLine Value="67"/> + <CursorPos X="51" Y="83"/> + <UsageCount Value="4"/> + </Unit20> + <Unit21> + <Filename Value="/usr/lib/codetyphon/lazarus/lcl/graphics.pp"/> + <UnitName Value="Graphics"/> + <TopLine Value="1168"/> + <CursorPos X="49" Y="1181"/> + <UsageCount Value="6"/> + </Unit21> + <Unit22> + <Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/objpas/objpas.pp"/> + <TopLine Value="119"/> + <CursorPos X="8" Y="28"/> + <UsageCount Value="4"/> + </Unit22> + <Unit23> + <Filename Value="uos.pas"/> + <EditorIndex Value="4"/> + <TopLine Value="4754"/> + <CursorPos X="4" Y="4789"/> + <UsageCount Value="100"/> + <Loaded Value="True"/> + </Unit23> + <Unit24> + <Filename Value="uos_new.pas"/> + <TopLine Value="310"/> + <CursorPos X="29" Y="478"/> + <UsageCount Value="88"/> + </Unit24> + <Unit25> + <Filename Value="../firstprognew/bass.pas"/> + <TopLine Value="810"/> + <UsageCount Value="3"/> + </Unit25> + <Unit26> + <Filename Value="../onenamevar/unit1.pas"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit1"/> + <TopLine Value="81"/> + <CursorPos X="44" Y="100"/> + <UsageCount Value="6"/> + </Unit26> + <Unit27> + <Filename Value="/usr/lib/codetyphon/lazarus/packager/registration/fcllaz.pas"/> + <CursorPos Y="4"/> + <UsageCount Value="10"/> + </Unit27> + <Unit28> + <Filename Value="main_sp.pas"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <CursorPos X="61" Y="12"/> + <UsageCount Value="18"/> + <Loaded Value="True"/> + </Unit28> + <Unit29> + <Filename Value="../lazarus32/packager/registration/fcllaz.pas"/> + <UsageCount Value="10"/> + </Unit29> + <Unit30> + <Filename Value="/usr/lib/codetyphon/lazarus/lcl/controls.pp"/> + <UnitName Value="Controls"/> + <TopLine Value="33"/> + <CursorPos X="36" Y="44"/> + <UsageCount Value="10"/> + </Unit30> + <Unit31> + <Filename Value="multiplayer_fpGUI.lpr"/> + <TopLine Value="513"/> + <CursorPos X="85" Y="530"/> + <UsageCount Value="10"/> + </Unit31> + <Unit32> + <Filename Value="uos_flat.pas"/> + <EditorIndex Value="5"/> + <TopLine Value="852"/> + <CursorPos X="68" Y="866"/> + <UsageCount Value="17"/> + <Loaded Value="True"/> + </Unit32> + <Unit33> + <Filename Value="simpleplayer_fpGUI.pas"/> + <EditorIndex Value="2"/> + <TopLine Value="217"/> + <CursorPos X="46" Y="234"/> + <UsageCount Value="16"/> + <Loaded Value="True"/> + </Unit33> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="MultiInput"/> + </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> diff --git a/UOS/examples/multiinput.lpr b/UOS/examples/multiinput.lpr new file mode 100644 index 0000000..2702c1f --- /dev/null +++ b/UOS/examples/multiinput.lpr @@ -0,0 +1,22 @@ +program multiinput; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + cthreads, + cwstring, {$ENDIF} {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, + main_mi { you can add units after this }; + + +begin + Application.Title := 'MultiInput'; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + + diff --git a/UOS/examples/multiinput.prj b/UOS/examples/multiinput.prj new file mode 100644 index 0000000..56b2cfb --- /dev/null +++ b/UOS/examples/multiinput.prj @@ -0,0 +1,1376 @@ +[componentpalette] +order0=0 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/multiinput.prj +findinfiledialog=37 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=1 + "*.pas" "*.pp" "*.inc" + [findinfileadialogfo.dir] + filenames=1 + /home/graemeg/devel/ + filehistory=1 + /home/graemeg/devel/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + [findinfileadialogfo.findtext] + value=lapAutoAdjustForDPI + history=2 + lapAutoAdjustForDPI + + [findinfileadialogfo] + stackedunder= + x=268 + y=415 + cx=339 + cy=251 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=319 + y=205 + cx=312 + cy=114 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=708 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=125 + sortdescend4=0 + width5=245 + sortdescend5=0 + width6=289 + sortdescend6=0 + width7=49 + sortdescend7=0 + width8=1 + sortdescend8=0 + width9=290 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=543 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=260 + sortdescend3=0 + width4=273 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=0 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=389 + width0=98 + sortdescend0=0 + width1=378 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=146 + xprop=1 + yprop=0.2395498392283 + [projectoptionsfo.macrogrid] + propcolwidthref=481 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=465 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=699 + width0=47 + sortdescend0=0 + width1=693 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=734 + width0=112 + sortdescend0=0 + width1=727 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=522 + y=43 + cx=759 + cy=681 +settings=8 + [settings_form] + x=447 + y=148 + cx=471 + cy=524 + wsize=0 + active=1 + visible=1 +mainfile=${PROJECTNAME}.lpr +targetfile=${PROJECTNAME}${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=10 + ${lcldir} + ${lcldir}/components/BaseUtils + ${lcldir}/* + ${lcldir}/lcl/* + ${lcldir}/components/lazutils + ${lcldir}/lcl/interfaces/qt + ${lcldir}/lcl/interfaces/gtk2 + ${lcldir}/lcl/components/* + ${lcldir}/lcl/include + ${lcldir}/lcl +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=8 + -l -Mobjfpc -Sh + -gl + -ghl + -vi + -B + -O- + -O1 -XX -CX -Xs + -FUunits/ +makeoptpurpose=8 + + + + + + + + +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}default/program.pas + ${TEMPLATEDIR}default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}default/mainform.pas + ${TEMPLATEDIR}default/simpleform.pas + ${TEMPLATEDIR}default/dockingform.pas + ${TEMPLATEDIR}default/datamodule.pas + ${TEMPLATEDIR}default/subform.pas + ${TEMPLATEDIR}default/scrollboxform.pas + ${TEMPLATEDIR}default/tabform.pas + ${TEMPLATEDIR}default/dockpanelform.pas + ${TEMPLATEDIR}default/report.pas + ${TEMPLATEDIR}default/pascform.pas + ${TEMPLATEDIR}default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}default/mainform.mfm + ${TEMPLATEDIR}default/simpleform.mfm + ${TEMPLATEDIR}default/dockingform.mfm + ${TEMPLATEDIR}default/datamodule.mfm + ${TEMPLATEDIR}default/subform.mfm + ${TEMPLATEDIR}default/scrollboxform.mfm + ${TEMPLATEDIR}default/tabform.mfm + ${TEMPLATEDIR}default/dockpanelform.mfm + ${TEMPLATEDIR}default/report.mfm + ${TEMPLATEDIR}default/pascform.mfm + ${TEMPLATEDIR}default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=0 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=1 +settingsdebugger=1 +settingsstorage=1 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=8 + 63 + 2 + 0 + 4095 + 6 + 6 + 61 + 63 +compilerusedon=29 + 4088 + 7 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 4088 + 0 + 0 + 0 + 0 + 7 +exeusedon=14 + 4095 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=15:21:42 26/03/2017 +project_comment= +aftcommandon=0 +unitdirson=10 + 987135 + 987135 + 987135 + 987135 + 987135 + 987104 + 987135 + 987135 + 987135 + 987135 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal_ideu.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=4 +linenumberson=1 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=1 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=16 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=0 +path=0 +line=0 +address=0 +addbkpt=0 +ignore=0 +condition=0 +panels=1 + panel1 +units= + ( + a=0,8228,6,Pascal Units + ) +cmodules= + ( + a=0,8228,6,C Modules + ) +files= + ( + a=0,8228,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=100 +x=0 +y=0 +cx=0 +cy=0 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=0 +hintheight=0 +finddtext=endless +findhistory=17 + endless + SeekIfTerminated + seekken + isend + hasen + seeken + ended + nputSe + mut + endproc + ClosePlayer0 + ClosePlayer1 + AddFromEndlessMuted + readendl + reade + 0.0 + AddFromSynth +findoptions=1 +editpos=5 + 0,-1073741823 + 6,621 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 +bookmarks0=0 +bookmarks1=0 +bookmarks2=0 +bookmarks3=0 +bookmarks4=0 +sourcefiles=5 + ${PROJECTDIR}/multiinput.lpr + ${PROJECTDIR}/main_mi.pas + ${PROJECTDIR}/uos_flat.pas + ${PROJECTDIR}/uos.pas + ${PROJECTDIR}/multiinput.lpr +relpaths=5 + multiinput.lpr + main_mi.pas + uos_flat.pas + uos.pas + multiinput.lpr +ismoduletexts=5 + 0 + 0 + 0 + 0 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +order=5 + 0 + 1 + 4 + 2 + 3 +firsttab=0 +index=1 +[layout] +windowlayout=561 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=34 + y=45 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=1 + [projecttreefo.grid] + propcolwidthref=28 + width0=141 + sortdescend0=0 + width1=22 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=16 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=memoryfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=448 + width0=107 + sortdescend0=0 + width1=335 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1219 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenamescust=0 + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + panel=0 + noicon=0 + compact=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1219 + cy=52 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1219 + ncy=60 + x=0 + y=0 + cx=1219 + cy=60 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/main_mi.pas + history=2 + /home/fred/uos/examples/main_mi.pas + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=0 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1219 + cy=454 + rcx=0 + rcy=0 + [sourcefo.files_tab] + order=5 + 0 + 1 + 4 + 2 + 3 + firsttab=0 + index=1 + [confideufo.fontname] + value=stf_default + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=confdebuggerfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=55 + cx=1219 + cy=454 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/multiplayer.lpi b/UOS/examples/multiplayer.lpi new file mode 100644 index 0000000..3365d59 --- /dev/null +++ b/UOS/examples/multiplayer.lpi @@ -0,0 +1,412 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <SaveJumpHistory Value="False"/> + <SaveFoldState Value="False"/> + </Flags> + <MainUnit Value="0"/> + <Title Value="MultiPlayer"/> + <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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="LCL"/> + </Item1> + </RequiredPackages> + <Units Count="33"> + <Unit0> + <Filename Value="multiplayer.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="2"/> + <CursorPos Y="14"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main_mp.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <TopLine Value="254"/> + <CursorPos X="14" Y="266"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit1> + <Unit2> + <Filename Value="lazdyn_portaudio.pas"/> + <UnitName Value="LazDyn_PortAudio"/> + <TopLine Value="110"/> + <CursorPos X="16" Y="117"/> + <UsageCount Value="100"/> + </Unit2> + <Unit3> + <Filename Value="Lazdyn_SoundTouch.pas"/> + <UnitName Value="SoundTouchDLL"/> + <CursorPos X="59" Y="12"/> + <UsageCount Value="4"/> + </Unit3> + <Unit4> + <Filename Value="u_os.pas"/> + <UnitName Value="U_OS"/> + <TopLine Value="445"/> + <CursorPos X="10" Y="402"/> + <UsageCount Value="89"/> + </Unit4> + <Unit5> + <Filename Value="../firstprognew/mainmixxl.pas"/> + <TopLine Value="4347"/> + <CursorPos X="9" Y="4364"/> + <UsageCount Value="8"/> + </Unit5> + <Unit6> + <Filename Value="../dynmpg123/waveutils.pas"/> + <UnitName Value="WaveUtils"/> + <TopLine Value="3"/> + <CursorPos X="45" Y="43"/> + <UsageCount Value="4"/> + </Unit6> + <Unit7> + <Filename Value="kPGtest.pas"/> + <UnitName Value="PlayMP3"/> + <TopLine Value="111"/> + <CursorPos X="32" Y="128"/> + <UsageCount Value="6"/> + </Unit7> + <Unit8> + <Filename Value="kPGtestSF.pas"/> + <UnitName Value="PlayWAV"/> + <TopLine Value="27"/> + <CursorPos X="29" Y="32"/> + <UsageCount Value="6"/> + </Unit8> + <Unit9> + <Filename Value="lazdyn_mpg123.pas"/> + <TopLine Value="1060"/> + <CursorPos Y="1072"/> + <UsageCount Value="100"/> + </Unit9> + <Unit10> + <Filename Value="../OpenC2Pas/src/main.pas"/> + <TopLine Value="193"/> + <CursorPos Y="232"/> + <UsageCount Value="3"/> + </Unit10> + <Unit11> + <Filename Value="lazdyn_libsndfile.pas"/> + <TopLine Value="62"/> + <CursorPos Y="540"/> + <UsageCount Value="100"/> + </Unit11> + <Unit12> + <Filename Value="../U_OS_Test (copie)/u_os.pas"/> + <UnitName Value="U_OS"/> + <TopLine Value="72"/> + <CursorPos X="34" Y="236"/> + <UsageCount Value="9"/> + </Unit12> + <Unit13> + <Filename Value="PA_SF_MP.pas"/> + <TopLine Value="77"/> + <CursorPos X="20" Y="10"/> + <UsageCount Value="1"/> + </Unit13> + <Unit14> + <Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/objpas/sysutils/sysstrh.inc"/> + <TopLine Value="100"/> + <CursorPos X="10" Y="112"/> + <UsageCount Value="4"/> + </Unit14> + <Unit15> + <Filename Value="../lazarus64/examples/multithreading/mainunit.pas"/> + <UnitName Value="MainUnit"/> + <TopLine Value="70"/> + <UsageCount Value="4"/> + </Unit15> + <Unit16> + <Filename Value="../lazarus64/examples/pascalstream/componentstreampas.pas"/> + <UnitName Value="ComponentStreamPas"/> + <TopLine Value="33"/> + <UsageCount Value="7"/> + </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="6"/> + </Unit17> + <Unit18> + <Filename Value="/media/Windows7/dynsndfile/libsndfilestrings.pas"/> + <UsageCount Value="4"/> + </Unit18> + <Unit19> + <Filename Value="/media/Windows7/dynsndfile/lazdyn_libsndfile.pas"/> + <UsageCount Value="4"/> + </Unit19> + <Unit20> + <Filename Value="../logouos/unit1.pas"/> + <UnitName Value="Unit1"/> + <TopLine Value="67"/> + <CursorPos X="51" Y="83"/> + <UsageCount Value="4"/> + </Unit20> + <Unit21> + <Filename Value="/usr/lib/codetyphon/lazarus/lcl/graphics.pp"/> + <UnitName Value="Graphics"/> + <TopLine Value="1168"/> + <CursorPos X="49" Y="1181"/> + <UsageCount Value="6"/> + </Unit21> + <Unit22> + <Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/objpas/objpas.pp"/> + <TopLine Value="119"/> + <CursorPos X="8" Y="28"/> + <UsageCount Value="4"/> + </Unit22> + <Unit23> + <Filename Value="uos.pas"/> + <EditorIndex Value="3"/> + <TopLine Value="6822"/> + <CursorPos X="79" Y="6834"/> + <UsageCount Value="100"/> + <Loaded Value="True"/> + </Unit23> + <Unit24> + <Filename Value="uos_new.pas"/> + <TopLine Value="310"/> + <CursorPos X="29" Y="478"/> + <UsageCount Value="88"/> + </Unit24> + <Unit25> + <Filename Value="../firstprognew/bass.pas"/> + <TopLine Value="810"/> + <UsageCount Value="3"/> + </Unit25> + <Unit26> + <Filename Value="../onenamevar/unit1.pas"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit1"/> + <TopLine Value="81"/> + <CursorPos X="44" Y="100"/> + <UsageCount Value="6"/> + </Unit26> + <Unit27> + <Filename Value="/usr/lib/codetyphon/lazarus/packager/registration/fcllaz.pas"/> + <CursorPos Y="4"/> + <UsageCount Value="10"/> + </Unit27> + <Unit28> + <Filename Value="main_sp.pas"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="-1"/> + <TopLine Value="271"/> + <CursorPos Y="285"/> + <UsageCount Value="11"/> + </Unit28> + <Unit29> + <Filename Value="../lazarus32/packager/registration/fcllaz.pas"/> + <UsageCount Value="10"/> + </Unit29> + <Unit30> + <Filename Value="/usr/lib/codetyphon/lazarus/lcl/controls.pp"/> + <UnitName Value="Controls"/> + <TopLine Value="33"/> + <CursorPos X="36" Y="44"/> + <UsageCount Value="10"/> + </Unit30> + <Unit31> + <Filename Value="multiplayer_fpGUI.lpr"/> + <TopLine Value="513"/> + <CursorPos X="85" Y="530"/> + <UsageCount Value="10"/> + </Unit31> + <Unit32> + <Filename Value="uos_flat.pas"/> + <EditorIndex Value="1"/> + <TopLine Value="642"/> + <CursorPos X="23" Y="657"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit32> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="MultiPlayer"/> + </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> diff --git a/UOS/examples/multiplayer.lpr b/UOS/examples/multiplayer.lpr new file mode 100644 index 0000000..76145c4 --- /dev/null +++ b/UOS/examples/multiplayer.lpr @@ -0,0 +1,21 @@ +program multiplayer; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + cthreads, + cwstring, {$ENDIF} {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, + main_mp { you can add units after this }; + +begin + Application.Title := 'MultiPlayer'; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + + diff --git a/UOS/examples/multiplayer.prj b/UOS/examples/multiplayer.prj new file mode 100644 index 0000000..788cce8 --- /dev/null +++ b/UOS/examples/multiplayer.prj @@ -0,0 +1,1364 @@ +[componentpalette] +order0=0 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/multiplayer.prj +findinfiledialog=43 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=1 + "*.pas" "*.pp" "*.inc" + [findinfileadialogfo.dir] + filenames=1 + /usr/local/codetyphon/ + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + filehistory=2 + /usr/local/codetyphon/ + /home/graemeg/devel/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=lazfileutils + history=3 + lazfileutils + lapAutoAdjustForDPI + + [findinfileadialogfo] + stackedunder= + x=507 + y=259 + cx=339 + cy=292 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=319 + y=205 + cx=312 + cy=114 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=726 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=128 + sortdescend4=0 + width5=251 + sortdescend5=0 + width6=296 + sortdescend6=0 + width7=50 + sortdescend7=0 + width8=1 + sortdescend8=0 + width9=297 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=550 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=263 + sortdescend3=0 + width4=277 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=16 + [projectoptionsfo.newfile] + firsttab=0 + index=0 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=389 + width0=98 + sortdescend0=0 + width1=378 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=121 + xprop=1 + yprop=0.24171539961014 + [projectoptionsfo.macrogrid] + propcolwidthref=481 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=465 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=3 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=710 + width0=47 + sortdescend0=0 + width1=704 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=1 + [projectoptionsfo.filefiltergrid] + propcolwidthref=621 + width0=112 + sortdescend0=0 + width1=614 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=400 + y=78 + cx=759 + cy=568 +settings=8 + [settings_form] + x=447 + y=148 + cx=467 + cy=493 + wsize=0 + active=1 + visible=1 +mainfile=${PROJECTNAME}.lpr +targetfile=${PROJECTNAME}${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=10 + ${lcldir}/components/BaseUtils + ${lcldir}* + ${lcldir}/* + ${lcldir}/lcl/* + ${lcldir}/lcl/interfaces/qt + ${lcldir}/lcl/interfaces/win32 + ${lcldir}/lcl/interfaces/gtk2 + ${lcldir}/lcl/components/* + ${lcldir}/lcl/include + ${lcldir}/lcl +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=9 + -l -Mobjfpc -Sh + -gl + -ghl + -vi + -WG + -B + -O- + -O1 -XX -CX -Xs + -FUunits/ +makeoptpurpose=9 + + + + + + + + + +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}default/program.pas + ${TEMPLATEDIR}default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}default/mainform.pas + ${TEMPLATEDIR}default/simpleform.pas + ${TEMPLATEDIR}default/dockingform.pas + ${TEMPLATEDIR}default/datamodule.pas + ${TEMPLATEDIR}default/subform.pas + ${TEMPLATEDIR}default/scrollboxform.pas + ${TEMPLATEDIR}default/tabform.pas + ${TEMPLATEDIR}default/dockpanelform.pas + ${TEMPLATEDIR}default/report.pas + ${TEMPLATEDIR}default/pascform.pas + ${TEMPLATEDIR}default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}default/mainform.mfm + ${TEMPLATEDIR}default/simpleform.mfm + ${TEMPLATEDIR}default/dockingform.mfm + ${TEMPLATEDIR}default/datamodule.mfm + ${TEMPLATEDIR}default/subform.mfm + ${TEMPLATEDIR}default/scrollboxform.mfm + ${TEMPLATEDIR}default/tabform.mfm + ${TEMPLATEDIR}default/dockpanelform.mfm + ${TEMPLATEDIR}default/report.mfm + ${TEMPLATEDIR}default/pascform.mfm + ${TEMPLATEDIR}default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=0 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612712 +colorwarning=-1610612717 +colornote=-1610612716 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=1 +settingsdebugger=1 +settingsstorage=1 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=9 + 63 + 0 + 2 + 4095 + 48 + 2 + 2 + 61 + 63 +compilerusedon=29 + 4035 + 4 + 8 + 16 + 32 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 4088 + 0 + 0 + 0 + 0 + 7 +exeusedon=14 + 4047 + 0 + 48 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=15:21:42 26/03/2017 +project_comment= +aftcommandon=0 +unitdirson=10 + 987135 + 987135 + 987135 + 987135 + 987072 + 983088 + 983055 + 987135 + 987135 + 987135 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal_ideu.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=4 +linenumberson=1 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=1 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=16 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=0 +path=0 +line=0 +address=0 +addbkpt=0 +ignore=0 +condition=0 +panels=1 + panel1 +units= + ( + a=0,8228,6,Pascal Units + ) +cmodules= + ( + a=0,8228,6,C Modules + ) +files= + ( + a=0,8228,6,Text Files + ) +[componentstore] +storedir=/home/fred/msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=100 +x=0 +y=0 +cx=0 +cy=0 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=0 +hintheight=0 +finddtext=addfromfile +findhistory=5 + addfromfile + InIndex + uos_CreatePlayer + playnofr + Pa_StopStream +findoptions=1 +editpos=8 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,6 +bookmarks0=0 +bookmarks1=0 +bookmarks2=0 +bookmarks3=0 +bookmarks4=0 +bookmarks5=0 +bookmarks6=0 +bookmarks7=0 +sourcefiles=8 + ${PROJECTDIR}/multiplayer.lpr + ${PROJECTDIR}/main_mp.pas + ${PROJECTDIR}/uos.pas + ${PROJECTDIR}/uos_portaudio.pas + ${PROJECTDIR}/uos_flat.pas + ${PROJECTDIR}/multiplayer_fpGUI.pas + /home/fred/msegui/lib/common/fpccompatibility/mclasses.pas + ${PROJECTDIR}/multiplayer.lpr +relpaths=8 + multiplayer.lpr + main_mp.pas + uos.pas + uos_portaudio.pas + uos_flat.pas + multiplayer_fpGUI.pas + msegui/lib/common/fpccompatibility/mclasses.pas + multiplayer.lpr +ismoduletexts=8 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +order=8 + 0 + 2 + 3 + 1 + 5 + 4 + 6 + 7 +firsttab=1 +index=7 +[layout] +windowlayout=535 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=125 + y=46 + cx=1157 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=493 + y=171 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=1 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=444 + y=431 + cx=418 + cy=126 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=205 + cy=457 + rcx=0 + rcy=0 + [projecttreefo.grid] + propcolwidthref=88 + width0=117 + sortdescend0=0 + width1=82 + sortdescend1=0 + sorted=0 + col=1 + row=-1073741823 + rowheight=16 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=423 + y=321 + cx=344 + cy=155 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=memoryfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=316 + y=249 + cx=316 + cy=484 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [objectinspectorfo.grid] + propcolwidthref=306 + width0=136 + sortdescend0=0 + width1=164 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1262 + rcy=583 + [watchfo.grid] + propcolwidthref=111 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268517483 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=513 + cx=1147 + cy=92 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder= + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=240 + y=139 + cx=956 + cy=77 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=0 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1147 + cy=50 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1147 + ncy=53 + x=0 + y=0 + cx=1147 + cy=53 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/multiplayer.lpr + history=1 + /home/fred/uos/examples/multiplayer.lpr + [debuggerfo.project_options] + value=B + [debuggerfo.hints] + value=0 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=208 + y=0 + cx=939 + cy=457 + rcx=0 + rcy=0 + [sourcefo.files_tab] + order=8 + 0 + 2 + 3 + 1 + 5 + 4 + 6 + 7 + firsttab=1 + index=7 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302087659 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=53 + cx=1147 + cy=457 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/multiplayer_fpGUI.lpi b/UOS/examples/multiplayer_fpGUI.lpi new file mode 100644 index 0000000..1993603 --- /dev/null +++ b/UOS/examples/multiplayer_fpGUI.lpi @@ -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 Multi Player 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="multiplayer_fpGUI.pas"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="MultiPlayer_fpGUI"/> + </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> diff --git a/UOS/examples/multiplayer_fpGUI.pas b/UOS/examples/multiplayer_fpGUI.pas new file mode 100644 index 0000000..f6860cb --- /dev/null +++ b/UOS/examples/multiplayer_fpGUI.pas @@ -0,0 +1,1026 @@ +program multiplayer_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_widget, + fpg_label, + fpg_Editbtn, + fpg_RadioButton, + fpg_trackbar, + fpg_CheckBox, + fpg_base, + fpg_main, + fpg_form { you can add units after this }; + +type + + TMultiplayer = class(TfpgForm) + procedure uos_logo(Sender: TObject); + private + {@VFD_HEAD_BEGIN: Multiplayer} + Custom1: TfpgWidget; + Labelport: TfpgLabel; + btnLoad: TfpgButton; + FilenameEdit1: TfpgFileNameEdit; + FilenameEdit2: TfpgFileNameEdit; + FilenameEdit4: TfpgFileNameEdit; + btnStart: TfpgButton; + btnStop: TfpgButton; + Labelsnf: TfpgLabel; + Labelmpg: TfpgLabel; + FilenameEdit3: TfpgFileNameEdit; + btnpause: TfpgButton; + btnresume: TfpgButton; + FilenameEdit5: TfpgFileNameEdit; + btnStart2: TfpgButton; + btnpause2: TfpgButton; + btnresume2: TfpgButton; + btnStop2: TfpgButton; + FilenameEdit6: TfpgFileNameEdit; + btnStart3: TfpgButton; + btnPause3: TfpgButton; + btnResume3: TfpgButton; + btnStop3: TfpgButton; + FilenameEdit7: TfpgFileNameEdit; + btnStart4: TfpgButton; + btnPause4: TfpgButton; + btnResume4: TfpgButton; + btnStop4: TfpgButton; + Button3: TfpgButton; + {@VFD_HEAD_END: Multiplayer} + public + procedure AfterCreate; override; + // constructor Create(AOwner: TComponent); + procedure btnLoadClick(Sender: TObject); + procedure btnCloseClick(Sender: TObject); + procedure btnStartClick(Sender: TObject); + procedure btnStopClick(Sender: TObject); + procedure btnPauseClick(Sender: TObject); + procedure btnResumeClick(Sender: TObject); + procedure ClosePlayer0; + + procedure btnStartClick2(Sender: TObject); + procedure btnStopClick2(Sender: TObject); + procedure btnPauseClick2(Sender: TObject); + procedure btnResumeClick2(Sender: TObject); + procedure ClosePlayer1; + + procedure btnStartClick3(Sender: TObject); + procedure btnStopClick3(Sender: TObject); + procedure btnPauseClick3(Sender: TObject); + procedure btnResumeClick3(Sender: TObject); + procedure ClosePlayer2; + + procedure btnStartClick4(Sender: TObject); + procedure btnStopClick4(Sender: TObject); + procedure btnPauseClick4(Sender: TObject); + procedure btnResumeClick4(Sender: TObject); + procedure ClosePlayer3; + + procedure btnStartClickAll(Sender: TObject); + + end; + + {@VFD_NEWFORM_DECL} + + {@VFD_NEWFORM_IMPL} + +var + PlayerIndex0, PlayerIndex2, PlayerIndex3: cardinal; + ordir, opath: string; + PlayerIndex1: cardinal; + //PlayerIndex1 : tuos_player; + + procedure TMultiplayer.AfterCreate; + begin + {%region 'Auto-generated GUI code' -fold} + + + {@VFD_BODY_BEGIN: Multiplayer} + Name := 'Multiplayer'; + SetPosition(432, 151, 502, 465); + WindowTitle := 'Multi Player'; + Hint := ''; + Ondestroy := @btnCloseClick; + WindowPosition := wpScreenCenter; + + 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'; + Hint := ''; + Text := 'Folder + filename of PortAudio Library'; + end; + + btnLoad := TfpgButton.Create(self); + with btnLoad do + begin + Name := 'btnLoad'; + SetPosition(12, 128, 480, 23); + Text := 'Load that libraries'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 0; + 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(12, 160, 480, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 5; + end; + + btnStart := TfpgButton.Create(self); + with btnStart do + begin + Name := 'btnStart'; + SetPosition(76, 192, 60, 23); + Text := 'Play'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 6; + onclick := @btnstartClick; + end; + + btnStop := TfpgButton.Create(self); + with btnStop do + begin + Name := 'btnStop'; + SetPosition(344, 192, 76, 23); + Text := 'Stop'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 7; + onclick := @btnStopClick; + end; + + Labelsnf := TfpgLabel.Create(self); + with Labelsnf do + begin + Name := 'Labelsnf'; + SetPosition(140, 40, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + Hint := ''; + Text := 'Folder + filename of SndFile Library'; + end; + + Labelmpg := TfpgLabel.Create(self); + with Labelmpg do + begin + Name := 'Labelmpg'; + SetPosition(136, 80, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + Hint := ''; + Text := 'Folder + filename of Mpg123 Library'; + end; + + FilenameEdit3 := TfpgFileNameEdit.Create(self); + with FilenameEdit3 do + begin + Name := 'FilenameEdit3'; + SetPosition(136, 96, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 12; + end; + + btnpause := TfpgButton.Create(self); + with btnpause do + begin + Name := 'btnpause'; + SetPosition(168, 192, 52, 23); + Text := 'Pause'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 15; + onclick := @btnPauseClick; + end; + + btnresume := TfpgButton.Create(self); + with btnresume do + begin + Name := 'btnresume'; + SetPosition(248, 192, 64, 23); + Text := 'Resume'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 16; + onclick := @btnResumeClick; + end; + + FilenameEdit5 := TfpgFileNameEdit.Create(self); + with FilenameEdit5 do + begin + Name := 'FilenameEdit5'; + SetPosition(12, 224, 480, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 14; + end; + + btnStart2 := TfpgButton.Create(self); + with btnStart2 do + begin + Name := 'btnStart2'; + SetPosition(76, 256, 60, 23); + Text := 'Play'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 15; + onclick := @btnstartClick2; + end; + + btnpause2 := TfpgButton.Create(self); + with btnpause2 do + begin + Name := 'btnpause2'; + SetPosition(168, 256, 52, 23); + Text := 'Pause'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 16; + onclick := @btnPauseClick2; + end; + + btnresume2 := TfpgButton.Create(self); + with btnresume2 do + begin + Name := 'btnresume2'; + SetPosition(248, 256, 64, 23); + Text := 'Resume'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 17; + onclick := @btnResumeClick2; + end; + + btnStop2 := TfpgButton.Create(self); + with btnStop2 do + begin + Name := 'btnStop2'; + SetPosition(348, 256, 76, 23); + Text := 'Stop'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 18; + onclick := @btnStopClick2; + end; + + FilenameEdit6 := TfpgFileNameEdit.Create(self); + with FilenameEdit6 do + begin + Name := 'FilenameEdit6'; + SetPosition(12, 288, 480, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 19; + end; + + btnStart3 := TfpgButton.Create(self); + with btnStart3 do + begin + Name := 'btnStart3'; + SetPosition(76, 320, 60, 23); + Text := 'Play'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 20; + onclick := @btnstartClick3; + end; + + btnPause3 := TfpgButton.Create(self); + with btnPause3 do + begin + Name := 'btnPause3'; + SetPosition(168, 320, 52, 23); + Text := 'Pause'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 21; + onclick := @btnPauseClick3; + end; + + btnResume3 := TfpgButton.Create(self); + with btnResume3 do + begin + Name := 'btnResume3'; + SetPosition(248, 320, 64, 23); + Text := 'Resume'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 22; + onclick := @btnResumeClick3; + end; + + btnStop3 := TfpgButton.Create(self); + with btnStop3 do + begin + Name := 'btnStop3'; + SetPosition(348, 320, 76, 23); + Text := 'Stop'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 23; + onclick := @btnStopClick3; + end; + + FilenameEdit7 := TfpgFileNameEdit.Create(self); + with FilenameEdit7 do + begin + Name := 'FilenameEdit7'; + SetPosition(12, 352, 480, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 24; + end; + + btnStart4 := TfpgButton.Create(self); + with btnStart4 do + begin + Name := 'btnStart4'; + SetPosition(76, 384, 60, 23); + Text := 'Play'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 25; + onclick := @btnstartClick4; + end; + + btnPause4 := TfpgButton.Create(self); + with btnPause4 do + begin + Name := 'btnPause4'; + SetPosition(168, 384, 52, 23); + Text := 'Pause'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 26; + onclick := @btnPauseClick4; + end; + + btnResume4 := TfpgButton.Create(self); + with btnResume4 do + begin + Name := 'btnResume4'; + SetPosition(248, 384, 64, 23); + Text := 'Resume'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 27; + onclick := @btnResumeClick4; + end; + + btnStop4 := TfpgButton.Create(self); + with btnStop4 do + begin + Name := 'btnStop4'; + SetPosition(348, 384, 76, 23); + Text := 'Stop'; + Enabled := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 28; + onclick := @btnStopClick4; + end; + + Button3 := TfpgButton.Create(self); + with Button3 do + begin + Name := 'Button3'; + SetPosition(68, 425, 360, 23); + Text := 'Play All Together'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 29; + onclick := @btnStartClickAll; + end; + + {@VFD_BODY_END: Multiplayer} + {%endregion} + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + + 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} + {$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'; + {$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'; + 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'; + {$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'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + FilenameEdit1.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + FilenameEdit2.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + FilenameEdit3.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + {$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'; + {$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} + {$ENDIF} + + + FilenameEdit1.Initialdir := ordir + 'lib'; + FilenameEdit2.Initialdir := ordir + 'lib'; + FilenameEdit3.Initialdir := ordir + 'lib'; + FilenameEdit4.FileName := ordir + 'sound' + directoryseparator + 'test.mp3'; + FilenameEdit5.FileName := ordir + 'sound' + directoryseparator + 'test.ogg'; + FilenameEdit6.FileName := ordir + 'sound' + directoryseparator + 'test.wav'; + FilenameEdit7.FileName := ordir + 'sound' + directoryseparator + 'test.flac'; + + ////////////////////////////////////////////////////////////////////////// + end; + + procedure TMultiplayer.btnCloseClick(Sender: TObject); + begin + if (btnstart.Enabled = False) then + uos_stop(PlayerIndex0); + if (btnstart2.Enabled = False) then + uos_stop(PlayerIndex1)//PlayerIndex1.stop; + ; + if (btnstart3.Enabled = False) then + uos_stop(PlayerIndex2); + if (btnstart4.Enabled = False) then + uos_stop(PlayerIndex3); + sleep(200); + if btnLoad.Enabled = False then + uos_UnloadLib(); + end; + + procedure TMultiplayer.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, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + + if uos_LoadLib(PChar(FilenameEdit1.FileName), PChar(FilenameEdit2.FileName), + PChar(FilenameEdit3.FileName), nil, nil, nil, nil) = 0 then + begin + hide; + Height := 465; + 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 TMultiplayer.ClosePlayer0; + begin + btnStart.Enabled := True; + btnStop.Enabled := False; + btnPause.Enabled := False; + btnresume.Enabled := False; + end; + + procedure TMultiplayer.ClosePlayer1; + begin + btnStart2.Enabled := True; + btnStop2.Enabled := False; + btnPause2.Enabled := False; + btnresume2.Enabled := False; + end; + + procedure TMultiplayer.ClosePlayer2; + begin + btnStart3.Enabled := True; + btnStop3.Enabled := False; + btnPause3.Enabled := False; + btnresume3.Enabled := False; + end; + + procedure TMultiplayer.ClosePlayer3; + begin + btnStart4.Enabled := True; + btnStop4.Enabled := False; + btnPause4.Enabled := False; + btnresume4.Enabled := False; + end; + + procedure TMultiplayer.btnStopClick(Sender: TObject); + begin + uos_Stop(PlayerIndex0); + closeplayer0; + end; + + procedure TMultiplayer.btnResumeClick(Sender: TObject); + begin + uos_Replay(PlayerIndex0); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := True; + btnresume.Enabled := False; + end; + + procedure TMultiplayer.btnPauseClick(Sender: TObject); + begin + uos_Pause(PlayerIndex0); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := False; + btnresume.Enabled := True; + end; + + procedure TMultiplayer.btnStartClick(Sender: TObject); + var + InIndex: integer; + begin + PlayerIndex0 := 0; + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + uos_CreatePlayer(PlayerIndex0); + {$else} + uos_CreatePlayer(PlayerIndex0, sender); + {$ENDIF} + + InIndex := uos_AddFromFile(PlayerIndex0, 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 + uos_AddIntoDevOut(PlayerIndex0, -1, 0.3, uos_InputGetSampleRate(PlayerIndex0, InIndex), -1, 0, -1, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex0, -1, -1, uos_InputGetSampleRate(PlayerIndex0, InIndex), -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) + // result : -1 nothing created, otherwise Output Index in array + + /////// procedure to execute when stream is terminated + uos_EndProc(PlayerIndex0, @ClosePlayer0); + ///// Assign the procedure of object to execute at end + //////////// PlayerIndex : Index of a existing Player + //////////// ClosePlayer1 : procedure of object to execute inside the loop + + btnStart.Enabled := False; + btnStop.Enabled := True; + btnpause.Enabled := True; + btnresume.Enabled := False; + + uos_Play(PlayerIndex0); + /////// everything is ready, here we are, lets play it... + + end; + + procedure TMultiplayer.btnStopClick2(Sender: TObject); + begin + // PlayerIndex1.stop; + uos_Stop(PlayerIndex1); + // closeplayer1; + // sleep(1000); + // PlayerIndex1.stop; + // if assigned(PlayerIndex1) then PlayerIndex1.destroy; + end; + + procedure TMultiplayer.btnResumeClick2(Sender: TObject); + begin + // uos_RePlay(PlayerIndex1); + btnStart2.Enabled := False; + btnStop2.Enabled := True; + btnPause2.Enabled := True; + btnresume2.Enabled := False; + end; + + procedure TMultiplayer.btnPauseClick2(Sender: TObject); + begin + // uos_Pause(PlayerIndex1); + btnStart2.Enabled := False; + btnStop2.Enabled := True; + btnPause2.Enabled := False; + btnresume2.Enabled := True; + end; + + procedure TMultiplayer.btnStartClick2(Sender: TObject); + var + InIndex: integer; + begin + PlayerIndex1 := 1; + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + uos_CreatePlayer(PlayerIndex1); + {$else} + uos_CreatePlayer(PlayerIndex1, sender); + + {$ENDIF} + + InIndex := uos_AddFromFile(PlayerIndex1, PChar(FilenameEdit5.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 + uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, InIndex), -1, 0, -1, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, InIndex), -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) + // result : -1 nothing created, otherwise Output Index in array + + /////// procedure to execute when stream is terminated + 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 + + btnStart2.Enabled := False; + btnStop2.Enabled := True; + btnpause2.Enabled := True; + btnresume2.Enabled := False; + + uos_Play(PlayerIndex1); + ////// Ok let start it + + end; + + procedure TMultiplayer.btnStopClick3(Sender: TObject); + begin + uos_Stop(PlayerIndex2); + closeplayer2; + end; + + procedure TMultiplayer.btnResumeClick3(Sender: TObject); + begin + uos_RePlay(PlayerIndex2); + btnStart3.Enabled := False; + btnStop3.Enabled := True; + btnPause3.Enabled := True; + btnresume3.Enabled := False; + end; + + procedure TMultiplayer.btnPauseClick3(Sender: TObject); + begin + uos_Pause(PlayerIndex2); + btnStart3.Enabled := False; + btnStop3.Enabled := True; + btnPause3.Enabled := False; + btnresume3.Enabled := True; + end; + + procedure TMultiplayer.btnStartClick3(Sender: TObject); + var + InIndex: integer; + begin + PlayerIndex2 := 2; + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + uos_CreatePlayer(PlayerIndex2); + {$else} + uos_CreatePlayer(PlayerIndex2, sender); + {$ENDIF} + + InIndex := uos_AddFromFile(PlayerIndex2, PChar(FilenameEdit6.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 + uos_AddIntoDevOut(PlayerIndex2, -1, 0.3, uos_InputGetSampleRate(PlayerIndex2, InIndex), -1, 0, -1, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex2, -1, -1, uos_InputGetSampleRate(PlayerIndex2, InIndex), -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) + // result : -1 nothing created, otherwise Output Index in array + + /////// procedure to execute when stream is terminated + uos_EndProc(PlayerIndex2, @ClosePlayer2); + ///// Assign the procedure of object to execute at end + //////////// PlayerIndex : Index of a existing Player + //////////// ClosePlayer1 : procedure of object to execute inside the loop + + uos_Play(PlayerIndex2); + ////// Ok let start it + + + btnStart3.Enabled := False; + btnStop3.Enabled := True; + btnpause3.Enabled := True; + btnresume3.Enabled := False; + /////// everything is ready, here we are, lets play it... + + end; + + procedure TMultiplayer.btnStopClick4(Sender: TObject); + begin + uos_Stop(PlayerIndex3); + closeplayer3; + end; + + procedure TMultiplayer.btnResumeClick4(Sender: TObject); + begin + uos_RePlay(PlayerIndex3); + btnStart4.Enabled := False; + btnStop4.Enabled := True; + btnPause4.Enabled := True; + btnresume4.Enabled := False; + end; + + procedure TMultiplayer.btnPauseClick4(Sender: TObject); + begin + uos_Pause(PlayerIndex3); + btnStart4.Enabled := False; + btnStop4.Enabled := True; + btnPause4.Enabled := False; + btnresume4.Enabled := True; + end; + + procedure TMultiplayer.btnStartClick4(Sender: TObject); + var + InIndex: integer; + begin + PlayerIndex3 := 3; + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + uos_CreatePlayer(PlayerIndex3); + {$else} + uos_CreatePlayer(PlayerIndex3, sender); + {$ENDIF} + + InIndex := uos_AddFromFile(PlayerIndex3, PChar(FilenameEdit7.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 + uos_AddIntoDevOut(PlayerIndex3, -1, 0.3, uos_InputGetSampleRate(PlayerIndex3, InIndex), -1, 0, -1, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex3, -1, -1, uos_InputGetSampleRate(PlayerIndex3, InIndex), -1, 0, -1, -1); + {$endif} + + uos_AddIntoDevOut(PlayerIndex3, -1, -1, uos_InputGetSampleRate(PlayerIndex3, InIndex), -1, 0, -1, -1); + //// 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) + // result : -1 nothing created, otherwise Output Index in array + + /////// procedure to execute when stream is terminated + uos_EndProc(PlayerIndex3, @ClosePlayer3); + ///// Assign the procedure of object to execute at end + //////////// PlayerIndex : Index of a existing Player + //////////// ClosePlayer1 : procedure of object to execute inside the loop + + uos_Play(PlayerIndex3); + ////// Ok let start it + + btnStart4.Enabled := False; + btnStop4.Enabled := True; + btnpause4.Enabled := True; + btnresume4.Enabled := False; + + /////// everything is ready, here we are, lets play it... + + end; + + procedure TMultiplayer.btnStartClickAll(Sender: TObject); + begin + btnStartClick(self); + btnStartClick2(self); + btnStartClick3(self); + btnStartClick4(self); + end; + + procedure TMultiplayer.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: TMultiplayer; + x: integer; + begin + fpgApplication.Initialize; + if fpgStyleManager.SetStyle('Chrome silver flat menu') then + fpgStyle := fpgStyleManager.Style; + frm := TMultiplayer.Create(nil); + try + frm.Show; + fpgApplication.Run; + finally + uos_free; + frm.Free; + end; + end; + +begin + MainProc; +end. + diff --git a/UOS/examples/multiplayer_fpGUI.prj b/UOS/examples/multiplayer_fpGUI.prj new file mode 100644 index 0000000..20b9baf --- /dev/null +++ b/UOS/examples/multiplayer_fpGUI.prj @@ -0,0 +1,1403 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/multiplayer_fpGUI.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=multiplayer_fpGUI.pas +targetfile=multiplayer_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/multiplayer_fpGUI.pas +relpaths=1 + multiplayer_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/multiplayer_fpGUI.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/noiseremover.lpi b/UOS/examples/noiseremover.lpi new file mode 100644 index 0000000..83456d6 --- /dev/null +++ b/UOS/examples/noiseremover.lpi @@ -0,0 +1,751 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="12"/> + <General> + <Flags> + <CompatibilityMode Value="True"/> + </Flags> + <Title Value="NoiseRemover"/> + <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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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="72"> + <Unit0> + <Filename Value="noiseremover.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="3"/> + <CursorPos Y="22"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main_nr.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <TopLine Value="295"/> + <CursorPos X="3" Y="298"/> + <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="/usr/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="/usr/lib/codetyphon/lazarus/lcl/graphics.pp"/> + <TopLine Value="1168"/> + <CursorPos X="49" Y="1181"/> + <UsageCount Value="8"/> + </Unit21> + <Unit22> + <Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/objpas/objpas.pp"/> + <TopLine Value="119"/> + <CursorPos X="8" Y="28"/> + <UsageCount Value="6"/> + </Unit22> + <Unit23> + <Filename Value="uos.pas"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="4"/> + <TopLine Value="63"/> + <CursorPos X="33" Y="78"/> + <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="/usr/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="/usr/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="-1"/> + <CursorPos Y="2"/> + <UsageCount Value="26"/> + </Unit36> + <Unit37> + <Filename Value="noiseremover_fpGUI.lpr"/> + <TopLine Value="263"/> + <CursorPos X="29" Y="270"/> + <UsageCount Value="11"/> + </Unit37> + <Unit38> + <Filename Value="/media/fred/Windows7/uos/examples/main_sp.pas"/> + <TopLine Value="108"/> + <CursorPos X="37" Y="119"/> + <UsageCount Value="10"/> + </Unit38> + <Unit39> + <Filename Value="uos_soundtouch.pas"/> + <EditorIndex Value="-1"/> + <CursorPos Y="2"/> + <UsageCount Value="17"/> + </Unit39> + <Unit40> + <Filename Value="uos_soundtouchok.pas"/> + <TopLine Value="92"/> + <CursorPos X="40" Y="101"/> + <UsageCount Value="10"/> + </Unit40> + <Unit41> + <Filename Value="../../uos-master/examples/uos.pas"/> + <CursorPos X="66" Y="517"/> + <UsageCount Value="12"/> + </Unit41> + <Unit42> + <Filename Value="../../uos2/src/uos.pas"/> + <TopLine Value="1906"/> + <CursorPos X="38" Y="1917"/> + <UsageCount Value="10"/> + </Unit42> + <Unit43> + <Filename Value="/usr/share/lazarus/1.2RC2/ide/compiler.pp"/> + <TopLine Value="30"/> + <CursorPos X="6" Y="33"/> + <UsageCount Value="10"/> + </Unit43> + <Unit44> + <Filename Value="../../libuos/src/libuos.pas"/> + <TopLine Value="3"/> + <CursorPos X="32" Y="24"/> + <UsageCount Value="16"/> + </Unit44> + <Unit45> + <Filename Value="noiseremover_fpGUI.pas"/> + <UnitName Value="noiseremove_fpGUI"/> + <EditorIndex Value="2"/> + <TopLine Value="361"/> + <CursorPos X="24" Y="377"/> + <UsageCount Value="21"/> + <Loaded Value="True"/> + </Unit45> + <Unit46> + <Filename Value="../../codetyphon/fpcsrc/rtl/objpas/sysutils/filutilh.inc"/> + <CursorPos X="10" Y="143"/> + <UsageCount Value="11"/> + </Unit46> + <Unit47> + <Filename Value="../../lazarus/fpc/2.6.2/source/rtl/win/sysutils.pp"/> + <UsageCount Value="11"/> + </Unit47> + <Unit48> + <Filename Value="../../lazarus/components/lazutils/fileutil.pas"/> + <TopLine Value="24"/> + <CursorPos X="65" Y="29"/> + <UsageCount Value="11"/> + </Unit48> + <Unit49> + <Filename Value="../../codetyphon/typhon/components/lazutils/fileutil.pas"/> + <TopLine Value="201"/> + <CursorPos X="19" Y="217"/> + <UsageCount Value="10"/> + </Unit49> + <Unit50> + <Filename Value="uos_flat.pas"/> + <EditorIndex Value="1"/> + <TopLine Value="508"/> + <CursorPos X="45" Y="523"/> + <UsageCount Value="22"/> + <Loaded Value="True"/> + </Unit50> + <Unit51> + <Filename Value="uos_libsndfile.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="61" Y="11"/> + <UsageCount Value="21"/> + </Unit51> + <Unit52> + <Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/linux/ptypes.inc"/> + <TopLine Value="90"/> + <CursorPos X="5" Y="94"/> + <UsageCount Value="10"/> + </Unit52> + <Unit53> + <Filename Value="../../uoslib/src/uos.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="3417"/> + <CursorPos X="17" Y="3438"/> + <UsageCount Value="10"/> + </Unit53> + <Unit54> + <Filename Value="uos_bs2b.pas"/> + <EditorIndex Value="-1"/> + <CursorPos Y="2"/> + <UsageCount Value="16"/> + </Unit54> + <Unit55> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/inc/systemh.inc"/> + <EditorIndex Value="-1"/> + <TopLine Value="491"/> + <CursorPos X="10" Y="493"/> + <UsageCount Value="10"/> + </Unit55> + <Unit56> + <Filename Value="define.inc"/> + <EditorIndex Value="-1"/> + <CursorPos X="78" Y="10"/> + <UsageCount Value="19"/> + </Unit56> + <Unit57> + <Filename Value="mcwAAC.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="57"/> + <CursorPos X="95" Y="74"/> + <UsageCount Value="10"/> + </Unit57> + <Unit58> + <Filename Value="uos_cdrom.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="11" Y="5"/> + <UsageCount Value="14"/> + </Unit58> + <Unit59> + <Filename Value="uos_aac.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="14" Y="6"/> + <UsageCount Value="15"/> + </Unit59> + <Unit60> + <Filename Value="/usr/local/codetyphon/fpcsrc/packages/cdrom/src/cdrom.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="18"/> + <CursorPos X="13" Y="44"/> + <UsageCount Value="10"/> + </Unit60> + <Unit61> + <Filename Value="/usr/local/codetyphon/fpcsrc/packages/cdrom/src/cdromw32.inc"/> + <EditorIndex Value="-1"/> + <UsageCount Value="10"/> + </Unit61> + <Unit62> + <Filename Value="/usr/local/codetyphon/fpcsrc/packages/cdrom/src/wincd.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="308"/> + <CursorPos X="44" Y="341"/> + <UsageCount Value="10"/> + </Unit62> + <Unit63> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/inc/ctypes.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="38"/> + <CursorPos X="10" Y="71"/> + <UsageCount Value="10"/> + </Unit63> + <Unit64> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/unix/unixtype.pp"/> + <EditorIndex Value="-1"/> + <UsageCount Value="10"/> + </Unit64> + <Unit65> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/unix/aliasctp.inc"/> + <EditorIndex Value="-1"/> + <UsageCount Value="10"/> + </Unit65> + <Unit66> + <Filename Value="uos_httpgetthread.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="78" Y="16"/> + <UsageCount Value="14"/> + </Unit66> + <Unit67> + <Filename Value="uos_mpg123.pas"/> + <EditorIndex Value="-1"/> + <CursorPos Y="2"/> + <UsageCount Value="14"/> + </Unit67> + <Unit68> + <Filename Value="uos_dsp_noiseremoval.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="9" Y="6"/> + <UsageCount Value="14"/> + </Unit68> + <Unit69> + <Filename Value="noiseremover_fpGUI_noflat.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="6" Y="8"/> + <UsageCount Value="10"/> + </Unit69> + <Unit70> + <Filename Value="simplerecorder_fpGUI.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="4" Y="7"/> + <UsageCount Value="10"/> + </Unit70> + <Unit71> + <Filename Value="/usr/local/codetyphon/typhon/components/BaseUtils/lazutf8sysutils.pas"/> + <UnitName Value="LazUTF8SysUtils"/> + <EditorIndex Value="-1"/> + <TopLine Value="10"/> + <CursorPos X="5" Y="29"/> + <UsageCount Value="10"/> + </Unit71> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="main_nr.pas"/> + <Caret Line="111" Column="18" TopLine="93"/> + </Position1> + <Position2> + <Filename Value="main_nr.pas"/> + <Caret Line="110" Column="18" TopLine="92"/> + </Position2> + <Position3> + <Filename Value="main_nr.pas"/> + <Caret Line="109" Column="18" TopLine="91"/> + </Position3> + <Position4> + <Filename Value="main_nr.pas"/> + <Caret Line="108" Column="18" TopLine="90"/> + </Position4> + <Position5> + <Filename Value="main_nr.pas"/> + <Caret Line="107" Column="18" TopLine="89"/> + </Position5> + <Position6> + <Filename Value="main_nr.pas"/> + <Caret Line="106" Column="18" TopLine="88"/> + </Position6> + <Position7> + <Filename Value="main_nr.pas"/> + <Caret Line="107" Column="13" TopLine="98"/> + </Position7> + <Position8> + <Filename Value="main_nr.pas"/> + <Caret Line="106" Column="13" TopLine="97"/> + </Position8> + <Position9> + <Filename Value="main_nr.pas"/> + <Caret Line="105" Column="13" TopLine="96"/> + </Position9> + <Position10> + <Filename Value="main_nr.pas"/> + <Caret Line="104" Column="13" TopLine="95"/> + </Position10> + <Position11> + <Filename Value="main_nr.pas"/> + <Caret Line="103" Column="13" TopLine="94"/> + </Position11> + <Position12> + <Filename Value="main_nr.pas"/> + <Caret Line="102" Column="13" TopLine="93"/> + </Position12> + <Position13> + <Filename Value="main_nr.pas"/> + <Caret Line="101" Column="13" TopLine="92"/> + </Position13> + <Position14> + <Filename Value="main_nr.pas"/> + <Caret Line="100" Column="13" TopLine="91"/> + </Position14> + <Position15> + <Filename Value="main_nr.pas"/> + <Caret Line="101" Column="13" TopLine="92"/> + </Position15> + <Position16> + <Filename Value="main_nr.pas"/> + <Caret Line="104" Column="13" TopLine="104"/> + </Position16> + <Position17> + <Filename Value="main_nr.pas"/> + <Caret Line="103" Column="13" TopLine="103"/> + </Position17> + <Position18> + <Filename Value="main_nr.pas"/> + <Caret Line="102" Column="13" TopLine="102"/> + </Position18> + <Position19> + <Filename Value="main_nr.pas"/> + <Caret Line="101" Column="13" TopLine="101"/> + </Position19> + <Position20> + <Filename Value="main_nr.pas"/> + <Caret Line="100" Column="13" TopLine="100"/> + </Position20> + <Position21> + <Filename Value="main_nr.pas"/> + <Caret Line="99" Column="13" TopLine="99"/> + </Position21> + <Position22> + <Filename Value="main_nr.pas"/> + <Caret Line="98" Column="13" TopLine="98"/> + </Position22> + <Position23> + <Filename Value="main_nr.pas"/> + <Caret Line="261" Column="45" TopLine="250"/> + </Position23> + <Position24> + <Filename Value="main_nr.pas"/> + <Caret Line="169" Column="3" TopLine="145"/> + </Position24> + <Position25> + <Filename Value="main_nr.pas"/> + <Caret Line="180" Column="2" TopLine="173"/> + </Position25> + <Position26> + <Filename Value="main_nr.pas"/> + <Caret Line="219" Column="56" TopLine="210"/> + </Position26> + <Position27> + <Filename Value="main_nr.pas"/> + <Caret Line="216" Column="57" TopLine="209"/> + </Position27> + <Position28> + <Filename Value="main_nr.pas"/> + <Caret Line="133" Column="18" TopLine="125"/> + </Position28> + <Position29> + <Filename Value="main_nr.pas"/> + <Caret Line="154" Column="23" TopLine="137"/> + </Position29> + <Position30> + <Filename Value="main_nr.pas"/> + <Caret Line="247" Column="70" TopLine="242"/> + </Position30> + </JumpHistory> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="noiseremover"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <Optimizations> + <OptimizationLevel Value="2"/> + </Optimizations> + </CodeGeneration> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf3"/> + <UseExternalDbgSyms Value="True"/> + </Debugging> + <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> diff --git a/UOS/examples/noiseremover.lpr b/UOS/examples/noiseremover.lpr new file mode 100644 index 0000000..deca75e --- /dev/null +++ b/UOS/examples/noiseremover.lpr @@ -0,0 +1,22 @@ +program noiseremover; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} + cthreads, + cwstring, {$ENDIF} + Interfaces, // this includes the LCL widgetset + ctypes, + Forms, + main_nr { you can add units after this }; + +begin + Application.Title := 'SimplePlayer'; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + + diff --git a/UOS/examples/noiseremover_fpGUI.pas b/UOS/examples/noiseremover_fpGUI.pas new file mode 100644 index 0000000..c7fd3a3 --- /dev/null +++ b/UOS/examples/noiseremover_fpGUI.pas @@ -0,0 +1,507 @@ +program noiseremove_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_widget, + fpg_label, + fpg_Editbtn, + fpg_RadioButton, + fpg_trackbar, + fpg_CheckBox, + fpg_base, + fpg_main, + fpg_form { you can add units after this }; + +type + TSimpleplayer = class(TfpgForm) + procedure uos_logo(Sender: TObject); + private + {@VFD_HEAD_BEGIN: Simpleplayer} + Custom1: TfpgWidget; + Labelport: TfpgLabel; + btnLoad: TfpgButton; + FilenameEdit1: TfpgFileNameEdit; + FilenameEdit2: TfpgFileNameEdit; + FilenameEdit4: TfpgFileNameEdit; + btnStart: TfpgButton; + btnStop: TfpgButton; + Labelsnf: TfpgLabel; + btnpause: TfpgButton; + btnresume: TfpgButton; + chknoise: TfpgCheckBox; + {@VFD_HEAD_END: Simpleplayer} + public + procedure AfterCreate; override; + // constructor Create(AOwner: TComponent); + procedure btnLoadClick(Sender: TObject); + procedure btnCloseClick(Sender: TObject); + procedure btnStartClick(Sender: TObject); + procedure btnStopClick(Sender: TObject); + procedure btnPauseClick(Sender: TObject); + procedure btnResumeClick(Sender: TObject); + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + {$else} + procedure CustomMsgReceived(var msg: TfpgMessageRec); message MSG_CUSTOM1; + {$ENDIF} + procedure ClosePlayer1; + procedure ChangeNoise(Sender: TObject); + end; + + {@VFD_NEWFORM_DECL} + + {@VFD_NEWFORM_IMPL} + +var + PlayerIndex1: integer; + ordir, opath: string; + OutputIndex1, InputIndex1 : integer; + + procedure TSimpleplayer.ChangeNoise(Sender: TObject); + begin + if btnStart.Enabled = False then /// player1 was created + uos_InputSetDSPNoiseRemoval(PlayerIndex1, InputIndex1, chknoise.Checked); + end; + + procedure TSimpleplayer.btnResumeClick(Sender: TObject); + begin + uos_RePlay(PlayerIndex1); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := True; + btnresume.Enabled := False; + end; + + procedure TSimpleplayer.btnPauseClick(Sender: TObject); + begin + uos_Pause(PlayerIndex1); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := False; + btnresume.Enabled := True; + end; + + procedure TSimpleplayer.btnCloseClick(Sender: TObject); + begin + if (btnstart.Enabled = False) then + begin + uos_stop(PlayerIndex1); + sleep(100); + end; + end; + + procedure TSimpleplayer.btnLoadClick(Sender: TObject); +var +loadok : boolean = false; + begin + // Load the libraries + // function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + +{$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} + +if uos_LoadLib(Pchar(FilenameEdit1.FileName), Pchar(FilenameEdit2.FileName), +nil, nil, nil, nil, nil) = 0 then + begin + hide; + loadok := true; + Height := 230; + btnStart.Enabled := True; + btnLoad.Enabled := False; + FilenameEdit1.ReadOnly := True; + FilenameEdit2.ReadOnly := True; + UpdateWindowPosition; + btnLoad.Text := + 'PortAudio, SndFile, Mpg123 libraries are loaded...'; + + WindowPosition := wpScreenCenter; + WindowTitle := 'Noise Remover. uos Version ' + inttostr(uos_getversion()); + fpgapplication.ProcessMessages; + sleep(500); + Show; + end else btnLoad.Text := + 'One or more libraries did not load, check filenames...'; + + end; + + procedure TSimpleplayer.ClosePlayer1; + begin + btnStart.Enabled := True; + btnStop.Enabled := False; + btnPause.Enabled := False; + btnresume.Enabled := False; + end; + + procedure TSimpleplayer.btnStopClick(Sender: TObject); + begin + uos_Stop(PlayerIndex1); + closeplayer1; + end; + + ///// example how to do custom dsp + + procedure TSimpleplayer.btnStartClick(Sender: TObject); + var + samformat: shortint; + + begin + samformat := 0; + + 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(Windows)} + uos_CreatePlayer(PlayerIndex1); + {$else} + uos_CreatePlayer(PlayerIndex1,self); + {$endif} + //// Create the player. + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + InputIndex1 := uos_AddFromFile(PlayerIndex1, pchar(filenameEdit4.filename), -1, + samformat, -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 div channels) + // result : -1 nothing created, otherwise Input Index in array + + if InputIndex1 > -1 then begin + + // OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1) ; + //// add a Output into device with default parameters + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, -1, -1); + {$else} + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, -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) /// here default samplerate of input + //////////// 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) + // result : -1 nothing created, otherwise Output Index in array + + uos_InputAddDSPNoiseRemoval(PlayerIndex1, InputIndex1); + uos_InputSetDSPNoiseRemoval(PlayerIndex1, InputIndex1, chknoise.Checked); + /// Add DSP Noise removal. First chunck will be the noise sample. + + /////// procedure to execute when stream is terminated + 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 general loop + + btnStart.Enabled := False; + btnStop.Enabled := True; + btnpause.Enabled := True; + btnresume.Enabled := False; + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets play it... + end; + end; + + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + {$else} + procedure TSimpleplayer.CustomMsgReceived(var msg: TfpgMessageRec); + begin + ShowLevel; + ShowPosition ; + end; + + {$ENDIF} + + procedure TSimpleplayer.AfterCreate; + begin + {%region 'Auto-generated GUI code' -fold} + + + {@VFD_BODY_BEGIN: Simpleplayer} + Name := 'Simpleplayer'; + SetPosition(396, 317, 503, 229); + WindowTitle := 'Noise remover'; + IconName := ''; + BackGroundColor := $80000001; + Hint := ''; + WindowPosition := wpScreenCenter; + Ondestroy := @btnCloseClick; + + Custom1 := TfpgWidget.Create(self); + with Custom1 do + begin + Name := 'Custom1'; + SetPosition(10, 16, 115, 107); + OnPaint := @uos_logo; + end; + + Labelport := TfpgLabel.Create(self); + with Labelport do + begin + Name := 'Labelport'; + SetPosition(136, 4, 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(4, 130, 488, 24); + 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(140, 24, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 3; + end; + + FilenameEdit2 := TfpgFileNameEdit.Create(self); + with FilenameEdit2 do + begin + Name := 'FilenameEdit2'; + SetPosition(140, 84, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 4; + end; + + FilenameEdit4 := TfpgFileNameEdit.Create(self); + with FilenameEdit4 do + begin + Name := 'FilenameEdit4'; + SetPosition(168, 160, 320, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 5; + end; + + btnStart := TfpgButton.Create(self); + with btnStart do + begin + Name := 'btnStart'; + SetPosition(92, 196, 66, 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(320, 196, 66, 23); + Text := 'Stop'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 7; + Hint := ''; + onclick := @btnStopClick; + end; + + Labelsnf := TfpgLabel.Create(self); + with Labelsnf do + begin + Name := 'Labelsnf'; + SetPosition(144, 64, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of SndFile Library'; + Hint := ''; + end; + + btnpause := TfpgButton.Create(self); + with btnpause do + begin + Name := 'btnpause'; + SetPosition(168, 196, 66, 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(244, 196, 66, 23); + Text := 'Resume'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 16; + Hint := ''; + onclick := @btnResumeClick; + end; + + chknoise := TfpgCheckBox.Create(self); + with chknoise do + begin + Name := 'chknoise'; + SetPosition(20, 160, 136, 19); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 38; + Text := 'Noise Remover'; + Hint := 'Noise remover'; + OnChange := @Changenoise; + end; + + {@VFD_BODY_END: Simpleplayer} + {%endregion} + + ////////////////////// + + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + Height := 159; + {$IFDEF Windows} + {$if defined(cpu64)} + FilenameEdit1.FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + FilenameEdit2.FileName := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + {$else} + FilenameEdit1.FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + FilenameEdit2.FileName := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + {$endif} + FilenameEdit4.FileName := ordir + 'sound\noisyvoice.ogg'; + {$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'; + FilenameEdit4.FileName := opath + 'sound/noisyvoice.ogg'; + {$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'; + FilenameEdit4.FileName := ordir + 'sound/noisyvoice.ogg'; + {$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'; + FilenameEdit4.FileName := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + FilenameEdit1.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + FilenameEdit2.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + FilenameEdit4.FileName := ordir + 'sound/noisyvoice.ogg'; + {$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'; + FilenameEdit4.FileName := ordir + 'sound/noisyvoice.ogg'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + FilenameEdit1.FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + FilenameEdit2.FileName := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + {$else} + FilenameEdit1.FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + FilenameEdit2.FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + {$endif} + FilenameEdit4.FileName := ordir + 'sound/noisyvoice.ogg'; +{$ENDIF} + FilenameEdit4.Initialdir := ordir + 'sound'; + FilenameEdit1.Initialdir := ordir + 'lib'; + FilenameEdit2.Initialdir := ordir + 'lib'; + + end; + + procedure TSimpleplayer.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: TSimpleplayer; + begin + fpgApplication.Initialize; + if fpgStyleManager.SetStyle('Chrome silver flat menu') then + fpgStyle := fpgStyleManager.Style; + fpgApplication.CreateForm(TSimpleplayer, frm); + try + frm.Show; + fpgApplication.Run; + finally + uos_free; // do not forget this... + frm.Free; + end; + end; + +begin + MainProc; +end. diff --git a/UOS/examples/noiseremover_fpGUI.prj b/UOS/examples/noiseremover_fpGUI.prj new file mode 100644 index 0000000..2dd7fe2 --- /dev/null +++ b/UOS/examples/noiseremover_fpGUI.prj @@ -0,0 +1,1403 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/noiseremover_fpGUI.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=noiseremover_fpGUI.pas +targetfile=noiseremover_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/noiseremover_fpGUI.pas +relpaths=1 + noiseremover_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/noiseremover_fpGUI.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/simpledrums.lpi b/UOS/examples/simpledrums.lpi new file mode 100644 index 0000000..1df8d36 --- /dev/null +++ b/UOS/examples/simpledrums.lpi @@ -0,0 +1,99 @@ +<?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="simpledrums"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <MacroValues Count="1"> + <Macro3 Name="LCLWidgetType" Value="gtk2"/> + </MacroValues> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + <SharedMatrixOptions Count="3"> + <Item1 ID="268150442086" Type="IDEMacro" MacroName="LCLWidgetType" Value="qt5"/> + <Item2 ID="160893005837" Type="IDEMacro" MacroName="LCLWidgetType" Value="qt"/> + <Item3 ID="317647995932" Modes="Default" Type="IDEMacro" MacroName="LCLWidgetType" Value="gtk2"/> + </SharedMatrixOptions> + </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="2"> + <Unit0> + <Filename Value="simpledrums.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main_sd.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="simpledrums"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="units"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <Optimizations> + <OptimizationLevel Value="3"/> + </Optimizations> + <SmallerCode Value="True"/> + </CodeGeneration> + <Linking> + <Debugging> + <GenerateDebugInfo Value="False"/> + </Debugging> + <LinkSmart Value="True"/> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/UOS/examples/simpledrums.lpr b/UOS/examples/simpledrums.lpr new file mode 100644 index 0000000..51d0d9f --- /dev/null +++ b/UOS/examples/simpledrums.lpr @@ -0,0 +1,18 @@ +program simpledrums; + +{$mode objfpc}{$H+} + +uses + // cmem, + {$IFDEF UNIX} + cthreads, + {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, main_sd; + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/UOS/examples/simpledrums.prj b/UOS/examples/simpledrums.prj new file mode 100644 index 0000000..b976de0 --- /dev/null +++ b/UOS/examples/simpledrums.prj @@ -0,0 +1,1362 @@ +[componentpalette] +order0=0 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/simpledrums.prj +findinfiledialog=42 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.inprojectdir] + value=1 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.indirectories] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=1 + "*.pas" "*.pp" "*.inc" + [findinfileadialogfo.dir] + filenames=1 + /home/graemeg/devel/ + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + filehistory=1 + /home/graemeg/devel/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=round( + history=3 + round( + lapAutoAdjustForDPI + + [findinfileadialogfo] + stackedunder= + x=268 + y=415 + cx=339 + cy=251 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=319 + y=205 + cx=312 + cy=114 +replacedialog=15 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=trunc( + history=2 + trunc( + + [replacedialogfo] + stackedunder= + x=142 + y=302 + cx=427 + cy=163 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=726 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=128 + sortdescend4=0 + width5=251 + sortdescend5=0 + width6=296 + sortdescend6=0 + width7=50 + sortdescend7=0 + width8=1 + sortdescend8=0 + width9=297 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=550 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=263 + sortdescend3=0 + width4=277 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=16 + [projectoptionsfo.newfile] + firsttab=0 + index=0 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=389 + width0=98 + sortdescend0=0 + width1=378 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=120 + xprop=1 + yprop=0.23976608187135 + [projectoptionsfo.macrogrid] + propcolwidthref=481 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=465 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=710 + width0=47 + sortdescend0=0 + width1=704 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=621 + width0=112 + sortdescend0=0 + width1=614 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=292 + y=99 + cx=759 + cy=568 +settings=8 + [settings_form] + x=447 + y=148 + cx=471 + cy=446 + wsize=0 + active=1 + visible=1 +mainfile=${PROJECTNAME}.lpr +targetfile=${PROJECTNAME} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=10 + ${lcldir}* + ${lcldir}/* + ${lcldir}/components/BaseUtils + ${lcldir}/lcl/* + ${lcldir}/lcl/interfaces/qt + ${lcldir}/lcl/interfaces/win32 + ${lcldir}/lcl/interfaces/gtk2 + ${lcldir}/lcl/components/* + ${lcldir}/lcl/include + ${lcldir}/lcl +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=9 + -l -Mobjfpc -Sh + -gl + -ghl + -vi + -WG + -B + -O- + -O2 -XX -CX -Xs + -FUunits/ +makeoptpurpose=9 + + + + + + + + + +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}default/program.pas + ${TEMPLATEDIR}default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}default/mainform.pas + ${TEMPLATEDIR}default/simpleform.pas + ${TEMPLATEDIR}default/dockingform.pas + ${TEMPLATEDIR}default/datamodule.pas + ${TEMPLATEDIR}default/subform.pas + ${TEMPLATEDIR}default/scrollboxform.pas + ${TEMPLATEDIR}default/tabform.pas + ${TEMPLATEDIR}default/dockpanelform.pas + ${TEMPLATEDIR}default/report.pas + ${TEMPLATEDIR}default/pascform.pas + ${TEMPLATEDIR}default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}default/mainform.mfm + ${TEMPLATEDIR}default/simpleform.mfm + ${TEMPLATEDIR}default/dockingform.mfm + ${TEMPLATEDIR}default/datamodule.mfm + ${TEMPLATEDIR}default/subform.mfm + ${TEMPLATEDIR}default/scrollboxform.mfm + ${TEMPLATEDIR}default/tabform.mfm + ${TEMPLATEDIR}default/dockpanelform.mfm + ${TEMPLATEDIR}default/report.mfm + ${TEMPLATEDIR}default/pascform.mfm + ${TEMPLATEDIR}default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=0 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612712 +colorwarning=-1610612717 +colornote=-1610612716 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=1 +settingsdebugger=1 +settingsstorage=1 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=9 + 255 + 2 + 4 + 4095 + 240 + 254 + 2 + 511 + 255 +compilerusedon=29 + 4035 + 4 + 8 + 16 + 32 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 4032 + 0 + 0 + 0 + 0 + 63 +exeusedon=14 + 4047 + 0 + 48 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=15:21:42 26/03/2017 +project_comment= +aftcommandon=0 +unitdirson=10 + 987135 + 987135 + 987135 + 987083 + 987087 + 983088 + 983040 + 987135 + 987135 + 987135 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal_ideu.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=4 +linenumberson=1 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=1 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=16 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=1 + 0 +path=1 + /home/fred/uos/examples/main_sd.pas +line=1 + 163 +address=1 + 0 +addbkpt=1 + 0 +ignore=1 + 0 +condition=1 + +panels=1 + panel1 +units= + ( + a=0,8228,6,Pascal Units + ) +cmodules= + ( + a=0,8228,6,C Modules + ) +files= + ( + a=0,8228,6,Text Files + ) +[componentstore] +storedir=/home/fred/msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=100 +x=0 +y=0 +cx=0 +cy=0 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=0 +hintheight=0 +finddtext=round +findhistory=18 + round + round( + InputAddDSPVolum + uos_InputAddDSPVolume + dsplev + inputadddsple + adddsple + AddFromEndlessMuted + playex + AddIntoDevOut + ### + play() + play + firstn + freepl + GetStatus + status + playerno +findoptions=1 +editpos=4 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,27 +bookmarks0=0 +bookmarks1=0 +bookmarks2=0 +bookmarks3=0 +sourcefiles=4 + ${PROJECTDIR}/main_sd.pas + ${PROJECTDIR}/simpledrums.lpr + ${PROJECTDIR}/main_sd.pas + ${PROJECTDIR}/uos_flat.pas +relpaths=4 + main_sd.pas + simpledrums.lpr + main_sd.pas + uos_flat.pas +ismoduletexts=4 + 0 + 0 + 0 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=3 +[layout] +windowlayout=527 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=125 + y=46 + cx=1157 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=493 + y=171 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=444 + y=431 + cx=418 + cy=126 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=205 + cy=456 + rcx=0 + rcy=0 + [projecttreefo.grid] + propcolwidthref=88 + width0=117 + sortdescend0=0 + width1=82 + sortdescend1=0 + sorted=0 + col=1 + row=-1073741823 + rowheight=16 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=423 + y=321 + cx=344 + cy=155 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=memoryfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=316 + y=249 + cx=316 + cy=484 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [objectinspectorfo.grid] + propcolwidthref=306 + width0=136 + sortdescend0=0 + width1=164 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1262 + rcy=583 + [watchfo.grid] + propcolwidthref=111 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268517483 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=513 + cx=1147 + cy=92 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder= + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=240 + y=139 + cx=956 + cy=77 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=0 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1147 + cy=51 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1111 + ncy=52 + x=0 + y=0 + cx=1147 + cy=54 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/uos_flat.pas + history=2 + /home/fred/uos/examples/uos_flat.pas + /home/fred/uos/examples/main_sd.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=0 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=208 + y=0 + cx=939 + cy=456 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=3 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=mainfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302087659 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=54 + cx=1147 + cy=456 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/simpledrums_fpGUI.pas b/UOS/examples/simpledrums_fpGUI.pas new file mode 100644 index 0000000..eab1d2b Binary files /dev/null and b/UOS/examples/simpledrums_fpGUI.pas differ diff --git a/UOS/examples/simpledrums_fpGUI.prj b/UOS/examples/simpledrums_fpGUI.prj new file mode 100644 index 0000000..365bfc5 --- /dev/null +++ b/UOS/examples/simpledrums_fpGUI.prj @@ -0,0 +1,1403 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/simpledrums_fpGUI.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=simpledrums_fpGUI.pas +targetfile=simpledrums_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/simpledrums_fpGUI.pas +relpaths=1 + simpledrums_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/simpledrums_fpGUI.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/simpleplayer.lpi b/UOS/examples/simpleplayer.lpi new file mode 100644 index 0000000..6cf46de --- /dev/null +++ b/UOS/examples/simpleplayer.lpi @@ -0,0 +1,754 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="12"/> + <General> + <Flags> + <CompatibilityMode Value="True"/> + </Flags> + <Title Value="SimplePlayer"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + <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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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="73"> + <Unit0> + <Filename Value="simpleplayer.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="1"/> + <CursorPos X="63" Y="3"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main_sp.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <TopLine Value="256"/> + <CursorPos X="2" Y="265"/> + <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="/usr/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="/usr/lib/codetyphon/lazarus/lcl/graphics.pp"/> + <TopLine Value="1168"/> + <CursorPos X="49" Y="1181"/> + <UsageCount Value="8"/> + </Unit21> + <Unit22> + <Filename Value="/usr/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="-1"/> + <TopLine Value="4810"/> + <CursorPos X="19" Y="4817"/> + <UsageCount Value="100"/> + </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="/usr/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="/usr/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="-1"/> + <CursorPos Y="2"/> + <UsageCount Value="26"/> + </Unit36> + <Unit37> + <Filename Value="simpleplayer_fpGUI.lpr"/> + <TopLine Value="263"/> + <CursorPos X="29" Y="270"/> + <UsageCount Value="11"/> + </Unit37> + <Unit38> + <Filename Value="/media/fred/Windows7/uos/examples/main_sp.pas"/> + <TopLine Value="108"/> + <CursorPos X="37" Y="119"/> + <UsageCount Value="10"/> + </Unit38> + <Unit39> + <Filename Value="uos_soundtouch.pas"/> + <EditorIndex Value="-1"/> + <CursorPos Y="2"/> + <UsageCount Value="17"/> + </Unit39> + <Unit40> + <Filename Value="uos_soundtouchok.pas"/> + <TopLine Value="92"/> + <CursorPos X="40" Y="101"/> + <UsageCount Value="10"/> + </Unit40> + <Unit41> + <Filename Value="../../uos-master/examples/uos.pas"/> + <CursorPos X="66" Y="517"/> + <UsageCount Value="12"/> + </Unit41> + <Unit42> + <Filename Value="../../uos2/src/uos.pas"/> + <TopLine Value="1906"/> + <CursorPos X="38" Y="1917"/> + <UsageCount Value="10"/> + </Unit42> + <Unit43> + <Filename Value="/usr/share/lazarus/1.2RC2/ide/compiler.pp"/> + <TopLine Value="30"/> + <CursorPos X="6" Y="33"/> + <UsageCount Value="10"/> + </Unit43> + <Unit44> + <Filename Value="../../libuos/src/libuos.pas"/> + <TopLine Value="3"/> + <CursorPos X="32" Y="24"/> + <UsageCount Value="16"/> + </Unit44> + <Unit45> + <Filename Value="simpleplayer_fpGUI.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="361"/> + <CursorPos X="24" Y="377"/> + <UsageCount Value="22"/> + </Unit45> + <Unit46> + <Filename Value="../../codetyphon/fpcsrc/rtl/objpas/sysutils/filutilh.inc"/> + <CursorPos X="10" Y="143"/> + <UsageCount Value="11"/> + </Unit46> + <Unit47> + <Filename Value="../../lazarus/fpc/2.6.2/source/rtl/win/sysutils.pp"/> + <UsageCount Value="11"/> + </Unit47> + <Unit48> + <Filename Value="../../lazarus/components/lazutils/fileutil.pas"/> + <TopLine Value="24"/> + <CursorPos X="65" Y="29"/> + <UsageCount Value="11"/> + </Unit48> + <Unit49> + <Filename Value="../../codetyphon/typhon/components/lazutils/fileutil.pas"/> + <TopLine Value="201"/> + <CursorPos X="19" Y="217"/> + <UsageCount Value="10"/> + </Unit49> + <Unit50> + <Filename Value="uos_flat.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="508"/> + <CursorPos X="45" Y="523"/> + <UsageCount Value="23"/> + </Unit50> + <Unit51> + <Filename Value="uos_libsndfile.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="61" Y="11"/> + <UsageCount Value="21"/> + </Unit51> + <Unit52> + <Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/linux/ptypes.inc"/> + <TopLine Value="90"/> + <CursorPos X="5" Y="94"/> + <UsageCount Value="10"/> + </Unit52> + <Unit53> + <Filename Value="../../uoslib/src/uos.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="3417"/> + <CursorPos X="17" Y="3438"/> + <UsageCount Value="10"/> + </Unit53> + <Unit54> + <Filename Value="uos_bs2b.pas"/> + <EditorIndex Value="-1"/> + <CursorPos Y="2"/> + <UsageCount Value="16"/> + </Unit54> + <Unit55> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/inc/systemh.inc"/> + <EditorIndex Value="-1"/> + <TopLine Value="491"/> + <CursorPos X="10" Y="493"/> + <UsageCount Value="10"/> + </Unit55> + <Unit56> + <Filename Value="define.inc"/> + <EditorIndex Value="-1"/> + <CursorPos X="3" Y="19"/> + <UsageCount Value="20"/> + </Unit56> + <Unit57> + <Filename Value="mcwAAC.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="57"/> + <CursorPos X="95" Y="74"/> + <UsageCount Value="10"/> + </Unit57> + <Unit58> + <Filename Value="uos_cdrom.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="11" Y="5"/> + <UsageCount Value="14"/> + </Unit58> + <Unit59> + <Filename Value="uos_aac.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="14" Y="6"/> + <UsageCount Value="15"/> + </Unit59> + <Unit60> + <Filename Value="/usr/local/codetyphon/fpcsrc/packages/cdrom/src/cdrom.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="18"/> + <CursorPos X="13" Y="44"/> + <UsageCount Value="10"/> + </Unit60> + <Unit61> + <Filename Value="/usr/local/codetyphon/fpcsrc/packages/cdrom/src/cdromw32.inc"/> + <EditorIndex Value="-1"/> + <UsageCount Value="10"/> + </Unit61> + <Unit62> + <Filename Value="/usr/local/codetyphon/fpcsrc/packages/cdrom/src/wincd.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="308"/> + <CursorPos X="44" Y="341"/> + <UsageCount Value="10"/> + </Unit62> + <Unit63> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/inc/ctypes.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="38"/> + <CursorPos X="10" Y="71"/> + <UsageCount Value="10"/> + </Unit63> + <Unit64> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/unix/unixtype.pp"/> + <EditorIndex Value="-1"/> + <UsageCount Value="10"/> + </Unit64> + <Unit65> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/unix/aliasctp.inc"/> + <EditorIndex Value="-1"/> + <UsageCount Value="10"/> + </Unit65> + <Unit66> + <Filename Value="uos_httpgetthread.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="18"/> + <CursorPos X="14" Y="27"/> + <UsageCount Value="14"/> + </Unit66> + <Unit67> + <Filename Value="uos_mpg123.pas"/> + <EditorIndex Value="-1"/> + <CursorPos Y="2"/> + <UsageCount Value="14"/> + </Unit67> + <Unit68> + <Filename Value="uos_dsp_noiseremoval.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="168"/> + <CursorPos X="26" Y="177"/> + <UsageCount Value="14"/> + </Unit68> + <Unit69> + <Filename Value="simpleplayer_fpGUI_noflat.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="6" Y="8"/> + <UsageCount Value="10"/> + </Unit69> + <Unit70> + <Filename Value="simplerecorder_fpGUI.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="4" Y="7"/> + <UsageCount Value="10"/> + </Unit70> + <Unit71> + <Filename Value="/usr/local/codetyphon/typhon/components/BaseUtils/lazutf8sysutils.pas"/> + <UnitName Value="LazUTF8SysUtils"/> + <EditorIndex Value="-1"/> + <TopLine Value="10"/> + <CursorPos X="5" Y="29"/> + <UsageCount Value="10"/> + </Unit71> + <Unit72> + <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"/> + <TopLine Value="302"/> + <CursorPos Y="317"/> + <UsageCount Value="10"/> + </Unit72> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="main_sp.pas"/> + <Caret Line="82" Column="23" TopLine="68"/> + </Position1> + <Position2> + <Filename Value="main_sp.pas"/> + <Caret Line="83" Column="23" TopLine="69"/> + </Position2> + <Position3> + <Filename Value="main_sp.pas"/> + <Caret Line="290" Column="46" TopLine="273"/> + </Position3> + <Position4> + <Filename Value="main_sp.pas"/> + <Caret Line="604" Column="19" TopLine="589"/> + </Position4> + <Position5> + <Filename Value="main_sp.pas"/> + <Caret Line="646" Column="22" TopLine="646"/> + </Position5> + <Position6> + <Filename Value="main_sp.pas"/> + <Caret Line="120" TopLine="108"/> + </Position6> + <Position7> + <Filename Value="main_sp.pas"/> + <Caret Line="502" Column="77" TopLine="483"/> + </Position7> + <Position8> + <Filename Value="main_sp.pas"/> + <Caret Line="687" Column="26" TopLine="676"/> + </Position8> + <Position9> + <Filename Value="main_sp.pas"/> + <Caret Line="111" Column="26" TopLine="99"/> + </Position9> + <Position10> + <Filename Value="main_sp.pas"/> + <Caret Line="498" Column="96" TopLine="484"/> + </Position10> + <Position11> + <Filename Value="main_sp.pas"/> + <Caret Line="782" Column="39" TopLine="778"/> + </Position11> + <Position12> + <Filename Value="main_sp.pas"/> + <Caret Line="690" Column="3" TopLine="667"/> + </Position12> + <Position13> + <Filename Value="main_sp.pas"/> + <Caret Line="58" Column="11" TopLine="47"/> + </Position13> + <Position14> + <Filename Value="main_sp.pas"/> + <Caret Line="147" Column="11" TopLine="127"/> + </Position14> + <Position15> + <Filename Value="main_sp.pas"/> + <Caret Line="362" Column="13" TopLine="343"/> + </Position15> + <Position16> + <Filename Value="main_sp.pas"/> + <Caret Line="58" Column="11" TopLine="47"/> + </Position16> + <Position17> + <Filename Value="main_sp.pas"/> + <Caret Line="147" Column="11" TopLine="127"/> + </Position17> + <Position18> + <Filename Value="main_sp.pas"/> + <Caret Line="362" Column="13" TopLine="343"/> + </Position18> + <Position19> + <Filename Value="main_sp.pas"/> + <Caret Line="159" Column="103" TopLine="149"/> + </Position19> + <Position20> + <Filename Value="main_sp.pas"/> + <Caret Line="518" Column="79" TopLine="512"/> + </Position20> + <Position21> + <Filename Value="main_sp.pas"/> + <Caret Line="139" Column="91" TopLine="131"/> + </Position21> + <Position22> + <Filename Value="main_sp.pas"/> + <Caret Line="143" Column="83" TopLine="131"/> + </Position22> + <Position23> + <Filename Value="main_sp.pas"/> + <Caret Line="158" Column="3" TopLine="156"/> + </Position23> + <Position24> + <Filename Value="main_sp.pas"/> + <Caret Line="145" Column="62" TopLine="132"/> + </Position24> + <Position25> + <Filename Value="main_sp.pas"/> + <Caret Line="147" Column="62" TopLine="134"/> + </Position25> + <Position26> + <Filename Value="main_sp.pas"/> + <Caret Line="610" Column="3" TopLine="608"/> + </Position26> + <Position27> + <Filename Value="main_sp.pas"/> + <Caret Line="612" Column="3" TopLine="610"/> + </Position27> + <Position28> + <Filename Value="main_sp.pas"/> + <Caret Line="808" Column="3" TopLine="795"/> + </Position28> + <Position29> + <Filename Value="main_sp.pas"/> + <Caret Line="284" Column="52" TopLine="266"/> + </Position29> + <Position30> + <Filename Value="main_sp.pas"/> + <Caret Line="112" Column="92" TopLine="112"/> + </Position30> + </JumpHistory> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="SimplePlayer"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <Optimizations> + <OptimizationLevel Value="2"/> + </Optimizations> + </CodeGeneration> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf3"/> + <UseExternalDbgSyms Value="True"/> + </Debugging> + </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> diff --git a/UOS/examples/simpleplayer.lpr b/UOS/examples/simpleplayer.lpr new file mode 100644 index 0000000..4dc6193 --- /dev/null +++ b/UOS/examples/simpleplayer.lpr @@ -0,0 +1,22 @@ +program simpleplayer; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} + cthreads, + cwstring, {$ENDIF} + Interfaces, // this includes the LCL widgetset + ctypes, + Forms, + main_sp { you can add units after this }; + +begin + Application.Title:='SimplePlayer'; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + + diff --git a/UOS/examples/simpleplayer.prj b/UOS/examples/simpleplayer.prj new file mode 100644 index 0000000..1b0e32c --- /dev/null +++ b/UOS/examples/simpleplayer.prj @@ -0,0 +1,1397 @@ +[componentpalette] +order0=0 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos_xmp/examples +projectfilename=/home/fred/uos_xmp/examples/simpleplayer.prj +findinfiledialog=59 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" "*.*" + history=2 + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/espeak-ng-master/ + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + filehistory=4 + /home/fred/espeak-ng-master/ + /home/fred/espeak-1.48.04-source/ + /usr/local/codetyphon/ + /home/graemeg/devel/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" "*.*" + [findinfileadialogfo.findtext] + value=application_name + history=16 + application_name + create_audio_device_object + option_device + loadlib + loadlibrary + portaudio + if (out_samplerate != 0) + out_samplerate + Jonathan Duddington + pcaudiolib + windres + resbin + fpcres + uos_AddIntoDevOut + lapAutoAdjustForDPI + + [findinfileadialogfo] + stackedunder= + x=241 + y=281 + cx=341 + cy=276 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=655 + y=516 + cx=312 + cy=291 +replacedialog=15 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=// + history=2 + // + + [replacedialogfo] + stackedunder= + x=447 + y=253 + cx=389 + cy=216 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=708 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=125 + sortdescend4=0 + width5=245 + sortdescend5=0 + width6=289 + sortdescend6=0 + width7=49 + sortdescend7=0 + width8=1 + sortdescend8=0 + width9=290 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=563 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=270 + sortdescend3=0 + width4=284 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=19 + [projectoptionsfo.newfile] + firsttab=0 + index=0 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=389 + width0=98 + sortdescend0=0 + width1=378 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=118 + xprop=1 + yprop=0.23960396039604 + [projectoptionsfo.macrogrid] + propcolwidthref=481 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=465 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=699 + width0=47 + sortdescend0=0 + width1=693 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=734 + width0=112 + sortdescend0=0 + width1=727 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=341 + y=68 + cx=759 + cy=568 +settings=8 + [settings_form] + x=447 + y=138 + cx=482 + cy=724 + wsize=0 + active=1 + visible=1 +mainfile=${PROJECTNAME}.lpr +targetfile=${PROJECTNAME}${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=9 + ${lcldir}* + ${lcldir}/components/* + ${lcldir}/* + ${lcldir}/lcl/* + ${lcldir}/lcl/interfaces/* + ${lcldir}/lcl/interfaces/gtk2 + ${lcldir}/lcl/components/* + ${lcldir}/lcl/include + ${lcldir}/lcl +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=8 + -l -Mobjfpc -Sh + -gl + -ghl + -B + -O- + -O2 -XX -CX -Xs + -vi + -FUunits +makeoptpurpose=8 + + + + + + + + +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}default/program.pas + ${TEMPLATEDIR}default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}default/mainform.pas + ${TEMPLATEDIR}default/simpleform.pas + ${TEMPLATEDIR}default/dockingform.pas + ${TEMPLATEDIR}default/datamodule.pas + ${TEMPLATEDIR}default/subform.pas + ${TEMPLATEDIR}default/scrollboxform.pas + ${TEMPLATEDIR}default/tabform.pas + ${TEMPLATEDIR}default/dockpanelform.pas + ${TEMPLATEDIR}default/report.pas + ${TEMPLATEDIR}default/pascform.pas + ${TEMPLATEDIR}default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}default/mainform.mfm + ${TEMPLATEDIR}default/simpleform.mfm + ${TEMPLATEDIR}default/dockingform.mfm + ${TEMPLATEDIR}default/datamodule.mfm + ${TEMPLATEDIR}default/subform.mfm + ${TEMPLATEDIR}default/scrollboxform.mfm + ${TEMPLATEDIR}default/tabform.mfm + ${TEMPLATEDIR}default/dockpanelform.mfm + ${TEMPLATEDIR}default/report.mfm + ${TEMPLATEDIR}default/pascform.mfm + ${TEMPLATEDIR}default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=0 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=1 +settingsdebugger=1 +settingsstorage=1 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=8 + 127 + 2 + 0 + 67 + 2 + 61 + 4095 + 4095 +compilerusedon=29 + 4020 + 11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3840 + 0 + 0 + 0 + 0 + 127 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=15:21:42 26/03/2017 +project_comment= +aftcommandon=0 +unitdirson=9 + 987135 + 987135 + 987135 + 987135 + 987008 + 987079 + 987135 + 987135 + 987135 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal_ideu.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=4 +linenumberson=1 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=1 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=16 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=0 +path=0 +line=0 +address=0 +addbkpt=0 +ignore=0 +condition=0 +panels=1 + panel1 +units= + ( + a=0,8228,6,Pascal Units + ) +cmodules= + ( + a=0,8228,6,C Modules + ) +files= + ( + a=0,8228,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=100 +x=0 +y=0 +cx=0 +cy=0 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=0 +hintheight=0 +finddtext=loadlib +findhistory=20 + loadlib + LoadLibrary + /// + //// + ///// + ////// + /////// + //////// + ///////// + ////////// + /////////// + //////////// + showlevel + showpos + LoopProcPlayer1 + clong + uos_Addfrom + uos_AddInto + application_name + option_device +findoptions=1 +editpos=1 + 0,7 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/simpleplayer.lpr +relpaths=1 + simpleplayer.lpr +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=567 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=125 + y=46 + cx=1157 + cy=621 + rcx=0 + rcy=0 + wsize=6 + active=1 + visible=1 + [findmessagefo.findtext] + value=mysqldyn + history=2 + mysqldyn + linux + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=493 + y=171 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=1 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=444 + y=431 + cx=418 + cy=126 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=205 + cy=620 + rcx=0 + rcy=0 + [projecttreefo.grid] + propcolwidthref=88 + width0=117 + sortdescend0=0 + width1=86 + sortdescend1=0 + sorted=0 + col=1 + row=-1073741823 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=423 + y=321 + cx=344 + cy=155 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=468 + width0=207 + sortdescend0=0 + width1=255 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1262 + rcy=583 + [watchfo.grid] + propcolwidthref=111 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268517483 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=684 + cx=1427 + cy=136 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=confdebuggerfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=240 + y=139 + cx=956 + cy=77 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=0 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1427 + cy=58 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1427 + ncy=51 + x=0 + y=0 + cx=1427 + cy=51 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos_xmp/examples/mainmse_sp.pas + history=50 + /home/fred/uos_xmp/examples/mainmse_sp.pas + /home/fred/uos_xmp/examples/uos_flat.pas + /home/fred/uos_xmp/examples/uos.pas + /home/fred/gme_pas_work/gme_test_console/libgme.pas + /home/fred/Downloads/project1_xmp_win_lin/unit1.pas + /home/fred/gme_pas_work/gme_test_console/gmetest.pas + /home/fred/Downloads/project1_gme_win_lin/gme.pas + /home/fred/Downloads/project1_gme_win_lin/unit1.pas + /home/fred/Downloads/project1_xmp_win_lin/project1.lpr + /home/fred/uos_xmp/examples/uos_libxmp.pas + /home/fred/xmp_test/libxmp.pas + /home/fred/tron/project1_gme_win_lin/gme.pas + /home/fred/uos_xmp/examples/main_sp.pas + /home/fred/tron/project1_gme_win_lin/project1.lpr + /home/fred/tron/project1/gme.pas + /home/fred/tron/project1/unit1.pas + /home/fred/tron/project1/project1.prj + /home/fred/tron/project1/project1.lpr + /home/fred/uos/src/uos_libsndfile.pas + /home/fred/uos/src/uos_portaudio.pas + /home/fred/xmp_test/xmptest.prj + /home/fred/xmp_test/xmptest.pas + /home/fred/Downloads/apngopt-1.4-src/apngopt.cpp + /home/fred/SimpleWebStreamer/uos_soundtouch.pas + /home/fred/strumpract_work/src/msefiledialogx.pas + /home/fred/strumpract/src/msefiledialogx.pas + /home/fred/strumpract/src/splash.pas + /home/fred/strumpract/src/uos_flat.pas + /home/fred/strumpract/src/infosd.pas + /home/fred/SimpleWebStreamer/uos.pas + /home/fred/SimpleWebStreamer/uos_httpgetthread.pas + /home/fred/SimpleWebStreamer/uos_define.inc + /home/fred/SimpleWebStreamer/simplewebplayer.prj + /home/fred/SimpleWebStreamer/simplewebplayer.pas + /home/fred/strumpract/src/drums.pas + /home/fred/strumpract/src/waveform.pas + /home/fred/Downloads/sinewave/sine.pas + /home/fred/strumpract/src/uos_define.inc + /home/fred/mseide-msegui/lib/common/kernel/mselibc.pas + /home/fred/mseide-msegui/lib/common/kernel/linux/msesysintf.pas + /home/fred/mseide-msegui/lib/common/kernel/mseclasses.pas + /home/fred/mseide-msegui/lib/common/kernel/msectypes.pas + /home/fred/strumpract/src/aboutform.pas + /home/fred/freepascal-ootb/compiler/systems/t_bsd.pas + /home/fred/Downloads/freepascal-ootb-main/compiler/systems/t_bsd.pas + /home/fred/Downloads/freepascal-ootb-main/rtl/freebsd/x86_64/si_c.inc + /home/fred/Downloads/freepascal-ootb-main/rtl/openbsd/si_dll.pp + /home/fred/Downloads/freepascal-ootb-main/rtl/openbsd/si_c.pp + /home/fred/Downloads/freepascal-ootb-main/rtl/openbsd/x86_64/si_c.inc + /home/fred/Downloads/freepascal-ootb-main/rtl/openbsd/x86_64/openbsd_ident.inc + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=0 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=208 + y=0 + cx=1219 + cy=620 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302087659 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=61 + cx=1427 + cy=620 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/simpleplayer_fpGUI.lpi b/UOS/examples/simpleplayer_fpGUI.lpi new file mode 100644 index 0000000..af56411 --- /dev/null +++ b/UOS/examples/simpleplayer_fpGUI.lpi @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="10"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasTitleStatement Value="False"/> + <LRSInOutputDirectory Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="UOS Simple Player fpGUI"/> + <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="2"> + <Unit0> + <Filename Value="simpleplayer_fpGUI.pas"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uos.pas"/> + <IsPartOfProject Value="True"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="SimplePlayer_FPG"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <Optimizations> + <OptimizationLevel Value="3"/> + </Optimizations> + <SmallerCode Value="True"/> + </CodeGeneration> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf3"/> + <StripSymbols Value="True"/> + <UseExternalDbgSyms Value="True"/> + </Debugging> + <LinkSmart Value="True"/> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <WriteFPCLogo Value="False"/> + <CustomOptions Value="-FUunits"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/UOS/examples/simpleplayer_fpGUI.pas b/UOS/examples/simpleplayer_fpGUI.pas new file mode 100644 index 0000000..2353467 --- /dev/null +++ b/UOS/examples/simpleplayer_fpGUI.pas @@ -0,0 +1,1461 @@ + +program simpleplayer_fpGUI; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + cthreads, + cwstring, {$ENDIF} {$ENDIF} + SysUtils, + uos_flat, + ctypes, + Classes, + fpg_style_chrome_silver_flatmenu, + fpg_stylemanager, + fpg_button, + fpg_widget, + fpg_label, + fpg_Editbtn, + fpg_RadioButton, + fpg_trackbar, + fpg_CheckBox, + fpg_Panel, + fpg_base, + fpg_main, + fpg_form; + +type + TSimpleplayer = class(TfpgForm) + procedure uos_logo(Sender: TObject); + private + {@VFD_HEAD_BEGIN: Simpleplayer} + Custom1: TfpgWidget; + Labelport: TfpgLabel; + btnLoad: TfpgButton; + FilenameEdit1: TfpgFileNameEdit; + FilenameEdit2: TfpgFileNameEdit; + Labelsnf: TfpgLabel; + Labelmpg: TfpgLabel; + Labelst11: TfpgLabel; + FilenameEdit7: TfpgFileNameEdit; + Labelst111: TfpgLabel; + FilenameEdit8: TfpgFileNameEdit; + Labelst11111: TfpgLabel; + FilenameEdit31: TfpgFileNameEdit; + Labelst: TfpgLabel; + FilenameEdit3: TfpgFileNameEdit; + FilenameEdit5: TfpgFileNameEdit; + Labelst1: TfpgLabel; + FilenameEdit6: TfpgFileNameEdit; + Panel1: TfpgPanel; + FilenameEdit4: TfpgFileNameEdit; + btnStart: TfpgButton; + btnStop: TfpgButton; + lposition: TfpgLabel; + Label1: TfpgLabel; + 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; + vuleft: TfpgPanel; + vuright: TfpgPanel; + CheckBox2: TfpgCheckBox; + Label6: TfpgLabel; + Label7: TfpgLabel; + TrackBar4: TfpgTrackBar; + TrackBar5: TfpgTrackBar; + Button1: TfpgButton; + chkst2b: TfpgCheckBox; + chkstereo2mono: TfpgCheckBox; + {@VFD_HEAD_END: Simpleplayer} + public + procedure AfterCreate; override; + // constructor Create(AOwner: TComponent); + procedure btnLoadClick(Sender: TObject); + procedure btnCloseClick(Sender: TObject); + procedure btnStartClick(Sender: TObject); + procedure btnStopClick(Sender: TObject); + procedure btnPauseClick(Sender: TObject); + procedure btnResumeClick(Sender: TObject); + procedure btnTrackOnClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + procedure btnTrackOffClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + {$else} + procedure CustomMsgReceived(var msg: TfpgMessageRec); message MSG_CUSTOM1; + {$ENDIF} + procedure ClosePlayer1; + procedure LoopProcPlayer1; + procedure ShowPosition; + procedure ShowLevel; + procedure changecheck(Sender: TObject); + procedure VolumeChange(Sender: TObject; pos: integer); + procedure ChangeStereo2Mono(Sender: TObject); + procedure ChangePlugSetSoundTouch(Sender: TObject); + procedure ChangePlugSetbs2b(Sender: TObject); + procedure TrackChangePlugSetSoundTouch(Sender: TObject; pos: integer); + procedure ResetPlugClick(Sender: TObject); + end; + + {@VFD_NEWFORM_DECL} + + {@VFD_NEWFORM_IMPL} + +var + PlayerIndex1: integer; + ordir, opath: string; + OutputIndex1, InputIndex1, DSPIndex1, DSPIndex2, PluginIndex1, PluginIndex2, PluginIndex3: integer; + plugsoundtouch: Boolean = False; + plugbs2b: Boolean = False; + + procedure TSimpleplayer.btnTrackOnClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + begin + TrackBar1.Tag := 1; + end; + + procedure TSimpleplayer.ChangePlugSetBs2b(Sender: TObject); + begin + uos_SetPluginBs2b(PlayerIndex1, PluginIndex1, -1, -1, -1, chkst2b.Checked); + end; + + procedure TSimpleplayer.Changestereo2mono(Sender: TObject); + begin + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex2, chkstereo2mono.Checked); + end; + + procedure TSimpleplayer.ChangePlugSetSoundTouch(Sender: TObject); + var + tempo, rate: cfloat; + begin + if (trim(PChar(filenameedit5.FileName)) <> '') and fileexists(filenameedit5.FileName) then + begin + if 2 - (2 * (TrackBar4.Position / 100)) < 0.3 then + tempo := 0.3 + else + tempo := 2 - (2 * (TrackBar4.Position / 100)); + if 2 - (2 * (TrackBar5.Position / 100)) < 0.3 then + rate := 0.3 + else + rate := 2 - (2 * (TrackBar5.Position / 100)); + + label6.Text := 'Tempo: ' + floattostrf(tempo, ffFixed, 15, 1); + label7.Text := 'Pitch: ' + floattostrf(rate, ffFixed, 15, 1); + + uos_SetPluginSoundTouch(PlayerIndex1, PluginIndex2, tempo, rate, checkbox2.Checked); + end; + + end; + + procedure TSimpleplayer.ResetPlugClick(Sender: TObject); + begin + TrackBar4.Position := 50; + TrackBar5.Position := 50; + + uos_SetPluginSoundTouch(PlayerIndex1, PluginIndex2, 1, 1, checkbox2.Checked); + + end; + + procedure TSimpleplayer.TrackChangePlugSetSoundTouch(Sender: TObject; pos: integer); + begin + if (trim(PChar(filenameedit5.FileName)) <> '') and fileexists(filenameedit5.FileName) then + ChangePlugSetSoundTouch(Sender); + end; + + procedure TSimpleplayer.btnTrackoffClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + begin + uos_InputSeek(PlayerIndex1, InputIndex1, TrackBar1.position); + TrackBar1.Tag := 0; + end; + + procedure TSimpleplayer.btnResumeClick(Sender: TObject); + begin + uos_RePlay(PlayerIndex1); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := True; + btnresume.Enabled := False; + end; + + procedure TSimpleplayer.btnPauseClick(Sender: TObject); + begin + uos_Pause(PlayerIndex1); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := False; + btnresume.Enabled := True; + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + end; + + procedure TSimpleplayer.changecheck(Sender: TObject); + begin + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex1, checkbox1.Checked); + + end; + + procedure TSimpleplayer.VolumeChange(Sender: TObject; pos: integer); + begin + + { + uos_InputSetDSPVolume(PlayerIndex1, InputIndex1, + (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); + } + + uos_OutputSetDSPVolume(PlayerIndex1, OutputIndex1, + (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); + end; + + procedure TSimpleplayer.ShowLevel; + begin + vuLeft.Visible := True; + vuRight.Visible := True; + if round(uos_InputGetLevelLeft(PlayerIndex1, InputIndex1) * 74) >= 0 then + vuLeft.Height := round(uos_InputGetLevelLeft(PlayerIndex1, InputIndex1) * 74); + if round(uos_InputGetLevelRight(PlayerIndex1, InputIndex1) * 74) >= 0 then + vuRight.Height := round(uos_InputGetLevelRight(PlayerIndex1, InputIndex1) * 74); + vuLeft.top := 96 - vuLeft.Height; + vuRight.top := 96 - vuRight.Height; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + // writeln('BPM ' + floattostr(uos_InputGetBPM(PlayerIndex1, InputIndex1))); + end; + + procedure TSimpleplayer.btnCloseClick(Sender: TObject); + begin + if (btnstart.Enabled = False) then + begin + uos_stop(PlayerIndex1); + sleep(100); + end; + uos_free(); + end; + + procedure TSimpleplayer.btnLoadClick(Sender: TObject); + var + loadok: Boolean = False; + begin + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + +{$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, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + + if uos_LoadLib(PChar(FilenameEdit1.FileName), PChar(FilenameEdit2.FileName), + PChar(FilenameEdit3.FileName), PChar(FilenameEdit7.FileName), PChar(FilenameEdit8.FileName), + PChar(FilenameEdit31.FileName), nil) = 0 then + begin + hide; + loadok := True; + Height := 208; + panel1.Height := Height; + panel1.Width := Width; + panel1.left := 0; + panel1.top := 0; + panel1.Visible := True; + btnStart.Enabled := True; + btnLoad.Enabled := False; + FilenameEdit1.ReadOnly := True; + FilenameEdit2.ReadOnly := True; + FilenameEdit3.ReadOnly := True; + FilenameEdit5.ReadOnly := True; + FilenameEdit6.ReadOnly := True; + FilenameEdit7.ReadOnly := True; + FilenameEdit8.ReadOnly := True; + FilenameEdit31.ReadOnly := True; + UpdateWindowPosition; + btnLoad.Text := + 'PortAudio, SndFile, Mpg123, AAC, Opus libraries are loaded...'; + end + else + btnLoad.Text := + 'One or more libraries did not load, check filenames...'; + + if loadok = True then + begin + if ((trim(PChar(filenameedit5.FileName)) <> '') and fileexists(filenameedit5.FileName)) then + if (uos_LoadPlugin('soundtouch', PChar(FilenameEdit5.FileName)) = 0) then + begin + plugsoundtouch := True; + btnLoad.Text := + 'PortAudio, SndFile, Mpg123, AAC, Opus and Plugin are loaded...'; + end + else + begin + TrackBar4.Enabled := False; + TrackBar5.Enabled := False; + CheckBox2.Enabled := False; + Button1.Enabled := False; + label6.Enabled := False; + label7.Enabled := False; + end; + + if ((trim(PChar(filenameedit6.FileName)) <> '') and fileexists(filenameedit6.FileName)) then + if (uos_LoadPlugin('bs2b', PChar(FilenameEdit6.FileName)) = 0) then + plugbs2b := True + else + chkst2b.Enabled := False; + + + WindowPosition := wpScreenCenter; + WindowTitle := 'Simple Player. uos Version ' + IntToStr(uos_getversion()); + + fpgapplication.ProcessMessages; + sleep(100); + Show; + end; + end; + + procedure TSimpleplayer.ClosePlayer1; + begin + radiobutton1.Enabled := True; + radiobutton2.Enabled := True; + radiobutton3.Enabled := True; + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + btnStart.Enabled := True; + btnPause.Enabled := False; + btnresume.Enabled := False; + trackbar1.Position := 0; + lposition.Text := '00:00:00.000'; + fpgapplication.ProcessMessages; + btnStop.Enabled := False; + end; + + procedure TSimpleplayer.btnStopClick(Sender: TObject); + begin + uos_Stop(PlayerIndex1); + end; + + ///// example how to do custom dsp + + function DSPReverseBefore(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; + begin + + if (Data.position > Data.OutFrames div Data.channels) then + uos_InputSeek(PlayerIndex1, InputIndex1, Data.position - + (Data.OutFrames div Data.channels)); + end; + + function DSPReverseAfter(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; + var + x: integer = 0; + arfl: TDArFloat; + begin + if (Data.position > Data.OutFrames div Data.channels) then + begin + SetLength(arfl, Data.outframes); + + while x < Data.outframes - 1 do + begin + arfl[x] := Data.Buffer[Data.outframes - x - 1]; + arfl[x + 1] := Data.Buffer[Data.outframes - x]; + x := x + 2; + end; + Result := arfl; + end + else + Result := Data.Buffer; + end; + + /// WARNING: This is only to show a DSP effect, it is not the best reverb it exists ;-) +{ + function DSPReverb(Data: TuosF_Data; fft: TuosF_FFT): TDArFloat; + var + x: integer = 0; + arfl: TDArFloat; + begin + SetLength(arfl, length(Data.Buffer)); + while x < length(Data.Buffer) do + begin + if x > 10000 then + begin + arfl[x] := Data.Buffer[x] + (Data.Buffer[x-10000] / 2); + arfl[x+1] := Data.Buffer[x+1] + (Data.Buffer[x+1-10000] / 2); + end else + begin + arfl[x] := Data.Buffer[x] ; + arfl[x+1] := Data.Buffer[x+1]; + end; + x := x + 2; + end; + Result := arfl; + end; +} + + function DSPStereo2Mono(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; + var + x: integer = 0; + ps: PDArShort; //////// if input is Int16 format + pl: PDArLong; //////// if input is Int32 format + pf: PDArFloat; //////// if input is Float32 format + samplef: cFloat; + samplei: integer; + begin + if (Data.channels = 2) then + begin + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + while x < Data.OutFrames do + begin + samplei := round((ps^[x] + ps^[x + 1]) / 2); + ps^[x] := samplei; + ps^[x + 1] := samplei; + x := x + 2; + end; + end; + + 1: + begin + pl := @Data.Buffer; + while x < Data.OutFrames do + begin + samplei := round((pl^[x] + pl^[x + 1]) / 2); + pl^[x] := samplei; + pl^[x + 1] := samplei; + x := x + 2; + end; + end; + + 0: + begin + pf := @Data.Buffer; + while x < Data.OutFrames do + begin + samplef := (pf^[x] + pf^[x + 1]) / 2; + pf^[x] := samplef; + pf^[x + 1] := samplef; + x := x + 2; + end; + end; + + end; + Result := Data.Buffer; + end + else + Result := Data.Buffer; + end; + + procedure TSimpleplayer.btnStartClick(Sender: TObject); + var + samformat: shortint; + temptime: ttime; + ho, mi, se, ms: word; + begin + + if radiobutton1.Checked = True then + samformat := 0; + if radiobutton2.Checked = True then + samformat := 1; + if radiobutton3.Checked = True then + samformat := 2; + + radiobutton1.Enabled := False; + radiobutton2.Enabled := False; + radiobutton3.Enabled := False; + + InputIndex1 := -1; + 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(Windows)} + if uos_CreatePlayer(PlayerIndex1) then + {$else} + if uos_CreatePlayer(PlayerIndex1,self) then + {$endif} + //// Create the player. + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + InputIndex1 := uos_AddFromFile(PlayerIndex1, PChar(filenameEdit4.filename), -1, + samformat, -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 div channels) + // result : -1 nothing created, otherwise Input Index in array + + if InputIndex1 > -1 then + begin + + // OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1) ; + //// add a Output into device with default parameters + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, -1, -1); + {$else} + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, -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) /// here default samplerate of input + //////////// 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) + // result : -1 nothing created, otherwise Output Index in array + + uos_InputSetLevelEnable(PlayerIndex1, InputIndex1, 2); + ///// set calculation of level/volume (usefull for showvolume procedure) + ///////// set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + // 3 => calcul before and after all DSP procedures. + + uos_InputSetPositionEnable(PlayerIndex1, InputIndex1, 1); + ///// set calculation of position (usefull for positions procedure) + ///////// set position calculation (default is 0) + // 0 => no calcul + // 1 => calcul position. + + uos_LoopProcIn(PlayerIndex1, InputIndex1, @LoopProcPlayer1); + ///// Assign the procedure of object to execute inside the loop + //////////// PlayerIndex : Index of a existing Player + //////////// InputIndex1 : Index of a existing Input + //////////// LoopProcPlayer1 : procedure of object to execute inside the loop + + + uos_OutputAddDSPVolume(PlayerIndex1, OutputIndex1, 1, 1); + ///// DSP Volume changer + ////////// PlayerIndex1 : Index of a existing Player + ////////// OutputIndex1 : Index of a existing output + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + + uos_OutputSetDSPVolume(PlayerIndex1, OutputIndex1, + (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); + /// Set volume + ////////// PlayerIndex1 : Index of a existing Player + ////////// OutputIndex1 : InputIndex of a existing Output + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + ////////// Enable : Enabled + + DSPIndex1 := uos_InputAddDSP(PlayerIndex1, InputIndex1, @DSPReverseBefore, @DSPReverseAfter, nil, nil); + ///// add a custom DSP procedure for input + ////////// PlayerIndex1 : Index of a existing Player + ////////// InputIndex1: InputIndex of existing input + ////////// BeforeFunc : function to do before the buffer is filled + ////////// AfterFunc : function to do after the buffer is filled + ////////// EndedFunc : function to do at end of thread + ////////// LoopProc : external procedure to do after the buffer is filled + + //// set the parameters of custom DSP + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex1, checkbox1.Checked); + + // This is a other custom DSP...stereo to mono to show how to do a DSP ;-) + DSPIndex2 := uos_InputAddDSP(PlayerIndex1, InputIndex1, nil, @DSPStereo2Mono, nil, nil); + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex2, chkstereo2mono.Checked); + + ///// add bs2b plugin with samplerate_of_input1 / default channels (2 = stereo) + if plugbs2b = True then + begin + PlugInIndex1 := uos_AddPlugin(PlayerIndex1, 'bs2b', + uos_InputGetSampleRate(PlayerIndex1, InputIndex1), -1); + uos_SetPluginbs2b(PlayerIndex1, PluginIndex1, -1, -1, -1, chkst2b.Checked); + end; + + if plugsoundtouch = True then + begin + { + PluginIndex3 := uos_AddPlugin(PlayerIndex1, 'getbpm', + uos_InputGetSampleRate(PlayerIndex1, InputIndex1) , -1); + uos_SetPluginGetBPM(PlayerIndex1, PluginIndex3, 20, true, checkbox2.Checked); + } + /// add SoundTouch plugin with samplerate of input1 / default channels (2 = stereo) + /// SoundTouch plugin should be the last added. + PlugInIndex2 := uos_AddPlugin(PlayerIndex1, 'soundtouch', + uos_InputGetSampleRate(PlayerIndex1, InputIndex1), -1); + ChangePlugSetSoundTouch(self); //// custom procedure to Change plugin settings + + end; + + trackbar1.Max := uos_InputLength(PlayerIndex1, InputIndex1); + + ////// Length of Input in samples + + temptime := uos_InputLengthTime(PlayerIndex1, InputIndex1); + ////// Length of input in time + + DecodeTime(temptime, ho, mi, se, ms); + + llength.Text := format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); + + /////// procedure to execute when stream is terminated + 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 general loop + + TrackBar1.position := 0; + trackbar1.Enabled := True; + CheckBox1.Enabled := True; + + btnStop.Enabled := True; + btnpause.Enabled := True; + btnresume.Enabled := False; + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets play it... + + end; + + end; + + procedure TSimpleplayer.ShowPosition; + var + temptime: ttime; + ho, mi, se, ms: word; + begin + if (TrackBar1.Tag = 0) then + if uos_InputPosition(PlayerIndex1, InputIndex1) > 0 then + begin + TrackBar1.Position := uos_InputPosition(PlayerIndex1, InputIndex1); + temptime := uos_InputPositionTime(PlayerIndex1, InputIndex1); + ////// Length of input in time + DecodeTime(temptime, ho, mi, se, ms); + lposition.Text := format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); + end; + end; + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + {$else} + procedure TSimpleplayer.CustomMsgReceived(var msg: TfpgMessageRec); + begin + ShowLevel; + ShowPosition ; + end; + + {$ENDIF} + + procedure TSimpleplayer.LoopProcPlayer1; + begin + ShowPosition; + ShowLevel; + end; + + procedure TSimpleplayer.AfterCreate; + begin + {%region 'Auto-generated GUI code' -fold} + + + {@VFD_BODY_BEGIN: Simpleplayer} + Name := 'Simpleplayer'; + SetPosition(593, 132, 513, 364); + WindowTitle := 'Simple player '; + IconName := ''; + BackGroundColor := $80000001; + Sizeable := False; + Hint := ''; + WindowPosition := wpScreenCenter; + Ondestroy := @btnCloseClick; + + Custom1 := TfpgWidget.Create(self); + with Custom1 do + begin + Name := 'Custom1'; + SetPosition(10, 16, 115, 307); + OnPaint := @uos_logo; + end; + + Labelport := TfpgLabel.Create(self); + with Labelport do + begin + Name := 'Labelport'; + SetPosition(136, -4, 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(8, 334, 488, 24); + 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, 12, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 3; + end; + + FilenameEdit2 := TfpgFileNameEdit.Create(self); + with FilenameEdit2 do + begin + Name := 'FilenameEdit2'; + SetPosition(136, 52, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 4; + end; + + Labelsnf := TfpgLabel.Create(self); + with Labelsnf do + begin + Name := 'Labelsnf'; + SetPosition(140, 36, 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, 76, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of Mpg123 Library'; + Hint := ''; + end; + + Labelst11 := TfpgLabel.Create(self); + with Labelst11 do + begin + Name := 'Labelst11'; + SetPosition(136, 116, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of mp4ff Library'; + end; + + FilenameEdit7 := TfpgFileNameEdit.Create(self); + with FilenameEdit7 do + begin + Name := 'FilenameEdit7'; + SetPosition(136, 132, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 44; + end; + + Labelst111 := TfpgLabel.Create(self); + with Labelst111 do + begin + Name := 'Labelst111'; + SetPosition(138, 156, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of Faad Library'; + end; + + FilenameEdit8 := TfpgFileNameEdit.Create(self); + with FilenameEdit8 do + begin + Name := 'FilenameEdit8'; + SetPosition(136, 172, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 46; + end; + + Labelst11111 := TfpgLabel.Create(self); + with Labelst11111 do + begin + Name := 'Labelst11111'; + SetPosition(176, 196, 292, 15); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of OpusFile Library'; + end; + + FilenameEdit31 := TfpgFileNameEdit.Create(self); + with FilenameEdit31 do + begin + Name := 'FilenameEdit31'; + SetPosition(136, 213, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 49; + end; + + Labelst := TfpgLabel.Create(self); + with Labelst do + begin + Name := 'Labelst'; + SetPosition(152, 240, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of SoundTouch plugin Library'; + Hint := ''; + end; + + FilenameEdit3 := TfpgFileNameEdit.Create(self); + with FilenameEdit3 do + begin + Name := 'FilenameEdit3'; + SetPosition(136, 92, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 12; + end; + + FilenameEdit5 := TfpgFileNameEdit.Create(self); + with FilenameEdit5 do + begin + Name := 'FilenameEdit5'; + SetPosition(136, 256, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 12; + end; + + Labelst1 := TfpgLabel.Create(self); + with Labelst1 do + begin + Name := 'Labelst1'; + SetPosition(142, 284, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of bs2b plugin Library'; + end; + + FilenameEdit6 := TfpgFileNameEdit.Create(self); + with FilenameEdit6 do + begin + Name := 'FilenameEdit6'; + SetPosition(136, 300, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 40; + end; + + Panel1 := TfpgPanel.Create(self); + with Panel1 do + begin + Name := 'Panel1'; + SetPosition(4, 396, 512, 208); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := ''; + Visible := False; + Hint := ''; + end; + + FilenameEdit4 := TfpgFileNameEdit.Create(Panel1); + with FilenameEdit4 do + begin + Name := 'FilenameEdit4'; + SetPosition(140, 12, 360, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 5; + end; + + btnStart := TfpgButton.Create(Panel1); + with btnStart do + begin + Name := 'btnStart'; + SetPosition(152, 176, 66, 23); + Text := 'Play'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 6; + Hint := ''; + onclick := @btnstartClick; + end; + + btnStop := TfpgButton.Create(Panel1); + with btnStop do + begin + Name := 'btnStop'; + SetPosition(380, 176, 66, 23); + Text := 'Stop'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 7; + Hint := ''; + onclick := @btnStopClick; + end; + + lposition := TfpgLabel.Create(Panel1); + with lposition do + begin + Name := 'lposition'; + SetPosition(232, 69, 84, 19); + Alignment := taCenter; + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := '00:00:00.000'; + Hint := ''; + end; + + Label1 := TfpgLabel.Create(Panel1); + with Label1 do + begin + Name := 'Label1'; + SetPosition(316, 69, 12, 15); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := '/'; + Hint := ''; + end; + + Llength := TfpgLabel.Create(Panel1); + with Llength do + begin + Name := 'Llength'; + SetPosition(324, 69, 80, 15); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := '00:00:00.000'; + Hint := ''; + end; + + btnpause := TfpgButton.Create(Panel1); + with btnpause do + begin + Name := 'btnpause'; + SetPosition(228, 176, 66, 23); + Text := 'Pause'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 15; + Hint := ''; + onclick := @btnPauseClick; + end; + + btnresume := TfpgButton.Create(Panel1); + with btnresume do + begin + Name := 'btnresume'; + SetPosition(304, 176, 66, 23); + Text := 'Resume'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 16; + Hint := ''; + onclick := @btnResumeClick; + end; + + CheckBox1 := TfpgCheckBox.Create(Panel1); + with CheckBox1 do + begin + Name := 'CheckBox1'; + SetPosition(144, 148, 104, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 17; + Text := 'Play Reverse'; + Hint := ''; + onchange := @changecheck; + end; + + RadioButton1 := TfpgRadioButton.Create(Panel1); + with RadioButton1 do + begin + Name := 'RadioButton1'; + SetPosition(24, 140, 96, 19); + BackgroundColor := TfpgColor($68A7D3A8); + Checked := True; + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 18; + Text := 'Float 32 bit'; + Hint := ''; + end; + + RadioButton2 := TfpgRadioButton.Create(Panel1); + with RadioButton2 do + begin + Name := 'RadioButton2'; + SetPosition(24, 156, 100, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 19; + Text := 'Int 32 bit'; + Hint := ''; + end; + + RadioButton3 := TfpgRadioButton.Create(Panel1); + with RadioButton3 do + begin + Name := 'RadioButton3'; + SetPosition(24, 174, 100, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 20; + Text := 'Int 16 bit'; + Hint := ''; + end; + + Label2 := TfpgLabel.Create(Panel1); + with Label2 do + begin + Name := 'Label2'; + SetPosition(24, 124, 104, 15); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := 'Sample format'; + Hint := ''; + end; + + TrackBar1 := TfpgTrackBar.Create(Panel1); + with TrackBar1 do + begin + Name := 'TrackBar1'; + SetPosition(140, 40, 356, 30); + BackgroundColor := TfpgColor($68A7D3A8); + ParentShowHint := False; + TabOrder := 22; + Hint := ''; + TrackBar1.OnMouseDown := @btntrackonClick; + TrackBar1.OnMouseUp := @btntrackoffClick; + end; + + TrackBar2 := TfpgTrackBar.Create(Panel1); + with TrackBar2 do + begin + Name := 'TrackBar2'; + SetPosition(20, 20, 32, 78); + BackgroundColor := TfpgColor($68A7D3A8); + Orientation := orVertical; + ParentShowHint := False; + TabOrder := 23; + Hint := ''; + OnChange := @volumechange; + end; + + TrackBar3 := TfpgTrackBar.Create(Panel1); + with TrackBar3 do + begin + Name := 'TrackBar3'; + SetPosition(88, 20, 28, 78); + BackgroundColor := TfpgColor($68A7D3A8); + Orientation := orVertical; + ParentShowHint := False; + TabOrder := 24; + Hint := ''; + OnChange := @volumechange; + end; + + Label3 := TfpgLabel.Create(Panel1); + with Label3 do + begin + Name := 'Label3'; + SetPosition(28, 4, 84, 15); + Alignment := taCenter; + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := 'Volume'; + Hint := ''; + end; + + Label4 := TfpgLabel.Create(Panel1); + with Label4 do + begin + Name := 'Label4'; + SetPosition(20, 100, 40, 15); + Alignment := taCenter; + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Left'; + Hint := ''; + end; + + Label5 := TfpgLabel.Create(Panel1); + with Label5 do + begin + Name := 'Label5'; + SetPosition(84, 100, 36, 19); + Alignment := taCenter; + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Right'; + Hint := ''; + end; + + vuleft := TfpgPanel.Create(Panel1); + with vuleft do + begin + Name := 'vuleft'; + SetPosition(56, 24, 8, 74); + BackgroundColor := TfpgColor($00D51D); + FontDesc := '#Label1'; + ParentShowHint := False; + Style := bsFlat; + Text := ''; + Hint := ''; + end; + + vuright := TfpgPanel.Create(Panel1); + with vuright do + begin + Name := 'vuright'; + SetPosition(76, 24, 8, 74); + BackgroundColor := TfpgColor($1DD523); + FontDesc := '#Label1'; + ParentShowHint := False; + Style := bsFlat; + Text := ''; + Hint := ''; + end; + + CheckBox2 := TfpgCheckBox.Create(Panel1); + with CheckBox2 do + begin + Name := 'CheckBox2'; + SetPosition(292, 92, 184, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 32; + Text := 'Enable SoundTouch PlugIn'; + Hint := 'Change Tempo with same tuning or change Tuning with same tempo'; + OnChange := @ChangePlugSetSoundTouch; + end; + + Label6 := TfpgLabel.Create(Panel1); + with Label6 do + begin + Name := 'Label6'; + SetPosition(284, 112, 80, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Tempo: 1.0'; + Hint := ''; + end; + + Label7 := TfpgLabel.Create(Panel1); + with Label7 do + begin + Name := 'Label7'; + SetPosition(396, 112, 68, 15); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Pitch: 1.0'; + Hint := ''; + end; + + TrackBar4 := TfpgTrackBar.Create(Panel1); + with TrackBar4 do + begin + Name := 'TrackBar4'; + SetPosition(360, 112, 28, 54); + BackgroundColor := TfpgColor($68A7D3A8); + Orientation := orVertical; + ParentShowHint := False; + Position := 50; + TabOrder := 35; + Hint := ''; + OnChange := @TrackChangePlugSetSoundTouch; + end; + + TrackBar5 := TfpgTrackBar.Create(Panel1); + with TrackBar5 do + begin + Name := 'TrackBar5'; + SetPosition(456, 112, 28, 54); + BackgroundColor := TfpgColor($68A7D3A8); + Orientation := orVertical; + ParentShowHint := False; + Position := 50; + TabOrder := 36; + Hint := ''; + OnChange := @TrackChangePlugSetSoundTouch; + end; + + Button1 := TfpgButton.Create(Panel1); + with Button1 do + begin + Name := 'Button1'; + SetPosition(288, 140, 60, 23); + Text := 'Reset'; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 37; + Hint := ''; + OnClick := @ResetPlugClick; + end; + + chkst2b := TfpgCheckBox.Create(Panel1); + with chkst2b do + begin + Name := 'chkst2b'; + SetPosition(144, 120, 136, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 38; + Text := 'Stereo to BinAural'; + Hint := 'Stereo to BinAural (for headphones)'; + OnChange := @ChangePlugSetBs2b; + end; + + chkstereo2mono := TfpgCheckBox.Create(Panel1); + with chkstereo2mono do + begin + Name := 'chkstereo2mono'; + SetPosition(144, 88, 120, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 42; + Text := 'Stereo to Mono'; + Hint := 'Convert Stereo to Mono'; + OnChange := @Changestereo2mono; + end; + + {@VFD_BODY_END: Simpleplayer} + {%endregion} + + ////////////////////// + + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + RadioButton1.Checked := True; + Height := 364; + {$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'; + FilenameEdit5.FileName := ordir + 'lib\Windows\64bit\plugin\LibSoundTouch-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'; + FilenameEdit7.FileName := ordir + 'lib\Windows\32bit\LibMp4ff-32.dll'; + FilenameEdit8.FileName := ordir + 'lib\Windows\32bit\LibFaad2-32.dll'; + + FilenameEdit31.FileName := ordir + 'lib\Windows\32bit\LibOpusFile-32.dll'; + + FilenameEdit5.FileName := ordir + 'lib\Windows\32bit\plugin\libSoundTouch-32.dll'; + + // problem with windows10 when closing application + // FilenameEdit6.FileName := ordir + 'lib\Windows\32bit\plugin\LibBs2b-32.dll'; + + {$endif} + FilenameEdit4.FileName := ordir + 'sound\test.ogg'; + {$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'; + FilenameEdit5.FileName := opath + '/lib/Mac/32bit/plugin/libSoundTouch-32.dylib'; + FilenameEdit4.FileName := opath + 'sound/test.ogg'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + FilenameEdit1.FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + FilenameEdit2.FileName := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + FilenameEdit3.FileName := opath + '/lib/Mac/64bit/LibMpg123-64.dylib'; + FilenameEdit4.FileName := opath + 'sound/test.ogg'; + {$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'; + FilenameEdit7.FileName := ordir + 'lib/Linux/64bit/LibMp4ff-64.so'; + FilenameEdit8.FileName := ordir + 'lib/Linux/64bit/LibFaad2-64.so'; + + FilenameEdit31.FileName := ordir + 'lib/Linux/64bit/LibOpusFile-64.so'; + + FilenameEdit5.FileName := ordir + 'lib/Linux/64bit/plugin/LibSoundTouch-64.so'; + FilenameEdit6.FileName := ordir + 'lib/Linux/64bit/plugin/libbs2b-64.so'; + FilenameEdit4.FileName := ordir + 'sound/test.ogg'; + {$ENDIF} + + {$if defined(cpu32) and defined(linux) and not defined(cpuarm)} + 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'; + FilenameEdit7.FileName := ordir + 'lib/Linux/32bit/LibMp4ff-32.so'; + FilenameEdit8.FileName := ordir + 'lib/Linux/32bit/LibFaad2-32.so'; + + FilenameEdit5.FileName := ordir + 'lib/Linux/32bit/plugin/LibSoundTouch-32.so'; + FilenameEdit6.FileName := ordir + 'lib/Linux/32bit/plugin/libbs2b-32.so'; + FilenameEdit4.FileName := ordir + 'sound/test.ogg'; + {$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'; + FilenameEdit5.FileName := ordir + 'lib/Linux/arm_raspberrypi/plugin/soundtouch-arm.so'; + FilenameEdit4.FileName := ordir + 'sound/test.ogg'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + FilenameEdit1.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + FilenameEdit2FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + FilenameEdit3.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + FilenameEdit5.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so'; + FilenameEdit1.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'; + FilenameEdit5.FileName := ordir + 'lib/FreeBSD/64bit/plugin/libsoundtouch-64.so'; + FilenameEdit7.FileName := ordir + 'lib/FreeBSD/64bit/libmp4ff-64.so'; + FilenameEdit8.FileName := ordir + 'lib/FreeBSD/64bit/libfaad2-64.so'; + + // To play opus file you should copy uos/examples/lib/FreeBSD/64bit/libopus.so and paste into /usr/local/lib. + FilenameEdit31.FileName := ordir + 'lib/FreeBSD/64bit/libopusfile-64.so'; + + FilenameEdit6.FileName := ordir + 'lib/FreeBSD/64bit/plugin/libbs2b-64.so'; + {$else} + FilenameEdit1.FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + FilenameEdit2.FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + FilenameEdit3.FileName := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + FilenameEdit5.FileName := ''; +{$endif} + FilenameEdit4.FileName := ordir + 'sound/test.ogg'; +{$ENDIF} + FilenameEdit4.Initialdir := ordir + 'sound'; + FilenameEdit1.Initialdir := ordir + 'lib'; + FilenameEdit2.Initialdir := ordir + 'lib'; + FilenameEdit3.Initialdir := ordir + 'lib'; + FilenameEdit5.Initialdir := ordir + 'lib'; + vuLeft.Visible := False; + vuRight.Visible := False; + vuLeft.Height := 0; + vuRight.Height := 0; + vuright.UpdatewindowPosition; + vuLeft.UpdatewindowPosition; + + end; + + procedure TSimpleplayer.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: TSimpleplayer; + begin + fpgApplication.Initialize; + if fpgStyleManager.SetStyle('Chrome silver flat menu') then + fpgStyle := fpgStyleManager.Style; + fpgApplication.CreateForm(TSimpleplayer, frm); + try + frm.Show; + fpgApplication.Run; + finally + uos_free; + frm.Free; + end; + end; + +begin + MainProc; +end. + diff --git a/UOS/examples/simpleplayer_fpGUI.prj b/UOS/examples/simpleplayer_fpGUI.prj new file mode 100644 index 0000000..feeadbc --- /dev/null +++ b/UOS/examples/simpleplayer_fpGUI.prj @@ -0,0 +1,1403 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/simpleplayer_fpGUI.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=simpleplayer_fpGUI.pas +targetfile=simpleplayer_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/simpleplayer_fpGUI.pas +relpaths=1 + simpleplayer_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/simpleplayer_fpGUI.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/simpleplayer_fpGUI_noflat.lpi b/UOS/examples/simpleplayer_fpGUI_noflat.lpi new file mode 100644 index 0000000..7339f16 --- /dev/null +++ b/UOS/examples/simpleplayer_fpGUI_noflat.lpi @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasTitleStatement Value="False"/> + <LRSInOutputDirectory Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="UOS Simple Player 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="simpleplayer_fpGUI_noflat.pas"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="SimplePlayer_FPG_noflat" ApplyConventions="False"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="units"/> + </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> diff --git a/UOS/examples/simpleplayer_fpGUI_noflat.pas b/UOS/examples/simpleplayer_fpGUI_noflat.pas new file mode 100644 index 0000000..d6016d0 --- /dev/null +++ b/UOS/examples/simpleplayer_fpGUI_noflat.pas @@ -0,0 +1,1350 @@ +program simpleplayer_fpGUI_noflat; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + // cmem, + cthreads, + cwstring, {$ENDIF} {$ENDIF} + SysUtils, + uos, + ctypes, + //Math, + Classes, + fpg_button, + fpg_widget, + fpg_label, + fpg_Editbtn, + fpg_RadioButton, + fpg_trackbar, + fpg_CheckBox, + fpg_Panel, + fpg_base, + fpg_main, + fpg_form { you can add units after this }; + +type + TSimpleplayer = class(TfpgForm) + procedure uos_logo(Sender: TObject); + private + {@VFD_HEAD_BEGIN: Simpleplayer} + Custom1: TfpgWidget; + Labelport: TfpgLabel; + btnLoad: TfpgButton; + FilenameEdit1: TfpgFileNameEdit; + FilenameEdit2: TfpgFileNameEdit; + FilenameEdit4: TfpgFileNameEdit; + btnStart: TfpgButton; + btnStop: TfpgButton; + lposition: TfpgLabel; + Labelsnf: TfpgLabel; + Labelmpg: TfpgLabel; + Labelst: TfpgLabel; + FilenameEdit3: TfpgFileNameEdit; + FilenameEdit5: TfpgFileNameEdit; + Label1: TfpgLabel; + 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; + vuleft: TfpgPanel; + vuright: TfpgPanel; + CheckBox2: TfpgCheckBox; + Label6: TfpgLabel; + Label7: TfpgLabel; + TrackBar4: TfpgTrackBar; + TrackBar5: TfpgTrackBar; + Button1: TfpgButton; + chkst2b: TfpgCheckBox; + Labelst1: TfpgLabel; + FilenameEdit6: TfpgFileNameEdit; + chkstereo2mono: TfpgCheckBox; + Labelst11: TfpgLabel; + FilenameEdit7: TfpgFileNameEdit; + Labelst111: TfpgLabel; + FilenameEdit8: TfpgFileNameEdit; + {@VFD_HEAD_END: Simpleplayer} + public + procedure AfterCreate; override; + // constructor Create(AOwner: TComponent); + procedure btnLoadClick(Sender: TObject); + procedure btnCloseClick(Sender: TObject); + procedure btnStartClick(Sender: TObject); + procedure btnStopClick(Sender: TObject); + procedure btnPauseClick(Sender: TObject); + procedure btnResumeClick(Sender: TObject); + procedure btnTrackOnClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + procedure btnTrackOffClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + {$else} + procedure CustomMsgReceived(var msg: TfpgMessageRec); message MSG_CUSTOM1; + {$ENDIF} + procedure ClosePlayer1; + procedure LoopProcPlayer1; + procedure ShowPosition; + procedure ShowLevel; + procedure changecheck(Sender: TObject); + procedure VolumeChange(Sender: TObject; pos: integer); + procedure ChangeStereo2Mono(Sender: TObject); + procedure ChangePlugSetSoundTouch(Sender: TObject); + procedure ChangePlugSetbs2b(Sender: TObject); + procedure TrackChangePlugSetSoundTouch(Sender: TObject; pos: integer); + procedure ResetPlugClick(Sender: TObject); + end; + + {@VFD_NEWFORM_DECL} + + {@VFD_NEWFORM_IMPL} + +var + PlayerIndex1: Tuos_Player; + ordir, opath: string; + OutputIndex1, InputIndex1, DSPIndex1, DSPIndex2, DSPVolume, PluginIndex1, PluginIndex2: integer; + plugsoundtouch: Boolean = False; + plugbs2b: Boolean = False; + + procedure TSimpleplayer.btnTrackOnClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + begin + TrackBar1.Tag := 1; + end; + + procedure TSimpleplayer.ChangePlugSetBs2b(Sender: TObject); + begin + if radiobutton1.Enabled = False then /// player1 was created + PlayerIndex1.SetPluginBs2b(PluginIndex1, -1, -1, -1, chkst2b.Checked); + end; + + procedure TSimpleplayer.Changestereo2mono(Sender: TObject); + begin + if radiobutton1.Enabled = False then /// player1 was created + PlayerIndex1.InputSetDSP(InputIndex1, DSPIndex2, chkstereo2mono.Checked); + end; + + procedure TSimpleplayer.ChangePlugSetSoundTouch(Sender: TObject); + var + tempo, rate: cfloat; + begin + if (trim(PChar(filenameedit5.FileName)) <> '') and fileexists(filenameedit5.FileName) then + begin + if 2 - (2 * (TrackBar4.Position / 100)) < 0.3 then + tempo := 0.3 + else + tempo := 2 - (2 * (TrackBar4.Position / 100)); + if 2 - (2 * (TrackBar5.Position / 100)) < 0.3 then + rate := 0.3 + else + rate := 2 - (2 * (TrackBar5.Position / 100)); + + label6.Text := 'Tempo: ' + floattostrf(tempo, ffFixed, 15, 1); + label7.Text := 'Pitch: ' + floattostrf(rate, ffFixed, 15, 1); + + if radiobutton1.Enabled = False then /// player1 was created + PlayerIndex1.SetPluginSoundTouch(PluginIndex2, tempo, rate, checkbox2.Checked); + end; + end; + + procedure TSimpleplayer.ResetPlugClick(Sender: TObject); + begin + TrackBar4.Position := 50; + TrackBar5.Position := 50; + if radiobutton1.Enabled = False then /// player1 was created + PlayerIndex1.SetPluginSoundTouch(PluginIndex2, 1, 1, checkbox2.Checked); + end; + + procedure TSimpleplayer.TrackChangePlugSetSoundTouch(Sender: TObject; pos: integer); + begin + if (trim(PChar(filenameedit5.FileName)) <> '') and fileexists(filenameedit5.FileName) then + ChangePlugSetSoundTouch(Sender); + end; + + procedure TSimpleplayer.btnTrackoffClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + begin + PlayerIndex1.Seek(InputIndex1, TrackBar1.position); + TrackBar1.Tag := 0; + end; + + procedure TSimpleplayer.btnResumeClick(Sender: TObject); + begin + PlayerIndex1.RePlay(); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := True; + btnresume.Enabled := False; + end; + + procedure TSimpleplayer.btnPauseClick(Sender: TObject); + begin + PlayerIndex1.Pause(); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := False; + btnresume.Enabled := True; + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + end; + + procedure TSimpleplayer.changecheck(Sender: TObject); + begin + if (btnstart.Enabled = False) then + PlayerIndex1.InputSetDSP(InputIndex1, DSPIndex1, checkbox1.Checked); + end; + + procedure TSimpleplayer.VolumeChange(Sender: TObject; pos: integer); + begin + if (btnstart.Enabled = False) then + + PlayerIndex1.InputSetDSPVolume(InputIndex1, DSPVolume, + (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); + end; + + procedure TSimpleplayer.ShowLevel; + begin + vuLeft.Visible := True; + vuRight.Visible := True; + if round(PlayerIndex1.InputGetLevelLeft(InputIndex1) * 74) >= 0 then + vuLeft.Height := round(PlayerIndex1.InputGetLevelLeft(InputIndex1) * 74); + if round(PlayerIndex1.InputGetLevelRight(InputIndex1) * 74) >= 0 then + vuRight.Height := round(PlayerIndex1.InputGetLevelRight(InputIndex1) * 74); + vuLeft.top := 402 - vuLeft.Height; + vuRight.top := 402 - vuRight.Height; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + end; + + procedure TSimpleplayer.btnCloseClick(Sender: TObject); + begin + if (btnstart.Enabled = False) then + begin + PlayerIndex1.stop(); + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + sleep(100); + end; + if btnLoad.Enabled = False then + begin + uos_UnloadPlugin('soundtouch'); + uos_UnloadPlugin('bs2b'); + uos_UnloadLib(); + end; + end; + + procedure TSimpleplayer.btnLoadClick(Sender: TObject); + var + loadok: Boolean = False; + 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, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + if uos_LoadLib(PChar(FilenameEdit1.FileName), PChar(FilenameEdit2.FileName), + PChar(FilenameEdit3.FileName), PChar(FilenameEdit7.FileName), PChar(FilenameEdit8.FileName), nil, nil) = 0 then + begin + hide; + loadok := True; + Height := 514; + btnStart.Enabled := True; + btnLoad.Enabled := False; + FilenameEdit1.ReadOnly := True; + FilenameEdit2.ReadOnly := True; + FilenameEdit3.ReadOnly := True; + FilenameEdit5.ReadOnly := True; + FilenameEdit6.ReadOnly := True; + FilenameEdit7.ReadOnly := True; + FilenameEdit8.ReadOnly := True; + UpdateWindowPosition; + btnLoad.Text := + 'PortAudio, SndFile, Mpg123, AAC libraries are loaded...'; + end + else + btnLoad.Text := + 'One or more libraries did not load, check filenames...'; + + if loadok = True then + begin + if ((trim(PChar(filenameedit5.FileName)) <> '') and fileexists(filenameedit5.FileName)) then + if (uos_LoadPlugin('soundtouch', PChar(FilenameEdit5.FileName)) = 0) then + begin + plugsoundtouch := True; + btnLoad.Text := + 'PortAudio, SndFile, Mpg123, AAC and Plugin are loaded...'; + end + else + begin + TrackBar4.Enabled := False; + TrackBar5.Enabled := False; + CheckBox2.Enabled := False; + Button1.Enabled := False; + label6.Enabled := False; + label7.Enabled := False; + end; + + if ((trim(PChar(filenameedit6.FileName)) <> '') and fileexists(filenameedit6.FileName)) then + if (uos_LoadPlugin('bs2b', PChar(FilenameEdit6.FileName)) = 0) then + plugbs2b := True + else + chkst2b.Enabled := False; + + WindowPosition := wpScreenCenter; + WindowTitle := 'Simple Player. uos Version ' + IntToStr(uos_getversion()); + fpgapplication.ProcessMessages; + sleep(500); + Show; + end; + end; + + procedure TSimpleplayer.ClosePlayer1; + begin + radiobutton1.Enabled := True; + radiobutton2.Enabled := True; + radiobutton3.Enabled := True; + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + btnStart.Enabled := True; + btnStop.Enabled := False; + btnPause.Enabled := False; + btnresume.Enabled := False; + trackbar1.Position := 0; + lposition.Text := '00:00:00.000'; + end; + + procedure TSimpleplayer.btnStopClick(Sender: TObject); + begin + PlayerIndex1.Stop(); + closeplayer1; + end; + + ///// example how to do custom dsp + + function DSPReverseBefore(Data: Tuos_Data; fft: Tuos_FFT): TDArFloat; + begin + if Data.position > Data.OutFrames div Data.ratio then + PlayerIndex1.Seek(InputIndex1, Data.position - 2 - (Data.OutFrames div Data.Ratio)); + end; + + function DSPReverseAfter(Data: Tuos_Data; fft: Tuos_FFT): TDArFloat; + var + x: integer = 0; + arfl: TDArFloat; + begin + SetLength(arfl, length(Data.Buffer)); + while x < length(Data.Buffer) + 1 do + begin + arfl[x] := Data.Buffer[length(Data.Buffer) - x - 1]; + arfl[x + 1] := Data.Buffer[length(Data.Buffer) - x]; + x := x + 2; + end; + + Result := arfl; + end; + + /// WARNING: This is only to show a DSP effect, it is not the best reverb it exists ;-) + function DSPReverb(Data: Tuos_Data; fft: Tuos_FFT): TDArFloat; + var + x: integer = 0; + arfl: TDArFloat; + begin + SetLength(arfl, length(Data.Buffer)); + while x < length(Data.Buffer) do + begin + if x > 10000 then + begin + arfl[x] := Data.Buffer[x] + (Data.Buffer[x - 10000] / 2); + arfl[x + 1] := Data.Buffer[x + 1] + (Data.Buffer[x + 1 - 10000] / 2); + end + else + begin + arfl[x] := Data.Buffer[x]; + arfl[x + 1] := Data.Buffer[x + 1]; + end; + x := x + 2; + end; + Result := arfl; + end; + + function DSPStereo2Mono(Data: Tuos_Data; fft: Tuos_FFT): TDArFloat; + var + x: integer = 0; + ps: PDArShort; //////// if input is Int16 format + pl: PDArLong; //////// if input is Int32 format + pf: PDArFloat; //////// if input is Float32 format + samplef: cFloat; + samplei: integer; + begin + if (Data.channels = 2) then + begin + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + while x < Data.OutFrames do + begin + samplei := round((ps^[x] + ps^[x + 1]) / 2); + ps^[x] := samplei; + ps^[x + 1] := samplei; + x := x + 2; + end; + end; + + 1: + begin + pl := @Data.Buffer; + while x < Data.OutFrames do + begin + samplei := round((pl^[x] + pl^[x + 1]) / 2); + pl^[x] := samplei; + pl^[x + 1] := samplei; + x := x + 2; + end; + end; + + 0: + begin + pf := @Data.Buffer; + while x < Data.OutFrames do + begin + samplef := (pf^[x] + pf^[x + 1]) / 2; + pf^[x] := samplef; + pf^[x + 1] := samplef; + x := x + 2; + end; + end; + + end; + Result := Data.Buffer; + end + else + Result := Data.Buffer; + end; + + procedure TSimpleplayer.btnStartClick(Sender: TObject); + var + samformat: shortint; + temptime: ttime; + ho, mi, se, ms: word; + begin + + if radiobutton1.Checked = True then + samformat := 0; + if radiobutton2.Checked = True then + samformat := 1; + if radiobutton3.Checked = True then + samformat := 2; + + radiobutton1.Enabled := False; + radiobutton2.Enabled := False; + radiobutton3.Enabled := False; + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + PlayerIndex1 := Tuos_Player.Create(True); + {$else} + PlayerIndex1 := Tuos_Player.Create(true,self); + {$endif} + + //// Create the player. + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + InputIndex1 := PlayerIndex1.AddFromFile(PChar(filenameEdit4.filename), -1, samformat, -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 div channels) + // result : -1 nothing created, otherwise Input Index in array + + if InputIndex1 > -1 then + begin + + // OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1) ; + //// add a Output into device with default parameters + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + OutputIndex1 := PlayerIndex1.AddIntoDevOut(-1, 0.3, PlayerIndex1.StreamIn[InputIndex1].Data.SampleRate, -1, samformat, -1); + {$else} + OutputIndex1 := PlayerIndex1.AddIntoDevOut(-1, -1, PlayerIndex1.StreamIn[InputIndex1].Data.SampleRate, -1, samformat, -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) /// here default samplerate of input + //////////// 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) + // result : -1 nothing created, otherwise Output Index in array + + // PlayerIndex1.StreamIn[In1Index].Data.levelEnable:=2 ; + PlayerIndex1.InputSetLevelEnable(InputIndex1, 2); + ///// set calculation of level/volume (usefull for showvolume procedure) + ///////// set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + // 3 => calcul before and after all DSP procedures. + + // PlayerIndex1.StreamIn[In1Index].Data.PositionEnable:= 1 ; + PlayerIndex1.InputSetPositionEnable(InputIndex1, 1); + ///// set calculation of position (usefull for positions procedure) + ///////// set position calculation (default is 0) + // 0 => no calcul + // 1 => calcul position. + + PlayerIndex1.StreamIn[InputIndex1].LoopProc := @LoopProcPlayer1; + ///// Assign the procedure of object to execute inside the loop + //////////// PlayerIndex : Index of a existing Player + //////////// InputIndex1 : Index of a existing Input + //////////// LoopProcPlayer1 : procedure of object to execute inside the loop + + + DSPVolume := PlayerIndex1.InputAddDSPVolume(InputIndex1, 1, 1); + ///// DSP Volume changer + ////////// PlayerIndex1 : Index of a existing Player + ////////// InputIndex1 : Index of a existing input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + // { + PlayerIndex1.InputSetDSPVolume(InputIndex1, DSPVolume, + (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); + // } /// Set volume + ////////// PlayerIndex1 : Index of a existing Player + ////////// DSPVolume : Index of a existing dsp + ////////// InputIndex1 : InputIndex of a existing Input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + ////////// Enable : Enabled + + DSPIndex1 := PlayerIndex1.InputAddDSP(InputIndex1, @DSPReverseBefore, @DSPReverseAfter, nil, nil); + ///// add a custom DSP procedure for input + ////////// PlayerIndex1 : Index of a existing Player + ////////// InputIndex1: InputIndex of existing input + ////////// BeforeFunc : function to do before the buffer is filled + ////////// AfterFunc : function to do after the buffer is filled + ////////// EndedFunc : function to do at end of thread + ////////// LoopProc : external procedure to do after the buffer is filled + + //// set the parameters of custom DSP + PlayerIndex1.InputSetDSP(InputIndex1, DSPIndex1, checkbox1.Checked); + + // This is a other custom DSP...stereo to mono to show how to do a DSP ;-) + DSPIndex2 := PlayerIndex1.InputAddDSP(InputIndex1, nil, @DSPStereo2Mono, nil, nil); + PlayerIndex1.InputSetDSP(InputIndex1, DSPIndex2, chkstereo2mono.Checked); + + ///// add bs2b plugin with samplerate_of_input1 / default channels (2 = stereo) + if plugbs2b = True then + begin + PlugInIndex1 := PlayerIndex1.AddPlugin('bs2b', PlayerIndex1.StreamIn[InputIndex1].Data.SampleRate, -1); + PlayerIndex1.SetPluginbs2b(PluginIndex1, -1, -1, -1, chkst2b.Checked); + end; + + /// add SoundTouch plugin with samplerate of input1 / default channels (2 = stereo) + /// SoundTouch plugin should be the last added. + if plugsoundtouch = True then + begin + PlugInIndex2 := PlayerIndex1.AddPlugin('soundtouch', + PlayerIndex1.StreamIn[InputIndex1].Data.SampleRate, -1); + ChangePlugSetSoundTouch(self); //// custom procedure to Change plugin settings + end; + + trackbar1.Max := PlayerIndex1.InputLength(InputIndex1); + ////// Length of Input in samples + + temptime := PlayerIndex1.InputLengthTime(InputIndex1); + ////// Length of input in time + + DecodeTime(temptime, ho, mi, se, ms); + + llength.Text := format('%d:%d:%d.%d', [ho, mi, se, ms]); + + /////// procedure to execute when stream is terminated + PlayerIndex1.EndProc := @ClosePlayer1; + ///// Assign the procedure of object to execute at end + //////////// PlayerIndex : Index of a existing Player + //////////// ClosePlayer1 : procedure of object to execute inside the general loop + + TrackBar1.position := 0; + trackbar1.Enabled := True; + CheckBox1.Enabled := True; + + btnStart.Enabled := False; + btnStop.Enabled := True; + btnpause.Enabled := True; + btnresume.Enabled := False; + + PlayerIndex1.Play(); + + end; + end; + + procedure TSimpleplayer.ShowPosition; + var + temptime: ttime; + ho, mi, se, ms: word; + begin + if (TrackBar1.Tag = 0) then + if PlayerIndex1.InputPosition(InputIndex1) > 0 then + begin + TrackBar1.Position := PlayerIndex1.InputPosition(InputIndex1); + temptime := PlayerIndex1.InputPositionTime(InputIndex1); + ////// Length of input in time + DecodeTime(temptime, ho, mi, se, ms); + lposition.Text := format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); + end; + end; + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + {$else} + procedure TSimpleplayer.CustomMsgReceived(var msg: TfpgMessageRec); + begin + ShowLevel; + ShowPosition ; + end; + + {$ENDIF} + + procedure TSimpleplayer.LoopProcPlayer1; + begin + ShowPosition; + ShowLevel; + end; + + procedure TSimpleplayer.AfterCreate; + begin + {%region 'Auto-generated GUI code' -fold} + + {@VFD_BODY_BEGIN: Simpleplayer} + Name := 'Simpleplayer'; + SetPosition(600, 57, 503, 515); + WindowTitle := 'Simple player '; + IconName := ''; + BackGroundColor := $80000001; + Hint := ''; + WindowPosition := wpScreenCenter; + Ondestroy := @btnCloseClick; + + Custom1 := TfpgWidget.Create(self); + with Custom1 do + begin + Name := 'Custom1'; + SetPosition(10, 16, 115, 259); + 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(8, 282, 488, 24); + 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(132, 312, 360, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 5; + end; + + btnStart := TfpgButton.Create(self); + with btnStart do + begin + Name := 'btnStart'; + SetPosition(140, 480, 66, 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(368, 480, 66, 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(228, 373, 84, 19); + Alignment := taCenter; + FontDesc := '#Label2'; + ParentShowHint := False; + Text := '00:00:00.000'; + 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; + + Labelst := TfpgLabel.Create(self); + with Labelst do + begin + Name := 'Labelst'; + SetPosition(140, 200, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of SoundTouch plugin 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; + + FilenameEdit5 := TfpgFileNameEdit.Create(self); + with FilenameEdit5 do + begin + Name := 'FilenameEdit5'; + SetPosition(138, 216, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 12; + end; + + Label1 := TfpgLabel.Create(self); + with Label1 do + begin + Name := 'Label1'; + SetPosition(312, 373, 12, 15); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := '/'; + Hint := ''; + end; + + Llength := TfpgLabel.Create(self); + with Llength do + begin + Name := 'Llength'; + SetPosition(320, 373, 80, 15); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := '00:00:00.000'; + Hint := ''; + end; + + btnpause := TfpgButton.Create(self); + with btnpause do + begin + Name := 'btnpause'; + SetPosition(216, 480, 66, 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(292, 480, 66, 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(132, 452, 104, 19); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 17; + Text := 'Play Reverse'; + Hint := ''; + end; + + RadioButton1 := TfpgRadioButton.Create(self); + with RadioButton1 do + begin + Name := 'RadioButton1'; + SetPosition(12, 444, 96, 19); + Checked := True; + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 18; + Text := 'Float 32 bit'; + Hint := ''; + end; + + RadioButton2 := TfpgRadioButton.Create(self); + with RadioButton2 do + begin + Name := 'RadioButton2'; + SetPosition(12, 460, 100, 19); + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 19; + Text := 'Int 32 bit'; + Hint := ''; + end; + + RadioButton3 := TfpgRadioButton.Create(self); + with RadioButton3 do + begin + Name := 'RadioButton3'; + SetPosition(12, 478, 100, 19); + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 20; + Text := 'Int 16 bit'; + Hint := ''; + end; + + Label2 := TfpgLabel.Create(self); + with Label2 do + begin + Name := 'Label2'; + SetPosition(12, 428, 104, 15); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := 'Sample format'; + Hint := ''; + end; + + TrackBar1 := TfpgTrackBar.Create(self); + with TrackBar1 do + begin + Name := 'TrackBar1'; + SetPosition(136, 340, 356, 30); + ParentShowHint := False; + TabOrder := 22; + Hint := ''; + TrackBar1.OnMouseDown := @btntrackonClick; + TrackBar1.OnMouseUp := @btntrackoffClick; + end; + + TrackBar2 := TfpgTrackBar.Create(self); + with TrackBar2 do + begin + Name := 'TrackBar2'; + SetPosition(8, 324, 32, 78); + Orientation := orVertical; + ParentShowHint := False; + TabOrder := 23; + Hint := ''; + OnChange := @volumechange; + end; + + TrackBar3 := TfpgTrackBar.Create(self); + with TrackBar3 do + begin + Name := 'TrackBar3'; + SetPosition(76, 324, 28, 78); + Orientation := orVertical; + ParentShowHint := False; + TabOrder := 24; + Hint := ''; + OnChange := @volumechange; + end; + + Label3 := TfpgLabel.Create(self); + with Label3 do + begin + Name := 'Label3'; + SetPosition(16, 308, 84, 15); + Alignment := taCenter; + FontDesc := '#Label2'; + ParentShowHint := False; + Text := 'Volume'; + Hint := ''; + end; + + Label4 := TfpgLabel.Create(self); + with Label4 do + begin + Name := 'Label4'; + SetPosition(8, 404, 40, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Left'; + Hint := ''; + end; + + Label5 := TfpgLabel.Create(self); + with Label5 do + begin + Name := 'Label5'; + SetPosition(72, 404, 36, 19); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Right'; + Hint := ''; + end; + + vuleft := TfpgPanel.Create(self); + with vuleft do + begin + Name := 'vuleft'; + SetPosition(44, 328, 8, 74); + BackgroundColor := TfpgColor($00D51D); + FontDesc := '#Label1'; + ParentShowHint := False; + Style := bsFlat; + Text := ''; + Hint := ''; + end; + + vuright := TfpgPanel.Create(self); + with vuright do + begin + Name := 'vuright'; + SetPosition(64, 328, 8, 74); + BackgroundColor := TfpgColor($1DD523); + FontDesc := '#Label1'; + ParentShowHint := False; + Style := bsFlat; + Text := ''; + Hint := ''; + end; + + CheckBox2 := TfpgCheckBox.Create(self); + with CheckBox2 do + begin + Name := 'CheckBox2'; + SetPosition(280, 396, 184, 19); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 32; + Text := 'Enable SoundTouch PlugIn'; + Hint := 'Change Tempo with same tuning or change Tuning with same tempo'; + OnChange := @ChangePlugSetSoundTouch; + end; + + Label6 := TfpgLabel.Create(self); + with Label6 do + begin + Name := 'Label6'; + SetPosition(272, 416, 80, 19); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Tempo: 1.0'; + Hint := ''; + end; + + Label7 := TfpgLabel.Create(self); + with Label7 do + begin + Name := 'Label7'; + SetPosition(384, 416, 68, 15); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Pitch: 1.0'; + Hint := ''; + end; + + TrackBar4 := TfpgTrackBar.Create(self); + with TrackBar4 do + begin + Name := 'TrackBar4'; + SetPosition(348, 416, 28, 54); + Orientation := orVertical; + ParentShowHint := False; + Position := 50; + TabOrder := 35; + Hint := ''; + OnChange := @TrackChangePlugSetSoundTouch; + end; + + TrackBar5 := TfpgTrackBar.Create(self); + with TrackBar5 do + begin + Name := 'TrackBar5'; + SetPosition(444, 416, 28, 54); + Orientation := orVertical; + ParentShowHint := False; + Position := 50; + TabOrder := 36; + Hint := ''; + OnChange := @TrackChangePlugSetSoundTouch; + end; + + Button1 := TfpgButton.Create(self); + with Button1 do + begin + Name := 'Button1'; + SetPosition(276, 444, 60, 23); + Text := 'Reset'; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 37; + Hint := ''; + OnClick := @ResetPlugClick; + end; + + chkst2b := TfpgCheckBox.Create(self); + with chkst2b do + begin + Name := 'chkst2b'; + SetPosition(132, 424, 136, 19); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 38; + Text := 'Stereo to BinAural'; + Hint := 'Stereo to BinAural (for headphones)'; + OnChange := @ChangePlugSetBs2b; + end; + + Labelst1 := TfpgLabel.Create(self); + with Labelst1 do + begin + Name := 'Labelst1'; + SetPosition(146, 240, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of bs2b plugin Library'; + end; + + FilenameEdit6 := TfpgFileNameEdit.Create(self); + with FilenameEdit6 do + begin + Name := 'FilenameEdit6'; + SetPosition(138, 256, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 40; + end; + + chkstereo2mono := TfpgCheckBox.Create(self); + with chkstereo2mono do + begin + Name := 'chkstereo2mono'; + SetPosition(132, 392, 120, 19); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 42; + Text := 'Stereo to Mono'; + Hint := 'Convert Stereo to Mono'; + OnChange := @Changestereo2mono; + end; + + Labelst11 := TfpgLabel.Create(self); + with Labelst11 do + begin + Name := 'Labelst11'; + SetPosition(140, 120, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of mp4ff Library'; + end; + + FilenameEdit7 := TfpgFileNameEdit.Create(self); + with FilenameEdit7 do + begin + Name := 'FilenameEdit7'; + SetPosition(138, 136, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 44; + end; + + Labelst111 := TfpgLabel.Create(self); + with Labelst111 do + begin + Name := 'Labelst111'; + SetPosition(138, 160, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of Faad Library'; + end; + + FilenameEdit8 := TfpgFileNameEdit.Create(self); + with FilenameEdit8 do + begin + Name := 'FilenameEdit8'; + SetPosition(138, 176, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 46; + end; + + {@VFD_BODY_END: Simpleplayer} + {%endregion} + + ////////////////////// + + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + checkbox1.OnChange := @changecheck; + RadioButton1.Checked := True; + Height := 312; + {$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'; + FilenameEdit5.FileName := ordir + 'lib\Windows\64bit\plugin\LibSoundTouch-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'; + FilenameEdit7.FileName := ordir + 'lib\Windows\32bit\LibMp4ff-32.dll'; + FilenameEdit8.FileName := ordir + 'lib\Windows\32bit\LibFaad2-32.dll'; + + FilenameEdit5.FileName := ordir + 'lib\Windows\32bit\plugin\libSoundTouch-32.dll'; + FilenameEdit6.FileName := ordir + 'lib\Windows\32bit\plugin\LibBs2b-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'; + FilenameEdit5.FileName := opath + '/lib/Mac/32bit/plugin/libSoundTouch-32.dylib'; + FilenameEdit4.FileName := opath + 'sound/test.mp3'; + {$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'; + FilenameEdit7.FileName := ordir + 'lib/Linux/64bit/LibMp4ff-64.so'; + FilenameEdit8.FileName := ordir + 'lib/Linux/64bit/LibFaad2-64.so'; + + FilenameEdit5.FileName := ordir + 'lib/Linux/64bit/plugin/LibSoundTouch-64.so'; + FilenameEdit6.FileName := ordir + 'lib/Linux/64bit/plugin/libbs2b-64.so'; + FilenameEdit4.FileName := ordir + 'sound/test.ogg'; + {$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'; + FilenameEdit7.FileName := ordir + 'lib/Linux/32bit/LibMp4ff-32.so'; + FilenameEdit8.FileName := ordir + 'lib/Linux/32bit/LibFaad2-32.so'; + + FilenameEdit5.FileName := ordir + 'lib/Linux/32bit/plugin/LibSoundTouch-32.so'; + FilenameEdit6.FileName := ordir + 'lib/Linux/32bit/plugin/libbs2b-32.so'; + FilenameEdit4.FileName := ordir + 'sound/test.ogg'; + {$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'; + FilenameEdit5.FileName := ordir + 'lib/Linux/arm_raspberrypi/libsoundtouch-arm.so'; + FilenameEdit4.FileName := ordir + 'sound/test.ogg'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + FilenameEdit1.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + FilenameEdit2.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + FilenameEdit3.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + FilenameEdit5.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so'; + FilenameEdit4.FileName := ordir + 'sound/test.ogg'; + {$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'; + FilenameEdit5.FileName := ordir + 'lib/FreeBSD/64bit/plugin/libsoundtouch-64.so'; + FilenameEdit6.FileName := ordir + 'lib/FreeBSD/64bit/plugin/libbs2b-64.so'; + {$else} + FilenameEdit1.FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + FilenameEdit2.FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + FilenameEdit3.FileName := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + FilenameEdit5.FileName := ''; +{$endif} + FilenameEdit4.FileName := ordir + 'sound/test.mp3'; +{$ENDIF} + FilenameEdit4.Initialdir := ordir + 'sound'; + FilenameEdit1.Initialdir := ordir + 'lib'; + FilenameEdit2.Initialdir := ordir + 'lib'; + FilenameEdit3.Initialdir := ordir + 'lib'; + FilenameEdit5.Initialdir := ordir + 'lib'; + vuLeft.Visible := False; + vuRight.Visible := False; + vuLeft.Height := 0; + vuRight.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + end; + + procedure TSimpleplayer.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: TSimpleplayer; + begin + fpgApplication.Initialize; + fpgApplication.CreateForm(TSimpleplayer, frm); + try + frm.Show; + fpgApplication.Run; + finally + PlayerIndex1.Free; + uos_free; + frm.Free; + end; + end; + +begin + MainProc; +end. + diff --git a/UOS/examples/simpleplayer_fpGUI_noflat.prj b/UOS/examples/simpleplayer_fpGUI_noflat.prj new file mode 100644 index 0000000..56a3077 --- /dev/null +++ b/UOS/examples/simpleplayer_fpGUI_noflat.prj @@ -0,0 +1,1403 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/simpleplayer_fpGUI_noflat.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=simpleplayer_fpGUI_noflat.pas +targetfile=simpleplayer_fpGUI_noflat${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/simpleplayer_fpGUI_noflat.pas +relpaths=1 + simpleplayer_fpGUI_noflat.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/simpleplayer_fpGUI_noflat.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/simpleplayer_noflat.lpi b/UOS/examples/simpleplayer_noflat.lpi new file mode 100644 index 0000000..aa54ac1 --- /dev/null +++ b/UOS/examples/simpleplayer_noflat.lpi @@ -0,0 +1,383 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="12"/> + <General> + <Flags> + <CompatibilityMode Value="True"/> + </Flags> + <Title Value="SimplePlayer"/> + <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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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="9"> + <Unit0> + <Filename Value="simpleplayer_noflat.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="2"/> + <CursorPos X="3" Y="7"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main_sp_nf.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <TopLine Value="565"/> + <CursorPos X="7" Y="546"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit1> + <Unit2> + <Filename Value="uos.pas"/> + <EditorIndex Value="4"/> + <TopLine Value="3784"/> + <CursorPos X="7" Y="3807"/> + <UsageCount Value="100"/> + <Loaded Value="True"/> + </Unit2> + <Unit3> + <Filename Value="simpleplayer_fpGUI_noflat.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="596"/> + <CursorPos X="19" Y="614"/> + <UsageCount Value="11"/> + </Unit3> + <Unit4> + <Filename Value="../../uoslib/headers/uoslib_h.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="17" Y="69"/> + <UsageCount Value="10"/> + </Unit4> + <Unit5> + <Filename Value="main_sp.pas"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="564"/> + <CursorPos X="20" Y="548"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit5> + <Unit6> + <Filename Value="simpleplayer_fpGUI.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="266"/> + <CursorPos X="19" Y="288"/> + <UsageCount Value="10"/> + </Unit6> + <Unit7> + <Filename Value="/lib/codetyphon/typhon/lcl/stdctrls.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="165"/> + <CursorPos X="72" Y="188"/> + <UsageCount Value="10"/> + </Unit7> + <Unit8> + <Filename Value="uos_flat.pas"/> + <EditorIndex Value="3"/> + <TopLine Value="1083"/> + <CursorPos X="35" Y="1101"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit8> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="559" Column="3" TopLine="553"/> + </Position1> + <Position2> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="557" Column="12" TopLine="553"/> + </Position2> + <Position3> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="558" Column="12" TopLine="554"/> + </Position3> + <Position4> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="559" Column="12" TopLine="555"/> + </Position4> + <Position5> + <Filename Value="main_sp.pas"/> + <Caret Line="576" Column="2" TopLine="573"/> + </Position5> + <Position6> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="560" Column="12" TopLine="556"/> + </Position6> + <Position7> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="562" Column="12" TopLine="558"/> + </Position7> + <Position8> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="597" Column="3" TopLine="595"/> + </Position8> + <Position9> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="353" TopLine="336"/> + </Position9> + <Position10> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="774" Column="28" TopLine="771"/> + </Position10> + <Position11> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="42" Column="64" TopLine="35"/> + </Position11> + <Position12> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="72" Column="14" TopLine="57"/> + </Position12> + <Position13> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="179" Column="35" TopLine="163"/> + </Position13> + <Position14> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="404" Column="33" TopLine="389"/> + </Position14> + <Position15> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="694" Column="39" TopLine="683"/> + </Position15> + <Position16> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="785" Column="12" TopLine="769"/> + </Position16> + <Position17> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="72" Column="14" TopLine="64"/> + </Position17> + <Position18> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="176" Column="18" TopLine="160"/> + </Position18> + <Position19> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="178" Column="18" TopLine="162"/> + </Position19> + <Position20> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="401" Column="18" TopLine="385"/> + </Position20> + <Position21> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="403" Column="18" TopLine="387"/> + </Position21> + <Position22> + <Filename Value="main_sp.pas"/> + <Caret Line="290" Column="10" TopLine="289"/> + </Position22> + <Position23> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="689" Column="6" TopLine="672"/> + </Position23> + <Position24> + <Filename Value="main_sp.pas"/> + <Caret Line="5" Column="118"/> + </Position24> + <Position25> + <Filename Value="main_sp_nf.pas"/> + <Caret Line="682" Column="30" TopLine="674"/> + </Position25> + <Position26> + <Filename Value="main_sp.pas"/> + <Caret Line="565" Column="14" TopLine="560"/> + </Position26> + <Position27> + <Filename Value="main_sp.pas"/> + <Caret Line="694" Column="21" TopLine="676"/> + </Position27> + <Position28> + <Filename Value="main_sp.pas"/> + <Caret Line="548" Column="20" TopLine="540"/> + </Position28> + <Position29> + <Filename Value="main_sp.pas"/> + <Caret Line="551" Column="23" TopLine="540"/> + </Position29> + <Position30> + <Filename Value="main_sp.pas"/> + <Caret Line="686" Column="21" TopLine="670"/> + </Position30> + </JumpHistory> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="SimplePlayer"/> + </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"/> + <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> diff --git a/UOS/examples/simpleplayer_noflat.lpr b/UOS/examples/simpleplayer_noflat.lpr new file mode 100644 index 0000000..bb2dfa4 --- /dev/null +++ b/UOS/examples/simpleplayer_noflat.lpr @@ -0,0 +1,23 @@ +program simpleplayer; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + cthreads, + cwstring, {$ENDIF} {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, + main_sp_nf { you can add units after this }; + +{$R *.res} + +begin + Application.Title := 'SimplePlayer'; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + + diff --git a/UOS/examples/simplerecorder.lpi b/UOS/examples/simplerecorder.lpi new file mode 100644 index 0000000..a03e81e --- /dev/null +++ b/UOS/examples/simplerecorder.lpi @@ -0,0 +1,628 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="12"/> + <General> + <Flags> + <CompatibilityMode Value="True"/> + </Flags> + <Title Value="simplerecorder"/> + <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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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="48"> + <Unit0> + <Filename Value="simplerecorder.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="2"/> + <WindowIndex Value="1"/> + <CursorPos X="3" Y="7"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main_sr.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="4"/> + <WindowIndex Value="1"/> + <TopLine Value="400"/> + <CursorPos Y="404"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit1> + <Unit2> + <Filename Value="lazdyn_portaudio.pas"/> + <CursorPos X="28"/> + <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"/> + <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"/> + <CursorPos Y="598"/> + <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="/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="/lib/codetyphon/lazarus/lcl/graphics.pp"/> + <TopLine Value="1168"/> + <CursorPos X="49" Y="1181"/> + <UsageCount Value="9"/> + </Unit21> + <Unit22> + <Filename Value="/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="6"/> + <WindowIndex Value="1"/> + <TopLine Value="7384"/> + <CursorPos X="62" Y="7394"/> + <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="/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="/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="main_sp.pas"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <TopLine Value="363"/> + <CursorPos X="5" Y="391"/> + <UsageCount Value="10"/> + </Unit34> + <Unit35> + <Filename Value="simplerecorder_fpGUI.lpr"/> + <TopLine Value="566"/> + <CursorPos X="61" Y="578"/> + <UsageCount Value="7"/> + </Unit35> + <Unit36> + <Filename Value="../../uos2/examples/uos.pas"/> + <TopLine Value="1939"/> + <CursorPos X="3" Y="1966"/> + <UsageCount Value="7"/> + </Unit36> + <Unit37> + <Filename Value="../../uos2/src/uos.pas"/> + <TopLine Value="1971"/> + <CursorPos X="55" Y="1970"/> + <UsageCount Value="7"/> + </Unit37> + <Unit38> + <Filename Value="uos_flat.pas"/> + <WindowIndex Value="1"/> + <TopLine Value="1253"/> + <CursorPos X="75" Y="33"/> + <UsageCount Value="34"/> + <Loaded Value="True"/> + </Unit38> + <Unit39> + <Filename Value="uos_portaudio.pas"/> + <EditorIndex Value="3"/> + <WindowIndex Value="1"/> + <TopLine Value="79"/> + <CursorPos X="21" Y="98"/> + <UsageCount Value="34"/> + <Loaded Value="True"/> + </Unit39> + <Unit40> + <Filename Value="simpleplayer_fpGUI.pas"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <TopLine Value="478"/> + <CursorPos X="49" Y="487"/> + <UsageCount Value="20"/> + </Unit40> + <Unit41> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/inc/mathh.inc"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <TopLine Value="83"/> + <CursorPos X="19" Y="101"/> + <UsageCount Value="21"/> + </Unit41> + <Unit42> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/objpas/classes/classesh.inc"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <TopLine Value="960"/> + <CursorPos X="62" Y="968"/> + <UsageCount Value="19"/> + </Unit42> + <Unit43> + <Filename Value="/usr/local/codetyphon/fpcsrc/rtl/unix/aliasctp.inc"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <TopLine Value="31"/> + <CursorPos X="10" Y="53"/> + <UsageCount Value="17"/> + </Unit43> + <Unit44> + <Filename Value="uos_dsp_utils.pas"/> + <EditorIndex Value="1"/> + <WindowIndex Value="1"/> + <TopLine Value="291"/> + <CursorPos Y="300"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit44> + <Unit45> + <Filename Value="define.inc"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <CursorPos X="2" Y="19"/> + <UsageCount Value="11"/> + </Unit45> + <Unit46> + <Filename Value="/usr/local/codetyphon/typhon/lcl/lclmessageglue.pas"/> + <UnitName Value="LCLMessageGlue"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <TopLine Value="16"/> + <CursorPos X="48" Y="22"/> + <UsageCount Value="11"/> + </Unit46> + <Unit47> + <Filename Value="simplerecorder_fpGUI.pas"/> + <EditorIndex Value="5"/> + <WindowIndex Value="1"/> + <TopLine Value="71"/> + <CursorPos X="50" Y="78"/> + <UsageCount Value="16"/> + <Loaded Value="True"/> + </Unit47> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="main_sr.pas"/> + <Caret Line="120" Column="23" TopLine="105"/> + </Position1> + <Position2> + <Filename Value="main_sr.pas"/> + <Caret Line="223" Column="114" TopLine="223"/> + </Position2> + <Position3> + <Filename Value="main_sr.pas"/> + <Caret Line="259" Column="3" TopLine="245"/> + </Position3> + <Position4> + <Filename Value="main_sr.pas"/> + <Caret Line="245" Column="103" TopLine="234"/> + </Position4> + <Position5> + <Filename Value="main_sr.pas"/> + <Caret Line="312" Column="2" TopLine="303"/> + </Position5> + <Position6> + <Filename Value="main_sr.pas"/> + <Caret Line="103" Column="38" TopLine="98"/> + </Position6> + <Position7> + <Filename Value="main_sr.pas"/> + <Caret Line="286" Column="52" TopLine="285"/> + </Position7> + <Position8> + <Filename Value="main_sr.pas"/> + <Caret Line="295" Column="4" TopLine="295"/> + </Position8> + <Position9> + <Filename Value="main_sr.pas"/> + <Caret Line="294" Column="16" TopLine="287"/> + </Position9> + <Position10> + <Filename Value="main_sr.pas"/> + <Caret Line="255" Column="16" TopLine="238"/> + </Position10> + <Position11> + <Filename Value="main_sr.pas"/> + <Caret Line="294" Column="45" TopLine="287"/> + </Position11> + <Position12> + <Filename Value="main_sr.pas"/> + <Caret Line="302" Column="103" TopLine="299"/> + </Position12> + <Position13> + <Filename Value="main_sr.pas"/> + <Caret Line="413" Column="81" TopLine="412"/> + </Position13> + <Position14> + <Filename Value="main_sr.pas"/> + <Caret Line="30" Column="14" TopLine="23"/> + </Position14> + <Position15> + <Filename Value="main_sr.pas"/> + <Caret Line="51" Column="24" TopLine="39"/> + </Position15> + <Position16> + <Filename Value="main_sr.pas"/> + <Caret Line="90" Column="12" TopLine="78"/> + </Position16> + <Position17> + <Filename Value="main_sr.pas"/> + <Caret Line="91" Column="15" TopLine="79"/> + </Position17> + <Position18> + <Filename Value="main_sr.pas"/> + <Caret Line="242" Column="49" TopLine="238"/> + </Position18> + <Position19> + <Filename Value="main_sr.pas"/> + <Caret Line="348" Column="30" TopLine="340"/> + </Position19> + <Position20> + <Filename Value="main_sr.pas"/> + <Caret Line="12" Column="8"/> + </Position20> + <Position21> + <Filename Value="main_sr.pas"/> + <Caret Line="341" TopLine="334"/> + </Position21> + <Position22> + <Filename Value="main_sr.pas"/> + <Caret Line="336" Column="34" TopLine="332"/> + </Position22> + <Position23> + <Filename Value="main_sr.pas"/> + <Caret Line="352" Column="6" TopLine="322"/> + </Position23> + <Position24> + <Filename Value="main_sr.pas"/> + <Caret Line="335" Column="4" TopLine="335"/> + </Position24> + <Position25> + <Filename Value="main_sr.pas"/> + <Caret Line="334" Column="4" TopLine="334"/> + </Position25> + <Position26> + <Filename Value="main_sr.pas"/> + <Caret Line="50" Column="57" TopLine="47"/> + </Position26> + <Position27> + <Filename Value="main_sr.pas"/> + <Caret Line="3" Column="46"/> + </Position27> + <Position28> + <Filename Value="main_sr.pas"/> + <Caret Column="18"/> + </Position28> + <Position29> + <Filename Value="main_sr.pas"/> + <Caret Line="86" Column="106" TopLine="80"/> + </Position29> + <Position30> + <Filename Value="main_sr.pas"/> + </Position30> + </JumpHistory> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="SimpleRecorder"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <SmallerCode Value="True"/> + </CodeGeneration> + <Linking> + <Debugging> + <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> diff --git a/UOS/examples/simplerecorder.lpr b/UOS/examples/simplerecorder.lpr new file mode 100644 index 0000000..3245361 --- /dev/null +++ b/UOS/examples/simplerecorder.lpr @@ -0,0 +1,22 @@ +program simplerecorder; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + cthreads, + cwstring, {$ENDIF} {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, + main_sr { you can add units after this }; + + {$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + + diff --git a/UOS/examples/simplerecorder.prj b/UOS/examples/simplerecorder.prj new file mode 100644 index 0000000..f3abd5c --- /dev/null +++ b/UOS/examples/simplerecorder.prj @@ -0,0 +1,1373 @@ +[componentpalette] +order0=0 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/simplerecorder.prj +findinfiledialog=59 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.inprojectdir] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" "*.*" + history=2 + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + [findinfileadialogfo.dir] + filenames=1 + /home/fred/espeak-ng-master/ + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + filehistory=4 + /home/fred/espeak-ng-master/ + /home/fred/espeak-1.48.04-source/ + /usr/local/codetyphon/ + /home/graemeg/devel/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" "*.*" + [findinfileadialogfo.findtext] + value=application_name + history=16 + application_name + create_audio_device_object + option_device + loadlib + loadlibrary + portaudio + if (out_samplerate != 0) + out_samplerate + Jonathan Duddington + pcaudiolib + windres + resbin + fpcres + uos_AddIntoDevOut + lapAutoAdjustForDPI + + [findinfileadialogfo] + stackedunder= + x=241 + y=281 + cx=341 + cy=276 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=885 + y=259 + cx=312 + cy=291 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=708 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=125 + sortdescend4=0 + width5=245 + sortdescend5=0 + width6=289 + sortdescend6=0 + width7=49 + sortdescend7=0 + width8=1 + sortdescend8=0 + width9=290 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=543 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=260 + sortdescend3=0 + width4=273 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=17 + [projectoptionsfo.newfile] + firsttab=0 + index=0 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=389 + width0=98 + sortdescend0=0 + width1=378 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=119 + xprop=1 + yprop=0.23968565815324 + [projectoptionsfo.macrogrid] + propcolwidthref=481 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=465 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=2 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=699 + width0=47 + sortdescend0=0 + width1=693 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=734 + width0=112 + sortdescend0=0 + width1=727 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=0 + [projectoptionsfo] + stackedunder= + x=341 + y=68 + cx=759 + cy=568 +settings=8 + [settings_form] + x=447 + y=138 + cx=518 + cy=724 + wsize=0 + active=1 + visible=1 +mainfile=${PROJECTNAME}.lpr +targetfile=${PROJECTNAME}${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=15 + ${lcldir}* + ${lcldir}/components/* + ${lcldir}/* + ${lcldir}/lcl/* + ${lcldir}/lcl/interfaces/* + ${lcldir}/lcl/widgetset + ${lcldir}/lcl/include + ${lcldir}/lcl/images + ${lcldir}/lcl/forms + ${lcldir}/lcl/nonwin32 + ${lcldir}/lcl/interfaces/win32 + ${lcldir}/lcl/interfaces/gtk2 + ${lcldir}/lcl/components/* + ${lcldir}/lcl/include + ${lcldir}/lcl +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=8 + -l -Mobjfpc -Sh + -gl + -ghl + -B + -O- + -O1 -XX -CX -Xs + -vi + -FUunits +makeoptpurpose=8 + + + + + + + + +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}default/program.pas + ${TEMPLATEDIR}default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}default/mainform.pas + ${TEMPLATEDIR}default/simpleform.pas + ${TEMPLATEDIR}default/dockingform.pas + ${TEMPLATEDIR}default/datamodule.pas + ${TEMPLATEDIR}default/subform.pas + ${TEMPLATEDIR}default/scrollboxform.pas + ${TEMPLATEDIR}default/tabform.pas + ${TEMPLATEDIR}default/dockpanelform.pas + ${TEMPLATEDIR}default/report.pas + ${TEMPLATEDIR}default/pascform.pas + ${TEMPLATEDIR}default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}default/mainform.mfm + ${TEMPLATEDIR}default/simpleform.mfm + ${TEMPLATEDIR}default/dockingform.mfm + ${TEMPLATEDIR}default/datamodule.mfm + ${TEMPLATEDIR}default/subform.mfm + ${TEMPLATEDIR}default/scrollboxform.mfm + ${TEMPLATEDIR}default/tabform.mfm + ${TEMPLATEDIR}default/dockpanelform.mfm + ${TEMPLATEDIR}default/report.mfm + ${TEMPLATEDIR}default/pascform.mfm + ${TEMPLATEDIR}default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=0 +enablepurpose=0 +enablesource=1 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=1 +settingsdebugger=1 +settingsstorage=1 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=8 + 127 + 2 + 0 + 3 + 2 + 61 + 4095 + 4095 +compilerusedon=29 + 3903 + 0 + 0 + 0 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3840 + 0 + 0 + 0 + 0 + 127 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=15:21:42 26/03/2017 +project_comment= +aftcommandon=0 +unitdirson=15 + 987135 + 987135 + 987135 + 986943 + 986880 + 987072 + 987072 + 987072 + 987072 + 986943 + 987072 + 986943 + 987135 + 987135 + 987135 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal_ideu.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=4 +linenumberson=1 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=1 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=16 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=0 +path=0 +line=0 +address=0 +addbkpt=0 +ignore=0 +condition=0 +panels=1 + panel1 +units= + ( + a=0,8228,6,Pascal Units + ) +cmodules= + ( + a=0,8228,6,C Modules + ) +files= + ( + a=0,8228,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=100 +x=0 +y=0 +cx=0 +cy=0 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=0 +hintheight=0 +finddtext=AddFrom +findhistory=20 + AddIntoMemoryBuffer + writeln('De + AddFromDevIn + AddIntoDevOut + uos_UpdateDevice + Pa_GetDefaultOutputDevice + convert + InputGetChannels + uos_AddIntoMemoryBuffer + FramesCount + 65 + getbuffer + looppro + loop + sf_write + StreamOut[x].Data.Filename + AddIntoFileFromMem + AddIntoFile( + filename,fmCreate + AddIntoFile +findoptions=1 +editpos=3 + 0,9 + 0,-1073741823 + 0,289 +bookmarks0=0 +bookmarks1=0 +bookmarks2=0 +sourcefiles=3 + /home/fred/uos/examples/simplerecorder.lpr + /home/fred/uos/examples/main_sr.pas + /home/fred/uos/examples/uos_flat.pas +relpaths=3 + simplerecorder.lpr + main_sr.pas + uos_flat.pas +ismoduletexts=3 + 0 + 0 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=537 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=5 + y=29 + cx=1356 + cy=710 + rcx=0 + rcy=0 + wsize=6 + active=1 + visible=1 + [findmessagefo.findtext] + value=mysqldyn + history=2 + mysqldyn + linux + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=493 + y=171 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=444 + y=431 + cx=418 + cy=126 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=205 + cy=620 + rcx=0 + rcy=0 + [projecttreefo.grid] + propcolwidthref=88 + width0=117 + sortdescend0=0 + width1=86 + sortdescend1=0 + sorted=0 + col=1 + row=-1073741823 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=423 + y=321 + cx=344 + cy=155 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=449 + width0=199 + sortdescend0=0 + width1=244 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1262 + rcy=583 + [watchfo.grid] + propcolwidthref=111 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268517483 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=691 + cx=1586 + cy=129 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=confdebuggerfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=240 + y=139 + cx=956 + cy=77 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=0 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1586 + cy=65 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1354 + ncy=58 + x=0 + y=0 + cx=1586 + cy=63 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/simplerecorder.lpr + history=20 + /home/fred/uos/examples/uos_flat.pas + /home/fred/sdl4msegui/testsdl/form2.pas + /home/fred/sdl4msegui/testsdl/testsdl.pas + /home/fred/mseide-msegui/lib/common/kernel/msegui.pas + /home/fred/mseide-msegui/lib/common/kernel/msectypes.pas + /home/fred/mseide-msegui_sdl/lib/common/kernel/msegui.pas + /home/fred/msegui_form_savetofile/form2file.pas + /home/fred/mseide-msegui_sdl/lib/common/kernel/linux/msesocketintf.pas + /home/fred/mseide-msegui_sdl/lib/common/kernel/sdl/msesocketintf.pas + /home/fred/mseide-msegui_sdl/lib/common/kernel/sdl/sdl2_types.inc + /home/fred/mseide-msegui_sdl/lib/common/kernel/mseclasses.pas + /home/fred/sdl4msegui/testsdl/main.pas + /home/fred/mseide-msegui_sdl/lib/common/widgets/msewidgets.pas + /home/fred/mseuniverse-main/sdl4msegui/lib/common/kernel/sdl/msesysintf1.pas + /home/fred/mseuniverse-main/sdl4msegui/lib/common/kernel/sdl/msesysintfhlinux.inc + /home/fred/mseide-msegui_sdl/lib/common/kernel/msesysintf.inc + /home/fred/mseide-msegui_sdl/lib/common/kernel/sdl/msesysintflinux.inc + /home/fred/mseide-msegui/lib/common/fpccompatibility/msefpwritepng.pas + /home/fred/ideu/src/ideusettings.pas + /home/fred/ideu_stadialogx/src/ideusettings.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=0 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=208 + y=0 + cx=1378 + cy=620 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302087659 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=68 + cx=1586 + cy=620 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/simplerecorder.res b/UOS/examples/simplerecorder.res new file mode 100644 index 0000000..18ed76a Binary files /dev/null and b/UOS/examples/simplerecorder.res differ diff --git a/UOS/examples/simplerecorder_fpGUI.lpi b/UOS/examples/simplerecorder_fpGUI.lpi new file mode 100644 index 0000000..323deda --- /dev/null +++ b/UOS/examples/simplerecorder_fpGUI.lpi @@ -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="Simple Recorder 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="simplerecorder_fpGUI.pas"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="SimpleRecodrer_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> diff --git a/UOS/examples/simplerecorder_fpGUI.pas b/UOS/examples/simplerecorder_fpGUI.pas new file mode 100644 index 0000000..52382af --- /dev/null +++ b/UOS/examples/simplerecorder_fpGUI.pas @@ -0,0 +1,734 @@ +program simplerecorder_fpGUI; + +{$mode objfpc}{$H+} +{$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + + cthreads, + cwstring, {$ENDIF} {$ENDIF} + SysUtils, + uos_flat, + ctypes, + Classes, + fpg_style_chrome_silver_flatmenu, + fpg_stylemanager, + fpg_button, + fpg_widget, + fpg_label, + fpg_TrackBar, + fpg_Editbtn, + fpg_CheckBox, + fpg_base, + fpg_main, + fpg_form; + +type + + TSimplerecorder = class(TfpgForm) + procedure uos_logo(Sender: TObject); + private + {@VFD_HEAD_BEGIN: Simpleplayer} + Custom1: TfpgWidget; + Labelport: TfpgLabel; + btnLoad: TfpgButton; + FilenameEdit1: TfpgFileNameEdit; + FilenameEdit2: TfpgFileNameEdit; + FilenameEdit4: TfpgFileNameEdit; + btnStart: TfpgButton; + btnStop: TfpgButton; + lposition: TfpgLabel; + Labelsnf: TfpgLabel; + button4: TfpgButton; + button5: TfpgButton; + CheckBox1: TfpgCheckBox; + Label2: TfpgLabel; + TrackBar2: TfpgTrackBar; + TrackBar3: TfpgTrackBar; + Label3: TfpgLabel; + Label4: TfpgLabel; + Label5: TfpgLabel; + CheckBox2: TfpgCheckBox; + {@VFD_HEAD_END: Simpleplayer} + public + procedure AfterCreate; override; + // constructor Create(AOwner: TComponent); + procedure btnLoadClick(Sender: TObject); + procedure btnCloseClick(Sender: TObject); + procedure btnStartClick(Sender: TObject); + procedure btnStopClick(Sender: TObject); + procedure btnPlaySavedClick(Sender: TObject); + procedure ClosePlayer1; + procedure VolumeChange(Sender: TObject; pos: integer); + procedure Changechk1(Sender: TObject); + end; + + {@VFD_NEWFORM_DECL} + + {@VFD_NEWFORM_IMPL} + +var + PlayerIndex1: cint32; + ordir, opath: string; + In1Index, out1index: cint32; + + thebuffer: array of cfloat; + thebufferinfos: TuosF_BufferInfos; + thememorystream: Tmemorystream; + + + procedure TSimplerecorder.Changechk1(Sender: TObject); + begin + uos_outputsetenable(0, out1Index, checkbox1.Checked); + end; + + procedure TSimplerecorder.btnStartClick(Sender: TObject); + var + inp: integer; + begin + if (checkbox1.Checked = True) or (checkbox2.Checked = True) then + begin + + PlayerIndex1 := 0; + + {$IF (FPC_FULLVERSION >= 20701) 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... + + // saving in a file using a File-Stream: + uos_AddIntoFile(PlayerIndex1, PChar(filenameEdit4.filename)); + + // saving in a Memory-Buffer: + // SetLength(thebuffer, 0); + // uos_AddIntoMemoryBuffer(PlayerIndex1, @thebuffer); + + // saving in a Memory-Stream: + // if thememorystream = nil then thememorystream := tmemorystream.create; + // uos_AddIntoMemoryStream(PlayerIndex1, (thememorystream),-1,-1,-1,-1); + + // saving in a file using a Menory-Stream: + // uos_AddIntoFileFromMem(PlayerIndex1, Pchar(filenameEdit4.filename)); + //// add Output into wav file (save record) with default parameters + + // uos_AddIntoFile(PlayerIndex1, Pchar(filenameEdit4.filename), -1, -1, 1, -1, -1); + //// add a Output into wav file (save record) with custom parameters + //////////// PlayerIndex : Index of a existing Player + //////////// Filename : name of new file for recording + //////////// SampleRate : delault : -1 (44100) + //////////// Channels : delault : -1 (2:stereo) ( 1:mono, 2:stereo, ...) + //////////// SampleFormat : -1 default : Int16 : (0: Float32, 1:Int32, 2:Int16) + //////////// FramesCount : -1 default : 65536 + //////////// FileFormat : -1 default : wav (0:wav, 1:pcm, 2:uos, 3:custom) + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + out1Index := uos_AddIntoDevOut(PlayerIndex1, -1, 0.08, -1, -1, -1, -1, -1) ; + {$else} + out1Index := uos_AddIntoDevOut(PlayerIndex1); + {$endif} + + uos_outputsetenable(PlayerIndex1, out1Index, checkbox1.Checked); + + + //// add a Output into OUT device with default parameters + + // uos_AddIntoDevOut(0, -1, -1, -1, -1, 1,-1, -1); + //// 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 : -1 default : 65536 + // ChunkCount : default : -1 (= 512) + // ChunkCount : default : -1 (= 512) + + In1Index := uos_AddFromDevIn(PlayerIndex1); + /// add Input from mic/aux into IN device with default parameters + + // In1Index := uos_AddFromDevIn(0, -1, -1, -1, -1, -1, -1, -1); + /// add Input from mic/aux into IN device with custom parameters + //////////// PlayerIndex : Index of a existing Player + //////////// Device ( -1 is default Input device ) + //////////// Latency ( -1 is latency suggested ) ) + //////////// SampleRate : delault : -1 (44100) + //////////// 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) + //////////// FramesCount : -1 default : 4096 ( > = safer, < = better latency ) + + uos_InputAddDSP1ChanTo2Chan(PlayerIndex1, In1Index); + ///// Convert mono one channel channel to stereo two channels. + //// If the input is stereo, original buffer is keeped. + ////////// InputIndex : InputIndex of a existing Input + // result : index of DSPIn in array + ////////// example DSPIndex1 := uos_InputAddDSP1ChanTo2Chan(PlayerIndex1, InputIndex1); + + uos_InputAddDSPVolume(PlayerIndex1, In1Index, 1, 1); + ///// DSP Volume changer + //////////// PlayerIndex : Index of a existing Player + ////////// In1Index : InputIndex of a existing input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + + uos_InputSetDSPVolume(PlayerIndex1, In1Index, (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); /// Set volume + + /////// procedure to execute when stream is terminated + 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 + + uos_Play(PlayerIndex1); /////// everything is ready to play... + + CheckBox2.Enabled := False; + btnStart.Enabled := False; + btnStop.Enabled := True; + button5.Enabled := False; + button4.Enabled := False; + end; + + end; + + procedure TSimplerecorder.btnPlaySavedClick(Sender: TObject); + begin + + // if fileexists( Pchar(filenameedit4.FileName)) then begin + + // writeln('length(StreamIn[x].MemoryStreamDec) = '+inttostr(StreamIn[x].MemoryStreamDec.size)) ; + // writeln('length(MemoryStream) = '+inttostr(theMemoryStream.size)) ; + + PlayerIndex1 := 1; // 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(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... + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + uos_AddIntoDevOut(PlayerIndex1, -1, 0.08, -1, -1, -1, -1, -1) ; + {$else} + uos_AddIntoDevOut(PlayerIndex1); + // uos_AddIntoDevOut(PlayerIndex1, -1, -1, -1, -1, -1, 1024*4, -1) ; + {$endif} + + // uos_AddIntoDevOut(0, -1, -1, -1, -1, 0,-1, -1); //// 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 : -1 default : 65536 + // ChunkCount : default : -1 (= 512) + + // from audio-encoded file + if fileexists(PChar(filenameedit4.FileName)) then + In1Index := uos_AddFromFile(PlayerIndex1, PChar(filenameedit4.FileName)); + + // from Memory-Buffer + // uos_CustBufferInfos(thebufferinfos, 44100, 2, 2 ,Length(thebuffer) div 2); + // In1Index := uos_AddFromMemoryBuffer(PlayerIndex1,thebuffer,thebufferinfos, -1, -1); + + // from Memory-Stream + // uos_CustBufferInfos(thebufferinfos, 44100, 2, 2 ,thememorystream.size div 2); + // In1Index := uos_AddFromMemoryStreamdec(PlayerIndex1,(thememorystream),thebufferinfos, -1, -1); + + + //// add input from audio file with default parameters + // In1Index := Player1.AddFromFile(0, Edit3.Text, -1, 0); //// add input from audio file with custom parameters + //////////// PlayerIndex : Index of a existing Player + ////////// FileName : filename of audio file + ////////// 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 + + uos_InputAddDSPVolume(PlayerIndex1, In1Index, 1, 1); + ///// DSP Volume changer + //////////// PlayerIndex : Index of a existing Player + ////////// In1Index : InputIndex of a existing input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + + uos_InputSetDSPVolume(PlayerIndex1, In1Index, (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); /// Set volume + + /////// procedure to execute when stream is terminated + 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 + + btnStart.Enabled := False; + btnStop.Enabled := False; + button4.Enabled := False; + button5.Enabled := True; + + uos_Play(PlayerIndex1); /////// everything is ready to play... + + end; + + procedure TSimplerecorder.VolumeChange(Sender: TObject; pos: integer); + begin + if (btnstart.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex1, In1Index, (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); + end; + + + procedure TSimplerecorder.btnCloseClick(Sender: TObject); + begin + if (btnstart.Enabled = False) then + begin + uos_stop(PlayerIndex1); + sleep(100); + end; + if btnLoad.Enabled = False then + uos_free(); + end; + + procedure TSimplerecorder.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, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + + if uos_LoadLib(PChar(FilenameEdit1.FileName), PChar(FilenameEdit2.FileName), nil, nil, nil, nil, nil) = 0 then + begin + hide; + Height := 305; + btnStart.Enabled := True; + btnLoad.Enabled := False; + FilenameEdit1.ReadOnly := True; + FilenameEdit2.ReadOnly := True; + UpdateWindowPosition; + btnLoad.Text := 'PortAudio and SndFile libraries are loaded...'; + WindowPosition := wpScreenCenter; + fpgapplication.ProcessMessages; + sleep(500); + Show; + end; + end; + + procedure TSimplerecorder.ClosePlayer1; + begin + btnStart.Enabled := True; + btnStop.Enabled := False; + button4.Enabled := True; + button5.Enabled := False; + CheckBox1.Enabled := True; + CheckBox2.Enabled := True; + end; + + procedure TSimplerecorder.btnStopClick(Sender: TObject); + begin + uos_Stop(PlayerIndex1); + end; + + + procedure TSimplerecorder.AfterCreate; + begin + {%region 'Auto-generated GUI code' -fold} + {@VFD_BODY_BEGIN: Simpleplayer} + Name := 'Simpleplayer'; + SetPosition(392, 184, 502, 316); + WindowTitle := 'Simple Recorder'; + 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(140, 12, 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, 28, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 3; + end; + + FilenameEdit2 := TfpgFileNameEdit.Create(self); + with FilenameEdit2 do + begin + Name := 'FilenameEdit2'; + SetPosition(136, 80, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 4; + end; + + FilenameEdit4 := TfpgFileNameEdit.Create(self); + with FilenameEdit4 do + begin + Name := 'FilenameEdit4'; + SetPosition(124, 192, 364, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 5; + end; + + btnStart := TfpgButton.Create(self); + with btnStart do + begin + Name := 'btnStart'; + SetPosition(244, 232, 68, 23); + Text := 'Start'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 6; + Hint := ''; + onclick := @btnstartClick; + end; + + btnStop := TfpgButton.Create(self); + with btnStop do + begin + Name := 'btnStop'; + SetPosition(344, 232, 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(144, 173, 312, 19); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of wav saved file'; + Hint := ''; + end; + + Labelsnf := TfpgLabel.Create(self); + with Labelsnf do + begin + Name := 'Labelsnf'; + SetPosition(140, 64, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of SndFile Library'; + Hint := ''; + end; + + button4 := TfpgButton.Create(self); + with button4 do + begin + Name := 'button4'; + SetPosition(184, 268, 112, 23); + Text := 'Play saved file'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 15; + Hint := ''; + onclick := @btnPlaySavedClick; + end; + + button5 := TfpgButton.Create(self); + with button5 do + begin + Name := 'button5'; + SetPosition(324, 268, 104, 23); + Text := 'Stop saved file'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 16; + Hint := ''; + onclick := @btnStopClick; + end; + + CheckBox1 := TfpgCheckBox.Create(self); + with CheckBox1 do + begin + Name := 'CheckBox1'; + SetPosition(132, 224, 104, 19); + Checked := True; + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 17; + Text := 'Listen MIC'; + Hint := ''; + OnChange := @Changechk1; + end; + + Label2 := TfpgLabel.Create(self); + with Label2 do + begin + Name := 'Label2'; + SetPosition(124, 155, 356, 15); + Alignment := taCenter; + FontDesc := '#Label2'; + ParentShowHint := False; + Text := 'WARNING : Use headphones or set volume to low...'; + TextColor := TfpgColor($FFFF0000); + Hint := ''; + end; + + TrackBar2 := TfpgTrackBar.Create(self); + with TrackBar2 do + begin + Name := 'TrackBar2'; + SetPosition(16, 176, 32, 98); + Orientation := orVertical; + ParentShowHint := False; + TabOrder := 23; + Hint := ''; + OnChange := @volumechange; + end; + + TrackBar3 := TfpgTrackBar.Create(self); + with TrackBar3 do + begin + Name := 'TrackBar3'; + SetPosition(60, 176, 28, 98); + Orientation := orVertical; + ParentShowHint := False; + TabOrder := 24; + Hint := ''; + OnChange := @volumechange; + end; + + Label3 := TfpgLabel.Create(self); + with Label3 do + begin + Name := 'Label3'; + SetPosition(12, 156, 84, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Volume'; + Hint := ''; + end; + + Label4 := TfpgLabel.Create(self); + with Label4 do + begin + Name := 'Label4'; + SetPosition(8, 280, 40, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Left'; + Hint := ''; + end; + + Label5 := TfpgLabel.Create(self); + with Label5 do + begin + Name := 'Label5'; + SetPosition(56, 280, 36, 19); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Right'; + Hint := ''; + end; + + CheckBox2 := TfpgCheckBox.Create(self); + with CheckBox2 do + begin + Name := 'CheckBox2'; + SetPosition(132, 244, 100, 19); + Checked := True; + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 22; + Text := 'Save to file'; + Hint := ''; + end; + + {@VFD_BODY_END: Simpleplayer} + {%endregion} + + ////////////////////// + + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + CheckBox1.Checked := True; + CheckBox2.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'; +{$else} + FilenameEdit1.FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + FilenameEdit2.FileName := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + {$endif} + FilenameEdit4.FileName := ordir + 'sound\testrecord.wav'; + {$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'; + FilenameEdit4.FileName := opath + 'sound/testrecord.wav'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + FilenameEdit1.FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + FilenameEdit2.FileName := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + FilenameEdit4.FileName := opath + 'sound/testrecord.wav'; + {$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'; + FilenameEdit4.FileName := ordir + 'sound/testrecord.wav'; + {$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'; + FilenameEdit4.FileName := ordir + 'sound/testrecord.wav'; + {$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'; + FilenameEdit4.FileName := ordir + 'sound/testrecord.wav'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + FilenameEdit1.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + FilenameEdit2.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + FilenameEdit4.FileName := ordir + 'sound/testrecord.wav'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + FilenameEdit1.FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + FilenameEdit2.FileName := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + {$else} + FilenameEdit1.FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + FilenameEdit2.FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + {$endif} + FilenameEdit4.FileName := ordir + 'sound/testrecord.wav'; + {$ENDIF} + + ////////////////////////////////////////////////////////////////////////// + + FilenameEdit4.Initialdir := ordir + 'sound'; + FilenameEdit1.Initialdir := ordir + 'lib'; + FilenameEdit2.Initialdir := ordir + 'lib'; + //thememorystream := Tmemorystream.create; + end; + + procedure TSimplerecorder.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: TSimplerecorder; + begin + fpgApplication.Initialize; + if fpgStyleManager.SetStyle('Chrome silver flat menu') then + fpgStyle := fpgStyleManager.Style; + fpgApplication.CreateForm(TSimplerecorder, frm); + try + frm.Show; + fpgApplication.Run; + finally + // if thememorystream <> nil then + FreeAndNil(thememorystream); + frm.Free; + end; + end; + +begin + MainProc; +end. + diff --git a/UOS/examples/simplerecorder_fpGUI.prj b/UOS/examples/simplerecorder_fpGUI.prj new file mode 100644 index 0000000..a75b49b --- /dev/null +++ b/UOS/examples/simplerecorder_fpGUI.prj @@ -0,0 +1,1403 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/simplerecorder_fpGUI.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=simplerecorder_fpGUI.pas +targetfile=simplerecorder_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/simplerecorder_fpGUI.pas +relpaths=1 + simplerecorder_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/simplerecorder_fpGUI.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/simplewebplayer.lpi b/UOS/examples/simplewebplayer.lpi new file mode 100644 index 0000000..c429094 --- /dev/null +++ b/UOS/examples/simplewebplayer.lpi @@ -0,0 +1,726 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="12"/> + <General> + <Flags> + <CompatibilityMode Value="True"/> + </Flags> + <Title Value="SimpleWebPlayer"/> + <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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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="64"> + <Unit0> + <Filename Value="simplewebplayer.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="7"/> + <WindowIndex Value="1"/> + <CursorPos Y="4"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main_sp.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <CursorPos X="4" Y="407"/> + <UsageCount Value="200"/> + </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="/usr/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="/usr/lib/codetyphon/lazarus/lcl/graphics.pp"/> + <TopLine Value="1168"/> + <CursorPos X="49" Y="1181"/> + <UsageCount Value="8"/> + </Unit21> + <Unit22> + <Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/objpas/objpas.pp"/> + <TopLine Value="119"/> + <CursorPos X="8" Y="28"/> + <UsageCount Value="6"/> + </Unit22> + <Unit23> + <Filename Value="uos.pas"/> + <WindowIndex Value="1"/> + <TopLine Value="7967"/> + <CursorPos X="85" Y="7973"/> + <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="/usr/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="/usr/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"/> + <TopLine Value="158"/> + <CursorPos X="5" Y="167"/> + <UsageCount Value="17"/> + </Unit36> + <Unit37> + <Filename Value="simplewebplayer_fpGUI.lpr"/> + <TopLine Value="263"/> + <CursorPos X="29" Y="270"/> + <UsageCount Value="11"/> + </Unit37> + <Unit38> + <Filename Value="/media/fred/Windows7/uos/examples/main_sp.pas"/> + <TopLine Value="108"/> + <CursorPos X="37" Y="119"/> + <UsageCount Value="10"/> + </Unit38> + <Unit39> + <Filename Value="uos_soundtouch.pas"/> + <CursorPos X="10" Y="7"/> + <UsageCount Value="13"/> + </Unit39> + <Unit40> + <Filename Value="uos_soundtouchok.pas"/> + <TopLine Value="92"/> + <CursorPos X="40" Y="101"/> + <UsageCount Value="10"/> + </Unit40> + <Unit41> + <Filename Value="../../uos-master/examples/uos.pas"/> + <CursorPos X="66" Y="517"/> + <UsageCount Value="12"/> + </Unit41> + <Unit42> + <Filename Value="../../uos2/src/uos.pas"/> + <TopLine Value="1906"/> + <CursorPos X="38" Y="1917"/> + <UsageCount Value="10"/> + </Unit42> + <Unit43> + <Filename Value="/usr/share/lazarus/1.2RC2/ide/compiler.pp"/> + <TopLine Value="30"/> + <CursorPos X="6" Y="33"/> + <UsageCount Value="10"/> + </Unit43> + <Unit44> + <Filename Value="../../libuos/src/libuos.pas"/> + <TopLine Value="3"/> + <CursorPos X="32" Y="24"/> + <UsageCount Value="16"/> + </Unit44> + <Unit45> + <Filename Value="simplewebplayer_fpGUI.pas"/> + <EditorIndex Value="3"/> + <WindowIndex Value="1"/> + <TopLine Value="332"/> + <CursorPos X="50" Y="348"/> + <UsageCount Value="13"/> + <Loaded Value="True"/> + </Unit45> + <Unit46> + <Filename Value="../../codetyphon/fpcsrc/rtl/objpas/sysutils/filutilh.inc"/> + <CursorPos X="10" Y="143"/> + <UsageCount Value="11"/> + </Unit46> + <Unit47> + <Filename Value="../../lazarus/fpc/2.6.2/source/rtl/win/sysutils.pp"/> + <UsageCount Value="11"/> + </Unit47> + <Unit48> + <Filename Value="../../lazarus/components/lazutils/fileutil.pas"/> + <TopLine Value="24"/> + <CursorPos X="65" Y="29"/> + <UsageCount Value="11"/> + </Unit48> + <Unit49> + <Filename Value="../../codetyphon/typhon/components/lazutils/fileutil.pas"/> + <TopLine Value="201"/> + <CursorPos X="19" Y="217"/> + <UsageCount Value="10"/> + </Unit49> + <Unit50> + <Filename Value="uos_flat.pas"/> + <EditorIndex Value="4"/> + <WindowIndex Value="1"/> + <TopLine Value="391"/> + <CursorPos X="24" Y="401"/> + <UsageCount Value="14"/> + <Loaded Value="True"/> + </Unit50> + <Unit51> + <Filename Value="uos_libsndfile.pas"/> + <TopLine Value="281"/> + <CursorPos X="3" Y="289"/> + <UsageCount Value="12"/> + </Unit51> + <Unit52> + <Filename Value="/usr/lib/codetyphon/fpcsrc/rtl/linux/ptypes.inc"/> + <TopLine Value="90"/> + <CursorPos X="5" Y="94"/> + <UsageCount Value="10"/> + </Unit52> + <Unit53> + <Filename Value="main_wsp.pas"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <WindowIndex Value="1"/> + <TopLine Value="505"/> + <CursorPos Y="515"/> + <UsageCount Value="12"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit53> + <Unit54> + <Filename Value="uos_httpgetthread.pas"/> + <EditorIndex Value="6"/> + <WindowIndex Value="1"/> + <TopLine Value="21"/> + <CursorPos X="71" Y="32"/> + <UsageCount Value="12"/> + <Loaded Value="True"/> + </Unit54> + <Unit55> + <Filename Value="../../uoslib/src/uoslib.pas"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <TopLine Value="871"/> + <CursorPos X="18" Y="895"/> + <UsageCount Value="10"/> + </Unit55> + <Unit56> + <Filename Value="../../uoslib/src/uoslib_h.pas"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <TopLine Value="240"/> + <CursorPos X="50" Y="247"/> + <UsageCount Value="10"/> + </Unit56> + <Unit57> + <Filename Value="/usr/share/lazarus/1.2.6/components/lazutils/paswstring.pas"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <TopLine Value="371"/> + <CursorPos X="43" Y="379"/> + <UsageCount Value="10"/> + </Unit57> + <Unit58> + <Filename Value="conswebstream.pas"/> + <EditorIndex Value="5"/> + <WindowIndex Value="1"/> + <TopLine Value="77"/> + <CursorPos X="3" Y="85"/> + <UsageCount Value="12"/> + <Loaded Value="True"/> + </Unit58> + <Unit59> + <Filename Value="../../opusfile-0.7/include/opusfile.pas"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <UsageCount Value="11"/> + </Unit59> + <Unit60> + <Filename Value="../../opus-1.1.3/include/opus.h"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <CursorPos Y="154"/> + <UsageCount Value="11"/> + <DefaultSyntaxHighlighter Value="C++"/> + </Unit60> + <Unit61> + <Filename Value="/usr/local/codetyphon/fpcsrc/packages/fcl-web/src/base/fphttpclient.pp"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <UsageCount Value="11"/> + </Unit61> + <Unit62> + <Filename Value="/usr/local/codetyphon/fpcsrc/packages/fcl-web/src/base/fphttpserver.pp"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="1"/> + <TopLine Value="32"/> + <UsageCount Value="11"/> + </Unit62> + <Unit63> + <Filename Value="uos_define.inc"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="2"/> + <WindowIndex Value="1"/> + <CursorPos X="3" Y="14"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit63> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="main_wsp.pas"/> + <Caret Line="331" Column="14" TopLine="322"/> + </Position1> + <Position2> + <Filename Value="main_wsp.pas"/> + <Caret Line="313" Column="66" TopLine="313"/> + </Position2> + <Position3> + <Filename Value="main_wsp.pas"/> + <Caret Line="514" Column="73" TopLine="510"/> + </Position3> + <Position4> + <Filename Value="main_wsp.pas"/> + <Caret Line="54" Column="114" TopLine="51"/> + </Position4> + <Position5> + <Filename Value="main_wsp.pas"/> + <Caret Line="60" Column="14" TopLine="51"/> + </Position5> + <Position6> + <Filename Value="main_wsp.pas"/> + <Caret Line="142" Column="42" TopLine="126"/> + </Position6> + <Position7> + <Filename Value="main_wsp.pas"/> + <Caret Line="144" Column="18" TopLine="128"/> + </Position7> + <Position8> + <Filename Value="main_wsp.pas"/> + <Caret Line="308" Column="33" TopLine="289"/> + </Position8> + <Position9> + <Filename Value="main_wsp.pas"/> + <Caret Line="502" Column="27" TopLine="497"/> + </Position9> + <Position10> + <Filename Value="main_wsp.pas"/> + <Caret Line="513" Column="12" TopLine="497"/> + </Position10> + <Position11> + <Filename Value="main_wsp.pas"/> + <Caret Line="54" Column="73" TopLine="51"/> + </Position11> + <Position12> + <Filename Value="uos.pas"/> + <Caret Line="1047" Column="7" TopLine="1046"/> + </Position12> + <Position13> + <Filename Value="uos.pas"/> + <Caret Line="1102" Column="26" TopLine="1085"/> + </Position13> + <Position14> + <Filename Value="main_wsp.pas"/> + <Caret Line="279" Column="15" TopLine="277"/> + </Position14> + <Position15> + <Filename Value="main_wsp.pas"/> + <Caret Line="280" Column="15" TopLine="278"/> + </Position15> + <Position16> + <Filename Value="main_wsp.pas"/> + <Caret Line="291" Column="24" TopLine="279"/> + </Position16> + <Position17> + <Filename Value="main_wsp.pas"/> + <Caret Line="300" Column="66" TopLine="291"/> + </Position17> + <Position18> + <Filename Value="main_wsp.pas"/> + <Caret Line="534" Column="24" TopLine="527"/> + </Position18> + <Position19> + <Filename Value="main_wsp.pas"/> + <Caret Line="533" Column="24" TopLine="526"/> + </Position19> + <Position20> + <Filename Value="main_wsp.pas"/> + <Caret Line="532" Column="24" TopLine="525"/> + </Position20> + <Position21> + <Filename Value="main_wsp.pas"/> + <Caret Line="60" Column="14" TopLine="51"/> + </Position21> + <Position22> + <Filename Value="main_wsp.pas"/> + <Caret Line="144" Column="39" TopLine="135"/> + </Position22> + <Position23> + <Filename Value="main_wsp.pas"/> + <Caret Line="311" Column="18" TopLine="295"/> + </Position23> + <Position24> + <Filename Value="main_wsp.pas"/> + <Caret Line="313" Column="18" TopLine="297"/> + </Position24> + <Position25> + <Filename Value="main_wsp.pas"/> + <Caret Line="502" Column="40" TopLine="379"/> + </Position25> + <Position26> + <Filename Value="main_wsp.pas"/> + <Caret Line="193" Column="2" TopLine="184"/> + </Position26> + <Position27> + <Filename Value="main_wsp.pas"/> + <Caret Line="509" Column="31" TopLine="496"/> + </Position27> + <Position28> + <Filename Value="main_wsp.pas"/> + <Caret Line="448" Column="19" TopLine="442"/> + </Position28> + <Position29> + <Filename Value="main_wsp.pas"/> + <Caret Line="88" Column="19" TopLine="78"/> + </Position29> + <Position30> + <Filename Value="main_wsp.pas"/> + <Caret Line="151" Column="62" TopLine="142"/> + </Position30> + </JumpHistory> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="SimpleWebPlayer"/> + </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"/> + <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="5"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + <Item4> + <Name Value="ESocketError"/> + </Item4> + <Item5> + <Name Value="EReadError"/> + </Item5> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/UOS/examples/simplewebplayer.lpr b/UOS/examples/simplewebplayer.lpr new file mode 100644 index 0000000..4fe9c1b --- /dev/null +++ b/UOS/examples/simplewebplayer.lpr @@ -0,0 +1,22 @@ + +program simplewebplayer; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + cthreads, + cwstring, {$ENDIF} {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, + main_wsp { you can add units after this }; + +begin + Application.Title := 'SimpleWebPlayer'; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + + diff --git a/UOS/examples/simplewebplayer.prj b/UOS/examples/simplewebplayer.prj new file mode 100644 index 0000000..54633a7 --- /dev/null +++ b/UOS/examples/simplewebplayer.prj @@ -0,0 +1,1500 @@ +[componentpalette] +order0=0 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos_xmp/examples +projectfilename=/home/fred/uos_xmp/examples/simplewebplayer.prj +findinfiledialog=77 + [findinfileadialogfo.dir] + filenames=1 + /home/fred/espeak-ng-master/ + filenamescust=0 + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=0 + colsizewidth=0 + colextwidth=0 + coldatewidth=0 + splitterplaces=0 + splitterlateral=0 + lastdir=/home/fred/espeak-ng-master/ + filehistory=4 + /home/fred/espeak-ng-master/ + /home/fred/espeak-1.48.04-source/ + /usr/local/codetyphon/ + /home/graemeg/devel/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" "*.*" + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.incurrentfile] + value=0 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.indirectories] + value=0 + [findinfileadialogfo.inprojectdir] + value=1 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=3 + "*.pas" "*.pp" "*.inc" + "*.pas" "*.pp" "*.inc" "*.*" + "*.pas" "*.pp" "*.inc" + [findinfileadialogfo.findtext] + value=mp4ff_atom + history=19 + mp4ff_atom + mpg_read_stream + mp4ff_ + application_name + create_audio_device_object + option_device + loadlib + loadlibrary + portaudio + if (out_samplerate != 0) + out_samplerate + Jonathan Duddington + pcaudiolib + windres + resbin + fpcres + uos_AddIntoDevOut + lapAutoAdjustForDPI + + [findinfileadialogfo] + stackedunder=finddialogfo + x=241 + y=281 + cx=341 + cy=334 +finddialog=8 + [finddialogfo.selectedonly] + value=0 + [finddialogfo] + stackedunder= + x=973 + y=345 + cx=312 + cy=291 +replacedialog=15 + [replacedialogfo.promptonreplace] + value=1 + [replacedialogfo.selectedonly] + value=0 + [replacedialogfo.replacetext] + value=// + history=2 + // + + [replacedialogfo] + stackedunder= + x=447 + y=253 + cx=389 + cy=216 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=708 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=125 + sortdescend4=0 + width5=245 + sortdescend5=0 + width6=289 + sortdescend6=0 + width7=49 + sortdescend7=0 + width8=1 + sortdescend8=0 + width9=290 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=563 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=270 + sortdescend3=0 + width4=284 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=19 + [projectoptionsfo.newfile] + firsttab=0 + index=0 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=389 + width0=98 + sortdescend0=0 + width1=378 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=168 + xprop=1 + yprop=0.2398316970547 + [projectoptionsfo.macrogrid] + propcolwidthref=481 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=465 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=3 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=699 + width0=47 + sortdescend0=0 + width1=693 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=0 + [projectoptionsfo.filefiltergrid] + propcolwidthref=734 + width0=112 + sortdescend0=0 + width1=727 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=586 + y=119 + cx=759 + cy=776 +settings=8 + [settings_form] + x=447 + y=138 + cx=482 + cy=724 + wsize=0 + active=1 + visible=1 +mainfile=${PROJECTNAME}.lpr +targetfile=${PROJECTNAME}${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=16 + ${lcldir}* + ${lcldir}/components/* + ${lcldir}/* + /home/fred/fpcupdeluxe/lazarus/lcl/nonwin32 + /home/fred/fpcupdeluxe/lazarus/lcl/widgetset + /home/fred/fpcupdeluxe/lazarus/lcl/forms + /home/fred/fpcupdeluxe/lazarus/lcl/templates + /home/fred/fpcupdeluxe/lazarus/lcl/languages + /home/fred/fpcupdeluxe/lazarus/lcl/include + /home/fred/fpcupdeluxe/lazarus/lcl/images + /home/fred/fpcupdeluxe/lazarus/lcl/forms + /home/fred/fpcupdeluxe/lazarus/lcl/interfaces/gtk2 + /home/fred/fpcupdeluxe/lazarus/lcl/interfaces/win32 + ${lcldir}/lcl/components/* + ${lcldir}/lcl/include + ${lcldir}/lcl +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=8 + -l -Mobjfpc -Sh + -gl + -ghl + -B + -O- + -O2 -XX -CX -Xs + -vi + -FUunits +makeoptpurpose=8 + + + + + + + + +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}default/program.pas + ${TEMPLATEDIR}default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}default/mainform.pas + ${TEMPLATEDIR}default/simpleform.pas + ${TEMPLATEDIR}default/dockingform.pas + ${TEMPLATEDIR}default/datamodule.pas + ${TEMPLATEDIR}default/subform.pas + ${TEMPLATEDIR}default/scrollboxform.pas + ${TEMPLATEDIR}default/tabform.pas + ${TEMPLATEDIR}default/dockpanelform.pas + ${TEMPLATEDIR}default/report.pas + ${TEMPLATEDIR}default/pascform.pas + ${TEMPLATEDIR}default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}default/mainform.mfm + ${TEMPLATEDIR}default/simpleform.mfm + ${TEMPLATEDIR}default/dockingform.mfm + ${TEMPLATEDIR}default/datamodule.mfm + ${TEMPLATEDIR}default/subform.mfm + ${TEMPLATEDIR}default/scrollboxform.mfm + ${TEMPLATEDIR}default/tabform.mfm + ${TEMPLATEDIR}default/dockpanelform.mfm + ${TEMPLATEDIR}default/report.mfm + ${TEMPLATEDIR}default/pascform.mfm + ${TEMPLATEDIR}default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=0 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=1 +settingsdebugger=1 +settingsstorage=1 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=8 + 127 + 2 + 0 + 71 + 2 + 61 + 4095 + 4095 +compilerusedon=29 + 3892 + 11 + 0 + 0 + 0 + 64 + 128 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 3844 + 0 + 0 + 0 + 0 + 123 +exeusedon=14 + 3903 + 0 + 192 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=15:21:42 26/03/2017 +project_comment= +aftcommandon=0 +unitdirson=16 + 987135 + 987135 + 987135 + 986943 + 987135 + 987135 + 987135 + 987135 + 987135 + 987135 + 987135 + 986943 + 983232 + 987135 + 987135 + 987135 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal_ideu.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=4 +linenumberson=1 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=1 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=16 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=1 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=0 +path=0 +line=0 +address=0 +addbkpt=0 +ignore=0 +condition=0 +panels=1 + panel1 +units= + ( + a=0,8228,6,Pascal Units + ) +cmodules= + ( + a=0,8228,6,C Modules + ) +files= + ( + a=0,8228,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=100 +x=421 +y=284 +cx=597 +cy=298 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=0 +hintheight=0 +finddtext=FA_ +findhistory=20 + FA_ + fdkaac + Tuos_Init.unloadlibCust + uos_unloadlibCust + loadlib + uosLoadResult.XMloadERROR := -1; + Aa_Unload; + Tuos_Player.ReadUrl + StreamIn[x].httpget.Terminate + op_free(StreamIn[x].Data.H + Tuos_Player.AddFromUR + function uos_loadlib + unloadlibCust + Tuos_Init = class + unloadlib + LoadLib + external + fdkaacdecoder + internal + implementation +findoptions=1 +editpos=10 + 0,0 + 0,154 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,-1073741823 + 0,86 + 0,1331 + 0,-1073741823 + 0,417 +bookmarks0=0 +bookmarks1=0 +bookmarks2=0 +bookmarks3=0 +bookmarks4=0 +bookmarks5=0 +bookmarks6=0 +bookmarks7=0 +bookmarks8=0 +bookmarks9=0 +sourcefiles=10 + ${PROJECTDIR}/simplewebplayer.lpr + ${PROJECTDIR}/main_wsp.pas + ${PROJECTDIR}/uos_aac.pas + ${PROJECTDIR}/uos_flat.pas + ${PROJECTDIR}/uos_define.inc + ${PROJECTDIR}/uos_opus.pas + ${PROJECTDIR}/uos.pas + ${PROJECTDIR}/uos_fdkaacdecoder.pas + ${PROJECTDIR}/uos_yeeep.pas + ${PROJECTDIR}/uos_libxmp.pas +relpaths=10 + simplewebplayer.lpr + main_wsp.pas + uos_aac.pas + uos_flat.pas + uos_define.inc + uos_opus.pas + uos.pas + uos_fdkaacdecoder.pas + uos_yeeep.pas + uos_libxmp.pas +ismoduletexts=10 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +order=10 + 0 + 1 + 9 + 7 + 2 + 3 + 4 + 5 + 6 + 8 +firsttab=0 +index=3 +[layout] +windowlayout=582 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=58 + y=67 + cx=1334 + cy=707 + rcx=0 + rcy=0 + wsize=6 + active=1 + visible=1 + [findmessagefo.findtext] + value=mysqldyn + history=3 + not inlined + linux + used + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=401 + y=181 + cx=895 + cy=568 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=1 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=987 + cy=262 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=conflangfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=27 + width0=141 + sortdescend0=0 + width1=25 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=697 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=332 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=149 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=172 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=projecttreefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=0 + [objectinspectorfo.grid] + propcolwidthref=468 + width0=112 + sortdescend0=0 + width1=350 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=732 + cx=1427 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=confdebuggerfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1427 + cy=58 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1427 + ncy=63 + x=0 + y=0 + cx=1427 + cy=63 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos_xmp/examples/uos_fdkaacdecoder.pas + history=50 + /home/fred/uos_xmp/examples/uos_yeeep.pas + /home/fred/uos_xmp/examples/uos_fdkaacdecoder.pas + /home/fred/uos_xmp/examples/uos2.pas + /home/fred/uos_xmp_aacwebsteam/examples/mainmse_sp.pas + /home/fred/uos_xmp_aacwebsteam/examples/main_sp.pas + /home/fred/uos_xmp_aacwebsteam/examples/uos.pas + /home/fred/uos_xmp_aacwebsteam/examples/uos_httpgetthread.pas + /home/fred/uos_xmp/examples/uos_aacdecoder.pas + /home/fred/uos_work/examples/consoleplaymemorystream.pas + /home/fred/uos_work/examples/conswebstream.pas + /home/fred/libfdk-aac-fpc/Examples/aac-dec/Project1.pas + /home/fred/libfdk-aac-fpc/Include/FDK_audio.pas + /home/fred/libfdk-aac-fpc/Include/aacdecoder_lib.pas + /home/fred/libfdk-aac-fpc/Examples/aac-dec/Project1.prj + /home/fred/libfdk-aac-fpc/Examples/aac-dec/Project1.dpr + /home/fred/uos_xmp/examples/uos_libxmp.pas + /home/fred/uos/examples/consoleplay.pas + /home/fred/uos/examples/uos_libxmp.pas + /home/fred/uos/examples/main_sp.pas + /home/fred/xmp_test/libxmp.pas + /home/fred/uos_xmp/examples/uos_define.inc + /home/fred/uos_xmp/examples/uos_aac.pas + /home/fred/uos_xmp/examples/uos.pas + /home/fred/uos_xmp/examples/mainmse_sp.pas + /home/fred/uos_xmp/examples/SimplePlayer_MSE.pas + /home/fred/uos_xmp/examples/uos_flat.pas + /home/fred/gme_pas_work/gme_test_console/libgme.pas + /home/fred/Downloads/project1_xmp_win_lin/unit1.pas + /home/fred/gme_pas_work/gme_test_console/gmetest.pas + /home/fred/Downloads/project1_gme_win_lin/gme.pas + /home/fred/Downloads/project1_gme_win_lin/unit1.pas + /home/fred/Downloads/project1_xmp_win_lin/project1.lpr + /home/fred/tron/project1_gme_win_lin/gme.pas + /home/fred/uos_xmp/examples/main_sp.pas + /home/fred/tron/project1_gme_win_lin/project1.lpr + /home/fred/tron/project1/gme.pas + /home/fred/tron/project1/unit1.pas + /home/fred/tron/project1/project1.prj + /home/fred/tron/project1/project1.lpr + /home/fred/uos/src/uos_libsndfile.pas + /home/fred/uos/src/uos_portaudio.pas + /home/fred/xmp_test/xmptest.prj + /home/fred/xmp_test/xmptest.pas + /home/fred/Downloads/apngopt-1.4-src/apngopt.cpp + /home/fred/SimpleWebStreamer/uos_soundtouch.pas + /home/fred/strumpract_work/src/msefiledialogx.pas + /home/fred/strumpract/src/msefiledialogx.pas + /home/fred/strumpract/src/splash.pas + /home/fred/strumpract/src/uos_flat.pas + /home/fred/strumpract/src/infosd.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=0 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1427 + cy=668 + rcx=0 + rcy=0 + [sourcefo.files_tab] + order=10 + 0 + 1 + 9 + 7 + 2 + 3 + 4 + 5 + 6 + 8 + firsttab=0 + index=3 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=61 + cx=1427 + cy=668 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/simplewebplayer_fpGUI.lpi b/UOS/examples/simplewebplayer_fpGUI.lpi new file mode 100644 index 0000000..e41e9c2 --- /dev/null +++ b/UOS/examples/simplewebplayer_fpGUI.lpi @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasTitleStatement Value="False"/> + <LRSInOutputDirectory Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="UOS Simple Web Player 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="simplewebplayer_fpGUI.pas"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="SimpleWebPlayer_FPG"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <Optimizations> + <OptimizationLevel Value="3"/> + </Optimizations> + </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> diff --git a/UOS/examples/simplewebplayer_fpGUI.pas b/UOS/examples/simplewebplayer_fpGUI.pas new file mode 100644 index 0000000..69a74fd --- /dev/null +++ b/UOS/examples/simplewebplayer_fpGUI.pas @@ -0,0 +1,1046 @@ +program simplewebplayer_fpGUI; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} + cthreads, + cwstring, {$ENDIF} + SysUtils, + fpg_style_chrome_silver_flatmenu, + fpg_stylemanager, + uos_flat, + ctypes, + Classes, + fpg_button, + fpg_widget, + fpg_label, + fpg_Edit, + fpg_Editbtn, + fpg_RadioButton, + fpg_trackbar, + fpg_CheckBox, + fpg_Panel, + fpg_base, + fpg_main, + uos_Opusurl, + fpg_form; + +type + TSimpleplayer = class(TfpgForm) + procedure uos_logo(Sender: TObject); + private + {@VFD_HEAD_BEGIN: Simpleplayer} + Custom1: TfpgWidget; + Labelport: TfpgLabel; + btnLoad: TfpgButton; + FilenameEdit1: TfpgFileNameEdit; + btnStart: TfpgButton; + btnStop: TfpgButton; + Labelmpg: TfpgLabel; + Labelst: TfpgLabel; + FilenameEdit3: TfpgFileNameEdit; + FilenameEdit5: TfpgFileNameEdit; + btnpause: TfpgButton; + btnresume: TfpgButton; + RadioButton1: TfpgRadioButton; + RadioButton2: TfpgRadioButton; + RadioButton3: TfpgRadioButton; + Label2: TfpgLabel; + TrackBar2: TfpgTrackBar; + TrackBar3: TfpgTrackBar; + Label3: TfpgLabel; + Label4: TfpgLabel; + Label5: TfpgLabel; + vuleft: TfpgPanel; + vuright: TfpgPanel; + CheckBox2: TfpgCheckBox; + Label6: TfpgLabel; + Label7: TfpgLabel; + TrackBar4: TfpgTrackBar; + TrackBar5: TfpgTrackBar; + Button1: TfpgButton; + Edit1: TfpgEdit; + Label8: TfpgLabel; + Butquit: TfpgButton; + FilenameEdit2: TfpgFileNameEdit; + Label1: TfpgLabel; + mp3format: TfpgRadioButton; + opusformat: TfpgRadioButton; + lresult: TfpgLabel; + {@VFD_HEAD_END: Simpleplayer} + public + procedure AfterCreate; override; + // constructor Create(AOwner: TComponent); + procedure btnLoadClick(Sender: TObject); + procedure btnCloseClick(Sender: TObject); + procedure btnStartClick(Sender: TObject); + procedure btnStopClick(Sender: TObject); + procedure btnPauseClick(Sender: TObject); + procedure btnResumeClick(Sender: TObject); + procedure ClosePlayer1; + procedure LoopProcPlayer1; + procedure ShowLevel; + procedure VolumeChange(Sender: TObject; pos: integer); + procedure ChangePlugSet(Sender: TObject); + procedure TrackChangePlugSet(Sender: TObject; pos: integer); + procedure ResetPlugClick(Sender: TObject); + end; + + {@VFD_NEWFORM_DECL} + + {@VFD_NEWFORM_IMPL} + +var + PlayerIndex1: integer; + ordir, opath: string; + In1Index, Plugin1Index: integer; + plugsoundtouch: Boolean = False; + + + procedure TSimpleplayer.ChangePlugSet(Sender: TObject); + var + tempo, rate: cfloat; + begin + if (trim(PChar(filenameedit5.FileName)) <> '') and fileexists(filenameedit5.FileName) then + begin + if 2 - (2 * (TrackBar4.Position / 100)) < 0.3 then + tempo := 0.3 + else + tempo := 2 - (2 * (TrackBar4.Position / 100)); + if 2 - (2 * (TrackBar5.Position / 100)) < 0.3 then + rate := 0.3 + else + rate := 2 - (2 * (TrackBar5.Position / 100)); + + label6.Text := 'Tempo: ' + floattostrf(tempo, ffFixed, 15, 1); + label7.Text := 'Pitch: ' + floattostrf(rate, ffFixed, 15, 1); + + if radiobutton1.Enabled = False then /// player1 was created + uos_SetPluginSoundTouch(PlayerIndex1, Plugin1Index, tempo, rate, checkbox2.Checked); + end; + end; + + procedure TSimpleplayer.ResetPlugClick(Sender: TObject); + begin + TrackBar4.Position := 50; + TrackBar5.Position := 50; + if radiobutton1.Enabled = False then /// player1 was created + uos_SetPluginSoundTouch(PlayerIndex1, Plugin1Index, 1, 1, checkbox2.Checked); + end; + + procedure TSimpleplayer.TrackChangePlugSet(Sender: TObject; pos: integer); + begin + if (trim(PChar(filenameedit5.FileName)) <> '') and fileexists(filenameedit5.FileName) then + ChangePlugSet(Sender); + end; + + procedure TSimpleplayer.btnResumeClick(Sender: TObject); + begin + uos_RePlay(PlayerIndex1); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := True; + btnresume.Enabled := False; + end; + + procedure TSimpleplayer.btnPauseClick(Sender: TObject); + begin + uos_Pause(PlayerIndex1); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := False; + btnresume.Enabled := True; + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + end; + + + procedure TSimpleplayer.VolumeChange(Sender: TObject; pos: integer); + begin + uos_InputSetDSPVolume(PlayerIndex1, In1Index, + (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); + end; + + procedure TSimpleplayer.ShowLevel; + begin + vuLeft.Visible := True; + vuRight.Visible := True; + if round(uos_InputGetLevelLeft(PlayerIndex1, In1Index) * 128) >= 0 then + vuLeft.Height := round(uos_InputGetLevelLeft(PlayerIndex1, In1Index) * 128); + if round(uos_InputGetLevelRight(PlayerIndex1, In1Index) * 128) >= 0 then + vuRight.Height := round(uos_InputGetLevelRight(PlayerIndex1, In1Index) * 128); + vuLeft.top := 348 - vuLeft.Height; + vuRight.top := 348 - vuRight.Height; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + end; + + procedure TSimpleplayer.btnCloseClick(Sender: TObject); + begin + fpgapplication.ProcessMessages; + uos_stop(PlayerIndex1); + if (btnstart.Enabled = False) then + begin + uos_stop(PlayerIndex1); + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + sleep(100); + end; + if btnLoad.Enabled = False then + begin + uos_free(); + sleep(100); + fpgapplication.terminate; + end; + end; + + procedure TSimpleplayer.btnLoadClick(Sender: TObject); + var + loadok: Boolean = False; + 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, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + + if uos_LoadLib(PChar(FilenameEdit1.FileName), nil, PChar(FilenameEdit3.FileName), + nil, nil, PChar(FilenameEdit2.FileName), nil) = 0 then + begin + hide; + loadok := True; + Height := 403; + btnStart.Enabled := True; + btnLoad.Enabled := False; + FilenameEdit1.ReadOnly := True; + FilenameEdit3.ReadOnly := True; + FilenameEdit5.ReadOnly := True; + FilenameEdit2.ReadOnly := True; + UpdateWindowPosition; + btnLoad.Text := + 'PortAudio, Mpg123, Opus libraries are loaded...'; + end + else + btnLoad.Text := + 'One or more libraries did not load, check filenames...'; + + if loadok = True then + begin + if ((trim(PChar(filenameedit5.FileName)) <> '') and fileexists(filenameedit5.FileName)) and (uos_LoadPlugin('soundtouch', PChar(FilenameEdit5.FileName)) = 0) then + begin + plugsoundtouch := True; + btnLoad.Text := + 'PortAudio, Mpg123, Opus and Plugin SoundTouch are loaded...'; + end + else + begin + TrackBar4.Enabled := False; + TrackBar5.Enabled := False; + CheckBox2.Enabled := False; + Button1.Enabled := False; + label6.Enabled := False; + label7.Enabled := False; + end; + + WindowPosition := wpScreenCenter; + WindowTitle := 'Simple Web Player uos version ' + IntToStr(uos_getversion()); + + // Some audio web streaming + + // edit1.text := 'http://streaming304.radionomy.com:80/GENERATIONSOULDISCOFUNK-MP3'; + // edit1.text := 'http://broadcast.infomaniak.net:80/alouette-high.mp3'; + edit1.Text := 'https://p.scdn.co/mp3-preview/ad672a346d38cdcdb7ea6c246282d43522473968?cid=null'; + // edit1.text := 'http://str1.sad.ukrd.com:80/2br'; + // edit1.text := 'http://streaming304.radionomy.com:80/GENERATIONSOULDISCOFUNK-MP3'; + // edit1.text := 'http://broadcast.infomaniak.net/start-latina-high.mp3' ; + // edit1.text := 'http://www.hubharp.com/web_sound/BachGavotteShort.mp3' ; + // edit1.text := 'http://www.jerryradio.com/downloads/BMB-64-03-06-MP3/jg1964-03-06t01.mp3' ; + // edit1.text := 'https://sites.google.com/site/fredvsbinaries/guit_kungs.opus'; + // edit1.text := 'http://localhost:8000/example.opus'; + + fpgapplication.ProcessMessages; + sleep(250); + Show; + end; + end; + + procedure TSimpleplayer.ClosePlayer1; + begin + radiobutton1.Enabled := True; + radiobutton2.Enabled := True; + radiobutton3.Enabled := True; + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + btnStart.Enabled := True; + btnStop.Enabled := False; + btnPause.Enabled := False; + btnresume.Enabled := False; + + end; + + procedure TSimpleplayer.btnStopClick(Sender: TObject); + begin + uos_Stop(PlayerIndex1); + end; + + procedure TSimpleplayer.btnStartClick(Sender: TObject); + var + samformat, audioformat: shortint; + begin + + lresult.Text := ''; + + if mp3format.Checked = True then + audioformat := 0 + else + audioformat := 1; + + if radiobutton1.Checked = True then + samformat := 0; + if radiobutton2.Checked = True then + samformat := 1; + if radiobutton3.Checked = True then + samformat := 2; + + 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(Windows)} + uos_CreatePlayer(PlayerIndex1); + {$else} + uos_CreatePlayer(PlayerIndex1,self); + {$endif} + //// Create the player. + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + In1Index := uos_AddFromURL(PlayerIndex1, PChar(edit1.Text), -1, samformat, -1, audioformat, False); + /////// Add a Input from Audio URL with custom parameters + ////////// URL : URL of audio file (like 'http://someserver/somesound.mp3') + ////////// 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 (4096) + //////////// AudioFormat : default : -1 (mp3) (0: mp3, 1: opus) + /// ICY data on/off + ////////// example : InputIndex := AddFromFile(0,'http://someserver/somesound.mp3',-1,-1,-1); + // result : -1 nothing created, otherwise Input Index in array + if In1Index > -1 then + begin + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, In1Index), + uos_InputGetChannels(PlayerIndex1, In1Index), samformat, 1024, -1); + {$else} + uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, In1Index), + uos_InputGetChannels(PlayerIndex1, In1Index), samformat, 1024, -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) /// here default samplerate of input + //////////// 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) + // result : -1 nothing created, otherwise Output Index in array + + uos_InputSetLevelEnable(PlayerIndex1, In1Index, 2); + ///// set calculation of level/volume (usefull for showvolume procedure) + ///////// set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + // 3 => calcul before and after all DSP procedures. + + uos_LoopProcIn(PlayerIndex1, In1Index, @LoopProcPlayer1); + ///// Assign the procedure of object to execute inside the loop of input + //////////// PlayerIndex : Index of a existing Player + //////////// InIndex : Index of a existing Input + //////////// LoopProcPlayer1 : procedure of object to execute inside the loop + + uos_InputAddDSPVolume(PlayerIndex1, In1Index, 1, 1); + ///// DSP Volume changer + ////////// PlayerIndex1 : Index of a existing Player + ////////// In1Index : InputIndex of a existing input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + + uos_InputSetDSPVolume(PlayerIndex1, In1Index, + (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); + /// Set volume + ////////// PlayerIndex1 : Index of a existing Player + ////////// In1Index : InputIndex of a existing Input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + ////////// Enable : Enabled + + if plugsoundtouch = True then + begin + Plugin1Index := uos_AddPlugin(PlayerIndex1, 'soundtouch', uos_InputGetSampleRate(PlayerIndex1, In1Index), -1); + + ChangePlugSet(self); //// custom procedure to Change plugin settings + uos_SetPluginSoundTouch(PlayerIndex1, Plugin1Index, 1, 1, False); + end; + + /////// procedure to execute when stream is terminated + 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 general loop + radiobutton1.Enabled := False; + radiobutton2.Enabled := False; + radiobutton3.Enabled := False; + btnStart.Enabled := False; + btnStop.Enabled := True; + btnpause.Enabled := True; + btnresume.Enabled := False; + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets play it... + end + else + begin + lresult.Text := 'URL did not load...'; + uos_Play(PlayerIndex1); + sleep(300); + uos_stop(PlayerIndex1); + + end; + end; + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + {$else} + procedure TSimpleplayer.CustomMsgReceived(var msg: TfpgMessageRec); + begin + ShowLevel; + end; + + {$ENDIF} + + procedure TSimpleplayer.LoopProcPlayer1; + begin + ShowLevel; + end; + + procedure TSimpleplayer.AfterCreate; + begin + {%region 'Auto-generated GUI code' -fold} + + {@VFD_BODY_BEGIN: Simpleplayer} + Name := 'Simpleplayer'; + SetPosition(483, 204, 502, 403); + WindowTitle := 'Simple Web Player '; + IconName := ''; + BackGroundColor := $80000001; + Hint := ''; + WindowPosition := wpScreenCenter; + Ondestroy := @btnCloseClick; + + Custom1 := TfpgWidget.Create(self); + with Custom1 do + begin + Name := 'Custom1'; + SetPosition(10, 8, 115, 155); + 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(12, 168, 480, 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; + + btnStart := TfpgButton.Create(self); + with btnStart do + begin + Name := 'btnStart'; + SetPosition(116, 372, 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(360, 372, 64, 23); + Text := 'Stop'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 7; + Hint := ''; + onclick := @btnStopClick; + end; + + Labelmpg := TfpgLabel.Create(self); + with Labelmpg do + begin + Name := 'Labelmpg'; + SetPosition(144, 40, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of Mpg123 Library'; + Hint := ''; + end; + + Labelst := TfpgLabel.Create(self); + with Labelst do + begin + Name := 'Labelst'; + SetPosition(136, 120, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of SoundTouch Library'; + Hint := ''; + end; + + FilenameEdit3 := TfpgFileNameEdit.Create(self); + with FilenameEdit3 do + begin + Name := 'FilenameEdit3'; + SetPosition(136, 56, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 12; + end; + + FilenameEdit5 := TfpgFileNameEdit.Create(self); + with FilenameEdit5 do + begin + Name := 'FilenameEdit5'; + SetPosition(136, 136, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 12; + end; + + btnpause := TfpgButton.Create(self); + with btnpause do + begin + Name := 'btnpause'; + SetPosition(192, 372, 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(272, 372, 64, 23); + Text := 'Resume'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 16; + Hint := ''; + onclick := @btnResumeClick; + end; + + RadioButton1 := TfpgRadioButton.Create(self); + with RadioButton1 do + begin + Name := 'RadioButton1'; + SetPosition(128, 300, 96, 19); + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 18; + Text := 'Float 32 bit'; + Hint := ''; + end; + + RadioButton2 := TfpgRadioButton.Create(self); + with RadioButton2 do + begin + Name := 'RadioButton2'; + SetPosition(128, 316, 100, 19); + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 19; + Text := 'Int 32 bit'; + Hint := ''; + end; + + RadioButton3 := TfpgRadioButton.Create(self); + with RadioButton3 do + begin + Name := 'RadioButton3'; + SetPosition(128, 334, 100, 19); + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 20; + Text := 'Int 16 bit'; + Hint := ''; + end; + + Label2 := TfpgLabel.Create(self); + with Label2 do + begin + Name := 'Label2'; + SetPosition(116, 284, 104, 15); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := 'Sample format'; + Hint := ''; + end; + + TrackBar2 := TfpgTrackBar.Create(self); + with TrackBar2 do + begin + Name := 'TrackBar2'; + SetPosition(4, 216, 32, 134); + Orientation := orVertical; + ParentShowHint := False; + TabOrder := 23; + Hint := ''; + OnChange := @volumechange; + end; + + TrackBar3 := TfpgTrackBar.Create(self); + with TrackBar3 do + begin + Name := 'TrackBar3'; + SetPosition(72, 216, 28, 134); + Orientation := orVertical; + ParentShowHint := False; + TabOrder := 24; + Hint := ''; + OnChange := @volumechange; + end; + + Label3 := TfpgLabel.Create(self); + with Label3 do + begin + Name := 'Label3'; + SetPosition(12, 196, 84, 15); + Alignment := taCenter; + FontDesc := '#Label2'; + ParentShowHint := False; + Text := 'Volume'; + Hint := ''; + end; + + Label4 := TfpgLabel.Create(self); + with Label4 do + begin + Name := 'Label4'; + SetPosition(0, 348, 40, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Left'; + Hint := ''; + end; + + Label5 := TfpgLabel.Create(self); + with Label5 do + begin + Name := 'Label5'; + SetPosition(72, 348, 36, 19); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Right'; + Hint := ''; + end; + + vuleft := TfpgPanel.Create(self); + with vuleft do + begin + Name := 'vuleft'; + SetPosition(40, 220, 8, 128); + BackgroundColor := TfpgColor($00D51D); + FontDesc := '#Label1'; + ParentShowHint := False; + Style := bsFlat; + Text := ''; + Hint := ''; + end; + + vuright := TfpgPanel.Create(self); + with vuright do + begin + Name := 'vuright'; + SetPosition(60, 220, 8, 128); + BackgroundColor := TfpgColor($1DD523); + FontDesc := '#Label1'; + ParentShowHint := False; + Style := bsFlat; + Text := ''; + Hint := ''; + end; + + CheckBox2 := TfpgCheckBox.Create(self); + with CheckBox2 do + begin + Name := 'CheckBox2'; + SetPosition(268, 284, 184, 19); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 32; + Text := 'Enable SoundTouch PlugIn'; + Hint := ''; + OnChange := @ChangePlugSet; + end; + + Label6 := TfpgLabel.Create(self); + with Label6 do + begin + Name := 'Label6'; + SetPosition(272, 312, 80, 19); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Tempo: 1.0'; + Hint := ''; + end; + + Label7 := TfpgLabel.Create(self); + with Label7 do + begin + Name := 'Label7'; + SetPosition(380, 312, 80, 15); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Pitch: 1.0'; + Hint := ''; + end; + + TrackBar4 := TfpgTrackBar.Create(self); + with TrackBar4 do + begin + Name := 'TrackBar4'; + SetPosition(344, 308, 28, 54); + Orientation := orVertical; + ParentShowHint := False; + Position := 50; + TabOrder := 35; + Hint := ''; + OnChange := @TrackChangePlugSet; + end; + + TrackBar5 := TfpgTrackBar.Create(self); + with TrackBar5 do + begin + Name := 'TrackBar5'; + SetPosition(440, 308, 28, 54); + Orientation := orVertical; + ParentShowHint := False; + Position := 50; + TabOrder := 36; + Hint := ''; + OnChange := @TrackChangePlugSet; + end; + + Button1 := TfpgButton.Create(self); + with Button1 do + begin + Name := 'Button1'; + SetPosition(260, 336, 60, 23); + Text := 'Reset'; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 37; + Hint := ''; + OnClick := @ResetPlugClick; + end; + + Edit1 := TfpgEdit.Create(self); + with Edit1 do + begin + Name := 'Edit1'; + SetPosition(120, 232, 360, 24); + ExtraHint := ''; + FontDesc := '#Edit1'; + ParentShowHint := False; + TabOrder := 33; + Text := 'http://broadcast.infomaniak.net:80/alouette-high.mp3'; + Hint := ''; + end; + + Label8 := TfpgLabel.Create(self); + with Label8 do + begin + Name := 'Label8'; + SetPosition(236, 216, 100, 15); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'HTTP location'; + Hint := ''; + end; + + Butquit := TfpgButton.Create(self); + with Butquit do + begin + Name := 'Butquit'; + SetPosition(444, 372, 44, 23); + Text := 'Quit'; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 32; + Onclick := @btnCloseClick; + end; + + FilenameEdit2 := TfpgFileNameEdit.Create(self); + with FilenameEdit2 do + begin + Name := 'FilenameEdit2'; + SetPosition(140, 96, 352, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 33; + end; + + Label1 := TfpgLabel.Create(self); + with Label1 do + begin + Name := 'Label1'; + SetPosition(140, 80, 328, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of OpusFile Library'; + end; + + mp3format := TfpgRadioButton.Create(self); + with mp3format do + begin + Name := 'mp3format'; + SetPosition(188, 260, 96, 19); + Checked := True; + FontDesc := '#Label1'; + GroupIndex := 1; + ParentShowHint := False; + TabOrder := 35; + Text := 'mp3 format'; + end; + + opusformat := TfpgRadioButton.Create(self); + with opusformat do + begin + Name := 'opusformat'; + SetPosition(296, 260, 96, 19); + FontDesc := '#Label1'; + GroupIndex := 1; + ParentShowHint := False; + TabOrder := 36; + Text := 'opus format'; + end; + + lresult := TfpgLabel.Create(self); + with lresult do + begin + Name := 'lresult'; + SetPosition(116, 352, 124, 15); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := ''; + TextColor := TfpgColor($FFFF0000); + end; + + {@VFD_BODY_END: Simpleplayer} + {%endregion} + + ////////////////////// + + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + RadioButton1.Checked := True; + Height := 197; + {$IFDEF Windows} + {$if defined(cpu64)} + FilenameEdit1.FileName := ordir + 'lib\Windows\64bit\LibPortaudio-64.dll'; + FilenameEdit3.FileName := ordir + 'lib\Windows\64bit\LibMpg123-64.dll'; + FilenameEdit5.FileName := ordir + 'lib\Windows\64bit\plugin\LibSoundTouch-64.dll'; +{$else} + FilenameEdit1.FileName := ordir + 'lib\Windows\32bit\LibPortaudio-32.dll'; + FilenameEdit3.FileName := ordir + 'lib\Windows\32bit\LibMpg123-32.dll'; + FilenameEdit5.FileName := ordir + 'lib\Windows\32bit\plugin\LibSoundTouch-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'; + FilenameEdit3.FileName := opath + '/lib/Mac/32bit/LibMpg123-32.dylib'; + FilenameEdit5.FileName := opath + '/lib/Mac/32bit/plugin/libSoundTouch-32.dylib'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + FilenameEdit1.FileName := opath + '/lib/Mac/64bit/LibPortaudio-64.dylib'; + FilenameEdit3.FileName := opath + '/lib/Mac/64bit/LibMpg123-64.dylib'; + {$ENDIF} + {$ENDIF} + + + {$if defined(CPUAMD64) and defined(linux) } + FilenameEdit1.FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + FilenameEdit3.FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + FilenameEdit2.FileName := ordir + 'lib/Linux/64bit/LibOpusFile-64.so'; + FilenameEdit5.FileName := ordir + 'lib/Linux/64bit/plugin/LibSoundTouch-64.so'; + {$ENDIF} + + {$if defined(cpu86) and defined(linux)} + FilenameEdit1.FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + FilenameEdit3.FileName := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; + FilenameEdit5.FileName := ordir + 'lib/Linux/32bit/plugin/LibSoundTouch-32.so'; + {$endif} + + {$if defined(linux) and defined(cpuarm)} + FilenameEdit1.FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + FilenameEdit3.FileName := ordir + 'lib/Linux/arm_raspberrypi/libmpg123-arm.so'; + FilenameEdit5.FileName := ordir + 'lib/Linux/arm_raspberrypi/plugin/libsoundtouch_arm.so'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + FilenameEdit1.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + FilenameEdit3.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + FilenameEdit5.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/plugin/libsoundtouch_aarch64.so'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + FilenameEdit1.FileName := ordir + 'lib/FreeBSD/64bit/libportaudio-64.so'; + FilenameEdit3.FileName := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so'; + FilenameEdit5.FileName := ''; + {$else} + FilenameEdit1.FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-64.so'; + FilenameEdit3.FileName := ordir + 'lib/FreeBSD/32bit/libmpg123-64.so'; + FilenameEdit5.FileName := ''; +{$endif} + {$ENDIF} + + FilenameEdit1.Initialdir := ordir + 'lib'; + FilenameEdit3.Initialdir := ordir + 'lib'; + FilenameEdit5.Initialdir := ordir + 'lib'; + + vuLeft.Visible := False; + vuRight.Visible := False; + vuLeft.Height := 0; + vuRight.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + end; + + procedure TSimpleplayer.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: TSimpleplayer; + begin + fpgApplication.Initialize; + if fpgStyleManager.SetStyle('Chrome silver flat menu') then + fpgStyle := fpgStyleManager.Style; + fpgApplication.CreateForm(TSimpleplayer, frm); + try + frm.Show; + fpgApplication.Run; + finally + uos_free; + frm.Free; + end; + end; + +begin + MainProc; +end. + diff --git a/UOS/examples/simplewebplayer_fpGUI.prj b/UOS/examples/simplewebplayer_fpGUI.prj new file mode 100644 index 0000000..48d0342 --- /dev/null +++ b/UOS/examples/simplewebplayer_fpGUI.prj @@ -0,0 +1,1403 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/simplewebplayer_fpGUI.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=simplewebplayer_fpGUI.pas +targetfile=simplewebplayer_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/simplewebplayer_fpGUI.pas +relpaths=1 + simplewebplayer_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/simplewebplayer_fpGUI.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/simplewebserver_fpGUI.pas b/UOS/examples/simplewebserver_fpGUI.pas new file mode 100644 index 0000000..b86c386 --- /dev/null +++ b/UOS/examples/simplewebserver_fpGUI.pas @@ -0,0 +1,1268 @@ + // WARNING: in development. For Unix only (Not yet for Windows) + // Please uncomment {$DEFINE shout} in uos_define.inc + +program simplewebserver_fpGUI; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + cthreads, + cwstring, {$ENDIF} {$ENDIF} + SysUtils, + uos_flat, + fpg_stylemanager, + fpg_style_chrome_silver_flatmenu, + ctypes, + Classes, + fpg_button, + fpg_widget, + fpg_label, + fpg_Editbtn, + fpg_RadioButton, + fpg_trackbar, + fpg_CheckBox, + fpg_Panel, + fpg_base, + fpg_main, + fpg_form; + +type + TSimpleplayer = class(TfpgForm) + procedure uos_logo(Sender: TObject); + private + {@VFD_HEAD_BEGIN: Simpleplayer} + Custom1: TfpgWidget; + Labelport: TfpgLabel; + btnLoad: TfpgButton; + FilenameEdit1: TfpgFileNameEdit; + FilenameEdit2: TfpgFileNameEdit; + Labelsnf: TfpgLabel; + Labelmpg: TfpgLabel; + Labelst11: TfpgLabel; + FilenameEdit7: TfpgFileNameEdit; + Labelst111: TfpgLabel; + FilenameEdit8: TfpgFileNameEdit; + Labelst11111: TfpgLabel; + FilenameEdit31: TfpgFileNameEdit; + FilenameEdit3: TfpgFileNameEdit; + Labelst1: TfpgLabel; + FilenameEdit6: TfpgFileNameEdit; + Panel1: TfpgPanel; + FilenameEdit4: TfpgFileNameEdit; + btnStart: TfpgButton; + btnStop: TfpgButton; + lposition: TfpgLabel; + Label1: TfpgLabel; + Llength: TfpgLabel; + btnpause: TfpgButton; + btnresume: TfpgButton; + CheckBox1: TfpgCheckBox; + RadioButton1: TfpgRadioButton; + RadioButton3: TfpgRadioButton; + Label2: TfpgLabel; + TrackBar1: TfpgTrackBar; + TrackBar2: TfpgTrackBar; + TrackBar3: TfpgTrackBar; + Label3: TfpgLabel; + Label4: TfpgLabel; + Label5: TfpgLabel; + vuleft: TfpgPanel; + vuright: TfpgPanel; + chkst2b: TfpgCheckBox; + chkstereo2mono: TfpgCheckBox; + {@VFD_HEAD_END: Simpleplayer} + public + procedure AfterCreate; override; + // constructor Create(AOwner: TComponent); + procedure btnLoadClick(Sender: TObject); + procedure btnCloseClick(Sender: TObject); + procedure btnStartClick(Sender: TObject); + procedure btnStopClick(Sender: TObject); + procedure btnPauseClick(Sender: TObject); + procedure btnResumeClick(Sender: TObject); + procedure btnTrackOnClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + procedure btnTrackOffClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + {$else} + procedure CustomMsgReceived(var msg: TfpgMessageRec); message MSG_CUSTOM1; + {$ENDIF} + procedure ClosePlayer1; + procedure LoopProcPlayer1; + procedure ShowPosition; + procedure ShowLevel; + procedure changecheck(Sender: TObject); + procedure VolumeChange(Sender: TObject; pos: integer); + procedure ChangeStereo2Mono(Sender: TObject); + procedure ChangePlugSetbs2b(Sender: TObject); + end; + + {@VFD_NEWFORM_DECL} + + {@VFD_NEWFORM_IMPL} + +var + PlayerIndex1: integer; + ordir, opath, ShoutFileName, OpusFileName: string; + OutputIndex1, InputIndex1, DSPIndex1, DSPIndex2, PluginIndex1, PluginIndex2: integer; + plugsoundtouch: Boolean = False; + plugbs2b: Boolean = False; + + procedure TSimpleplayer.btnTrackOnClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + begin + TrackBar1.Tag := 1; + end; + + procedure TSimpleplayer.ChangePlugSetBs2b(Sender: TObject); + begin + if radiobutton1.Enabled = False then /// player1 was created + uos_SetPluginBs2b(PlayerIndex1, PluginIndex1, -1, -1, -1, chkst2b.Checked); + end; + + procedure TSimpleplayer.Changestereo2mono(Sender: TObject); + begin + if radiobutton1.Enabled = False then /// player1 was created + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex2, chkstereo2mono.Checked); + end; + + + procedure TSimpleplayer.btnTrackoffClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; const pos: TPoint); + begin + uos_InputSeek(PlayerIndex1, InputIndex1, TrackBar1.position); + TrackBar1.Tag := 0; + end; + + procedure TSimpleplayer.btnResumeClick(Sender: TObject); + begin + uos_RePlay(PlayerIndex1); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := True; + btnresume.Enabled := False; + end; + + procedure TSimpleplayer.btnPauseClick(Sender: TObject); + begin + uos_Pause(PlayerIndex1); + btnStart.Enabled := False; + btnStop.Enabled := True; + btnPause.Enabled := False; + btnresume.Enabled := True; + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + end; + + procedure TSimpleplayer.changecheck(Sender: TObject); + begin + if (btnstart.Enabled = False) then + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex1, checkbox1.Checked); + end; + + procedure TSimpleplayer.VolumeChange(Sender: TObject; pos: integer); + begin + if (btnstart.Enabled = False) then + uos_InputSetDSPVolume(PlayerIndex1, InputIndex1, + (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); + end; + + procedure TSimpleplayer.ShowLevel; + begin + vuLeft.Visible := True; + vuRight.Visible := True; + if round(uos_InputGetLevelLeft(PlayerIndex1, InputIndex1) * 74) >= 0 then + vuLeft.Height := round(uos_InputGetLevelLeft(PlayerIndex1, InputIndex1) * 74); + if round(uos_InputGetLevelRight(PlayerIndex1, InputIndex1) * 74) >= 0 then + vuRight.Height := round(uos_InputGetLevelRight(PlayerIndex1, InputIndex1) * 74); + vuLeft.top := 96 - vuLeft.Height; + vuRight.top := 96 - vuRight.Height; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + end; + + procedure TSimpleplayer.btnCloseClick(Sender: TObject); + begin + if (btnstart.Enabled = False) then + begin + uos_stop(PlayerIndex1); + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + sleep(100); + end; + if btnLoad.Enabled = False then + begin + uos_UnloadPlugin('soundtouch'); + uos_UnloadPlugin('bs2b'); + uos_UnloadLib(); + end; + end; + + procedure TSimpleplayer.btnLoadClick(Sender: TObject); + var + loadok: Boolean = False; + begin + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + +{$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, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfilefilename, libxmpfilename: PChar) : LongInt; + if uos_LoadLib(PChar(FilenameEdit1.FileName), PChar(FilenameEdit2.FileName), + PChar(FilenameEdit3.FileName), PChar(FilenameEdit7.FileName), PChar(FilenameEdit8.FileName), + PChar(FilenameEdit31.FileName), nil) = 0 then + + if uos_LoadServerLib(PChar(ShoutFileName), PChar(OpusFileName)) = 0 then + begin + hide; + loadok := True; + Height := 208; + panel1.Height := Height; + panel1.Width := Width; + panel1.left := 0; + panel1.top := 0; + panel1.Visible := True; + btnStart.Enabled := True; + btnLoad.Enabled := False; + FilenameEdit1.ReadOnly := True; + FilenameEdit2.ReadOnly := True; + FilenameEdit3.ReadOnly := True; + FilenameEdit6.ReadOnly := True; + FilenameEdit7.ReadOnly := True; + FilenameEdit8.ReadOnly := True; + FilenameEdit31.ReadOnly := True; + UpdateWindowPosition; + btnLoad.Text := + 'PortAudio, SndFile, Mpg123, AAC, Opus, Shout libraries are loaded...'; + end + else + btnLoad.Text := + 'One or more libraries did not load, check filenames...'; + + if loadok = True then + + + if ((trim(PChar(filenameedit6.FileName)) <> '') and fileexists(filenameedit6.FileName)) then + if (uos_LoadPlugin('bs2b', PChar(FilenameEdit6.FileName)) = 0) then + plugbs2b := True + else + chkst2b.Enabled := False; + + + WindowPosition := wpScreenCenter; + WindowTitle := 'Simple Audio Web Server. uos Version ' + IntToStr(uos_getversion()); + + fpgapplication.ProcessMessages; + sleep(100); + Show; + + end; + + procedure TSimpleplayer.ClosePlayer1; + begin + radiobutton1.Enabled := True; + radiobutton3.Enabled := True; + vuLeft.Visible := False; + vuRight.Visible := False; + vuright.Height := 0; + vuleft.Height := 0; + vuright.UpdateWindowPosition; + vuLeft.UpdateWindowPosition; + btnStart.Enabled := True; + btnStop.Enabled := False; + btnPause.Enabled := False; + btnresume.Enabled := False; + trackbar1.Position := 0; + lposition.Text := '00:00:00.000'; + end; + + procedure TSimpleplayer.btnStopClick(Sender: TObject); + begin + uos_Stop(PlayerIndex1); + closeplayer1; + end; + + ///// example how to do custom dsp + + function DSPReverseBefore(var Data: TuosF_Data; var fft: TuosF_FFT): TDArFloat; + begin + + if (Data.position > Data.OutFrames div Data.channels) then + uos_InputSeek(PlayerIndex1, InputIndex1, Data.position - (Data.OutFrames div Data.channels)); + end; + + function DSPReverseAfter(Data: TuosF_Data; fft: TuosF_FFT): TDArFloat; + var + x: integer = 0; + arfl: TDArFloat; + begin + if (Data.position > Data.OutFrames div Data.channels) then + begin + SetLength(arfl, Data.outframes); + + while x < Data.outframes - 1 do + begin + arfl[x] := Data.Buffer[Data.outframes - x - 1]; + arfl[x + 1] := Data.Buffer[Data.outframes - x]; + x := x + 2; + end; + Result := arfl; + end + else + Result := Data.Buffer; + end; + + /// WARNING: This is only to show a DSP effect, it is not the best reverb it exists ;-) +{ + function DSPReverb(Data: TuosF_Data; fft: TuosF_FFT): TDArFloat; + var + x: integer = 0; + arfl: TDArFloat; + begin + SetLength(arfl, length(Data.Buffer)); + while x < length(Data.Buffer) do + begin + if x > 10000 then + begin + arfl[x] := Data.Buffer[x] + (Data.Buffer[x-10000] / 2); + arfl[x+1] := Data.Buffer[x+1] + (Data.Buffer[x+1-10000] / 2); + end else + begin + arfl[x] := Data.Buffer[x] ; + arfl[x+1] := Data.Buffer[x+1]; + end; + x := x + 2; + end; + Result := arfl; + end; +} + + function DSPStereo2Mono(Data: TuosF_Data; fft: TuosF_FFT): TDArFloat; + var + x: integer = 0; + ps: PDArShort; //////// if input is Int16 format + pl: PDArLong; //////// if input is Int32 format + pf: PDArFloat; //////// if input is Float32 format + samplef: cFloat; + samplei: integer; + begin + if (Data.channels = 2) then + begin + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + while x < Data.OutFrames do + begin + samplei := round((ps^[x] + ps^[x + 1]) / 2); + ps^[x] := samplei; + ps^[x + 1] := samplei; + x := x + 2; + end; + end; + + 1: + begin + pl := @Data.Buffer; + while x < Data.OutFrames do + begin + samplei := round((pl^[x] + pl^[x + 1]) / 2); + pl^[x] := samplei; + pl^[x + 1] := samplei; + x := x + 2; + end; + end; + + 0: + begin + pf := @Data.Buffer; + while x < Data.OutFrames do + begin + samplef := (pf^[x] + pf^[x + 1]) / 2; + pf^[x] := samplef; + pf^[x + 1] := samplef; + x := x + 2; + end; + end; + + end; + Result := Data.Buffer; + end + else + Result := Data.Buffer; + end; + + procedure TSimpleplayer.btnStartClick(Sender: TObject); + var + samformat, samformatopus: shortint; + temptime: ttime; + ho, mi, se, ms: word; + begin + + if radiobutton1.Checked = True then + begin + samformat := 0; + samformatopus := 0; + end; + + if radiobutton3.Checked = True then + begin + samformat := 2; + samformatopus := 1; + end; + + radiobutton1.Enabled := False; + radiobutton3.Enabled := False; + + 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(Windows)} + uos_CreatePlayer(PlayerIndex1); + {$else} + uos_CreatePlayer(PlayerIndex1,self); + {$endif} + //// Create the player. + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + InputIndex1 := uos_AddFromFile(PlayerIndex1, PChar(filenameEdit4.filename), -1, + samformat, 960 * 4); + //// 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 div channels) + // result : -1 nothing created, otherwise Input Index in array + + if InputIndex1 > -1 then + begin + + // OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1) ; + //// add a Output into device with default parameters + + {$if defined(cpuarm) or defined(cpuaarch64)} // need a lower latency + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, 0.3, uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat,960*4, -1); + {$else} + OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, -1, uos_InputGetSampleRate(PlayerIndex1, InputIndex1), + uos_InputGetChannels(PlayerIndex1, InputIndex1), samformat, 960 * 4, -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) /// here default samplerate of input + //////////// 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) + // result : -1 nothing created, otherwise Output Index in array + + uos_AddIntoIceServer(PlayerIndex1, -1, -1, -1, samformatopus, 8000, PChar('127.0.0.1'), + PChar('source'), PChar('hackme'), PChar('/example.opus')); + ////// Add a Output into a IceCast server for audio-web-streaming + //////////// SampleRate : delault : -1 (48100) + //////////// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + //////////// EncodeType : default : -1 (0:Music) (0: Music, 1:Voice) + //////////// SampleFormat : -1 default : float32 : (0:float32, 1:Int16) + //////////// Port : default : -1 (= 8000) + //////////// Host : default : 'def' (= '127.0.0.1') + //////////// User : default : 'def' (= 'source') + //////////// Password : default : 'def' (= 'hackme') + //////////// MountFile : default : 'def' (= '/example.opus') + // result : Output Index in array -1 = error + + uos_InputSetLevelEnable(PlayerIndex1, InputIndex1, 2); + ///// set calculation of level/volume (usefull for showvolume procedure) + ///////// set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + // 3 => calcul before and after all DSP procedures. + + uos_InputSetPositionEnable(PlayerIndex1, InputIndex1, 1); + ///// set calculation of position (usefull for positions procedure) + ///////// set position calculation (default is 0) + // 0 => no calcul + // 1 => calcul position. + + uos_LoopProcIn(PlayerIndex1, InputIndex1, @LoopProcPlayer1); + ///// Assign the procedure of object to execute inside the loop + //////////// PlayerIndex : Index of a existing Player + //////////// InputIndex1 : Index of a existing Input + //////////// LoopProcPlayer1 : procedure of object to execute inside the loop + + uos_InputAddDSPVolume(PlayerIndex1, InputIndex1, 1, 1); + ///// DSP Volume changer + ////////// PlayerIndex1 : Index of a existing Player + ////////// InputIndex1 : Index of a existing input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + //{ + uos_InputSetDSPVolume(PlayerIndex1, InputIndex1, + (100 - TrackBar2.position) / 100, + (100 - TrackBar3.position) / 100, True); + //} /// Set volume + ////////// PlayerIndex1 : Index of a existing Player + ////////// InputIndex1 : InputIndex of a existing Input + ////////// VolLeft : Left volume + ////////// VolRight : Right volume + ////////// Enable : Enabled + + DSPIndex1 := uos_InputAddDSP(PlayerIndex1, InputIndex1, @DSPReverseBefore, @DSPReverseAfter, nil, nil); + ///// add a custom DSP procedure for input + ////////// PlayerIndex1 : Index of a existing Player + ////////// InputIndex1: InputIndex of existing input + ////////// BeforeFunc : function to do before the buffer is filled + ////////// AfterFunc : function to do after the buffer is filled + ////////// EndedFunc : function to do at end of thread + ////////// LoopProc : external procedure to do after the buffer is filled + + //// set the parameters of custom DSP + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex1, checkbox1.Checked); + + + // This is a other custom DSP...stereo to mono to show how to do a DSP ;-) + DSPIndex2 := uos_InputAddDSP(PlayerIndex1, InputIndex1, nil, @DSPStereo2Mono, nil, nil); + uos_InputSetDSP(PlayerIndex1, InputIndex1, DSPIndex2, chkstereo2mono.Checked); + + ///// add bs2b plugin with samplerate_of_input1 / default channels (2 = stereo) + if plugbs2b = True then + begin + PlugInIndex1 := uos_AddPlugin(PlayerIndex1, 'bs2b', + uos_InputGetSampleRate(PlayerIndex1, InputIndex1), -1); + uos_SetPluginbs2b(PlayerIndex1, PluginIndex1, -1, -1, -1, chkst2b.Checked); + end; + + + trackbar1.Max := uos_InputLength(PlayerIndex1, InputIndex1); + ////// Length of Input in samples + + temptime := uos_InputLengthTime(PlayerIndex1, InputIndex1); + ////// Length of input in time + + DecodeTime(temptime, ho, mi, se, ms); + + llength.Text := format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); + + /////// procedure to execute when stream is terminated + 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 general loop + + TrackBar1.position := 0; + trackbar1.Enabled := True; + CheckBox1.Enabled := True; + + btnStart.Enabled := False; + btnStop.Enabled := True; + btnpause.Enabled := True; + btnresume.Enabled := False; + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets play it... + + end; + + end; + + procedure TSimpleplayer.ShowPosition; + var + temptime: ttime; + ho, mi, se, ms: word; + begin + if (TrackBar1.Tag = 0) then + if uos_InputPosition(PlayerIndex1, InputIndex1) > 0 then + begin + TrackBar1.Position := uos_InputPosition(PlayerIndex1, InputIndex1); + temptime := uos_InputPositionTime(PlayerIndex1, InputIndex1); + ////// Length of input in time + DecodeTime(temptime, ho, mi, se, ms); + lposition.Text := format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]); + end; + end; + + {$IF (FPC_FULLVERSION >= 20701) or DEFINED(Windows)} + {$else} + procedure TSimpleplayer.CustomMsgReceived(var msg: TfpgMessageRec); + begin + ShowLevel; + ShowPosition ; + end; + + {$ENDIF} + + procedure TSimpleplayer.LoopProcPlayer1; + begin + ShowPosition; + ShowLevel; + end; + + procedure TSimpleplayer.AfterCreate; + begin + {%region 'Auto-generated GUI code' -fold} + + + {@VFD_BODY_BEGIN: Simpleplayer} + Name := 'Simpleplayer'; + SetPosition(452, 8, 513, 634); + WindowTitle := 'Simple Audio Web Server'; + IconName := ''; + BackGroundColor := $80000001; + Sizeable := False; + Hint := ''; + WindowPosition := wpScreenCenter; + Ondestroy := @btnCloseClick; + + Custom1 := TfpgWidget.Create(self); + with Custom1 do + begin + Name := 'Custom1'; + SetPosition(10, 12, 115, 275); + OnPaint := @uos_logo; + end; + + Labelport := TfpgLabel.Create(self); + with Labelport do + begin + Name := 'Labelport'; + SetPosition(136, -4, 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(8, 294, 488, 24); + 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, 12, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 3; + end; + + FilenameEdit2 := TfpgFileNameEdit.Create(self); + with FilenameEdit2 do + begin + Name := 'FilenameEdit2'; + SetPosition(136, 52, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 4; + end; + + Labelsnf := TfpgLabel.Create(self); + with Labelsnf do + begin + Name := 'Labelsnf'; + SetPosition(140, 36, 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, 76, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of Mpg123 Library'; + Hint := ''; + end; + + Labelst11 := TfpgLabel.Create(self); + with Labelst11 do + begin + Name := 'Labelst11'; + SetPosition(136, 116, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of mp4ff Library'; + end; + + FilenameEdit7 := TfpgFileNameEdit.Create(self); + with FilenameEdit7 do + begin + Name := 'FilenameEdit7'; + SetPosition(136, 132, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 44; + end; + + Labelst111 := TfpgLabel.Create(self); + with Labelst111 do + begin + Name := 'Labelst111'; + SetPosition(138, 156, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of Faad Library'; + end; + + FilenameEdit8 := TfpgFileNameEdit.Create(self); + with FilenameEdit8 do + begin + Name := 'FilenameEdit8'; + SetPosition(136, 172, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 46; + end; + + Labelst11111 := TfpgLabel.Create(self); + with Labelst11111 do + begin + Name := 'Labelst11111'; + SetPosition(176, 196, 292, 15); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of OpusFile Library'; + end; + + FilenameEdit31 := TfpgFileNameEdit.Create(self); + with FilenameEdit31 do + begin + Name := 'FilenameEdit31'; + SetPosition(136, 213, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 49; + end; + + FilenameEdit3 := TfpgFileNameEdit.Create(self); + with FilenameEdit3 do + begin + Name := 'FilenameEdit3'; + SetPosition(136, 92, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 12; + end; + + Labelst1 := TfpgLabel.Create(self); + with Labelst1 do + begin + Name := 'Labelst1'; + SetPosition(138, 240, 316, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Folder + filename of bs2b plugin Library'; + end; + + FilenameEdit6 := TfpgFileNameEdit.Create(self); + with FilenameEdit6 do + begin + Name := 'FilenameEdit6'; + SetPosition(136, 260, 356, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 40; + end; + + Panel1 := TfpgPanel.Create(self); + with Panel1 do + begin + Name := 'Panel1'; + SetPosition(4, 328, 512, 208); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := ''; + Visible := False; + Hint := ''; + end; + + FilenameEdit4 := TfpgFileNameEdit.Create(Panel1); + with FilenameEdit4 do + begin + Name := 'FilenameEdit4'; + SetPosition(140, 12, 360, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 5; + end; + + btnStart := TfpgButton.Create(Panel1); + with btnStart do + begin + Name := 'btnStart'; + SetPosition(152, 176, 66, 23); + Text := 'Play'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 6; + Hint := ''; + onclick := @btnstartClick; + end; + + btnStop := TfpgButton.Create(Panel1); + with btnStop do + begin + Name := 'btnStop'; + SetPosition(380, 176, 66, 23); + Text := 'Stop'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 7; + Hint := ''; + onclick := @btnStopClick; + end; + + lposition := TfpgLabel.Create(Panel1); + with lposition do + begin + Name := 'lposition'; + SetPosition(232, 69, 84, 19); + Alignment := taCenter; + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := '00:00:00.000'; + Hint := ''; + end; + + Label1 := TfpgLabel.Create(Panel1); + with Label1 do + begin + Name := 'Label1'; + SetPosition(316, 69, 12, 15); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := '/'; + Hint := ''; + end; + + Llength := TfpgLabel.Create(Panel1); + with Llength do + begin + Name := 'Llength'; + SetPosition(324, 69, 80, 15); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := '00:00:00.000'; + Hint := ''; + end; + + btnpause := TfpgButton.Create(Panel1); + with btnpause do + begin + Name := 'btnpause'; + SetPosition(228, 176, 66, 23); + Text := 'Pause'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 15; + Hint := ''; + onclick := @btnPauseClick; + end; + + btnresume := TfpgButton.Create(Panel1); + with btnresume do + begin + Name := 'btnresume'; + SetPosition(304, 176, 66, 23); + Text := 'Resume'; + Enabled := False; + FontDesc := '#Label1'; + ImageName := ''; + ParentShowHint := False; + TabOrder := 16; + Hint := ''; + onclick := @btnResumeClick; + end; + + CheckBox1 := TfpgCheckBox.Create(Panel1); + with CheckBox1 do + begin + Name := 'CheckBox1'; + SetPosition(364, 144, 104, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 17; + Text := 'Play Reverse'; + Hint := ''; + end; + + RadioButton1 := TfpgRadioButton.Create(Panel1); + with RadioButton1 do + begin + Name := 'RadioButton1'; + SetPosition(24, 144, 96, 19); + BackgroundColor := TfpgColor($68A7D3A8); + Checked := True; + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 18; + Text := 'Float 32 bit'; + Hint := ''; + end; + + RadioButton3 := TfpgRadioButton.Create(Panel1); + with RadioButton3 do + begin + Name := 'RadioButton3'; + SetPosition(24, 166, 100, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + GroupIndex := 0; + ParentShowHint := False; + TabOrder := 20; + Text := 'Int 16 bit'; + Hint := ''; + end; + + Label2 := TfpgLabel.Create(Panel1); + with Label2 do + begin + Name := 'Label2'; + SetPosition(24, 124, 104, 15); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := 'Sample format'; + Hint := ''; + end; + + TrackBar1 := TfpgTrackBar.Create(Panel1); + with TrackBar1 do + begin + Name := 'TrackBar1'; + SetPosition(140, 40, 356, 30); + BackgroundColor := TfpgColor($68A7D3A8); + ParentShowHint := False; + TabOrder := 22; + Hint := ''; + TrackBar1.OnMouseDown := @btntrackonClick; + TrackBar1.OnMouseUp := @btntrackoffClick; + end; + + TrackBar2 := TfpgTrackBar.Create(Panel1); + with TrackBar2 do + begin + Name := 'TrackBar2'; + SetPosition(20, 20, 32, 78); + BackgroundColor := TfpgColor($68A7D3A8); + Orientation := orVertical; + ParentShowHint := False; + TabOrder := 23; + Hint := ''; + OnChange := @volumechange; + end; + + TrackBar3 := TfpgTrackBar.Create(Panel1); + with TrackBar3 do + begin + Name := 'TrackBar3'; + SetPosition(88, 20, 28, 78); + BackgroundColor := TfpgColor($68A7D3A8); + Orientation := orVertical; + ParentShowHint := False; + TabOrder := 24; + Hint := ''; + OnChange := @volumechange; + end; + + Label3 := TfpgLabel.Create(Panel1); + with Label3 do + begin + Name := 'Label3'; + SetPosition(28, 4, 84, 15); + Alignment := taCenter; + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label2'; + ParentShowHint := False; + Text := 'Volume'; + Hint := ''; + end; + + Label4 := TfpgLabel.Create(Panel1); + with Label4 do + begin + Name := 'Label4'; + SetPosition(20, 100, 40, 15); + Alignment := taCenter; + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Left'; + Hint := ''; + end; + + Label5 := TfpgLabel.Create(Panel1); + with Label5 do + begin + Name := 'Label5'; + SetPosition(84, 100, 36, 19); + Alignment := taCenter; + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + Text := 'Right'; + Hint := ''; + end; + + vuleft := TfpgPanel.Create(Panel1); + with vuleft do + begin + Name := 'vuleft'; + SetPosition(56, 24, 8, 74); + BackgroundColor := TfpgColor($00D51D); + FontDesc := '#Label1'; + ParentShowHint := False; + Style := bsFlat; + Text := ''; + Hint := ''; + end; + + vuright := TfpgPanel.Create(Panel1); + with vuright do + begin + Name := 'vuright'; + SetPosition(76, 24, 8, 74); + BackgroundColor := TfpgColor($1DD523); + FontDesc := '#Label1'; + ParentShowHint := False; + Style := bsFlat; + Text := ''; + Hint := ''; + end; + + chkst2b := TfpgCheckBox.Create(Panel1); + with chkst2b do + begin + Name := 'chkst2b'; + SetPosition(236, 120, 136, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 38; + Text := 'Stereo to BinAural'; + Hint := 'Stereo to BinAural (for headphones)'; + OnChange := @ChangePlugSetBs2b; + end; + + chkstereo2mono := TfpgCheckBox.Create(Panel1); + with chkstereo2mono do + begin + Name := 'chkstereo2mono'; + SetPosition(144, 88, 120, 19); + BackgroundColor := TfpgColor($68A7D3A8); + FontDesc := '#Label1'; + ParentShowHint := False; + TabOrder := 42; + Text := 'Stereo to Mono'; + Hint := 'Convert Stereo to Mono'; + OnChange := @Changestereo2mono; + end; + + {@VFD_BODY_END: Simpleplayer} + {%endregion} + + ////////////////////// + + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + checkbox1.OnChange := @changecheck; + RadioButton1.Checked := True; + Height := 324; + {$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'; + FilenameEdit5.FileName := ordir + 'lib\Windows\64bit\plugin\LibSoundTouch-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'; + FilenameEdit7.FileName := ordir + 'lib\Windows\32bit\LibMp4ff-32.dll'; + FilenameEdit8.FileName := ordir + 'lib\Windows\32bit\LibFaad2-32.dll'; + + FilenameEdit31.FileName := ordir + 'lib\Windows\32bit\LibOpusFile-32.dll'; + FilenameEdit6.FileName := ordir + 'lib\Windows\32bit\plugin\LibBs2b-32.dll'; + + {$endif} + FilenameEdit4.FileName := ordir + 'sound\test.ogg'; + {$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'; + FilenameEdit5.FileName := opath + '/lib/Mac/32bit/plugin/libSoundTouch-32.dylib'; + FilenameEdit4.FileName := opath + 'sound/test.ogg'; + {$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'; + FilenameEdit7.FileName := ordir + 'lib/Linux/64bit/LibMp4ff-64.so'; + FilenameEdit8.FileName := ordir + 'lib/Linux/64bit/LibFaad2-64.so'; + FilenameEdit31.FileName := ordir + 'lib/Linux/64bit/LibOpusFile-64.so'; + + FilenameEdit6.FileName := ordir + 'lib/Linux/64bit/plugin/libbs2b-64.so'; + + ShoutFileName := ordir + 'lib/Linux/64bit/LibShout-64.so'; + OpusFileName := ordir + 'lib/Linux/64bit/libopus.so'; +FilenameEdit4.FileName := ordir + 'sound/test.opus'; + {$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'; + FilenameEdit7.FileName := ordir + 'lib/Linux/32bit/LibMp4ff-32.so'; + FilenameEdit8.FileName := ordir + 'lib/Linux/32bit/LibFaad2-32.so'; + FilenameEdit6.FileName := ordir + 'lib/Linux/32bit/plugin/libbs2b-32.so'; + FilenameEdit4.FileName := ordir + 'sound/test.opus'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + FilenameEdit1.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + FilenameEdit2.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libsndfile_aarch64.so'; + FilenameEdit3.FileName := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + FilenameEdit4.FileName := ordir + 'sound/test.mp3'; + {$ENDIF} + + {$if defined(linux) and defined(cpuarm)} + FilenameEdit1.FileName := ordir + 'lib/Linux/arm_raspberrypi/libportaudio-arm.so'; + FilenameEdit1.FileName := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + FilenameEdit1.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'; + FilenameEdit5.FileName := ''; + FilenameEdit7.FileName := ordir + 'lib/FreeBSD/64bit/libmp4ff-64.so'; + FilenameEdit8.FileName := ordir + 'lib/FreeBSD/64bit/libfaad2-64.so'; + FilenameEdit31.FileName := ordir + 'lib/FreeBSD/64bit/libopusfile-64.so'; + FilenameEdit6.FileName := ordir + 'lib/FreeBSD/64bit/plugin/libbs2b-64.so'; + ShoutFileName := ordir + 'lib/FreeBSD/64bit/libshout-64.so'; + OpusFileName := ordir + 'lib/FreeBSD/64bit/libopus.so'; + {$else} + FilenameEdit1.FileName := ordir + 'lib/FreeBSD/32bit/libportaudio-32.so'; + FilenameEdit2.FileName := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + FilenameEdit3.FileName := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + FilenameEdit5.FileName := ''; +{$endif} + FilenameEdit4.FileName := ordir + 'sound/test.opus'; +{$ENDIF} + FilenameEdit4.Initialdir := ordir + 'sound'; + FilenameEdit1.Initialdir := ordir + 'lib'; + FilenameEdit2.Initialdir := ordir + 'lib'; + FilenameEdit3.Initialdir := ordir + 'lib'; + vuLeft.Visible := False; + vuRight.Visible := False; + vuLeft.Height := 0; + vuRight.Height := 0; + vuright.UpdatewindowPosition; + vuLeft.UpdatewindowPosition; + + end; + + procedure TSimpleplayer.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: TSimpleplayer; + begin + fpgApplication.Initialize; + fpgApplication.CreateForm(TSimpleplayer, frm); + try + frm.Show; + fpgApplication.Run; + finally + uos_unloadlib; + uos_unloadserverlib; + uos_free; // do not forget this... + frm.Free; + end; + end; + +begin + MainProc; +end. + diff --git a/UOS/examples/simplewebserver_fpGUI.prj b/UOS/examples/simplewebserver_fpGUI.prj new file mode 100644 index 0000000..4d41fc5 --- /dev/null +++ b/UOS/examples/simplewebserver_fpGUI.prj @@ -0,0 +1,1403 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/simplewebserver_fpGUI.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=simplewebserver_fpGUI.pas +targetfile=simplewebserver_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/simplewebserver_fpGUI.pas +relpaths=1 + simplewebserver_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=521 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=findmessagefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=mainfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=conflangfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=394 + width0=94 + sortdescend0=0 + width1=294 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder=targetconsolefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=69 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1221 + ncy=77 + x=0 + y=0 + cx=1221 + cy=77 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/simplewebserver_fpGUI.pas + history=1 + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=437 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=componentpalettefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=72 + cx=1221 + cy=437 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/sound/drums/BD.wav b/UOS/examples/sound/drums/BD.wav new file mode 100644 index 0000000..ae998a0 Binary files /dev/null and b/UOS/examples/sound/drums/BD.wav differ diff --git a/UOS/examples/sound/drums/HH.wav b/UOS/examples/sound/drums/HH.wav new file mode 100644 index 0000000..a395254 Binary files /dev/null and b/UOS/examples/sound/drums/HH.wav differ diff --git a/UOS/examples/sound/drums/SD.wav b/UOS/examples/sound/drums/SD.wav new file mode 100644 index 0000000..6585101 Binary files /dev/null and b/UOS/examples/sound/drums/SD.wav differ diff --git a/UOS/examples/sound/morse_audio/0.mp3 b/UOS/examples/sound/morse_audio/0.mp3 new file mode 100644 index 0000000..b4808e7 Binary files /dev/null and b/UOS/examples/sound/morse_audio/0.mp3 differ diff --git a/UOS/examples/sound/morse_audio/1.mp3 b/UOS/examples/sound/morse_audio/1.mp3 new file mode 100644 index 0000000..f32e51e Binary files /dev/null and b/UOS/examples/sound/morse_audio/1.mp3 differ diff --git a/UOS/examples/sound/morse_audio/2.mp3 b/UOS/examples/sound/morse_audio/2.mp3 new file mode 100644 index 0000000..134ee2b Binary files /dev/null and b/UOS/examples/sound/morse_audio/2.mp3 differ diff --git a/UOS/examples/sound/morse_audio/3.mp3 b/UOS/examples/sound/morse_audio/3.mp3 new file mode 100644 index 0000000..8fedc57 Binary files /dev/null and b/UOS/examples/sound/morse_audio/3.mp3 differ diff --git a/UOS/examples/sound/morse_audio/4.mp3 b/UOS/examples/sound/morse_audio/4.mp3 new file mode 100644 index 0000000..71120b3 Binary files /dev/null and b/UOS/examples/sound/morse_audio/4.mp3 differ diff --git a/UOS/examples/sound/morse_audio/5.mp3 b/UOS/examples/sound/morse_audio/5.mp3 new file mode 100644 index 0000000..85a4e10 Binary files /dev/null and b/UOS/examples/sound/morse_audio/5.mp3 differ diff --git a/UOS/examples/sound/morse_audio/6.mp3 b/UOS/examples/sound/morse_audio/6.mp3 new file mode 100644 index 0000000..95f68df Binary files /dev/null and b/UOS/examples/sound/morse_audio/6.mp3 differ diff --git a/UOS/examples/sound/morse_audio/7.mp3 b/UOS/examples/sound/morse_audio/7.mp3 new file mode 100644 index 0000000..14b16df Binary files /dev/null and b/UOS/examples/sound/morse_audio/7.mp3 differ diff --git a/UOS/examples/sound/morse_audio/8.mp3 b/UOS/examples/sound/morse_audio/8.mp3 new file mode 100644 index 0000000..7eb616e Binary files /dev/null and b/UOS/examples/sound/morse_audio/8.mp3 differ diff --git a/UOS/examples/sound/morse_audio/9.mp3 b/UOS/examples/sound/morse_audio/9.mp3 new file mode 100644 index 0000000..b5e8437 Binary files /dev/null and b/UOS/examples/sound/morse_audio/9.mp3 differ diff --git a/UOS/examples/sound/morse_audio/a.mp3 b/UOS/examples/sound/morse_audio/a.mp3 new file mode 100644 index 0000000..819c225 Binary files /dev/null and b/UOS/examples/sound/morse_audio/a.mp3 differ diff --git a/UOS/examples/sound/morse_audio/b.mp3 b/UOS/examples/sound/morse_audio/b.mp3 new file mode 100644 index 0000000..f08b110 Binary files /dev/null and b/UOS/examples/sound/morse_audio/b.mp3 differ diff --git a/UOS/examples/sound/morse_audio/c.mp3 b/UOS/examples/sound/morse_audio/c.mp3 new file mode 100644 index 0000000..c4b4560 Binary files /dev/null and b/UOS/examples/sound/morse_audio/c.mp3 differ diff --git a/UOS/examples/sound/morse_audio/d.mp3 b/UOS/examples/sound/morse_audio/d.mp3 new file mode 100644 index 0000000..d0c3666 Binary files /dev/null and b/UOS/examples/sound/morse_audio/d.mp3 differ diff --git a/UOS/examples/sound/morse_audio/e.mp3 b/UOS/examples/sound/morse_audio/e.mp3 new file mode 100644 index 0000000..7daaf95 Binary files /dev/null and b/UOS/examples/sound/morse_audio/e.mp3 differ diff --git a/UOS/examples/sound/morse_audio/f.mp3 b/UOS/examples/sound/morse_audio/f.mp3 new file mode 100644 index 0000000..08f867a Binary files /dev/null and b/UOS/examples/sound/morse_audio/f.mp3 differ diff --git a/UOS/examples/sound/morse_audio/g.mp3 b/UOS/examples/sound/morse_audio/g.mp3 new file mode 100644 index 0000000..0ffcfbb Binary files /dev/null and b/UOS/examples/sound/morse_audio/g.mp3 differ diff --git a/UOS/examples/sound/morse_audio/h.mp3 b/UOS/examples/sound/morse_audio/h.mp3 new file mode 100644 index 0000000..d340fa6 Binary files /dev/null and b/UOS/examples/sound/morse_audio/h.mp3 differ diff --git a/UOS/examples/sound/morse_audio/i.mp3 b/UOS/examples/sound/morse_audio/i.mp3 new file mode 100644 index 0000000..8b3538b Binary files /dev/null and b/UOS/examples/sound/morse_audio/i.mp3 differ diff --git a/UOS/examples/sound/morse_audio/j.mp3 b/UOS/examples/sound/morse_audio/j.mp3 new file mode 100644 index 0000000..b623cc2 Binary files /dev/null and b/UOS/examples/sound/morse_audio/j.mp3 differ diff --git a/UOS/examples/sound/morse_audio/k.mp3 b/UOS/examples/sound/morse_audio/k.mp3 new file mode 100644 index 0000000..1f9ac70 Binary files /dev/null and b/UOS/examples/sound/morse_audio/k.mp3 differ diff --git a/UOS/examples/sound/morse_audio/l.mp3 b/UOS/examples/sound/morse_audio/l.mp3 new file mode 100644 index 0000000..fe16c51 Binary files /dev/null and b/UOS/examples/sound/morse_audio/l.mp3 differ diff --git a/UOS/examples/sound/morse_audio/m.mp3 b/UOS/examples/sound/morse_audio/m.mp3 new file mode 100644 index 0000000..d03ff0e Binary files /dev/null and b/UOS/examples/sound/morse_audio/m.mp3 differ diff --git a/UOS/examples/sound/morse_audio/n.mp3 b/UOS/examples/sound/morse_audio/n.mp3 new file mode 100644 index 0000000..2d6c39d Binary files /dev/null and b/UOS/examples/sound/morse_audio/n.mp3 differ diff --git a/UOS/examples/sound/morse_audio/o.mp3 b/UOS/examples/sound/morse_audio/o.mp3 new file mode 100644 index 0000000..6740943 Binary files /dev/null and b/UOS/examples/sound/morse_audio/o.mp3 differ diff --git a/UOS/examples/sound/morse_audio/p.mp3 b/UOS/examples/sound/morse_audio/p.mp3 new file mode 100644 index 0000000..26087f4 Binary files /dev/null and b/UOS/examples/sound/morse_audio/p.mp3 differ diff --git a/UOS/examples/sound/morse_audio/q.mp3 b/UOS/examples/sound/morse_audio/q.mp3 new file mode 100644 index 0000000..d0a5806 Binary files /dev/null and b/UOS/examples/sound/morse_audio/q.mp3 differ diff --git a/UOS/examples/sound/morse_audio/r.mp3 b/UOS/examples/sound/morse_audio/r.mp3 new file mode 100644 index 0000000..618d6db Binary files /dev/null and b/UOS/examples/sound/morse_audio/r.mp3 differ diff --git a/UOS/examples/sound/morse_audio/s.mp3 b/UOS/examples/sound/morse_audio/s.mp3 new file mode 100644 index 0000000..464c398 Binary files /dev/null and b/UOS/examples/sound/morse_audio/s.mp3 differ diff --git a/UOS/examples/sound/morse_audio/t.mp3 b/UOS/examples/sound/morse_audio/t.mp3 new file mode 100644 index 0000000..c7383b7 Binary files /dev/null and b/UOS/examples/sound/morse_audio/t.mp3 differ diff --git a/UOS/examples/sound/morse_audio/u.mp3 b/UOS/examples/sound/morse_audio/u.mp3 new file mode 100644 index 0000000..f3bb360 Binary files /dev/null and b/UOS/examples/sound/morse_audio/u.mp3 differ diff --git a/UOS/examples/sound/morse_audio/v.mp3 b/UOS/examples/sound/morse_audio/v.mp3 new file mode 100644 index 0000000..2b8116a Binary files /dev/null and b/UOS/examples/sound/morse_audio/v.mp3 differ diff --git a/UOS/examples/sound/morse_audio/w.mp3 b/UOS/examples/sound/morse_audio/w.mp3 new file mode 100644 index 0000000..9164e49 Binary files /dev/null and b/UOS/examples/sound/morse_audio/w.mp3 differ diff --git a/UOS/examples/sound/morse_audio/x.mp3 b/UOS/examples/sound/morse_audio/x.mp3 new file mode 100644 index 0000000..2a52c8e Binary files /dev/null and b/UOS/examples/sound/morse_audio/x.mp3 differ diff --git a/UOS/examples/sound/morse_audio/y.mp3 b/UOS/examples/sound/morse_audio/y.mp3 new file mode 100644 index 0000000..e69ccdc Binary files /dev/null and b/UOS/examples/sound/morse_audio/y.mp3 differ diff --git a/UOS/examples/sound/morse_audio/z.mp3 b/UOS/examples/sound/morse_audio/z.mp3 new file mode 100644 index 0000000..8f378e7 Binary files /dev/null and b/UOS/examples/sound/morse_audio/z.mp3 differ diff --git a/UOS/examples/sound/noisyvoice.ogg b/UOS/examples/sound/noisyvoice.ogg new file mode 100644 index 0000000..89afac1 Binary files /dev/null and b/UOS/examples/sound/noisyvoice.ogg differ diff --git a/UOS/examples/sound/test.flac b/UOS/examples/sound/test.flac new file mode 100644 index 0000000..7cb5e3b Binary files /dev/null and b/UOS/examples/sound/test.flac differ diff --git a/UOS/examples/sound/test.it b/UOS/examples/sound/test.it new file mode 100644 index 0000000..ab42fb4 Binary files /dev/null and b/UOS/examples/sound/test.it differ diff --git a/UOS/examples/sound/test.m4a b/UOS/examples/sound/test.m4a new file mode 100644 index 0000000..536a44b Binary files /dev/null and b/UOS/examples/sound/test.m4a differ diff --git a/UOS/examples/sound/test.mod b/UOS/examples/sound/test.mod new file mode 100644 index 0000000..f3f1d9d Binary files /dev/null and b/UOS/examples/sound/test.mod differ diff --git a/UOS/examples/sound/test.mp3 b/UOS/examples/sound/test.mp3 new file mode 100644 index 0000000..ed48d37 Binary files /dev/null and b/UOS/examples/sound/test.mp3 differ diff --git a/UOS/examples/sound/test.ogg b/UOS/examples/sound/test.ogg new file mode 100644 index 0000000..2449f14 Binary files /dev/null and b/UOS/examples/sound/test.ogg differ diff --git a/UOS/examples/sound/test.opus b/UOS/examples/sound/test.opus new file mode 100644 index 0000000..551b31e Binary files /dev/null and b/UOS/examples/sound/test.opus differ diff --git a/UOS/examples/sound/test.s3m b/UOS/examples/sound/test.s3m new file mode 100644 index 0000000..e0b5e62 Binary files /dev/null and b/UOS/examples/sound/test.s3m differ diff --git a/UOS/examples/sound/test.wav b/UOS/examples/sound/test.wav new file mode 100644 index 0000000..d8b12b6 Binary files /dev/null and b/UOS/examples/sound/test.wav differ diff --git a/UOS/examples/sound/test.xm b/UOS/examples/sound/test.xm new file mode 100644 index 0000000..0090da8 Binary files /dev/null and b/UOS/examples/sound/test.xm differ diff --git a/UOS/examples/testfpguistream.lpi b/UOS/examples/testfpguistream.lpi new file mode 100644 index 0000000..ba32cdd --- /dev/null +++ b/UOS/examples/testfpguistream.lpi @@ -0,0 +1,70 @@ +<?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="testfpguistream"/> + <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="testfpguistream.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="testfpgui"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="testfpguistream"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + </CodeGeneration> + <Linking> + <LinkSmart Value="True"/> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <WriteFPCLogo Value="False"/> + <CustomOptions Value="-FUunits"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/UOS/examples/testfpguistream.pas b/UOS/examples/testfpguistream.pas new file mode 100644 index 0000000..8a908e3 --- /dev/null +++ b/UOS/examples/testfpguistream.pas @@ -0,0 +1,172 @@ +program testfpgui; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} +uses + {$IFDEF UNIX} + cthreads, + {$ENDIF} + SysUtils, Classes, fpg_base, fpg_main, math, uos_flat, + {%units 'Auto-generated GUI code'} + fpg_form, fpg_button + {%endunits} + ; + +type + + Ttest = class(TfpgForm) + private + {@VFD_HEAD_BEGIN: test} + Button1: TfpgButton; + {@VFD_HEAD_END: test} + public + procedure AfterCreate; override; + procedure btnStartClick(Sender: TObject); + + procedure btnCloseClick(Sender: TObject); + procedure ConsolePlay; + end; + +{@VFD_NEWFORM_DECL} + +{@VFD_NEWFORM_IMPL} +var + res: integer; + ordir, opath, PA_FileName, MP_FileName, theurl : string; + PlayerIndex1: cardinal = 0; + +procedure Ttest.AfterCreate; +begin + {%region 'Auto-generated GUI code' -fold} + + {@VFD_BODY_BEGIN: test} + Name := 'test'; + SetPosition(427, 240, 300, 100); + WindowTitle := 'Internet Radio test'; + IconName := ''; + Hint := ''; + WindowPosition := wpScreenCenter; + Ondestroy := @btnCloseClick; + + Button1 := TfpgButton.Create(self); + with Button1 do + begin + Name := 'Button1'; + SetPosition(100, 35, 100, 30); + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 1; + Text := 'Start'; + onClick := @btnStartClick; + end; + + {@VFD_BODY_END: test} + {%endregion} + end; + +procedure Ttest.btnStartClick(Sender: TObject); +begin +ConsolePlay; +end; + +procedure Ttest.btnCloseClick(Sender: TObject); + begin + uos_stop(PlayerIndex1); + sleep(100); + uos_UnloadLib(); + end; + + procedure Ttest.ConsolePlay; + 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} + + {$IFDEF linux} + {$if defined(cpu64)} + PA_FileName := ordir + 'lib/Linux/64bit/LibPortaudio-64.so'; + MP_FileName := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + {$else} + PA_FileName := ordir + 'lib/Linux/32bit/LibPortaudio-32.so'; + MP_FileName := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; +{$endif} + {$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} + 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} + + PlayerIndex1 := 0; + +{$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 + res := uos_LoadLib(Pchar(PA_FileName), nil, Pchar(MP_FileName), nil , nil, nil, nil) ; + // if res = 0 then writeln('===> Libraries are loaded.') else writeln('===> Libraries are NOT loaded.') ; + + + uos_CreatePlayer(PlayerIndex1); //// Create the player + // writeln('===> uos_CreatePlayer => ok'); + + theurl := 'http://broadcast.infomaniak.net:80/alouette-high.mp3'; + // 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' ; + + uos_AddFromURL(PlayerIndex1,pchar(theurl)) ; + // writeln('===> uos_AddFromURL => ok'); + + //// add a Output => change framecount => 1024 + uos_AddIntoDevOut(PlayerIndex1, -1, -1, -1, -1, -1, 1024, -1); + // writeln('===> uos_AddIntoDevOut => ok'); + + uos_Play(PlayerIndex1); +end; + +procedure MainProc; +var + frm: Ttest; +begin + fpgApplication.Initialize; + try + frm := Ttest.Create(nil); + fpgApplication.MainForm := frm; + frm.Show; + fpgApplication.Run; + finally + uos_free; + frm.Free; + end; +end; + +begin + MainProc; +end. diff --git a/UOS/examples/uos.bmp b/UOS/examples/uos.bmp new file mode 100644 index 0000000..1f3352e Binary files /dev/null and b/UOS/examples/uos.bmp differ diff --git a/UOS/examples/uos.pas b/UOS/examples/uos.pas new file mode 100644 index 0000000..369fe3e --- /dev/null +++ b/UOS/examples/uos.pas @@ -0,0 +1,12754 @@ + + +{This unit is part of United Openlibraries of Sound (uos) + This is the main uos unit. + License : modified LGPL.3 + Fred van Stappen fiens@hotmail.com } + +unit uos; + +{$mode objfpc}{$H+}{$inline on} +{$PACKRECORDS C} + +// For custom configuration of directive to compiler ---> uos_define.inc +{$I uos_define.inc} + +interface + +uses + +{$IF DEFINED(mse)} +msegui, msethread, +{$endif} + +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} +fpg_base, fpg_main, +{$endif} + +{$IF DEFINED(Java)} +uos_jni, +{$endif} + +{$IF DEFINED(webstream)} +uos_httpgetthread, Pipes, +{$ENDIF} + +{$IF DEFINED(portaudio)} +uos_portaudio, +{$endif} + +{$IF DEFINED(xmp)} +uos_libxmp, +{$endif} + +{$IF DEFINED(sndfile)} +uos_LibSndFile, +{$endif} + +{$IF DEFINED(mpg123)} +uos_Mpg123, +{$endif} + +{$IF DEFINED(soundtouch)} +uos_soundtouch, +{$endif} + +{$IF DEFINED(bs2b)} +uos_bs2b, +{$endif} + +{$IF DEFINED(noiseremoval)} +uos_dsp_noiseremoval, +{$endif} + +{$IF DEFINED(neaac)} +uos_aac, +{$endif} + +{$IF DEFINED(fdkaac)} +uos_fdkaacdecoder, +{$endif} + +{$IF DEFINED(opus)} +uos_opusfile, +{$endif} + +{$IF DEFINED(shout)} +uos_shout, uos_opus, +{$endif} + +{$IF DEFINED(cdrom)} +uos_cdrom, +{$endif} + +Classes, DynLibs, ctypes, Math, sysutils; + +const + uos_version : cint32 = 2241001; + +{$IF DEFINED(bs2b)} + BS2B_HIGH_CLEVEL = (CInt32(700)) or ((CInt32(30)) shl 16); + BS2B_MIDDLE_CLEVEL = (CInt32(500)) or ((CInt32(45)) shl 16); + BS2B_LOW_CLEVEL = (CInt32(360)) or ((CInt32(60)) shl 16); + { Easy crossfeed levels (Obsolete) } + BS2B_HIGH_ECLEVEL = (CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_MIDDLE_ECLEVEL = (CInt32(500)) or ((CInt32(72)) shl 16); + BS2B_LOW_ECLEVEL = (CInt32(360)) or ((CInt32(84)) shl 16); + BS2B_DEFAULT_CLEVEL = (CInt32(700)) or ((CInt32(45)) shl 16); + BS2B_CMOY_CLEVEL = (CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_JMEIER_CLEVEL = (CInt32(650)) or ((CInt32(95)) shl 16); +{$endif} + +{$IF DEFINED(synthesizer)} +const + // musical note ==> frequency in hertz + // Latin: Do, Ré, Mi, Fa, Sol, La, Si + // Dièse = _d example la0_d + la0 = 55.0; + la0_d = 58.3; + si0 = 61.7; + do0 = 65.4; + do0_d = 69.3; + re0 = 73.4; + re0_d = 77.8; + mi0 = 82.4; + fa0 = 87.3; + fa0_d = 92.5; + sol0 = 98.0; + sol0_d = 103.8; + la1 = 110.0; + la1_d = 116.5; + si1 = 123.5; + do1 = 130.8; + do1_d = 138.6; + re1 = 146.8; + re1_d = 155.6; + mi1 = 164.8; + fa1 = 174.6; + fa1_d = 185.0; + sol1 = 196.0; + sol1_d = 207.7; + la2 = 220.0; + la2_d = 233.1; + si2 = 2246.9; + do2 = 261.6; + do2_d = 277.2; + re2 = 293.7; + re2_d = 311.1; + mi2 = 329.6; + fa2 = 349.2; + fa2_d = 370.0; + sol2 = 392.0; + sol2_d = 415.3; + la3 = 440.0; + la3_d = 466.2; + si3 = 493.9; + do3 = 523.3; + do3_d = 554.4; + re3 = 587.3; + re3_d = 622.3; + mi3 = 659.3; + fa3 = 698.5; + fa3_d = 740.0; + sol3 = 784.0; + sol3_d = 830.6; + la4 = 880.0; + la4_d = 932.4; + si4 = 987.8; + do4 = 1046.6; + do4_d = 1108.8; + re4 = 1174.6; + re4_d = 1244.6; + mi4 = 1318.6; + fa4 = 1397.0; + fa4_d = 1480.0; + sol4 = 1568.0; + sol4_d = 1661.2; + la5 = 1760.0; + + // English musique note + // A, B, C, D, E, F, G + a0 = 55.0; + a0_s = 58.3; + b0 = 61.7; + c0 = 65.4; + c0_s = 69.3; + d0 = 73.4; + d0_s = 77.8; + e0 = 82.4; + f0 = 87.3; + f0_s = 92.5; + g0 = 98.0; + g0_s = 103.8; + a1 = 110.0; + a1_s = 116.5; + b1 = 123.5; + c1 = 130.8; + c1_s = 138.6; + d1 = 146.8; + d1_s = 155.6; + e1 = 164.8; + f1 = 174.6; + f1_s = 185.0; + g1 = 196.0; + g1_s = 207.7; + a2 = 220.0; + a2_s = 233.1; + b2 = 2246.9; + c2 = 261.6; + c2_s = 277.2; + d2 = 293.7; + d2_s = 311.1; + e2 = 329.6; + f2 = 349.2; + f2_s = 370.0; + g2 = 392.0; + g2_s = 415.3; + a3 = 440.0; + a3_s = 466.2; + b3 = 493.9; + c3 = 523.3; + c3_s = 554.4; + d3 = 587.3; + d3_s = 622.3; + e3 = 659.3; + f3 = 698.5; + f3_s = 740.0; + g3 = 784.0; + g3_s = 830.6; + a4 = 880.0; + a4_s = 932.4; + b4 = 987.8; + c4 = 1046.6; + c4_s = 1108.8; + d4 = 1174.6; + d4_s = 1244.6; + e4 = 1318.6; + f4 = 1397.0; + f4_s = 1480.0; + g4 = 1568.0; + g4_s = 1661.2; + a5 = 1760.0; +{$endif} + +{$IF DEFINED(shout)} + cFRAME_SIZE = 960; + cSAMPLE_RATE = 48000; + cAPPLICATION = OPUS_APPLICATION_AUDIO; + cBITRATE = 64000; + cMAX_FRAME_SIZE = 6 * 960; + cMAX_PACKET_SIZE = 3 * 1276; +{$endif} + +type + TDummyThread = class(TThread) + protected + procedure execute; + override; + end; + +{$IF DEFINED(mse)} +{$else} + +type + TuosThread = class(TThread) + protected + procedure execute; + override; + public + theparent : Tobject; + + constructor Create(CreateSuspended: boolean; AParent: TObject; + Const StackSize: SizeUInt = DefaultStackSize); + overload; + virtual; + procedure DoTerminate; + override; + end; +{$endif} + +type + TDArFloat = array of cfloat; + TDArShort = array of cInt16; + TDArLong = array of cInt32; + + TDArPARFloat = array of TDArFloat; + TDArIARFloat = array of TDArPARFloat; + + PDArFloat = ^TDArFloat; + PDArShort = ^TDArShort; + PDArLong = ^TDArLong; + + {$IF not DEFINED(windows)} + THandle = pointer; + TArray = single; +{$endif} + +type + Tuos_BufferInfos = record + SampleRate: CDouble; + SampleRateRoot: CDouble; + SampleFormat: cint32; + Channels: cint32; + Filename: UTF8String; + Title: UTF8String; + Copyright: UTF8String; + Software: UTF8String; + Artist: UTF8String; + Comment: UTF8String; + Date: string; + Tag: array[0..2] of char; + Album: UTF8String; + Genre: string; + Track: string; + HDFormat: cint32; + Sections: cint32; + Encoding: cint32; + bitrate: cint32; + Length: cint32; + // length samples total + LibOpen: shortint; + Ratio: byte; + end; + +type +{$if not defined(fs32bit)} + Tcount_t = cint64; { used for file sizes } +{$else} + Tcount_t = cint32; +{$endif} + +type + Tuos_LoadResult = record + PAloadError: shortint; + SFloadError: shortint; + MPloadError: shortint; + PCloadError: shortint; + STloadError: shortint; + BSloadError: shortint; + AAloadError: shortint; + OPloadError: shortint; + XMloadError: shortint; + FAloadError: shortint; + PAinitError: shortint; + MPinitError: shortint; + end; + +type + Tuos_Init = class(TObject) + public + evGlobalPause: PRTLEvent; + // for global pausing + + constructor Create; + private + + PA_FileName: pchar; + // PortAudio + SF_FileName: pchar; + // SndFile + MP_FileName: pchar; + // Mpg123 + AA_FileName : PChar; + // Faad + M4_FileName : PChar; + // Mp4ff + OF_FileName : PChar; + // opusfile + XM_FileName : PChar; + // XMP + FA_FileName : PChar; + // Fdkaac + Plug_ST_FileName: pchar; + // Plugin SoundTouch + GetBMP + Plug_BS_FileName: pchar; + // Plugin bs2b + +{$IF DEFINED(portaudio)} + DefDevOut: PaDeviceIndex; + DefDevOutInfo: PPaDeviceInfo; + DefDevOutAPIInfo: PPaHostApiInfo; + DefDevIn: PaDeviceIndex; + DefDevInInfo: PPaDeviceInfo; + DefDevInAPIInfo: PPaHostApiInfo; +{$endif} + + function loadlib: cint32; + procedure unloadlib; + procedure unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: boolean); + function InitLib: cint32; + procedure unloadPlugin(PluginName: Pchar); + end; + +type + Tuos_DeviceInfos = record + DeviceNum: cint32; + DeviceName: UTF8String; + DeviceType: UTF8String; + DefaultDevIn: boolean; + DefaultDevOut: boolean; + ChannelsIn: cint32; + ChannelsOut: cint32; + SampleRate: CDouble; + LatencyHighIn: CDouble; + LatencyLowIn: CDouble; + LatencyHighOut: CDouble; + LatencyLowOut: CDouble; + HostAPIName: UTF8String; + end; + +type + Tuos_WaveHeaderChunk = packed record + wFormatTag: smallint; + wChannels: word; + wSamplesPerSec: cint32; + wAvgBytesPerSec: cint32; + wBlockAlign: word; + wBitsPerSample: word; + wcbSize: word; + end; + +type + Tuos_FileBuffer = record + ERROR: word; + wSamplesPerSec: cint32; + wBitsPerSample: word; + wChannels: word; + FileFormat: shortint; + Data: TFileStream; + DataMS: TMemoryStream; + end; + +type + Tuos_Data = record + // Global data + Enabled: boolean; + + TypePut: shortint; + // -1 : nothing. + // for Input : 0: from audio encoded file, 1: from input device (like mic), + // 2: from internet audio stream, 3: from Synthesizer, 4: from memory buffer, + // 5: from endless-muted, 6: from decoded memorystream + + // for Output : 0: into wav file from filestream, 1: into output device Portaudio, 2: into stream server, + // 3: into memory buffer, 4: into wav file from memorystream, 5: into memorystream, + // 6: into ogg file from filestream, 7: into ogg memorystream + + Seekable: boolean; + Status: byte; + Buffer: TDArFloat; + MemoryBuffer: TDArFloat; + MemoryStream : Tmemorystream; + + posmem : longint; + + {$IF DEFINED(opus)} + BufferTMP: tbytes; + {$endif} + + DSPVolumeIndex : cint32; + DSPNoiseIndex : cint32; + VLeft, VRight: double; + hasfilters : boolean; + nbfilters : cint32; + incfilters : cint32; + levelfilters : string; + levelfiltersar : TDArFloat; + PositionEnable : shortint; + LevelEnable : shortint; + LevelLeft, LevelRight: cfloat; + levelArrayEnable : shortint; + +{$IF DEFINED(synthesizer)} + LookupTableLeft, LookupTableRight: array [0..1023] of CFloat; + PosInTableLeft, PosInTableRight: Double; + typLsine, typRsine: cint32; + freqLsine, freqRsine: cfloat; + dursine, posdursine: cint32; + harmonic: cint32; + evenharm: shortint; +{$endif} + +{$if defined(cpu64)} + Wantframes: Tcount_t; + OutFrames: Tcount_t; +{$else} + Wantframes: cint32; + OutFrames: cint32; +{$endif} + + SamplerateRoot: CDouble; + SampleRate: CDouble; + SampleFormat: cint32; + Channels: cint32; + lastbuf: shortint; + + // audio file data + HandleSt: pointer; + {$IF DEFINED(opus)} + HandleOP: TOpusFile; + {$endif} + Filename: UTF8String; + Title: UTF8String; + Copyright: UTF8String; + Software: UTF8String; + Artist: UTF8String; + Comment: UTF8String; + Date: string; + Tag: array[0..2] of char; + Album: UTF8String; + Genre: string; + Track: string; + HDFormat: cint32; + {$IF DEFINED(sndfile)} + Frames: Tcount_t; + {$else} + Frames: cint32; + {$endif} + Sections: cint32; + Encoding: cint32; + bitrate: cint32; + Length: cint32; + // length samples total + LibOpen: shortint; + // -1: nothing open, 0: sndfile open, 1: mpg123 open, 2: aac open, 3: cdrom, 4: opus, 5: xmp + Ratio: byte; + // if mpg123 or aac then ratio := 2 + + BPM : cfloat; + numbuf : integer; + Output: cint32; + + {$if defined(cpu64)} + // TO CHECK + Position: cint32; + Poseek: cint32; + {$else} + Position: cint32; + Poseek: cint32; + {$endif} + + end; + +type + TArray01 = array[0..1] of cfloat; + + Tuos_FFT = class(TObject) + public + + TypeFilterL, TypeFilterR: byte; + LowFrequencyL, HighFrequencyL: cfloat; + LowFrequencyR, HighFrequencyR: cfloat; + GainL, GainR: cfloat; + + // Left + a3, a32: array[0..2] of cfloat; + b2, x0, x1, y0, y1, b22, x02, x12, y02, y12: TArray01; + C, D, C2, D2 : cfloat; + + // Right + a3R, a32R: array[0..2] of cfloat; + b2R, x0R, x1R, y0R, y1R, b22R, x02R, x12R, y02R, y12R: TArray01; + CR, DR, C2R, D2R : cfloat; + + AlsoBuf: boolean; + VirtualBuffer: TDArFloat; + levelstring : string; + + {$IF DEFINED(noiseremoval)} + FNoise : TuosNoiseRemoval; + {$endif} + + constructor Create; + end; + +type + TFunc = function (Var Data: Tuos_Data; Var FFT: Tuos_FFT): TDArFloat; + + {$if DEFINED(java)} + TProc = JMethodID ; + {$else} + TProc = procedure of object; + {$endif} + + TProcOnly = procedure ; + + {$IF DEFINED(bs2b) or DEFINED(soundtouch)} + TPlugFunc = function (bufferin: TDArFloat; plugHandle: THandle; Abs2bd : Tt_bs2bdp; Var inputData: + Tuos_Data; + param1: float; param2: float; param3: float; param4: float; + param5: float; param6: float; param7: float; param8: float): TDArFloat; + {$endif} + +type + Tuos_DSP = class(TObject) + public + Enabled: boolean; + BefFunc: TFunc; + // function to execute before buffer is filled + AftFunc: TFunc; + // function to execute after buffer is filled + EndFunc: TFunc; + // function to execute at end of thread; + LoopProc: TProc; + // External Procedure of object to synchronize after buffer is filled + + // for FFT + fftdata: Tuos_FFT; + + {$IF DEFINED(Java)} + procedure LoopProcjava; + {$endif} + + constructor Create; + + destructor Destroy; + override; + + end; + +type + Tuos_InStream = class(TObject) + {$IF DEFINED(webstream)} + private + procedure UpdateIcyMetaInterval; + {$endif} + public + Data: Tuos_Data; + DSP: array of Tuos_DSP; + + MemoryStreamDec : TMemoryStream; + + {$IF DEFINED(neaac)} + AACI: TAACInfo; + {$endif} + + {$IF DEFINED(cdrom)} + pCD: PCDROMInfo; + {$endif} + + // for web streaming + {$IF DEFINED(webstream)} + httpget: TThreadHttpGetter; + // threaded http getter + {$IF DEFINED(windows)} + {$if defined(cpu64)} + InHandle : Qword; + OutHandle: Qword; + {$else} + InHandle : longword; + OutHandle: longword; + {$ENDIF} + {$else} + InHandle : cint32; + OutHandle: cint32; + {$endif} + InPipe: TInputPipeStream; + OutPipe: TOutputPipeStream; + {$ENDIF} + {$IF DEFINED(portaudio)} + PAParam: PaStreamParameters; + {$endif} + LoopProc: TProc; + // External Procedure of object to synchronize after buffer is filled + + {$IF DEFINED(Java)} + procedure LoopProcjava; + {$endif} + + constructor Create; + + destructor Destroy; + override; + end; + +type + Tuos_OutStream = class(TObject) + public + Data: Tuos_Data; + BufferOut: PDArFloat; + MemorySteamOut: TMemoryStream; + DSP: array of Tuos_DSP; + {$IF DEFINED(portaudio)} + PAParam: PaStreamParameters; + {$endif} + {$IF DEFINED(shout)} + encoder: TOpusEncoder; + cbits: array [0..cMAX_PACKET_SIZE - 1] of Byte; + // cbits: tbytes; + {$endif} + FileBuffer: Tuos_FileBuffer; + LoopProc: TProc; + // External Procedure of object to synchronize after buffer is filled + {$IF DEFINED(Java)} + procedure LoopProcjava; + {$endif} + + constructor Create; + + destructor Destroy; + override; + end; + + Tuos_Plugin = class(TObject) + public + Enabled: boolean; + Name: string; + PlugHandle: THandle; + + {$IF DEFINED(bs2b) or DEFINED(soundtouch)} + Abs2b : Tt_bs2bdp; + PlugFunc: TPlugFunc; + {$endif} + param1: float; + param2: float; + param3: float; + param4: float; + param5: float; + param6: float; + param7: float; + param8: float; + Buffer: TDArFloat; + + constructor Create; + end; + +type + Tuos_Player = class(tobject) + protected + {$IF DEFINED(mse)} + thethread : tmsethread; + {$else} + thethread : TuosThread; + {$endif} + evPause: PRTLEvent; + // for pausing + procedure ReadFile(x : integer); + inline; + {$IF DEFINED(webstream)} + procedure ReadUrl(x : integer); + inline; + {$endif} + {$IF DEFINED(synthesizer)} + procedure ReadSynth(x : integer); + inline; + procedure FillLookupTable(x, typewave, channel, + AHarmonics: Integer; EvenHarmonics: shortint); + inline; + {$endif} + procedure ReadEndless(x : integer); + inline; + procedure ReadMem(x : integer); + inline; + procedure ReadMemDec(x : integer); + inline; + {$IF DEFINED(portaudio)} + procedure ReadDevice(x : integer); + inline; + {$endif} + procedure WriteOutPlug(x:integer; x2 : integer); + inline; + procedure WriteOut(x:integer; x2 : integer); + inline; + procedure CheckIfPaused ; + inline; + procedure DoBeginMethods; + inline; + procedure DoLoopBeginMethods; + inline; + procedure DoLoopEndMethods; + inline; + procedure DoArrayLevel(x: integer); + inline; + procedure DoSeek(x: integer); + inline; + procedure DoDSPinBeforeBufProc(x: integer); + inline; + procedure DoDSPinAfterBufProc(x: integer); + inline; + procedure DoDSPOutAfterBufProc(x: integer); + inline; + procedure DoMainLoopProc(x: integer); + inline; + procedure SeekIfTerminated; + inline; + procedure DoTerminateNoFreePlayer; + inline; + procedure DoTerminatePlayer; + inline; + procedure DoEndProc; + inline; + + {$IF DEFINED(mse)} + function execute(thread: tmsethread): integer; + inline; + {$endif} + + public + isAssigned: boolean ; + isGlobalPause: boolean ; + Status: cint32; + + //if use -1 value (default) -> not alterate uosPlayers[],.. + Index: cint32; + + intobuf : boolean; + // to check, needed for filetobuf + + NLooped : Integer; + // -1 infinite loop; 0 no loop; > 0 n-loop + + NoFree : boolean; + // Do not free the player at end of thread. + + BeginProc: TProc ; + // External procedure of object to execute at begin of thread + + LoopBeginProc: TProc; + // External procedure of object to execute at each begin of loop + + LoopEndProc: TProc; + // External procedure of object to execute at each end of loop + + EndProc: TProc; + // Procedure of object to execute at end of thread + + EndProcOnly: TProcOnly ; + // Procedure to execute at end of thread (not of object) + + StreamIn: array of Tuos_InStream; + StreamOut: array of Tuos_OutStream; + PlugIn: array of Tuos_Plugin; + + {$IF DEFINED(Java)} + PEnv : PJNIEnv; + Obj: JObject; + procedure beginprocjava; + procedure endprocjava; + procedure LoopBeginProcjava; + procedure LoopEndProcjava; + {$endif} + + constructor create(); + + destructor Destroy; + override; + + function IsLooped: Boolean; + + function SetGlobalEvent(isenabled : boolean) : boolean; + +// Set the RTL Events Global (will pause/start/replay all the players synchro with same rtl event)) + // result : true if set ok. + + // Audio methods + + procedure PlayEx(no_free: Boolean; nloop: Integer; paused: boolean= false); + // Start playing with free at end as parameter and assign loop + + procedure Play(nloop: Integer = 0) ; + // Start playing with loop + + procedure PlayPaused(nloop: Integer = 0) ; + // Start play paused with loop + + procedure RePlay(); + // Resume playing after pause + + procedure Stop(); + // Stop playing and free thread + + procedure Pause(); + // Pause playing + + procedure PlayNoFree(nloop: Integer = 0) ; + // Starting but do not free the player after stop with loop + + procedure PlayNoFreePaused(nloop: Integer = 0) ; + // Start play paused with loop but not free player at end + + procedure FreePlayer() ; + // Free the player: works only when PlayNoFree() was called. + + {$IF DEFINED(portaudio)} + function AddIntoDevOut(Device: cint32; Latency: CDouble; + SampleRate: CDouble; Channels: cint32; SampleFormat: cint32 ; + FramesCount: cint32 ; ChunkCount: cint32 ): cint32; + // 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 (= 65536) + // ChunkCount : default : -1 (= 512) + // result : Output Index in array -1 = error + // example : OutputIndex1 := AddIntoDevOut(-1,-1,-1,-1,0,-1,-1); +{$endif} + + function AddIntoFile(Filenamepath: PChar; SampleRate: CDouble; + Channels: cint32; SampleFormat: cint32 ; FramesCount: cint32 ; FileFormat + : cint32): cint32; + // Add a Output into audio wav file with custom parameters from TFileStream + // FileName : filename of saved audio wav file + // SampleRate : delault : -1 (44100) + // Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + // SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) + // FramesCount : default : -1 (= 4096) + // FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg); + // result : Output Index in array -1 = error + // example : OutputIndex1 := AddIntoFile(edit5.Text,-1,-1, 0, -1, -1); + + function AddIntoFileFromMem(Filenamepath: PChar; SampleRate: CDouble; + Channels: LongInt; SampleFormat: LongInt ; FramesCount: LongInt; + FileFormat: cint32): LongInt; + // Add a Output into audio wav file with custom parameters from TMemoryStream + // FileName : filename of saved audio wav file + // SampleRate : delault : -1 (44100) + // Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + // SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) + // FramesCount : default : -1 (= 4096) + // FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom); + // result : Output Index in array -1 = error + // example : OutputIndex1 := AddIntoFileFromBuf(edit5.Text,-1,-1, 0, -1); + + function AddIntoMemoryBuffer(outmemory: PDArFloat) : cint32; + // Add a Output into memory buffer + // outmemory : pointer of buffer to use to store memory. + // example : OutputIndex1 := AddIntoMemoryBuffer(bufmemory); + + function AddIntoMemoryBuffer(outmemory: PDArFloat; SampleRate: CDouble; SampleFormat: + LongInt; + Channels: LongInt; FramesCount: LongInt): LongInt; + // Add a Output into TMemoryStream + // outmemory : pointer of buffer to use to store memory. + // SampleRate : delault : -1 (44100) + // SampleFormat : default : -1 (0:float32) ( 1:Int32, 2:Int16) + // Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + // FramesCount : default : -1 (= 65536) + + function AddIntoMemoryStream(Var MemoryStream: TMemoryStream; SampleRate: CDouble; + SampleFormat: LongInt ; Channels: LongInt; FramesCount: LongInt; + AudioFormat: cint32): LongInt; + // Add a Output into TMemoryStream + // MemoryStream : the TMemoryStream to use to store memory. + // SampleRate : delault : -1 (44100) + // SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) + // Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + // FramesCount : default : -1 (= 4096) + // AudioFormat : default : -1 (wav) (0:wav, 1:ogg); + + {$IF DEFINED(shout)} + function AddIntoIceServer(SampleRate : CDouble; Channels: cint; SampleFormat: cint; + EncodeType: cint; Port: cint; Host: pchar; User: pchar; Password: + pchar; MountFile :pchar): cint32; + // Add a Output into a IceCast server for audio-web-streaming + // SampleRate : delault : -1 (48000) + // Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + // SampleFormat : -1 default : float32 : (0:float32, 1:Int16) + // EncodeType : default : -1 (0:Music) (0: Music, 1:Voice) + // Port : default : -1 (= 8000) + // Host : default : 'def' (= '127.0.0.1') + // User : default : 'def' (= 'source') + // Password : default : 'def' (= 'hackme') + // MountFile : default : 'def' (= '/example.opus') + // result : Output Index in array -1 = error + {$endif} + +{$IF DEFINED(portaudio)} + function AddFromDevIn(Device: cint32; Latency: CDouble; + SampleRate: CDouble; OutputIndex: cint32; + SampleFormat: cint32; FramesCount : cint32 ; ChunkCount: cint32): cint32 + ; + + // Add a Input from Device Input with custom parameters + // Device ( -1 is default Input device ) + // Latency ( -1 is latency suggested ) ) + // SampleRate : delault : -1 (44100) + +// 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) + // ChunkCount : default : -1 (= 512) + // result : otherwise Output Index in array -1 = error + // example : OutputIndex1 := AddFromDevice(-1,-1,-1,-1,-1, -1); +{$endif} + + function AddFromEndlessMuted(Channels : cint32; FramesCount: cint32): cint32; + // Add a input from Endless Muted dummy sine wav + // FramesCount = FramesCount of input-to-follow + // Channels = Channels of input-to-follow. + + function InputGetBuffer(InputIndex: cint32): TDArFloat; + // Get current buffer + +{$IF DEFINED(synthesizer)} + function AddFromSynth(Channels: integer; WaveTypeL, WaveTypeR: shortint; + FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; + duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32; + OutputIndex: cint32; SampleFormat: cint32 ; SampleRate: CDouble ; + 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, 2= triangle, 3=sawtooth used for mono and stereo) + +// WaveTypeR: default: -1 (0) (0 = sine-wave, 1 = square-wave, 2= triangle, , 3=sawtooth 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 + + procedure InputSetSynth(InputIndex: cint32; WaveTypeL, WaveTypeR: shortint; + 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, 2= triangle, 3=sawtooth used for mono and stereo) + +// WaveTypeR: do not change: -1 (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth 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 ; +{$endif} + + function AddFromFile(Filename: Pchar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32): cint32; + // Add a input from audio file with custom parameters + // FileName : filename of audio file + +// 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 := AddFromFile(edit5.Text,-1,0,-1); + + function AddFromFileIntoMemory(Filename: Pchar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ; numbuf : cint): + cint32 + ; + // Add a input from audio file and store it into memory with custom parameters + // FileName : filename of audio file + +// 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) + +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) + // result : Input Index in array -1 = error + // example : InputIndex1 := AddFromFileIntoMemory(edit5.Text,-1,0,-1, -1); + + function AddFromMemoryBuffer(Var MemoryBuffer: TDArFloat; Var Bufferinfos: Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; + // Add a input from memory buffer with custom parameters + // MemoryBuffer : the buffer + // Bufferinfos : infos of the buffer + +// 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 ';')// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)// SampleRate : delault : -1 (44100)// FramesCount : default : -1 (4096) + // FramesCount : default : -1 (65536 div Channels) + // result : Input Index in array -1 = error + // example : InputIndex1 := AddFromMemoryBuffer(mybuffer, buffinfos,-1,1024); + + function AddFromMemoryStream(Var MemoryStream: TMemoryStream; + TypeAudio: cint32; OutputIndex: cint32; SampleFormat: cint32 ; + FramesCount: cint32): cint32; + // 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 := AddFromMemoryStream(mymemorystream,-1,-1,0,1024); + + function AddFromMemoryStreamDec(Var MemoryStream: TMemoryStream; Var Bufferinfos: + Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; + // MemoryStream : Memory-stream of decoded audio (like created by AddIntoMemoryStream) + // Bufferinfos : infos of the Memory-stream + +// 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 ';') + // FramesCount : default : -1 (4096) + // result : Input Index in array -1 = error + +{$IF DEFINED(webstream)} + function AddFromURL(URL: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ; AudioFormat: cint32 ; ICYon: + boolean): cint32; + // Add a Input from Audio URL + // URL : URL of audio file + +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output + // SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) + // FramesCount : default : -1 (4096) + // AudioFormat : default : -1 (mp3) (0: mp3, 1: opus) + // ICYon : ICY data on/off + // example : InputIndex := AddFromURL('http://someserver/somesound.mp3',-1,-1,-1,-1,false); +{$ENDIF} + + function AddPlugin(PlugName: Pchar; SampleRate: CDouble; + Channels: cint32): cint32; + // Add a plugin , result is PluginIndex + // SampleRate : delault : -1 (44100) + // Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) + // 'soundtouch' 'getbpm' and 'bs2b' PlugName are registred. + +{$IF DEFINED(soundtouch)} + procedure SetPluginSoundTouch(PluginIndex: cint32; Tempo: cfloat; + Pitch: cfloat; Enable: boolean); + // PluginIndex : PluginIndex Index of a existing Plugin. + + procedure SetPluginGetBPM(PluginIndex: cint32; numofframes: integer; loop : boolean; + Enable: boolean); + // PluginIndex : PluginIndex Index of a existing Plugin. + // numofframes: number of frames to analyse (-1 = 512 x frames) + // loop: do new detection after previous. +{$endif} + +{$IF DEFINED(bs2b)} + procedure SetPluginBs2b(PluginIndex: cint32; level: CInt32; fcut: CInt32; + feed: CInt32; Enable: boolean); + // PluginIndex : PluginIndex Index of a existing Plugin. +{$endif} + + function GetStatus() : cint32 ; + // Get the status of the player : 0 => has stopped, 1 => is running, 2 => is paused, + // -1 => error or not yet played, only created. + + procedure InputSeek(InputIndex: cint32; pos: Tcount_t); + // change position in sample + + procedure InputSeekSeconds(InputIndex: cint32; pos: cfloat); + // change position in seconds + + procedure InputSeekTime(InputIndex: cint32; pos: TTime); + // change position in time format + + procedure InputSetEnable(InputIndex: cint32; enabled: boolean); + // set enable true or false + + function InputLength(InputIndex: cint32): cint32; + inline; + // InputIndex : InputIndex of existing input + // result : Length of Input in samples + + function InputLengthSeconds(InputIndex: cint32): cfloat; + inline; + // InputIndex : InputIndex of existing input + // result : Length of Input in seconds + + function InputLengthTime(InputIndex: cint32): TTime; + inline; + // InputIndex : InputIndex of existing input + // result : Length of Input in time format + + function InputPosition(InputIndex: cint32): cint32; + inline; + // InputIndex : InputIndex of existing input + // result : current postion in sample + + function InputPositionSeconds(InputIndex: cint32): float; + inline; + // InputIndex : InputIndex of existing input + // result : current postion of Input in seconds + + function InputPositionTime(InputIndex: cint32): TTime; + inline; + // InputIndex : InputIndex of existing input + // result : current postion of Input in time format + + procedure InputSetFrameCount(InputIndex: cint32 ; framecount : cint32); + inline; + // set number of frames to be done. (usefull for recording and level precision) + + procedure InputSetLevelEnable(InputIndex: cint32 ; levelcalc : cint32); + // set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + // 3 => calcul before and after all DSP procedures. + + procedure InputSetPositionEnable(InputIndex: cint32 ; poscalc : cint32); + // set position calculation (default is 0) + // 0 => no calcul + // 1 => calcul of position. + + procedure InputSetLevelArrayEnable(InputIndex: cint32 ; levelcalc : cint32); + // set add level calculation in level-array (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + + function InputGetLevelLeft(InputIndex: cint32): double; + inline; + // InputIndex : InputIndex of existing input + // result : left level from 0 to 1 + + function InputGetLevelRight(InputIndex: cint32): double; + inline; + // InputIndex : InputIndex of existing input + // result : right level from 0 to 1 + + function InputFiltersGetLevelString(InputIndex: cint32): string; + inline; + // InputIndex : InputIndex of existing input + // filterIndex : Filterindex of existing filter + // result : list of left|right levels separed by $ character + + function InputFiltersGetLevelArray(InputIndex: cint32): TDArFloat; + inline; + // InputIndex : InputIndex of existing input + // result : array of float of each filter. + //in format levelfilter0left,levelfilter0right,levelfilter1left,levelfilter2right,... + +{$IF DEFINED(soundtouch)} + function InputGetBPM(InputIndex: cint32): CDouble; + inline; + // InputIndex : InputIndex of existing input + // result : left level from 0 to 1 +{$endif} + + function InputUpdateTag(InputIndex: cint32): boolean; + inline; + +{$IF DEFINED(webstream) and DEFINED(mpg123)} + function InputUpdateICY(InputIndex: cint32; Var icy_data : pchar): integer; + inline; +{$endif} + + function InputGetTagTitle(InputIndex: cint32): pchar; + inline; + function InputGetTagArtist(InputIndex: cint32): pchar; + inline; + function InputGetTagAlbum(InputIndex: cint32): pchar; + inline; + function InputGetTagDate(InputIndex: cint32): pchar; + inline; + function InputGetTagComment(InputIndex: cint32): pchar; + inline; + function InputGetTagTrack(InputIndex: cint32): pchar; + inline; + function InputGetTagGenre(InputIndex: cint32): pchar; + inline; + function InputGetTagTag(InputIndex: cint32): pchar; + inline; + // Tag infos + + function InputAddDSP(InputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; LoopProc: TProc ): cint32; + // add a DSP procedure for input + // InputIndex d: Input Index of a existing input + // BeforeFunc : function to do before the buffer is filled + // AfterFunc : function to do after the buffer is filled + // EndedFunc : function to do after thread is finish + // LoopProc : external procedure of object to synchronize after the buffer is filled + // result : index of DSPin in array (DSPinIndex) + // example : DSPinIndex1 := InputAddDSP(InputIndex1,@beforereverse,@afterreverse,nil); + + procedure InputSetDSP(InputIndex: cint32; DSPinIndex: cint32; Enable: boolean); + // InputIndex : Input Index of a existing input + // DSPIndexIn : DSP Index of a existing DSP In + // Enable : DSP enabled + // example : InputSetDSP(InputIndex1,DSPinIndex1,True); + + procedure OutputSetEnable(OutputIndex: cint32; enabled: boolean); + // set enable true or false + + function OutputAddDSP(OutputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; LoopProc: TProc): cint32; + // usefull if multi output + // OutputIndex : OutputIndex of a existing Output + // BeforeFunc : function to do before the buffer is filled + // AfterFunc : function to do after the buffer is filled just before to give to output + // EndedFunc : function to do after thread is finish + // LoopProc : external procedure of object to synchronize after the buffer is filled + // result : index of DSPout in array + // example :DSPoutIndex1 := OutputAddDSP(OutputIndex1,@volumeproc,nil,nil); + + procedure OutPutSetDSP(OutputIndex: cint32; DSPoutIndex: cint32; Enable: boolean); + // OutputIndex : OutputIndex of a existing Output + // DSPoutIndex : DSPoutIndex of existing DSPout + // Enable : DSP enabled + // example : OutPutSetDSP(OutputIndex1,DSPoutIndex1,True); + + function InputAddFilter(InputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; + // 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 ) + // LoopProc : external procedure of object to synchronize after DSP done + // result : index of DSPIn in array + + procedure InputSetFilter(InputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); + // 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 + + function OutputAddFilter(OutputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; + // Output : InputIndex of a existing Output + // 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 + // result : index of DSPIn in array + + procedure OutputSetFilter(OutputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); + // OuputIndex : InputIndex of a existing Output + // 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 + + function DSPLevel(Data: Tuos_Data): Tuos_Data; + inline; + // to get level of buffer (volume) + + function InputAddDSP1ChanTo2Chan(InputIndex: cint32): cint32; + // Convert mono 1 channel input to stereo 2 channels input. + // Works only if the input is mono 1 channel othewise stereo 2 chan is keeped. + // InputIndex : InputIndex of a existing Input + // result : index of DSPIn in array + // example DSPIndex1 := InputAddDSP1ChanTo2Chan(InputIndex1); + + function InputAddDSPVolume(InputIndex: cint32; VolLeft: double; + VolRight: double): cint32; + // DSP Volume changer + // InputIndex : InputIndex of a existing Input + // VolLeft : Left volume + // VolRight : Right volume + // result : index of DSPIn in array + // example DSPIndex1 := InputAddDSPVolume(InputIndex1,1,1); + + function OutputAddDSPVolume(OutputIndex: cint32; VolLeft: double; + VolRight: double): cint32; + // DSP Volume changer + // OutputIndex : OutputIndex of a existing Output + // VolLeft : Left volume + // VolRight : Right volume + // result : otherwise index of DSPIn in array + // example DSPIndex1 := OutputAddDSPVolume(InputIndex1,1,1); + +{$IF DEFINED(noiseremoval)} + function InputAddDSPNoiseRemoval(InputIndex: cint32): cint32; + // DSP Noise Removal + // InputIndex : InputIndex of a existing Input + // result : otherwise index of DSPIn in array + // example DSPIndex1 := InputAddDSPNoiseRemoval(InputIndex1); + + procedure InputSetDSPNoiseRemoval(InputIndex: cint32; Enable: boolean); + + function OutputAddDSPNoiseRemoval(OutputIndex: cint32): cint32; + // DSP Noise Removal + // InputIndex : OutputIndex of a existing Output + // result : otherwise index of DSPOut in array + // example DSPIndex1 := OutputAddDSPNoiseRemoval(OutputIndex1); + + procedure OutputSetDSPNoiseRemoval(OutputIndex: cint32; Enable: boolean); +{$endif} + + procedure InputSetDSPVolume(InputIndex: cint32; DSPVolIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); + inline; + // InputIndex : InputIndex of a existing Input + // DSPIndex : DSPIndex of a existing DSP + // VolLeft : Left volume + // VolRight : Right volume + // Enable : Enabled + // example InputSetDSPVolume(InputIndex1,DSPIndex1,1,0.8,True); + + procedure OutputSetDSPVolume(OutputIndex: cint32; DSPVolIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); + inline; + // OutputIndex : OutputIndex of a existing Output + // DSPIndex : DSPIndex of a existing DSP + // VolLeft : Left volume + // VolRight : Right volume + // Enable : Enabled + // example OutputSetDSPVolume(InputIndex1,DSPIndex1,1,0.8,True); + + end; + + // General public procedure/function (accessible for library uos too) + +function uos_GetInfoLibraries() : Pansichar ; + + {$IF DEFINED(portaudio)} + +procedure uos_UpdateDevice(); + +procedure uos_GetInfoDevice(); + +function uos_GetInfoDeviceStr() : Pansichar ; + {$endif} + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName, fdkaacFilename : PChar) : cint32; +// load libraries... if libraryfilename = '' => do not load it... You may load what and when you want... +// PortAudio => needed for dealing with audio-device +// SndFile => needed for dealing with ogg, vorbis, flac and wav audio-files +// Mpg123 => needed for dealing with mp* audio-files +// Mp4ff and Faad => needed for dealing with acc, m4a audio-files +// opusfile => needed for dealing with opus audio-files +// XMP => needed for dealing with MOD audio-files +// Fdkaac => needed for webstreaming of aac files. + +// If you want to load libraries from system, replace it by "'system'" +// If some libraries are not needed, replace it by "nil", + +// for example : uos_loadlib('system', SndFileFileName, 'system', nil, nil, nil, OpusFileFileName, nil, nil) + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName : PChar) : cint32; +// The same but without fdkaac. (for compatibility with previous version) + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName : PChar) : cint32; +// The same but without libxmp and fdkaac. (for compatibility with previous version) + +procedure uos_unloadlib(); +// Unload all libraries... Do not forget to call it before close application... + +{$IF DEFINED(shout)} +function uos_LoadServerLib(ShoutFileName, OpusFileName : PChar) : cint32; +// Shout => needed for dealing with IceCast server +// Opus => needed for dealing with encoding opus stream + +procedure uos_unloadServerLib(); +// Unload server libraries... Do not forget to call it before close application... +{$endif} + +procedure uos_unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: boolean); +// Custom Unload libraries... if true, then unload the library. You may unload what and when you want... + +function uos_loadPlugin(PluginName, PluginFilename: PChar) : cint32; +// load plugin... + +{$IF DEFINED(soundtouch)} +function uos_GetBPM(TheBuffer: TDArFloat; Channels: cint32; SampleRate: CDouble) : CDouble; +inline; +// From SoundTouch plugin +{$endif} + +procedure uos_unloadPlugin(PluginName: PChar); +// Unload Plugin... + +procedure uos_Free(); +// To call at end of application. +// If uos_flat.pas was used, it will free all the uos_player created. + +function uos_GetVersion() : cint32 ; +inline; +// version of uos + +function uos_File2Buffer(Filename: Pchar; SampleFormat: cint32 ; Var bufferinfos: Tuos_BufferInfos ; + frompos : cint; numbuf : cint ): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) + + +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max of frames) +// result : The memory buffer +// example : buffmem := uos_File2buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + +function uos_Stream2Buffer(AudioFile: TMemoryStream; SampleFormat: int32 ; Var outmemory: TDArFloat; + Var bufferinfos: Tuos_BufferInfos ; frompos : cint; numbuf : cint): + TDArFloat +; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) + +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) +// result : The memory buffer +// example : buffmem := uos__Stream2Buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + +procedure uos_File2File(FilenameIN: Pchar; FilenameOUT: Pchar; SampleFormat: cint32 ; typeout: + cint32 ); +// Create a audio file from a audio file. +// FileNameIN : filename of audio file IN (ogg, flac, wav, mp3, opus, aac,...) +// FileNameOUT : filename of audio file OUT (wav, pcm, custom) +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// typeout : Type of out file (-1:default=wav, 0:wav, 1:pcm, 2:custom) +// example : InputIndex1 := uos_File2File(edit5.Text,0,buffmem); + +procedure uos_MemStream2Wavfile(FileName: UTF8String; Data: TMemoryStream; BitsPerSample, chan: + integer; + samplerate : CDouble); +// Create a audio wav file from a TMemoryStream. +// FileName : filename of wav saved file +// data : the memorystream +// BitsPerSample : 16 or 32 (bit) +// chan : number of channels +// samplerate : sample rate + +function CvInt16ToFloat32(Inbuf: TDArFloat): TDArFloat; +inline; +// convert buffer int16 into float32. + +procedure uos_CustBufferInfos(Var bufferinfos: Tuos_BufferInfos; SampleRate: CDouble; SampleFormat + : cint32; Channels: cint32 ; Length: cint32); +inline; +// to initialize a custom bufferinfos: needed for AddFromMemoryBuffer() if no bufferinfos was created. +// all infos refer to the buffer used ---> length = length of the buffer div channels. + +function uos_TestLoadLibrary(Filename: Pchar): boolean; inline; +// test a library to check if it can be loaded; + + +const + // error + noError = 0; + FilePAError = 10; + LoadPAError = 11; + FileSFError = 20; + LoadSFError = 21; + FileMPError = 30; + LoadMPError = 31; + LoadOPError = 41; + FileOPError = 50; + // uos Audio + Stereo = 2; + Mono = 1; + + {$IF DEFINED(android)} + DefRate = 48000; + {$else} + DefRate = 44100; + {$endif} + + // Write wav file + ReadError = 1; + HeaderError = 2; + DataError = 3; + FileCorrupt = 4; + IncorectFileFormat = 5; + HeaderWriteError = 6; + StreamError = 7; + // FFT Filters + fBandAll = 0; + fBandSelect = 1; + fBandReject = 2; + fBandPass = 3; + fLowPass = 4; + fHighPass = 5; + + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + MSG_CUSTOM1 = FPGM_USER + 1; + {$endif} + +var + theinc : integer = 0; + theincbpm : integer = 0; + tempload : boolean = false; + paversion : UTF8String = ''; + sfversion : UTF8String = ''; + mpversion : UTF8String = ''; + tempSamplerate : CDouble; + tempSampleFormat, tempchan, tempratio, tempLibOpen, tempLength : cint32; + tempoutmemory: TDArFloat; + uosPlayers: array of Tuos_Player; + uosPlayersStat : array of cint32; + uosLevelArray : TDArIARFloat ; + uosDeviceInfos: array of Tuos_DeviceInfos; + uosLoadResult: Tuos_LoadResult; + uosDeviceCount: cint32 = 0; + uosDefaultDeviceIn: cint32 = -1; + uosDefaultDeviceOut: cint32 = -1; + uosInit: Tuos_Init = nil; + uosisactif : boolean = true; + + {$IF DEFINED(windows)} + old8087cw: word; + {$endif} + + {$IF DEFINED(Java)} + theclass : JClass; + {$endif} + +implementation + +function uos_TestLoadLibrary(Filename: Pchar): boolean; +// test a library to check if it can be loaded; +var +test_Handle: TLibHandle = NilHandle; +begin + result := false; + test_Handle := DynLibs.SafeLoadLibrary(Filename); + if test_Handle <> DynLibs.NilHandle then + begin + DynLibs.UnloadLibrary(test_Handle); + test_Handle := DynLibs.NilHandle; + result := true; + end; +end; + +procedure TDummyThread.Execute; +begin + FreeOnTerminate := True; + Terminate; +end; + +function RoundMath(aV:double): int64; +overload; +begin + if aV>=0 then + result := Trunc(aV+0.5) + else + result := Trunc(aV-0.5); +end; + +function RoundMath(aV:single): int64; +overload; +begin + if aV>=0 then + result := Trunc(aV+0.5) + else + result := Trunc(aV-0.5); +end; + +function FormatBuf(Inbuf: TDArFloat; format: cint32): TDArFloat; +inline; +var + x: cint32; + ps: PDArShort; + // if input is Int16 format + pl: PDArLong; + // if input is Int32 format + pf: PDArFloat; + // if input is Float32 format +begin + + case format of + 2: + begin + ps := @inbuf; + for x := 0 to high(inbuf) do + ps^[x] := cint16(trunc(ps^[x])); + end; + 1: + begin + pl := @inbuf; + for x := 0 to high(inbuf) do + pl^[x] := cint32(trunc(pl^[x])); + end; + 0: + begin + pf := @inbuf; + for x := 0 to high(inbuf) do + pf^[x] := cfloat(pf^[x]); + end; + end; + Result := Inbuf; +end; + +function CvFloat32ToInt16(Inbuf: TDArFloat): TDArShort; +inline; +var + x, i: cint32; + arsh: TDArShort; +begin + SetLength(arsh, length(inbuf)); + for x := 0 to high(Inbuf) do + begin + i := trunc(Inbuf[x] * 32768); + if i > 32767 then + i := 32767 + else + if i < -32768 then + i := -32768; + arsh[x] := i; + end; + Result := arsh; +end; + +function CvFloat32ToInt32(Inbuf: TDArFloat): TDArLong; +inline; +var + i: int64; + x : cint32; + arlo: TDArLong; +begin + SetLength(arlo, length(inbuf)); + for x := 0 to high(Inbuf) do + begin + i := trunc(Inbuf[x] * 2147483647); + if i > 2147483647 then + i := 2147483647 + else + if i < -2147483648 then + i := -2147483648; + arlo[x] := i; + end; + Result := arlo; +end; + +function CvFloat32ToInt32fl(Inbuf: TDArFloat; nb:integer): TDArFloat; +inline; +var + x : cint32; + pl2: PDArLong; + // if input is Int32 format + pf: PDArfloat; + buffer2 : TDArFloat; + +begin + pf := @Inbuf; + pl2 := @Buffer2; + + setlength(buffer2,nb); + + for x := 0 to nb -1 do + begin + pl2^[x] := trunc((pf^[x]) * 2147483647); + end; + Result := buffer2; +end; + +function CvInt16ToFloat32(Inbuf: TDArFloat): TDArFloat; +inline; +var + x: cint32; + arfl: TDArFloat; + ps: PDArShort; +begin + setlength(arfl,length(Inbuf)); + ps := @inbuf; + for x := 0 to high(Inbuf) do + arfl[x] := ps^[x] / 32768; + Result := arfl; +end; + +function CvSteroToMono(Inbuf: TDArFloat; len : cint32): TDArFloat; +inline; +var + x, y: cint32; + arsh: TDArFloat; +begin + + if len > 0 then + begin + setlength(arsh, len); + + x := 0; + y := 0; + + while x < (len * 2)-1 do + begin + + + // TODO -> this takes only chan1, not (chan1+chan2)/2 -> it get bad noise dont know why ???... + // arsh[y] := trunc((Inbuf[x] + Inbuf[x+1])/ 2) ; + + arsh[y] := Inbuf[x+1] ; + + inc(y); + x := x + 2 ; + end; + + Result := arsh; + end + else Result := Inbuf; +end; + +function CvInt32ToFloat32(Inbuf: TDArFloat): TDArFloat; +inline; +var + x: cint32; + arfl: TDArFloat; + pl: PDArLong; +begin + setlength(arfl,length(Inbuf)); + pl := @inbuf; + for x := 0 to high(Inbuf) do + arfl[x] := pl^[x] / 2147483647; + Result := arfl; +end; + +// convert a Tmemory stream into a wav file. +procedure uos_MemStream2Wavfile(FileName: UTF8String; Data: TMemoryStream; BitsPerSample, chan: + integer; + samplerate : CDouble); +var + f: TFileStream; + wFileSize: LongInt; + wChunkSize: LongInt; + ID: array[0..3] of char; + Header: Tuos_WaveHeaderChunk; +begin + f := Nil; + f := TFileStream.Create(FileName, fmCreate); + f.Seek(0, soFromBeginning); + try + ID := 'RIFF'; + f.WriteBuffer(ID, 4); + wFileSize := 0; + f.WriteBuffer(wFileSize, 4); + ID := 'WAVE'; + f.WriteBuffer(ID, 4); + ID := 'fmt '; + f.WriteBuffer(ID, 4); + wChunkSize := SizeOf(Header); + f.WriteBuffer(wChunkSize, 4); + Header.wFormatTag := 1; + + Header.wChannels := chan; + + Header.wSamplesPerSec := roundmath(samplerate); + + Header.wBitsPerSample := BitsPerSample; + + Header.wBlockAlign := chan * (BitsPerSample Div 8); + + Header.wAvgBytesPerSec := roundmath(samplerate) * Header.wBlockAlign; + + Header.wcbSize := 0; + f.WriteBuffer(Header, SizeOf(Header)); + except + +end; +try + ID := 'data'; + f.WriteBuffer(ID, 4); + wChunkSize := Data.Size; + f.WriteBuffer(wChunkSize, 4); +except +end; + +Data.Seek(0, soFromBeginning); +f.CopyFrom(Data, Data.Size); +f.Seek(SizeOf(ID), soFromBeginning); +wFileSize := f.Size - SizeOf(ID) - SizeOf(wFileSize); +f.write(wFileSize, 4); +f.Free; +end; + +function WriteWaveFromMem(FileName: UTF8String; Data: Tuos_FileBuffer): word; +var + f: TFileStream; + wFileSize: LongInt; + wChunkSize: LongInt; + ID: array[0..3] of char; + Header: Tuos_WaveHeaderChunk; +begin + Result := noError; + f := Nil; + f := TFileStream.Create(FileName, fmCreate); + f.Seek(0, soFromBeginning); + if Data.FileFormat = 0 then + begin + // wav file + try + ID := 'RIFF'; + f.WriteBuffer(ID, 4); + wFileSize := 0; + f.WriteBuffer(wFileSize, 4); + ID := 'WAVE'; + f.WriteBuffer(ID, 4); + ID := 'fmt '; + f.WriteBuffer(ID, 4); + wChunkSize := SizeOf(Header); + f.WriteBuffer(wChunkSize, 4); + Header.wFormatTag := 1; + + Header.wChannels := Data.wChannels; + + Header.wSamplesPerSec := Data.wSamplesPerSec; + + Header.wBlockAlign := Data.wChannels * (Data.wBitsPerSample Div 8); + + Header.wAvgBytesPerSec := Data.wSamplesPerSec * Header.wBlockAlign; + Header.wBitsPerSample := Data.wBitsPerSample; + Header.wcbSize := 0; + f.WriteBuffer(Header, SizeOf(Header)); + except + Result := HeaderWriteError; + end; + try + ID := 'data'; + f.WriteBuffer(ID, 4); + wChunkSize := Data.DataMS.Size; + f.WriteBuffer(wChunkSize, 4); + except + Result := StreamError; +end; + +end; + +Data.DataMS.Seek(0, soFromBeginning); +f.CopyFrom(Data.DataMS, Data.DataMS.Size); +f.Seek(SizeOf(ID), soFromBeginning); +wFileSize := f.Size - SizeOf(ID) - SizeOf(wFileSize); +f.write(wFileSize, 4); +f.Free; +end; + + +procedure WriteWave(FileName: UTF8String; Data: Tuos_FileBuffer); +var + wFileSize: cint32; + ID: array[0..3] of char; +begin + Data.data.Position := 42; + //(after 'data') + Data.data.write(Data.data.Size, 4); + ID := 'RIFF'; + Data.data.Seek(SizeOf(ID), soFromBeginning); + wFileSize := Data.data.Size - SizeOf(ID) - SizeOf(wFileSize); + Data.data.write(wFileSize, 4); + Data.data.Free; +end; + +{$IF DEFINED(sndfile) or DEFINED(mpg123)} +function mpg_read_stream(ahandle: Pointer; AData: Pointer; ACount: Integer): Integer; +inline; +cdecl; +var + Stream: TStream absolute ahandle; +begin + Result := Stream.Read(AData^, ACount); +end; + +function mpg_seek_stream(ahandle: Pointer; offset: Integer; + whence: Integer): Integer; +cdecl; +var + Stream: TStream absolute ahandle; +begin + try + case whence of + SEEK_SET : Result := Stream.Seek(offset, soFromBeginning); + SEEK_CUR : Result := Stream.Seek(offset, soFromCurrent); + SEEK_END : Result := Stream.Seek(offset, soFromEnd); + else + Result := 0; + end; + except + Result := 0; +end; +end; + +procedure mpg_close_stream(ahandle: Pointer); +// not used, uos does it... +begin + TObject(ahandle).Free; +end; +{$endif} + +{$IF DEFINED(webstream)} +// should use this for pipes vs memorystream ? +function mpg_seek_url(ahandle: Pointer; aoffset: Integer): Integer; +cdecl; +var + Stream: TStream absolute ahandle; +begin + // pipe streams are not seekable but memory and filestreams are + Result := 0; + try + if aoffset > 0 then + Result := Stream.Seek(aoffset, soFromCurrent); + except + Result := 0; +end; +end; +{$endif} + +function Filetobuffer(Filename: Pchar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32; Var outmemory: TDArFloat; + Var bufferinfos: Tuos_BufferInfos; frompos: cint; numbuf : cint ): TDArFloat; +// Add a input from audio file with custom parameters +// FileName : filename of audio file + +// 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) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer +// frompos : from position (default : -1 = from begining, otherwise position in song) + +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) +// result : Input Index in array -1 = error +// example : InputIndex1 := Filetobuffer(edit5.Text,-1,0,-1, buffmem, buffinfos, -1); +var + theplayer : Tuos_Player; + in1 : cint32; +begin + theplayer := Tuos_Player.Create(); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('begin Filetobuffer'); + {$endif} + + In1 := theplayer.AddFromFile( pchar(Filename), OutputIndex, SampleFormat, FramesCount) ; + if in1 > -1 then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('in1 = ' + inttostr(in1)); + writeln('theplayer.InputLength(In1) = ' + inttostr(theplayer.InputLength(In1))); + {$endif} + + SetLength(outmemory, 0); + + tempchan := theplayer.StreamIn[in1].Data.Channels; + tempratio := theplayer.StreamIn[in1].Data.ratio; + tempSampleFormat := theplayer.StreamIn[in1].Data.SampleFormat; + tempSamplerate := theplayer.StreamIn[in1].Data.Samplerate; + templength := theplayer.StreamIn[in1].Data.Length; + + bufferinfos.SampleRate := theplayer.StreamIn[in1].Data.Samplerate; + bufferinfos.SampleRateRoot := theplayer.StreamIn[in1].Data.Samplerate; + bufferinfos.SampleFormat := theplayer.StreamIn[in1].Data.SampleFormat; + bufferinfos.Channels := theplayer.StreamIn[in1].Data.Channels; + bufferinfos.Filename := theplayer.StreamIn[in1].Data.Filename; + bufferinfos.Title := theplayer.StreamIn[in1].Data.Title; + bufferinfos.Copyright := theplayer.StreamIn[in1].Data.Copyright; + bufferinfos.Software := theplayer.StreamIn[in1].Data.Software; + bufferinfos.Artist := theplayer.StreamIn[in1].Data.Artist; + bufferinfos.Comment := theplayer.StreamIn[in1].Data.Comment; + bufferinfos.Date := theplayer.StreamIn[in1].Data.Date; + bufferinfos.Tag := theplayer.StreamIn[in1].Data.Tag; + bufferinfos.Album := theplayer.StreamIn[in1].Data.Album; + bufferinfos.Genre := theplayer.StreamIn[in1].Data.Genre; + bufferinfos.Track := theplayer.StreamIn[in1].Data.Track; + bufferinfos.HDFormat := theplayer.StreamIn[in1].Data.HDFormat; + bufferinfos.Sections := theplayer.StreamIn[in1].Data.Sections; + bufferinfos.Encoding := theplayer.StreamIn[in1].Data.Encoding; + bufferinfos.bitrate := theplayer.StreamIn[in1].Data.bitrate; + bufferinfos.Length := theplayer.StreamIn[in1].Data.Length; + bufferinfos.LibOpen := 0; + bufferinfos.Ratio := 2 ; + + theplayer.StreamIn[in1].Data.numbuf := numbuf; + + theplayer.AddIntoMemoryBuffer( @outmemory ); + theplayer.Play(0); + + if frompos > 0 then theplayer.inputseek(in1,frompos); + + while (theplayer.getstatus > 0) do + sleep(100); + + end; + + {$IF DEFINED(mse)} + theplayer.destroy; + {$endif} + result := outmemory; +end; + + {$IF DEFINED(soundtouch)} +function uos_GetBPM(TheBuffer: TDArFloat; Channels: cint32; SampleRate: CDouble) : CDouble; +inline; +// From SoundTouch plugin +var + BPMhandle : THandle; + sr, ch : cint32; +begin + + if SampleRate = -1 then sr := 44100 + else sr := roundmath(SampleRate); + if Channels = -1 then ch := 2 + else ch := Channels; + + BPMhandle := bpm_createInstance(ch,sr); + bpm_putSamples(BPMhandle, pcfloat(thebuffer), length(thebuffer) div Channels); + + result := bpm_getBpm(BPMhandle); + + bpm_destroyInstance(BPMhandle); + +end; + {$endif} + +function uos_File2Buffer(Filename: Pchar; SampleFormat: cint32 ; Var bufferinfos: Tuos_BufferInfos ; + frompos : cint; numbuf : cint ): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) + +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max of frames) +// result : The memory buffer +// example : buffmem := uos_File2buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + {$IF DEFINED(uos_debug) and DEFINED(unix)} +var + i : integer; + st : string; + {$endif} +begin + + result := Filetobuffer(Filename,-1, SampleFormat, 1024, result, bufferinfos, frompos, numbuf); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('After Filetobuffer'); + writeln('length(result) =' +inttostr(length(result))); + st := ''; + for i := 0 to length(result) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(result[i]); + WriteLn('OUTPUT DATA into portaudio------------------------------'); + WriteLn(st); + {$endif} + +end; + +function Streamtobuffer(AudioFile:TMemoryStream; OutputIndex: cint32;SampleFormat: cint32 ; + FramesCount: cint32; + Var outmemory: TDArFloat; Var bufferinfos: Tuos_BufferInfos; frompos: cint; + numbuf : cint): TDArFloat; +// Add a input from audio file with custom parameters +// FileName : filename of audio file + +// 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) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer +// frompos : from position (default : -1 = from begining, otherwise position in song) + +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) +// result : Input Index in array -1 = error +// example : InputIndex1 := streamtobuffer(edit5.Text,-1,0,-1, buffmem, buffinfos, -1); + +var + theplayer : Tuos_Player; + in1 : cint32; + +begin + theplayer := Tuos_Player.Create(); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('begin Filetobuffer'); + {$endif} + + //In1 := theplayer.AddFromFile( pchar(Filename), OutputIndex, SampleFormat, FramesCount) ; + In1 := theplayer.AddFromMemoryStream( AudioFile,-1, OutputIndex, SampleFormat, FramesCount) ; + + if in1 > -1 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('in1 = ' + inttostr(in1)); + writeln('theplayer.InputLength(In1) = ' + inttostr(theplayer.InputLength(In1))); + {$endif} + + SetLength(outmemory, 0); + + tempchan := theplayer.StreamIn[in1].Data.Channels; + tempratio := theplayer.StreamIn[in1].Data.ratio; + tempSampleFormat := theplayer.StreamIn[in1].Data.SampleFormat; + tempSamplerate := theplayer.StreamIn[in1].Data.Samplerate; + templength := theplayer.StreamIn[in1].Data.Length; + + bufferinfos.SampleRate := theplayer.StreamIn[in1].Data.Samplerate; + bufferinfos.SampleRateRoot := theplayer.StreamIn[in1].Data.Samplerate; + bufferinfos.SampleFormat := theplayer.StreamIn[in1].Data.SampleFormat; + bufferinfos.Channels := theplayer.StreamIn[in1].Data.Channels; + bufferinfos.Filename := theplayer.StreamIn[in1].Data.Filename; + bufferinfos.Title := theplayer.StreamIn[in1].Data.Title; + bufferinfos.Copyright := theplayer.StreamIn[in1].Data.Copyright; + bufferinfos.Software := theplayer.StreamIn[in1].Data.Software; + bufferinfos.Artist := theplayer.StreamIn[in1].Data.Artist; + bufferinfos.Comment := theplayer.StreamIn[in1].Data.Comment; + bufferinfos.Date := theplayer.StreamIn[in1].Data.Date; + bufferinfos.Tag := theplayer.StreamIn[in1].Data.Tag; + bufferinfos.Album := theplayer.StreamIn[in1].Data.Album; + bufferinfos.Track := theplayer.StreamIn[in1].Data.Track; + bufferinfos.Genre := theplayer.StreamIn[in1].Data.Genre; + bufferinfos.HDFormat := theplayer.StreamIn[in1].Data.HDFormat; + bufferinfos.Sections := theplayer.StreamIn[in1].Data.Sections; + bufferinfos.Encoding := theplayer.StreamIn[in1].Data.Encoding; + bufferinfos.bitrate := theplayer.StreamIn[in1].Data.bitrate; + bufferinfos.Length := theplayer.StreamIn[in1].Data.Length; + bufferinfos.LibOpen := 0; + bufferinfos.Ratio := 2 ; + + theplayer.StreamIn[in1].Data.numbuf := numbuf; + + theplayer.AddIntoMemoryBuffer( @outmemory ); + theplayer.Play(0); + if frompos > 0 then theplayer.inputseek(in1,frompos); + + while (theplayer.getstatus > 0) do + sleep(100); + + end; + {$IF DEFINED(mse)} + theplayer.destroy; + {$endif} + result := outmemory; +end; + +function uos_Stream2Buffer(AudioFile: TMemoryStream; SampleFormat: int32 ; + Var outmemory: TDArFloat; Var bufferinfos: Tuos_BufferInfos ; frompos: + cint; numbuf : cint): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) + +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) +// result : The memory buffer +// example : buffmem := uos_File2buffer(edit5.Text,0,buffmem, buffinfos, -1); +begin + result := Streamtobuffer(AudioFile,-1, SampleFormat, -1, outmemory, bufferinfos, frompos, numbuf); +end; + +procedure uos_File2File(FilenameIN: Pchar; FilenameOUT: Pchar; SampleFormat: cint32 ; typeout: + cint32 ); +// Create a audio file from a audio file. +// FileNameIN : filename of audio file IN (ogg, flac, wav, mp3, opus, aac,...) +// FileNameOUT : filename of audio file OUT (wav, pcm, custom) +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) + +// typeout : Type of out file (-1:default=wav, 0:wav, 1:pcm, 2:custom)// example : InputIndex1 := uos_File2File(edit5.Text,0,buffmem); +var + theplayer : Tuos_Player; + in1 : cint32; +begin + + theplayer := Tuos_Player.Create(); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('begin File2file'); + {$endif} + In1 := theplayer.AddFromFile( pchar(FilenameIN), -1, SampleFormat, -1) ; + if in1 > -1 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('in1 = ' + inttostr(in1)); + writeln('theplayer.InputLength(In1) = ' + inttostr(theplayer.InputLength(In1))); + {$endif} + + theplayer.AddIntoFile(FilenameOUT, theplayer.StreamIn[0].data.samplerate, + theplayer.StreamIn[0].data.channels, SampleFormat, -1 , typeout); + + theplayer.Play(0); + + while (theplayer.getstatus > 0) do + sleep(100); + end; + {$IF DEFINED(mse)} + theplayer.destroy; + {$endif} +end; + + {$IF DEFINED(mse)} + {$else} + +constructor TuosThread.Create(CreateSuspended: boolean; AParent: TObject; + Const StackSize: SizeUInt); +begin + theparent := AParent; + FreeOnTerminate := true; + inherited Create(CreateSuspended, StackSize); + Priority := tpTimeCritical; +end; + {$endif} + +function Tuos_Player.GetStatus() : cint32 ; + + +// Get the status of the player : -1 => error or not yet played, 0 => has stopped, 1 => is running, 2 => is paused. +begin + result := -1 ; + if (isAssigned = True) then result := Status + else result := -1 ; +end; + +function Tuos_Player.IsLooped: Boolean; +inline; +begin + Result := (NLooped <> 0) And + (NLooped <> 1); +end; + +procedure Tuos_Player.PlayEx(no_free: Boolean; nloop: Integer; paused: boolean= false); +var + x: cint32; +begin + if (isAssigned = True) and (not IsLooped) then + begin + NLooped := nloop; + NoFree := no_free; + + {$IF DEFINED(portaudio)} + for x := 0 to high(StreamOut) do + if StreamOut[x].Data.HandleSt <> nil then + Pa_StartStream(StreamOut[x].Data.HandleSt); + {$endif} + + for x := 0 to high(StreamIn) do + begin + {$IF DEFINED(portaudio)} + if (StreamIn[x].Data.HandleSt <> nil) and (StreamIn[x].Data.TypePut = 1) then + Pa_StartStream(StreamIn[x].Data.HandleSt); + {$endif} + + if (no_free = true) and (StreamIn[x].Data.HandleSt <> nil) + and (StreamIn[x].Data.TypePut = 4) then + StreamIn[x].Data.posmem := 0; + + if (no_free = true) and (StreamIn[x].Data.HandleSt <> nil) + and ((StreamIn[x].Data.TypePut = 0) or (StreamIn[x].Data.TypePut = 4)) then + InputSeek(x, 0); + + StreamIn[x].Data.status := 1 ; + + end; + + Status := 1; + + if isGlobalPause = true then + RTLeventSetEvent(uosInit.evGlobalPause) + else + RTLeventSetEvent(evPause); + + if paused = true then + begin + if isGlobalPause = true then + RTLeventReSetEvent(uosInit.evGlobalPause) + else + RTLeventResetEvent(evPause); + end; + + //protect from multiple instances of thread + if thethread = nil then + begin + {$IF DEFINED(mse)} + thethread := tmsethread.create(@execute); + {$else} + thethread := tuosthread.Create(false,self); + {$endif} + end; + end; +end; + +procedure Tuos_Player.PlayPaused(nloop: Integer = 0) ; +inline; +// Start play paused with loop +begin + PlayEx(False,nloop,true); +end; + +procedure Tuos_Player.PlayNoFreePaused(nloop: Integer = 0) ; +inline; +// Start play paused with loop and not free player at end +begin + PlayEx(true,nloop,true); +end; + +procedure Tuos_Player.Play(nloop: Integer = 0) ; +inline; +begin + PlayEx(False,nloop); +end; + +procedure Tuos_Player.PlayNoFree(nloop: Integer = 0) ; +inline; +begin + PlayEx(True,nloop); +end; + +procedure Tuos_Player.FreePlayer(); +// Works only when PlayNoFree() was used: free the player +begin + if isAssigned then + begin + NLooped := 0; + NoFree := False; + //if it has never been put into play (= there is no thread for free).. + if thethread = nil then + Play(); + Stop; + end; +end; + +procedure Tuos_Player.RePlay(); +// Resume Playing after Pause +begin + if (Status > 0) and (isAssigned = True) and + (not IsLooped) then + begin + Status := 1; + if isGlobalPause = true then + RTLeventSetEvent(uosInit.evGlobalPause) + else + RTLeventSetEvent(evPause); + end; +end; + +procedure Tuos_Player.Stop(); +begin + //writeln(inttostr(Status)); + if (Status <> 0) and (isAssigned = True) then + begin + if status < 0 then playpaused; + NLooped := 0; + if isGlobalPause = true then + RTLeventSetEvent(uosInit.evGlobalPause) + else + RTLeventSetEvent(evPause); + Status := 0; + end; +end; + +procedure Tuos_Player.Pause(); +begin + if (Status > 0) and (isAssigned = True) then + begin + if isGlobalPause = true then + RTLeventReSetEvent(uosInit.evGlobalPause) + else + RTLeventResetEvent(evPause); + Status := 2; + end; +end; + +procedure Tuos_Player.InputSeek(InputIndex:cint32; pos: Tcount_t); +// change position in samples +begin + if (isAssigned = True) then StreamIn[InputIndex].Data.Poseek := pos; +end; + +procedure Tuos_Player.InputSeekSeconds(InputIndex: cint32; pos: cfloat); +// change position in seconds +begin + if (isAssigned = True) then StreamIn[InputIndex].Data.Poseek := + trunc(pos * StreamIn[InputIndex] + .Data.SampleRate); +end; + +procedure Tuos_Player.InputSeekTime(InputIndex: cint32; pos: TTime); +// change position in time format +var + ho, mi, se, ms: word; + possample : cint32; +begin + if (isAssigned = True) then + begin + sysutils.DecodeTime(pos, ho, mi, se, ms); + + possample := trunc(((ho * 3600) + (mi * 60) + se + (ms / 1000)) * + StreamIn[InputIndex].Data.SampleRate); + + StreamIn[InputIndex].Data.Poseek := possample; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('TTime: '+ timetostr(pos)); + WriteLn('SeekTime() : Data.Poseek: '+ inttostr(possample)); + {$endif} + end; +end; + +procedure Tuos_Player.InputSetEnable(InputIndex: cint32; enabled: boolean); +// set enable true or false +begin + StreamIn[InputIndex].data.Enabled := enabled; +end; + +function Tuos_Player.InputLength(InputIndex: cint32): cint32; +// gives length in samples +begin + result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.Length; +end; + +function Tuos_Player.InputLengthSeconds(InputIndex: cint32): cfloat; +begin + result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.Length / StreamIn[InputIndex]. + Data.SampleRate; +end; + +function Tuos_Player.InputLengthTime(InputIndex: cint32): TTime; +var + tmp: cfloat; + h, m, s, ms: word; +begin + Result := sysutils.EncodeTime(0, 0, 0, 0); + if (isAssigned = True) then tmp := InputLengthSeconds(InputIndex); + ms := trunc(frac(tmp) * 1000); + h := trunc(tmp / 3600); + m := trunc(tmp / 60 - h * 60); + s := trunc(tmp - (h * 3600 + m * 60)); + Result := sysutils.EncodeTime(h, m, s, ms); +end; + +function Tuos_Player.InputPosition(InputIndex: cint32): cint32; +// gives current position +begin + Result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.Position; +end; + +procedure Tuos_Player.InputSetFrameCount(InputIndex: cint32 ; framecount : cint32); +begin + if (isAssigned = True) then + + case StreamIn[InputIndex].Data.LibOpen of + 0: + StreamIn[InputIndex].Data.Wantframes := (framecount * StreamIn[InputIndex].Data.Channels) ; + + 1: + StreamIn[InputIndex].Data.Wantframes := (framecount * StreamIn[InputIndex].Data.Channels) + * 2 ; + + 2: + StreamIn[InputIndex].Data.Wantframes := (framecount * StreamIn[InputIndex].Data.Channels) ; + + 3: + StreamIn[InputIndex].Data.Wantframes := (framecount * StreamIn[InputIndex].Data.Channels) ; + + 4: + StreamIn[InputIndex].Data.Wantframes := (framecount * StreamIn[InputIndex].Data.Channels) ; + + end; +end; + +procedure Tuos_Player.InputSetLevelArrayEnable(InputIndex: cint32 ; levelcalc : cint32); +// set add level calculation in level-array (default is 0) +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. +begin + if (isAssigned = True) then + begin + if index + 1 > length(uosLevelArray) then + setlength(uosLevelArray,index + 1) ; + if InputIndex + 1 > length(uosLevelArray[index]) then + setlength(uosLevelArray[index],InputIndex + 1) ; + setlength(uosLevelArray[index][InputIndex],0) ; + StreamIn[InputIndex].Data.levelArrayEnable := levelcalc; + end; +end; + +procedure Tuos_Player.InputSetLevelEnable(InputIndex: cint32 ; levelcalc : cint32); +// set level calculation (default is 0) +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. +// 3 => calcul before and after all DSP procedures. + +begin + if (isAssigned = True) then + StreamIn[InputIndex].Data.levelEnable := levelcalc; +end; + +procedure Tuos_Player.InputSetPositionEnable(InputIndex: cint32 ; poscalc : cint32); +// set position calculation (default is 0) +// 0 => no calcul +// 1 => calcul position procedures. +begin + if (isAssigned = True) then + StreamIn[InputIndex].Data.PositionEnable := poscalc; +end; + +function Tuos_Player.InputGetLevelLeft(InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : left level(volume) from 0 to 1 +begin + Result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.LevelLeft; +end; + +function Tuos_Player.InputGetLevelRight(InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : right level(volume) from 0 to 1 +begin + Result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.LevelRight; +end; + +function Tuos_Player.InputFiltersGetLevelString(InputIndex: cint32): string; +// InputIndex : InputIndex of existing input +// result : list of left|right levels separed by $ character +begin + Result := ''; + if (isAssigned = True) then Result := StreamIn[InputIndex].data.Levelfilters; +end; + +function Tuos_Player.InputFiltersGetLevelArray(InputIndex: cint32): TDArFloat; +// InputIndex : InputIndex of existing input +// result : array of float of each filter. +//in format levelfilter0left,levelfilter0right,levelfilter1left,levelfilter2right,... +begin + if (isAssigned = True) then Result := StreamIn[InputIndex].data.Levelfiltersar; +end; + +{$IF DEFINED(soundtouch)} +function Tuos_Player.InputGetBPM(InputIndex: cint32): CDouble; +// InputIndex : InputIndex of existing input +// result : Beat per minuts +begin + Result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.BPM; +end; +{$endif} + +function Tuos_Player.InputPositionSeconds(InputIndex: cint32): float; +begin + Result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.Position / StreamIn[InputIndex]. + Data.SampleRate; +end; + +function Tuos_Player.InputPositionTime(InputIndex: cint32): TTime; +var + tmp: float = 0.0; + h: word = 0; + m: word = 0; + s: word = 0; + ms: word = 0; + +begin + Result := sysutils.EncodeTime(0, 0, 0, 0); + if (isAssigned = True) then + begin + tmp := InputPositionSeconds(InputIndex); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('InputPositionTime(): InputPositionSeconds: '+ floattostr(tmp)); + {$endif} + ms := trunc(frac(tmp) * 1000); + h := trunc(tmp / 3600); + m := trunc(tmp / 60 - h * 60); + s := trunc(tmp - (h * 3600 + m * 60)); + Result := sysutils.EncodeTime(h, m, s, ms); + end; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('EncodeTime(): '+ timetostr(Result)); + {$endif} +end; + +// for mp3 and opus files only +function Tuos_Player.InputUpdateTag(InputIndex: cint32): boolean; + +{$IF DEFINED(mpg123) or DEFINED(opus) } +var + {$endif} + + {$IF DEFINED(mpg123)} + // problems with mpg123 + // mpinfo: Tmpg123_frameinfo; + // mpid3v2: Tmpg123_id3v2; + BufferTag: array[1..128] of char; + F: file; + {$endif} + + {$IF DEFINED(opus)} + s: UTF8String; + j: Integer; + OpusTag: POpusTags; + LComment: PPAnsiChar; + LcommentLength: PInteger; + {$endif} + +begin + + Result := false; + if (isAssigned = True) then + begin + {$IF DEFINED(mpg123)} + if StreamIn[InputIndex].Data.LibOpen = 1 then// mp3 + begin + //mpg123_info(StreamIn[InputIndex].Data.HandleSt, MPinfo); + // custom code for reading ID3Tag ---> problems with mpg123_id3() + + AssignFile(F, StreamIn[InputIndex].Data.Filename); + FileMode := fmOpenRead + fmShareDenyNone; + Reset(F, 1); + Seek(F, FileSize(F) - 128); + BlockRead(F, BufferTag, SizeOf(BufferTag)); + CloseFile(F); + + StreamIn[InputIndex].Data.tag := copy(BufferTag, 1, 3); + StreamIn[InputIndex].Data.title := copy(BufferTag, 4, 30); + StreamIn[InputIndex].Data.artist := copy(BufferTag, 34, 30); + StreamIn[InputIndex].Data.album := copy(BufferTag, 64, 30); + StreamIn[InputIndex].Data.date := copy(BufferTag, 94, 4); + StreamIn[InputIndex].Data.comment := copy(BufferTag, 98, 29); + StreamIn[InputIndex].Data.track := inttostr(ord(BufferTag[127])); + StreamIn[InputIndex].Data.genre := inttostr(ord(BufferTag[128])); + + Result := true; + // ? freeandnil(MPinfo); + end; +{$endif} + +{$IF DEFINED(opus)} + if StreamIn[InputIndex].Data.LibOpen = 4 then// opus + begin + OpusTag := op_tags(StreamIn[InputIndex].Data.HandleOP, Nil); + + if OpusTag<>nil + + then + begin + + if OpusTag^.comments>0 + then + begin + + LComment := OpusTag^.user_comments; + LcommentLength := OpusTag^.comment_lengths; + for j := 0 to OpusTag^.comments - 1 do + begin + SetLength(s, LcommentLength^); + move(Pointer(LComment^)^, Pointer(s)^, LcommentLength^); + + if j = 1 then StreamIn[InputIndex].Data.title := s; + if j = 2 then StreamIn[InputIndex].Data.artist := s; + if j = 3 then StreamIn[InputIndex].Data.album := s; + if j = 4 then StreamIn[InputIndex].Data.date := s; + if j = 5 then StreamIn[InputIndex].Data.comment := s; + if j = 6 then StreamIn[InputIndex].Data.tag := s; + + inc(LComment); + inc(LcommentLength); + end; + result := true; + end; + end; + end; + {$endif} + end; +end; + +{$IF DEFINED(webstream)} +// for mp3 files only +function Tuos_Player.InputUpdateICY(InputIndex: cint32; Var icy_data : pchar): integer; +begin + Result := -1; + if (isAssigned = True) then + begin + if StreamIn[InputIndex].Data.LibOpen = 1 then// mp3 + if assigned(StreamIn[InputIndex].httpget) then + if StreamIn[InputIndex].httpget.ICYenabled = true then + begin + {$IF DEFINED(mpg123)} + Result := mpg123_icy(StreamIn[InputIndex].Data.HandleSt, icy_data); + {$endif} + end; + end; +end; +{$ENDIF} + +function Tuos_Player.InputGetTagTitle(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.title); +end; + +function Tuos_Player.InputGetTagArtist(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.Artist); +end; + +function Tuos_Player.InputGetTagAlbum(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.album); +end; + +function Tuos_Player.InputGetTagComment(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.comment); +end; + +function Tuos_Player.InputGetTagTrack(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.track); +end; + +function Tuos_Player.InputGetTagGenre(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.genre); +end; + +function Tuos_Player.InputGetTagTag(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.tag); +end; + +function Tuos_Player.InputGetTagDate(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.date); +end; + +procedure Tuos_Player.InputSetDSP(InputIndex: cint32; DSPinIndex: cint32; + Enable: boolean); +begin + StreamIn[InputIndex].DSP[DSPinIndex].Enabled := Enable; +end; + +procedure Tuos_Player.OutputSetDSP(OutputIndex: cint32; DSPoutIndex: cint32; + Enable: boolean); +begin + StreamOut[OutputIndex].DSP[DSPoutIndex].Enabled := Enable; +end; + +function Tuos_Player.InputAddDSP(InputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; LoopProc: TProc ): cint32; +begin + SetLength(StreamIn[InputIndex].DSP, Length(StreamIn[InputIndex].DSP) + 1); + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1] := Tuos_DSP.Create(); + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].Enabled := false; + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].BefFunc := BeforeFunc; + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].AftFunc := AfterFunc; + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].EndFunc := EndedFunc; + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].LoopProc := LoopProc; + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].Enabled := True; + + Result := Length(StreamIn[InputIndex].DSP) - 1; +end; + +procedure Tuos_Player.OutputSetEnable(OutputIndex: cint32; enabled: boolean); +// set enable true or false +begin + StreamOut[OutputIndex].data.Enabled := enabled; +end; + +function Tuos_Player.OutputAddDSP(OutputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; LoopProc: TProc): cint32; +begin + SetLength(StreamOut[OutputIndex].DSP, Length(StreamOut[OutputIndex].DSP) + 1); + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1] := + Tuos_DSP.Create; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].Enabled := false; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].BefFunc := + BeforeFunc; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].AftFunc := + AfterFunc; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].EndFunc := + EndedFunc; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].LoopProc := + LoopProc; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].Enabled := True; + Result := Length(StreamOut[OutputIndex].DSP) - 1; +end; + +procedure Tuos_Player.InputSetFilter(InputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: + cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: + cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// 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 +// 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 + +begin + if isAssigned = true then + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.AlsoBuf := AlsoBuf; + StreamIn[InputIndex].DSP[FilterIndex].Enabled := Enable; + + if LowFrequencyL = -1 then + LowFrequencyL := StreamIn[InputIndex].DSP[FilterIndex].fftdata.LowFrequencyL; + if LowFrequencyL = -1 then + LowFrequencyL := StreamIn[InputIndex].DSP[FilterIndex].fftdata.HighFrequencyL; + if GainL <> -1 then + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Gainl := cfloat(Gainl); + + if LowFrequencyR = -1 then + LowFrequencyR := StreamIn[InputIndex].DSP[FilterIndex].fftdata.LowFrequencyR; + if LowFrequencyR = -1 then + LowFrequencyR := StreamIn[InputIndex].DSP[FilterIndex].fftdata.HighFrequencyR; + if GainR <> -1 then + StreamIn[InputIndex].DSP[FilterIndex].fftdata.GainR := cfloat(GainR); + + if TypeFilterL <> -1 then + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.typefilterL := TypeFilterL; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C2 := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D2 := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[2] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22[1] := 0.0; + + case TypeFilterL of + 1: // DSPFFTBandSelect := DSPFFTBandReject + DSPFFTBandPass + begin + // DSPFFTBandReject + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * (HighFrequencyL - + LowFrequencyl + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamIn[InputIndex + ].DSP[FilterIndex].fftdata.C + ); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.D * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[1]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.C) + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + // DSPFFTBandPass + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C2 := + 1 / Tan(Pi * (HighFrequencyl - + LowFrequencyl + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D2 := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[0] := + 1 / (1 + StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.C2); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[2] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22[0] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C2 * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.D2 * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22[1] := + (StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C2 - 1 + ) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32[0] + ; + // + end; + + 2: // DSPFFTBandReject + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * (HighFrequencyl - + LowFrequencyl + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamIn[InputIndex + ].DSP[FilterIndex].fftdata.C + ); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.D * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[1]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.C) + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + end; + + 3: // DSPFFTBandPass + begin + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := + 1 / Tan(Pi * (HighFrequencyl - + LowFrequencyl + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamIn[InputIndex + ].DSP[FilterIndex].fftdata.C + ); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.D * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := + (StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C - 1) + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + end; + + 4: // DSPFFTLowPass + begin + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := + 1 / Tan(Pi * LowFrequencyl / + StreamIn[InputIndex].Data. + SampleRate); + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex] + .fftdata.C + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := + 2 * StreamIn[InputIndex].DSP + [FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := + 2 * (1 - StreamIn[InputIndex + ].DSP[FilterIndex].fftdata.C + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex] + .fftdata.C + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + end; + + 5: // DSPFFTHighPass + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * HighFrequencyl / + StreamIn[InputIndex].Data. + SampleRate); + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex] + .fftdata.C + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := + + -2 * StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.a3[ + 0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := + 2 * (StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C - 1) + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex] + .fftdata.C + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + end; + end; + end; + + if TypeFilterR <> -1 then + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.typefilterR := TypeFilterR; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Dr := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C2r := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D2r := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[2] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22r[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22r[1] := 0.0; + + case TypeFilterR of + 1: // DSPFFTBandSelect := DSPFFTBandReject + DSPFFTBandPass + begin + // DSPFFTBandReject + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * (HighFrequencyr - + LowFrequencyr + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + LowFrequencyr) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Dr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[1] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.Cr + ) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + // DSPFFTBandPass + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C2r := + 1 / Tan(Pi * (HighFrequencyr - + LowFrequencyr + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D2r := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + LowFrequencyr + ) shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[0] := + 1 / (1 + StreamIn[ + InputIndex].DSP[ + FilterIndex].fftdata.C2r); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[2] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32r[ + 0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22r[0] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C2r * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.D2r * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32r[ + 0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22r[1] := + (StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C2r - + 1) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32r[ + 0]; + // + end; + + 2: // DSPFFTBandReject + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * (HighFrequencyr - + LowFrequencyr + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + LowFrequencyr) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Dr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[1] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.Cr + ) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + end; + + 3: // DSPFFTBandPass + begin + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := + 1 / Tan(Pi * (HighFrequencyr- + LowFrequencyr + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + LowFrequencyr) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Dr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr - 1 + ) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + end; + + 4: // DSPFFTLowPass + begin + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := + 1 / Tan(Pi * LowFrequencyr / + StreamIn[InputIndex].Data. + SampleRate); + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + Sqrt(2) * StreamIn + [InputIndex].DSP[ + FilterIndex].fftdata.Cr + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := + 2 * StreamIn[InputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := + 2 * (1 - StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + end; + + 5: // DSPFFTHighPass + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * HighFrequencyr / + StreamIn[InputIndex].Data. + SampleRate); + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + Sqrt(2) * StreamIn + [InputIndex].DSP[ + FilterIndex].fftdata.Cr + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := + + -2 * StreamIn[InputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := + 2 * (StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.Cr + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr - 1 + ) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + end; + end; + end; + end; +end; + +procedure Tuos_Player.OutputSetFilter(OutputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: + cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: + cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// OuputIndex : InputIndex of a existing Output +// 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 +begin + if isAssigned = true then + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.AlsoBuf := AlsoBuf; + StreamOut[OutputIndex].DSP[FilterIndex].Enabled := Enable; + + if LowFrequencyL = -1 then + LowFrequencyL := StreamOut[OutputIndex].DSP[FilterIndex].fftdata.LowFrequencyL; + if LowFrequencyL = -1 then + LowFrequencyL := StreamOut[OutputIndex].DSP[FilterIndex].fftdata.HighFrequencyL; + if GainL <> -1 then + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Gainl := cfloat(Gainl); + + if LowFrequencyR = -1 then + LowFrequencyR := StreamOut[OutputIndex].DSP[FilterIndex].fftdata.LowFrequencyR; + if LowFrequencyR = -1 then + LowFrequencyR := StreamOut[OutputIndex].DSP[FilterIndex].fftdata.HighFrequencyR; + if GainR <> -1 then + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.GainR := cfloat(GainR); + + if TypeFilterL <> -1 then + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.typefilterL := TypeFilterL; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C2 := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D2 := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[2] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22[1] := 0.0; + + case TypeFilterL of + 1: // DSPFFTBandSelect := DSPFFTBandReject + DSPFFTBandPass + begin + // DSPFFTBandReject + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * (HighFrequencyL - + LowFrequencyl + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl + ) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata.D + * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[1 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - StreamOut[OutputIndex + ].DSP[FilterIndex].fftdata + .C) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + // DSPFFTBandPass + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C2 := + 1 / Tan(Pi * (HighFrequencyl + - LowFrequencyl + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D2 := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + + LowFrequencyl) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C2); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[2] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a32[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22[0] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + C2 * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + D2 * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a32[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22[1] := + (StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + C2 - 1) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a32[0]; + // + end; + + 2: // DSPFFTBandReject + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * (HighFrequencyl - + LowFrequencyl + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl + ) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata.D + * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[1 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - StreamOut[OutputIndex + ].DSP[FilterIndex].fftdata + .C) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + end; + + 3: // DSPFFTBandPass + begin + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := + 1 / Tan(Pi * (HighFrequencyl - + LowFrequencyl + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl + ) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata.C + * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.D * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := + (StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata.C + - 1) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + end; + + 4: // DSPFFTLowPass + begin + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := + 1 / Tan(Pi * LowFrequencyl / + StreamOut[OutputIndex].Data. + SampleRate); + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + Sqrt(2) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C + + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := + 2 * StreamOut[OutputIndex] + .DSP[FilterIndex].fftdata. + a3[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := + 2 * (1 - StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - Sqrt(2) * StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C + + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + end; + + 5: // DSPFFTHighPass + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * HighFrequencyl / + StreamOut[OutputIndex].Data. + SampleRate); + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + Sqrt(2) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C + + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := + + -2 * StreamOut[OutputIndex + ].DSP[FilterIndex].fftdata + .a3[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := + 2 * (StreamOut[OutputIndex + ].DSP[FilterIndex].fftdata + .C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C - + 1) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - Sqrt(2) * StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C + + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + end; + + end; + end; + + if TypeFilterR <> -1 then + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.typefilterR := TypeFilterR; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Dr := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C2r := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D2r := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[2] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22r[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22r[1] := 0.0; + + case TypeFilterR of + 1: // DSPFFTBandSelect := DSPFFTBandReject + DSPFFTBandPass + begin + // DSPFFTBandReject + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * (HighFrequencyr - + LowFrequencyr + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + + LowFrequencyr) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Dr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[1]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr) + * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + // DSPFFTBandPass + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C2r := + 1 / Tan(Pi * (HighFrequencyr + - LowFrequencyr + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D2r := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + + LowFrequencyr) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C2r + ); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[2] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .a32r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22r[0] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .C2r * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .D2r * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .a32r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22r[1] := + (StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .C2r - 1) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .a32r[0]; + // + end; + + 2: // DSPFFTBandReject + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * (HighFrequencyr - + LowFrequencyr + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + + LowFrequencyr) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Dr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[1]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr) + * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + end; + + 3: // DSPFFTBandPass + begin + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := + 1 / Tan(Pi * (HighFrequencyr- + LowFrequencyr + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + + LowFrequencyr) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Dr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr - 1) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + end; + + 4: // DSPFFTLowPass + begin + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := + 1 / Tan(Pi * LowFrequencyr / + StreamOut[OutputIndex].Data. + SampleRate); + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + Sqrt(2) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr + + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := + 2 * StreamOut[OutputIndex + ].DSP[FilterIndex]. + fftdata.a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := + 2 * (1 - StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - Sqrt(2) * StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr + + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + end; + + 5: // DSPFFTHighPass + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * HighFrequencyr / + StreamOut[OutputIndex].Data. + SampleRate); + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + Sqrt(2) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr + + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := + + -2 * StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.a3r[ + 0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := + 2 * (StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr - 1) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - Sqrt(2) * StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr + + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + end; + end; + end; + end; +end; + +{$IF DEFINED(soundtouch)} +function SoundTouchPlug(bufferin: TDArFloat; plugHandle: THandle; notneeded :Tt_bs2bdp; Var + inputData: Tuos_Data; + notused1: float; notused2: float; notused3: float; notused4: float; + notused5: float; notused6: float; notused7: float; notused8: float): + + TDArFloat +; +var + ratio : shortint; + numoutbuf, x1, x2: cint32; + BufferplugFLTMP: TDArFloat; + BufferplugFL: TDArFloat; +begin + + case inputData.LibOpen of + 0: ratio := 1; + // sndfile + 1: + begin + // mpg123 + case inputData.SampleFormat of + 0: ratio := 2; + // float32 + 1: ratio := 2; + // int32 + 2: ratio := 1; + // int16 + end; + end; + 2: ratio := 1; + 3: ratio := 1; + // cdrom + 4: ratio := 1; + // opus + 5: ratio := 1; + // xmp + end; + + if inputData.LibOpen <> 4 then//not working yet for opus files + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln(); + writeln('_____Begin Sound touch_____'); + writeln('soundtouch_putSamples: Length(bufferin) = ' + inttostr(length(bufferin))); + writeln('outframes = ' + inttostr(inputData.outframes)+ + ' ratio = ' + inttostr(ratio)+' channels = ' + inttostr(inputData.Channels)); + {$endif} + + if inputData.outframes > 0 then + begin + soundtouch_putSamples(plugHandle, pcfloat(bufferin), + inputData.outframes div cint(inputData.Channels * ratio)); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('inputData.outframes div trunc(inputData.Channels * ratio) = ' + + inttostr(inputData.outframes Div inputData.Channels * ratio)); + {$endif} + + SetLength(BufferplugFL, 0); + SetLength(BufferplugFLTMP, 0); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Length(BufferplugFL) = ' + + inttostr(Length(BufferplugFL))); + writeln('Length(Bufferin) = ' + + inttostr(Length(Bufferin))); + writeln('Length(BufferplugFLTMP) = ' + + inttostr(Length(BufferplugFLTMP))); + {$endif} + + SetLength(BufferplugFLTMP,(Length(Bufferin))); + + +{ + x2 := 0 ; +while x2 < Length(BufferplugFLTMP) do +begin +BufferplugFLTMP[x2] := 0.0 ; +inc(x2); +end; +} + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('2_Length(BufferplugFLTMP) = ' + + inttostr(Length(BufferplugFLTMP))); + {$endif} + + numoutbuf := 1; + + while numoutbuf > 0 do + begin + + numoutbuf := soundtouch_receiveSamples(PlugHandle, + pcfloat(BufferplugFLTMP), inputData.outframes); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('numoutbuf = ' + inttostr(numoutbuf)); + {$endif} + + if numoutbuf > 0 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('SetLength(BufferplugFL) = ' + inttostr(length(BufferplugFL) + trunc( + + numoutbuf + * + + inputData + . + + Channels + ))); + {$endif} + + SetLength(BufferplugFL, length(BufferplugFL) + trunc(numoutbuf * inputData. + Channels)); + // works only with 2 channels. + + x2 := Length(BufferplugFL) - (numoutbuf * inputData.Channels); + + for x1 := 0 to trunc(numoutbuf * inputData.Channels) -1 do + begin + BufferplugFL[x1 + x2] := BufferplugFLTMP[x1]; + end; + end; + end; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('inputData.outframes = Length(BufferplugFL) = ' + inttostr(inputData.outframes)); + writeln('_____End Sound touch_____'); + {$endif} + + inputData.outframes := Length(BufferplugFL) Div inputData.Channels; + + Result := BufferplugFL; + end + else + begin + SetLength(bufferin, inputData.outframes); + Result := bufferin; + end; +end; + +function GetBPMPlug(bufferin: TDArFloat; plugHandle: THandle; notneeded :Tt_bs2bdp; Var inputData: + Tuos_Data; + numframes: float; loop: float; notused3: float; notused4: float; + notused5: float; notused6: float; notused7: float; notused8: float): TDArFloat; +var + ratio : shortint; +begin + + case inputData.LibOpen of + 0: ratio := 1; + // sndfile + 1: + begin + // mpg123 + case inputData.SampleFormat of + 0: ratio := 2; + // float32 + 1: ratio := 2; + // int32 + 2: ratio := 1; + // int16 + end; + end; + 2: ratio := 1; + 3: ratio := 1; + // cdrom + 4: ratio := 1; + // opus + 5: ratio := 1; + // xmp + end; + + if inputData.LibOpen <> 4 then//not working yet for opus files + begin + // writeln('getBPM init '); + if (theincbpm < numframes) and (theincbpm > -1) then + begin + bpm_putSamples(plugHandle, pcfloat(bufferin), length(bufferin) div inputData.channels); + end + else + begin + if theincbpm > -1 then + begin + inputData.BPM := bpm_getBpm(plugHandle); + // writeln('inputData.BPM := ' + floattostr(inputData.BPM)); + if loop = 1 then theincbpm := 0 + else theincbpm := -1; + + end; + end; + + if theincbpm > -1 then inc(theincbpm); + + SetLength(bufferin, inputData.outframes Div ratio); + Result := bufferin; + end; +end; + + +{$endif} + +{$IF DEFINED(bs2b)} +function bs2bPlug(bufferin: TDArFloat; notneeded: THandle; Abs2bd : Tt_bs2bdp; Var inputData: + Tuos_Data; + notused1: float; notused2: float; notused3: float; notused4: float; + notused5: float; notused6: float; notused7: float; notused8: float): TDArFloat; +var + x, x2: cint32; + Bufferplug: TDArFloat; +begin + + if (inputData.libopen = 0) or (inputData.libopen = 2) or (inputData.libopen = 3) or (inputData. + libopen = 4) or (inputData.libopen = 5) then + x2 := trunc(inputData.ratio * (inputData.outframes Div trunc(inputData.channels))) ; + + if (inputData.libopen = 1) then + begin + if inputData.SampleFormat < 2 then + x2 := trunc((inputData.outframes Div trunc(inputData.channels))) + else x2 := trunc(inputData.ratio * (inputData.outframes Div trunc(inputData.channels))) ; + end; + + SetLength(Bufferplug,x2); + + x := 0; + + while x < x2 do + begin + + Bufferplug[x] := bufferin[x] ; + Bufferplug[x+1] := bufferin[x+1] ; + bs2b_cross_feed_f(Abs2bd,Bufferplug[x],1); + bs2b_cross_feed_f(Abs2bd,Bufferplug[x+1],2); + x := x +2; + end; + Result := Bufferplug; +end; +{$endif} + +function Tuos_Player.AddPlugin(PlugName: PChar; SampleRate: CDouble; + Channels: cint32): cint32; +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// Result is PluginIndex +var + x: cint32; + chan, sr : integer; +begin + x := -1 ; + {$IF DEFINED(soundtouch)} + if lowercase(PlugName) = 'soundtouch' then + begin + // + SetLength(Plugin, Length(Plugin) + 1); + x := Length(Plugin) - 1; + Plugin[x] := Tuos_Plugin.Create(); + Plugin[x].Enabled := false; + Plugin[x].Name := lowercase(PlugName); + Plugin[x].param1 := -1; + Plugin[x].param2 := -1; + Plugin[x].param3 := -1; + Plugin[x].param4 := -1; + Plugin[x].param5 := -1; + Plugin[x].param6 := -1; + Plugin[x].param7 := -1; + Plugin[x].param8 := -1; + Plugin[x].PlugHandle := soundtouch_createInstance(); + if SampleRate = -1 then + soundtouch_setSampleRate(Plugin[x].PlugHandle, 44100) + else + soundtouch_setSampleRate(Plugin[x].PlugHandle, roundmath(SampleRate)); + if Channels = -1 then + soundtouch_setChannels(Plugin[x].PlugHandle, 2) + else + soundtouch_setChannels(Plugin[x].PlugHandle, Channels); + soundtouch_setRate(Plugin[x].PlugHandle, 1); + soundtouch_setTempo(Plugin[x].PlugHandle, 1); + soundtouch_clear(Plugin[x].PlugHandle); + Plugin[x].PlugFunc := @soundtouchplug; + end; + + if lowercase(PlugName) = 'getbpm' then + begin + // + SetLength(Plugin, Length(Plugin) + 1); + x := Length(Plugin) - 1; + Plugin[x] := Tuos_Plugin.Create(); + Plugin[x].Enabled := true; + Plugin[x].Name := lowercase(PlugName); + Plugin[x].param1 := -1; + Plugin[x].param2 := -1; + Plugin[x].param3 := -1; + Plugin[x].param4 := -1; + Plugin[x].param5 := -1; + Plugin[x].param6 := -1; + Plugin[x].param7 := -1; + Plugin[x].param8 := -1; + + if SampleRate = -1 then + sr := 44100 + else + sr := roundmath(SampleRate); + if Channels = -1 then + chan := 2 + else + chan := Channels; + + Plugin[x].PlugHandle := bpm_createInstance(chan,sr); + + Plugin[x].PlugFunc := @getbpmplug; + end; + {$endif} + + {$IF DEFINED(bs2b)} + if lowercase(PlugName) = 'bs2b' then + begin + SetLength(Plugin, Length(Plugin) + 1); + Plugin[Length(Plugin) - 1] := Tuos_Plugin.Create(); + x := Length(Plugin) - 1; + Plugin[x].Name := lowercase(PlugName); + Plugin[x].Enabled := true; + if assigned(Plugin[x].Abs2b) then bs2b_close(Plugin[x].Abs2b) ; + Plugin[x].Abs2b := bs2b_open() ; + + if SampleRate = -1 then + bs2b_set_srate(Plugin[x].Abs2b, 44100) + else + bs2b_set_srate(Plugin[x].Abs2b, roundmath(SampleRate)); + + Plugin[x].param1 := -1; + Plugin[x].param2 := -1; + Plugin[x].param3 := -1; + Plugin[x].param4 := -1; + Plugin[x].param5 := -1; + Plugin[x].param6 := -1; + Plugin[x].param7 := -1; + Plugin[x].param8 := -1; + Plugin[x].PlugFunc := @bs2bplug; + end; + {$endif} + Plugin[x].Enabled := true; + Result := x; +end; + +{$IF DEFINED(soundtouch)} +procedure Tuos_Player.SetPluginSoundTouch(PluginIndex: cint32; + Tempo: cfloat; Pitch: cfloat; Enable: boolean); +begin + soundtouch_setRate(Plugin[PluginIndex].PlugHandle, Pitch); + soundtouch_setTempo(Plugin[PluginIndex].PlugHandle, Tempo); + Plugin[PluginIndex].Enabled := Enable; + Plugin[PluginIndex].param1 := Tempo; + Plugin[PluginIndex].param2 := Pitch; +end; + +procedure Tuos_Player.SetPluginGetBPM(PluginIndex: cint32; numofframes: integer; loop : boolean; + Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +// numofframes: number of frames to analyse (-1 = 512 frames) +// loop: do new detection after previous. +begin + + Plugin[PluginIndex].Enabled := Enable; + + Plugin[PluginIndex].param1 := numofframes; + + if (loop = true) then + Plugin[PluginIndex].param2 := 1 + else Plugin[PluginIndex].param2 := 0; ; +end; +{$endif} + +{$IF DEFINED(bs2b)} +procedure Tuos_Player.SetPluginBs2b(PluginIndex: cint32; + level: CInt32; fcut: CInt32; feed: CInt32; Enable: boolean); +begin + + Plugin[PluginIndex].Enabled := Enable; + + if level > -1 then + begin + bs2b_set_level(Plugin[PluginIndex].Abs2b,level); + Plugin[PluginIndex].param1 := level; + end; + + if fcut > -1 then + begin + bs2b_set_level_fcut(Plugin[PluginIndex].Abs2b,fcut); + Plugin[PluginIndex].param2 := fcut; + end; + + if feed > -1 then + begin + bs2b_set_level_feed(Plugin[PluginIndex].Abs2b,feed); + Plugin[PluginIndex].param3 := feed; + end; + +end; +{$endif} + +function uos_InputGetLevelArray(PlayerIndex: cint32; InputIndex: cint32) : TDArFloat; +begin + result := uosLevelArray[PlayerIndex][InputIndex] ; +end; + +{$IF DEFINED(noiseremoval)} +function uos_NoiseRemoval(Var Data: Tuos_Data; Var fft: Tuos_FFT): TDArFloat; +var + ratio, x: cint32; + Outfr : cint32; + tempr : PSingle; + pf: TDArFloat; +begin + + case Data.LibOpen of + 0: ratio := 1; + // sndfile + 1: ratio := 2; + // mpg123 + 2: ratio := 1; + // aac + 3: ratio := 1; + // cdrom + 4: ratio := 1; + // opus + 5: ratio := 1; + // xmp + end; + + if Data.SampleFormat = 0 then// TODO for Array of integer. + begin + + tempr := fft.FNoise.FilterNoise(pointer(Data.Buffer) , + (Data.OutFrames Div ratio) , Outfr); + + setlength(pf,length(Data.Buffer)); + + for x := 0 to length(pf) -1 do + begin + if x < Outfr then + pf[x] := tempr[x] + else pf[x] := 0.0; + end; + + result := pf ; + + end + else result := Data.Buffer; + // TODO for Array of integer. +end; + {$endif} + +function uos_DSPVolumeIn(Var Data: Tuos_Data;Var fft: Tuos_FFT): TDArFloat; +var + x, ratio: cint32; + vleft, vright: cfloat; + + // volumearray : array of double; + + ps: PDArShort; + // if input is Int16 format + pl: PDArLong; + // if input is Int32 format + pf: PDArFloat; + // if input is Float32 format +begin + //setlength(volumearray,Data.channels); + vleft := Data.VLeft; + vright := Data.VRight; + + case Data.SampleFormat of + 2: // int16 + begin + ps := @Data.Buffer; + for x := 0 to (Data.OutFrames -1) do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + ps^[x] := trunc(ps^[x] * vright) + else + ps^[x] := trunc(ps^[x] * vleft); + end; + // This to avoid distortion + if ps^[x] < (-32760) then ps^[x] := -32760 ; + if ps^[x] > (32760) then ps^[x] := 32760 ; + + end; + + end; + 1: // int32 + begin + pl := @Data.Buffer; + for x := 0 to (Data.OutFrames -1) do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + pl^[x] := trunc(pl^[x] * vright) + else + pl^[x] := trunc(pl^[x] * vleft); + end; + + // This to avoid distortion + if pl^[x] < (-2147000000) then pl^[x] := -2147000000 ; + if pl^[x] > (2147000000) then pl^[x] := 2147000000 ; + + end; + + end; + 0: // float32 + begin + case Data.LibOpen of + 0: ratio := 1; + // sndfile + 1: ratio := 2; + // mpg123 + 2: ratio := 1; + // aac + 3: ratio := 1; + // cdrom + 4: ratio := 1; + // opus + 5: ratio := 1; + // xmp + end; + + pf := @Data.Buffer; + + for x := 0 to (Data.OutFrames div ratio) -1 do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + pf^[x] := pf^[x] * vright + else + pf^[x] := pf^[x] * vleft; + end; + + // This to avoid distortion + if pf^[x] < -1 then pf^[x] := -1; + if pf^[x] > 1 then pf^[x] := 1 ; + + end; + + end; + end; + + Result := Data.Buffer; +end; + +function uos_DSPVolumeOut(Var Data: Tuos_Data;Var fft: Tuos_FFT): TDArFloat; +var + x: cint32; + vleft, vright: cfloat; + ps: PDArShort; + // if output is Int16 format + pl: PDArLong; + // if output is Int32 format + pf: PDArFloat; + // if output is Float32 format +begin + + vleft := Data.VLeft; + vright := Data.VRight; + + case Data.SampleFormat of + 2: // int16 + begin + ps := @Data.Buffer; + for x := 0 to (length(Data.Buffer) -1) do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + ps^[x] := trunc(ps^[x] * vright) + else + ps^[x] := trunc(ps^[x] * vleft); + end; + // This to avoid distortion + if ps^[x] < (-32760) then ps^[x] := -32760 ; + if ps^[x] > (32760) then ps^[x] := 32760 ; + + end; + + end; + 1: // int32 + begin + pl := @Data.Buffer; + for x := 0 to (length(Data.Buffer) -1) do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + pl^[x] := trunc(pl^[x] * vright) + else + pl^[x] := trunc(pl^[x] * vleft); + end; + + // This to avoid distortion + if pl^[x] < (-2147000000) then pl^[x] := -2147000000 ; + if pl^[x] > (2147000000) then pl^[x] := 2147000000 ; + + end; + + end; + 0: // float32 + begin + + pf := @Data.Buffer; + + for x := 0 to (length(Data.Buffer)) -1 do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + pf^[x] := pf^[x] * vright + else + pf^[x] := pf^[x] * vleft; + end; + + // This to avoid distortion + if pf^[x] < -1 then pf^[x] := -1; + if pf^[x] > 1 then pf^[x] := 1 ; + + end; + + end; + end; + + Result := Data.Buffer; +end; + +function Tuos_Player.DSPLevel(Data: Tuos_Data): Tuos_Data; +var + x, ratio: cint32; + ps: PDArShort; + // if input is Int16 format + pl: PDArLong; + // if input is Int32 format + pf: PDArFloat; + // if input is Float32 format + mins, maxs: array[0..1] of cInt16; + // if input is Int16 format + minl, maxl: array[0..1] of cInt32; + // if input is Int32 format + minf, maxf: array[0..1] of cfloat; + // if input is Float32 format +begin + + case Data.SampleFormat of + 2: + begin + mins[0] := 32767; + mins[1] := 32767; + maxs[0] := -32768; + maxs[1] := -32768; + ps := @Data.Buffer; + x := 0; + while x < Data.OutFrames -1 do + begin + if ps^[x] < mins[0] then + mins[0] := ps^[x]; + if ps^[x] > maxs[0] then + maxs[0] := ps^[x]; + + Inc(x, 1); + + if ps^[x] < mins[1] then + mins[1] := ps^[x]; + if ps^[x] > maxs[1] then + maxs[1] := ps^[x]; + + Inc(x, 1); + end; + + if Abs(mins[0]) > Abs(maxs[0]) then + Data.LevelLeft := Sqrt(Abs(mins[0]) / 32768) + else + Data.LevelLeft := Sqrt(Abs(maxs[0]) / 32768); + + if Abs(mins[1]) > Abs(maxs[1]) then + Data.Levelright := Sqrt(Abs(mins[1]) / 32768) + else + Data.Levelright := Sqrt(Abs(maxs[1]) / 32768); + + end; + + 1: + begin + minl[0] := 2147483647; + minl[1] := 2147483647; + maxl[0] := -2147483648; + maxl[1] := -2147483648; + pl := @Data.Buffer; + x := 0; + while x < Data.OutFrames -1 do + begin + if pl^[x] < minl[0] then + minl[0] := pl^[x]; + if pl^[x] > maxl[0] then + maxl[0] := pl^[x]; + + Inc(x, 1); + + if pl^[x] < minl[1] then + minl[1] := pl^[x]; + if pl^[x] > maxl[1] then + maxl[1] := pl^[x]; + + Inc(x, 1); + end; + + if Abs(minl[0]) > Abs(maxl[0]) then + Data.LevelLeft := Sqrt(Abs(minl[0]) / 2147483648) + else + Data.LevelLeft := Sqrt(Abs(maxl[0]) / 2147483648); + + if Abs(minl[1]) > Abs(maxl[1]) then + Data.Levelright := Sqrt(Abs(minl[1]) / 2147483648) + else + Data.Levelright := Sqrt(Abs(maxl[1]) / 2147483648); + end; + + 0: + begin + case Data.LibOpen of + 0: ratio := 1; + // sndfile + 1: ratio := 2; + // mpg123 + 2: ratio := 2; + // aac + 3: ratio := 2; + // cdrom + 4: ratio := 2; + // opus + 5: ratio := 1; + // xmp + end; + + minf[0] := 1; + minf[1] := 1; + maxf[0] := -1; + maxf[1] := -1; + pf := @Data.Buffer; + x := 0; + while x < (Data.OutFrames div ratio)-1 do + begin + if pf^[x] < minf[0] then + minf[0] := pf^[x]; + if pf^[x] > maxf[0] then + maxf[0] := pf^[x]; + + Inc(x, 1); + + if pf^[x] < minf[1] then + minf[1] := pf^[x]; + if pf^[x] > maxf[1] then + maxf[1] := pf^[x]; + + Inc(x, 1); + end; + + if Abs(minf[0]) > Abs(maxf[0]) then + Data.LevelLeft := Sqrt(Abs(minf[0])) + else + Data.LevelLeft := Sqrt(Abs(maxf[0])); + + if Abs(minf[1]) > Abs(maxf[1]) then + Data.Levelright := Sqrt(Abs(minf[1])) + else + Data.Levelright := Sqrt(Abs(maxf[1])); + end; + end; + + Result := Data; +end; + +function DSPLevelString(Buffer: TDArFloat; SampleFormat, Ratio : cint32; Var resfloatleft : cfloat; + Var resfloatright : cfloat): string; +var + x, OutFrames: cint32; + ps: PDArShort; + // if input is Int16 format + pl: PDArLong; + // if input is Int32 format + pf: PDArFloat; + // if input is Float32 format + mins, maxs: array[0..1] of cInt16; + // if input is Int16 format + minl, maxl: array[0..1] of cInt32; + // if input is Int32 format + minf, maxf: array[0..1] of cfloat; + // if input is Float32 format +begin + + OutFrames := length(buffer); + + case SampleFormat of + 2: + begin + mins[0] := 32767; + mins[1] := 32767; + maxs[0] := -32768; + maxs[1] := -32768; + ps := @Buffer; + x := 0; + while x < OutFrames -1 do + begin + if ps^[x] < mins[0] then + mins[0] := ps^[x]; + if ps^[x] > maxs[0] then + maxs[0] := ps^[x]; + + Inc(x, 1); + + if ps^[x] < mins[1] then + mins[1] := ps^[x]; + if ps^[x] > maxs[1] then + maxs[1] := ps^[x]; + + Inc(x, 1); + end; + + if Abs(mins[0]) > Abs(maxs[0]) then + resfloatLeft := Sqrt(Abs(mins[0]) / 32768) + else + resfloatLeft := Sqrt(Abs(maxs[0]) / 32768); + + if Abs(mins[1]) > Abs(maxs[1]) then + resfloatright := Sqrt(Abs(mins[1]) / 32768) + else + resfloatright := Sqrt(Abs(maxs[1]) / 32768); + + end; + + 1: + begin + minl[0] := 2147483647; + minl[1] := 2147483647; + maxl[0] := -2147483648; + maxl[1] := -2147483648; + pl := @Buffer; + x := 0; + while x < OutFrames -1 do + begin + if pl^[x] < minl[0] then + minl[0] := pl^[x]; + if pl^[x] > maxl[0] then + maxl[0] := pl^[x]; + + Inc(x, 1); + + if pl^[x] < minl[1] then + minl[1] := pl^[x]; + if pl^[x] > maxl[1] then + maxl[1] := pl^[x]; + + Inc(x, 1); + end; + + if Abs(minl[0]) > Abs(maxl[0]) then + resfloatLeft := Sqrt(Abs(minl[0]) / 2147483648) + else + resfloatLeft := Sqrt(Abs(maxl[0]) / 2147483648); + + if Abs(minl[1]) > Abs(maxl[1]) then + resfloatright := Sqrt(Abs(minl[1]) / 2147483648) + else + resfloatright := Sqrt(Abs(maxl[1]) / 2147483648); + end; + + 0: + begin + + minf[0] := 1; + minf[1] := 1; + maxf[0] := -1; + maxf[1] := -1; + pf := @Buffer; + x := 0; + while x < (OutFrames div ratio) -1 do + begin + if pf^[x] < minf[0] then + minf[0] := pf^[x]; + if pf^[x] > maxf[0] then + maxf[0] := pf^[x]; + + Inc(x, 1); + + if pf^[x] < minf[1] then + minf[1] := pf^[x]; + if pf^[x] > maxf[1] then + maxf[1] := pf^[x]; + + Inc(x, 1); + end; + + if Abs(minf[0]) > Abs(maxf[0]) then + resfloatLeft := Sqrt(Abs(minf[0])) + else + resfloatLeft := Sqrt(Abs(maxf[0])); + + if Abs(minf[1]) > Abs(maxf[1]) then + resfloatright := Sqrt(Abs(minf[1])) + else + resfloatright := Sqrt(Abs(maxf[1])); + end; + end; + Result := floattostr(resfloatleft) + '|' + floattostr(resfloatright); +end; + + +function uos_BandFilter(Var Data: Tuos_Data; Var fft: Tuos_FFT): TDArFloat; +var + i, ratio: cint32; + ifbuf: boolean; + arg, res, res2: cfloat; + ps, ps2: PDArShort; + // if input is Int16 format + pl, pl2: PDArLong; + // if input is Int32 format + pf, pf2: PDArFloat; + // if input is Float32 format +begin + + ratio := 1; + ifbuf := fft.AlsoBuf; + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + ps2 := @fft.VirtualBuffer; + end; + 1: + begin + pl := @Data.Buffer; + pl2 := @fft.VirtualBuffer; + end; + 0: + begin + case Data.LibOpen of + 0: ratio := 1; + // sndfile + 1: ratio := 2; + // mpg123 + 2: ratio := 2; + // aac + 3: ratio := 2; + // cdrom + 4: ratio := 2; + // opus + 5: ratio := 1; + // xmp + end; + pf := @Data.Buffer; + pf2 := @fft.VirtualBuffer; + end; + end; + i := 0; + while i < (Data.OutFrames div ratio) -1 do + begin + + case Data.SampleFormat of + 2: arg := ps^[i]; + 1: arg := pl^[i]; + 0: arg := pf^[i]; + end; + + res := fft.a3[0] * arg + fft.a3[1] * fft.x0[0] + fft.a3[2] * + fft.x1[0] - fft.b2[0] * fft.y0[0] - fft.b2[1] * fft.y1[0]; + + if fft.typefilterL = 1 then + begin + res2 := fft.a32[0] * arg + fft.a32[1] * fft.x02[0] + fft.a32[2] * + fft.x12[0] - fft.b22[0] * fft.y02[0] - fft.b22[1] * fft.y12[0]; + + case Data.SampleFormat of + 2: + begin + if ifbuf = True then + ps^[i] := trunc((res * 1) + (res2 * fft.gainl)) + else + ps2^[i] := trunc((res * 1) + (res2 * fft.gainl)); + end; + 1: + begin + if ifbuf = True then + pl^[i] := trunc((res * 1) + (res2 * fft.gainl)) + else + pl2^[i] := trunc((res * 1) + (res2 * fft.gainl)); + end; + 0: + begin + + if ifbuf = True then + pf^[i] := ((res * 1) + (res2 * fft.gainl)) + else + pf2^[i] := ((res * 1) + (res2 * fft.gainl)); + end; + end; + + end + else + case Data.SampleFormat of + 2: + begin + + if ifbuf = True then + ps^[i] := trunc((res * fft.gainl)) + else + ps2^[i] := trunc(res * fft.gainl); + end; + 1: + begin + if ifbuf = True then + pl^[i] := trunc((res * fft.gainl)) + else + pl2^[i] := trunc(res * fft.gainl); + end; + 0: + begin + if ifbuf = True then + pf^[i] := ((res * fft.gainl)) + else + pf2^[i] := ((res * fft.gainl)); + end; + end; + + fft.x1[0] := fft.x0[0]; + fft.x0[0] := arg; + fft.y1[0] := fft.y0[0]; + fft.y0[0] := res; + + if fft.typefilterL = 1 then + begin + fft.x12[0] := fft.x02[0]; + fft.x02[0] := arg; + fft.y12[0] := fft.y02[0]; + fft.y02[0] := res2; + end; + + if Data.Channels = 2 then + begin + Inc(i); + case Data.SampleFormat of + 2: arg := ps^[i]; + 1: arg := pl^[i]; + 0: arg := pf^[i]; + end; + res := fft.a3r[0] * arg + fft.a3r[1] * fft.x0r[1] + fft.a3r[2] * + fft.x1r[1] - fft.b2r[0] * fft.y0r[1] - fft.b2r[1] * fft.y1r[1]; + + if fft.typefilterR = 1 then + begin + res2 := fft.a32r[0] * arg + fft.a32r[1] * fft.x02r[1] + + fft.a32r[2] * fft.x12r[1] - fft.b22r[0] * fft.y02r[1] - + fft.b22r[1] * fft.y12r[1]; + + case Data.SampleFormat of + 2: + begin + if ifbuf = True then + ps^[i] := trunc((res * 1) + (res2 * fft.gainr)) + else + ps2^[i] := trunc((res * 1) + (res2 * fft.gainr)); + end; + 1: + begin + if ifbuf = True then + pl^[i] := trunc((res * 1) + (res2 * fft.gainr)) + else + pl2^[i] := trunc((res * 1) + (res2 * fft.gainr)); + end; + 0: + begin + if ifbuf = True then + pf^[i] := ((res * 1) + (res2 * fft.gainr)) + else + pf2^[i] := ((res * 1) + (res2 * fft.gainr)); + end; + end; + + end + else + case Data.SampleFormat of + 2: + begin + if ifbuf = True then + ps^[i] := trunc((res * fft.gainr)) + else + ps2^[i] := trunc((res * fft.gainr)); + end; + 1: + begin + if ifbuf = True then + pl^[i] := trunc((res * fft.gainr)) + else + pl2^[i] := trunc((res * fft.gainr)); + end; + 0: + begin + if ifbuf = True then + pf^[i] := ((res * fft.gainr)) + else + pf2^[i] := ((res * fft.gainr)); + end; + end; + + fft.x1r[1] := fft.x0r[1]; + fft.x0r[1] := arg; + fft.y1r[1] := fft.y0r[1]; + fft.y0r[1] := res; + + if fft.typefilterR = 1 then + begin + fft.x12r[1] := fft.x02r[1]; + fft.x02r[1] := arg; + fft.y12r[1] := fft.y02r[1]; + fft.y02r[1] := res2; + end; + + end; + Inc(i); + end; + + if ifbuf = false then + begin + data.levelfilters := data.levelfilters + '%'+ DSPLevelString(fft.VirtualBuffer, Data. + SampleFormat, data.Ratio, data.levelleft, data.levelright) ; + inc(Data.incfilters); + Data.levelfiltersar[Data.incfilters-1] := data.levelleft; + inc(Data.incfilters); + Data.levelfiltersar[Data.incfilters-1] := data.levelright; + end; + + Result := Data.Buffer; + +end; + +function uos_InputAddDSP1ChanTo2Chan(Var Data: Tuos_Data; Var fft: Tuos_FFT): TDArFloat; +// Convert mono 1 chan input into stereo 2 channels input. +// Works only if the input is mono 1 channel othewise stereo 2 chan is keeped. +// InputIndex : InputIndex of a existing Input +// result : index of DSPIn in array +// example DSPIndex1 := InputAdd1ChanTo2Chan(InputIndex1); +var + x, x2: integer ; + + ps, ps2: PDArShort; + // if input is Int16 format + pl, pl2: PDArLong; + // if input is Int32 format + pf, pf2: PDArFloat; + // if input is Float32 format + + buffer2 : TDArFloat; + +begin + if (Data.channels = 1) then + begin + setlength(Buffer2, Data.OutFrames); + x := 0 ; + x2 := 0 ; + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + ps2 := @Buffer2; + while x < Data.OutFrames -1 do + begin + ps2^[x2] := (ps^[x]); + ps2^[x2+1] := (ps^[x]); + x := x + 1; + x2 := x2 + 2; + end; + end; + + 1: + begin + pl := @Data.Buffer; + pl2 := @Buffer2; + while x < Data.OutFrames -1 do + begin + pl2^[x2] := (pl^[x]); + pl2^[x2+1] := (pl^[x]); + x := x + 1; + x2 := x2 + 2; + end; + end; + + 0: + begin + pf := @Data.Buffer; + pf2 := @Buffer2; + while x < Data.OutFrames -1 do + begin + pf2^[x2] := (pf^[x]); + pf2^[x2+1] := (pf^[x]); + x := x + 1; + x2 := x2 + 2; + end; + end; + end; + data.outframes := length(buffer2); + Result := Buffer2;; + end + else + begin + Result := data.Buffer; + end; + +end; + +function ConvertSampleFormat(Data: Tuos_Data): TDArFloat; +var + x : integer ; + + ps, ps2: PDArShort; + // if input is Int16 format + pl, pl2: PDArLong; + // if input is Int32 format + buffer2 : TDArFloat; + +begin + if (Data.SampleFormat > 0) then + begin + setlength(Buffer2, Data.OutFrames); + x := 0 ; + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + ps2 := @Buffer2; + while x < Data.OutFrames do + begin + ps2^[x] := (ps^[x]); + x := x + 1; + end; + end; + + 1: + begin + pl := @Data.Buffer; + pl2 := @Buffer2; + while x < Data.OutFrames do + begin + pl2^[x] := (pl^[x]); + x := x + 1; + end; + end; + end; + Result := Buffer2; + end + else + begin + Result := data.Buffer; + end; + +end; + + {$IF DEFINED(noiseremoval)} +function Tuos_Player.InputAddDSPNoiseRemoval(InputIndex: cint32): cint32; +// DSP Noise Removal +// InputIndex : InputIndex of a existing Input +// result : otherwise index of DSPIn in array +// example DSPIndex1 := InputAddDSPNoiseRemoval(InputIndex1); +begin + + Result := InputAddDSP(InputIndex, Nil, @uos_NoiseRemoval, Nil, Nil); + + StreamIn[InputIndex].data.DSPNoiseIndex := Result ; + + StreamIn[InputIndex].DSP[result].fftdata := Tuos_FFT.Create(); + + StreamIn[InputIndex].DSP[result].fftdata.FNoise := + TuosNoiseRemoval.Create(StreamIn[InputIndex]. + data.Channels,roundmath(StreamIn[InputIndex]. + data. + SampleRate)); + + StreamIn[InputIndex].DSP[result].fftdata.FNoise.samprate := + roundmath(StreamIn[InputIndex].data. + SampleRate); + + StreamIn[InputIndex].DSP[result].fftdata.FNoise.WriteProc := + @StreamIn[InputIndex].DSP[result]. + fftdata.FNoise.WriteData; + + StreamIn[InputIndex].DSP[result].fftdata.FNoise.isprofiled := false; + +end; + +procedure Tuos_Player.InputSetDSPNoiseRemoval(InputIndex: cint32; Enable: boolean); + +begin + StreamIn[InputIndex].DSP[StreamIn[InputIndex].data.DSPNoiseIndex].enabled := Enable ; +end; + +function Tuos_Player.OutputAddDSPNoiseRemoval(OutputIndex: cint32): cint32; +// DSP Noise Removal +// OutputIndex : OutputIndex of a existing Output +// result : otherwise index of DSPInOut in array +// example DSPIndex1 := OutputAddDSPNoiseRemoval(OutputIndex1); +begin + + Result := OutputAddDSP(OutputIndex, Nil, @uos_NoiseRemoval, Nil, Nil); + + StreamOut[OutputIndex].data.DSPNoiseIndex := Result ; + + StreamOut[OutputIndex].DSP[result].fftdata := Tuos_FFT.Create(); + + StreamOut[OutputIndex].DSP[result].fftdata.FNoise := + TuosNoiseRemoval.Create(StreamOut[OutputIndex + ].data.Channels,roundmath(StreamOut[ + OutputIndex].data. + SampleRate)); + + StreamOut[OutputIndex].DSP[result].fftdata.FNoise.samprate := + roundmath(StreamOut[OutputIndex]. + data. + SampleRate); + + StreamOut[OutputIndex].DSP[result].fftdata.FNoise.WriteProc := + @StreamOut[OutputIndex].DSP[result] + .fftdata.FNoise.WriteData; + + StreamOut[OutputIndex].DSP[result].fftdata.FNoise.isprofiled := false; + +end; + +procedure Tuos_Player.OutputSetDSPNoiseRemoval(OutputIndex: cint32; Enable: boolean); +begin + StreamOut[OutputIndex].DSP[StreamOut[OutputIndex].data.DSPNoiseIndex].enabled := Enable ; +end; + +{$endif} + +function Tuos_Player.InputAddDSPVolume(InputIndex: cint32; VolLeft: double; + VolRight: double): cint32; +// DSP Volume changer +// InputIndex : InputIndex of a existing Input +// VolLeft : Left volume +// VolRight : Right volume +// result : index of DSPIn in array +// example DSPIndex1 := InputAddDSPVolume(InputIndex1,1,1); +begin + Result := InputAddDSP(InputIndex, Nil, @uos_DSPVolumeIn, Nil, Nil); + StreamIn[InputIndex].Data.VLeft := VolLeft; + StreamIn[InputIndex].Data.VRight := VolRight; +end; + +function Tuos_Player.InputAddDSP1ChanTo2Chan(InputIndex: cint32): cint32; +// Convert mono 1 channel input to stereo 2 channels input. +// Works only if the input is mono 1 channel othewise stereo 2 chan is keeped. +// InputIndex : InputIndex of a existing Input +// result : index of DSPIn in array +// example DSPIndex1 := InputAddDSP1ChanTo2Chan(InputIndex1); +begin + Result := InputAddDSP(InputIndex, Nil, @uos_InputAddDSP1ChanTo2Chan, Nil, Nil); +end; + +function Tuos_Player.OutputAddDSPVolume(OutputIndex: cint32; VolLeft: double; + VolRight: double): cint32; +// DSP Volume changer +// OutputIndex : OutputIndex of a existing Output +// VolLeft : Left volume ( 1 = max) +// VolRight : Right volume ( 1 = max) +// result : index of DSPIn in array +// example DSPIndex1 := OutputAddDSPVolume(OutputIndex1,1,1); +begin + Result := OutputAddDSP(OutputIndex, Nil, @uos_DSPVolumeOut, Nil, Nil); + StreamOut[OutputIndex].Data.VLeft := VolLeft; + StreamOut[OutputIndex].Data.VRight := VolRight; +end; + +procedure Tuos_Player.InputSetDSPVolume(InputIndex: cint32; DSPVolIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); +// InputIndex : InputIndex of a existing Input +// DSPIndex : DSPVolIndex of a existing DSPVolume +// VolLeft : Left volume ( -1 = do not change) +// VolRight : Right volume ( -1 = do not change) +// Enable : Enabled +// example InputSetDSPVolume(InputIndex1,DSPVolIndex1,1,0.8,True); +begin + if VolLeft <> -1 then + StreamIn[InputIndex].Data.VLeft := VolLeft; + if VolRight <> -1 then + StreamIn[InputIndex].Data.VRight := VolRight; + StreamIn[InputIndex].DSP[DSPVolIndex].Enabled := Enable; +end; + +procedure Tuos_Player.OutputSetDSPVolume(OutputIndex: cint32; + DSPVolIndex: cint32; VolLeft: double; VolRight: double; + Enable: boolean); +// OutputIndex : OutputIndex of a existing Output +// DSPIndex : DSPIndex of a existing DSP +// VolLeft : Left volume +// VolRight : Right volume +// Enable : Enabled +// example OutputSetDSPVolume(InputIndex1,DSPIndex1,1,0.8,True); +begin + if VolLeft <> -1 then + StreamOut[OutputIndex].Data.VLeft := VolLeft; + if VolRight <> -1 then + StreamOut[OutputIndex].Data.VRight := VolRight; + StreamOut[OutputIndex].DSP[DSPVolIndex].Enabled := Enable; +end; + +function Tuos_Player.InputAddFilter(InputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: + cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: + cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// InputIndex : InputIndex of a existing Input +// TypeFilterL: Type of filter left: +// ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2 +// 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 +// result : index of DSPIn in array + +var + FilterIndex: cint32; +begin + FilterIndex := InputAddDSP(InputIndex, Nil, @uos_BandFilter, Nil, LoopProc); + + if alsobuf = false then + begin + StreamIn[InputIndex].data.hasfilters := true; + inc(StreamIn[InputIndex].data.nbfilters); + end; + + StreamIn[InputIndex].DSP[FilterIndex].fftdata := + Tuos_FFT.Create(); + + setlength(StreamIn[InputIndex].DSP[FilterIndex].fftdata.Virtualbuffer, length(StreamIn[InputIndex] + .data.buffer)); + + if TypeFilterL = -1 then TypeFilterL := 1; + if TypeFilterR = -1 then TypeFilterR := 1; + + InputSetFilter(InputIndex, FilterIndex, TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, AlsoBuf, LoopProc, True); + + Result := FilterIndex; +end; + +function Tuos_Player.OutputAddFilter(OutputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: + cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: + cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// OutputIndex : InputIndex of a existing Output +// TypeFilterL: Type of filter left: +// ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2 +// 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 +// result : index of DSPIn in array + +var + FilterIndex: cint32; +begin + FilterIndex := OutputAddDSP(OutputIndex, Nil, @uos_BandFilter, Nil, LoopProc); + + if alsobuf = false then + begin + StreamOut[OutputIndex].data.hasfilters := true; + inc(StreamOut[OutputIndex].data.nbfilters); + end; + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata := + Tuos_FFT.Create(); + + setlength(StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Virtualbuffer, + length(StreamOut[OutputIndex].data.buffer)); + + if TypeFilterL = -1 then TypeFilterL := 1; + if TypeFilterR = -1 then TypeFilterR := 1; + + OutputSetFilter(OutputIndex, FilterIndex, TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, AlsoBuf, LoopProc, True); + + Result := FilterIndex; +end; + + +{$IF DEFINED(portaudio)} +function Tuos_Player.AddFromDevIn(Device: cint32; Latency: CDouble; + SampleRate: CDouble; OutputIndex: cint32; + SampleFormat: cint32; FramesCount : cint32; ChunkCount: cint32): + cint32 +; +// Add Input from IN device with custom parameters +// Device ( -1 is default Input device ) +// Latency ( -1 is latency suggested ) +// SampleRate : delault : -1 (44100) + +// 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 : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : -1 default : 4096 +// ChunkCount : default : -1 (= 512) +var + x, err: cint32; +begin + result := -1 ; + + if device = -1 then + err := Pa_GetDefaultInputDevice(); + if err = -1 then result := -2; + + if result <> -2 then + begin + x := 0; + err := -1; + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create(); + x := Length(StreamIn) - 1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.PositionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + + StreamIn[x].PAParam.HostApiSpecificStreamInfo := Nil; + + if device = -1 then + StreamIn[x].PAParam.device := + Pa_GetDefaultInputDevice() + else + StreamIn[x].PAParam.device := cint32(device); + + if SampleRate = -1 then + StreamIn[x].Data.SampleRate := DefRate + else + StreamIn[x].Data.SampleRate := SampleRate; + + StreamIn[x].PAParam.SuggestedLatency := CDouble(0); + + StreamIn[x].PAParam.SampleFormat := paInt16; + + case SampleFormat of + 0: StreamIn[x].PAParam.SampleFormat := paFloat32; + 1: StreamIn[x].PAParam.SampleFormat := paInt32; + 2: StreamIn[x].PAParam.SampleFormat := paInt16; + end; + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := CInt32(2) + else + StreamIn[x].Data.SampleFormat := CInt32(SampleFormat); + + if ((Pa_GetDeviceInfo(StreamIn[x].PAParam.device)^. + maxInputChannels)) > 1 then + StreamIn[x].PAParam.channelCount := CInt32(2) + else + StreamIn[x].PAParam.channelCount := CInt32(1) ; + + StreamIn[x].data.channels := StreamIn[x].PAParam.channelCount; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 4096 + else + StreamIn[x].Data.Wantframes := (FramesCount) ; + + if ChunkCount = -1 then ChunkCount := 512; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes* StreamIn[x].Data.channels); + + // StreamIn[x].Data.outframes := length(StreamIn[x].Data.Buffer); + StreamIn[x].Data.outframes := 0; + + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.TypePut := 1; + StreamIn[x].Data.ratio := 2; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.seekable := False; + StreamIn[x].Data.LibOpen := 2; + StreamIn[x].LoopProc := Nil; + + err := Pa_OpenStream(@StreamIn[x].Data.HandleSt, @StreamIn[x].PAParam, + Nil, CDouble(StreamIn[x].Data.SampleRate), CULong(ChunkCount), paClipOff, Nil, Nil); + + if err <> 0 then + else + begin + StreamIn[x].Data.Enabled := True; + Result := x; + end; + end + else Result := -1; +end; +{$endif} + +function Tuos_Player.InputGetBuffer(InputIndex: cint32): TDArFloat; +// Get current buffer +begin + result := StreamIn[InputIndex].data.Buffer; +end; + +function Tuos_Player.AddFromEndlessMuted(Channels : cint32; FramesCount: cint32): cint32; +// Add a input from Endless Muted dummy sine wav +// FramesCountByChan = FramesCount of input-to-follow div channels of input-to-follow. +var + x, i : cint32; +begin + result := -1 ; + x := 0; + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create(); + x := Length(StreamIn) - 1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.PositionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + + if channels = -1 then + StreamIn[x].data.channels := 2 + else + StreamIn[x].data.channels := Channels; + + StreamIn[x].Data.SampleRate := DefRate; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := trunc(1024 * 2 Div StreamIn[x].Data. + channels) + else + StreamIn[x].Data.Wantframes := FramesCount * 2 Div channels ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes* StreamIn[x].Data.channels); + + StreamIn[x].Data.OutFrames := StreamIn[x].Data.WantFrames ; + + for i := 0 to length(StreamIn[x].Data.Buffer) -1 do + StreamIn[x].Data.Buffer[i] := 0.0; + + StreamIn[x].Data.SampleFormat := CInt32(0); + + StreamIn[x].Data.VLeft := 0; + + StreamIn[x].Data.Vright := 0; + + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.TypePut := 5; + StreamIn[x].Data.HandleSt := pchar('endless'); + StreamIn[x].Data.ratio := 2; + StreamIn[x].Data.Output := -1; + StreamIn[x].Data.seekable := False; + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].LoopProc := Nil; + StreamIn[x].Data.Enabled := True; + Result := x; +end; + +{$IF DEFINED(synthesizer)} +function Tuos_Player.AddFromSynth(Channels: integer; WaveTypeL, WaveTypeR: shortint; + FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; + duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32; + OutputIndex: cint32; SampleFormat: cint32 ; SampleRate: CDouble ; + 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, 2 = triangle, 2= triangle, 3=sawtooth used for mono and stereo) + +// WaveTypeR: default: -1 (0) (0 = sine-wave 1 = square-wave,2 = triangle, 2= triangle, 3=sawtooth used, 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 Harmonies +// 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 + +var + x : cint32; +begin + result := -1 ; + x := 0; + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create(); + x := Length(StreamIn) - 1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.PositionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + + if channels < 1 then + StreamIn[x].data.channels := 2 + else + StreamIn[x].data.channels := channels; + + if SampleRate = -1 then + StreamIn[x].Data.SampleRate := DefRate + else + StreamIn[x].Data.SampleRate := SampleRate; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 1024 + else + StreamIn[x].Data.Wantframes := FramesCount ; + + if FrequencyL = -1 then + StreamIn[x].Data.freqLsine := 440 + else + StreamIn[x].Data.freqLsine := FrequencyL ; + + if FrequencyR = -1 then + StreamIn[x].Data.freqRsine := 440 + else + StreamIn[x].Data.freqRsine := FrequencyR ; + + if WaveTypeL < 1 then + StreamIn[x].Data.typLsine := 0 + else + StreamIn[x].Data.typLsine := WaveTypeL; + + if WaveTypeR < 1 then + StreamIn[x].Data.typRsine := 0 + else + StreamIn[x].Data.typRsine := WaveTypeR; + + StreamIn[x].Data.PosInTableLeft := 0; + StreamIn[x].Data.PosInTableRight := 0; + + if NbHarmonics < 1 then + StreamIn[x].data.harmonic := 0 + else + StreamIn[x].data.harmonic := NbHarmonics; + + if EvenHarmonics < 1 then + StreamIn[x].data.evenharm := 0 + else + StreamIn[x].data.evenharm := 1; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes* StreamIn[x].Data.channels); + + StreamIn[x].Data.posdursine := 0 ; + + if duration = -1 then duration := 1000; + StreamIn[x].Data.dursine := trunc( StreamIn[x].Data.SampleRate * duration / 1000); + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := CInt32(0) + else + StreamIn[x].Data.SampleFormat := CInt32(SampleFormat); + + if VolumeL = -1 then StreamIn[x].Data.VLeft := 1 + else + StreamIn[x].Data.VLeft := VolumeL; + + if VolumeR = -1 then StreamIn[x].Data.Vright := 1 + else + StreamIn[x].Data.Vright := VolumeR; + + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.TypePut := 3; + StreamIn[x].Data.HandleSt := pchar('synth'); + + if (StreamIn[x].Data.SampleFormat = 2) then + StreamIn[x].Data.ratio := StreamIn[x].data.channels + else StreamIn[x].Data.ratio := 2; + + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.seekable := False; + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].LoopProc := Nil; + StreamIn[x].Data.Enabled := True; + + FillLookupTable(x, StreamIn[x].Data.typLsine, 1,StreamIn[x].data.harmonic, StreamIn[x].data. + evenharm); + FillLookupTable(x, StreamIn[x].Data.typRsine, 2,StreamIn[x].data.harmonic, StreamIn[x].data. + evenharm); + + Result := x; +end; + +procedure Tuos_Player.InputSetSynth(InputIndex: cint32; WaveTypeL, WaveTypeR: shortint; + 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, 2 = triangle, 2= triangle, 3=sawtooth used for mono and stereo) + +// WaveTypeR : do not change: -1 (0 = sine-wave 1 = square-wave, 2 = triangle, 2= triangle, 3=sawtooth 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 Harmonies (-1 not change) +// EvenHarmonics: default: -1 (= 0) (0 = all harmonics, 1 = Only even harmonics) +// Enable : true or false ; + +var + newtable : boolean = false; +begin + StreamIn[InputIndex].Data.Enabled := Enable; + + if NbHarmonic <> -1 then + begin + StreamIn[InputIndex].Data.harmonic := NbHarmonic; + newtable := true; + end; + + if EvenHarmonics <> - 1 then + begin + if EvenHarmonics = 0 then + StreamIn[InputIndex].data.evenharm := 0 + else + StreamIn[InputIndex].data.evenharm := 1; + newtable := true; + end; + + if WaveTypeL <> -1 then + begin + StreamIn[InputIndex].Data.typLsine := WaveTypeL; + newtable := true; + end; + + if WaveTypeR <> -1 then + begin + StreamIn[InputIndex].Data.typRsine := WaveTypeR; + newtable := true; + end; + + if FrequencyL <> -1 then + begin + StreamIn[InputIndex].Data.freqLsine := FrequencyL ; + end; + + if FrequencyR <> -1 then + begin + StreamIn[InputIndex].Data.freqRsine := FrequencyR ; + end; + + if VolumeL <> -1 then + begin + StreamIn[InputIndex].Data.VLeft := VolumeL; + end; + + if VolumeR <> -1 then + begin + StreamIn[InputIndex].Data.Vright := VolumeR; + end; + + if Duration <> -1 then StreamIn[InputIndex].Data.dursine := + trunc( StreamIn[InputIndex].Data. + SampleRate * duration / 1000); + + if newtable then + begin + FillLookupTable(InputIndex,StreamIn[InputIndex].Data.typLsine, 1, + StreamIn[InputIndex].Data.harmonic, StreamIn[InputIndex].data.evenharm); + FillLookupTable(InputIndex,StreamIn[InputIndex].Data.typRsine, 2, + StreamIn[InputIndex].Data.harmonic, StreamIn[InputIndex].data.evenharm); + end; + +end; +{$endif} + +{$IF DEFINED(shout)} +function Tuos_Player.AddIntoIceServer(SampleRate : CDouble; Channels: cint; SampleFormat: cint; + EncodeType: cint; Port: cint; Host: pchar; User: pchar; + Password: pchar; MountFile :pchar): cint32; +// Add a Output into a IceCast server for audio-web-streaming +// SampleRate : delault : -1 (48100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// SampleFormat : -1 default : float32 : (0:float32, 1:Int16) +// EncodeType : default : -1 (0:Music) (0: Music, 1:Voice) +// Port : default : -1 (= 8000) +// Host : default : 'def' (= '127.0.0.1') +// User : default : 'def' (= 'source') +// Password : default : 'def' (= 'hackme') +// MountFile : default : 'def' (= '/example.opus') +// result : Output Index in array -1 = error + +var + x, typeenc : cint32; + err : integer = -1; + +begin + + result := -1 ; + x := 0; + err := -1; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + + StreamOut[x].Data.Enabled := false; + + if (EncodeType = -1) or (EncodeType = 0) then typeenc := OPUS_APPLICATION_AUDIO + else + typeenc := OPUS_APPLICATION_VOIP ; + + if SampleRate = -1 then StreamOut[x].Data.SampleRate := 48000 + else + StreamOut[x].Data.SampleRate := SampleRate; + + if Channels = -1 then StreamOut[x].Data.Channels := 2 + else + StreamOut[x].Data.Channels := Channels; + + if SampleFormat = -1 then StreamOut[x].Data.SampleFormat := 0 + else + StreamOut[x].Data.SampleFormat := SampleFormat; + + StreamOut[x].Data.TypePut := 2 ; + + setlength(StreamOut[x].Data.Buffer,1024 *2); + + // setlength(StreamOut[x].Data.Buffer,960); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('before opus_encoder_create ' ); + {$endif} + + // opus encoder + StreamOut[x].encoder := opus_encoder_create(StreamOut[x].Data.SampleRate, + StreamOut[x].Data.Channels, typeenc, err); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if (err<0) + then + begin + WriteLn(Format('failed to create an encoder: %s', [opus_strerror(err)])); + end; + {$endif} + // if (err=0) then + // err := opus_encoder_ctl(StreamOut[x].encoder , OPUS_SET_BITRATE(cBITRATE)); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if (err<0) + then + begin + WriteLn(Format('failed opus_encoder_ctl: %s', [opus_strerror(err)])); + end; + {$endif} + + if err =0 then + begin + + StreamOut[x].Data.HandleSt := Nil; + + shout_init(); + + StreamOut[x].Data.HandleSt := shout_new(); + + if assigned(StreamOut[x].Data.HandleSt) then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('shhandle assigned'); + {$endif} + err := shout_set_host( StreamOut[x].Data.HandleSt, pchar(Host)); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_host ok ' + inttostr(err)) + else + WriteLn('shout_set_host error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + err := shout_set_protocol(StreamOut[x].Data.HandleSt, SHOUT_PROTOCOL_HTTP); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_protocol ' + inttostr(err)) + else + WriteLn('shout_set_protocol error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt) + )); + {$endif} + err := shout_set_port(StreamOut[x].Data.HandleSt, Port); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_port ok ' + inttostr(err)) + else + WriteLn('shout_set_port error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + err := shout_set_password(StreamOut[x].Data.HandleSt, pchar(Password)); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('set_password ok ' + inttostr(err)) + else + WriteLn('set_password error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + err := shout_set_mount(StreamOut[x].Data.HandleSt, pchar(MountFile)); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_mount ok ' + inttostr(err)) + else + WriteLn('shout_set_mount error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + err := shout_set_user(StreamOut[x].Data.HandleSt, pchar(user)); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_user ok ' + inttostr(err)) + else + WriteLn('shout_set_user error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + err := shout_set_format(StreamOut[x].Data.HandleSt, SHOUT_FORMAT_OGG); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_format ok ' + inttostr(err)) + else + WriteLn('shout_set_format error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))) + ; + {$endif} + err := shout_open(StreamOut[x].Data.HandleSt); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_open ok ' + inttostr(err)) + else + WriteLn('shout_open error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + + if err = SHOUTERR_SUCCESS then + begin + StreamOut[x].Data.Enabled := True; + result := x + end + else + begin + shout_free(StreamOut[x].Data.HandleSt); + StreamOut[Length(StreamOut) - 1].Destroy; + setlength(StreamOut, Length(StreamOut) - 1); + end; + end + else + begin + StreamOut[Length(StreamOut) - 1].Destroy; + setlength(StreamOut, Length(StreamOut) - 1); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('shhandle not assigned') {$endif} ; + end; + end; +end; + {$endif} + +procedure uos_CustBufferInfos(Var bufferinfos: Tuos_BufferInfos; SampleRate: CDouble; SampleFormat + : cint32; Channels: cint32 ; Length: cint32); +begin + bufferinfos.SampleRate := Samplerate; + bufferinfos.SampleRateRoot := Samplerate; + bufferinfos.SampleFormat := SampleFormat; + bufferinfos.Channels := Channels; + bufferinfos.Length := Length; + bufferinfos.LibOpen := 0; + bufferinfos.Ratio := 2 ; +end; + + +function Tuos_Player.AddIntoFileFromMem(Filenamepath: PChar; SampleRate: CDouble; + Channels: LongInt; SampleFormat: LongInt; FramesCount: + LongInt; FileFormat: cint32): LongInt; +// Add a Output into audio wav file with Custom parameters +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : -1 default : Int16 : (1:Int32, 2:Int16) +// FramesCount : -1 default : 65536 div channels +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom); +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoFileFromMem(edit5.Text,-1,-1,0, -1); +var + x: LongInt; +begin + result := -1 ; + x := 0; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + StreamOut[x].Data.Enabled := false; + StreamOut[x].FileBuffer.ERROR := 0; + StreamOut[x].Data.Filename := Filenamepath; + if (FileFormat = -1) or (FileFormat = 0) then + StreamOut[x].FileBuffer.FileFormat := 0 + else StreamOut[x].FileBuffer.FileFormat := FileFormat; + StreamOut[x].Data.TypePut := 4; + FillChar(StreamOut[x].FileBuffer, sizeof(StreamOut[x].FileBuffer), 0); + StreamOut[x].FileBuffer.DataMS := TMemoryStream.Create; + + result := x; + + if (Channels = -1) then + StreamOut[x].FileBuffer.wChannels := 2 + else + StreamOut[x].FileBuffer.wChannels := Channels; + + StreamOut[x].Data.Channels := StreamOut[x].FileBuffer.wChannels; + + if FramesCount = -1 then StreamOut[x].Data.Wantframes := 65536 Div StreamOut[x].Data.Channels + else + StreamOut[x].Data.Wantframes := FramesCount ; + + SetLength(StreamOut[x].Data.Buffer, StreamOut[x].Data.Wantframes*StreamOut[x].Data.Channels); + + if (SampleFormat = -1) or (SampleFormat = 2) then + begin + StreamOut[x].FileBuffer.wBitsPerSample := 16; + StreamOut[x].Data.SampleFormat := 2; + end; + + if (SampleFormat = 1) then + begin + StreamOut[x].FileBuffer.wBitsPerSample := 32; + StreamOut[x].Data.SampleFormat := 1; + end; + + if SampleRate = -1 then + StreamOut[x].FileBuffer.wSamplesPerSec := 44100 + else + StreamOut[x].FileBuffer.wSamplesPerSec := roundmath(samplerate); + + StreamOut[x].Data.Samplerate := StreamOut[x].FileBuffer.wSamplesPerSec; + StreamOut[x].LoopProc := Nil; + StreamOut[x].Data.Enabled := True; +end; + +function Tuos_Player.AddIntoFile(Filenamepath: PChar; SampleRate: CDouble; + Channels: cint32; SampleFormat: cint32 ; FramesCount: cint32 ; + FileFormat: cint32): cint32; +// Add a Output into audio wav file with custom parameters +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) +// FramesCount : default : -1 (= 4096) +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg); +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoFile(edit5.Text,-1,-1, 0, -1, -1); +var + x: cint32; + wChunkSize: cint32; + wFileSize: cint32; + IDwav: array[0..3] of char; + Header: Tuos_WaveHeaderChunk; + {$IF DEFINED(sndfile)} + sfInfo: TSF_INFO; + {$endif} + +begin + result := -1 ; + x := 0; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + StreamOut[x].Data.Enabled := false; + StreamOut[x].FileBuffer.ERROR := 0; + StreamOut[x].Data.Filename := filenamepath; + if (FileFormat = -1) or (FileFormat = 0) then + StreamOut[x].FileBuffer.FileFormat := 0 + else StreamOut[x].FileBuffer.FileFormat := FileFormat; + + FillChar(StreamOut[x].FileBuffer, sizeof(StreamOut[x].FileBuffer), 0); + + result := x; + + if (Channels = -1) then + StreamOut[x].FileBuffer.wChannels := 2 + else + StreamOut[x].FileBuffer.wChannels := Channels; + + StreamOut[x].Data.Channels := StreamOut[x].FileBuffer.wChannels; + + if FramesCount = -1 then StreamOut[x].Data.Wantframes := 65536 Div StreamOut[x].Data.Channels + else + StreamOut[x].Data.Wantframes := FramesCount ; + + SetLength(StreamOut[x].Data.Buffer, StreamOut[x].Data.Wantframes*StreamOut[x].Data.Channels); + + if (SampleFormat = -1) or (SampleFormat = 2) then + begin + StreamOut[x].FileBuffer.wBitsPerSample := 16; + StreamOut[x].Data.SampleFormat := 2; + end; + + if (SampleFormat = 1) then + begin + StreamOut[x].FileBuffer.wBitsPerSample := 32; + StreamOut[x].Data.SampleFormat := 1; + end; + + if (SampleFormat = 0) then + begin + StreamOut[x].FileBuffer.wBitsPerSample := 32; + StreamOut[x].Data.SampleFormat := 0; + end; + + if SampleRate = -1 then + StreamOut[x].FileBuffer.wSamplesPerSec := 44100 + else + StreamOut[x].FileBuffer.wSamplesPerSec := roundmath(samplerate); + + StreamOut[x].Data.Samplerate := StreamOut[x].FileBuffer.wSamplesPerSec; + StreamOut[x].LoopProc := Nil; + + if fileformat = 3 then + begin + // ogg file + {$IF DEFINED(sndfile)} + StreamOut[x].FileBuffer.FileFormat := 3; + StreamOut[x].Data.TypePut := 6 ; + sfInfo.format := SF_FORMAT_OGG Or SF_FORMAT_VORBIS; + sfInfo.channels := StreamOut[x].Data.Channels; + sfInfo.frames := streamOut[x].Data.Wantframes; + SFinfo.samplerate := StreamOut[x].FileBuffer.wSamplesPerSec; + SFinfo.seekable := 0; + StreamOut[x].Data.Enabled := True; + StreamOut[x].Data.HandleSt := sf_open(pchar(FileNamepath), SFM_WRITE, sfInfo); + {$endif} + end + else + begin + // wav file + StreamOut[x].FileBuffer.Data := TFileStream.Create(filenamepath,fmCreate); + StreamOut[x].FileBuffer.Data.Seek(0, soFromBeginning); + StreamOut[x].Data.TypePut := 0 ; + IDwav := 'RIFF'; + StreamOut[x].FileBuffer.Data.WriteBuffer(IDwav, 4); + wFileSize := 0; + StreamOut[x].FileBuffer.Data.WriteBuffer(wFileSize, 4); + IDwav := 'WAVE'; + StreamOut[x].FileBuffer.Data.WriteBuffer(IDwav, 4); + IDwav := 'fmt '; + StreamOut[x].FileBuffer.Data.WriteBuffer(IDwav, 4); + wChunkSize := SizeOf(Header); + StreamOut[x].FileBuffer.Data.WriteBuffer(wChunkSize, 4); + Header.wFormatTag := 1; + + Header.wChannels := StreamOut[x].FileBuffer.wChannels; + + Header.wSamplesPerSec := StreamOut[x].FileBuffer.wSamplesPerSec; + + Header.wBlockAlign := StreamOut[x].FileBuffer.wChannels * (StreamOut[x].FileBuffer. + wBitsPerSample Div 8); + + Header.wAvgBytesPerSec := StreamOut[x].FileBuffer.wSamplesPerSec * Header.wBlockAlign; + Header.wBitsPerSample := StreamOut[x].FileBuffer.wBitsPerSample; + Header.wcbSize := 0; + StreamOut[x].FileBuffer.Data.WriteBuffer(Header, SizeOf(Header)); + IDwav := 'data'; + StreamOut[x].FileBuffer.Data.WriteBuffer(IDwav, 4); + wChunkSize := 0; + StreamOut[x].FileBuffer.Data.WriteBuffer(wChunkSize, 4); + StreamOut[x].Data.Enabled := True; + + end; +end; + +function Tuos_Player.AddIntoMemoryBuffer(outmemory: PDArFloat): cint32; +// Add a Output into memory-bufffer +// outmemory : buffer to use to store memory buffer +// example : OutputIndex1 := AddIntoMemoryBuffer(bufmemory); + +var + x: integer; +begin + result := -1 ; + x := 0; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + StreamOut[x].Data.Enabled := false; + StreamOut[x].Data.TypePut := 3; + Streamout[x].Data.posmem := 0; + Streamout[x].BufferOut := outmemory; + StreamOut[x].Data.channels := 2; + StreamOut[x].Data.Wantframes := 65536 ; + StreamOut[x].Data.SampleFormat := 0; + StreamOut[x].Data.SampleRate := 44100 ; + SetLength(StreamOut[x].Data.Buffer,65536*2); + intobuf := true; + // to check, why ? + result := x; + StreamOut[x].Data.Enabled := True; +end; + +function Tuos_Player.AddIntoMemoryBuffer(outmemory: PDArFloat; SampleRate: CDouble; SampleFormat: + LongInt; + Channels: LongInt; FramesCount: LongInt): LongInt; +// Add a Output into Memory Buffer with parameters. +// outmemory : pointer of buffer to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (0:Float32) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 65536) + +var + x, ch, sr, sf, fr: integer; +begin + result := -1 ; + x := 0; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + StreamOut[x].Data.Enabled := false; + StreamOut[x].Data.TypePut := 3; + Streamout[x].Data.posmem := 0; + Streamout[x].BufferOut := outmemory; + if channels = -1 then ch := 2 + else ch := channels; + StreamOut[x].Data.channels := ch; + if SampleFormat = -1 then sf := 0 + else sf := SampleFormat; + StreamOut[x].Data.SampleFormat := sf; + if FramesCount = -1 then fr := 65536 + else fr := FramesCount; + StreamOut[x].Data.Wantframes := fr ; + if SampleRate = -1 then sr := 44100 + else sr := roundmath(SampleRate); + StreamOut[x].Data.SampleRate := sr ; + + SetLength(StreamOut[x].Data.Buffer,fr*ch); + intobuf := true; + // to check, why ? + result := x; + StreamOut[x].Data.Enabled := True; +end; + + {$IF DEFINED(portaudio)} +function Tuos_Player.AddIntoDevOut(Device: cint32; Latency: CDouble; + SampleRate: CDouble; Channels: cint32; SampleFormat: cint32 ; + FramesCount: cint32 ; ChunkCount: cint32): cint32; +// 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 (= 65536) +// ChunkCount : default : -1 (= 512) +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoDevOut(-1,-1,-1,-1,0,-1,-1); +var + x, x2, err: cint32; + +begin + result := -1 ; + + if device = -1 then + err := Pa_GetDefaultOutputDevice(); + if err = -1 then result := -2; + + if result <> -2 then + begin + x := 0; + err := -1; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + + StreamOut[x].Data.Enabled := false; + + {$IF DEFINED(portaudio)} + StreamOut[x].PAParam.hostApiSpecificStreamInfo := Nil; + if device = -1 then + StreamOut[x].PAParam.device := Pa_GetDefaultOutputDevice() + else + StreamOut[x].PAParam.device := device; + {$endif} + + if SampleRate = -1 then + StreamOut[x].Data.SampleRate := DefRate + else + StreamOut[x].Data.SampleRate := SampleRate; + + {$IF DEFINED(portaudio)} + + if Latency = -1 then + StreamOut[x].PAParam.SuggestedLatency := CDouble((Pa_GetDeviceInfo(StreamOut[x].PAParam. + device)^. defaultHighOutputLatency)) * 1 + else StreamOut[x].PAParam.SuggestedLatency := CDouble(Latency); + + + {$IF DEFINED(android)} + StreamOut[x].PAParam.SampleFormat := paFloat32; + {$else} + StreamOut[x].PAParam.SampleFormat := paInt16; + {$endif} + + case SampleFormat of + 0: StreamOut[x].PAParam.SampleFormat := paFloat32; + 1: StreamOut[x].PAParam.SampleFormat := paInt32; + 2: StreamOut[x].PAParam.SampleFormat := paInt16; + end; + {$endif} + + if SampleFormat = -1 then + StreamOut[x].Data.SampleFormat := 2 + else + StreamOut[x].Data.SampleFormat := SampleFormat; + + if Channels = -1 then + begin + {$IF DEFINED(portaudio)} + StreamOut[x].PAParam.channelCount := 2 ; + {$endif} + StreamOut[x].Data.Channels := 2 ; + end + else + begin + {$IF DEFINED(portaudio)} + StreamOut[x].PAParam.channelCount := CInt32(Channels); + {$endif} + StreamOut[x].Data.Channels := CInt32(Channels); + end; + + if FramesCount = -1 then StreamOut[x].Data.Wantframes := + + {$IF DEFINED(android)} + 1024 * 64 + else + {$else} + 65536 div StreamOut[x].Data.Channels + else + {$endif} + StreamOut[x].Data.Wantframes := FramesCount ; + + if ChunkCount = -1 then ChunkCount := 512; + + SetLength(StreamOut[x].Data.Buffer, StreamOut[x].Data.Wantframes*StreamOut[x].Data.Channels); + + x2 := 0 ; + while x2 < Length(StreamOut[x].Data.Buffer) do + begin + StreamOut[x].Data.Buffer[x2] := 0.0 ; + inc(x2); + end; + + StreamOut[x].Data.TypePut := 1; + + {$IF DEFINED(portaudio)} + err := Pa_OpenStream(@StreamOut[x].Data.HandleSt, Nil, @StreamOut[x].PAParam, CDouble( + StreamOut[x] + .Data.SampleRate), CULong(ChunkCount), paClipOff, Nil, Nil); + + +// err := Pa_OpenDefaultStream(@StreamOut[x].Data.HandleSt, 2, 2, paFloat32, DefRate, 512, nil, nil); + {$endif} + + StreamOut[x].LoopProc := Nil; + if err <> 0 then Result := -1 + else + begin + StreamOut[x].Data.Enabled := True; + Result := x; + end; + end + else Result := -1; +end; + + {$endif} + +{$IF DEFINED(webstream)} + +function Tuos_Player.AddFromURL(URL: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ; AudioFormat: cint32 ; + ICYon : boolean): cint32; +// Add a Input from Audio URL +// URL : URL of audio file + +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output +// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : default : -1 (4096) +// AudioFormat : default : -1 (mp3) (0: mp3, 1: opus, 2:aac) +// ICYon : ICY data on/off +// example : InputIndex := AddFromURL('http://someserver/somesound.mp3',-1,-1,-1,-1,-1, false); + +var + x, err, len, len2, i : cint32; + PipeBufferSize, totsamples : integer; + buffadd : tbytes; + samprat : cint32; + + {$IF DEFINED(mpg123)} + mpinfo: Tmpg123_frameinfo; + // BufferTag: array[1..128] of char; + // F: file; + // mpid3v2: Tmpg123_id3v2; + {$endif} + + {$IF DEFINED(opus)} + s: UTF8String; + j: Integer; + OpusTag: POpusTags; + LComment: PPAnsiChar; + LcommentLength: PInteger; + {$endif} + +begin + result := -1 ; + x := 0; + err := -1; + + SetLength(StreamIn, Length(StreamIn) + 1); + + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + + StreamIn[x].Data.Enabled := false; + + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + + {$IF DEFINED(fdkaac)} + if (AudioFormat = 2) + then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Begin fdkaac'); + {$endif} + + + PipeBufferSize := 1024 * 4; + + CreatePipeHandles(StreamIn[x].InHandle, StreamIn[x].OutHandle, PipeBufferSize); + + StreamIn[x].InPipe := TInputPipeStream.Create(StreamIn[x].InHandle); + StreamIn[x].OutPipe := TOutputPipeStream.Create(StreamIn[x].OutHandle); + + + + StreamIn[x].httpget := TThreadHttpGetter.Create(url, StreamIn[x].OutPipe); + + StreamIn[x].httpget.freeonterminate := true; + + StreamIn[x].httpget.ICYenabled := ICYon; + + //writeln('avant httpget.Start'); + StreamIn[x].httpget.Start; + // writeln('apres httpget.Start'); + + sleep(2000); + + if StreamIn[x].httpget.IsRunning then + begin + + if StreamIn[x].httpget.ICYenabled = true then + CheckSynchronize(1000); + + StreamIn[x].Data.HandleSt := aacDecoder_Open(TRANSPORT_TYPE.TT_MP4_ADTS, 1); + + if StreamIn[x].Data.HandleSt = nil then + begin + // writeln('NOT OK aacDecoder_Open()'); + exit; + end; + // else writeln('OK aacDecoder_Open()'); + + if (aacDecoder_SetParam(StreamIn[x].Data.HandleSt, AAC_CONCEAL_METHOD, 1) <> AAC_DECODER_ERROR + .AAC_DEC_OK) then + begin + // writeln('Unable to set the AAC_CONCEAL_METHOD'); + exit; + end; + + if (aacDecoder_SetParam(StreamIn[x].Data.HandleSt, AAC_PCM_LIMITER_ENABLE, 0) <> + AAC_DECODER_ERROR.AAC_DEC_OK) then + begin + // writeln('Unable to set the AAC_PCM_LIMITER_ENABLE'); + exit; + end; + + // writeln('FIN INIT ------------- AACDecDecode'); + + StreamIn[x].Data.LibOpen := 2; + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else StreamIn[x].Data.SampleFormat := SampleFormat; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 + else + StreamIn[x].Data.Wantframes := FramesCount ; + + StreamIn[x].Data.Channels := 2; + StreamIn[x].Data.samplerate := 44100; + StreamIn[x].Data.ratio := 2; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes * StreamIn[x].Data.channels); + + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := 0; + StreamIn[x].Data.TypePut := 2; + StreamIn[x].Data.seekable := false; + Err := 0; + + end else + begin + result := -1; + StreamIn[x].httpget.Terminate; + sleep(100); + StreamIn[x].inpipe.destroy; + StreamIn[x].outpipe.destroy; + end; + // writeln('----------- FIN add URL -------------' ); + + end; + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('ac StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + {$endif} + + ////////////////// end aac + + {$IF DEFINED(opus)} + if (AudioFormat = 1) + // or (AudioFormat = -1) + then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Begin opus test'); + {$endif} + + if FramesCount= -1 then + totsamples := 4096 + else + totsamples := FramesCount; + + PipeBufferSize := totsamples * sizeOf(Single); + // * 2 + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('totsamples: ' + inttostr(totsamples)); + WriteLn('PipeBufferSize: ' + inttostr(PipeBufferSize)); + {$endif} + + CreatePipeHandles(StreamIn[x].InHandle, StreamIn[x].OutHandle, PipeBufferSize); + StreamIn[x].InPipe := TInputPipeStream.Create(StreamIn[x].InHandle); + StreamIn[x].OutPipe := TOutputPipeStream.Create(StreamIn[x].OutHandle); + + StreamIn[x].httpget := TThreadHttpGetter.Create(url, StreamIn[x].OutPipe); + StreamIn[x].httpget.freeonterminate := true; + StreamIn[x].httpget.ICYenabled := false; + // TODO + + // StreamIn[x].httpget.FIsRunning := True; + + StreamIn[x].httpget.Start; + // WriteLn('StreamIn[x].httpget.Start'); + + sleep(2000); + + if StreamIn[x].httpget.IsRunning then + begin + + len := 1 ; + len2 := 0 ; + + setlength(buffadd, PipeBufferSize); + setlength(StreamIn[x].data.BufferTMP, PipeBufferSize); + + while (len2 < PipeBufferSize) and (len > 0) do + begin + len := StreamIn[x].InPipe.Read(buffadd[0],PipeBufferSize-len2); + if len > 0 then for i := 0 to len -1 do + StreamIn[x].data.BufferTMP[i+len2] := buffadd[i] ; + len2 := len2 + len; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('PipeBufferSize = ' + inttostr(PipeBufferSize)); + WriteLn('InPipe.Read = ' + inttostr(len2)); + WriteLn('----------------------------------'); + //writeln(tencoding.utf8.getstring(StreamIn[x].data.BufferTMP)); + {$endif} + + StreamIn[x].Data.HandleSt := pchar('opusurl'); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('StreamIn[x].Data.HandleSt url assisgned'); + {$endif} + + StreamIn[x].Data.HandleOP := + + +// op_open_callbacks(StreamIn[x].InPipe, uos_callbacks, StreamIn[x].data.BufferTMP[0], PipeBufferSize, err); + op_test_callbacks(StreamIn[x].InPipe, uos_callbacks, StreamIn[x]. + data.BufferTMP[0], PipeBufferSize, err); + // op_test_memory(StreamIn[x].data.BufferTMP[0],PipeBufferSize, Err); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('error: op_test_*: ' + inttostr(err)); + {$endif} + + if Err=0 + then + begin + Err := op_test_open(StreamIn[x].Data.HandleOP); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('error: op_test_open: ' + inttostr(err)); + {$endif} + + if (Err=0) and (op_link_count(StreamIn[x].Data.HandleOP)=1) + then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('OK open'); + {$endif} + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + //tag + + OpusTag := op_tags(StreamIn[x].Data.HandleOP, Nil); + + if OpusTag<>nil + + then + begin + + if OpusTag^.comments>0 + then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn((Format('OpusTag.comments = %d', [OpusTag^.comments]))); + {$endif} + LComment := OpusTag^.user_comments; + LcommentLength := OpusTag^.comment_lengths; + + for j := 0 to OpusTag^.comments - 1 do + begin + SetLength(s, LcommentLength^); + move(Pointer(LComment^)^, Pointer(s)^, LcommentLength^); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn(s); + {$endif} + if j = 1 then StreamIn[x].Data.title := s; + if j = 2 then StreamIn[x].Data.artist := s; + if j = 3 then StreamIn[x].Data.album := s; + if j = 4 then StreamIn[x].Data.date := s; + if j = 5 then StreamIn[x].Data.comment := s; + if j = 6 then StreamIn[x].Data.tag := s; + if j > 6 then StreamIn[x].Data.comment := StreamIn[x].Data.comment + ' ' + + s; + + inc(LComment); + inc(LcommentLength); + end; + end; + end; + + StreamIn[x].Data.Length := op_pcm_total(StreamIn[x].Data.HandleOP, Nil); + StreamIn[x].Data.filename := url; + StreamIn[x].Data.channels := op_channel_count(StreamIn[x].Data.HandleOP, Nil); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn((Format('op_bitrate = %d', [op_bitrate(StreamIn[x].Data.HandleOP, Nil)]))); + WriteLn('Length ' + inttostr(StreamIn[x].Data.Length)); + WriteLn('Data.Channels ' + inttostr(StreamIn[x].Data.channels)); + {$endif} + + StreamIn[x].Data.samplerate := 48000 ; + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.Wantframes := totsamples ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes); + + StreamIn[x].Data.LibOpen := 4; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.TypePut := 2; + StreamIn[x].Data.ratio := 1; + StreamIn[x].Data.seekable := false; + StreamIn[x].LoopProc := Nil; + StreamIn[x].Data.Enabled := True; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('End opus'); + {$endif} + + end; + end; + end else + begin + result := -1; + StreamIn[x].httpget.Terminate; + sleep(100); + StreamIn[x].inpipe.destroy; + StreamIn[x].outpipe.destroy; + end; + end; + {$endif} + + {$IF DEFINED(mpg123)} + if (StreamIn[x].Data.LibOpen = -1) and ((AudioFormat = 0) or (AudioFormat = -1)) then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Begin mpg123'); + {$endif} + + if FramesCount= -1 then + totsamples := $4000 + else + totsamples := FramesCount; + + PipeBufferSize := totsamples ; + + CreatePipeHandles(StreamIn[x].InHandle, StreamIn[x].OutHandle, PipeBufferSize); + + StreamIn[x].InPipe := TInputPipeStream.Create(StreamIn[x].InHandle); + StreamIn[x].OutPipe := TOutputPipeStream.Create(StreamIn[x].OutHandle); + + StreamIn[x].httpget := TThreadHttpGetter.Create(url, StreamIn[x].OutPipe); + + // if StreamIn[x].httpget = nil then writeln('httpget = NIL') else writeln('httpget = OK'); + + StreamIn[x].httpget.freeonterminate := true; + + StreamIn[x].httpget.ICYenabled := ICYon; + + if StreamIn[x].httpget.ICYenabled = true then + StreamIn[x].UpdateIcyMetaInterval ; + + StreamIn[x].httpget.Start; + + sleep(2000); + + if StreamIn[x].httpget.IsRunning then + begin + if StreamIn[x].httpget.ICYenabled = true then + CheckSynchronize(1000); + + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then writeln('===> mpg123_new => ok.') + else writeln('===> mpg123_new NOT ok.') ; + {$endif} + + if Err = 0 then + begin + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + mpg123_format_none(StreamIn[x].Data.HandleSt); + case StreamIn[x].Data.SampleFormat of + 0: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_FLOAT_32); + 1: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_SIGNED_32); + 2: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_SIGNED_16); + end; + + + +// mpg123_replace_reader_handle(StreamIn[x].Data.HandleSt, @mpg_read_stream, @mpg_seek_url, @mpg_close_stream); + mpg123_replace_reader_handle(StreamIn[x].Data.HandleSt, + @mpg_read_stream, @mpg_seek_url, Nil); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then writeln('===> mpg123_replace_reader_handle => ok.') ; + {$endif} + + Err := mpg123_open_handle(StreamIn[x].Data.HandleSt, Pointer(StreamIn[x].InPipe)); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then writeln('===> mpg123_open_handle => ok.') + else + writeln('===> mpg123_open_handle => NOT ok.') ; + {$endif} + + sleep(10); + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_open_handle all => ok.') + else + writeln('===> mpg123_open_handle all => NOT ok.'); + {$endif} + + if err = 0 then + begin + StreamIn[x].Data.filename := URL ; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 1024 + else + StreamIn[x].Data.Wantframes := FramesCount ; + + // StreamIn[x].Data.Wantframes := totsamples; + + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.TypePut := 2; + StreamIn[x].Data.seekable := false; + StreamIn[x].LoopProc := Nil; + + samprat := roundmath(StreamIn[x].Data.samplerate); + + Err := mpg123_getformat(StreamIn[x].Data.HandleSt, + samprat, StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_getformat => ok.') + else + writeln('===> mpg123_getformat => NOT ok.'); + {$endif} + + if err <> 0 then + begin + sleep(50); + samprat := roundmath(StreamIn[x].Data.samplerate); + + Err := mpg123_getformat(StreamIn[x].Data.HandleSt, + samprat, StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + + end; + if err = 0 then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('===> mpg123_getformat => ok'); + {$endif} + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + + StreamIn[x].Data.LibOpen := 1; + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + if StreamIn[x].Data.SampleFormat = 2 then + StreamIn[x].Data.ratio := sizeof(int16) + else + StreamIn[x].Data.ratio := sizeof(int32); + + mpg123_info(StreamIn[x].Data.HandleSt, MPinfo); + + // problems with mpg123 + // mpg123_id3(StreamIn[x].Data.HandleSt, mpid3v1, @mpid3v2); + // mpg123_icy(StreamIn[x].Data.HandleSt, pointer(icytext)); + + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.hdformat := MPinfo.layer; + StreamIn[x].Data.frames := MPinfo.framesize; + StreamIn[x].Data.Length := mpg123_length(StreamIn[x].Data.HandleSt); + + if StreamIn[x].Data.SampleFormat = 0 then + mpg123_param(StreamIn[x].Data.HandleSt, StreamIn[x].Data.Channels, + MPG123_FORCE_FLOAT, 0); + + StreamIn[x].Data.Enabled := True; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('===> mpg123_infos end => ok'); + {$endif} + + end; + end; + end else + begin + result := -1; + StreamIn[x].httpget.Terminate; + sleep(100); + StreamIn[x].inpipe.destroy; + StreamIn[x].outpipe.destroy; + end; + + end; + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before result ' + inttostr(result)); + WriteLn('error ' + inttostr(err)); + WriteLn('StreamIn[x].Data.LibOpen ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('Before Length(StreamIn) ' + inttostr(Length(StreamIn))); + {$endif} + sleep(10); + if StreamIn[x].Data.LibOpen = -1 then + begin + if err <> -133 then + begin + StreamIn[Length(StreamIn) - 1].Destroy; + setlength(StreamIn, Length(StreamIn) - 1); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('After Length(StreamIn) ' + inttostr(Length(StreamIn))); + WriteLn('Result: ' + inttostr(result)); + {$endif} + end; + + result := -1 + end + else + begin + StreamIn[x].Data.Enabled := True; + result := x ; + end; +end; + {$ENDIF} + +function Tuos_Player.AddFromMemoryBuffer(Var MemoryBuffer: TDArFloat; Var Bufferinfos: + Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// Add a input from memory buffer with custom parameters +// MemoryBuffer : the buffer +// Bufferinfos : infos of the buffer + +// 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 ';')// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)// SampleRate : delault : -1 (44100) +// FramesCount : default : -1 (65536 div Channels) +// result : Input Index in array -1 = error +// example : InputIndex1 := AddFromMemoryBuffer(mybuffer, buffinfos,-1,1024); + +var + x : cint32; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st: string; + i : cint32; + {$endif} +begin + + result := -1 ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('AddFromMemoryBuffer Before all.'); + writeln('length(MemoryBuffer) =' +inttostr(length(MemoryBuffer))); + st := ''; + for i := 0 to length(MemoryBuffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(MemoryBuffer[i]); + WriteLn(st); + {$endif} + + // writeln('length(MemoryBuffer) =' +inttostr(length(MemoryBuffer))); + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.typeput := 4; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + + +{ + setlength(StreamIn[x].Data.memorybuffer, length(MemoryBuffer)); + + writeln('length(Data.memorybuffer) =' +inttostr(length(StreamIn[x].Data.memorybuffer))); + + for i := 0 to length(MemoryBuffer) -1 do + StreamIn[x].Data.memorybuffer[i] := MemoryBuffer[i]; + } + + StreamIn[x].Data.memorybuffer := MemoryBuffer; + + sleep(50); + //TODO: it is necessary? + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('AddFromMemoryBuffer Before all.'); + writeln('length(MemoryBuffer) =' +inttostr(length(MemoryBuffer))); + st := ''; + for i := 0 to length(MemoryBuffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(StreamIn[x].Data.memorybuffer[i]); + WriteLn(st); + {$endif} + + StreamIn[x].Data.Length := length(MemoryBuffer); + StreamIn[x].Data.LibOpen := 0; + + StreamIn[x].Data.Channels := Bufferinfos.Channels; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 4096 + else + StreamIn[x].Data.Wantframes := FramesCount; + + StreamIn[x].Data.Samplerate := bufferinfos.SampleRate; + StreamIn[x].Data.SampleRateRoot := Bufferinfos.Samplerate; + StreamIn[x].Data.SampleFormat := Bufferinfos.SampleFormat; + StreamIn[x].Data.Filename := BufferInfos.Filename; + StreamIn[x].Data.Title := BufferInfos.Title; + StreamIn[x].Data.Copyright := BufferInfos.Copyright; + StreamIn[x].Data.Software := BufferInfos.Software; + StreamIn[x].Data.Artist := BufferInfos.Artist; + StreamIn[x].Data.Comment := BufferInfos.Comment; + StreamIn[x].Data.Date := BufferInfos.Date; + StreamIn[x].Data.Tag := BufferInfos.Tag; + StreamIn[x].Data.track := BufferInfos.track; + StreamIn[x].Data.Album := BufferInfos.Album; + StreamIn[x].Data.Genre := BufferInfos.Genre; + StreamIn[x].Data.HDFormat := BufferInfos.HDFormat; + StreamIn[x].Data.Sections := BufferInfos.Sections; + StreamIn[x].Data.Encoding := BufferInfos.Encoding; + StreamIn[x].Data.bitrate := BufferInfos.bitrate; + //StreamIn[x].Data.Length := BufferInfos.Length; + StreamIn[x].Data.LibOpen := 0; + StreamIn[x].Data.ratio := StreamIn[x].Data.Channels; + + StreamIn[x].Data.posmem := 0; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.seekable := true; + StreamIn[x].LoopProc := Nil; + setlength(StreamIn[x].Data.buffer,StreamIn[x].Data.wantframes*StreamIn[x].Data.Channels); + StreamIn[x].Data.Enabled := True; + result := x; +end; + +function Tuos_Player.AddFromFileIntoMemory(Filename: Pchar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32; numbuf : cint +): cint32; +// Add a input from audio file and store it into memory with custom parameters +// FileName : filename of audio file + +// 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 := AddFromFileIntoMemory(edit5.Text,-1,0,-1); +var + x, i : cint32; + bufferinfos: Tuos_bufferinfos; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st: string; + {$endif} + +begin + result := -1 ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('AddFromFileIntoMemory Before all.'); + {$endif} + + if fileexists(filename) then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before setlength.'); + {$endif} + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.typeput := 4; + StreamIn[x].Data.lastbuf := 0; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + // StreamIn[x].Data.wantframes := FramesCount; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Before Filetobuffer'); + {$endif} + + for i := 0 to length(tempoutmemory) -1 do + tempoutmemory[i] := 0.0; + + setlength(tempoutmemory, 0); + + Filetobuffer(Filename, -1, SampleFormat, FramesCount, tempoutmemory, bufferinfos, -1, numbuf); + sleep(50); + + setlength(StreamIn[x].Data.memorybuffer, length(tempoutmemory)); + for i := 0 to length(tempoutmemory) -1 do + StreamIn[x].Data.memorybuffer[i] := tempoutmemory [i]; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('After Filetobuffer'); + writeln('length(tempoutmemory) =' +inttostr(length(tempoutmemory))); + st := ''; + for i := 0 to length(tempoutmemory) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(tempoutmemory[i]); + WriteLn('OUTPUT DATA into portaudio------------------------------'); + WriteLn(st); + {$endif} + + StreamIn[x].Data.Length := tempLength; + StreamIn[x].Data.Samplerate := tempSamplerate; + StreamIn[x].Data.SampleFormat := tempSampleFormat; + StreamIn[x].Data.LibOpen := tempLibOpen; + StreamIn[x].Data.Channels := tempchan; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + StreamIn[x].Data.ratio := tempratio; + StreamIn[x].Data.posmem := 0; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.seekable := true; + StreamIn[x].LoopProc := Nil; + StreamIn[x].Data.Samplerate := bufferinfos.SampleRate; + StreamIn[x].Data.SampleRateRoot := Bufferinfos.Samplerate; + StreamIn[x].Data.SampleFormat := Bufferinfos.SampleFormat; + StreamIn[x].Data.Filename := BufferInfos.Filename; + StreamIn[x].Data.Title := BufferInfos.Title; + StreamIn[x].Data.Copyright := BufferInfos.Copyright; + StreamIn[x].Data.Software := BufferInfos.Software; + StreamIn[x].Data.Artist := BufferInfos.Artist; + StreamIn[x].Data.Comment := BufferInfos.Comment; + StreamIn[x].Data.Date := BufferInfos.Date; + StreamIn[x].Data.Tag := BufferInfos.Tag; + StreamIn[x].Data.Album := BufferInfos.Album; + StreamIn[x].Data.Genre := BufferInfos.Genre; + StreamIn[x].Data.track := BufferInfos.track; + StreamIn[x].Data.HDFormat := BufferInfos.HDFormat; + StreamIn[x].Data.Sections := BufferInfos.Sections; + StreamIn[x].Data.Encoding := BufferInfos.Encoding; + StreamIn[x].Data.bitrate := BufferInfos.bitrate; + StreamIn[x].Data.Length := BufferInfos.Length; + StreamIn[x].Data.LibOpen := 0; + StreamIn[x].Data.Ratio := 2 ; + + setlength(StreamIn[x].Data.buffer,StreamIn[x].Data.wantframes*StreamIn[x].Data.Channels); + StreamIn[x].Data.Enabled := True; + result := x; + end + else result := -2; + +end; + +{$IF DEFINED(sndfile)} +function m_get_filelen(pms: PMemoryStream): tuos_count_t; +cdecl; +begin + Result := pms^.Size; +end; + +function m_seek(offset: tuos_count_t; whence: cint32; pms: PMemoryStream): tuos_count_t; +cdecl; +const + SEEK_SET = 0; + SEEK_CUR = 1; + SEEK_END = 2; +begin + Result := 0 ; + case whence of + SEEK_SET: Result := pms^.Seek(offset, soFromBeginning); + SEEK_CUR: Result := pms^.Seek(offset, soFromCurrent); + SEEK_END: Result := pms^.Seek(offset, soFromEnd); + end; + +end; + +function m_read(Const buf: Pointer; count: Tuos_count_t; pms: PMemoryStream): Tuos_count_t; +cdecl; + +begin + Result := pms^.Read(buf^,count); +end; + +function m_write(Const buf: Pointer; count: Tuos_count_t; pms: PMemoryStream): Tuos_count_t; +cdecl; +begin + Result := pms^.Write(buf^,count); +end; + +function m_tell(pms: PMemoryStream): Tuos_count_t; +cdecl; +begin + Result := pms^.Position; +end; +{$endif} + +function Tuos_Player.AddIntoMemoryStream(Var MemoryStream: TMemoryStream; SampleRate: CDouble; + SampleFormat: LongInt ; Channels: LongInt; FramesCount: + LongInt; AudioFormat: cint32): LongInt; +// Add a Output into TMemoryStream +// MemoryStream : the TMemoryStream to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 4096) +// AudioFormat : default : -1 (wav) (0:wav, 1:ogg); + +var + x, ch, sr, sf, fr: integer; + {$IF DEFINED(sndfile)} + sfInfo: TSF_INFO; + sfVirtual: TSF_VIRTUAL; + {$endif} + +begin + result := -1 ; + x := 0; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + StreamOut[x].Data.Enabled := false; + + if channels = -1 then ch := 2 + else ch := channels; + StreamOut[x].Data.channels := ch; + if SampleFormat = -1 then sf := 2 + else sf := SampleFormat; + StreamOut[x].Data.SampleFormat := sf; + if FramesCount = -1 then fr := 4096 + else fr := FramesCount; + StreamOut[x].Data.Wantframes := fr ; + if SampleRate = -1 then sr := 44100 + else sr := roundmath(SampleRate); + StreamOut[x].Data.SampleRate := sr ; + + SetLength(StreamOut[x].Data.Buffer, StreamOut[x].Data.Wantframes*StreamOut[x].Data.Channels); + + if MemoryStream = nil then + MemoryStream := Tmemorystream.create; + + Streamout[x].MemorySteamOut := MemoryStream; + + Streamout[x].Data.posmem := 0; + + StreamOut[x].Data.TypePut := 5; + + {$IF DEFINED(sndfile)} + with sfVirtual do + begin + sf_vio_get_filelen := @m_get_filelen; + seek := @m_seek; + read := @m_read; + write := @m_write; + tell := @m_tell; + end; + + if (AudioFormat = 0) then + sfInfo.format := SF_FORMAT_WAV Or SF_FORMAT_PCM_16; + if (AudioFormat = 1) then + sfInfo.format := SF_FORMAT_OGG Or SF_FORMAT_VORBIS; + + sfInfo.channels := StreamOut[x].Data.Channels; + sfInfo.frames := streamOut[x].Data.Wantframes; + SFinfo.samplerate := roundmath(StreamOut[x].Data.SampleRate); + SFinfo.seekable := 0; + StreamOut[x].Data.HandleSt := sf_open_virtual(@sfVirtual, SFM_WRITE, @sfInfo, + @StreamOut[x].MemorySteamOut); + {$endif} + result := x; + StreamOut[x].Data.Enabled := True; +end; + +function Tuos_Player.AddFromMemoryStreamDec(Var MemoryStream: TMemoryStream; Var Bufferinfos: + Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// MemoryStream : Memory-stream of decoded audio (like created by AddIntoMemoryStream) +// Bufferinfos : infos of the Memory-stream + +// 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 ';') +// FramesCount : default : -1 (4096) +// result : Input Index in array -1 = error +var + x : integer; +begin + result := -1 ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before all.'); + {$endif} + + if assigned(MemoryStream) then + begin + x := 0; + MemoryStream.Position := 0; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before setlength.'); + {$endif} + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.lastbuf := -1; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.TypePut := 6; + StreamIn[x].Data.seekable := True; + StreamIn[x].LoopProc := Nil; + + StreamIn[x].Data.Channels := Bufferinfos.Channels; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 4096 + else + StreamIn[x].Data.Wantframes := FramesCount; + + StreamIn[x].Data.Samplerate := bufferinfos.SampleRate; + StreamIn[x].Data.SampleRateRoot := Bufferinfos.Samplerate; + StreamIn[x].Data.SampleFormat := Bufferinfos.SampleFormat; + StreamIn[x].Data.Filename := BufferInfos.Filename; + StreamIn[x].Data.Title := BufferInfos.Title; + StreamIn[x].Data.Copyright := BufferInfos.Copyright; + StreamIn[x].Data.Software := BufferInfos.Software; + StreamIn[x].Data.Artist := BufferInfos.Artist; + StreamIn[x].Data.Comment := BufferInfos.Comment; + StreamIn[x].Data.Date := BufferInfos.Date; + StreamIn[x].Data.Tag := BufferInfos.Tag; + StreamIn[x].Data.Album := BufferInfos.Album; + StreamIn[x].Data.Track := BufferInfos.Track; + StreamIn[x].Data.Genre := BufferInfos.Genre; + StreamIn[x].Data.HDFormat := BufferInfos.HDFormat; + StreamIn[x].Data.Sections := BufferInfos.Sections; + StreamIn[x].Data.Encoding := BufferInfos.Encoding; + StreamIn[x].Data.bitrate := BufferInfos.bitrate; + //StreamIn[x].Data.Length := BufferInfos.Length; + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].Data.ratio := StreamIn[x].Data.Channels; + + StreamIn[x].Data.posmem := 0; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.seekable := false; + StreamIn[x].LoopProc := Nil; + streamIn[x].Data.ratio := StreamIn[x].Data.Channels; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + StreamIn[x].MemoryStreamDec := MemoryStream; + + + StreamIn[x].MemoryStreamDec.Position := 0; + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data.Channels); + + StreamIn[x].Data.Enabled := true; + result := x; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('length(StreamIn[x].MemoryStreamDec) = '+inttostr(StreamIn[x].MemoryStreamDec.size)) ; + writeln('length(MemoryStream) = '+inttostr(MemoryStream.size)) ; + WriteLn('Length(StreamIn) = '+ inttostr(x)); + {$endif} + end + else result := -1; + +end; + +function Tuos_Player.AddFromMemoryStream(Var MemoryStream: TMemoryStream; + TypeAudio: cint32; OutputIndex: cint32; SampleFormat: + cint32 ; FramesCount: cint32): cint32; +// MemoryStream : Memory stream of encoded audio file. + +// TypeAudio : default : -1 --> 0 (0: flac, ogg, wav; 1: mp3; 2:opus ; 3:decoded Tmemory-stream; 5:mod, it, xm, s3m) + +// 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 := AddFromMemoryStream(mymemorystream,-1,-1,0,1024); + +var + x, x2, err, len, len2, i : cint32; + PipeBufferSize, totsamples : integer; + buffadd : tbytes; + samprat : cint32; + + {$IF DEFINED(sndfile)} + sfInfo: TSF_INFO; + sfVirtual: TSF_VIRTUAL; + {$endif} + + {$IF DEFINED(opus)} + s: UTF8String; + j: Integer; + OpusTag: POpusTags; + LComment: PPAnsiChar; + LcommentLength: PInteger; + {$endif} + + {$IF DEFINED(mpg123)} + mpinfo: Tmpg123_frameinfo; + // problems with mpg123 + mpid3v1: PPmpg123_id3v1; + refmpid3v1: Tmpg123_id3v1; + mpid3v2: Tmpg123_id3v2; + {$endif} + + {$IF DEFINED(xmp)} + mi: xmp_module_info; + {$endif} + +begin + result := -1 ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before all.'); + {$endif} + + if assigned(MemoryStream) then + begin + x := 0; + MemoryStream.Position := 0; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before setlength.'); + {$endif} + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + err := -1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].Data.lastbuf := -1; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + StreamIn[x].data.MemoryStream := MemoryStream; + StreamIn[x].data.MemoryStream.Position := 0; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Length(StreamIn) = '+ inttostr(x)); + {$endif} + + {$IF DEFINED(sndfile)} + if ((TypeAudio = -1) or (TypeAudio = 0)) and (uosLoadResult.SFloadERROR = 0) then + begin + with sfVirtual do + begin + sf_vio_get_filelen := @m_get_filelen; + seek := @m_seek; + read := @m_read; + write := @m_write; + tell := @m_tell; + end; + + try + Streamin [x] .Data.HandleSt := sf_open_virtual(@sfVirtual, SFM_READ, @sfInfo, @StreamIn[ + x].Data.MemoryStream); + except + StreamIn[x].Data.HandleSt := Nil; + end; + (* try to open the file *) + if StreamIn[x].Data.HandleSt = nil then + begin + StreamIn[x].Data.LibOpen := -1; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open_virtual NOT OK'); + {$endif} + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open_virtual OK'); + {$endif} + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else StreamIn[x].Data.SampleFormat := SampleFormat; + + StreamIn[x].Data.LibOpen := 0; + StreamIn[x].Data.channels := SFinfo.channels; + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data.Channels); + + StreamIn[x].Data.hdformat := SFinfo.format; + StreamIn[x].Data.frames := SFinfo.frames; + StreamIn[x].Data.samplerate := SFinfo.samplerate; + StreamIn[x].Data.samplerateroot := SFinfo.samplerate; + StreamIn[x].Data.sections := SFinfo.sections; + StreamIn[x].Data.copyright := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_COPYRIGHT); + StreamIn[x].Data.software := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_SOFTWARE); + StreamIn[x].Data.comment := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_COMMENT); + StreamIn[x].Data.artist := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_ARTIST); + StreamIn[x].Data.title := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_TITLE); + StreamIn[x].Data.date := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_DATE); + StreamIn[x].Data.track := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_TRACKNUMBER); + StreamIn[x].Data.genre := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_GENRE); + StreamIn[x].Data.album := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_ALBUM); + + StreamIn[x].Data.Length := sfInfo.frames; + err := 0; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open END OK'); + {$endif} + end; + end; + {$endif} + + {$IF DEFINED(xmp)} + if ((StreamIn[x].Data.LibOpen = -1)) then + if ((TypeAudio = 5)) and (uosLoadResult.XMloadERROR = 0) then + begin + StreamIn[x].Data.HandleSt := xmp_create_context(); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if StreamIn[x].Data.HandleSt = nil then WriteLn(' xmp_create_context() NOT OK') + else WriteLn('xmp_create_context() OK'); + {$endif} + + + if xmp_load_module_from_memory(StreamIn[x].Data.HandleSt, + StreamIn[x].Data.MemoryStream.Memory, + StreamIn[x].Data.MemoryStream.size) <> 0 then + begin + StreamIn[x].Data.LibOpen := -1; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('xmp_load_module_from_memory NOT OK'); + {$endif} + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('xmp_load_module_from_memory OK'); + {$endif} + + xmp_start_player(StreamIn[x].Data.HandleSt, 44100, 0); + xmp_get_module_info(StreamIn[x].Data.HandleSt, mi); + // xmp_get_frame_info(StreamIn[x].Data.HandleSt , fi); + + StreamIn[x].Data.LibOpen := 5; + StreamIn[x].Data.channels := 2; + // todo + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + // Need conversion because xmp is always 16 bit + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data. + Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + + x2 := 0 ; + while x2 < Length(Streamin[x].Data.Buffer) do + begin + Streamin[x].Data.Buffer[x2] := 0.0 ; + inc(x2); + end; + + // StreamIn[x].Data.hdformat := SFinfo.format; + // StreamIn[x].Data.frames := SFinfo.frames; + StreamIn[x].Data.samplerate := 44100; + StreamIn[x].Data.samplerateroot := 44100; + // StreamIn[x].Data.sections := SFinfo.sections; + StreamIn[x].Data.title := String(mi.module^.Name); + + StreamIn[x].Data.copyright := ''; + StreamIn[x].Data.software := ''; + + StreamIn[x].Data.comment := String(mi.module^.typ); + StreamIn[x].Data.artist := String(mi.comment); + StreamIn[x].Data.date := ''; + + StreamIn[x].Data.track := ''; + StreamIn[x].Data.genre := ''; + StreamIn[x].Data.album := ''; + + StreamIn[x].Data.Length := 0; + + err := 0; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('XMP_open END OK'); + {$endif} + + end; + end; + {$endif} + + {$IF DEFINED(mpg123)} + // mpg123 + if (((TypeAudio = 1) and (StreamIn[x].Data.LibOpen = -1) + and (uosLoadResult.MPloadERROR = 0))) then + begin + Err := -1; + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err); + + if Err = 0 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('mpg123_new OK'); + {$endif} + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else StreamIn[x].Data.SampleFormat := + SampleFormat + ; + mpg123_format_none(StreamIn[x].Data.HandleSt); + + case StreamIn[x].Data.SampleFormat of + 0: mpg123_format(StreamIn[x].Data.HandleSt, + DefRate, Stereo, + MPG123_ENC_FLOAT_32); + 1: mpg123_format(StreamIn[x].Data.HandleSt, + DefRate, Stereo, + MPG123_ENC_SIGNED_32); + 2: mpg123_format(StreamIn[x].Data.HandleSt, + DefRate, Stereo, + MPG123_ENC_SIGNED_16); + end; + + err := mpg123_replace_reader_handle(StreamIn[x]. + Data.HandleSt, @mpg_read_stream, @ + mpg_seek_stream, Nil); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln( + '===> mpg123_replace_reader_handle => ok.') + else writeln( + '===> mpg123_replace_reader_handle => NOT OK.'); + {$endif} + + Err := mpg123_open_handle(StreamIn[x].Data. + HandleSt, pointer(StreamIn[x].Data. + MemoryStream)); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_open_handle => ok.') + else + writeln('===> mpg123_open_handle => NOT ok.'); + {$endif} + + sleep(10); + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + + samprat := roundmath(StreamIn[x].Data.samplerate); + + if Err = 0 then Err := mpg123_getformat(StreamIn[x]. + Data.HandleSt, + samprat, + StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_getformat => ok.') + else writeln('===> mpg123_getformat => NOT ok.') ; + {$endif} + + if Err = 0 then + begin + mpg123_close(StreamIn[x].Data.HandleSt); + mpg123_delete(StreamIn[x].Data.HandleSt); + + // Close handle and reload with forced resolution + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err + ); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_open_handle => ok.') + else writeln( + '===> mpg123_open_handle => NOT ok.') ; + {$endif} + StreamIn[x].Data.HandleSt := Nil; + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err); + + mpg123_format_none(StreamIn[x].Data.HandleSt); + + samprat := roundmath(StreamIn[x].Data.samplerate); + + + case StreamIn[x].Data.SampleFormat of + 0: mpg123_format(StreamIn[x].Data.HandleSt, + samprat, + StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + 1: mpg123_format(StreamIn[x].Data.HandleSt, + samprat, + StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + 2: mpg123_format(StreamIn[x].Data.HandleSt, + samprat, + StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + end; + + err := mpg123_replace_reader_handle(StreamIn[x]. + Data.HandleSt, @mpg_read_stream, @mpg_seek_stream, Nil); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_replace_reader_handle => ok.') + else writeln('===> mpg123_replace_reader_handle => NOT OK.'); + {$endif} + + Err := mpg123_open_handle(StreamIn[x].Data. + HandleSt, pointer(StreamIn[x].Data. + MemoryStream)); + + samprat := roundmath(StreamIn[x].Data.samplerate); + + mpg123_getformat(StreamIn[x].Data.HandleSt, + samprat, + StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div + StreamIn[x]. + Data.Channels + else StreamIn[x].Data.Wantframes := FramesCount; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x]. + Data.Wantframes*StreamIn[x].Data. + Channels); + mpg123_info(StreamIn[x].Data.HandleSt, MPinfo); + + + // problems with mpg123 library + mpg123_id3(StreamIn[x].Data.HandleSt, @mpid3v1, @mpid3v2); + // to do : add id2v2 + if (mpid3v1 <> nil) and (mpid3v1^ <> nil) then + begin + refmpid3v1 := mpid3v1^^; + StreamIn[x].Data.title := trim(refmpid3v1.title); + StreamIn[x].Data.artist := refmpid3v1.artist; + StreamIn[x].Data.album := refmpid3v1.album; + StreamIn[x].Data.date := refmpid3v1.year; + StreamIn[x].Data.comment := refmpid3v1.comment; + //StreamIn[x].Data.track := refmpid3v1.comment; + StreamIn[x].Data.tag := refmpid3v1.tag; + StreamIn[x].Data.genre := inttostr(refmpid3v1.genre); + end; + + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.hdformat := MPinfo.layer; + StreamIn[x].Data.frames := MPinfo.framesize; + + if StreamIn[x].Data.SampleFormat = 0 then + mpg123_param(StreamIn[x].Data.HandleSt, + StreamIn[x].Data.Channels, + MPG123_FORCE_FLOAT, 0); + + StreamIn[x].Data.LibOpen := 1; + StreamIn[x].Data.Length := mpg123_length(StreamIn[x].Data.HandleSt); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('StreamIn[x].Data.Length = ' + inttostr( + mpg123_length(StreamIn[x].Data.HandleSt)); + writeln('StreamIn[x].Data.frames = ' + inttostr( + StreamIn[x].Data.frames)); + writeln('END StreamIn[x].Data.samplerate = ' + + inttostr(roundmath(StreamIn[x].Data.samplerate))); + writeln('END StreamIn[x].Data.channels = ' + + inttostr(StreamIn[x].Data.channels)); + {$endif} + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + end; + {$endif} + + {$IF DEFINED(opus)} + if ((TypeAudio = 2) and (StreamIn[x].Data.LibOpen = -1) and + (uosLoadResult.OPloadERROR = 0)) + + then + begin + Err := -1; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before Opus'); + {$endif} + + StreamIn[x].Data.HandleSt := pchar('opus'); + + if FramesCount= -1 then + totsamples := 4096 + else totsamples := FramesCount; + + PipeBufferSize := StreamIn[x].Data.MemoryStream.size; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('totsamples: ' + inttostr(totsamples)); + WriteLn('PipeBufferSize: ' + inttostr(PipeBufferSize)); + {$endif} + + len := 1 ; + len2 := 0 ; + + setlength(buffadd, PipeBufferSize); + setlength(StreamIn[x].data.BufferTMP, PipeBufferSize); + + while (len2 < PipeBufferSize) and (len > 0) do + begin + len := StreamIn[x].Data.MemoryStream.Read(buffadd[0],PipeBufferSize-len2); + + if len > 0 then + for i := 0 to len -1 do + StreamIn[x].data.BufferTMP[i+len2] := buffadd[i] ; + len2 := len2 + len; + end; + + // memory stream not needed anymore ---> converted into buffer + freeandnil(StreamIn[x].Data.MemoryStream); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('PipeBufferSize = ' + inttostr(PipeBufferSize)); + WriteLn('Data.MemoryStream.Read = ' + inttostr(len2)); + WriteLn('----------------------------------'); + //writeln(tencoding.utf8.getstring(StreamIn[x].data.BufferTMP)); + {$endif} + + StreamIn[x].Data.HandleSt := pchar('opusstream'); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('StreamIn[x].Data.HandleSt assisgned'); + {$endif} + + // Can not make work... + + +// StreamIn[x].Data.HandleOP := op_test_callbacks(StreamIn[x].data.MemoryStream, uos_callbacksms, StreamIn[x].data.BufferTMP[0], PipeBufferSize, err); + + // this is a memorystream converted into a buffer, it works... + StreamIn[x].Data.HandleOP := op_test_memory(StreamIn[x].data.BufferTMP[0],PipeBufferSize, Err); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('op_test_file error = '+ inttostr(Err)); + {$endif} + + if Err=0 then + begin + Err := op_test_open(StreamIn[x].Data.HandleOP); + if (Err=0) and (op_link_count(StreamIn[x].Data.HandleOP)=1) then + begin + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else StreamIn[x].Data.SampleFormat := SampleFormat; + + //tag + OpusTag := op_tags(StreamIn[x].Data.HandleOP, Nil); + + if OpusTag<>nil then + begin + if OpusTag^.comments>0 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn((Format('OpusTag.comments = %d', [OpusTag^.comments]))); + {$endif} + LComment := OpusTag^.user_comments; + LcommentLength := OpusTag^.comment_lengths; + for j := 0 to OpusTag^.comments - 1 do + begin + SetLength(s, LcommentLength^); + move(Pointer(LComment^)^, Pointer(s)^, LcommentLength^); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + // WriteLn(s); + {$endif} + + if j = 1 then StreamIn[x].Data.title := s; + if j = 2 then StreamIn[x].Data.artist := s; + if j = 3 then StreamIn[x].Data.album := s; + if j = 4 then StreamIn[x].Data.date := s; + if j = 5 then StreamIn[x].Data.comment := s; + if j = 6 then StreamIn[x].Data.tag := s; + + inc(LComment); + inc(LcommentLength); + end; + end; + end; + // WriteLn((Format('op_bitrate = %d', [op_bitrate(StreamIn[x].Data.HandleOP, nil)]))); + + StreamIn[x].Data.Length := op_pcm_total(StreamIn[x].Data.HandleOP, Nil); + StreamIn[x].Data.channels := op_channel_count(StreamIn[x].Data.HandleOP, Nil); + StreamIn[x].Data.bitrate := op_bitrate(StreamIn[x].Data.HandleOP, Nil); + + // opus use constant sample rate 48k + StreamIn[x].Data.samplerate := 48000 ; + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.Seekable := true; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 4096 * StreamIn[x].Data.Channels + else StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, + StreamIn[x].Data.Wantframes*StreamIn[x].Data.Channels); + + StreamIn[x].Data.LibOpen := 4; + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + end; + end; + {$endif} + + {$IF DEFINED(neaac)} + if (StreamIn[x].Data.LibOpen = -1) and (uosLoadResult.AAloadERROR = 0) then + begin + Err := -1; + + StreamIn[x].AACI := TAACInfo.Create(); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('TAACInfo.Create() = ok'); + {$endif} + { + Case SampleFormat of + 0 : StreamIn[x].AACI:= MP4OpenFile(FileName, FAAD_FMT_FLOAT); + 1 : StreamIn[x].AACI:= MP4OpenFile(FileName, FAAD_FMT_32BIT); + 2 : StreamIn[x].AACI:= MP4OpenFile(FileName, FAAD_FMT_16BIT); + End; + } + if StreamIn[x].AACI <> nil then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('MP4OpenFile() = ok'); + {$endif} + + case StreamIn[x].AACI.outputFormat of + FAAD_FMT_16BIT : StreamIn[x].Data.SampleFormat := 2; + //FAAD_FMT_24BIT : ; + FAAD_FMT_32BIT : StreamIn[x].Data.SampleFormat := 1; + FAAD_FMT_FLOAT : StreamIn[x].Data.SampleFormat := 0; + //FAAD_FMT_DOUBLE: ; + end; + + // StreamIn[x].Data.filename := FileName; + + StreamIn[x].Data.HandleSt := StreamIn[x].AACI.hMP4; + + StreamIn[x].Data.samplerate := StreamIn[x].AACI.SampleRate; + StreamIn[x].Data.channels := StreamIn[x].AACI.Channels; + + case StreamIn[x].AACI.outputFormat of + FAAD_FMT_16BIT : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_16; + //FAAD_FMT_24BIT : ; + FAAD_FMT_32BIT : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_32; + FAAD_FMT_FLOAT : StreamIn[x].Data.encoding := MPG123_ENC_FLOAT_32; + //FAAD_FMT_DOUBLE: ; + end; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes * StreamIn[x].Data.Channels + ); + + StreamIn[x].Data.title := StreamIn[x].AACI.Title; + StreamIn[x].Data.artist := StreamIn[x].AACI.Artist; + StreamIn[x].Data.album := StreamIn[x].AACI.Album; + StreamIn[x].Data.date := StreamIn[x].AACI.Date; + StreamIn[x].Data.comment := StreamIn[x].AACI.Comment; + StreamIn[x].Data.tag[0] := #0; + StreamIn[x].Data.tag[1] := #0; + StreamIn[x].Data.tag[2] := #0; + StreamIn[x].Data.genre := StreamIn[x].AACI.Genre; + StreamIn[x].Data.samplerateroot := StreamIn[x].AACI.SampleRate; + StreamIn[x].Data.hdformat := 0; + StreamIn[x].Data.frames := 0; + StreamIn[x].Data.Length := StreamIn[x].AACI.TotalSamples; + + StreamIn[x].Data.Seekable := StreamIn[x].AACI.Size > 0; + + StreamIn[x].Data.LibOpen := 2 ; + Err := 0; + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('MP4OpenFile() NOT ok'); + {$endif} + end; + + end; + {$endif} + + {$IF DEFINED(cdrom)} + if (StreamIn[x].Data.LibOpen = -1) then + begin + Err := -1; + StreamIn[x].pCD := Nil; + + case SampleFormat of + 2 : StreamIn[x].pCD := CDROM_OpenFile(StreamIn[x].Data.FileName); + end; + + if StreamIn[x].pCD <> nil then + begin + case StreamIn[x].pCD^.BitsPerSample of + 16 : StreamIn[x].Data.SampleFormat := 2; + end; + + StreamIn[x].Data.HandleSt := @StreamIn[x].pCD; + // Uos requires an assigned pointer.... + + StreamIn[x].Data.samplerate := StreamIn[x].pCD^.SampleRate; + StreamIn[x].Data.channels := StreamIn[x].pCD^.Channels; + + case StreamIn[x].pCD^.BitsPerSample of + 16 : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_16; + end; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else StreamIn[x].Data.Wantframes := FramesCount; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes * StreamIn[x].Data.Channels + ); + + StreamIn[x].Data.title := ''; + StreamIn[x].Data.artist := ''; + StreamIn[x].Data.album := ''; + StreamIn[x].Data.date := ''; + StreamIn[x].Data.comment := ''; + StreamIn[x].Data.tag[0] := #0; + StreamIn[x].Data.tag[1] := #0; + StreamIn[x].Data.tag[2] := #0; + StreamIn[x].Data.genre := 0; + StreamIn[x].Data.samplerateroot := StreamIn[x].pCD^.SampleRate; + StreamIn[x].Data.hdformat := 0; + StreamIn[x].Data.frames := 0; + StreamIn[x].Data.Length := StreamIn[x].pCD^.TotalSamples; + + StreamIn[x].Data.LibOpen := 3; + Err := 0; + end; + end; + {$endif} + + if err <> 0 then + begin + result := -1 ; + StreamIn[Length(StreamIn) - 1].Destroy; + setlength(StreamIn, Length(StreamIn) - 1); + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('addfrom memorystream OK'); + {$endif} + Result := x; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.TypePut := 0; + StreamIn[x].Data.seekable := True; + StreamIn[x].LoopProc := Nil; + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else StreamIn[x].Data.SampleFormat := SampleFormat; + + + case StreamIn[x].Data.LibOpen of + -1: ; + {$IF DEFINED(sndfile)} + 0: StreamIn[x].Data.ratio := StreamIn[x].Data.Channels; + {$endif} + {$IF DEFINED(mpg123)} + 1: + begin + if StreamIn[x].Data.SampleFormat = 2 then + StreamIn[x].Data.ratio := streamIn[x].Data.Channels + else StreamIn[x].Data.ratio := 2 * streamIn[x].Data.Channels; + + if StreamIn[x].Data.SampleFormat = 0 then + mpg123_param(StreamIn[x].Data.HandleSt, StreamIn[x].Data.Channels, MPG123_FORCE_FLOAT + , 0); + end; + {$endif} + {$IF DEFINED(neaac)} + 2 : StreamIn[x].Data.ratio := streamIn[x].AACI.Channels; + {$endif} + {$IF DEFINED(cdrom)} + 3 : StreamIn[x].Data.ratio := streamIn[x].pCD^.Channels; + {$endif} + {$IF DEFINED(opus)} + 4 : StreamIn[x].Data.ratio := streamIn[x].Data.Channels; + {$endif} + {$IF DEFINED(xmp)} + 5 : StreamIn[x].Data.ratio := streamIn[x].Data.Channels; + {$endif} + end; + + StreamIn[x].Data.Enabled := True; + end; +end; +end; + +function Tuos_Player.AddFromFile(Filename: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ): cint32; +// Add a Input from Audio file with Custom parameters +// FileName : filename of audio file + +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output +// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : default : -1 (65536 div channels) +// example : InputIndex := AddFromFile('/usr/home/test.ogg',-1,-1,-1); +var + x, x2, err: cint32; + + samprat : integer; + + {$IF DEFINED(sndfile)} + sfInfo: TSF_INFO; + {$endif} + + {$IF DEFINED(opus)} + s: UTF8String; + j: Integer; + OpusTag: POpusTags; + LComment: PPAnsiChar; + LcommentLength: PInteger; + {$endif} + + {$IF DEFINED(xmp)} + mi: xmp_module_info; + {$endif} + + {$IF DEFINED(mpg123)} + mpinfo: Tmpg123_frameinfo; + BufferTag: array[1..128] of char; + F: file; + // problems with mpg123 + // mpid3v2: Tmpg123_id3v2; + {$endif} + +begin + result := -1 ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before all.'); + {$endif} + + if fileexists(filename) then + begin + x := 0; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before setlength.'); + {$endif} + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + err := -1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + StreamIn[x].Data.lastbuf := 0; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Length(StreamIn) = '+ inttostr(x)); + {$endif} + + {$IF DEFINED(sndfile)} + if (uosLoadResult.SFloadERROR = 0) then + begin + + StreamIn[x].Data.HandleSt := sf_open(FileName, SFM_READ, sfInfo); + + (* try to open the file *) + if StreamIn[x].Data.HandleSt = nil then + begin + StreamIn[x].Data.LibOpen := -1; + err := -1; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open NOT OK'); + {$endif} + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open OK'); + {$endif} + StreamIn[x].Data.LibOpen := 0; + StreamIn[x].Data.filename := FileName; + StreamIn[x].Data.channels := SFinfo.channels; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data. + Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + x2 := 0 ; + while x2 < Length(Streamin[x].Data.Buffer) do + begin + Streamin[x].Data.Buffer[x2] := 0.0 ; + inc(x2); + end; + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + StreamIn[x].Data.hdformat := SFinfo.format; + StreamIn[x].Data.frames := SFinfo.frames; + StreamIn[x].Data.samplerate := SFinfo.samplerate; + StreamIn[x].Data.samplerateroot := SFinfo.samplerate; + StreamIn[x].Data.sections := SFinfo.sections; + StreamIn[x].Data.title := + sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_TITLE); + StreamIn[x].Data.copyright := + sf_get_string(StreamIn[x].Data.HandleSt, + SF_STR_COPYRIGHT); + StreamIn[x].Data.software := + sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_SOFTWARE) + ; + StreamIn[x].Data.comment := + sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_COMMENT); + StreamIn[x].Data.artist := + sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_ARTIST); + StreamIn[x].Data.date := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_DATE); + + StreamIn[x].Data.track := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_TRACKNUMBER); + StreamIn[x].Data.genre := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_GENRE); + StreamIn[x].Data.album := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_ALBUM); + + StreamIn[x].Data.Length := sfInfo.frames; + err := 0; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open END OK'); + {$endif} + end; + end; + + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('sf err = ' + inttostr(err)); + {$endif} + + // XMP + {$IF DEFINED(xmp)} + if (StreamIn[x].Data.LibOpen = -1) and (uosLoadResult.XMloadERROR = 0) then + begin + Err := -1; + + StreamIn[x].Data.HandleSt := xmp_create_context(); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if StreamIn[x].Data.HandleSt = nil then WriteLn(' xmp_create_context() NOT OK') + else WriteLn(' xmp_create_context() OK'); + {$endif} + + if xmp_load_module(StreamIn[x].Data.HandleSt, PChar(FileName)) <> 0 then + begin + StreamIn[x].Data.LibOpen := -1; + err := -1; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('xmp_load_module NOT OK'); + {$endif} + end + else + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('xmp_load_module() = ok'); + {$endif} + xmp_start_player(StreamIn[x].Data.HandleSt, 44100, 0); + xmp_get_module_info(StreamIn[x].Data.HandleSt, mi); + // xmp_get_frame_info(StreamIn[x].Data.HandleSt , fi); + + StreamIn[x].Data.LibOpen := 5; + StreamIn[x].Data.filename := FileName; + StreamIn[x].Data.channels := 2; + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + // Need conversion because xmp is always 16 bit + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data. + Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + x2 := 0 ; + while x2 < Length(Streamin[x].Data.Buffer) do + begin + Streamin[x].Data.Buffer[x2] := 0.0 ; + inc(x2); + end; + + StreamIn[x].Data.hdformat := 0; + StreamIn[x].Data.frames := 0; + StreamIn[x].Data.samplerate := 44100; + StreamIn[x].Data.samplerateroot := 44100; + // StreamIn[x].Data.sections := SFinfo.sections; + StreamIn[x].Data.title := String(mi.module^.Name); + + StreamIn[x].Data.copyright := ''; + StreamIn[x].Data.software := ''; + + StreamIn[x].Data.comment := String(mi.module^.typ); + StreamIn[x].Data.artist := String(mi.comment); + StreamIn[x].Data.date := ''; + + StreamIn[x].Data.track := ''; + StreamIn[x].Data.genre := ''; + StreamIn[x].Data.album := ''; + + StreamIn[x].Data.Length := 0; + + err := 0; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('XMP_open END OK'); + {$endif} + end; + end; + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('XMP StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('XMP err = ' + inttostr(err)); + {$endif} + + {$IF DEFINED(mpg123)} + if ((StreamIn[x].Data.LibOpen = -1)) and (uosLoadResult.MPloadERROR = 0) then + begin + Err := -1; + + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err); + + if Err = 0 then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('mpg123_new OK'); + {$endif} + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + mpg123_format_none(StreamIn[x].Data.HandleSt); + case StreamIn[x].Data.SampleFormat of + 0: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_FLOAT_32); + 1: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_SIGNED_32); + 2: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_SIGNED_16); + end; + + Err := mpg123_open(StreamIn[x].Data.HandleSt, PChar(FileName)); + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + + samprat := roundmath(StreamIn[x].Data.samplerate); + + if Err = 0 then + Err := mpg123_getformat(StreamIn[x].Data.HandleSt, + samprat, StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + + if Err = 0 then + begin + // Close handle and reload with forced resolution + mpg123_close(StreamIn[x].Data.HandleSt); + mpg123_delete(StreamIn[x].Data.HandleSt); + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err); + + mpg123_format_none(StreamIn[x].Data.HandleSt); + case StreamIn[x].Data.SampleFormat of + 0: mpg123_format(StreamIn[x].Data.HandleSt, samprat, + StreamIn[x].Data.channels, StreamIn[x].Data.encoding); + 1: mpg123_format(StreamIn[x].Data.HandleSt, samprat, + StreamIn[x].Data.channels, StreamIn[x].Data.encoding); + 2: mpg123_format(StreamIn[x].Data.HandleSt, samprat, + StreamIn[x].Data.channels, StreamIn[x].Data.encoding); + end; + mpg123_open(StreamIn[x].Data.HandleSt, (PChar(FileName))); + mpg123_getformat(StreamIn[x].Data.HandleSt, + samprat, StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + StreamIn[x].Data.filename := filename; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := + 65536 Div StreamIn[x].Data. + Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + + mpg123_info(StreamIn[x].Data.HandleSt, MPinfo); + + // custom code for reading ID3Tag ---> problems with mpg123_id3() + + AssignFile(F, Filename); + + FileMode := fmOpenRead + fmShareDenyNone; + + Reset(F, 1); + Seek(F, FileSize(F) - 128); + BlockRead(F, BufferTag, SizeOf(BufferTag)); + CloseFile(F); + + StreamIn[x].Data.tag := copy(BufferTag, 1, 3); + StreamIn[x].Data.title := copy(BufferTag, 4, 30); + StreamIn[x].Data.artist := copy(BufferTag, 34, 30); + StreamIn[x].Data.album := copy(BufferTag, 64, 30); + StreamIn[x].Data.date := copy(BufferTag, 94, 4); + StreamIn[x].Data.comment := copy(BufferTag, 98, 30); + StreamIn[x].Data.track := inttostr(ord(BufferTag[127])); + StreamIn[x].Data.genre := inttostr(ord(BufferTag[128])); + + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.hdformat := MPinfo.layer; + StreamIn[x].Data.frames := MPinfo.framesize; + StreamIn[x].Data.Length := mpg123_length(StreamIn[x].Data.HandleSt); + StreamIn[x].Data.LibOpen := 1; + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + end; + + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('mp StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('mp err = ' + inttostr(err)); + {$endif} + + {$IF DEFINED(opus)} + if (StreamIn[x].Data.LibOpen = -1) and (uosLoadResult.OPloadERROR = 0) then + begin + Err := -1; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before Opus'); + {$endif} + + StreamIn[x].Data.HandleSt := pchar('opus'); + StreamIn[x].Data.HandleOP := op_test_file(PChar(FileName), Err); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('op_test_file error = '+ inttostr(Err)); + {$endif} + + if Err=0 + then + begin + Err := op_test_open(StreamIn[x].Data.HandleOP); + if (Err=0) and (op_link_count(StreamIn[x].Data.HandleOP)=1) + then + begin + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + //tag + + OpusTag := op_tags(StreamIn[x].Data.HandleOP, Nil); + + if OpusTag<>nil + + then + begin + + if OpusTag^.comments>0 + then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn((Format('OpusTag.comments = %d', [OpusTag^.comments]))); + {$endif} + LComment := OpusTag^.user_comments; + LcommentLength := OpusTag^.comment_lengths; + for j := 0 to OpusTag^.comments - 1 do + begin + SetLength(s, LcommentLength^); + move(Pointer(LComment^)^, Pointer(s)^, LcommentLength^); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + // WriteLn(s); + {$endif} + + if j = 1 then StreamIn[x].Data.title := s; + if j = 2 then StreamIn[x].Data.artist := s; + if j = 3 then StreamIn[x].Data.album := s; + if j = 4 then StreamIn[x].Data.date := s; + if j = 5 then StreamIn[x].Data.comment := s; + if j = 6 then StreamIn[x].Data.tag := s; + + inc(LComment); + inc(LcommentLength); + end; + end; + end; + + + // WriteLn((Format('op_bitrate = %d', [op_bitrate(StreamIn[x].Data.HandleOP, nil)]))); + + StreamIn[x].Data.Length := op_pcm_total(StreamIn[x].Data.HandleOP, Nil); + StreamIn[x].Data.filename := FileName; + StreamIn[x].Data.channels := op_channel_count(StreamIn[x].Data.HandleOP, Nil); + + // opus use constant sample rate 48k + StreamIn[x].Data.samplerate := 48000 ; + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.Seekable := true; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 4096 * StreamIn[x].Data. + Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + + StreamIn[x].Data.LibOpen := 4; + + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + end; + end; +{$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('op StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('op err = ' + inttostr(err)); + {$endif} + + {$IF DEFINED(neaac)} + if (StreamIn[x].Data.LibOpen = -1) and (uosLoadResult.AAloadERROR = 0) then + begin + Err := -1; + + StreamIn[x].AACI := TAACInfo.Create(); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('TAACInfo.Create() = ok'); + {$endif} + + case SampleFormat of + 0 : StreamIn[x].AACI := MP4OpenFile(FileName, FAAD_FMT_FLOAT); + 1 : StreamIn[x].AACI := MP4OpenFile(FileName, FAAD_FMT_32BIT); + 2 : StreamIn[x].AACI := MP4OpenFile(FileName, FAAD_FMT_16BIT); + end; + + if StreamIn[x].AACI <> nil then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('MP4OpenFile() = ok'); + {$endif} + + case StreamIn[x].AACI.outputFormat of + FAAD_FMT_16BIT : StreamIn[x].Data.SampleFormat := 2; + //FAAD_FMT_24BIT : ; + FAAD_FMT_32BIT : StreamIn[x].Data.SampleFormat := 1; + FAAD_FMT_FLOAT : StreamIn[x].Data.SampleFormat := 0; + //FAAD_FMT_DOUBLE: ; + end; + + StreamIn[x].Data.filename := FileName; + + StreamIn[x].Data.HandleSt := StreamIn[x].AACI.hMP4; + + StreamIn[x].Data.samplerate := StreamIn[x].AACI.SampleRate; + StreamIn[x].Data.channels := StreamIn[x].AACI.Channels; + + case StreamIn[x].AACI.outputFormat of + FAAD_FMT_16BIT : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_16; + //FAAD_FMT_24BIT : ; + FAAD_FMT_32BIT : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_32; + FAAD_FMT_FLOAT : StreamIn[x].Data.encoding := MPG123_ENC_FLOAT_32; + //FAAD_FMT_DOUBLE: ; + end; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes * StreamIn[x].Data. + Channels); + + StreamIn[x].Data.title := StreamIn[x].AACI.Title; + StreamIn[x].Data.artist := StreamIn[x].AACI.Artist; + StreamIn[x].Data.album := StreamIn[x].AACI.Album; + StreamIn[x].Data.date := StreamIn[x].AACI.Date; + StreamIn[x].Data.comment := StreamIn[x].AACI.Comment; + StreamIn[x].Data.tag[0] := #0; + StreamIn[x].Data.tag[1] := #0; + StreamIn[x].Data.tag[2] := #0; + StreamIn[x].Data.genre := StreamIn[x].AACI.Genre; + StreamIn[x].Data.samplerateroot := StreamIn[x].AACI.SampleRate; + StreamIn[x].Data.hdformat := 0; + StreamIn[x].Data.frames := 0; + StreamIn[x].Data.Length := StreamIn[x].AACI.TotalSamples; + + StreamIn[x].Data.Seekable := StreamIn[x].AACI.Size > 0; + + StreamIn[x].Data.LibOpen := 2 ; + Err := 0; + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('MP4OpenFile() NOT ok'); + {$endif} + end; + + end; + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('ac StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('ac err = ' + inttostr(err)); + {$endif} + + + {$IF DEFINED(cdrom)} + if (StreamIn[x].Data.LibOpen = -1) then + begin + Err := -1; + StreamIn[x].pCD := Nil; + + case SampleFormat of + 2 : StreamIn[x].pCD := CDROM_OpenFile(FileName); + end; + + if StreamIn[x].pCD <> nil then + begin + case StreamIn[x].pCD^.BitsPerSample of + 16 : StreamIn[x].Data.SampleFormat := 2; + end; + + StreamIn[x].Data.filename := FileName; + + StreamIn[x].Data.HandleSt := @StreamIn[x].pCD; + // Uos requires an assigned pointer.... + + StreamIn[x].Data.samplerate := StreamIn[x].pCD^.SampleRate; + StreamIn[x].Data.channels := StreamIn[x].pCD^.Channels; + + case StreamIn[x].pCD^.BitsPerSample of + 16 : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_16; + end; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else + StreamIn[x].Data.Wantframes := FramesCount; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes * StreamIn[x].Data. + Channels); + + StreamIn[x].Data.title := ''; + StreamIn[x].Data.artist := ''; + StreamIn[x].Data.album := ''; + StreamIn[x].Data.date := ''; + StreamIn[x].Data.comment := ''; + StreamIn[x].Data.tag[0] := #0; + StreamIn[x].Data.tag[1] := #0; + StreamIn[x].Data.tag[2] := #0; + StreamIn[x].Data.genre := '0'; + StreamIn[x].Data.samplerateroot := StreamIn[x].pCD^.SampleRate; + StreamIn[x].Data.hdformat := 0; + StreamIn[x].Data.frames := 0; + StreamIn[x].Data.Length := StreamIn[x].pCD^.TotalSamples; + + StreamIn[x].Data.LibOpen := 3; + Err := 0; + end; + end; + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('cd StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('cd err = ' + inttostr(err)); + {$endif} + + if (err <> 0) or (StreamIn[x].Data.LibOpen = -1) then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('not ok StreamIn[x].Data.LibOpen = -1'); + WriteLn('not ok cd err = ' + inttostr(err)); + {$endif} + + result := -1 ; + StreamIn[Length(StreamIn) - 1].Destroy; + setlength(StreamIn, Length(StreamIn) - 1); + end + else + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('addfromfile OK'); + {$endif} + Result := x; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.TypePut := 0; + StreamIn[x].Data.seekable := True; + StreamIn[x].LoopProc := Nil; + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + case StreamIn[x].Data.LibOpen of + + 0: StreamIn[x].Data.ratio := StreamIn[x].Data.Channels; + + {$IF DEFINED(mpg123)} + 1: + begin + if StreamIn[x].Data.SampleFormat = 2 then + StreamIn[x].Data.ratio := streamIn[x].Data.Channels + else + StreamIn[x].Data.ratio := 2 * streamIn[x].Data.Channels; + + if StreamIn[x].Data.SampleFormat = 0 then + mpg123_param(StreamIn[x].Data.HandleSt, StreamIn[x].Data.Channels, + MPG123_FORCE_FLOAT, 0); + end; + {$endif} + {$IF DEFINED(neaac)} + 2 : StreamIn[x].Data.ratio := streamIn[x].AACI.Channels; + {$endif} + {$IF DEFINED(cdrom)} + 3 : StreamIn[x].Data.ratio := streamIn[x].pCD^.Channels; + {$endif} + {$IF DEFINED(opus)} + 4 : StreamIn[x].Data.ratio := streamIn[x].Data.Channels; + {$endif} + {$IF DEFINED(xmp)} + 5 : StreamIn[x].Data.ratio := streamIn[x].Data.Channels; + {$endif} + end; + StreamIn[x].Data.Enabled := True; + end; + end + else result := -2; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('result = ' + inttostr(result)); + WriteLn('cd err = ' + inttostr(err)); + {$endif} +end; + +procedure Tuos_Player.ReadEndless(x : integer); +begin +{ + Nothing to do: all is done with AddFromEndlessMuted. + } +end; + +{$IF DEFINED(synthesizer)} +procedure Tuos_Player.FillLookupTable(x, typewave, channel, AHarmonics: Integer; + EvenHarmonics : shortint); +var + i, j, l: Integer; + nPI_l, attenuation: Double; + thesample: single; +begin + l := 1024; + nPI_l := 2*PI/l; + + for i:=0 to l-1 do + begin + if typewave = 0 then // sine + begin + thesample := sin(i * nPI_l); + if thesample > 1 then + thesample := 1; + if thesample < -1 then + thesample := -1; + + if Channel = 1 then + StreamIn[x].Data.LookupTableLeft[i] := thesample; + // writeln( floattostr((LookupTableLeft[i])) + ' left '); + + if Channel = 2 then + StreamIn[x].Data.LookupTableRight[i] := thesample; + // writeln( 'right ' + floattostr((LookupTableRight[i]))); + + end; + + if typewave = 1 then // square + begin + if sin(i * nPI_l) >= 0 then + thesample := 1 + else + thesample := -1; + + if Channel = 1 then + StreamIn[x].Data.LookupTableLeft[i] := thesample; + if Channel = 2 then + StreamIn[x].Data.LookupTableRight[i] := thesample; + end; + + if typewave = 2 then // triangle + begin + if Channel = 1 then + begin + if i < (l div 2) + 1 then + thesample := (((l - (i * 2)) / (l / 2))) - 1 + else + thesample := StreamIn[x].Data.LookupTableLeft[l - i]; + if thesample > 1 then + thesample := 1; + if thesample < -1 then + thesample := -1; + StreamIn[x].Data.LookupTableLeft[i] := thesample; + //writeln( floattostr((LookupTableLeft[i])) + ' left '); + end; + + if Channel = 2 then + begin + if i < (l div 2) + 1 then + thesample := (((l - (i * 2)) / (l / 2))) - 1 + else + thesample := StreamIn[x].Data.LookupTableRight[l - i]; + if thesample > 1 then + thesample := 1; + if thesample < -1 then + thesample := -1; + StreamIn[x].Data.LookupTableRight[i] := thesample; + // writeln( floattostr((LookupTableright[i])) + ' right '); + end; + end; + + if typewave = 3 then // Sawtooth + begin + thesample := ((l - i) / (l / 2)) - 1; + if thesample > 1 then + thesample := 1; + if thesample < -1 then + thesample := -1; + + if Channel = 1 then + StreamIn[x].Data.LookupTableLeft[i] := thesample; + if Channel = 2 then + StreamIn[x].Data.LookupTableRight[i] := thesample; + end; + + end; + + if AHarmonics > 0 then + for j:=1 to AHarmonics do + begin + if ((((j mod 2) =1) and (EvenHarmonics=1)) or (EvenHarmonics=0)) then + begin + attenuation := power(j+1, 4); + nPI_l := 2*j*pi/l; + for i:=0 to l-1 do + begin + + if typewave = 0 then + begin + if channel = 1 then + StreamIn[x].Data.LookupTableLeft[i] := + StreamIn[x].Data.LookupTableLeft[i]+sin + (i*nPI_l)/attenuation; + if channel = 2 then + StreamIn[x].Data.LookupTableRight[i] := + StreamIn[x].Data.LookupTableRight[i]+ + sin(i*nPI_l)/attenuation; + end; + + if typewave = 1 then + begin + if channel = 1 then + begin + if sin(i*nPI_l) >= 0 then + StreamIn[x].Data.LookupTableLeft[i] := + StreamIn[x].Data.LookupTableLeft[i] + +(1/attenuation) + else + StreamIn[x].Data.LookupTableLeft[i] := + StreamIn[x].Data.LookupTableLeft[i] + +(-1/attenuation); + end ; + if channel = 2 then + begin + if sin(i*nPI_l) >= 0 then + StreamIn[x].Data.LookupTableRight[i] := + StreamIn[x].Data.LookupTableRight[ + i]+(1/attenuation) + else + StreamIn[x].Data.LookupTableRight[i] := + StreamIn[x].Data.LookupTableRight[ + i]+(-1/attenuation); + end ; + end; + + end; + end; + end; +end; + +procedure Tuos_Player.ReadSynth(x :integer); +var + x2 : integer; + sf1, sf2 : cfloat; + ps: PDArShort; + // if input is Int16 format + pl: PDArLong; + // if input is Int32 format + pf: PDArFloat; + // if input is Float32 format + + i: culong; + chan : integer; + aFreqL, aFreqR, aPosL, aPosR, aStepL, aStepR: cfloat; + +begin + + //for x2 := 0 to length(StreamIn[x].Data.Buffer) + // do StreamIn[x].Data.Buffer[x2] := 0; + + if StreamIn[x].Data.SampleFormat = 2 then ps := @StreamIn[x].Data.Buffer + else + if StreamIn[x].Data.SampleFormat = 1 then pl := @StreamIn[x].Data.Buffer + else + if StreamIn[x].Data.SampleFormat = 0 then pf := @StreamIn[x].Data.Buffer; + + chan := StreamIn[x].Data.channels; + + aPosL := StreamIn[x].Data.PosInTableLeft; + aPosR := StreamIn[x].Data.PosInTableRight; + + aFreqL := StreamIn[x].Data.freqLsine; + aFreqR := StreamIn[x].Data.freqRsine; + + aStepL := (aFreqL*1024/StreamIn[x].Data.samplerate); + aStepR := (aFreqR*1024/StreamIn[x].Data.samplerate);; + + StreamIn[x].Data.posdursine := + StreamIn[x].Data.posdursine + (StreamIn[x].Data.WantFrames Div chan + ); + + x2 := 0 ; + + if (StreamIn[x].Data.posdursine <= StreamIn[x].Data.dursine) or (StreamIn[x].Data.dursine = 0) + then + begin + + while x2 < (length(StreamIn[x].Data.Buffer) div chan) do + begin + + sf2 := 0; + sf1 := 0; + + sf1 := StreamIn[x].Data.VLeft*StreamIn[x].Data.LookupTableLeft[trunc(aPosL) And (1023)]; + aPosL := aPosL+aStepL; + + if chan = 2 then + begin + sf2 := StreamIn[x].Data.VRight*StreamIn[x].Data.LookupTableRight[trunc(aPosR) And ( + 1023)]; + aPosR := aPosR+aStepR; + end; + case StreamIn[x].Data.SampleFormat of + 2: // int16 + begin + ps^[x2] := trunc(sf1 * 32768); + if chan = 2 then ps^[x2+1] := trunc(sf2 * 32768); + end; + 1: // int32 + begin + pl^[x2] := trunc(sf1 * 2147483648); + if chan = 2 then pl^[x2+1] := trunc(sf2 * 2147483648); + end; + 0: // float32 + begin + pf^[x2] := sf1; + if chan = 2 then pf^[x2+1] := sf2 ; + end; + end; + + inc(x2, chan); + end; + + i := trunc(aPosL) Div 1024; + StreamIn[x].Data.PosInTableLeft := aPosL-(i*1024); + i := trunc(aPosR) Div 1024; + StreamIn[x].Data.PosInTableRight := aPosR-(i*1024); + + StreamIn[x].Data.OutFrames := StreamIn[x].Data.WantFrames; + end + else StreamIn[x].Data.OutFrames := 0 ; + +end; +{$endif} + +procedure Tuos_Player.ReadMem(X : integer); +var + x2, wantframestemp : integer; +{$IF DEFINED(uos_debug) and DEFINED(unix)} + i : integer; + st : string; +{$endif} +begin + if length(StreamIn[x].Data.memorybuffer) - StreamIn[x].Data.posmem - (StreamIn[x].Data.WantFrames + + * StreamIn[x].Data.Channels) >= 0 then wantframestemp := (StreamIn[x].Data.WantFrames + * StreamIn[x].Data.Channels) + else + wantframestemp := length(StreamIn[x].Data.memorybuffer) - StreamIn[x].Data.posmem; + + // wantframestemp := StreamIn[x].Data.wantframes; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('length(StreamIn[x].Data.MemoryBuffer) = '+inttostr(length(StreamIn[x].Data.MemoryBuffer)) + ) ; + writeln('StreamIn[x].Data.posmem = '+inttostr(StreamIn[x].Data.posmem)) ; + writeln('wantframestemp = '+inttostr(wantframestemp)) ; +{$endif} + + for x2 := 0 to wantframestemp -1 do + + StreamIn[x].Data.Buffer[x2] := (StreamIn[x].Data.memorybuffer[StreamIn[x].Data.posmem + x2]); + + StreamIn[x].Data.posmem := StreamIn[x].Data.posmem + wantframestemp; + + StreamIn[x].Data.OutFrames := wantframestemp; + + if StreamIn[x].Data.SampleFormat > 0 then + StreamIn[x].Data.Buffer := ConvertSampleFormat(StreamIn[x].Data); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('StreamIn[x].Data.posmem after = '+inttostr(StreamIn[x].Data.posmem)) ; + writeln('StreamIn[x].Data.OutFrames = '+ inttostr(wantframestemp)) ; + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(StreamIn[x].data.Buffer[i]); + WriteLn('OUTPUT DATA AFTER Input from memory ------------------------------'); + WriteLn(st); +{$endif} +end; + +procedure Tuos_Player.ReadMemDec(X : integer); +var + wantframestemp : integer; +{$IF DEFINED(uos_debug) and DEFINED(unix)} + i : integer; + st : string; +{$endif} +begin + + +{ + if length(StreamIn[x].Data.MemoryStream) - StreamIn[x].Data.posmem - (StreamIn[x].Data.WantFrames + +* StreamIn[x].Data.Channels) >= 0 then wantframestemp := (StreamIn[x].Data.WantFrames +* StreamIn[x].Data.Channels) else + wantframestemp := length(StreamIn[x].Data.MemoryStream) - StreamIn[x].Data.posmem; +} + + wantframestemp := (StreamIn[x].Data.WantFrames * StreamIn[x].Data.channels); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('length(StreamIn[x].MemoryStreamDec) = '+inttostr(StreamIn[x].MemoryStreamDec.size)) ; + writeln('StreamIn[x].Data.posmem = '+inttostr(StreamIn[x].Data.posmem)) ; + writeln('wantframestemp = '+inttostr(wantframestemp)) ; +{$endif} + + StreamIn[x].Data.OutFrames := StreamIn[x].MemoryStreamDec.Read(StreamIn[x].Data.Buffer[0] , + wantframestemp); + + StreamIn[x].Data.OutFrames := StreamIn[x].Data.OutFrames Div StreamIn[x].Data.channels; + + StreamIn[x].Data.posmem := StreamIn[x].Data.posmem + wantframestemp; + + // StreamIn[x].Data.OutFrames := wantframestemp; + + if StreamIn[x].Data.SampleFormat > 0 then + StreamIn[x].Data.Buffer := ConvertSampleFormat(StreamIn[x].Data); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('StreamIn[x].Data.posmem after = '+inttostr(StreamIn[x].Data.posmem)) ; + writeln('StreamIn[x].Data.OutFrames = '+ inttostr(wantframestemp)) ; + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(StreamIn[x].data.Buffer[i]); + WriteLn('OUTPUT DATA AFTER Input from memory ------------------------------'); + WriteLn(st); +{$endif} +end; + +procedure Tuos_Player.DoSeek( x : integer); +begin + if StreamIn[x].Data.TypePut = 4 then + StreamIn[x].Data.posmem := 0 + else + + case StreamIn[x].Data.LibOpen of + -1: ; + {$IF DEFINED(sndfile)} + 0: sf_seek(StreamIn[x].Data.HandleSt, StreamIn[x].Data.Poseek, 0); + {$endif} + {$IF DEFINED(mpg123)} + 1: mpg123_seek(StreamIn[x].Data.HandleSt, StreamIn[x].Data.Poseek, 0); + {$endif} + {$IF DEFINED(neaac)} + 2 : MP4Seek(StreamIn[x].AACI, StreamIn[x].Data.Poseek); + {$endif} + {$IF DEFINED(cdrom)} + 3 : ; + {$endif} + {$IF DEFINED(opus)} + 4 : op_pcm_seek(StreamIn[x].Data.HandleOP, StreamIn[x].Data.Poseek); + {$endif} + end; +end; + +procedure Tuos_Player.DoDSPOutAfterBufProc(x: integer); +var + x3 : integer; +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + msg: TfpgMessageParams; + // for fpgui + {$endif} +begin + + for x3 := 0 to high(StreamOut[x].DSP) do + if (StreamOut[x].DSP[x3].Enabled = True) then + begin + if (StreamOut[x].DSP[x3].AftFunc <> nil) then + StreamOut[x].Data.Buffer := + StreamOut[x].DSP[x3].AftFunc(StreamOut[x].Data, + StreamOut[x].DSP[x3].fftdata); + + {$IF DEFINED(mse)} + if (StreamOut[x].DSP[x3].LoopProc <> nil) then + begin + application.queueasynccall(StreamOut[x].DSP[x3].LoopProc); + end; + {$else} + + {$IF not DEFINED(Library)} + if (StreamOut[x].DSP[x3].LoopProc <> nil) then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamOut[x]. + DSP[x3].LoopProc); + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := x3 ; + // the index of the dsp + msg.user.Param2 := 1; + // it is a OUT DSP + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamOut[x].DSP[ + x3].LoopProc); + {$endif} + {$endif} + + {$elseif not DEFINED(java)} + if (StreamOut[x].DSP[x3].LoopProc <> nil) then + StreamOut[x].DSP[x3].LoopProc; + {$else} + if (StreamOut[x].DSP[x3].LoopProc <> nil) then + {$IF FPC_FULLVERSION >= 20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@StreamOut[x]. + DSP[x3].LoopProcjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@StreamOut[x].DSP + [x3].LoopProcjava); + {$endif} + {$endif} + + {$endif} + end; +end; + +procedure Tuos_Player.DoArrayLevel(x: integer); +begin + setlength(uosLevelArray[index][x],length(uosLevelArray[index][x]) +1); + uosLevelArray[index][x][length(uosLevelArray[index][x]) -1 ] := StreamIn[x].Data.LevelLeft; + + setlength(uosLevelArray[index][x],length(uosLevelArray[index][x]) +1); + uosLevelArray[index][x][length(uosLevelArray[index][x]) -1 ] := StreamIn[x].Data.LevelRight; + + // writeln('array length = ' + inttostr(length(uosLevelArray[index][x]))); +end; + +{$IF DEFINED(portaudio)} +procedure Tuos_Player.ReadDevice(x : integer); +var + x2 : integer; +begin + for x2 := 0 to StreamIn[x].Data.WantFrames -1 do + StreamIn[x].Data.Buffer[x2] := cfloat(0.0); + // clear input + Pa_ReadStream(StreamIn[x].Data.HandleSt, + @StreamIn[x].Data.Buffer[0], StreamIn[x].Data.WantFrames); + + // err :=// if you want clean buffer + StreamIn[x].Data.OutFrames := + StreamIn[x].Data.WantFrames * StreamIn[x].Data.Channels; + + +// if err = 0 then StreamIn[x].Data.Status := 1 else StreamIn[x].Data.Status := 0;// if you want clean buffer +end; +{$endif} + +procedure Tuos_Player.DoDSPinBeforeBufProc(x: integer); +var + x2 : integer; +begin + for x2 := 0 to high(StreamIn[x].DSP) do + if (StreamIn[x].DSP[x2].Enabled = True) and + (StreamIn[x].DSP[x2].BefFunc <> nil) then + StreamIn[x].DSP[x2].BefFunc(StreamIn[x].Data, StreamIn[x].DSP[x2].fftdata); +end; + +procedure Tuos_Player.DoDSPinAfterBufProc(x: integer); +var + x2 : integer; +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + msg: TfpgMessageParams; + // for fpgui + {$endif} +begin + for x2 := 0 to high(StreamIn[x].DSP) do + if (StreamIn[x].DSP[x2].Enabled = True) then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin AfterBuffProc 1.'); + {$endif} + if (StreamIn[x].DSP[x2].AftFunc <> nil) then + StreamIn[x].Data.Buffer := + StreamIn[x].DSP[x2].AftFunc(StreamIn[x].Data, + StreamIn[x].DSP[x2].fftdata); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin AfterBuffProc 2.'); + {$endif} + + {$IF DEFINED(mse)} + if (StreamIn[x].DSP[x2].LoopProc <> nil) then + begin + application.queueasynccall(StreamIn[x].DSP[x2].LoopProc) ; + end; + {$else} + + {$IF not DEFINED(Library)} + if (StreamIn[x].DSP[x2].LoopProc <> nil) then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamIn[x].DSP + [x2].LoopProc); + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := x2 ; + // the index of the dsp + msg.user.Param2 := 0; + // it is a In DSP + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamIn[x].DSP[ + x2].LoopProc); + {$endif} + {$endif} + {$elseif not DEFINED(java)} + if (StreamIn[x].DSP[x2].LoopProc <> nil) then + StreamIn[x].DSP[x2].LoopProc; + {$else} + if (StreamIn[x].DSP[x2].LoopProc <> nil) then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@Streamin[x]. + DSP[x2].LoopProcjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@Streamin[x].DSP[ + x2].LoopProcjava); + {$endif} + {$endif} + {$endif} + end; +end; + +procedure Tuos_Player.SeekIfTerminated; +var + x, statustemp : integer; +begin + + statustemp := 0 ; + for x := 0 to high(StreamIn) do + begin + if (StreamIn[x].Data.enabled = true) + then + begin + + if (StreamIn[x].Data.TypePut <> 1) + then + begin + if StreamIn[x].Data.Status = 1 then + statustemp := StreamIn[x].Data.Status; + if (StreamIn[x].Data.Status = 2) and (statustemp = 0) then + statustemp := StreamIn[x].Data.Status; + end + else + if + (StreamIn[x].Data.TypePut = 1) then statustemp := status ; + end ; + end; + + if statustemp <> status then status := statustemp; + + if (status = 0) and IsLooped then + begin + for x:= 0 to high(StreamIn) do + begin + InputSeek(x, 0); + if StreamIn[x].Data.TypePut = 4 then + StreamIn[x].Data.posmem := 0; + StreamIn[x].Data.status := 1; + end; + + Status := 1; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Loop (NLooped: '+IntToStr(NLooped)+')----'); + {$endif} + + if NLooped > 0 then + Dec(NLooped); + end; + +end; + +procedure Tuos_Player.DoLoopEndMethods; +begin +{$IF DEFINED(mse)} + if LoopEndProc <> nil then + begin + application.queueasynccall(LoopEndProc); + end; + {$else} + + {$IF not DEFINED(Library)} + if LoopEndProc <> nil then + + // Execute LoopEndProc procedure + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,LoopEndProc); + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := -2 ; + // it is the first proc + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,LoopEndProc); + {$endif} + {$endif} + {$elseif not DEFINED(java)} + if LoopEndProc <> nil then + LoopEndProc; + {$else} + if LoopEndProc <> nil then + + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@endprocjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@endprocjava); + // Execute EndProc procedure + {$endif} + {$endif} + {$endif} +end; + +procedure Tuos_Player.DoEndProc; +begin +{$IF DEFINED(mse)} + if EndProc <> nil then + application.queueasynccall(EndProc); + {$else} + + {$IF not DEFINED(Library)} + if EndProc <> nil then + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,EndProc); + // Execute EndProc procedure + + //thethread.queue(thethread,EndProc);// Execute EndProc procedure + + {$elseif not DEFINED(java)} + if (EndProc <> nil) then + EndProc; + {$else} + if (EndProc <> nil) then + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@endprocjava); + // Execute EndProc procedure + + {$endif} + + {$endif} +end; + +procedure Tuos_Player.DoTerminateNoFreePlayer; +var + x, x2 : integer; +begin + + for x := 0 to high(StreamIn) do + begin + if (length(StreamIn[x].DSP) > 0) then + for x2 := 0 to high(StreamIn[x].DSP) do + if (StreamIn[x].DSP[x2].EndFunc <> nil) then + StreamIn[x].DSP[x2].EndFunc(StreamIn[x].Data, StreamIn[x].DSP[x2].fftdata); + end; + + for x := 0 to high(StreamOut) do + begin + if (length(StreamOut[x].DSP) > 0) then + for x2 := 0 to high(StreamOut[x].DSP) do + if (StreamOut[x].DSP[x2].EndFunc <> nil) then + StreamOut[x].DSP[x2].EndFunc(StreamOut[x].Data, StreamOut[x].DSP[x2].fftdata); + end; + + if (StreamOut[x].Data.TypePut = 0) then + begin + WriteWave(StreamOut[x].Data.Filename, StreamOut[x].FileBuffer); + // StreamOut[x].FileBuffer.Data.Free; + end; + + if (StreamOut[x].Data.TypePut = 4) then + begin + WriteWaveFromMem(StreamOut[x].Data.Filename, StreamOut[x].FileBuffer); + // StreamOut[x].FileBuffer.Data.Free; + end; + + {$IF DEFINED(sndfile)} + if (StreamOut[x].Data.TypePut = 6) then + begin + sf_write_sync(StreamOut[x].Data.HandleSt); + sf_close(StreamOut[x].Data.HandleSt); + end; + + if (StreamOut[x].Data.TypePut = 5) then + begin + sf_write_sync(StreamOut[x].Data.HandleSt); + sf_close(StreamOut[x].Data.HandleSt); + end; + {$endif} + + {$IF DEFINED(mse)} + if EndProc <> nil then + begin + application.queueasynccall(EndProc); + end; + {$else} + + {$IF not DEFINED(Library)} + if EndProc <> nil then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,EndProc); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,EndProc); + // Execute EndProc procedure + {$endif} + + {$elseif not DEFINED(java)} + if (EndProc <> nil) then + EndProc; + {$else} + if (EndProc <> nil) then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@endprocjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@endprocjava); + // Execute EndProc procedure + {$endif} + + {$endif} + {$endif} + + {$IF DEFINED(portaudio)} + for x := 0 to high(StreamOut) do + if (StreamOut[x].Data.HandleSt <> nil) and + (StreamOut[x].Data.TypePut = 1) then + Pa_StopStream(StreamOut[x].Data.HandleSt); + {$ENDIF} + + if EndProcOnly <> nil then EndProcOnly; + + StreamIn[x].Data.Poseek := 0; + // set to begin + doseek(x); + + Status := 2; + + if isGlobalPause = true then + begin + RTLeventReSetEvent(uosInit.evGlobalPause) + end + else + begin + RTLeventReSetEvent(evPause); + end; + +end; + +procedure Tuos_Player.DoTerminatePlayer; +var + x, x2 : integer; +begin + + if length(PlugIn) > 0 then + begin + for x := 0 to high(PlugIn) do + begin + {$IF DEFINED(soundtouch)} + if Plugin[x].Name = 'soundtouch' then + begin + soundtouch_clear(Plugin[x].PlugHandle); + soundtouch_destroyInstance(Plugin[x].PlugHandle); + end; + + if Plugin[x].Name = 'getbpm' then + begin + bpm_destroyInstance(Plugin[x].PlugHandle); + end; + {$endif} + + {$IF DEFINED(bs2b)} + if Plugin[x].Name = 'bs2b' then + begin + bs2b_close(Plugin[x].Abs2b); + end; + {$endif} + end; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Destroy DSP In'); + {$endif} + + for x := 0 to high(StreamIn) do + begin + if (length(StreamIn[x].DSP) > 0) then + for x2 := 0 to high(StreamIn[x].DSP) do + if (StreamIn[x].DSP[x2].EndFunc <> nil) then + StreamIn[x].DSP[x2].EndFunc(StreamIn[x].Data, StreamIn[x].DSP[x2].fftdata); + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Destroy DSP Out'); + {$endif} + + for x := 0 to high(StreamOut) do + begin + if (assigned(StreamOut[x].DSP)) and (assigned(StreamOut[x])) then if (length(StreamOut[x]. + DSP) > 0) then + for x2 := 0 to high( + StreamOut[x].DSP) do + if (StreamOut[x].DSP[ + x2].EndFunc <> nil) + then + StreamOut[x].DSP[x2] + .EndFunc(StreamOut[x + ].Data, + StreamOut[x + ].DSP[x2]. + fftdata); + end; + + for x := 0 to high(StreamIn) do + if assigned(StreamIn[x].Data.HandleSt) then if (StreamIn[x].Data.HandleSt <> nil) then + case StreamIn[x].Data.TypePut of + 0: case StreamIn[x].Data.LibOpen of + {$IF DEFINED(sndfile)} + 0: sf_close(StreamIn[x].Data.HandleSt); + {$endif} + {$IF DEFINED(mpg123)} + 1: + begin + mpg123_close(StreamIn[x].Data.HandleSt + ); + mpg123_delete(StreamIn[x].Data. + HandleSt); + end; + {$ENDIF} + {$IF DEFINED(neaac)} + 2 : + begin + MP4CloseFile(StreamIn[x].AACI); + end; + {$endif} + {$IF DEFINED(cdrom)} + 3: + begin + CDROM_Close(StreamIn[x].pCD); + end; + {$endif} + {$IF DEFINED(opus)} + 4: + begin + op_free(StreamIn[x].Data.HandleOP); + sleep(50); + // needed ? + end; + {$ENDIF} + + {$IF DEFINED(xmp)} + 5: + begin + xmp_end_player(StreamIn[x].Data. + HandleSt); + xmp_release_module(StreamIn[x].Data. + HandleSt); + xmp_free_context(StreamIn[x].Data. + HandleSt); + end; + {$ENDIF} + + 99: // if nothing was defined + + end; + + {$IF DEFINED(portaudio)} + 1: + begin + Pa_StopStream(StreamIn[x].Data.HandleSt); + Pa_CloseStream(StreamIn[x].Data.HandleSt); + end; + {$endif} + + {$IF DEFINED(webstream)} + 2: + begin + StreamIn[x].httpget.Terminate; + sleep(100); + StreamIn[x].inpipe.destroy; + StreamIn[x].outpipe.destroy; + + case StreamIn[x].Data.LibOpen of + {$IF DEFINED(mpg123)} + 1: + begin + mpg123_close(StreamIn[x].Data. + HandleSt); + mpg123_delete(StreamIn[x].Data. + HandleSt); + end; + {$ENDIF} + {$IF DEFINED(opus)} + 4: + begin + op_free(StreamIn[x].Data.HandleOP); + sleep(50); + // needed ? + end; + {$ENDIF} + {$IF DEFINED(fdkaac)} + 2 : + begin + aacDecoder_Close(StreamIn[x].Data. + HandleSt); + end; + {$ENDIF} + end; + end; + {$ENDIF} + + end; + + for x := 0 to high(StreamOut) do + begin + {$IF DEFINED(portaudio)} + if (StreamOut[x].Data.HandleSt <> nil) and + (StreamOut[x].Data.TypePut = 1) then + begin + Pa_StopStream(StreamOut[x].Data.HandleSt); + Pa_CloseStream(StreamOut[x].Data.HandleSt); + end; + {$ENDIF} + + {$IF DEFINED(shout)} + if (StreamOut[x].Data.TypePut = 2) then + begin + // freeandnil(StreamOut[x].encoder) ; + shout_free(StreamOut[x].Data.HandleSt); + + end; + {$endif} + + if (StreamOut[x].Data.TypePut = 0) then + begin + WriteWave(StreamOut[x].Data.Filename, StreamOut[x].FileBuffer); + // StreamOut[x].FileBuffer.Data.Free; + end; + + if (StreamOut[x].Data.TypePut = 4) then + begin + WriteWaveFromMem(StreamOut[x].Data.Filename, StreamOut[x].FileBuffer); + StreamOut[x].FileBuffer.Data.Free; + end; + + {$IF DEFINED(sndfile)} + + if (StreamOut[x].Data.TypePut = 6) then + begin + sf_close( StreamOut[x].Data.HandleSt); + end; + + if (StreamOut[x].Data.TypePut = 7) then + begin + sf_close( StreamOut[x].Data.HandleSt); + end; + {$endif} + + end; + + +end; + +procedure Tuos_Player.DoMainLoopProc(x: integer); +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} +var + msg: TfpgMessageParams; + // for fpgui + {$endif} +begin + + {$IF DEFINED(mse)} + if StreamIn[x].LoopProc <> nil then + begin + application.queueasynccall(StreamIn[x].LoopProc); + end; + {$else} + + // The synchro main loop procedure + {$IF not DEFINED(Library)} + if StreamIn[x].LoopProc <> nil then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamIn[x].LoopProc) + ; + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := -1 ; + // it is the main loop procedure + msg.user.Param2 := 0 ; + // it is a INput procedure + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamIn[x].LoopProc); + {$endif} + {$endif} + + {$elseif not DEFINED(java)} + if (StreamIn[x].LoopProc <> nil) then + StreamIn[x].LoopProc; + {$else} + if (StreamIn[x].LoopProc <> nil) then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@Streamin[x]. + LoopProcjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@Streamin[x]. + LoopProcjava); + {$endif} + {$endif} + {$endif} +end; + +procedure Tuos_Player.DoBeginMethods; +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} +var + msg: TfpgMessageParams; + // for fpgui + {$endif} +begin +{$IF DEFINED(mse)} + if BeginProc <> nil then + begin + application.queueasynccall(BeginProc); + end; + {$else} + + {$IF not DEFINED(Library)} + if BeginProc <> nil then + // Execute BeginProc procedure + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,BeginProc); + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := -2 ; + // it is the first proc + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,BeginProc); + {$endif} + {$endif} + {$elseif not DEFINED(java)} + if BeginProc <> nil then + BeginProc; + {$else} + if BeginProc <> nil then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@BeginProcjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@BeginProcjava); + {$endif} + {$endif} + {$endif} +end; + +procedure Tuos_Player.DoLoopBeginMethods; +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} +var + msg: TfpgMessageParams; + // for fpgui + {$endif} +begin +{$IF DEFINED(mse)} + if LoopBeginProc <> nil then + begin + application.queueasynccall(LoopBeginProc); + end; + {$else} + {$IF not DEFINED(Library)} + if LoopBeginProc <> nil then + // Execute BeginProc procedure + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,LoopBeginProc); + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := -2 ; + // it is the first proc + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,LoopBeginProc); + {$endif} + {$endif} + {$elseif not DEFINED(java)} + if loopBeginProc <> nil then + loopBeginProc; + {$else} + if loopBeginProc <> nil then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@loopBeginProcjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@loopBeginProcjava); + {$endif} + {$endif} + {$endif} +end; + +procedure Tuos_Player.WriteOut(x:integer; x2 : integer); +var + err, rat, wantframestemp: integer; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + st : string; + i : integer; +{$endif} + Bufferst2mo: TDArFloat; +begin + // Convert Input format into Output format if needed: + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Convert Input format into Output'); + {$endif} + case StreamOut[x].Data.SampleFormat of + 0: case StreamIn[x2].Data.SampleFormat of + 1: StreamOut[x].Data.Buffer := + CvInt32toFloat32(StreamOut[x].Data.Buffer); + 2: StreamOut[x].Data.Buffer := + CvInt16toFloat32(StreamOut[x].Data.Buffer); + end; + end; + // End convert. + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Finally give buffer to output'); + {$endif} + + // writeln(inttostr(StreamOut[x].Data.TypePut)); + + // Finally give buffer to output + case StreamOut[x].Data.TypePut of + {$IF DEFINED(portaudio)} + 1: // Give to output device using portaudio + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Give to output device'); + writeln('length(StreamOut[x].Data.Buffer) =' + inttostr(length(StreamOut[x].Data.Buffer))); + {$endif} + + if (StreamIn[x2].Data.TypePut <> 1) or + ((StreamIn[x2].Data.TypePut = 1) and (StreamIn[x2].Data.Channels > 1)) then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st := ''; + for i := 0 to length(StreamOut[x].Data.Buffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(StreamOut[x].Data.Buffer[i]); + WriteLn('OUTPUT DATA into portaudio------------------------------'); + //WriteLn(st); + {$endif} + + // err :=// if you want clean buffer + + if assigned(StreamOut[x].Data.HandleSt) then + Pa_WriteStream(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamIn[x2].Data.outframes Div StreamIn + [x2].Data.ratio); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('give to output device 1'); +{$endif} + end + else + begin + // err :=// if you want clean buffer + Pa_WriteStream(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamIn[x2].Data.outframes); + end; + // if err <> 0 then status := 0;// if you want clean buffer ... +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('End give to output device 2'); +{$endif} + end; + {$endif} + + + {$IF DEFINED(shout)} + 2: // Give to IceCast server + begin + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Give to output IceCast server'); + {$endif} + + case StreamOut[x].Data.SampleFormat of + 0: + begin + err := opus_encode_float(StreamOut[x].encoder, @StreamOut[x].Data.Buffer[0], + cFRAME_SIZE*3, StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + 1: + begin + err := opus_encode(StreamOut[x].encoder, @StreamOut[x].Data.Buffer[0], cFRAME_SIZE* + 3, StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + 2: + begin + err := opus_encode(StreamOut[x].encoder, @StreamOut[x].Data.Buffer[0], cFRAME_SIZE*3 + , StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + end; + + StreamOut[x].data.outframes := err; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('opus_encode outframes =' + inttostr(err)); + WriteLn('----------------------------------'); + // writeln(tencoding.utf8.getstring(StreamOut[x].cbits)); + {$endif} + + if err > 0 then + + err := shout_send_raw(StreamOut[x].Data.HandleSt, StreamOut[x].cbits, StreamOut[x].data. + outframes); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_send ok ' + inttostr(err)) + else + WriteLn('shout_send error: '+ inttostr(err) + ' ' + pchar(shout_get_error(StreamOut[x]. + Data.HandleSt))); + writeln('End give output to IceCast server'); + {$endif} + + shout_sync(StreamOut[x].Data.HandleSt); + end; + {$endif} + + 3: + begin + // Give to memory buffer + + wantframestemp := StreamIn[x2].Data.outframes ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before Give to memory ------------------------------'); + st := ''; + for i := 0 to wantframestemp -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(StreamOut[x].Data.Buffer[i]); + WriteLn(st); + WriteLn('OUTPUT DATA AFTER5 ------------------------------'); + writeln('Streamout[x].Data.posmem before = '+inttostr( Streamout[x].Data.posmem)) ; + + writeln('StreamIn[x2].Data.outframes * StreamIn[x2].Data.channels = '+inttostr( StreamIn[x2 + ].Data.outframes * StreamIn[x2].Data.channels)) ; + writeln('length(tempoutmemory) = '+ inttostr(length(tempoutmemory))); + writeln('Begin Give to memory buffer'); + writeln('(StreamIn[x2].Data.outframes ) -1 = ' + + inttostr((StreamIn[x2].Data.outframes) -1)); + {$endif} + + if StreamIn[x2].Data.numbuf > -1 then + begin + // writeln('theinc = ' + inttostr(theinc)); + inc(theinc); + if theinc > StreamIn[x2].Data.numbuf then status := 0 ; + end; + + SetLength(Streamout[x].BufferOut^,length(Streamout[x].BufferOut^) + wantframestemp ); + + Streamout[x].Data.posmem := length(Streamout[x].BufferOut^) - wantframestemp; + + for x2 := 0 to (wantframestemp) -1 do + begin + Streamout[x].BufferOut^[Streamout[x].Data.posmem + x2] := StreamOut[x].Data.Buffer[x2]; + end; + Streamout[x].Data.posmem := Streamout[x].Data.posmem + (wantframestemp); + + // if Streamout[x].Data.SampleFormat > 0 then + //StreamOut[x].Data.Buffer := ConvertSampleFormat(StreamOut[x].Data); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Streamout[x].Data.posmem after = '+inttostr( Streamout[x].Data.posmem)) ; + st := ''; + for i := 0 to length(tempoutmemory) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(tempoutmemory[i]); + WriteLn('OUTPUT DATA AFTER5 ------------------------------'); + //WriteLn(st); + {$endif} + + end; + + 4: // Give to wav file from TMemoryStream + begin + + case StreamOut[x].Data.SampleFormat of + 0: rat := 2 ; + 1: rat := 2 ; + 2: rat := 1 ; + end; + + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 2) then + begin + + Bufferst2mo := CvSteroToMono(StreamOut[x].Data.Buffer, StreamIn[x2].Data.outframes); + + StreamOut[x].FileBuffer.DataMS.WriteBuffer( + Bufferst2mo[0], + StreamIn[x2].Data.outframes * rat); + end + else + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 1) then + begin + StreamOut[x].FileBuffer.DataMS.WriteBuffer( + StreamOut[x].Data.Buffer[0], StreamIn[x2] + .Data.outframes * StreamIn[x2].Data.ratio + * rat * 2); + end + else + + StreamOut[x].FileBuffer.DataMS.WriteBuffer( + StreamOut[x].Data.Buffer[0], StreamIn[x2]. + Data.outframes * StreamIn[x2].Data.Channels * + rat); + end; + + {$IF DEFINED(sndfile)} + 5: // Give to MemoryStream + begin + + if StreamIn[x2].Data.TypePut = 1 then rat := StreamIn[x2].Data.Channels + else rat := 1; + + // writeln('MemoryStream'); + + if assigned(StreamOut[x].MemorySteamOut) then + + case StreamOut[x].Data.SampleFormat of + + 0: StreamOut[x].Data.OutFrames := + sf_write_float(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes *rat ); + 1: StreamOut[x].Data.OutFrames := + sf_write_int(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes *rat ); + 2: StreamOut[x].Data.OutFrames := + sf_write_short(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes *rat); + end; + end; + + 6: // give to ogg file from Tfilestream + begin + //writeln('ok ogg'); + + + // if StreamIn[x2].Data.outframes = StreamOut[x].Data.Wantframes * StreamOut[x].Data.channels then + case StreamOut[x].Data.SampleFormat of + 0: StreamOut[x].Data.OutFrames := + sf_write_float(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes * StreamOut[x].Data.channels); + 1: StreamOut[x].Data.OutFrames := + sf_write_int(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes * StreamOut[x].Data.channels); + 2: StreamOut[x].Data.OutFrames := + sf_write_short(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes * StreamOut[x].Data.channels); + end; + sf_write_sync(StreamOut[x].Data.HandleSt); + // writeln(inttostr(StreamOut[x].Data.OutFrames)); + end; + + {$endif} + + + 0: // Give to wav file from TFileStream + begin + case StreamOut[x].Data.SampleFormat of + 0: rat := 2 ; + 1: rat := 2 ; + 2: rat := 1 ; + end; + + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 2) then + begin + + Bufferst2mo := CvSteroToMono(StreamOut[x].Data.Buffer, StreamIn[x2].Data.outframes); + + StreamOut[x].FileBuffer.Data.WriteBuffer( + Bufferst2mo[0], + StreamIn[x2].Data.outframes * rat); + end + else + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 1) then + begin + StreamOut[x].FileBuffer.Data.WriteBuffer( + StreamOut[x].Data.Buffer[0], StreamIn[x2]. + Data.outframes * StreamIn[x2].Data.ratio * + rat * 2); + end + else + + StreamOut[x].FileBuffer.Data.WriteBuffer( + StreamOut[x].Data.Buffer[0], StreamIn[x2].Data. + outframes * StreamIn[x2].Data.Channels * rat); + end; + + end; +end; + +procedure Tuos_Player.WriteOutPlug(x:integer; x2 : integer); +var + x3, x4, err, wantframestemp: integer; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st : string; + i : integer; + {$endif} + BufferplugINFLTMP: TDArFloat; + BufferplugFL: TDArFloat; + BufferplugSH: TDArShort; + BufferplugLO: TDArLong; + Bufferst2mo: TDArFloat; +begin + // convert buffer if needed + case StreamOut[x].Data.SampleFormat of + 1: StreamOut[x].Data.Buffer := + CvInt32toFloat32(StreamOut[x].Data.Buffer); + 2: StreamOut[x].Data.Buffer := + CvInt16toFloat32(StreamOut[x].Data.Buffer); + end; + + // transfer buffer out to temp + SetLength(BufferplugINFLTMP, (StreamIn[x2].Data.outframes) * + StreamIn[x2].Data.Channels); + + if length(BufferplugINFLTMP) > 2 then + for x3 := 0 to (length(BufferplugINFLTMP) div 2) - 1 do + BufferplugINFLTMP[x3] := cfloat(StreamOut[x].Data.Buffer[x3]); + + // dealing with input plugin + for x3 := 0 to high(PlugIn) do + begin + if PlugIn[x3].Enabled = True then + begin + {$IF DEFINED(bs2b) or DEFINED(soundtouch) or DEFINED(noiseremoval)} + BufferplugFL := Plugin[x3].PlugFunc(BufferplugINFLTMP, + Plugin[x3].PlugHandle, Plugin[x3].Abs2b, StreamIn[x2].Data, + Plugin[x3].param1, Plugin[x3].param2, Plugin[x3].param3, Plugin[x3].param4 + , + Plugin[x3].param5, Plugin[x3].param6, Plugin[x3].param7, Plugin[x3].param8 + ); + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('PlugFunc: Length(BufferplugINFLTMP,BufferplugFL) = ' + + inttostr(Length(BufferplugINFLTMP)) + ' , ' + inttostr(Length(BufferplugFL))); + {$endif} + + if (length(PlugIn) > 1) then + begin + // TO CHECK : works only if SoundTouch is last or only plugin + for x4 := 0 to length(BufferplugFL) - 1 do + BufferplugINFLTMP[x4] := cfloat(BufferplugFL[x4]); + end; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('2-PlugFunc: Length(BufferplugINFLTMP,BufferplugFL) = ' + + inttostr(Length(BufferplugINFLTMP)) + ' , ' + inttostr(Length(BufferplugFL))); + {$endif} + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Give the processed input to output.'); + writeln('Length(BufferplugFL) = ' + inttostr(Length(BufferplugFL))); + {$endif} + if Length(BufferplugFL) > 0 then + begin + + case StreamOut[x].Data.SampleFormat of + 1: + begin + SetLength(BufferplugLO, length(BufferplugFL)); + BufferplugLO := CvFloat32ToInt32(BufferplugFL); + end; + 2: + begin + SetLength(BufferplugSH, length(BufferplugFL)); + BufferplugSH := CvFloat32ToInt16(BufferplugFL); + + end; + end; + + case StreamOut[x].Data.TypePut of + + {$IF DEFINED(portaudio)} + 1: // Give to output device + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Before Pa_WriteStream: Length(BufferplugFL) = ' + inttostr(Length(BufferplugFL + ))); + {$endif} + case StreamOut[x].Data.SampleFormat of + 0: + begin + err := + Pa_WriteStream(StreamOut[x].Data.HandleSt, + @BufferplugFL[0], Length(BufferplugFL) Div + StreamIn[x2].Data.Channels); + end; + 1: + begin + BufferplugLO := CvFloat32ToInt32(BufferplugFL); + err := + Pa_WriteStream(StreamOut[x].Data.HandleSt, + @BufferplugLO[0], Length(BufferplugLO) Div + StreamIn[x2].Data.Channels); + end; + 2: + begin + BufferplugSH := CvFloat32ToInt16(BufferplugFL); + + err := + Pa_WriteStream(StreamOut[x].Data.HandleSt, + @BufferplugSH[0], Length(BufferplugSH) Div + StreamIn[x2].Data.Channels); + end; + end; + // if err <> 0 then status := 0;// if you want clean buffer ... + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Pa_WriteStream error = '+ inttostr(err)); + {$endif} + end; + {$endif} + + {$IF DEFINED(shout)} + 2: // Give to IceCast server + begin + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Give to output IceCast server'); + {$endif} + + case StreamOut[x].Data.SampleFormat of + 0: + begin + err := opus_encode_float(StreamOut[x].encoder, @BufferplugFL[0], cFRAME_SIZE, + StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + 1: + begin + err := opus_encode(StreamOut[x].encoder, @BufferplugLO[0], cFRAME_SIZE, + StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + 2: + begin + err := opus_encode(StreamOut[x].encoder, @BufferplugSH[0], cFRAME_SIZE, + StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + end; + + StreamOut[x].data.outframes := err ; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('opus_encode outframes =' + inttostr(err)); + WriteLn('----------------------------------'); + // writeln(tencoding.utf8.getstring(StreamOut[x].cbits)); + {$endif} + + if err > 0 then + + err := shout_send(StreamOut[x].Data.HandleSt, StreamOut[x].cbits, StreamOut[x].data. + outframes); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_send ok ' + inttostr(err)) + else + WriteLn('shout_send error: '+ inttostr(err) + ' ' + pchar(shout_get_error(StreamOut[x + ].Data.HandleSt))); + writeln('End give output to IceCast server'); + {$endif} + + shout_sync(StreamOut[x].Data.HandleSt); + // ? + + end; + {$endif} + + 0: + begin + // Give to wav file from TFileStream + + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 2) then + begin + Bufferst2mo := CvSteroToMono(BufferplugFL, Length(BufferplugFL) Div 2); + BufferplugSH := CvFloat32ToInt16(Bufferst2mo); + end + else + begin + BufferplugSH := CvFloat32ToInt16(BufferplugFL); + end; + StreamOut[x].FileBuffer.Data.WriteBuffer(BufferplugSH[0], + Length(BufferplugSH)); + + end; + + 4: + begin + // Give to wav file from TMemoryStream + + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 2) then + begin + Bufferst2mo := CvSteroToMono(BufferplugFL, Length(BufferplugFL) Div 2); + BufferplugSH := CvFloat32ToInt16(Bufferst2mo); + end + else + begin + BufferplugSH := CvFloat32ToInt16(BufferplugFL); + end; + StreamOut[x].FileBuffer.DataMS.WriteBuffer(BufferplugSH[0], + Length(BufferplugSH)); + + end; + + 5: // Give to MemoryStream + begin + + case StreamOut[x].Data.SampleFormat of + 0: StreamOut[x].MemorySteamOut.WriteBuffer(BufferplugFL[0], + Length(BufferplugFL)); + + 1: StreamOut[x].MemorySteamOut.WriteBuffer(BufferplugLO[0], + Length(BufferplugLO)); + + 2: StreamOut[x].MemorySteamOut.WriteBuffer(BufferplugSH[0], + Length(BufferplugSH)); + + end; + end; + + + 3: + begin + // Give to memory buffer + wantframestemp := Length(BufferplugFL) ; + SetLength(Streamout[x].BufferOut^,length(Streamout[x].BufferOut^) + wantframestemp ); + + for x2 := 0 to wantframestemp -1 do + Streamout[x].BufferOut^[Streamout[x].Data.posmem + x2] := BufferplugFL[x2]; + + Streamout[x].Data.posmem := Streamout[x].Data.posmem + wantframestemp; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Streamout[x].Data.posmem = '+inttostr( Streamout[x].Data.posmem)) ; + st := ''; + for i := 0 to length(tempoutmemory) -1 do + st := st + '|' + inttostr(i) + '|' + floattostr(tempoutmemory[i]); + WriteLn('OUTPUT DATA AFTER4 ------------------------------'); + WriteLn(st); + {$endif} + end; + + end; + end; +end; + +{$IF DEFINED(webstream)} +procedure Tuos_Player.ReadUrl(x : integer); +var + err : integer; + + {$IF DEFINED(fdkaac)} + FErrorCode : AAC_DECODER_ERROR; + FByteFilled, FBytesRead : longword; + FOutputBuff : array of cfloat; + FCStreamInfo : PCStreamInfo; + len, len2, len3: integer; + rawAACBuffer: PByte; + {$endif} + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + i : integer; + st : string; +{$endif} +begin + case StreamIn[x].Data.LibOpen of + 1 : + begin +{$IF DEFINED(mpg123)} + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('===> Before mpg123_read') ; +{$endif} + err := + mpg123_read(StreamIn[x].Data.HandleSt, @StreamIn[x].Data.Buffer[0], + StreamIn[x].Data.wantframes, StreamIn[x].Data.outframes); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('===> mpg123_read error => ' + inttostr(err)) ; +{$endif} + StreamIn[x].Data.outframes := + StreamIn[x].Data.outframes Div StreamIn[x].Data.Channels; +{$ENDIF} + end; + + 2: + begin +{$IF DEFINED(fdkaac)} + setlength(FOutputBuff, StreamIn[x].Data.wantframes); + + GetMem(rawAACBuffer,StreamIn[x].Data.wantframes); + + // writeln('avant bytesRead'); + FBytesRead := StreamIn[x].InPipe.Read(rawAACBuffer[0],1024); + + // writeln('StreamIn[x].Data.bytesRead ' + inttostr(StreamIn[x].Data.bytesRead)); + + FByteFilled := FBytesRead; + FErrorCode := aacDecoder_Fill(StreamIn[x].Data.HandleSt,@rawAACBuffer, FBytesRead, + FByteFilled); + + // writeLn('FByteFilled ' + inttostr(FByteFilled)); + + len2 := 0; + len3 := 0; + + while true do + begin + FErrorCode := aacDecoder_DecodeFrame(StreamIn[x].Data.HandleSt, PSmallInt(FOutputBuff), + StreamIn[x].Data.wantframes, 0); + + if (FErrorCode <> AAC_DECODER_ERROR.AAC_DEC_OK) then + begin + if FErrorCode = AAC_DECODER_ERROR.AAC_DEC_NOT_ENOUGH_BITS then + break; + // writeln(Format('Decode failed: %x', [Integer(FErrorCode)])); + end; + // else writeln('Decode ok '); + + FCStreamInfo := aacDecoder_GetStreamInfo(StreamIn[x].Data.HandleSt); + if ((not assigned(FCStreamInfo)) or (FCStreamInfo^.sampleRate <= 0)) then + raise Exception.Create('No stream info'); + + for len := 0 to (FCStreamInfo^.frameSize) -1 do + + begin + // writeln(round(FOutputBuff[len])); + StreamIn[x].Data.Buffer[len + len2] := FOutputBuff[len]; + // writeln((StreamIn[x].Data.Buffer[len + len2])); + inc(len3); + end; + len2 := len2 + FCStreamInfo^.frameSize; + end; + + // StreamIn[x].Data.outframes := len3 * StreamIn[x].Data.Channels; + StreamIn[x].Data.outframes := len3 * 2; + + if StreamIn[x].Data.SampleFormat < 2 then + begin + StreamIn[x].Data.Buffer := CvInt16ToFloat32(StreamIn[x].Data.Buffer); + if StreamIn[x].Data.SampleFormat = 1 then + StreamIn[x].Data.Buffer := CvFloat32toInt32fl(StreamIn[x].Data.Buffer, length( + StreamIn[x].Data.Buffer)); + end; + + freemem(rawAACBuffer); + + // writeln('---------- FIN read url ok '); +{$ENDIF} + end; + + 4 : + begin +{$IF DEFINED(opus)} + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('===> Before op_read_x.') ; +{$endif} + + case StreamIn[x].Data.SampleFormat of + 0: + begin + StreamIn[x].Data.outframes := cint(op_read_float(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0], cint(StreamIn[x].Data. + Wantframes + Div StreamIn[x].Data.channels) , Nil)); + end; + 1: + begin + StreamIn[x].Data.outframes := cint(op_read_float(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0], cint(StreamIn[x].Data. + Wantframes + Div StreamIn[x].Data.channels), Nil)); + + // no int32 format with opus => need a conversion from float32 to int32. + StreamIn[x].Data.Buffer := Cvfloat32ToInt32fl( StreamIn[x].Data.Buffer, + StreamIn[x].Data.outframes * StreamIn[x].Data.Channels ) + ; + end; + 2: + begin + + StreamIn[x].Data.outframes := cint( op_read(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0], cint(StreamIn[x].Data. + Wantframes + Div StreamIn[x].Data.channels), Nil)); + + end; + end; + + setlength(StreamIn[x].data.Buffer, StreamIn[x].Data.outframes * StreamIn[x].Data.Channels) + ; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Seek outframes = '+inttostr(StreamIn[x].Data.outframes)) ; + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + st := st + '|' + inttostr(i) + '|' + floattostr(StreamIn[x].data.Buffer[i]); + WriteLn('OUTPUT DATA AFTER1 ------------------------------'); + // WriteLn(st); + writeln(' StreamIn[x].Data.outframes = '+inttostr(StreamIn[x].Data.outframes * StreamIn[x] + .Data.Channels)) ; +{$endif} + + if StreamIn[x].Data.outframes < 0 then StreamIn[x].Data.outframes := 0 ; + +{$ENDIF} + end; + end; + + if (StreamIn[x].Data.TypePut = 2) and ((StreamIn[x].Data.LibOpen = 1 ) or (StreamIn[x].Data. + LibOpen = 4 )) then + begin + if StreamIn[x].httpget.IsRunning = false then StreamIn[x].Data.status := 0; + // no more data then close the stream + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Check if internet is stopped.'); + {$endif} + end; + +end; +{$endif} + +procedure Tuos_Player.ReadFile(x : integer); +{$IF DEFINED(neaac) or DEFINED(uos_debug)} +var +{$endif} +{$IF DEFINED(neaac)} + outBytes: longword; +{$endif} +{$IF DEFINED(uos_debug) and DEFINED(unix)} + i : integer; + st : string; +{$endif} +begin + + if length(StreamIn[x].Data.Buffer) <> StreamIn[x].Data.Wantframes then + setlength(StreamIn[x].Data.Buffer,StreamIn[x].Data.Wantframes); + + case StreamIn[x].Data.LibOpen of + // Here we are, reading the data and store it in buffer + {$IF DEFINED(sndfile)} + 0: + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before sf_read ' + inttostr(StreamIn[x].Data.Wantframes) + + ' length(StreamIn[x].Data.Buffer ' + + inttostr(length(StreamIn[x].Data.Buffer))); + {$endif} + case StreamIn[x].Data.SampleFormat of + 0: StreamIn[x].Data.OutFrames := + sf_read_float(StreamIn[x].Data.HandleSt, + @StreamIn[x].Data.Buffer[0], StreamIn[x].Data.Wantframes + ); + 1: StreamIn[x].Data.OutFrames := + sf_read_int(StreamIn[x].Data.HandleSt, + @StreamIn[x].Data.Buffer[0], StreamIn[x].Data.Wantframes + ); + 2: StreamIn[x].Data.OutFrames := + sf_read_short(StreamIn[x].Data.HandleSt, + @StreamIn[x].Data.Buffer[0], StreamIn[x].Data.Wantframes + ); + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln(inttostr(StreamIn[x].Data.lastbuf)); + WriteLn('after sf_read'); + {$endif} + if StreamIn[x].Data.outframes < 0 then StreamIn[x].Data.outframes := 0 ; + + if (StreamIn[x].Data.lastbuf < 0) and (StreamIn[x].Data.outframes < StreamIn[x].Data. + wantframes) then + begin + StreamIn[x].Data.outframes := StreamIn[x].Data.wantframes; + StreamIn[x].Data.lastbuf := StreamIn[x].Data.lastbuf -1; + if StreamIn[x].Data.lastbuf = -9 then StreamIn[x].Data.lastbuf := 0; + end; + + setlength(StreamIn[x].data.Buffer,StreamIn[x].Data.outframes); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + st := ''; + + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + case StreamIn[x].Data.SampleFormat of + 0: st := st + '|' + inttostr(i) + '=' + floattostr(StreamIn[x].data.Buffer[i]); + 1: st := st + '|' + inttostr(i) + '=' + inttostr(cint32(StreamIn[x].data.Buffer[i])); + 2: st := st + '|' + inttostr(i) + '=' + inttostr(cint16(cint32(StreamIn[x].data.Buffer[ + i]))); + end; + + WriteLn('OUTPUT DATA sf_read_() ---------------------------'); + WriteLn('StreamIn[x].Data.outframes = ' + inttostr(StreamIn[x].Data.outframes)); + WriteLn(st); + {$endif} + + end; + {$endif} + {$IF DEFINED(mpg123)} + 1: + begin + + mpg123_read(StreamIn[x].Data.HandleSt, @StreamIn[x].Data.Buffer[0], + StreamIn[x].Data.wantframes, StreamIn[x].Data.outframes); + + if StreamIn[x].Data.outframes < 0 then StreamIn[x].Data.outframes := 0 ; + + setlength(StreamIn[x].data.Buffer,StreamIn[x].Data.outframes Div + (StreamIn[x].Data.channels) ); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + case StreamIn[x].Data.SampleFormat of + 0: st := st + '|' + floattostr(StreamIn[x].data.Buffer[i]); + 1: st := st + '|' + inttostr(cint32(StreamIn[x].data.Buffer[i])); + 2: st := st + '|' + inttostr(cint16(cint32(StreamIn[x].data.Buffer[i]))); + end; + WriteLn('OUTPUT DATA mpg123_read_() ---------------------------'); + // WriteLn(st); + {$endif} + + StreamIn[x].Data.outframes := + StreamIn[x].Data.outframes Div StreamIn[x].Data.Channels; + end; + {$endif} + + {$IF DEFINED(neaac)} + 2 : + begin + StreamIn[x].AACI.lwDataLen := 0; + case StreamIn[x].AACI.outputFormat of + FAAD_FMT_16BIT, FAAD_FMT_32BIT, FAAD_FMT_FLOAT : + begin + outBytes := StreamIn[x].Data. + Wantframes; + MP4GetData(StreamIn[x].AACI, StreamIn + [x].AACI.pData, outBytes); + Move(StreamIn[x].AACI.pData^, + StreamIn[x].Data.Buffer[0], + outBytes); + StreamIn[x].AACI.lwDataLen := + + outBytes + ; + end; + end; + if StreamIn[x].AACI.lwDataLen > (StreamIn[x].AACI.BitsPerSample div 8) then + StreamIn[x].Data.outframes := trunc(StreamIn[x].AACI.lwDataLen Div (StreamIn[x].AACI. + BitsPerSample Div 8)) + else + StreamIn[x].Data.outframes := 0; + + if StreamIn[x].Data.outframes < 0 then StreamIn[x].Data.outframes := 0 ; + + + // setlength(StreamIn[x].data.Buffer,StreamIn[x].Data.outframes * StreamIn[x].Data.channels ); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + case StreamIn[x].Data.SampleFormat of + 0: st := st + '|' + floattostr(StreamIn[x].data.Buffer[i]); + 1: st := st + '|' + inttostr(cint32(StreamIn[x].data.Buffer[i])); + 2: st := st + '|' + inttostr(cint16(cint32(StreamIn[x].data.Buffer[i]))); + end; + WriteLn('OUTPUT DATA MP4GetData() ---------------------------'); + // WriteLn(st); + {$endif} + + end; + {$endif} + + {$IF DEFINED(cdrom)} + 3: + begin + StreamIn[x].pCD^.pDataLen := 0; + case StreamIn[x].pCD^.BitsPerSample of + 16 : + begin + outBytes := StreamIn[x].Data.Wantframes; + CDROM_GetData(StreamIn[x].pCD, StreamIn[x].pCD^.pData, outBytes); + Move(StreamIn[x].pCD^.pData^, StreamIn[x].Data.Buffer[0], outBytes); + StreamIn[x].pCD^.pDataLen := outBytes; + end; + end; + + if StreamIn[x].pCD^.pDataLen > (StreamIn[x].pCD^.BitsPerSample div 8) then + StreamIn[x].Data.outframes := StreamIn[x].pCD^.pDataLen Div (StreamIn[x].pCD^. + BitsPerSample Div 8) + else + StreamIn[x].Data.outframes := 0; + + end; + {$endif} + + {$IF DEFINED(opus)} + 4: + begin + + case StreamIn[x].Data.SampleFormat of + 0: StreamIn[x].Data.outframes := op_read_float(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0], cint(StreamIn[x].Data. + Wantframes Div StreamIn[x].Data.channels), Nil); + 1: + begin + StreamIn[x].Data.outframes := op_read_float(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0],cint(StreamIn[x].Data. + Wantframes Div StreamIn[x].Data.channels), Nil); + + // no int32 format with opus => needs a conversion from float32 to int32. + StreamIn[x].Data.Buffer := Cvfloat32ToInt32fl( StreamIn[x].Data.Buffer, + StreamIn[x].Data.outframes * StreamIn[x].Data.Channels ); + end; + 2: + begin + StreamIn[x].Data.outframes := op_read(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0], cint(StreamIn[x].Data. + Wantframes), Nil); + end; + + end; + + setlength(StreamIn[x].data.Buffer,int32(StreamIn[x].Data.outframes * StreamIn[x].Data. + Channels)); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + case StreamIn[x].Data.SampleFormat of + 0: st := st + '|' + floattostr(StreamIn[x].data.Buffer[i]); + 1: st := st + '|' + inttostr(cint32(StreamIn[x].data.Buffer[i])); + 2: st := st + '|' + inttostr(cint16(cint32(StreamIn[x].data.Buffer[i]))); + end; + WriteLn('OUTPUT DATA op_read_ ---------------------------'); + // WriteLn(st); + {$endif} + + if StreamIn[x].Data.outframes < 0 then StreamIn[x].Data.outframes := 0 ; + StreamIn[x].Data.outframes := StreamIn[x].Data.outframes * StreamIn[x].Data.Channels ; + + end; + {$endif} + + {$IF DEFINED(xmp)} + 5: + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before xmp_play_buffer ' + inttostr(StreamIn[x].Data.Wantframes) + + ' length(StreamIn[x].Data.Buffer ' + + inttostr(length(StreamIn[x].Data.Buffer))); + {$endif} + + if xmp_play_buffer(StreamIn[x].Data.HandleSt, + @StreamIn[x].Data.Buffer[0], StreamIn[x].Data.Wantframes * StreamIn[x].Data.channels , 0 + ) < 0 then + StreamIn[x].Data.outframes := 0 + else + begin + StreamIn[x].Data.outframes := StreamIn[x].Data.Wantframes; + + if StreamIn[x].Data.SampleFormat < 2 then + begin + StreamIn[x].Data.Buffer := CvInt16ToFloat32(StreamIn[x].Data.Buffer); + if StreamIn[x].Data.SampleFormat = 1 then + StreamIn[x].Data.Buffer := CvFloat32toInt32fl(StreamIn[x].Data.Buffer, length( + StreamIn[x].Data.Buffer)); + end; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln(inttostr(StreamIn[x].Data.lastbuf)); + WriteLn('after xmp_play_buffer'); + {$endif} + setlength(StreamIn[x].data.Buffer,StreamIn[x].Data.outframes); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + + st := ''; + + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + begin + st := st + '|' + inttostr(i) + '=' + inttostr(cint16(cint32(StreamIn[x].data.Buffer[ + i]))); + end; + + WriteLn('OUTPUT DATA xmp_read_ ---------------------------'); + WriteLn('StreamIn[x].Data.outframes = ' + inttostr(StreamIn[x].Data.outframes)); + // WriteLn(st); + {$endif} + + end; + {$endif} + + 99: // if nothing was defined + end; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.outframes); +end; + +procedure Tuos_Player.CheckIfPaused ; +begin + if isGlobalPause = true then + begin + RTLeventWaitFor(uosInit.evGlobalPause); + RTLeventSetEvent(uosInit.evGlobalPause); + end + else + begin + RTLeventWaitFor(evPause); + // is there a pause waiting ? + RTLeventSetEvent(evPause); + end; +end; + +{$IF DEFINED(mse)} +function Tuos_Player.execute(thread: tmsethread): integer; +// The Main Loop Procedure + {$else} +procedure TuosThread.Execute; +// The Main Loop Procedure + {$endif} +var + x, x2, x3 : cint32; + plugenabled: boolean; + curpos: cint64 = 0; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st : string; + i : integer; + {$endif} + +begin + + theinc := 0; + + +{$IF DEFINED(mse)} + {$else} + with Tuos_Player(theparent) do + begin + {$endif} + + CheckIfPaused ; + // is there a pause waiting ? + + DoBeginMethods(); + + CheckIfPaused ; + // is there a pause waiting ? + + repeat + + if uosisactif then DoLoopBeginMethods + else nofree := false; + + CheckIfPaused ; + // is there a pause waiting ? + // Dealing with input + for x := 0 to high(StreamIn) do + begin + + if (StreamIn[x].data.hasfilters) and uosisactif then + begin + setlength(StreamIn[x].Data.levelfiltersar,StreamIn[x].Data.nbfilters * StreamIn[x]. + Data.channels ); + StreamIn[x].Data.incfilters := 0; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before for x := 0 to high(StreamIn)'); + {$endif} + + CheckIfPaused ; + // is there a pause waiting ? + + if (StreamIn[x].Data.Status > 0) and + (StreamIn[x].Data.Enabled = True) then + begin + + StreamIn[x].Data.levelfilters := ''; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before StreamIn[x].Data.Seekable = True'); + {$endif} + if (StreamIn[x].Data.Poseek > -1) and (StreamIn[x].Data.Seekable = True) and + uosisactif then + begin + // there is a seek waiting + + DoSeek(x); + + curpos := StreamIn[x].Data.Poseek; + StreamIn[x].Data.Poseek := -1; + end; + + if (StreamIn[x].Data.positionEnable = 1) and (StreamIn[x].Data.Seekable = True) + then + StreamIn[x].Data.position := curpos; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin BeforeBufProc 1'); + {$endif} + if (StreamIn[x].Data.Status = 1) and (length(StreamIn[x].DSP) > 0) then + DoDSPinBeforeBufProc(x); + // Procedure in DSP to execute before fill buffer. + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin BeforeBufProc 2'); + {$endif} + + if uosisactif then + begin + CheckIfPaused ; + // is there a pause waiting ? + case StreamIn[x].Data.TypePut of + + 0: // It is a input from audio file. + ReadFile(x); + + {$IF DEFINED(portaudio)} + 1: // for Input from device + ReadDevice(x); + {$endif} + + {$IF DEFINED(webstream)} + 2: // for Input from Internet audio stream. + ReadUrl(x); + {$ENDIF} + + {$IF DEFINED(synthesizer)} + 3: // for Input from Synthesizer + ReadSynth(x); + {$endif} + + 4: // for Input from memory + ReadMem(x); + + 5: // for Input from endless muted + ReadEndless(x); + + 6: // for Input from decoded memory-stream + ReadMemDec(x); + + end; + //case StreamIn[x].Data.TypePut of + + end + else StreamIn[x].Data.OutFrames := 0; + + if StreamIn[x].Data.OutFrames = 0 then StreamIn[x].Data.status := 0; + + if (StreamIn[x].Data.Seekable = True) then if StreamIn[x].Data.OutFrames < 100 then + StreamIn[x].Data.status := 0; + // no more data then close the stream + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('StreamIn[x].Data.status = ' + inttostr(StreamIn[x].Data.status)); + {$endif} + + if StreamIn[x].Data.status > 0 then// still working + begin + + if (StreamIn[x].Data.positionEnable = 1) then + begin + if (StreamIn[x].Data.LibOpen = 1) and (StreamIn[x].Data.SampleFormat < 2) + then + + curpos := curpos + (StreamIn[x].Data.OutFrames Div + (StreamIn[x].Data.Channels * 2)) + // strange outframes float 32 with Mpg123 ? + else + curpos := curpos + (StreamIn[x].Data.OutFrames Div + (StreamIn[x].Data.Channels)); + + StreamIn[x].Data.position := curpos; + // new position + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Getting the level before DSP procedure'); + {$endif} + + if (StreamIn[x].Data.levelEnable = 1) or (StreamIn[x].Data.levelEnable = 3) then + StreamIn[x].Data := DSPLevel(StreamIn[x].Data); + + // Adding level in array-level// ideal for pre-wave form + if (StreamIn[x].Data.levelArrayEnable = 1) then + begin + if (StreamIn[x].Data.levelEnable = 0) or (StreamIn[x].Data.levelEnable = 3) + then + StreamIn[x].Data := DSPLevel(StreamIn[x].Data); + DoArrayLevel(x); + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin AfterBuffProcBefore'); + {$endif} + + if (StreamIn[x].Data.Status = 1) and (length(StreamIn[x].DSP) > 0) then + DoDSPinAfterBufProc(x) ; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin AfterBuffProcAfter'); + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('The synchro main loop procedurebefore'); + {$endif} + DoMainLoopProc(x); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Getting the level after DSP procedure'); + {$endif} + + // Getting the level after DSP procedure + if ((StreamIn[x].Data.levelEnable = 2) or (StreamIn[x].Data.levelEnable = 3)) + then StreamIn[x].Data := DSPLevel(StreamIn[x].Data); + + // Adding level in array-level + if (StreamIn[x].Data.levelArrayEnable = 2) then + begin + if (StreamIn[x].Data.levelEnable = 0) or (StreamIn[x].Data.levelEnable = 1) + then + StreamIn[x].Data := DSPLevel(StreamIn[x].Data); + DoArrayLevel(x); + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('End level after DSP procedure'); + {$endif} + + end; + //if StreamIn[x].Data.status > 0 then + + end; + //if (StreamIn[x].Data.Status > 0) and (StreamIn[x].Data.Enabled = True) then + + end; + // end for low(StreamIn[x]) to high(StreamIn[x]) + + // Seeking if StreamIn is terminated + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Seeking if StreamIn is terminated'); + {$endif} + + if status <> 0 then SeekIfTerminated; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('status = ' +inttostr(status)); + {$endif} + + CheckIfPaused ; + // is there a pause waiting ? + + // Give Buffer to Output + if status = 1 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Give Buffer to Output'); + {$endif} + + if uosisactif then for x := 0 to high(StreamOut) do + + if (StreamOut[x].Data.Enabled = True) + then + begin + + if StreamOut[x].data.hasfilters then + begin + setlength(StreamOut[x].Data.levelfiltersar,StreamOut[x]. + Data.nbfilters * StreamOut[x].Data.channels ); + StreamOut[x].Data.incfilters := 0; + end; + + for x2 := 0 to high(StreamOut[x].Data.Buffer) do + StreamOut[x].Data.Buffer[x2] := cfloat(0.0); + // clear output + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Buffer[x2] := cfloat(0.0)'); + {$endif} + for x2 := 0 to high(StreamIn) do + if (StreamIn[x2].Data.status > 0) and + (StreamIn[x2].Data.Enabled = True) + and ((StreamIn[x2].Data.Output = x) or (StreamIn[x2].Data + .Output = -1)) + then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('length(StreamIn[x2].Data.Buffer) = ' +inttostr( + length(StreamIn[x2].Data.Buffer))); + writeln('length(StreamOut[x].Data.Buffer) = ' +inttostr( + length(StreamOut[x].Data.Buffer))); + writeln( + + 'for x3 := 0 to high(StreamIn[x2].Data.Buffer) do' + ); + writeln('high(StreamIn[x2].Data.Buffer) = '+ inttostr( + high(StreamIn[x2].Data.Buffer))); + {$endif} + + for x3 := 0 to high(StreamIn[x2].Data.Buffer) do + begin + if x3 < high(StreamOut[x].Data.Buffer) + 1 then + StreamOut[x].Data.Buffer[x3] := + cfloat(StreamOut[x] + .Data.Buffer[x3]) + + cfloat(StreamIn[x2] + .Data.Buffer[x3]); + + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn( + + 'StreamOut[x].Data.Buffer ------------------------------' + ); + st := ''; + for i := 0 to length(StreamOut[0].Data.Buffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr( + Streamout[0].Data.Buffer[i]); + // WriteLn(st); + writeln( + + 'for x3 := 0 to high(StreamIn[x2].Data.Buffer) done' + ); + {$endif} + + case StreamIn[x2].Data.LibOpen of + 0: StreamOut[x].Data.outframes := StreamIn[x2].Data. + outframes ; + // sndfile + 1: StreamOut[x].Data.outframes := StreamIn[x2].Data. + outframes Div + StreamIn[x2].Data. + Channels; + // mpg123 + 2: StreamOut[x].Data.outframes := StreamIn[x2].Data. + outframes ; + // aac + 3: StreamOut[x].Data.outframes := StreamIn[x2].Data. + outframes ; + // CDRom + 4: StreamOut[x].Data.outframes := StreamIn[x2].Data. + outframes ; + // opus + end; + + end; + + // copy buffer-in into buffer-out + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('copy buffer-in into buffer-out'); + {$endif} + + // DSPOut AfterBuffProc + if (length(StreamOut[x].DSP) > 0) and uosisactif then + + DoDSPOutAfterBufProc(x) ; + + // apply plugin (ex: SoundTouch Library) + plugenabled := False; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln(' if (length(Plugin) > 0) then'); + {$endif} + + if (length(Plugin) > 0) then + begin + for x3 := 0 to high(PlugIn) do + if Plugin[x3].Enabled = True then + plugenabled := True; + end; + // + + if uosisactif then + begin + if plugenabled = True then + WriteOutPlug(x, x2) + else// No plugin + WriteOut(x, x2); + end; + + end; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before LoopEndProc ------------------------------'); + {$endif} + + if uosisactif then DoLoopEndMethods; + + if length(StreamIn) > 1 then// clear buffer for multi-input + for x2 := 0 to high(StreamIn) do + for x3 := 0 to high(StreamIn[x2].Data.Buffer) do + StreamIn[x2].Data.Buffer[x3] := cfloat(0.0); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before if (nofree = true) and (status = 0)-----'); + {$endif} + + if (nofree = true) and (status = 0) then + + DoTerminateNoFreePlayer ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before until status = 0;----'); + {$endif} + + until status = 0; + + // End of Loop --- + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before Terminate Thread---'); + {$endif} + + // Terminate Thread + if status = 0 then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Status = 0'); + {$endif} + + DoTerminatePlayer; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('EndProc---'); + {$endif} + + if uosisactif then DoEndProc; + + if uosisactif then if EndProcOnly <> nil then EndProcOnly; + + isAssigned := false ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('EndProc All'); + {$endif} + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('This is the end...'); + {$endif} + + {$IF DEFINED(mse)} + + {$else} + // FreeOnTerminate:=True; + // terminate(); + end; + {$endif} +end; + +procedure Tuos_Init.unloadPlugin(PluginName: Pchar); +// Unload Plugin... +begin + + {$IF DEFINED(soundtouch)} + if lowercase(PluginName) = 'soundtouch' then st_Unload(); + {$endif} + {$IF DEFINED(bs2b)} + if lowercase(PluginName) = 'bs2b' then bs_Unload(); + {$endif} + +end; + +procedure Tuos_Init.unloadlib; +begin + {$IF DEFINED(sndfile)} + Sf_Unload(); + {$endif} + {$IF DEFINED(mpg123)} + Mp_Unload(); + {$endif} + {$IF DEFINED(xmp)} + xmp_Unload(); + {$endif} + {$IF DEFINED(portaudio)} + Pa_Unload(); + {$endif} + {$IF DEFINED(neaac)} + Aa_Unload; + {$endif} + {$IF DEFINED(fdkaac)} + ad_Unload; + {$endif} + {$IF DEFINED(opus)} + //op_Unload; + of_Unload; + {$endif} + {$IF DEFINED(windows)} + Set8087CW(old8087cw); + {$endif} +end; + +function Tuos_Init.InitLib(): cint32; +begin + Result := -1; + {$IF DEFINED(mpg123)} + if (uosLoadResult.MPloadERROR = 0) then + if mpg123_init() = MPG123_OK then + begin + mpversion := UTF8Decode(mpg123_decoders()^); + uosLoadResult.MPinitError := 0; + Result := 0; + end + else + begin + Result := -2; + uosLoadResult.MPinitError := 1; + end; + {$endif} + + {$IF DEFINED(portaudio)} + if (uosLoadResult.PAloadERROR = 0) then + begin + uosLoadResult.PAinitError := Pa_Initialize(); + paversion := UTF8Decode(Pa_GetVersionText()); + if uosLoadResult.PAinitError = 0 then + begin + Result := 0; + DefDevInInfo := Nil ; + DefDevOutInfo := Nil ; + + DefDevOut := Pa_GetDefaultOutputDevice(); + if DefDevOut >= 0 then + DefDevOutInfo := Pa_GetDeviceInfo(DefDevOut); + if DefDevOutInfo <> nil then + DefDevOutAPIInfo := Pa_GetHostApiInfo(DefDevOutInfo^.hostApi); + + DefDevIn := Pa_GetDefaultInputDevice(); + if DefDevIn >= 0 then + DefDevInInfo := Pa_GetDeviceInfo(DefDevIn); + if DefDevInInfo <> nil then + DefDevInAPIInfo := Pa_GetHostApiInfo(DefDevInInfo^.hostApi); + end; + + end; + {$endif} + + {$IF DEFINED(sndfile)} + if (Result = -1) and (uosLoadResult.SFloadERROR = 0) then + begin + sfversion := UTF8Decode(sf_version_string()); + Result := 0; + end; + {$endif} + + {$IF DEFINED(xmp)} + if (Result = -1) and (uosLoadResult.XMloadERROR = 0) then + begin + Result := 0; + end; + {$endif} + +end; + +function Tuos_Init.loadlib(): cint32; +begin + Result := -1; + uosLoadResult.PAloadERROR := -1; + uosLoadResult.SFloadERROR := -1; + uosLoadResult.MPloadERROR := -1; + uosLoadResult.AAloadError := -1; + uosLoadResult.OPloadERROR := -1; + uosLoadResult.STloadERROR := -1; + uosLoadResult.BSloadERROR := -1; + uosLoadResult.XMloadERROR := -1; + uosLoadResult.FAloadERROR := -1; + + {$IF DEFINED(portaudio)} + if (PA_FileName <> nil) and (PA_FileName <> '') then + begin + if PA_FileName = 'system' then PA_FileName := '' ; + if Pa_Load(PA_FileName) then + begin + // { + Result := 0; + uosLoadResult.PAloadERROR := 0; + uosDefaultDeviceOut := Pa_GetDefaultOutPutDevice(); + uosDefaultDeviceIn := Pa_GetDefaultInPutDevice(); + uosDeviceCount := Pa_GetDeviceCount(); + // } + end + else + uosLoadResult.PAloadERROR := 2; + end + else + uosLoadResult.PAloadERROR := -1; + {$endif} + + {$IF DEFINED(sndfile)} + if (SF_FileName <> nil) and (SF_FileName <> '') then + begin + if Sf_FileName = 'system' then sf_FileName := '' ; + if Sf_Load(SF_FileName) then + begin + uosLoadResult.SFloadERROR := 0; + if uosLoadResult.PAloadERROR = -1 then + Result := 0; + end + else + begin + uosLoadResult.SFloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.SFloadERROR := -1; + {$endif} + + {$IF DEFINED(mpg123)} + if (MP_FileName <> nil) and (MP_FileName <> '') then + begin + if mp_FileName = 'system' then mp_FileName := '' ; + if mp_Load(Mp_FileName) then + begin + uosLoadResult.MPloadERROR := 0; + if (uosLoadResult.PAloadERROR = -1) and (uosLoadResult.SFloadERROR = -1) then + Result := 0; + end + else + begin + uosLoadResult.MPloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.MPloadERROR := -1; + {$endif} + + {$IF DEFINED(neaac)} + if (AA_FileName <> nil) and (AA_FileName <> '') and (M4_FileName <> nil) and (M4_FileName <> '') + then + begin + if m4_FileName = 'system' then m4_FileName := '' ; + if aa_FileName = 'system' then aa_FileName := '' ; + + if aa_load(UTF8String(M4_FileName), UTF8String(AA_FileName)) then + begin + uosLoadResult.AAloadERROR := 0; + if (uosLoadResult.MPloadERROR = -1) and (uosLoadResult.PAloadERROR = -1) and + (uosLoadResult.SFloadERROR = -1) then + Result := 0; + end + else + begin + uosLoadResult.AAloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.AAloadERROR := -1; + {$endif} + + {$IF DEFINED(opus)} + if (OF_FileName <> nil) and (OF_FileName <> '') then + begin + if of_FileName = 'system' then of_FileName := '' ; + if (of_load(UTF8String(OF_FileName))) then + begin + uosLoadResult.OPloadERROR := 0; + if (uosLoadResult.MPloadERROR = -1) and (uosLoadResult.PAloadERROR = -1) and + (uosLoadResult.SFloadERROR = -1) and (uosLoadResult.AAloadERROR = -1) + then + Result := 0; + end + else + begin + uosLoadResult.OPloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.OPloadERROR := -1; + {$endif} + + {$IF DEFINED(xmp)} + if (XM_FileName <> nil) and (XM_FileName <> '') then + begin + if XM_FileName = 'system' then XM_FileName := '' ; + if (xmp_Load(UTF8String(XM_FileName))) then + begin + uosLoadResult.XMloadERROR := 0; + if (uosLoadResult.MPloadERROR = -1) and (uosLoadResult.PAloadERROR = -1) and + (uosLoadResult.SFloadERROR = -1) and (uosLoadResult.AAloadERROR = -1) and + (uosLoadResult.OPloadERROR = -1) + then + Result := 0; + end + else + begin + uosLoadResult.XMloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.XMloadERROR := -1; + {$endif} + + {$IF DEFINED(fdkaac)} + if (FA_FileName <> nil) and (FA_FileName <> '') then + begin + if FA_FileName = 'system' then FA_FileName := '' ; + if (ad_Load(UTF8String(FA_FileName))) then + begin + uosLoadResult.FAloadERROR := 0; + if (uosLoadResult.MPloadERROR = -1) and (uosLoadResult.PAloadERROR = -1) and + (uosLoadResult.SFloadERROR = -1) and (uosLoadResult.AAloadERROR = -1) and + (uosLoadResult.OPloadERROR = -1) and (uosLoadResult.XMloadERROR = -1) + then + Result := 0; + end + else + begin + uosLoadResult.FAloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.FAloadERROR := -1; + {$endif} + + if Result = 0 then Result := InitLib(); +end; + + +function uos_loadPlugin(PluginName, PluginFilename: PChar) : cint32; +begin + Result := -1; + {$IF DEFINED(soundtouch)} + if ((lowercase(PluginName) = 'soundtouch') or (lowercase(PluginName) = 'getbpm')) and ( + PluginFileName <> nil) and (PluginFileName <> '') then + begin + if PluginFileName = 'system' then PluginFileName := '' ; + if ST_Load(PluginFileName) then + begin + Result := 0; + uosLoadResult.STloadERROR := 0; + uosInit.Plug_ST_FileName := PluginFileName; + end + else + begin + uosLoadResult.STloadERROR := 2; + Result := -1; + end; + end; + + {$endif} + + {$IF DEFINED(bs2b)} + if (lowercase(PluginName) = 'bs2b') and (PluginFileName <> nil) and (PluginFileName <> '') then + begin + if PluginFileName = 'system' then PluginFileName := '' ; + if BS_Load(PluginFileName) then + begin + Result := 0; + uosLoadResult.BSloadERROR := 0; + uosInit.Plug_BS_FileName := PluginFileName; + end + else + begin + uosLoadResult.BSloadERROR := 2; + Result := -1; + end; + end; + {$endif} +end; + + +{$IF DEFINED(shout)} +function uos_LoadServerLib(ShoutFileName, OpusFileName : PChar) : cint32; +// Shout => needed for dealing with IceCast server +// Opus => needed for dealing with encoding opus stream +begin + Result := -1; + if not fileexists(ShoutFileName) then + else + if sh_Load(UTF8String(ShoutFileName)) then + Result := 0; + + if result = 0 then + if not fileexists(OpusFileName) then + Result := -2 + else + if op_Load(UTF8String(OpusFileName)) then + Result := 0 + else Result := -1 ; +end; + +procedure uos_unloadServerLib(); +// Unload server libraries... Do not forget to call it before close application... +begin + shout_shutdown; + sh_unload; + op_unload; +end; +{$endif} + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName, fdkaacFilename : PChar) : cint32; +begin + result := -1 ; + if not assigned(uosInit) then + begin + + {$IF DEFINED(windows)} + old8087cw := Get8087CW; + Set8087CW($133f); + {$endif} + + uosInit := TUOS_Init.Create; + // Create Libraries Loader-Init + end; + + uosInit.PA_FileName := PortAudioFileName; + uosInit.SF_FileName := SndFileFileName; + uosInit.MP_FileName := Mpg123FileName; + uosInit.AA_FileName := FaadFileName; + uosInit.M4_FileName := Mp4ffFileName; + uosInit.OF_FileName := opusfileFileName; + uosInit.XM_FileName := XMPFileName; + uosInit.FA_FileName := fdkaacFilename; + + result := uosInit.loadlib ; +end; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName : PChar) : cint32; +begin + result := uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, + FaadFileName + , opusfileFileName, XMPFileName, nil); +end; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName: PChar) : cint32; +begin + result := uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, + FaadFileName + , opusfileFileName, Nil, nil); +end; + +function uos_GetVersion() : cint32 ; +begin + result := uos_version ; +end; + +function Tuos_Player.SetGlobalEvent(isenabled : boolean) : boolean; +// Set the RTL Events Global (will pause/start/replay all the players synchro with same rtl event)) +// result : true if set ok. +begin + result := false; + if (isAssigned = True) then + begin + isGlobalPause := isenabled; + result := true; + end; +end; + +procedure uos_unloadlib() ; +begin + if assigned(uosInit) then + begin + uosInit.unloadlib ; + end; +end; + +procedure uos_unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: boolean); +// Custom Unload libraries... if true, then unload the library. You may unload what and when you want... +begin + uosInit.unloadlibcust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac) ; +end; + +procedure uos_UnloadPlugin(PluginName: PChar); +// load plugin... +begin + uosInit.unloadplugin(PluginName); +end; + +function uos_GetInfoLibraries() : PansiChar ; +begin + result := pchar(paversion + ' | Sndfile: ' + sfversion + ' | Mpg123: ' + mpversion); +end; + +{$IF DEFINED(portaudio)} +procedure uos_UpdateDevice(); +begin + Pa_Terminate(); + Pa_Initialize(); +end; + +procedure uos_GetInfoDevice(); +var + x: cint32; + devinf: PPaDeviceInfo; + apiinf: PPaHostApiInfo; +begin + x := 0; + uosDeviceCount := 0; + SetLength(uosDeviceInfos, 0); + + uos_UpdateDevice(); + + if Pa_GetDeviceCount() > 0 then + begin + uosDeviceCount := Pa_GetDeviceCount(); + + SetLength(uosDeviceInfos, uosDeviceCount); + uosDefaultDeviceOut := Pa_GetDefaultOutPutDevice(); + uosDefaultDeviceIn := Pa_GetDefaultInPutDevice(); + + while x < uosDeviceCount do + begin + uosDeviceInfos[x].DeviceNum := x; + + devinf := Pa_GetDeviceInfo(x); + apiinf := Pa_GetHostApiInfo(devinf^.hostApi); + + uosDeviceInfos[x].DeviceName := UTF8Decode(devinf^._name); + uosDeviceInfos[x].HostAPIName := UTF8Decode(apiinf^._name); + + if x = uosDefaultDeviceIn then + uosDeviceInfos[x].DefaultDevIn := True + else + uosDeviceInfos[x].DefaultDevIn := False; + + if x = uosDefaultDeviceOut then + uosDeviceInfos[x].DefaultDevOut := True + else + uosDeviceInfos[x].DefaultDevOut := False; + + uosDeviceInfos[x].ChannelsIn := devinf^.maxInputChannels; + uosDeviceInfos[x].ChannelsOut := devinf^.maxOutPutChannels; + uosDeviceInfos[x].SampleRate := devinf^.defaultSampleRate; + uosDeviceInfos[x].LatencyHighIn := devinf^.defaultHighInputLatency; + uosDeviceInfos[x].LatencyLowIn := devinf^.defaultLowInputLatency; + uosDeviceInfos[x].LatencyHighOut := devinf^.defaultHighOutputLatency; + uosDeviceInfos[x].LatencyLowOut := devinf^.defaultLowOutputLatency; + + if uosDeviceInfos[x].ChannelsIn = 0 then + begin + if uosDeviceInfos[x].ChannelsOut = 0 then + uosDeviceInfos[x].DeviceType := 'None' + else uosDeviceInfos[x].DeviceType := 'Out' ; + end + else + begin + if uosDeviceInfos[x].ChannelsOut = 0 then + uosDeviceInfos[x].DeviceType := 'In' + else uosDeviceInfos[x].DeviceType := 'In/Out' ; + end ; + Inc(x); + end; + end; +end; + +function uos_GetInfoDeviceStr() : PansiChar ; +var + x : cint32 ; + devtmp , bool1, bool2 : UTF8String; +begin + + uos_GetInfoDevice() ; + + x := 0; + devtmp := ''; + + while x < length(uosDeviceInfos) do + begin + if uosDeviceInfos[x].DefaultDevIn then bool1 := 'Yes' + else bool1 := 'No'; + if uosDeviceInfos[x].DefaultDevOut then bool2 := 'Yes' + else bool2 := 'No'; + + devtmp := devtmp + + + 'DeviceNum: ' + inttostr(uosDeviceInfos[x].DeviceNum) + ' |' + + ' Name: ' + uosDeviceInfos[x].DeviceName + ' |' + + ' Type: ' + uosDeviceInfos[x].DeviceType + ' |' + + ' DefIn: ' + bool1 + ' |' + + ' DefOut: ' + bool2 + ' |' + + ' ChanIn: ' + IntToStr(uosDeviceInfos[x ].ChannelsIn)+ ' |' + + ' ChanOut: ' + IntToStr(uosDeviceInfos[x].ChannelsOut) + ' |' + + ' SampleRate: ' + floattostrf(uosDeviceInfos[x].SampleRate, ffFixed, 15, 0) + ' |' + + + ' LatencyHighIn: ' + floattostrf(uosDeviceInfos[x].LatencyHighIn, ffFixed, 15, 8) + + ' |' + + ' LatencyHighOut: ' + floattostrf(uosDeviceInfos[x].LatencyHighOut, ffFixed, 15, 8)+ + ' |' + + ' LatencyLowIn: ' + floattostrf(uosDeviceInfos[x].LatencyLowIn, ffFixed, 15, 8)+ + ' |' + + ' LatencyLowOut: ' + floattostrf(uosDeviceInfos[x].LatencyLowOut, ffFixed, 15, 8)+ + ' |' + + ' HostAPI: ' + uosDeviceInfos[x].HostAPIName ; + if x < length(uosDeviceInfos)-1 then devtmp := devtmp + #13#10 ; + Inc(x); + end; + result := pansichar( devtmp + ' ' ); + + // } +end; +{$endif} + +{$IF DEFINED(Java)} +procedure Tuos_Player.beginprocjava(); +begin + (PEnv^^).CallVoidMethod(PEnv,Obj,BeginProc) ; +end; + +procedure Tuos_Player.endprocjava(); +begin + (PEnv^^).CallVoidMethod(PEnv,Obj,EndProc) ; +end; + +procedure Tuos_Player.LoopBeginProcjava(); +begin + (PEnv^^).CallVoidMethod(PEnv,Obj,LoopBeginProc) ; +end; + +procedure Tuos_Player.LoopEndProcjava(); +begin + (PEnv^^).CallVoidMethod(PEnv,Obj,LoopEndProc) ; +end; + +procedure Tuos_DSP.LoopProcjava(); +begin + // todo +end; + +procedure Tuos_InStream.LoopProcjava(); +begin + // todo +end; + +procedure Tuos_OutStream.LoopProcjava(); +begin + // todo +end; + +{$endif} + +{$IF DEFINED(webstream)} +procedure Tuos_InStream.UpdateIcyMetaInterval; +begin + if Data.HandleSt<>nil then + mpg123_param(Data.HandleSt, MPG123_ICY_INTERVAL, httpget.IcyMetaInt, 0); +end; +{$endif} + +function AssignDefaultForUOSData: Tuos_Data; +var + i: Integer; +begin + with Result do + begin + Enabled := False; + TypePut := -1; + //nothing + Seekable := False; + Status := 0; + // no data + + + SetLength(Buffer,0); + SetLength(MemoryBuffer,0); + MemoryStream := Nil; + posmem := 0; + + {$IF DEFINED(opus)} + SetLength(BufferTMP,0); + {$endif} + + DSPVolumeIndex := -1; + DSPNoiseIndex := -1; + VLeft := 0; + + VRight := 0; + + hasfilters := false; + + nbfilters := 0; + + incfilters := 0; + + PositionEnable := 0; + LevelEnable := 0; + LevelLeft := 0; + LevelRight := 0; + levelArrayEnable := 0; + + //----------------------------// + SampleRate := 44100; + {$IF DEFINED(synthesizer)} + freqLsine := 440; + freqRsine := freqLsine; + dursine := 0; + posdursine := 0; + harmonic := 0; + {$endif} + SamplerateRoot := SampleRate; + //----------------------------// + + Wantframes := 0; + OutFrames := 0; + + SampleFormat := -1; + // default + Channels := -1; + // default + + HandleSt := Nil; + {$IF DEFINED(opus)} + HandleOP := Nil; + {$endif} + + Filename := ''; + Title := ''; + Copyright := ''; + Software := ''; + Artist := ''; + Comment := ''; + Date := ''; + for i:= 0 to High(Tag) do + Tag[i] := #0; + Album := ''; + Genre := ''; + HDFormat := 0; + Frames := 0; + Sections := 0; + Encoding := -1; + // unknow + bitrate := -1; + // unknow + Length := 0; + LibOpen := -1; + // nothing open + Ratio := 0; + + BPM := 0; + + numbuf := -1; + //default + + Output := -1; + //error + + Position := 0; + Poseek := 0; + end; +end; + +constructor Tuos_FFT.Create; +var + i: Integer; +begin + inherited; + + AlsoBuf := False; + + TypeFilterL := 0; + LowFrequencyL := 0; + HighFrequencyL := 0; + GainL := 0; + + for i:= 0 to High(a3) do + a3[i] := 0; + for i:= 0 to High(a32) do + a32[i] := 0; + + for i:= 0 to High(TArray01) do + begin + b2[i] := 0; + x0[i] := 0; + x1[i] := 0; + y0[i] := 0; + y1[i] := 0; + b22[i] := 0; + x02[i] := 0; + x12[i] := 0; + y02[i] := 0; + y12[i] := 0; + end; + + C := 0; + D := 0; + C2 := 0; + D2 := 0; + + TypeFilterR := 0; + LowFrequencyR := 0; + HighFrequencyR := 0; + GainR := 0; + for i:= 0 to High(a3r) do + a3r[i] := 0; + for i:= 0 to High(a32r) do + a32r[i] := 0; + + for i:= 0 to High(TArray01) do + begin + b2r[i] := 0; + x0r[i] := 0; + x1r[i] := 0; + y0r[i] := 0; + y1r[i] := 0; + b22r[i] := 0; + x02r[i] := 0; + x12r[i] := 0; + y02r[i] := 0; + y12r[i] := 0; + end; + + Cr := 0; + Dr := 0; + C2r := 0; + D2r := 0; + + levelstring := ''; + + {$IF DEFINED(noiseremoval)} + FNoise := Nil; + {$endif} +end; + +constructor Tuos_DSP.Create; +begin + inherited; + + Enabled := False; + BefFunc := Nil; + AftFunc := Nil; + EndFunc := Nil; + LoopProc := Nil; + fftdata := Nil; +end; + +constructor Tuos_InStream.Create; +begin + inherited; + + Data := AssignDefaultForUOSData; + SetLength(DSP,0); + + {$IF DEFINED(neaac)} + AACI := Nil; + {$endif} + + {$IF DEFINED(cdrom)} + pCD := Nil; + {$endif} + + {$IF DEFINED(webstream)} + httpget := Nil; + + InHandle := 0; + OutHandle := 0; + + InPipe := Nil; + OutPipe := Nil; + {$ENDIF} + + {$IF DEFINED(portaudio)} + with PAParam do + begin + device := 0; + channelCount := 0; + sampleFormat := Nil; + suggestedLatency := 0; + hostApiSpecificStreamInfo := Nil; + end; + {$endif} + + LoopProc := Nil; +end; + +constructor Tuos_OutStream.Create; +{$IF DEFINED(shout)} +var + i: integer; +{$endif} +begin + inherited; + + Data := AssignDefaultForUOSData; + BufferOut := Nil; + SetLength(DSP,0); + + {$IF DEFINED(portaudio)} + with PAParam do + begin + //TODO: check if the default settings are ok + device := 0; + channelCount := 0; + sampleFormat := Nil; + suggestedLatency := 0; + hostApiSpecificStreamInfo := Nil; + end; + {$endif} + + {$IF DEFINED(shout)} + encoder := Nil; + for i:= 0 to High(cbits) do + cbits[i] := 0; + //byte + {$endif} + + + + with FileBuffer do + begin + ERROR := 0; + wSamplesPerSec := 44100; + wBitsPerSample := 32; + wChannels := 2; + FileFormat := -1; + Data := Nil; + DataMS := Nil; + end; + LoopProc := Nil; + + MemorySteamOut := Nil; + + {$IF DEFINED(Java)} + // procedure LoopProcjava; + {$endif} +end; + +constructor Tuos_Plugin.Create; +begin + inherited; + + Enabled := False; + Name := ''; + + {$IF DEFINED(windows)} + PlugHandle := 0; + {$else} + PlugHandle := Nil; + {$endif} + + {$IF DEFINED(bs2b) or DEFINED(soundtouch)} + Abs2b := Nil; + PlugFunc := Nil; + {$endif} + param1 := -1; + param2 := -1; + param3 := -1; + param4 := -1; + param5 := -1; + param6 := -1; + param7 := -1; + param8 := -1; + + SetLength(Buffer,0); +end; + +constructor Tuos_Init.Create; +begin + {$IF DEFINED(portaudio)} + DefDevOut := -1; + DefDevOutInfo := Nil; + DefDevOutAPIInfo := Nil; + DefDevIn := -1; + DefDevInInfo := Nil; + DefDevInAPIInfo := Nil; + {$endif} + + TDummyThread.Create(false); + evGlobalPause := RTLEventCreate; + + SetExceptionMask(GetExceptionMask + [exZeroDivide] + [exInvalidOp] + + [exDenormalized] + [exOverflow] + [exUnderflow] + [exPrecision]); + uosLoadResult.PAloadERROR := -1; + uosLoadResult.PCloadERROR := -1; + uosLoadResult.SFloadERROR := -1; + uosLoadResult.BSloadERROR := -1; + uosLoadResult.STloadERROR := -1; + uosLoadResult.MPloadERROR := -1; + uosLoadResult.AAloadERROR := -1; + uosLoadResult.OPloadERROR := -1; + uosLoadResult.XMloadERROR := -1; + uosLoadResult.PAinitError := -1; + uosLoadResult.MPinitError := -1; + + PA_FileName := Nil; + // PortAudio + SF_FileName := Nil; + // SndFile + MP_FileName := Nil; + // Mpg123 + AA_FileName := Nil; + // Faad + M4_FileName := Nil; + // Mp4ff + OF_FileName := Nil; + // opusfile + XM_FileName := Nil; + // XMP + Plug_ST_FileName := Nil; + // Plugin SoundTouch + Plug_BS_FileName := Nil; + // Plugin bs2b +end; + +constructor Tuos_Player.create(); +begin + evPause := RTLEventCreate; + + Index := -1; + //default for independent instance + + isAssigned := true; + isGlobalPause := false; + intobuf := false; + NLooped := 0; + NoFree := False; + status := -1; + BeginProc := Nil; + EndProc := Nil; + EndProcOnly := Nil; + loopBeginProc := Nil; + loopEndProc := Nil; + + thethread := Nil; + SetLength(StreamIn,0); + SetLength(StreamOut,0); + SetLength(PlugIn,0); + + {$IF DEFINED(Java)} + PEnv := Nil; + Obj := Nil; + {$endif} +end; + +{$IF DEFINED(mse)} +{$else} +procedure TuosThread.DoTerminate; +begin + {$IF FPC_FULLVERSION>=20701} + //Terminate the thread the calls places into the queuelist will be removed + RemoveQueuedEvents(Self); + {$ENDIF} + //notice that is no longer valid (for safe destroy event of theparent) + Tuos_Player(theparent).thethread := Nil; + //execute player destroy + FreeAndNil(theparent); +end; + {$endif} + +destructor Tuos_Player.Destroy; +var + x: cint32; +begin + + if thethread <> nil then + begin + {$ifdef mse} + thethread.terminate(); + application.waitforthread(thethread); + //calls unlockall()/relockall in order to avoid possible deadlock + thethread.destroy(); + {$endif} + + end; + + if assigned(evPause) then RTLeventdestroy(evPause); + + if length(StreamOut) > 0 then + for x := 0 to high(StreamOut) do + freeandnil(StreamOut[x]); + + if length(StreamIn) > 0 then + for x := 0 to high(StreamIn) do + freeandnil(StreamIn[x]); + + if length(Plugin) > 0 then + for x := 0 to high(Plugin) do + freeandnil(Plugin[x]); + + //Note: if Index = -1 is a independent instance + if Index <> -1 then + begin + //now notice that player is really free + uosPlayersStat[Index] := -1 ; + uosPlayers[Index] := Nil; + end; + + inherited Destroy; + +end; + +destructor Tuos_DSP.Destroy; +begin + if assigned(fftdata) then + begin + {$IF DEFINED(noiseremoval)} + if assigned(fftdata.FNoise) then FreeAndNil(fftdata.FNoise); + {$endif} + FreeandNil(fftdata); + end; + + inherited Destroy; +end; + +destructor Tuos_InStream.Destroy; +var + x: cint32; +begin + {$IF DEFINED(neaac)} + if assigned(AACI) then + begin + if assigned(AACI.fsStream) then + begin + freeandnil(AACI.fsStream); + sleep(100); + end; + freeandnil(AACI); + sleep(100); + end; + {$endif} + if assigned(Data.MemoryStream) then + freeandnil(Data.MemoryStream); + + if length(DSP) > 0 then + for x := 0 to high(DSP) do + freeandnil(DSP[x]); + + inherited Destroy; + +end; + +destructor Tuos_OutStream.Destroy; +var + x: cint32; +begin + if length(DSP) > 0 then + for x := 0 to high(DSP) do + freeandnil(DSP[x]); + + inherited Destroy; +end; + +procedure Tuos_Init.unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: boolean); +// Custom Unload libraries... if true, then unload the library. You may unload what and when you want... +begin + {$IF DEFINED(portaudio)} + if PortAudio = true then Pa_Unload(); + {$endif} + {$IF DEFINED(sndfile)} + if SndFile = true then sf_Unload(); + {$endif} + {$IF DEFINED(mpg123)} + if Mpg123 = true then mp_Unload(); + {$endif} + {$IF DEFINED(xmp)} + if xmp = true then xmp_Unload(); + {$endif} + {$IF DEFINED(fdkaac)} + if fdkaac = true then ad_Unload(); + {$endif} + {$IF DEFINED(neaac)} + if AAC = True then aa_Unload(); + {$endif} + {$IF DEFINED(opus)} + if opus = True then + begin + of_Unload(); + // op_Unload(); + end; + {$endif} +end; + +procedure uos_Free(); +begin + uos_unloadlib() ; + + if assigned(uosInit) then + begin + if assigned(uosInit.evGlobalPause) then + RTLeventdestroy(uosInit.evGlobalPause); + freeandnil(uosInit); + end; +end; + +initialization +SetLength(tempoutmemory,0); +SetLength(uosPlayers,0); +SetLength(uosPlayersStat,0); +SetLength(uosLevelArray,0); +SetLength(uosDeviceInfos,0); +uosInit := Nil; + +end. diff --git a/UOS/examples/uos_aac.pas b/UOS/examples/uos_aac.pas new file mode 100644 index 0000000..6015fd6 --- /dev/null +++ b/UOS/examples/uos_aac.pas @@ -0,0 +1,906 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading version of FAAD2 Pascal Wrapper. + mcwNeAACDec.pas, mcwMP4FF.pas, mcwAAC.pas + By Franklyn A. Harlow Feb 2016 + License : modified LGPL. + mcw* merged into uos_aac by Fred van Stappen / fiens@hotmail.com } + +unit uos_aac; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + Classes, SysUtils, ctypes, math, + dynlibs; + +const + + {$IFDEF unix} +{$IFDEF darwin} +libaa= 'libfaad.2.dylib'; +libm4= 'libmp4ff.0.dylib'; + {$ELSE} +libaa= 'libfaad.so.2'; +libm4= 'libmp4ff.so.0.0.0'; + {$ENDIF} + {$ELSE} +libaa= 'Faad2.dll'; +libm4= 'mp4ff.dll'; + {$ENDIF} + +//////////// from mcwMP4FF.pas By Franklyn A. Harlow +type + + ArSingle = array of Single; + PArSingle = ^ArSingle; + + read_callback_t = function(user_data : Pointer; buffer : pcfloat; length : LongWord) : LongWord; cdecl; + write_callback_t = function(user_data : Pointer; buffer : pcfloat; length : LongWord) : LongWord; cdecl; + seek_callback_t = function(user_data : Pointer; Position : cInt64) : LongWord; cdecl; + truncate_callback_t = function(user_data : Pointer) : LongWord; cdecl; + + mp4ff_callback_t = record + read : read_callback_t; + write : write_callback_t; + seek : seek_callback_t; + truncate : truncate_callback_t; + user_data : Pointer; + end; + p_mp4ff_callback_t = ^mp4ff_callback_t; + + mp4ff_t = pointer; + int32_t = LongInt; + int64_t = cInt64; + uint32_t = LongWord; + +var + mp4ff_open_read : function(f : p_mp4ff_callback_t) : mp4ff_t; cdecl; + mp4ff_open_read_metaonly : function(f : p_mp4ff_callback_t) : mp4ff_t; cdecl; + mp4ff_close : procedure(f : mp4ff_t); cdecl; + mp4ff_get_sample_duration : function(f : mp4ff_t; track, sample : int32_t) : int32_t; cdecl; + mp4ff_get_sample_duration_use_offsets : function(f : mp4ff_t; track, sample : int32_t) : int32_t; cdecl; + mp4ff_get_sample_position : function(f : mp4ff_t; track, sample : int32_t) : int64_t; cdecl; + mp4ff_get_sample_offset : function(f : mp4ff_t; track, sample : int32_t) : int32_t; cdecl; + mp4ff_find_sample : function(f : mp4ff_t; track : int32_t; offset : int64_t; var toskip : int32_t) : int32_t; cdecl; + mp4ff_find_sample_use_offsets : function(f : mp4ff_t; track : int32_t; offset : int64_t; var toskip : int32_t) : int32_t; cdecl; + mp4ff_set_sample_position : function(f : mp4ff_t; track : int32_t; sample : int64_t) : int32_t; cdecl; + mp4ff_read_sample : function(f : mp4ff_t; track, sample : int32_t; var audio_buffer : pcfloat; var bytes : LongWord) : int32_t; cdecl; + mp4ff_read_sample_v2 : function(f : mp4ff_t; track, sample : int32_t; buffer : pcfloat): int32_t; cdecl; //returns 0 on error, number of bytes read on success, use mp4ff_read_sample_getsize_t = function() to check buffer size needed + mp4ff_read_sample_getsize : function(f : mp4ff_t; track, sample : Integer) : int32_t; cdecl; //returns 0 on error, buffer size needed for mp4ff_read_sample_v2_t = function() on success + mp4ff_get_decoder_config : function(f : mp4ff_t; track : Integer; var ppBuf : pcfloat; var pBufSize : LongWord) : int32_t; cdecl; + mp4ff_free_decoder_config : procedure(Buf : pcfloat); cdecl; + mp4ff_get_track_type : function(f : mp4ff_t; const track : Integer) : int32_t; cdecl; + mp4ff_total_tracks : function(f : mp4ff_t) : int32_t; cdecl; + mp4ff_num_samples : function(f : mp4ff_t; track : Integer) : int32_t; cdecl; + mp4ff_time_scale : function(f : mp4ff_t; track : Integer) : int32_t; cdecl; + mp4ff_get_avg_bitrate : function(f : mp4ff_t; track : int32_t) : uint32_t; cdecl; + mp4ff_get_max_bitrate : function(f : mp4ff_t; track : int32_t) : uint32_t; cdecl; + mp4ff_get_track_duration : function(f : mp4ff_t; track : int32_t) : int64_t; cdecl; //returns _t = function(-1) if unknown + mp4ff_get_track_duration_use_offsets : function(f : mp4ff_t; track : int32_t) : Integer; cdecl; //returns _t = function(-1) if unknown + mp4ff_get_sample_rate : function(f : mp4ff_t; track : int32_t) : uint32_t; cdecl; + mp4ff_get_channel_count : function(f : mp4ff_t; track : int32_t) : uint32_t; cdecl; + mp4ff_get_audio_type : function(f : mp4ff_t; track : int32_t) : uint32_t; cdecl; + mp4ff_meta_get_num_items : function(f : mp4ff_t) : Integer; cdecl; + mp4ff_meta_get_by_index : function(f : mp4ff_t; index : LongWord; var item, value : PChar) : Integer; cdecl; + mp4ff_meta_get_title : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_artist : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_writer : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_album : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_date : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_tool : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_comment : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_genre : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_track : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_disc : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_totaltracks : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_totaldiscs : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_compilation : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_tempo : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_coverart : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + +function GetAACTrack(infile : mp4ff_t) : Integer; +procedure Loadmp4ff(mp4ff : AnsiString); +procedure UnLoadMp4ff; +Function isMp4ffLoaded : Boolean; + + //////////// from mcwNeAACDec.pas by Franklyn A. Harlow + Const + { object types for AAC } + MAIN = 1; + LC = 2; + SSR = 3; + LTP = 4; + HE_AAC = 5; + ER_LC = 17; + ER_LTP = 19; + LD = 23; + { special object type for DRM } + DRM_ER_LC = 27; + { header types } + RAW = 0; + ADIF = 1; + ADTS = 2; + LATM = 3; + { SBR signalling } + NO_SBR = 0; + SBR_UPSAMPLED = 1; + SBR_DOWNSAMPLED = 2; + NO_SBR_UPSAMPLED = 3; + { library output formats } + FAAD_FMT_16BIT = 1; + FAAD_FMT_24BIT = 2; + FAAD_FMT_32BIT = 3; + FAAD_FMT_FLOAT = 4; + FAAD_FMT_FIXED = FAAD_FMT_FLOAT; + FAAD_FMT_DOUBLE = 5; + { Capabilities } + { Can decode LC } + LC_DEC_CAP = 1 shl 0; + { Can decode MAIN } + MAIN_DEC_CAP = 1 shl 1; + { Can decode LTP } + LTP_DEC_CAP = 1 shl 2; + { Can decode LD } + LD_DEC_CAP = 1 shl 3; + { Can decode ER } + ERROR_RESILIENCE_CAP = 1 shl 4; + { Fixed point } + FIXED_POINT_CAP = 1 shl 5; + { Channel definitions } + FRONT_CHANNEL_CENTER = 1; + FRONT_CHANNEL_LEFT = 2; + FRONT_CHANNEL_RIGHT = 3; + SIDE_CHANNEL_LEFT = 4; + SIDE_CHANNEL_RIGHT = 5; + BACK_CHANNEL_LEFT = 6; + BACK_CHANNEL_RIGHT = 7; + BACK_CHANNEL_CENTER = 8; + LFE_CHANNEL = 9; + UNKNOWN_CHANNEL = 0; + { DRM channel definitions } + DRMCH_MONO = 1; + DRMCH_STEREO = 2; + DRMCH_SBR_MONO = 3; + DRMCH_SBR_STEREO = 4; + DRMCH_SBR_PS_STEREO = 5; + { A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel, + so at least so much bytes per channel should be available in this stream } + { 6144 bits/channel } + FAAD_MIN_STREAMSIZE = 768; + +Type + PNeAACDec = Pointer; + + NeAAC_byte = {$IFDEF FPC}{$IFDEF CPU64}cuint32 {$ELSE}Byte {$ENDIF}{$ELSE}Byte {$ENDIF}; + NeAAC_word = {$IFDEF FPC}{$IFDEF CPU64}cuint64{$ELSE}Word {$ENDIF}{$ELSE}Word {$ENDIF}; + NeAAC_longword = {$IFDEF FPC}{$IFDEF CPU64}culong {$ELSE}LongWord{$ENDIF}{$ELSE}LongWord{$ENDIF}; + + NeAACDecConfiguration = record + defObjectType : NeAAC_byte; + defSampleRate : NeAAC_longword; + outputFormat : NeAAC_byte; + downMatrix : NeAAC_byte; + useOldADTSFormat : NeAAC_byte; + dontUpSampleImplicitSBR : NeAAC_byte; + end; + TNeAACDecConfiguration = NeAACDecConfiguration; + PNeAACDecConfiguration = ^NeAACDecConfiguration; + + NeAACDecFrameInfo = record + bytesconsumed : NeAAC_longword; + samples : NeAAC_longword; + channels : NeAAC_byte; + error : NeAAC_byte; + samplerate : NeAAC_longword; + sbr : NeAAC_byte; //* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */ + object_type : NeAAC_byte; //* MPEG-4 ObjectType */ + header_type : NeAAC_byte; //* AAC header type; MP4 will be signalled as RAW also */ + num_front_channels : NeAAC_byte; //* multichannel configuration */ + num_side_channels : NeAAC_byte; + num_back_channels : NeAAC_byte; + num_lfe_channels : NeAAC_byte; + channel_position : array[0..63] of NeAAC_byte; + ps : NeAAC_byte; //* PS: 0: off, 1: on */ + end; + TNeAACDecFrameInfo = NeAACDecFrameInfo; + PNeAACDecFrameInfo = ^NeAACDecFrameInfo; + + mp4AudioSpecificConfig = record + objectTypeIndex : NeAAC_byte; + samplingFrequencyIndex : NeAAC_byte; + samplingFrequency : NeAAC_longword; + channelsConfiguration : NeAAC_byte; + frameLengthFlag : NeAAC_byte; //* GA Specific Info */ + dependsOnCoreCoder : NeAAC_byte; + coreCoderDelay : NeAAC_word; + extensionFlag : NeAAC_byte; + aacSectionDataResilienceFlag : NeAAC_byte; + aacScalefactorDataResilienceFlag : NeAAC_byte; + aacSpectralDataResilienceFlag : NeAAC_byte; + epConfig : NeAAC_byte; + sbr_present_flag : NeAAC_byte; + forceUpSampling : NeAAC_byte; + downSampledSBR : NeAAC_byte; + end; + Tmp4AudioSpecificConfig = mp4AudioSpecificConfig; + Pmp4AudioSpecificConfig = ^mp4AudioSpecificConfig; + + var + NeAACDecGetErrorMessage : function(ErrorCode : Byte) : PChar; cdecl; + NeAACDecGetCapabilities : function : LongWord; cdecl; + NeAACDecOpen : function : PNeAACDec; cdecl; + NeAACDecGetCurrentConfiguration : function( hDecoder : PNeAACDec) : PNeAACDecConfiguration; cdecl; + NeAACDecSetConfiguration : function( hDecoder : PNeAACDec; pConfig : PNeAACDecConfiguration) : Byte; cdecl; + NeAACDecInit : function( hDecoder : PNeAACDec; pBuffer : pcfloat; lwBufferLength : LongWord; var lwSampleRate : LongWord; var Channels : Byte) : LongInt; cdecl; + NeAACDecInit2 : function( hDecoder : PNeAACDec; pBuffer : pcfloat; SizeOfDecoderSpecificInfo : LongWord; var lwSampleRate : LongWord; var Channels : Byte) : Byte; cdecl; + NeAACDecPostSeekReset : procedure(hDecoder : PNeAACDec; Frame : LongInt); cdecl; + NeAACDecClose : procedure(hDecoder : PNeAACDec); cdecl; + NeAACDecDecode : function( hDecoder : PNeAACDec; hInfo : PNeAACDecFrameInfo; pBuffer : pcfloat; lwBufferLength : LongWord) : Pointer; cdecl; + NeAACDecDecode2 : function( hDecoder : PNeAACDec; hInfo : PNeAACDecFrameInfo; pBuffer : pcfloat; lwBufferLength : LongWord; var pSampleBuf : Pointer; lwSampleBufSize : LongWord) : Pointer; cdecl; + NeAACDecAudioSpecificConfig : function( pBuffer : pcfloat; lwBufferLength : LongWord; var mp4ASC : mp4AudioSpecificConfig) : Byte; cdecl; + + procedure LoadNeAAC(NeAAC : AnsiString); + Procedure UnLoadNeAAC; + Function Is_NeAAC_Loaded : Boolean; + +////////////////// + +// from mcwAAC.pas from Franklyn A. Harlow +Const + kNeAAC_OK = 1; + kNeAAC_FAIL = 0; + +Type + + TAACIdata = array[0..2024*1024-1] of byte; + + TAACInfo = class(TObject) + public + // libfaad control interface... + fsStream : TFileStream; + pDecoder : PNeAACDec; + hMP4 : mp4ff_t; + + // output interface setup... + Channels : longword; // stereo = 2 + BitsPerSample : longword; // ie short/smallint = 16 + SampleRate : longword; // Frequency = 44100 + outputFormat : byte; // See FAAD_FMT_16BIT etc... + + Bitrate : longword; // 256000 = 256 + + TotalTime : double; // Length in Seconds + + {$if not defined(fs32bit)} + TotalSamples : cint64; + Size : cint64; // in frames + Position : cint64; // in frames + {$else} + TotalSamples : cint; + Size : cint; // in frames + Position : cint; // in frames + {$endif} + + // UoS interface + pData : pcfloat; + lwDataLen : longword; + + // tag info... + Artist : AnsiString; + AlbumArtist : AnsiString; + Album : AnsiString; + Title : AnsiString; + Date : AnsiString; + Genre : AnsiString; + Track : AnsiString; + Comment : AnsiString; + + // internal data... + cbs : mp4ff_callback_t; + _Buf : TAACIdata; + BufTmp : TAACIdata; + fTrack : longint; + fTimescale : longword; // Not actually used + + fBufStart : longword; + fBufEnd : longword; + End; + + Function aa_load(mp4ff, NeAAC: AnsiString): Boolean; + Procedure aa_Unload; + Function isLibAACLoaded : Boolean; + + Function MP4OpenFile(fName : String; OutputFormat : Byte) : TAACInfo; + Procedure MP4CloseFile(var AACI: TAACInfo); + procedure MP4GetData(var AACI: TAACInfo; var Buffer: pcfloat; var Bytes: longword); + function MP4Seek(var AACI: TAACInfo; var SampleNum: longint) : Boolean; + +implementation + +var + // hNeAAC: {$IFDEF MSWINDOWS}longword{$ELSE}{$IFDEF CPU32}longword{$ELSE}PtrInt{$ENDIF}{$ENDIF}; + hNeAAC:TLibHandle=dynlibs.NilHandle; + NeAACLoaded : Boolean; + Mp4ffLoaded : Boolean = False; + hMp4ff:TLibHandle=dynlibs.NilHandle; + +//////////// from mcwNeAACDec.pas By Franklyn A. Harlow + +function CBMP4Read(user_data : Pointer; buffer : pcfloat; length : LongWord) : LongWord; cdecl; +begin + try + Result := LongWord(TAACInfo(user_data).fsStream.Read(buffer^, Integer(length))); + except + Result := 0; + end; +end; + +function CBMP4Write(user_data : Pointer; buffer : pcfloat; length : LongWord) : LongWord; cdecl; +begin + try + Result := LongWord(TAACInfo(user_data).fsStream.Write(buffer^, Integer(length))); + TAACInfo(user_data).fsStream.Position:=0; + except + Result := 0; + end; +end; + +function CBMP4Seek(user_data : Pointer; Position : Int64) : LongWord; cdecl; +begin + try + Result := LongWord(TAACInfo(user_data).fsStream.Seek(Position, soBeginning)); + except + Result := 0; + end; +end; + +function CBMP4Truncate(user_data : Pointer) : LongWord; cdecl; +begin + Result := 0; +end; + +//////////// from mcwAAC.pas By Franklyn A. Harlow + +Function aa_load(mp4ff, NeAAC: AnsiString): Boolean; +Begin + // Safe To Call Multiple times, actual load of Lib checks to see if it is already loaded & + // returns true if it is... + LoadNeAAC(NeAAC); + + Loadmp4ff(mp4ff); + + Result:= Is_NeAAC_Loaded And isMp4ffLoaded; +End; + +Procedure aa_Unload; +Begin + UnLoadNeAAC(); + UnLoadMp4ff(); +End; + +Function isLibAACLoaded : Boolean; +Begin + Result:= Is_NeAAC_Loaded And isMp4ffLoaded; +end; + +Function isFileAAC(fName : AnsiString): Boolean; +Begin + Result:= LowerCase(ExtractFileExt(fName)) = '.m4a'; +end; + +Function MP4OpenFile(fName : String; OutputFormat : Byte) : TAACInfo; +Var + pConfig : PNeAACDecConfiguration; + mp4ASC : mp4AudioSpecificConfig; + + pBuf : pcfloat; + lwBufSize : longword; + lwBufSize2 : longword; + lwSampleRate : longword; + bChannels : byte; + + bRet : Byte; + iRet : LongInt; + pID3 : PAnsiChar; + f : Double; +Begin + Result:= nil; + if not FileExists(fName) then + Exit; + if Not isFileAAC(fName) then + Exit; + // writeln('MP4OpenFileBegin'); + + Result:= TAACInfo.Create; + // writeln('MP4OpenFile3'); + + Result.fsStream:= TFileStream.Create(fName, fmOpenRead or fmShareDenyWrite); + + sleep(1); + + // writeln('MP4OpenFile4'); + Result.cbs.read := @CBMP4Read; + Result.cbs.write := @CBMP4Write; + Result.cbs.seek := @CBMP4Seek; + Result.cbs.truncate := @CBMP4Truncate; + Result.cbs.user_data := Pointer(Result); + // writeln('MP4OpenFile5'); + + Result.pDecoder := NeAACDecOpen(); + // writeln('MP4OpenFile6'); + + pConfig := NeAACDecGetCurrentConfiguration(Result.pDecoder); + // writeln('MP4OpenFile7'); + pConfig^.defObjectType := LC; + pConfig^.defSampleRate := 44100; + pConfig^.outputFormat := OutputFormat; // FAAD_FMT_FLOAT FAAD_FMT_16BIT FAAD_FMT_32BIT + pConfig^.downMatrix := 1; + pConfig^.dontUpSampleImplicitSBR := 0; + + NeAACDecSetConfiguration(Result.pDecoder, pConfig) ; + + pConfig := NeAACDecGetCurrentConfiguration(Result.pDecoder); + // writeln('MP4OpenFile9'); + + case pConfig^.outputFormat of + FAAD_FMT_16BIT : Result.BitsPerSample := 16; + FAAD_FMT_24BIT : Result.BitsPerSample := 24; + FAAD_FMT_32BIT : Result.BitsPerSample := 32; + FAAD_FMT_FLOAT : Result.BitsPerSample := 32; + FAAD_FMT_DOUBLE: Result.BitsPerSample := 64; + end; + // writeln('MP4OpenFile10'); + Result.outputFormat:= pConfig^.outputFormat; + + Result.hMP4 := mp4ff_open_read(@Result.cbs); + // writeln('MP4OpenFile11'); + + Result.fTrack := GetAACTrack(Result.hMP4); + // writeln('MP4OpenFile12'); + + pBuf:= nil; + iRet:= mp4ff_get_decoder_config(Result.hMP4, Result.fTrack, pBuf, lwBufSize); + // writeln('MP4OpenFile13'); + + lwBufSize2:= lwBufSize; + // writeln('MP4OpenFile14'); + + bRet:= NeAACDecInit2(Result.pDecoder, pBuf, lwBufSize, lwSampleRate, bChannels); + // writeln('MP4OpenFile15'); + + Result.SampleRate := mp4ff_get_sample_rate(Result.hMP4, Result.fTrack); + Result.Channels := mp4ff_get_channel_count(Result.hMP4, Result.fTrack); + Result.fTimescale := mp4ff_time_scale(Result.hMP4, Result.fTrack); + Result.Bitrate := mp4ff_get_avg_bitrate(Result.hMP4, Result.fTrack); + Result.Size := mp4ff_num_samples(Result.hMP4, Result.fTrack); + // writeln('MP4OpenFile16'); + + if pBuf <> nil then + begin + bRet:= NeAACDecAudioSpecificConfig(pBuf, lwBufSize2, mp4ASC); + // writeln('MP4OpenFile17'); + + if bRet <> 0 then + Begin + // unix x64, NeAACDecAudioSpecificConfig Fails correct read, + // But if both previous SampleRates match, we'll use them... + {$IFDEF unix}{$IFDEF CPU64} + if Result.SampleRate = lwSampleRate then + Begin + mp4ASC.sbr_present_flag := 0; + mp4ASC.samplingFrequency := lwSampleRate; + End; + {$ENDIF}{$ENDIF} + End; + // writeln('MP4OpenFile18'); + mp4ff_free_decoder_config(pBuf); + // writeln('MP4OpenFile19'); + end; + + f := 1024.0; + if mp4ASC.sbr_present_flag = 1 then + f := f * 2.0; + Result.TotalTime := Result.Size * (f-1.0) / mp4ASC.samplingFrequency; + { ...End} + Result.TotalSamples := Trunc(Result.TotalTime * mp4ASC.samplingFrequency); + // writeln('MP4OpenFile20'); + if mp4ASC.samplingFrequency > Result.SampleRate then + Result.SampleRate:= mp4ASC.samplingFrequency; + + Result.Artist:= ''; + iRet:= mp4ff_meta_get_writer(Result.hMP4, pID3); + if iRet = 1 then + Result.Artist:= pID3; + + Result.AlbumArtist:= ''; + iRet:= mp4ff_meta_get_artist(Result.hMP4, pID3); + if iRet = 1 then + Result.AlbumArtist:= pID3; + + Result.Album:= ''; + iRet:= mp4ff_meta_get_album(Result.hMP4, pID3); + if iRet = 1 then + Result.Album:= pID3; + + Result.Title:= ''; + iRet:= mp4ff_meta_get_title(Result.hMP4, pID3); + if iRet = 1 then + Result.Title:= pID3; + + Result.Date:= ''; + iRet:= mp4ff_meta_get_date(Result.hMP4, pID3); + if iRet = 1 then + Result.Date:= pID3; + + Result.Genre:= ''; + iRet:= mp4ff_meta_get_genre(Result.hMP4, pID3); + if iRet = 1 then + Result.Genre:= pID3; + + Result.Track:= ''; + iRet:= mp4ff_meta_get_track(Result.hMP4, pID3); + if iRet = 1 then + Result.Track:= pID3; + + Result.Comment:= ''; + iRet:= mp4ff_meta_get_comment(Result.hMP4, pID3); + if iRet = 1 then + Result.Comment:= pID3; + + Result.Position := 0; + Result.fBufStart := 0; + Result.fBufEnd := 0; + // writeln('MP4OpenFile End'); +end; + +Procedure MP4CloseFile(var AACI: TAACInfo); +Begin + // writeln('MP4CloseFile1'); + NeAACDecClose(AACI.pDecoder); + sleep(50); + // writeln('MP4CloseFile2'); + mp4ff_close(AACI.hMP4); + // writeln('MP4CloseFile3'); + sleep(50); + end; + +procedure MP4GetData(var AACI: TAACInfo; var Buffer: pcfloat; var Bytes: longword); +var + ReqBytes : longword; + CurBufSize : longword; + NewSampleBuf : Pointer; + NewBytesRead : longword; + NewBytesDecoded : longword; + + Function readNextSample(var audioBuf : pcfloat; var audioSize : longword): longword; + Begin + audioSize := 0; + Result:= 0; + audioBuf := nil; + // writeln('readNextSample'); + if AACI.Position > AACI.Size then + Begin + Result:= 0; + Exit; + end; + Result := mp4ff_read_sample(AACI.hMP4, AACI.fTrack, AACI.Position, audioBuf, audioSize); + Inc(AACI.Position); + end; + + Function getNextChunk(var SampBuf : Pointer; var NBR : longword) : longword; + Var + pAB : pcfloat; + iAB : longword; + frameInfo: NeAACDecFrameInfo; + Begin + NBR:= 0; + // writeln('getNextChunk'); + Result:= 0; + Result:= readNextSample(pAB, iAB); + if Result = 0 then Exit; + SampBuf := NeAACDecDecode(AACI.pDecoder, @frameInfo, pAB, iAB); + if pAB <> nil then + mp4ff_free_decoder_config(pAB); + + NBR:= frameInfo.samples * (AACI.BitsPerSample div 8); + end; + +begin + // writeln('MP4GetData1'); + ReqBytes:= Bytes; + // writeln('MP4GetDataBegin1-2'); + CurBufSize:= AACI.fBufEnd - AACI.fBufStart; + + While ReqBytes > CurBufSize do + Begin + // writeln('MP4GetData31'); + // We need to put more data into Buffer... + + // If We Have Left Over Data... + if CurBufSize > 0 then + Begin + // Save Existing Left over data.. + Move(AACI._Buf[AACI.fBufStart], AACI.BufTmp[0], CurBufSize); + // Put Existing Data to Start of buffer... + Move(AACI.BufTmp[0], AACI._Buf[0], CurBufSize); + end; + + // writeln('MP4GetData32'); + // because we reshuffled buffers, AACI.fBufStart is now 0 + AACI.fBufStart:= 0; + NewSampleBuf := nil; + // Read next block of data + + NewBytesRead:= getNextChunk(NewSampleBuf, NewBytesDecoded); + + // writeln('MP4GetData322'); + if NewBytesRead = 0 then + begin + Buffer := nil; + Bytes := 0; + Exit; + end; + // writeln('MP4GetData33'); + // Append new data to buffer + Move(NewSampleBuf^, AACI._Buf[CurBufSize], NewBytesDecoded); + // Update current unprocessed data count + CurBufSize:= CurBufSize + NewBytesDecoded; + // writeln('MP4GetData34'); + end; + + // writeln('MP4GetData4'); + + // set AACI.fBufEnd to last valid data byte in buffer + AACI.fBufEnd:= CurBufSize; + + // writeln('MP4GetData5'); + + // If requested Byte count is more tha what we have, reduce requested count.. + if Bytes > AACI.fBufEnd - AACI.fBufStart then + Bytes := AACI.fBufEnd - AACI.fBufStart; + + // writeln('MP4GetData6'); + + // pass data back to calling function/procedure + Buffer := @AACI._Buf[AACI.fBufStart]; + + // writeln('MP4GetData7'); + + Inc(AACI.fBufStart, Bytes); + + // writeln('MP4GetData8'); + +end; + +function MP4Seek(var AACI: TAACInfo; var SampleNum: longint) : Boolean; +begin + Result := False; + if (AACI.Size = 0) or (AACI.TotalSamples = 0) then + Exit; + + if SampleNum > AACI.TotalSamples then + SampleNum := AACI.TotalSamples; + + AACI.Position:= Trunc(SampleNum / AACI.TotalSamples * AACI.Size); + Result := True; +end; + +procedure LoadNeAAC(NeAAC : AnsiString); +var +thelib: string; +Begin + if Length(NeAAC) = 0 then thelib := libaa else thelib := NeAAC; + hNeAAC:= DynLibs.SafeLoadLibrary(PChar(thelib)); + NeAACLoaded:= hNeAAC <> dynlibs.NilHandle; + + Pointer(NeAACDecGetErrorMessage) := + GetProcAddress(hNeAAC, PChar('NeAACDecGetErrorMessage')); + Pointer(NeAACDecGetCapabilities) := + GetProcAddress(hNeAAC, PChar('NeAACDecGetCapabilities')); + Pointer(NeAACDecOpen) := + GetProcAddress(hNeAAC, PChar('NeAACDecOpen')); + Pointer(NeAACDecGetCurrentConfiguration) := + GetProcAddress(hNeAAC, PChar('NeAACDecGetCurrentConfiguration')); + Pointer(NeAACDecSetConfiguration) := + GetProcAddress(hNeAAC, PChar('NeAACDecSetConfiguration')); + Pointer(NeAACDecInit) := + GetProcAddress(hNeAAC, PChar('NeAACDecInit')); + Pointer(NeAACDecInit2) := + GetProcAddress(hNeAAC, PChar('NeAACDecInit2')); + Pointer(NeAACDecPostSeekReset) := + GetProcAddress(hNeAAC, PChar('NeAACDecPostSeekReset')); + Pointer(NeAACDecClose) := + GetProcAddress(hNeAAC, PChar('NeAACDecClose')); + Pointer(NeAACDecDecode) := + GetProcAddress(hNeAAC, PChar('NeAACDecDecode')); + Pointer(NeAACDecDecode2) := + GetProcAddress(hNeAAC, PChar('NeAACDecDecode2')); + Pointer(NeAACDecPostSeekReset) := + GetProcAddress(hNeAAC, PChar('NeAACDecPostSeekReset')); + Pointer(NeAACDecAudioSpecificConfig) := + GetProcAddress(hNeAAC, PChar('NeAACDecAudioSpecificConfig')); +end; + +Procedure UnLoadNeAAC; +Begin + if NeAACLoaded then + DynLibs.UnloadLibrary(hNeAAC); + NeAACLoaded:= False; +end; + +Function Is_NeAAC_Loaded : Boolean; +Begin + Result:= NeAACLoaded; +end; + +////////////////////////////// from mcwMP4FF.pas by Franklyn A. Harlow + +function GetAACTrack(infile : mp4ff_t) : Integer; +var + i, rc, numTracks : Integer; + buff : pcfloat; + buff_size : LongWord; + mp4ASC : mp4AudioSpecificConfig; +begin + numTracks := mp4ff_total_tracks(infile); + for i := 0 to numTracks - 1 do + begin + buff := nil; + buff_size:=0; + mp4ff_get_decoder_config(infile, i, buff, buff_size); + if buff <> nil then + begin + rc := NeAACDecAudioSpecificConfig(buff, buff_size, mp4ASC); + mp4ff_free_decoder_config(buff); + if rc < 0 then + continue; + Result := i; + Exit; + end; + end; + Result := -1; +end; + +procedure UnLoadMp4ff; +begin + if Mp4ffLoaded then + + DynLibs.UnloadLibrary(hMp4ff); + + Mp4ffLoaded := False; +end; + +Function isMp4ffLoaded : Boolean; +Begin +Result:= Mp4ffLoaded; +end; + + + procedure Loadmp4ff(mp4ff : AnsiString); + var +thelib: string; +begin + if Mp4ffLoaded then + Exit; + if Length(mp4ff) = 0 then thelib := libm4 else thelib := mp4ff; + hMp4ff := DynLibs.SafeLoadLibrary(PChar(thelib)); + Mp4ffLoaded := hMp4ff <> dynlibs.NilHandle; + + // writeln('hMp4ff' + inttostr(hMp4ff)); + + Pointer(mp4ff_open_read) := + GetProcAddress(hMp4ff, pchar('mp4ff_open_read')); + + // if Pointer(mp4ff_open_read) <> nil then + // writeln('mp4ff_open_read OK') else + // writeln('mp4ff_open_read NOT OK'); + + Pointer(mp4ff_open_read_metaonly) := + GetProcAddress(hMp4ff, PChar('mp4ff_open_read_metaonly')); + Pointer(mp4ff_close) := + GetProcAddress(hMp4ff, PChar('mp4ff_close')); + Pointer(mp4ff_get_sample_duration) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_duration')); + Pointer(mp4ff_get_sample_duration_use_offsets) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_duration_use_offsets')); + Pointer(mp4ff_get_sample_position) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_position')); + Pointer(mp4ff_get_sample_offset) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_offset')); + Pointer(mp4ff_find_sample) := + GetProcAddress(hMp4ff, PChar('mp4ff_find_sample')); + + Pointer(mp4ff_find_sample_use_offsets) := + GetProcAddress(hMp4ff, PChar('mp4ff_find_sample_use_offsets')); + Pointer(mp4ff_set_sample_position) := + GetProcAddress(hMp4ff, PChar('mp4ff_set_sample_position')); + Pointer(mp4ff_read_sample) := + GetProcAddress(hMp4ff, PChar('mp4ff_read_sample')); + Pointer(mp4ff_read_sample_v2) := + GetProcAddress(hMp4ff, PChar('mp4ff_read_sample_v2')); + Pointer(mp4ff_read_sample_getsize) := + GetProcAddress(hMp4ff, PChar('mp4ff_read_sample_getsize')); + Pointer(mp4ff_get_sample_position) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_position')); + Pointer(mp4ff_get_sample_offset) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_offset')); + Pointer(mp4ff_find_sample) := + GetProcAddress(hMp4ff, PChar('mp4ff_find_sample')); + + Pointer(mp4ff_get_decoder_config) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_decoder_config')); + Pointer(mp4ff_get_track_type) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_track_type')); + Pointer(mp4ff_total_tracks) := + GetProcAddress(hMp4ff, PChar('mp4ff_total_tracks')); + Pointer(mp4ff_num_samples) := + GetProcAddress(hMp4ff, PChar('mp4ff_num_samples')); + Pointer(mp4ff_time_scale) := + GetProcAddress(hMp4ff, PChar('mp4ff_time_scale')); + Pointer(mp4ff_get_avg_bitrate) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_avg_bitrate')); + Pointer(mp4ff_get_max_bitrate) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_max_bitrate')); + Pointer(mp4ff_get_track_duration) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_track_duration')); + + Pointer(mp4ff_get_track_duration_use_offsets) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_track_duration_use_offsets')); + Pointer(mp4ff_get_sample_rate) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_rate')); + Pointer(mp4ff_get_channel_count) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_channel_count')); + Pointer(mp4ff_get_audio_type) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_audio_type')); + Pointer(mp4ff_free_decoder_config) := + GetProcAddress(hMp4ff, PChar('mp4ff_free_decoder_config')); + Pointer(mp4ff_meta_get_num_items) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_num_items')); + Pointer(mp4ff_meta_get_by_index) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_by_index')); + Pointer(mp4ff_meta_get_title) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_title')); + + Pointer(mp4ff_meta_get_artist) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_artist')); + Pointer(mp4ff_meta_get_writer) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_writer')); + Pointer(mp4ff_meta_get_album) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_album')); + Pointer(mp4ff_meta_get_date) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_date')); + Pointer(mp4ff_meta_get_tool) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_tool')); + Pointer(mp4ff_meta_get_comment) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_comment')); + Pointer(mp4ff_meta_get_genre) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_genre')); + Pointer(mp4ff_meta_get_track) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_track')); + + Pointer(mp4ff_meta_get_disc) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_disc')); + Pointer(mp4ff_meta_get_totaltracks) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_totaltracks')); + Pointer(mp4ff_meta_get_totaldiscs) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_totaldiscs')); + Pointer(mp4ff_meta_get_compilation) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_compilation')); + Pointer(mp4ff_meta_get_tempo) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_tempo')); + Pointer(mp4ff_meta_get_coverart) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_coverart')); + +end; + +initialization + NeAACLoaded:= False; + SetExceptionMask(GetExceptionMask + [exZeroDivide] + [exInvalidOp] + + [exDenormalized] + [exOverflow] + [exPrecision]); + +finalization +end. diff --git a/UOS/examples/uos_bs2b.pas b/UOS/examples/uos_bs2b.pas new file mode 100644 index 0000000..f05252d --- /dev/null +++ b/UOS/examples/uos_bs2b.pas @@ -0,0 +1,394 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading Pascal Wrapper of + bs2b library of Boris Mikhaylov + Load library with bs_load() and release with bs_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com +} + + +unit uos_bs2b; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + + +interface + +uses + SysUtils, dynlibs, ctypes, math; + +const +libsb= + {$IFDEF unix} + 'libbs2b.so.0'; + {$ELSE} + 'bs2b.dll'; + {$ENDIF} + +{ Minimum/maximum sample rate (Hz) } + BS2B_MINSRATE = 2000; + BS2B_MAXSRATE = 384000; + +{ Minimum/maximum cut frequency (Hz) } +{ bs2b_set_level_fcut() } + BS2B_MINFCUT = 300; + BS2B_MAXFCUT = 2000; + +{ Minimum/maximum feed level (dB * 10 @ low frequencies) } +{ bs2b_set_level_feed() } +{ 1 dB } + BS2B_MINFEED = 10; +{ 15 dB } + BS2B_MAXFEED = 150; + +const + + // for using with bs2b_set_level + + BS2B_HIGH_CLEVEL = (CInt32(700)) or ((CInt32(30)) shl 16); + BS2B_MIDDLE_CLEVEL = (CInt32(500)) or ((CInt32(45)) shl 16); + BS2B_LOW_CLEVEL = (CInt32(360)) or ((CInt32(60)) shl 16); + { Easy crossfeed levels (Obsolete) } + BS2B_HIGH_ECLEVEL = (CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_MIDDLE_ECLEVEL = (CInt32(500)) or ((CInt32(72)) shl 16); + BS2B_LOW_ECLEVEL = (CInt32(360)) or ((CInt32(84)) shl 16); + + BS2B_DEFAULT_CLEVEL = (CInt32(700)) or ((CInt32(45)) shl 16); + BS2B_CMOY_CLEVEL =(CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_JMEIER_CLEVEL = (CInt32(650)) or ((CInt32(95)) shl 16); + +{ Default sample rate (Hz) } +const + BS2B_DEFAULT_SRATE = 44100; + +{ A delay at low frequency by microseconds according to cut frequency } +function bs2b_level_delay(fcut : longint) : longint; + +{ Crossfeed level } +{ Sample rate (Hz) } +{ Lowpass IIR filter coefficients } +{ Highboost IIR filter coefficients } +{ Global gain against overloading } +{ Buffer of last filtered sample: [0] 1-st channel, [1] 2-d channel } +type + Tt_bs2bdp = ^Tt_bs2bd; + Tt_bs2bd = packed record + level : CInt32; + srate : CInt32; + a0_lo : CDouble; + b1_lo : CDouble; + a0_hi : CDouble; + a1_hi : CDouble; + b1_hi : CDouble; + gain : CDouble; + lfs : packed record + asis : array[0..1] of cdouble; + lo : array[0..1] of cdouble; + hi : array[0..1] of cdouble; + end; + end; + +////// Dynamic load : Vars that will hold our dynamically loaded functions... +// *************************** functions ******************************* + +var +{ Open } +bs2b_open : function():Tt_bs2bdp; cdecl; + +{ Close } +bs2b_close : procedure(bs2bdp:Tt_bs2bdp); cdecl; + +{ Sets a new coefficients by new crossfeed value. + * level = ( fcut | feed << 16 ) ) + * where 'feed' is crossfeeding level at low frequencies (dB * 10) + * and 'fcut' is cut frecuency (Hz) + } +bs2b_set_level : procedure(bs2bdp:Tt_bs2bdp; level: CInt32); cdecl; + +{ Return a current crossfeed level value. } +bs2b_get_level : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Sets a new coefficients by new cut frecuency value (Hz). } +bs2b_set_level_fcut : procedure(bs2bdp:Tt_bs2bdp; fcut: CInt32); cdecl; + +{ Return a current cut frecuency value (Hz). } +bs2b_get_level_fcut : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Sets a new coefficients by new crossfeeding level value (dB * 10). } +bs2b_set_level_feed : procedure(bs2bdp:Tt_bs2bdp; feed: CInt32); cdecl; + +{ Return a current crossfeeding level value (dB * 10). } +bs2b_get_level_feed : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Return a current delay value at low frequencies (micro seconds). } +bs2b_get_level_delay : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Clear buffers and sets a new coefficients with new sample rate value. + * srate - sample rate by Hz. } +bs2b_set_srate : procedure(bs2bdp:Tt_bs2bdp; srate: CInt32); cdecl; + +{ Return current sample rate value } +bs2b_get_srate : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Clear buffer } +bs2b_clear : procedure(bs2bdp:Tt_bs2bdp); cdecl; + +{ Return 1 if buffer is clear } +bs2b_is_clear : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Return bs2b version string } +(* Const before declarator ignored *) +bs2b_runtime_version : function():pchar; cdecl; + +{ Return bs2b version integer } +bs2b_runtime_version_int : function(): CInt32; cdecl; + +{ 'bs2b_cross_feed_*' crossfeeds buffer of 'n' stereo samples + * pointed by 'sample'. + * sample[i] - first channel, + * sample[i+1] - second channel. + * Where 'i' is ( i = 0; i < n * 2; i += 2 ) + } +{ sample poits to double floats native endians } +bs2b_cross_feed_d : procedure(bs2bdp:Tt_bs2bdp; var sample:Cdouble; n: CInt32); cdecl; + +{ sample poits to double floats big endians } +bs2b_cross_feed_dbe : procedure(bs2bdp:Tt_bs2bdp; var sample:Cdouble; n: CInt32); cdecl; + +{ sample poits to double floats little endians } +bs2b_cross_feed_dle : procedure(bs2bdp:Tt_bs2bdp; var sample:Cdouble; n: CInt32); cdecl; + +{ sample poits to floats native endians } +bs2b_cross_feed_f : procedure(bs2bdp:Tt_bs2bdp; var sample:Cfloat; n:CInt32); cdecl; + +{ sample poits to floats big endians } +bs2b_cross_feed_fbe : procedure(bs2bdp:Tt_bs2bdp; var sample:Cfloat; n:CInt32); cdecl; + +{ sample poits to floats little endians } +bs2b_cross_feed_fle : procedure(bs2bdp:Tt_bs2bdp; var sample:cfloat; n:CInt32); cdecl; + +{ sample poits to 32bit signed integers native endians } +bs2b_cross_feed_s32 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 32bit unsigned integers native endians } +bs2b_cross_feed_u32 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 32bit signed integers big endians } +bs2b_cross_feed_s32be : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 32bit unsigned integers big endians } +bs2b_cross_feed_u32be : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 32bit signed integers little endians } +bs2b_cross_feed_s32le : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 32bit unsigned integers little endians } +bs2b_cross_feed_u32le : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 16bit signed integers native endians } +bs2b_cross_feed_s16 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt16; n:CInt); cdecl; + +{ sample poits to 16bit unsigned integers native endians } +bs2b_cross_feed_u16 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 16bit signed integers big endians } +bs2b_cross_feed_s16be : procedure(bs2bdp:Tt_bs2bdp; var sample:cint16; n:cint); cdecl; + +{ sample poits to 16bit unsigned integers big endians } +bs2b_cross_feed_u16be : procedure(bs2bdp:Tt_bs2bdp; var sample:cint16; n:cint); cdecl; + +{ sample poits to 16bit signed integers little endians } +bs2b_cross_feed_s16le : procedure(bs2bdp:Tt_bs2bdp; var sample:cint16; n:cint); cdecl; + +{ sample poits to 16bit unsigned integers little endians } +bs2b_cross_feed_u16le : procedure(bs2bdp:Tt_bs2bdp; var sample:cint16; n:cint); cdecl; + +{ sample poits to 8bit signed integers } +bs2b_cross_feed_s8 : procedure(bs2bdp:Tt_bs2bdp; var sample:cint8; n:cint); cdecl; + +{ sample poits to 8bit unsigned integers } +bs2b_cross_feed_u8 : procedure(bs2bdp:Tt_bs2bdp; var sample:cint8; n:cint); cdecl; + +{ sample poits to 24bit signed integers native endians } +bs2b_cross_feed_s24 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 24bit unsigned integers native endians } +bs2b_cross_feed_u24 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 24bit signed integers be endians } +bs2b_cross_feed_s24be : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 24bit unsigned integers be endians } +bs2b_cross_feed_u24be : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 24bit signed integers little endians } +bs2b_cross_feed_s24le : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 24bit unsigned integers little endians } +bs2b_cross_feed_u24le : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + + function bs_IsLoaded() : boolean; inline; + + Function bs_Load(const libfilename:string) :boolean; // load the lib + + Procedure bs_Unload(); // unload and frees the lib from memory : do not forget to call it before close application. + +implementation + +function bs2b_level_delay(fcut : longint) : longint; +begin + result:=floor((18700/fcut)*10); +end; + + var + bs_Handle :TLibHandle=dynlibs.NilHandle; + {$IFDEF windows} // try load dependency if not in /windows/system32/ + gc_Handle :TLibHandle=dynlibs.NilHandle; + {$endif} + ReferenceCounter : cardinal = 0; // Reference counter + +function bs_IsLoaded(): boolean; +begin + Result := (bs_Handle <> dynlibs.NilHandle); +end; + +Procedure bs_Unload(); +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if bs_IsLoaded() then + begin + DynLibs.UnloadLibrary(bs_Handle); + bs_Handle:=DynLibs.NilHandle; + {$IFDEF windows} + if gc_Handle <> DynLibs.NilHandle then begin + DynLibs.UnloadLibrary(gc_Handle); + gc_Handle:=DynLibs.NilHandle; + end; + {$endif} + bs2b_open:=nil; + bs2b_close:=nil; + bs2b_set_level:=nil; + bs2b_get_level:=nil; + bs2b_set_level_fcut:=nil; + bs2b_get_level_fcut:=nil; + bs2b_set_level_feed:=nil; + bs2b_get_level_feed:=nil; + bs2b_get_level_delay:=nil; + bs2b_set_srate:=nil; + bs2b_get_srate:=nil; + bs2b_clear:=nil; + bs2b_is_clear:=nil; + bs2b_runtime_version:=nil; + bs2b_runtime_version_int:=nil; + bs2b_cross_feed_d:=nil; + bs2b_cross_feed_dbe:=nil; + bs2b_cross_feed_dle:=nil; + bs2b_cross_feed_f:=nil; + bs2b_cross_feed_fbe:=nil; + bs2b_cross_feed_fle:=nil; + bs2b_cross_feed_s32:=nil; + bs2b_cross_feed_u32:=nil; + bs2b_cross_feed_s32be:=nil; + bs2b_cross_feed_u32be:=nil; + bs2b_cross_feed_s32le:=nil; + bs2b_cross_feed_u32le:=nil; + bs2b_cross_feed_s16:=nil; + bs2b_cross_feed_u16:=nil; + bs2b_cross_feed_s16be:=nil; + bs2b_cross_feed_u16be:=nil; + bs2b_cross_feed_s16le:=nil; + bs2b_cross_feed_u16le:=nil; + bs2b_cross_feed_s8:=nil; + bs2b_cross_feed_u8:=nil; + bs2b_cross_feed_s24:=nil; + bs2b_cross_feed_u24:=nil; + bs2b_cross_feed_s24be:=nil; + bs2b_cross_feed_u24be:=nil; + bs2b_cross_feed_s24le:=nil; + bs2b_cross_feed_u24le:=nil; + end; +end; + + Function bs_Load(const libfilename:string) :boolean; + begin + Result := False; + if bs_Handle<>0 then +begin + Inc(ReferenceCounter); +result:=true {is it already there ?} +end else begin {go & load the library} + if Length(libfilename) = 0 then + begin + {$IFDEF windows} + gc_Handle:= DynLibs.SafeLoadLibrary('libgcc_s_dw2-1.dll'); + {$endif} + bs_Handle:=DynLibs.SafeLoadLibrary(libsb); + end + else + begin + {$IFDEF windows} + gc_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libgcc_s_dw2-1.dll'); + {$endif} + + bs_Handle:=DynLibs.SafeLoadLibrary(libfilename); + end; + + if bs_Handle <> DynLibs.NilHandle then + begin {now we tie the functions to the VARs from above} + + pointer(bs2b_open):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_open')); + pointer(bs2b_close):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_close')); + pointer(bs2b_set_level):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_set_level')); + pointer(bs2b_get_level):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_get_level')); + pointer(bs2b_set_level_fcut):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_set_level_fcut')); + pointer(bs2b_get_level_fcut):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_get_level_fcut')); + pointer(bs2b_set_level_feed):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_set_level_feed')); + pointer(bs2b_get_level_feed):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_get_level_feed')); + pointer(bs2b_get_level_delay):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_get_level_delay')); + pointer(bs2b_set_srate):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_set_srate')); + pointer(bs2b_get_srate):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_get_srate')); + pointer(bs2b_clear):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_clear')); + pointer(bs2b_is_clear):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_is_clear')); + pointer(bs2b_runtime_version):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_runtime_version')); + pointer(bs2b_runtime_version_int):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_runtime_version_int')); + pointer(bs2b_cross_feed_d):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_d')); + pointer(bs2b_cross_feed_dbe):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_dbe')); + pointer(bs2b_cross_feed_dle):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_dle')); + pointer(bs2b_cross_feed_f):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_f')); + pointer(bs2b_cross_feed_fbe):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_fbe')); + pointer(bs2b_cross_feed_fle):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_fle')); + pointer(bs2b_cross_feed_s32):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s32')); + pointer(bs2b_cross_feed_u32):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u32')); + pointer(bs2b_cross_feed_s32be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s32be')); + pointer(bs2b_cross_feed_u32be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u32be')); + pointer(bs2b_cross_feed_s32le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s32le')); + pointer(bs2b_cross_feed_u32le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u32le')); + pointer(bs2b_cross_feed_s16):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s16')); + pointer(bs2b_cross_feed_u16):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u16')); + pointer(bs2b_cross_feed_s16be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s16be')); + pointer(bs2b_cross_feed_u16be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u16be')); + pointer(bs2b_cross_feed_s16le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s16le')); + pointer(bs2b_cross_feed_u16le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u16le')); + pointer(bs2b_cross_feed_s8):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s8')); + pointer(bs2b_cross_feed_u8):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u8')); + pointer(bs2b_cross_feed_s24):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s24')); + pointer(bs2b_cross_feed_u24):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u24')); + pointer(bs2b_cross_feed_s24be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s24be')); + pointer(bs2b_cross_feed_u24be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u24be')); + pointer(bs2b_cross_feed_s24le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s24le')); + pointer(bs2b_cross_feed_u24le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u24le')); + end; + Result := bs_IsLoaded; + ReferenceCounter:=1; + end; +end; + +end. + diff --git a/UOS/examples/uos_cdrom.pas b/UOS/examples/uos_cdrom.pas new file mode 100644 index 0000000..589cf48 --- /dev/null +++ b/UOS/examples/uos_cdrom.pas @@ -0,0 +1,797 @@ +{This unit is part of United Openlibraries of Sound (uos)} +{ + From CDRom, CDromLinux, CDRomWindows + By Franklyn A. Harlow Feb 2016 + License : modified LGPL. + Merged by Fred van Stappen fiens/hotmail.com } + +unit uos_cdrom; + +{$mode objfpc}{$H+} + +interface + +uses + {$IFDEF FPC}cdrom,{$ENDIF} +{$IFDEF MSWINDOWS} + Windows, +{$ENDIF} +{$IFDEF unix} + baseunix, +{$ENDIF} + Classes, SysUtils, math; + + Const + CDROM_OK = 0; + CDROM_UNKNOWNERR = -1; + + CD_FRAMESIZE_RAW = 2352; + BUF_SIZE = 75 * CD_FRAMESIZE_RAW; // 75 frames - 1 sec + + kCDDA_Base = 'cdda://sr'; + kCDDA_Track = 'Track%20'; + kCDDA_TrackWin = 'Track'; + +Type + TCDDATrackType = (cdtAudio, cdtData, cdtMixed); + Tmsf = record + min : Byte; + sec : Byte; + Frame : Byte; + end; + TCDDAPosition = record + Track : LongInt; + msf : Tmsf; + end; + TCDDATrackInfo = record + TrackLength : Tmsf; + TrackType : TCDDATrackType; + end; + TCDStatus = (cdsNotReady, cdsReady, cdsPlaying, cdsPaused); + TCDDATOCEntry = record + dwStartSector : LongInt; // Start sector of the track + btFlag : Byte; // Track flags (i.e. data or audio track) + btTrackNumber : Byte; // Track number + end; + + PCDROMInfo = ^TCDROMInfo; + TCDROMInfo = Record + + Channels : longword; // stereo = 2 + BitsPerSample : longword; // ie short/smallint = 16 + SampleRate : longword; // Frequency = 44100 + TotalSamples : Int64; + TotalTime : LongWord; // Seconds + pData : pByte; + pDataLen : longword; + Size : Int64; + Position : Int64; + StartPos : TCDDAPosition; + EndPos : TCDDAPosition; + BufStart : LongWord; + BufEnd : LongWord; + BufSize : LongInt; + Buf : array[1..BUF_SIZE*2] of Byte; + BufTmp : array[1..BUF_SIZE*2] of Byte; + fHandleVaild : longint; // 0< : Impossible, 0: Not Valid, >0 : Valid/Available + CurrentPosition : Tmsf; // Current Position Of Track Being Read + {$IFDEF LIBCDRIP} + Opened : LongInt; + Busy : Boolean; + CurrentDrive : LongInt; + EnableJitterCorrection : Boolean; + LastJitterErrors : LongInt; + ReadSectors : LongInt; + OverlapSectors : LongInt; + CompareSectors : LongInt; + MultiReadCount : LongInt; + Paranoid : Boolean; + ParanoiaMode : LongInt; + LockTray : Boolean; + Status : TCDStatus; + RipSize : LongInt; + {$ENDIF} + {$IFDEF MSWINDOWS} + hCDROM : longword; // CDROM CreateFile Handle + {$ENDIF} + {$IFDEF unix} + hCDROM : longint; // CDROM fpOpen Handle + {$ENDIF} + End; + +Const + EndOfDisc : TCDDAPosition = (Track : 100; msf : (min : 0; sec : 0; frame : 0)); + + Function Frames2MSF(Frames : LongInt) : Tmsf; + Function MSF2Frames(const msf : Tmsf) : LongInt; + Function AddressToSectors (msf : Tmsf): int64; + + Function LoadCDROM(Lib : AnsiString): LongWord; + Function UnloadCDROM: LongWord; + Function isCDROMLoaded : Boolean; + + Function CDROM_GetFileNameDrive(FileName : AnsiString): Byte; + Function CDROM_GetFileNameTrack(FileName : AnsiString): Byte; + + Function CDROM_OpenFile(FileName : AnsiString): PCDROMInfo; + Function CDROM_Open(Drive, Track : Byte): PCDROMInfo; + Function CDROM_Close(var pCDROMI: PCDROMInfo): LongWord; + Function CDROM_GetData(var pCDROMI: PCDROMInfo; var pData: Pointer; var DataLength: longword): LongWord; + + Function GetSystemCDRoms: AnsiString; + +implementation + +Function LoadCDROM(Lib : AnsiString): LongWord; +Begin + Result:= 32767; + end; + +Function UnloadCDROM: LongWord; +Begin + Result:= 32767; + end; + +Function isCDROMLoaded : Boolean; +Begin + Result:= True; + end; + +{$IFDEF unix} +Const + CDROM_LBA = $01; // 'logical block': first frame is #0 + CDROM_MSF = $02; // 'minute-second-frame': binary, not bcd here! + CDROM_DATA_TRACK = $40; + CDROM_LEADOUT = $AA; + + CDROMREADTOCHDR = $5305; // Read TOC header + CDROMREADTOCENTRY = $5306; // Read TOC entry + CDROMREADAUDIO = $530E; // (struct cdrom_read_audio) + CDROM_DRIVE_STATUS = $5326; // Get tray position, etc. + CDROM_DISC_STATUS = $5327; // Get disc type, etc. + + CDS_NO_DISC = 1; + CDS_TRAY_OPEN = 2; + CDS_DRIVE_NOT_READY = 3; + CDS_DISC_OK = 4; + + CDS_AUDIO = 100; + CDS_MIXED = 105; + +type + cdrom_addr = record + case Word of + 1: (msf: Tmsf;); + 2: (lba: longint;); + end; + cdrom_read_audio = record + addr : cdrom_addr; // frame address + addr_format : Byte; // CDROM_LBA or CDROM_MSF + nframes : LongInt; // number of 2352-byte-frames to read at once + buf : PByte; // frame buffer (size: nframes*2352 bytes) + end; + cdrom_tocentry = record + cdte_track : Byte; + cdte_adr_ctrl : Byte; + cdte_format : Byte; + cdte_addr : cdrom_addr; + cdte_datamode : Byte; + end; + cdrom_tochdr = record + cdth_trk0: Byte; // start track + cdth_trk1: Byte; // end track + end; + +// ********************** Private Linux SUPPORT Functions ************************************************************** +function GetTrackInfo(hCDROM: LongInt; Track : LongInt): TCDDATrackInfo; +var + Entry : cdrom_tocentry; + TOC : cdrom_tochdr; + F1 : LongInt; + F2 : LongInt; + Ret : LongInt; +begin + Ret:= fpioctl(hCDROM, CDROMREADTOCHDR, @TOC); + if Ret <> 0 then + raise Exception.Create('mcwCDROM_Linux.GetTrackInfo.fpioctl(CDROMREADTOCHDR) Error : ' + IntToStr(Ret)); + + Entry.cdte_format := CDROM_MSF; + Entry.cdte_track := Track + TOC.cdth_trk0 - 1; + + Ret:= fpioctl(hCDROM, CDROMREADTOCENTRY, @Entry); + if Ret <> 0 then + raise Exception.Create('mcwCDROM_Linux.GetTrackInfo.fpioctl(CDROMREADTOCENTRY) Error : ' + IntToStr(Ret)); + + F1 := MSF2Frames(Entry.cdte_addr.msf); + + if (Entry.cdte_adr_ctrl and CDROM_DATA_TRACK) <> 0 then + Result.TrackType := cdtData + else + Result.TrackType := cdtAudio; + + if Entry.cdte_track < toc.cdth_trk1 then + Inc(Entry.cdte_track) + else + Entry.cdte_track := CDROM_LEADOUT; + + Ret:= fpioctl(hCDROM, CDROMREADTOCENTRY, @Entry); + if Ret <> 0 then + raise Exception.Create('mcwCDROM_Linux.GetTrackInfo.fpioctl(CDROMREADTOCENTRY) #2 Error : ' + IntToStr(Ret)); + + F2 := MSF2Frames(Entry.cdte_addr.msf); + Result.TrackLength:= Frames2MSF(F2 - F1); +end; + +function GetTrackMSF(hCDROM, Track : LongInt): Tmsf; +var + entry : cdrom_tocentry; + hdr : cdrom_tochdr; + Ret : LongInt; +begin + Ret:= fpioctl(hCDROM, CDROMREADTOCHDR, @hdr); + if Ret <> 0 then + raise Exception.Create('mcwCDROM_Linux.GetTrackMSF.fpioctl(CDROMREADTOCHDR) Error : ' + IntToStr(Ret)); + + entry.cdte_format := CDROM_MSF; + entry.cdte_track := Track + hdr.cdth_trk0 - 1; + if entry.cdte_track > hdr.cdth_trk1 then + entry.cdte_track := CDROM_LEADOUT; + + Ret:= fpioctl(hCDROM, CDROMREADTOCENTRY, @entry); + if Ret <> 0 then + raise Exception.Create('mcwCDROM_Linux.GetTrackMSF.fpioctl(CDROMREADTOCENTRY) Error : ' + IntToStr(Ret)); + + Result := entry.cdte_addr.msf; +end; + +function GetPosMSF(hCDROM: LongInt; Pos : TCDDAPosition): Tmsf; +var + msf1 : Tmsf; + frames : longint; +begin + msf1 := GetTrackMSF(hCDROM, Pos.Track); + frames := MSF2Frames(msf1); + frames := frames + MSF2Frames(Pos.msf); + Result := Frames2MSF(frames); +end; + +function GetSize(pCDROMI: PCDROMInfo): Int64; +var + F1 : LongWord; + F2 : LongWord; +begin + F1:= (((pCDROMI^.StartPos.msf.min * 60) + pCDROMI^.StartPos.msf.sec) * 75) + pCDROMI^.StartPos.msf.Frame; + F2:= (((pCDROMI^.EndPos.msf.min * 60) + pCDROMI^.EndPos.msf.sec) * 75) + pCDROMI^.EndPos.msf.Frame; + Result := (F2 - F1) * CD_FRAMESIZE_RAW; +end; +// ********************************************************************************************************************* + +Function CDROM_GetFileNameDrive(FileName : AnsiString): Byte; +Begin + Result:= 255; // Assume Error + if Copy(FileName, 1, Length(kCDDA_Base)) = kCDDA_Base then + Result:= StrToIntDef(FileName[10], 256); +end; + +Function CDROM_GetFileNameTrack(FileName : AnsiString): Byte; +Var + s : AnsiString; +Begin + Result:= 0; + if Pos(kCDDA_Track, FileName) > 0 then + Begin + s:= Copy(FileName, Pos(kCDDA_Track, FileName) + Length(kCDDA_Track), Length(FileName)); + s:= Copy(s, 1, Pos('.', s) -1); + Result:= StrToIntDef(s, 0); + end; +end; + +Function CDROM_OpenFile(FileName : AnsiString): PCDROMInfo; +Var + Drive, Track : Byte; +Begin + Result:= CDROM_Open(CDROM_GetFileNameDrive(FileName), + CDROM_GetFileNameTrack(FileName)); +end; + +Function CDROM_Open(Drive, Track : Byte): PCDROMInfo; +Var + CDRomPath : AnsiString; + slCDROMS : TStringList; + + Res : longint; + Data : longint; + CDTI : TCDDATrackInfo; + CDTrackCount : LongInt; + CDTOC : Array of TTocEntry; +Begin + Result:= nil; + if (Drive = 255) or (Track < 1) then + Exit; + + New(Result); + + // Read Only, CDROMI uses constants and ignores changes to these... + Result^.Channels := 2; + Result^.BitsPerSample:= 16; + Result^.SampleRate := 44100; + + CDRomPath:= '/dev/sr' + IntToStr(Drive); + slCDROMS := TStringList.Create; + Try + slCDROMS.Text:= GetSystemCDRoms; + if slCDROMS.IndexOf(CDRomPath) = -1 then + raise Exception.Create('mcwCDROM_Linux.CDROM_Open.GetSystemCDRoms Error : ' + CDRomPath + ' Not Found.'); + finally + slCDROMS.Free; + end; + + Result^.hCDROM:= fpopen(PAnsiChar(CDRomPath), O_RDONLY or O_NONBLOCK);; + if Result^.hCDROM < 0 then + raise Exception.Create('mcwCDROM_Linux.CDROM_Open.fpopen Error : (' + IntToStr(Result^.hCDROM) + ') On ' + CDRomPath); + + // What State Is CDROM in ? + Res:= fpioctl(Result^.hCDROM, CDROM_DRIVE_STATUS, @Data); + if Res <> CDS_DISC_OK then + Begin + CDROM_Close(Result); + Dispose(Result); + Result:= nil; + Exit; + end; + // CDRom OK, What Kind Of Disk Do We Have? + Res := fpioctl(Result^.hCDROM, CDROM_DISC_STATUS, @Data); + if (Res <> CDS_AUDIO) And (Res <> CDS_MIXED) Then + Begin + CDROM_Close(Result); + Dispose(Result); + Result:= nil; + Exit; + end; + + CDTI := GetTrackInfo(Result^.hCDROM, Track); + if CDTI.TrackType = cdtData then + raise Exception.Create('mcwCDROM_Linux.CDROM_Open : Trying to rip a data track'); + + Result^.StartPos.Track := Track; + Result^.StartPos.msf := GetTrackMSF(Result^.hCDROM, Result^.StartPos.Track); + Result^.EndPos.Track := Track +1; + Result^.EndPos.msf := GetTrackMSF(Result^.hCDROM, Result^.EndPos.Track); + + CDTrackCount := cdrom.ReadCDTOC(CDRomPath, CDTOC); + + if (Result^.EndPos.Track in [1..CDTrackCount]) = False then + raise Exception.Create('mcwCDROM_Linux.CDROM_Open : The end track out of range' + #13 + + IntToStr(Result^.EndPos.Track) + ' Requested, 1..' + IntToStr(CDTrackCount) + ' Allowed...'); + + Result^.CurrentPosition := Result^.StartPos.msf; + Result^.Position := 0; + Result^.Size := GetSize(Result); + Result^.BufStart := 1; + Result^.BufEnd := 0; + Result^.BufSize := BUF_SIZE; + Result^.TotalSamples := Result^.Size div 4; + Result^.TotalTime := floor(Result^.TotalSamples / 44100); + + Inc(Result^.fHandleVaild); + +end; + +Function CDROM_Close(var pCDROMI: PCDROMInfo): LongWord; +Begin + Result := CDROM_UNKNOWNERR; + if pCDROMI^.fHandleVaild = 1 then + fpclose(pCDROMI^.hCDROM); + if pCDROMI^.fHandleVaild > 0 then + Dec(pCDROMI^.fHandleVaild); + Result := CDROM_OK; +end; + +Function CDROM_GetData(var pCDROMI: PCDROMInfo; var pData: Pointer; var DataLength: longword): LongWord; +var + ReqLen : LongWord; + ReqFrames : LongInt; + cdaudio : cdrom_read_audio; + Ret : LongWord; + Res : LongInt; + TmpCount : longword; + Procedure getNextChunk; + Begin + TmpCount:= 0; + + // Have We Reached End On Track ? + if MSF2Frames(pCDROMI^.CurrentPosition) >= MSF2Frames(pCDROMI^.EndPos.msf) then + Begin + pCDROMI^.BufEnd := 0; + pCDROMI^.BufStart := 0; + Exit; + End; + + // This is not first call + if pCDROMI^.BufEnd > 0 then + Begin + // Copy Leftover Data to Start of buffer... + TmpCount:= pCDROMI^.BufEnd - pCDROMI^.BufStart; + Move(pCDROMI^.Buf[pCDROMI^.BufStart], pCDROMI^.BufTmp[1], TmpCount); + Move(pCDROMI^.BufTmp[1], pCDROMI^.Buf[1], TmpCount); + End; + + ReqFrames:= 75; // BUF_SIZE = 1 Sec Worth Data = 75 Frames = In Bytes + if MSF2Frames(pCDROMI^.CurrentPosition) + ReqFrames > MSF2Frames(pCDROMI^.EndPos.msf) then + ReqFrames:= MSF2Frames(pCDROMI^.EndPos.msf) - MSF2Frames(pCDROMI^.CurrentPosition); + + // *** Rip Next Chunk ****************************************** + cdaudio.nframes := ReqFrames; // BUF_SIZE = 1 Sec Worth Data = 75 Frames = In Bytes + cdaudio.addr_format := CDROM_MSF; + cdaudio.addr.msf := pCDROMI^.CurrentPosition; + cdaudio.buf := @pCDROMI^.Buf[TmpCount +1]; + + Res:= fpioctl(pCDROMI^.hCDROM, CDROMREADAUDIO, @cdaudio); + if Res <> 0 then + raise Exception.Create('mcwCDROM_Linux.CDROM_GetData.getNextChunk.fpioctl(CDROMREADAUDIO) Error : ' + IntToStr(fpgeterrno)); + + pCDROMI^.CurrentPosition:= Frames2MSF(MSF2Frames(pCDROMI^.CurrentPosition) + cdaudio.nframes); + + Ret := cdaudio.nframes * CD_FRAMESIZE_RAW; + // *** End Rip Next Chunk *************************************** + + pCDROMI^.BufEnd:= TmpCount + Ret + 1; + pCDROMI^.BufStart := 1; + end; + +begin + // PortAudio expects exact amount of data, anything less causes "Blips" + + // pCDROMI.BufStart = Start Byte of Current Valid, Not Sent Buffer... + // pCDROMI.BufEnd = Last Byte of Current Valid, Not sent Buffer... + + ReqLen:= DataLength; + + if pCDROMI^.fHandleVaild = 0 then + raise Exception.Create('mcwCDROM_Linux.CDROM_GetData Error : Call To GetData Without Vaild CDROM Handle.'); + + // We don't read CDROM every call, only when we need new data... + if (pCDROMI^.BufStart + ReqLen) > pCDROMI^.BufEnd then + getNextChunk; + + // is the amount in buffer less than what was requested... + if DataLength > (pCDROMI^.BufEnd - pCDROMI^.BufStart + 1) then + DataLength := pCDROMI^.BufEnd - pCDROMI^.BufStart + 1; + + // Have We Finished Reading Track ? + if pCDROMI^.BufEnd = 0 then + DataLength:= 0; + + pData:= @pCDROMI^.Buf[pCDROMI^.BufStart]; + + If DataLength > 0 Then + Begin + Inc(pCDROMI^.BufStart, DataLength); + Inc(pCDROMI^.Position, DataLength); + end; + + Result:= DataLength; +end; +{$ENDIF} +////////////////////// +{$IFDEF MSWINDOWS} +const + CDDA = 2; + IOCTL_CDROM_READ_TOC = $00024000; + IOCTL_CDROM_RAW_READ = $0002403E; + IOCTL_STORAGE_CHECK_VERIFY2 = $0002D0800; + MAXIMUM_NUMBER_TRACKS = 100; + CB_CDROMSECTOR = 2048; + +Type + _TRACK_DATA = record + Reserved : UCHAR; + Control_and_Adr: UCHAR; + TrackNumber : UCHAR; + Reserved1 : UCHAR; + Address : array[0..3] of UCHAR; + end; + TRACK_DATA = _TRACK_DATA; + PTRACK_DATA = ^_TRACK_DATA; + _CDROM_TOC = record + Length : WORD; + FirstTrack : UCHAR; + LastTrack : UCHAR; + TrackData : array[0..(MAXIMUM_NUMBER_TRACKS)-1] of TRACK_DATA; + end; + CDROM_TOC = _CDROM_TOC; + PCDROM_TOC = ^_CDROM_TOC; + RAW_READ_INFO = record + DiskOffset : Int64; + SectorCount : Cardinal; + TrackMode : Cardinal; + end; + +Function fpgeterrno(): LongWord; +Begin + Result:= GetLastOSError; +end; + +// ********************** Private Windows SUPPORT Functions ************************************************************ +function GetTrackMSF(Table: CDROM_TOC; Track : LongInt): Tmsf; +begin + Result.min := Table.TrackData[Track -1].Address[1]; + Result.sec := Table.TrackData[Track -1].Address[2]; + Result.Frame:= Table.TrackData[Track -1].Address[3]; +end; + +function GetPosMSF(Table: CDROM_TOC; Pos : TCDDAPosition): Tmsf; +var + msf1 : Tmsf; + frames : longint; +begin + msf1 := GetTrackMSF(Table, Pos.Track); + frames := MSF2Frames(msf1); + frames := frames + MSF2Frames(Pos.msf); + Result := Frames2MSF(frames); +end; + +function GetSize(pCDROMI: PCDROMInfo): Int64; +var + F1 : LongWord; + F2 : LongWord; +begin + F1:= (((pCDROMI^.StartPos.msf.min * 60) + pCDROMI^.StartPos.msf.sec) * 75) + pCDROMI^.StartPos.msf.Frame; + F2:= (((pCDROMI^.EndPos.msf.min * 60) + pCDROMI^.EndPos.msf.sec) * 75) + pCDROMI^.EndPos.msf.Frame; + Result := (F2 - F1) * CD_FRAMESIZE_RAW; +end; +// ********************************************************************************************************************* + +Function CDROM_GetFileNameDrive(FileName : AnsiString): Byte; +Var + driveLetter : Char; + drive : Char; + cdromcount : Byte; + found : Boolean; +Begin + found := False; + driveLetter:= FileName[1]; + cdromcount := 255; + For drive := 'A' to 'Z' do + if GetDriveType(PChar(drive + ':\')) = DRIVE_CDROM then + Begin + Inc(cdromcount); + if drive = driveLetter then + Begin + found:= True; + break; + end; + end; + if not found then + raise Exception.Create('CDROM (BDROM) Drive Not Found !'); + Result := cdromcount; +end; + +Function CDROM_GetFileNameTrack(FileName : AnsiString): Byte; +Var + s : AnsiString; +Begin + // This works on Win7... + s := Copy(Filename, Pos(kCDDA_TrackWin, Filename) + 5, Length(Filename)); + s := Copy(s, 1, Pos('.', s) -1); + Result:= StrToIntDef(s , 0); +end; + +Function CDROM_OpenFile(FileName : AnsiString): PCDROMInfo; +Var + Drive, Track : Byte; +Begin + Result:= CDROM_Open(CDROM_GetFileNameDrive(FileName), + CDROM_GetFileNameTrack(FileName)); +end; + +Function CDROM_Open(Drive, Track : Byte): PCDROMInfo; +Var + CDRomPath : AnsiString; + Table : CDROM_TOC; + BytesRead : LongWord; + Ret : BOOL; + flags : longword; +// Index : LongInt; +Begin + Result:= nil; + if (Drive = 255) or (Track < 1) then + Exit; + + New(Result); + + // Read Only, CDROMI uses constants and ignores changes to these... + Result^.Channels := 2; + Result^.BitsPerSample:= 16; + Result^.SampleRate := 44100; + + CDRomPath:= UpperCase('\\.\CDROM') + IntToStr(Drive); + flags := longword(GENERIC_READ); + + Result^.hCDROM:= CreateFileA(PAnsiChar(CDRomPath), Flags, FILE_SHARE_READ, nil, OPEN_EXISTING, 0, 0 ); + if (Result^.hCDROM = INVALID_HANDLE_VALUE) then + raise Exception.Create('mcwCDROM_Win.CDROM_Open.CreateFileA Error : (' + IntToStr(Result^.hCDROM) + ') On ' + CDRomPath); + + // What State Is CDROM in ? + Ret:= DeviceIoControl(Result^.hCDROM, IOCTL_STORAGE_CHECK_VERIFY2, nil, 0, nil, 0, BytesRead, nil); + if Not Ret then + Begin + CDROM_Close(Result); + Dispose(Result); + Result:= nil; + Exit; + end; + + Ret:= DeviceIoControl(Result^.hCDROM, IOCTL_CDROM_READ_TOC, nil, 0, @Table, sizeof(Table), BytesRead, nil); + if Ret = False then + raise Exception.Create('mcwCDROM_Win.CDROM_Open.DeviceIoControl(IOCTL_CDROM_READ_TOC) Error '); + + Result^.StartPos.Track := Track; + Result^.StartPos.msf := GetTrackMSF(Table, Result^.StartPos.Track); + Result^.EndPos.Track := Track +1; + Result^.EndPos.msf := GetTrackMSF(Table, Result^.EndPos.Track); + Result^.CurrentPosition := Result^.StartPos.msf; + Result^.Position := 0; + Result^.Size := GetSize(Result); + Result^.BufStart := 1; + Result^.BufEnd := 0; + Result^.BufSize := BUF_SIZE; + Result^.TotalSamples := Result^.Size div 4; + Result^.TotalTime := floor(Result^.TotalSamples / 44100); + + Inc(Result^.fHandleVaild); +end; + +Function CDROM_Close(var pCDROMI: PCDROMInfo): LongWord; +Begin + Result := CDROM_UNKNOWNERR; + if pCDROMI^.fHandleVaild = 1 then + CloseHandle(pCDROMI^.hCDROM); + if pCDROMI^.fHandleVaild > 0 then + Dec(pCDROMI^.fHandleVaild); + Result := CDROM_OK; +end; + +Function CDROM_GetData(var pCDROMI: PCDROMInfo; var pData: Pointer; var DataLength: longword): LongWord; +var + ReqLen : LongWord; + ReqFrames : LongInt; + Info : RAW_READ_INFO; + BytesRead : LongWord; + Address : Int64; + Ret : LongWord; + Res : BOOL; + TmpCount : longword; + Procedure getNextChunk; + Begin + TmpCount:= 0; + + // Have We Reached End On Track ? + if MSF2Frames(pCDROMI^.CurrentPosition) >= MSF2Frames(pCDROMI^.EndPos.msf) then + Begin + pCDROMI^.BufEnd := 0; + pCDROMI^.BufStart := 0; + Exit; + End; + + // This is not first call + if pCDROMI^.BufEnd > 0 then + Begin + // Copy Leftover Data to Start of buffer... + TmpCount:= pCDROMI^.BufEnd - pCDROMI^.BufStart; + Move(pCDROMI^.Buf[pCDROMI^.BufStart], pCDROMI^.BufTmp[1], TmpCount); + Move(pCDROMI^.BufTmp[1], pCDROMI^.Buf[1], TmpCount); + End; + // While Linux Can deal With 75 Frame Request, Windows Only 20 (?) + ReqFrames:= 20; // BUF_SIZE = 1 Sec Worth Data = 75 Frames = In Bytes + if MSF2Frames(pCDROMI^.CurrentPosition) + ReqFrames > MSF2Frames(pCDROMI^.EndPos.msf) then + ReqFrames:= MSF2Frames(pCDROMI^.EndPos.msf) - MSF2Frames(pCDROMI^.CurrentPosition); + + // *** Rip Next Chunk ****************************************** + Address:= AddressToSectors(pCDROMI^.CurrentPosition); + + Info.TrackMode := CDDA; + Info.SectorCount:= ReqFrames; + Info.DiskOffset := Address * CB_CDROMSECTOR; + + Res:= DeviceIoControl(pCDROMI^.hCDROM, + IOCTL_CDROM_RAW_READ, + @Info, + sizeof(Info), + @pCDROMI^.Buf[TmpCount +1], + ReqFrames * CD_FRAMESIZE_RAW, + BytesRead, + nil); + if Res = False then + raise Exception.Create('mcwCDROM_Win.CDROM_GetData.getNextChunk.fpioctl(CDROMREADAUDIO) Error : ' + IntToStr(fpgeterrno)); + + pCDROMI^.CurrentPosition:= Frames2MSF(MSF2Frames(pCDROMI^.CurrentPosition) + ReqFrames); + + Ret := BytesRead; // Should Be The same as "ReqFrames * CD_FRAMESIZE_RAW" + // *** End Rip Next Chunk *************************************** + + pCDROMI^.BufEnd:= TmpCount + Ret + 1; + pCDROMI^.BufStart := 1; + end; + +begin + // PortAudio expects exact amount of data, anything less causes "Blips" + + // pCDROMI.BufStart = Start Byte of Current Valid, Not Sent Buffer... + // pCDROMI.BufEnd = Last Byte of Current Valid, Not sent Buffer... + + ReqLen:= DataLength; + + if pCDROMI^.fHandleVaild = 0 then + raise Exception.Create('mcwCDROM_Win.CDROM_GetData Error : Call To GetData Without Vaild CDROM Handle.'); + + // We don't read CDROM every call, only when we need new data... + if (pCDROMI^.BufStart + ReqLen) > pCDROMI^.BufEnd then + getNextChunk; + + // is the amount in buffer less than what was requested... + if DataLength > (pCDROMI^.BufEnd - pCDROMI^.BufStart + 1) then + DataLength := pCDROMI^.BufEnd - pCDROMI^.BufStart + 1; + + // Have We Finished Reading Track ? + if pCDROMI^.BufEnd = 0 then + DataLength:= 0; + + pData:= @pCDROMI^.Buf[pCDROMI^.BufStart]; + + If DataLength > 0 Then + Begin + Inc(pCDROMI^.BufStart, DataLength); + Inc(pCDROMI^.Position, DataLength); + end; + + Result:= DataLength; +end; +{$ENDIF} +///////////////////// + +Function GetSystemCDRoms: AnsiString; +var + Index : longint; + Ret : LongInt; + Devices : Array of string; + sl : TStringList; +begin + Result:= ''; + sl:= TStringList.Create; + + SetLength(Devices, 99); + Ret:= cdrom.GetCDRomDevices(Devices); + If Ret > 0 Then + For Index := 0 To Ret -1 do + sl.Add(Devices[Index]); + + Result:= sl.Text; + sl.Free; +end; + +// ********************** Common Linux/Windows SUPPORT Functions ******************************************************* +Function Frames2MSF(Frames : LongInt) : Tmsf; +var + Temp : Integer; +begin + Temp := Frames div 75; + Result.min := Temp div 60; + Result.sec := Temp mod 60; + Result.Frame := Frames mod 75; +end; + +function MSF2Frames(const msf : Tmsf) : LongInt; +begin + Result := ((msf.min * 60) + msf.sec) * 75 + msf.Frame; +end; + +Function AddressToSectors (msf : Tmsf): int64; +begin + Result:= MSF2Frames(msf) - 150; +end; + +// ********************************************************************************************************************* + +end. + diff --git a/UOS/examples/uos_define.inc b/UOS/examples/uos_define.inc new file mode 100644 index 0000000..da57a6e --- /dev/null +++ b/UOS/examples/uos_define.inc @@ -0,0 +1,35 @@ +{ United Openlibraries of Sound (uos) + License : modified LGPL. + Fred van Stappen fiens@hotmail.com } + +// Compiler definitions + +{.$DEFINE uos_debug} // uncomment for debugging. For console and Unix applications only. + +{.$DEFINE consoleapp} // if FPC version < 2.7.1 uncomment for console application +{.$DEFINE library} // uncomment for building uos library (native and java) +{.$DEFINE java} // uncomment for building uos java library +{.$DEFINE fpgui} // uncomment if FPC version < 2.7.1 and using fpGUI widget +{.$DEFINE mse} // uncomment when using a mse project, use mse mseThread in place of fpc TThread. +{.$DEFINE usequeue} // uncomment to use Thread.Queue instead of Thread.Synchronize for fpc threads, better for LCL widgets. + +{$DEFINE portaudio} // uncomment to enable portaudio In/Out sound port + +{$DEFINE sndfile} // uncomment to enable sndfile (wav, ogg, flac audio file) +{$DEFINE mpg123} // uncomment to enable mpg123 (mp3 audio file) +{$DEFINE neaac} // uncomment to enable neaac (m4a audio file) +{$DEFINE fdkaac} // uncomment to enable aacdecoder (acc audio webstream) +{$DEFINE opus} // uncomment to enable opus (opus audio file) +{$DEFINE xmp} // uncomment to enable xmp (mod, it, mods, audio file) +{.$DEFINE cdrom} // uncomment to enable cdrom audio decoder (cda) + +{$DEFINE soundtouch} // uncomment to enable Soundtouch tempo plugin +{$DEFINE bs2b} // uncomment to enable bs2b stereo to binaural plugin + +{$DEFINE webstream} // uncomment to enable Internet Audio Streaming + +{.$DEFINE shout} // uncomment to enable IceCast-Shout audio web server. + +{$DEFINE noiseremoval} // uncomment to enable Noise Removal DSP + +{$DEFINE synthesizer} // uncomment to enable Synthesizer diff --git a/UOS/examples/uos_dsp_noiseremoval.pas b/UOS/examples/uos_dsp_noiseremoval.pas new file mode 100644 index 0000000..b6c5971 --- /dev/null +++ b/UOS/examples/uos_dsp_noiseremoval.pas @@ -0,0 +1,1202 @@ +{This unit is part of United Openlibraries of Sound (uos)} +{ + audacity which this file was converted from is GPLv2 + http://www.audacityteam.org/about/license/ + Converted By Andrew Haines + License : modified LGPL. + Fred van Stappen fiens@hotmail.com + } + +unit uos_dsp_noiseremoval; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, uos_dsp_utils ; + +type + PFFT = ^TFFT; + + { TFFT } + + TFFT = object + BitReversed: PInteger; + SinTable: PSingle; + Points: Integer; + FPCSinTable: array of Single; + function InitializeFFT(FFTLen: Integer): PFFT; static; + procedure EndFFT; + function GetFFT(FFTLen: Integer): PFFT; static; + procedure ReleaseFFT; + procedure InverseRealFFTf(buffer: PSingle); + procedure CleanupFFT; static; // ??? + procedure RealFFTf(buffer: PSingle); + procedure ReorderToTime(Buffer: PSingle; TimeOut: PSingle); + procedure ReorderToFreq(Buffer: PSingle; RealOut: PSingle; ImagOut: PSingle); + end; + +type + PPSingle=^PSingle; + TSingleArray = array of Single; + + TNoiseRemoval = class; + TNoiseWriteProc = procedure(ASender: TObject; AData: PSingle; ASampleCount: Integer) of Object; + + { TNoiseRemoval } + + TNoiseRemoval = class + private + FDoProfile: Boolean; + FHasProfile: Boolean; + + // Parameters chosen before the first phase + FSampleRate: Double; + FWindowSize: Integer; + FSpectrumSize: Integer; + FMinSignalTime: Single; // in secs + + // The frequency-indexed noise threshold derived during the first + // phase of analysis + FNoiseThreshold: array of Single; // length in FSpectrumSize + + // Parameters that affect the noise removal, regardless of how the + // noise profile was extracted + FSensitivity: Double; + FFreqSmoothingHz: Double; + FNoiseGain: Double; // in dB, should be negative + FAttackDecayTime: Double; + FbLeaveNoise: Boolean; + + // change this later + procedure Initialize; + procedure Reset; // StartNewTrack + procedure ProcessSamples(len: Integer; Buffer:PSingle); + procedure FillFirstHistoryWindow; + procedure ApplyFreqSmoothing(ASpec: PSingle); + procedure GetProfile; + procedure RemoveNoise; + procedure RotateHistoryWindows; + procedure FinishTrack; + procedure Cleanup; + private + //FOutputTrack: PSingle; // WaveTrack; + FInSampleCount: Integer; + FOutSampleCount: Integer; + FInputPos: Integer; + FFFT: PFFT; + FFFTBuffer: PSingle; // FWindowSize + FWindow: PSingle; // FWindowSize + FFreqSmoothingBins: Integer; + FAttackDecayBlocks: Integer; + FOneBlockAttackDecay: Single; + FNoiseAttenFactor: Single; + FSensitivityFactor: Single; + FMinSignalBlocks: Integer; + FHistoryLen: Integer; + FInWaveBuffer: PSingle; // FWindowSize + FOutOverlapBuffer: PSingle; // FWindowSize + FSpectrums: array of PSingle; // FHistoryLen x FSpectrumSize + FGains: array of PSingle; // FHistoryLen x FSpectrumSize + FRealFFTs: array of PSingle; // FHistoryLen x FWindowSize + FImagFFTs: array of PSingle; // FHistoryLen x FWindowSize + FWriteProc: TNoiseWriteProc; + FInited: Boolean; + FTotalRead: QWord; + function GetNoiseProfile: TSingleArray; + procedure SetAttackDecayTime(AValue: Double); + procedure SetFreqSmoothingHz(AValue: Double); + procedure SetGain(AValue: Double); + procedure SetNoiseProfile(AValue: TSingleArray); + procedure SetSensitivity(AValue: Double); + public + constructor Create; + destructor Destroy; override; + function Init(ASampleRate: Integer): Boolean; + function Process(AData: PSingle; ASampleCount: Integer; AGetNoiseProfile: Boolean; AMoreComing: Boolean = False): Boolean; + procedure Flush; // finish writing out data in buffers. + + property NoiseProfile: TSingleArray read GetNoiseProfile write SetNoiseProfile; + + // these have defaults + property Sensitivity: Double read FSensitivity write SetSensitivity; + property Gain: Double read FNoiseGain write SetGain; + property FreqSmoothingHz: Double read FFreqSmoothingHz write SetFreqSmoothingHz; + property AttackDecayTime: Double read FAttackDecayTime write SetAttackDecayTime; + property LeaveNoise: Boolean read FbLeaveNoise write FbLeaveNoise; + + // don't mess with these. + property SampleRate: Double read FSampleRate;// write FSampleRate; + property WindowSize: Integer read FWindowSize;// write FWindowSize; + property SpectrumSize: Integer read FSpectrumSize;// write FSpectrumSize; + property MinSignalTime: Single read FMinSignalTime;// write FMinSignalTime; // in secs + + // This must be assigned or av's will occur + property WriteProc: TNoiseWriteProc read FWriteProc write FWriteProc; + end; + +type + + { TNoiseRemovalChannel } + + TNoiseRemovalChannel = class(TNoiseRemoval, IPAIODataIOInterface) + HasProfile: Boolean; + ProfileComplete: Boolean; + procedure WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); + end; + + { TNoiseRemovalMultiChannel } + + TNoiseRemovalMultiChannel = class(IPAIODataIOInterface) + private + FChannels, + FSampleRate: Integer; + FHelper: TPAIOChannelHelper; + FNoise: array of TNoiseRemovalChannel; + FWriteProc: TNoiseWriteProc; + //IPAIODataIOInterface + procedure WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); + procedure DataWrite(ASender: TObject; AData: PSingle; ASampleCount: Integer); + public + constructor Create(AChannels: Integer; ASampleRate: Integer); + destructor Destroy; override; + procedure ReadNoiseProfile(AData: PSingle; ASamples: Integer); + procedure ProcessNoise(AData: PSingle; ASamples: Integer); + procedure Flush; + property WriteProc: TNoiseWriteProc read FWriteProc write FWriteProc; + end; + +{ TuosNoiseRemoval } + type + TuosNoiseRemoval = class(TNoiseRemovalMultiChannel) + OutStream: TStream; + public + isprofiled : boolean ; + samprate : integer ; + procedure WriteData(ASender: TObject; AData: PSingle; ASampleCount: Integer) ; + function FilterNoise(ANoisyAudio: PSingle; InFrames: Integer; out Samples: Integer): PSingle; + end; + + implementation +uses + math; + +const + PI = 3.14159265358979323846; + MAX_HFFT = 10; +var + FFTArray: array[0..MAX_HFFT-1] of PFFT; + FFTLockCount: array[0..MAX_HFFT-1] of Integer; + +{ TMultiChannelNoiseRemoval } + +procedure TNoiseRemovalMultiChannel.WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); +begin + if Assigned(FWriteProc) then + FWriteProc(Self, AData, ASamples); +end; + +procedure TNoiseRemovalMultiChannel.DataWrite(ASender: TObject; AData: PSingle; ASampleCount: Integer); +begin + (FHelper as IPAIODataIOInterface).WriteDataIO(ASender as IPAIODataIOInterface, AData, ASampleCount); +end; + +constructor TNoiseRemovalMultiChannel.Create(AChannels: Integer; + ASampleRate: Integer); +var + i: Integer; +begin + FChannels:=AChannels; + FSampleRate:=ASampleRate; + FHelper := TPAIOChannelHelper.Create(Self); + SetLength(FNoise, AChannels); + for i := 0 to High(FNoise) do + begin + FNoise[i] := TNoiseRemovalChannel.Create; + FNoise[i].WriteProc:=@DataWrite; + FNoise[i].Init(ASampleRate); + FHelper.Outputs.Add(FNoise[i] as IPAIODataIOInterface); + end; +end; + +destructor TNoiseRemovalMultiChannel.Destroy; +var + i: Integer; +begin + for i := 0 to High(FNoise) do + begin + FNoise[i].Free; + end; + SetLength(FNoise, 0); + FHelper.Free; +end; + +procedure TNoiseRemovalMultiChannel.ReadNoiseProfile(AData: PSingle; + ASamples: Integer); +var + i: Integer; +begin + FHelper.Write(AData, ASamples); + for i := 0 to High(FNoise) do + begin + FNoise[i].ProfileComplete:=True; + FNoise[i].Process(nil, 0, True, False); + FNoise[i].HasProfile:=True; + FNoise[i].Init(FSampleRate); + end; +end; + +procedure TNoiseRemovalMultiChannel.ProcessNoise(AData: PSingle; + ASamples: Integer); +begin + FHelper.Write(AData, ASamples); +end; + +procedure TNoiseRemovalMultiChannel.Flush; +var + i: Integer; +begin + for i := 0 to High(FNoise) do + FNoise[i].Flush; +end; + +procedure TNoiseRemovalChannel.WriteDataIO(ASender: IPAIODataIOInterface; + AData: PSingle; ASamples: Integer); +begin + Process(AData, ASamples, not HasProfile, not HasProfile); +end; + +{ TuosNoiseRemoval } + +procedure TuosNoiseRemoval.WriteData(ASender: TObject; AData: PSingle; + ASampleCount: Integer); +begin + OutStream.Write(AData^, ASampleCount*SizeOf(Single)); +end; + +function TuosNoiseRemoval.FilterNoise(ANoisyAudio: PSingle; InFrames: Integer; out Samples: Integer): PSingle; +var + MNoisyAudio: TMemoryStream; + begin + OutStream := TMemoryStream.Create; + + MNoisyAudio := TMemoryStream.Create; + MNoisyAudio.Write(ANoisyAudio^, InFrames*SizeOf(Single)); + MNoisyAudio.Position:=0; + + if isprofiled = false then // take the first chunk as noisy sample + begin + ReadNoiseProfile(PSingle(MNoisyAudio.Memory), MNoisyAudio.Size div SizeOf(Single)); + isprofiled := true; + end; + + Result := nil; + + ProcessNoise(PSingle(MNoisyAudio.Memory), MNoisyAudio.Size div SizeOf(Single)); + + Result:=GetMem(OutStream.Size); + Samples := OutStream.Size div SizeOf(Single); + OutStream.Position:=0; + OutStream.Read(Result^, OutStream.Size); + + MNoisyAudio.free; + OutStream.Free; + + // Result := ANoisyAudio; + end; + +{ TNoiseRemoval } + +function NewFloatArray(ALength: Integer): PSingle; inline; +begin + Result := Getmem(ALength*SizeOf(Single)); +end; + +procedure TNoiseRemoval.Initialize; +var + i: Integer; +begin + FFreqSmoothingBins := Trunc(FFreqSmoothingHz * FWindowSize / FSampleRate); + FAttackDecayBlocks := 1 + Trunc(FAttackDecayTime * FSampleRate / (FWindowSize / 2)); + // Applies to amplitudes, divide by 20: + FNoiseAttenFactor := power(10, FNoiseGain/20); + + // Applies to gain factors which apply to amplitudes, divide by 20: + //FOneBlockAttackDecay := power(10.0, (FNoiseGain / (20.0 * FAttackDecayBlocks))); + FOneBlockAttackDecay := power(10.0, (FNoiseGain / FAttackDecayBlocks) / 20 ); + // Applies to power, divide by 10: + FSensitivityFactor := power(10.0, FSensitivity/10.0); + FMinSignalBlocks := Trunc(FMinSignalTime * FSampleRate / (FWindowSize / 2)); + if( FMinSignalBlocks < 1 ) then + FMinSignalBlocks := 1; + FHistoryLen := (2 * FAttackDecayBlocks) - 1; + + if (FHistoryLen < FMinSignalBlocks) then + FHistoryLen := FMinSignalBlocks; + + SetLength(FSpectrums, FHistoryLen); + SetLength(FGains, FHistoryLen); + SetLength(FRealFFTs, FHistoryLen); + SetLength(FImagFFTs, FHistoryLen); + for i := 0 to FHistoryLen-1 do + begin + FSpectrums[i] := NewFloatArray(FSpectrumSize); + FGains[i] := NewFloatArray(FSpectrumSize); + FRealFFTs[i] := NewFloatArray(FSpectrumSize); + FImagFFTs[i] := NewFloatArray(FSpectrumSize); + end; + + // Initialize the FFT + FFFT := TFFT.InitializeFFT(FWindowSize); + + FFFTBuffer := NewFloatArray(FWindowSize); + FInWaveBuffer := NewFloatArray(FWindowSize); + FWindow := NewFloatArray(FWindowSize); + FOutOverlapBuffer := NewFloatArray(FWindowSize); + + // Create a Hanning window function + for i := 0 to FWindowSize-1 do + FWindow[i] := 0.5 - 0.5 * cos((2.0*pi*i) / FWindowSize); + + if FDoProfile then + begin + FillChar(FNoiseThreshold[0], SizeOf(FNoiseThreshold[0])*FSpectrumSize, 0); + //for i := 0 to FSpectrumSize-1 do + // FNoiseThreshold[i] := float(0); + end; + +end; + +procedure TNoiseRemoval.Reset; +var + i, j: Integer; +begin + for i := 0 to FHistoryLen-1 do + begin + for j := 0 to FSpectrumSize-1 do + begin + FSpectrums[i][j] := 0; + FGains[i][j] := FNoiseAttenFactor; + FRealFFTs[i][j] := 0.0; + FImagFFTs[i][j] := 0.0; + end; + end; + + for j := 0 to FWindowSize-1 do + FOutOverlapBuffer[j] := 0.0; + + FInputPos := 0; + FInSampleCount := 0; + FOutSampleCount := -(FWindowSize div 2) * (FHistoryLen - 1); +end; + +function Min(A, B: Integer): Integer; +begin + if A < B then + Exit(A); + Result := B; +end; + +procedure TNoiseRemoval.ProcessSamples(len: Integer; Buffer: PSingle); +var + i: Integer; + avail: Integer; +begin + //while((len and FOutSampleCount) < FInSampleCount) do + while len > 0 do + begin + avail := Min(len, FWindowSize - FInputPos); + for i := 0 to avail-1 do + FInWaveBuffer[FInputPos + i] := buffer[i]; + buffer += avail; + len -= avail; + FInputPos += avail; + + if (FInputPos = FWindowSize) then + begin + FillFirstHistoryWindow(); + if (FDoProfile) then + GetProfile() + else + RemoveNoise(); + RotateHistoryWindows(); + + // Rotate halfway for overlap-add + //for(i = 0; i < mWindowSize / 2; i++) { + for i := 0 to FWindowSize div 2 -1 do + FInWaveBuffer[i] := FInWaveBuffer[i + FWindowSize div 2]; + + FInputPos := FWindowSize div 2; + end; + end; +end; + +procedure TNoiseRemoval.FillFirstHistoryWindow; +var + i: Integer; +begin + for i := 0 to FWindowSize-1 do + FFFTBuffer[i] := FInWaveBuffer[i]; + FFFT^.RealFFTf(FFFTBuffer); + //for(i = 1; i < (mSpectrumSize-1); i++) { + for i := 1 to FSpectrumSize-2 do + begin + FRealFFTs[0][i] := FFFTBuffer[FFFT^.BitReversed[i] ]; + FImagFFTs[0][i] := FFFTBuffer[FFFT^.BitReversed[i]+1]; + FSpectrums[0][i] := FRealFFTs[0][i]*FRealFFTs[0][i] + FImagFFTs[0][i]*FImagFFTs[0][i]; + FGains[0][i] := FNoiseAttenFactor; + end; + + // DC and Fs/2 bins need to be handled specially + FSpectrums[0][0] := FFFTBuffer[0]*FFFTBuffer[0]; + FSpectrums[0][FSpectrumSize-1] := FFFTBuffer[1]*FFFTBuffer[1]; + FGains[0][0] := FNoiseAttenFactor; + FGains[0][FSpectrumSize-1] := FNoiseAttenFactor; +end; + +function Max(A,B: Integer): Integer; inline; +begin + if A>B then + Exit(A); + Result := B; +end; + +procedure TNoiseRemoval.ApplyFreqSmoothing(ASpec: PSingle); +var + tmp: PSingle; + i, j, j0, j1: Integer; +begin + tmp := NewFloatArray(FSpectrumSize); + for i := 0 to FSpectrumSize-1 do + begin + j0 := Max(0, i - FFreqSmoothingBins); + j1 := Min(FSpectrumSize-1, i + FFreqSmoothingBins); + tmp[i] := 0.0; + //for(j = j0; j <= j1; j++) + for j := j0 to j1-1 do + begin + tmp[i] += Aspec[j]; + end; + tmp[i] := tmp[i] / (j1 - j0 + 1); + end; + + //for(i = 0; i < mSpectrumSize; i++) + for i := 0 to FSpectrumSize-1 do + Aspec[i] := tmp[i]; + + Freemem(Tmp); +end; + +procedure TNoiseRemoval.GetProfile; +var + start, + finish, + i, j: Integer; + min: Single; +begin + // The noise threshold for each frequency is the maximum + // level achieved at that frequency for a minimum of + // mMinSignalBlocks blocks in a row - the max of a min. + + start := FHistoryLen - FMinSignalBlocks; + finish := FHistoryLen; + + + for j := 0 to FSpectrumSize-1 do + begin + min := FSpectrums[start][j]; + for i := start+1 to finish-1 do + if (FSpectrums[i][j] < min) then + min := FSpectrums[i][j]; + + if (min > FNoiseThreshold[j]) then + FNoiseThreshold[j] := min; + end; + + FOutSampleCount += FWindowSize div 2; // what is this for? Not used when we are getting the profile? +end; + +procedure TNoiseRemoval.RemoveNoise; +var + center: Integer; + start, + finish, + i,j : Integer; + min: Single; + out_: Integer; +begin + center := FHistoryLen div 2; + start := center - FMinSignalBlocks div 2; + finish := start + FMinSignalBlocks; + + // Raise the gain for elements in the center of the sliding history + for j := 0 to FSpectrumSize-1 do + begin + min := FSpectrums[start][j]; + //for (i = start+1; i < finish; i++) { + for i := start+1 to finish-1 do + begin + if (FSpectrums[i][j] < min) then + min := FSpectrums[i][j]; + end; + if (min > FSensitivityFactor * FNoiseThreshold[j]) and (FGains[center][j] < 1.0) then + begin + if (FbLeaveNoise) then + FGains[center][j] := 0.0 + else + FGains[center][j] := 1.0; + end + else + begin + if (FbLeaveNoise) then + FGains[center][j] := 1.0; + end; + end; + + // Decay the gain in both directions; + // note that mOneBlockAttackDecay is less than 1.0 + // of linear attenuation per block + for j := 0 to FSpectrumSize-1 do + begin + for i := center+1 to FHistoryLen-1 do + begin + if (FGains[i][j] < FGains[i - 1][j] * FOneBlockAttackDecay) then + FGains[i][j] := FGains[i - 1][j] * FOneBlockAttackDecay; + if (FGains[i][j] < FNoiseAttenFactor) then + FGains[i][j] := FNoiseAttenFactor; + end; + for i := center-1 downto 0 do + begin + if (FGains[i][j] < FGains[i + 1][j] * FOneBlockAttackDecay) then + FGains[i][j] := FGains[i + 1][j] * FOneBlockAttackDecay; + if (FGains[i][j] < FNoiseAttenFactor) then + FGains[i][j] := FNoiseAttenFactor; + end; + end; + + + // Apply frequency smoothing to output gain + out_ := FHistoryLen - 1; // end of the queue + + ApplyFreqSmoothing(FGains[out_]); + + // Apply gain to FFT + //for (j = 0; j < (mSpectrumSize-1); j++) { + for j := 0 to FSpectrumSize-2 do + begin + FFFTBuffer[j*2 ] := FRealFFTs[out_][j] * FGains[out_][j]; + FFFTBuffer[j*2+1] := FImagFFTs[out_][j] * FGains[out_][j]; + end; + // The Fs/2 component is stored as the imaginary part of the DC component + FFFTBuffer[1] := FRealFFTs[out_][FSpectrumSize-1] * FGains[out_][FSpectrumSize-1]; + + // Invert the FFT into the output buffer + FFFT^.InverseRealFFTf(FFFTBuffer); + + // Overlap-add + for j := 0 to FSpectrumSize-2 do + begin + FOutOverlapBuffer[j*2 ] += FFFTBuffer[FFFT^.BitReversed[j] ] * FWindow[j*2 ]; + FOutOverlapBuffer[j*2+1] += FFFTBuffer[FFFT^.BitReversed[j]+1] * FWindow[j*2+1]; + end; + + // Output the first half of the overlap buffer, they're done - + // and then shift the next half over. + + if (FOutSampleCount >= 0) then // ...but not if it's the first half-window + begin + //FOutputTrack->Append((samplePtr)mOutOverlapBuffer, floatSample, mWindowSize / 2); + FWriteProc(Self, FOutOverlapBuffer, FWindowSize div 2); + end; + + + FOutSampleCount += FWindowSize div 2; + //for(j = 0; j < mWindowSize / 2; j++) + for j := 0 to FWindowSize div 2 -1 do + begin + FOutOverlapBuffer[j] := FOutOverlapBuffer[j + (FWindowSize div 2)]; + FOutOverlapBuffer[j + (FWindowSize div 2)] := 0.0; + end +end; + +procedure TNoiseRemoval.RotateHistoryWindows; +var + last: Integer; + i: Integer; + lastSpectrum: PSingle; + lastGain: PSingle; + lastRealFFT: PSingle; + lastImagFFT: PSingle; +begin + last := FHistoryLen - 1; + + // Remember the last window so we can reuse it + lastSpectrum := FSpectrums[last]; + lastGain := FGains[last]; + lastRealFFT := FRealFFTs[last]; + lastImagFFT := FImagFFTs[last]; + + // Rotate each window forward + //for(i = last; i >= 1; i--) { + for i := last downto 1 do + begin + FSpectrums[i] := FSpectrums[i-1]; + FGains[i] := FGains[i-1]; + FRealFFTs[i] := FRealFFTs[i-1]; + FImagFFTs[i] := FImagFFTs[i-1]; + end; + + // Reuse the last buffers as the new first window + FSpectrums[0] := lastSpectrum; + FGains[0] := lastGain; + FRealFFTs[0] := lastRealFFT; + FImagFFTs[0] := lastImagFFT; +end; + +procedure TNoiseRemoval.FinishTrack; +var + empty: PSingle; + i: Integer; +begin + // Keep flushing empty input buffers through the history + // windows until we've output exactly as many samples as + // were input. + // Well, not exactly, but not more than mWindowSize/2 extra samples at the end. + // We'll delete them later in ProcessOne. + empty := NewFloatArray(FWindowSize div 2); + //for(i = 0; i < mWindowSize / 2; i++) + for i := 0 to FWindowSize div 2 -1 do + empty[i] := 0.0; + + while (FOutSampleCount < FInSampleCount) do + ProcessSamples(FWindowSize div 2, empty); + + Freemem(empty); +end; + +procedure TNoiseRemoval.Cleanup; +var + i: Integer; +begin + FFFT^.EndFFT; + + if (FDoProfile) then + ApplyFreqSmoothing(@FNoiseThreshold[0]); + + + for i := 0 to FHistoryLen-1 do + begin + FreeMem(FSpectrums[i]); + FreeMem(FGains[i]); + FreeMem(FRealFFTs[i]); + FreeMem(FImagFFTs[i]); + end; + SetLength(FSpectrums,0); + SetLength(FGains,0); + SetLength(FRealFFTs,0); + SetLength(FImagFFTs,0); + + FreeMem(FFFTBuffer); + FreeMem(FInWaveBuffer); + FreeMem(FWindow); + FreeMem(FOutOverlapBuffer); + + FInited := False; +end; + +function TNoiseRemoval.GetNoiseProfile: TSingleArray; +begin + SetLength(Result, FSpectrumSize); + Move(FNoiseThreshold[0], Result[0], FSpectrumSize); +end; + +procedure TNoiseRemoval.SetAttackDecayTime(AValue: Double); +begin + if FAttackDecayTime=AValue then Exit; + if AValue < 0.0 then AValue := 0; + if AValue > 1.0 then AValue := 1.0; + FAttackDecayTime:=AValue; +end; + +procedure TNoiseRemoval.SetFreqSmoothingHz(AValue: Double); +begin + if FFreqSmoothingHz=AValue then Exit; + if AValue<0 then AValue:=0; + if AValue>1000 then AValue := 1000; + FFreqSmoothingHz:=AValue; +end; + +procedure TNoiseRemoval.SetGain(AValue: Double); +begin + if FNoiseGain=AValue then Exit; + if AValue > 0 then AValue:=0; + if AValue < -48 then AValue := -48; + + FNoiseGain:=AValue; +end; + +procedure TNoiseRemoval.SetNoiseProfile(AValue: TSingleArray); +begin + SetLength(FNoiseThreshold, FSpectrumSize); + Move(AValue[0], FNoiseThreshold[0], FSpectrumSize); + FHasProfile:=True; + + FDoProfile:=False; + Cleanup; // set after FDoProfile so the profile is not processed. + +end; + +procedure TNoiseRemoval.SetSensitivity(AValue: Double); +begin + if FSensitivity=AValue then Exit; + if AValue < -20.0 then AValue:=-20.0; + if AValue > 20.0 then AValue := 20.0; + FSensitivity:=AValue; +end; + +constructor TNoiseRemoval.Create; +begin + FWindowSize:=2048; + FSpectrumSize:= 1 + FWindowSize div 2; + + // loaded prefs + FSensitivity := 0.0; + FNoiseGain := -24.0; + FFreqSmoothingHz := 150.0; + FAttackDecayTime:= 0.15; + FbLeaveNoise:=False; + + FMinSignalTime := 0.05; + FHasProfile := False; + FDoProfile := True; + + SetLength(FNoiseThreshold, FSpectrumSize); + +end; + +destructor TNoiseRemoval.Destroy; +begin + SetLength(FNoiseThreshold, 0); + + inherited Destroy; +end; + +function TNoiseRemoval.Init(ASampleRate: Integer): Boolean; +begin + FSampleRate:=ASampleRate; + Initialize; + FInited:=True; + Result := True; + Reset; +end; + +function TNoiseRemoval.Process(AData: PSingle; ASampleCount: Integer; + AGetNoiseProfile: Boolean; AMoreComing: Boolean = False): Boolean; +begin + if not FInited then + Raise Exception.Create('TNoiseRemoval is not Inited'); + + if not AGetNoiseProfile and not FHasProfile then + raise Exception.Create('Tried to remove noise without profile.'); + + FDoProfile:=AGetNoiseProfile; + + if FDoProfile and (FTotalRead = 0) then + begin + Initialize; + reset; + end; + + Inc(FTotalRead, ASampleCount); + ProcessSamples(ASampleCount, AData); + Result := True; + + if AMoreComing then + Exit; + + if {AGetNoiseProfile or }FDoProfile then + begin + FHasProfile:=True; + Cleanup; // triggers the data in FNoiseThreshold to be processed + + // must be set after Cleanup() is called + //FDoProfile:=False; + + //Initialize; + FTotalRead:=0; + end; + + FHasProfile:=True; + FDoProfile := False; + +end; + +procedure TNoiseRemoval.Flush; +begin + if not FInited then + Exit; + + FinishTrack; + Cleanup; // Sets FInited to False +end; + +{ TFFT } + +function TFFT.InitializeFFT(FFTLen: Integer): PFFT; +var + i: Integer; + temp: Integer; + mask: Integer; +begin + Result := New(PFFT); + if Result = nil then + raise EOutOfMemory.Create('Error allocating memory for FFT'); + + + with Result^ do begin + + {* + * FFT size is only half the number of data points + * The full FFT output can be reconstructed from this FFT's output. + * (This optimization can be made since the data is real.) + *} + Points := FFTLen div 2; + + SetLength(FPCSinTable, 2*Points); + SinTable:=@FPCSinTable[0]; + + BitReversed := Getmemory(Points*SizeOf(Integer)); + if BitReversed = nil then + raise EOutOfMemory.Create('Error allocating memory for BitReversed.'); + + for i := 0 to Points-1 do + begin + temp:=0; + mask := Points div 2; + while mask > 0 do + begin + //for(mask=h->Points/2;mask>0;mask >>= 1) + // temp=(temp >> 1) + (i&mask ? h->Points : 0); + temp := (temp shr 1); + if (i and mask) <> 0 then + temp := temp + Points; + //else temp := temp + 0; // why would you do that? + mask := mask shr 1; + end; + + BitReversed[i]:=temp; + end; + + for i := 0 to Points-1 do + begin + SinTable[BitReversed[i] ]:= -sin(2*PI*i/(2*Points)); + SinTable[BitReversed[i]+1]:= -cos(2*PI*i/(2*Points)); + end; + +{$ifdef EXPERIMENTAL_EQ_SSE_THREADED} + // new SSE FFT routines work on live data + for(i=0;i<32;i++) + if((1<<i)&fftlen) + h->pow2Bits=i; +{$endif} + + end; // with Result^ + + +end; + +procedure TFFT.EndFFT; +begin + if Points>0 then + begin + Freemem(BitReversed); + SetLength(FPCSinTable, 0); + SinTable:=nil; + end; + + Dispose(PFFT(@Self)); +end; + +function TFFT.GetFFT(FFTLen: Integer): PFFT; +var + h: Integer = 0; + n: Integer; +begin + n := fftlen div 2; + + while (h<MAX_HFFT) and (FFTArray[h] <> nil) and (n <> FFTArray[h]^.Points) do + begin + if (h<MAX_HFFT) then + begin + if(FFTArray[h] = nil) then + begin + FFTArray[h] := InitializeFFT(fftlen); + FFTLockCount[h] := 0; + end; + Inc(FFTLockCount[h]); + Exit(FFTArray[h]); + end + else begin + // All buffers used, so fall back to allocating a new set of tables + Exit(InitializeFFT(fftlen)); + end; + Inc(h); + end; +end; + +procedure TFFT.ReleaseFFT; +var + h: Integer = 0; +begin + + while (h<MAX_HFFT) and (FFTArray[h] <> @Self) do + begin + if(h<MAX_HFFT) then + begin + Dec(FFTLockCount[h]); + end + else + begin + EndFFT; + end; + Inc(h); + end; +end; + +procedure TFFT.InverseRealFFTf(buffer: PSingle); +var + A, B: PSingle; + sptr: PSingle; + endptr1, endptr2: PSingle; + br1: PInteger; + HRplus,HRminus,HIplus,HIminus: Single; + v1,v2,sin,cos: Single; + ButterfliesPerGroup: Integer; +begin + + ButterfliesPerGroup:=Points div 2; + + //* Massage input to get the input for a real output sequence. */ + A:=@buffer[2]; + B:=@buffer[Points*2-2]; + br1:=@BitReversed[1]; + while(A<B) do + begin + sin:=SinTable[br1^]; + cos:=SinTable[br1[1]]; + //HRplus = (HRminus = *A - *B ) + (*B * 2); + HRminus:=A^-B^; + HRplus:=HRminus+ (B^ *2); + + //HIplus = (HIminus = *(A+1) - *(B+1)) + (*(B+1) * 2); + HIminus:=A[1]-B[1]; + HIplus:=HIminus+(B[1] *2); + + v1 := (sin*HRminus + cos*HIplus); + v2 := (cos*HRminus - sin*HIplus); + A^ := (HRplus + v1) * single(0.5); + B^ := A^ - v1; + A[1] := (HIminus - v2) * single(0.5); + B[1] := A[1] - HIminus; + + A+=2; + B-=2; + Inc(br1); + end; + //* Handle center bin (just need conjugate) */ + A[1] :=-A[1]; + {* Handle DC bin separately - this ignores any Fs/2 component + buffer[1]=buffer[0]=buffer[0]/2;*} + //* Handle DC and Fs/2 bins specially */ + //* The DC bin is passed in as the real part of the DC complex value */ + //* The Fs/2 bin is passed in as the imaginary part of the DC complex value */ + //* (v1+v2) = buffer[0] == the DC component */ + //* (v1-v2) = buffer[1] == the Fs/2 component */ + v1:=0.5*(buffer[0]+buffer[1]); + v2:=0.5*(buffer[0]-buffer[1]); + buffer[0]:=v1; + buffer[1]:=v2; + + {* + * Butterfly: + * Ain-----Aout + * \ / + * / \ + * Bin-----Bout + *} + + endptr1:=@buffer[Points*2]; + + while(ButterfliesPerGroup>0) do + begin + A:=buffer; + B:=@buffer[ButterfliesPerGroup*2]; + sptr:=@SinTable[0]; + + while(A<endptr1) do + begin + sin:=sptr^; Inc(sptr); // *(sptr++); + cos:=sptr^; Inc(sptr); // *(sptr++); + endptr2:=B; + while(A<endptr2) do + begin + v1:=B^*cos - B[1]*sin; + v2:=B^*sin + B[1]*cos; + B^ := (A^+v1)*Single(0.5); + A^ := B^ - v1; Inc(A); Inc(B); //*(A++)=*(B++)-v1; + B^ := (A^ + v2)* Single(0.5); //*B=(*A+v2)*(fft_type)0.5; + A^ := B^ - v2; Inc(A); Inc(B); //*(A++)=*(B++)-v2; + end; + A:=B; + B := @B[ButterfliesPerGroup*2]; + end; + ButterfliesPerGroup := ButterfliesPerGroup shr 1; + end; +end; + +procedure TFFT.CleanupFFT; +var + h: Integer; +begin + + for h :=0 to MAX_HFFT-1do begin + if((FFTLockCount[h] <= 0) and (FFTArray[h] <> nil)) then + begin + FFTArray[h]^.EndFFT; + FFTArray[h] := nil; + end; + end; +end; + +procedure TFFT.RealFFTf(buffer: PSingle); +var + A, B: PSingle; + sptr: PSingle; + endptr1, endptr2: PSingle; + br1, br2: PInteger; + HRplus,HRminus,HIplus,HIminus: Single; + v1,v2,sin_,cos_: Single; + ButterfliesPerGroup: Integer; +begin + ButterfliesPerGroup:=Points div 2; + + {* + * Butterfly: + * Ain-----Aout + * \ / + * / \ + * Bin-----Bout + *} + + endptr1:=buffer+Points*2; + + while(ButterfliesPerGroup>0) do + begin + A:=buffer; + B:=buffer+ButterfliesPerGroup*2; + sptr:=@SinTable[0]; + + while(A<endptr1) do + begin + sin_:=sptr^; + cos_ := sptr[1]; + endptr2:=B; + while(A<endptr2) do + begin + v1 := B^ * cos_ + B[1] * sin_; //v1=*B*cos + *(B+1)*sin; + v2 := B^ * sin_ - B[1] * cos_; //v2=*B*sin - *(B+1)*cos; + B^ := A^+v1; //*B=(*A+v1); + A^ := B^-2*v1; Inc(A); Inc(B); //*(A++)=*(B++)-2*v1; + + B^ := A^-v2; //*B=(*A-v2); + A^ := B^+2*v2; Inc(A); Inc(B); //*(A++)=*(B++)+2*v2; + end; + A:=B; + B:=B+ButterfliesPerGroup*2; + sptr:=sptr+2; + end; + + ButterfliesPerGroup := ButterfliesPerGroup shr 1; + end; + + //* Massage output to get the output for a real input sequence. */ + br1:=@BitReversed[1]; // is this wrong? Should be @BitReversed[0] ; ? + br2:=@BitReversed[Points-1]; + + while(br1<br2) do + begin + sin_:=SinTable[br1[0]]; + cos_:=SinTable[br1[1]]; + A:=@buffer[br1^]; + B:=@buffer[br2^]; + //HRplus = (HRminus = *A - *B ) + (*B * 2); + HRminus := A^ - B^; + HRplus := HRminus + (B^ * 2); + + //HIplus = (HIminus = *(A+1) - *(B+1)) + (*(B+1) * 2); + HIminus := A[1] - B[1]; + HIplus := HIminus + (B[1] * 2); + + v1 := (sin_*HRminus - cos_*HIplus); + v2 := (cos_*HRminus + sin_*HIplus); + A^ := (HRplus + v1) * single(0.5); + B^ := A^ - v1; + A[1] := (HIminus + v2) * single(0.5); + B[1] := A[1] - HIminus; + + Inc(br1); + Dec(br2); + end; + //* Handle the center bin (just need a conjugate) */ + A:=buffer+br1[1]; + A^ := -A^; + {* Handle DC bin separately - and ignore the Fs/2 bin + buffer[0]+=buffer[1]; + buffer[1]=(fft_type)0;*} + ///* Handle DC and Fs/2 bins separately */ + ///* Put the Fs/2 value into the imaginary part of the DC bin */ + v1:=buffer[0]-buffer[1]; + buffer[0]+=buffer[1]; + buffer[1]:=v1; + +end; + +procedure TFFT.ReorderToTime(Buffer: PSingle; TimeOut: PSingle); +var + i: Integer; +begin + // Copy the data into the real outputs + //for(int i=0;i<hFFT->Points;i++) { + for i := 0 to Points-1 do + begin + TimeOut[i*2 ]:=buffer[BitReversed[i] ]; + TimeOut[i*2+1]:=buffer[BitReversed[i]+1]; + end; +end; + +procedure TFFT.ReorderToFreq(Buffer: PSingle; RealOut: PSingle; ImagOut: PSingle + ); +var + i: Integer; +begin + // Copy the data into the real and imaginary outputs + //for(int i=1;i<hFFT->Points;i++) + for i := 1 to Points-1 do + begin + + RealOut[i]:=buffer[BitReversed[i] ]; + ImagOut[i]:=buffer[BitReversed[i]+1]; + end; + RealOut[0] := buffer[0]; // DC component + ImagOut[0] := 0; + RealOut[Points] := buffer[1]; // Fs/2 component + ImagOut[Points] := 0; +end; + +initialization + FillChar(FFTArray, SizeOf(FFTArray), 0); + FillChar(FFTLockCount, SizeOf(FFTLockCount), 0); + +end. + diff --git a/UOS/examples/uos_dsp_utils.pas b/UOS/examples/uos_dsp_utils.pas new file mode 100644 index 0000000..b861117 --- /dev/null +++ b/UOS/examples/uos_dsp_utils.pas @@ -0,0 +1,328 @@ +{This unit is part of United Openlibraries of Sound (uos)} +{ + This unit uses part of Pascal Audio IO package. + (paio_channelhelper, pa_ringbuffer, pa_utils) + Copyright (c) 2016 by Andrew Haines. + + Fred van Stappen fiens@hotmail.com +} + +unit uos_dsp_utils; + +{$mode objfpc}{$H+} +{$interfaces corba} + +interface + +uses + Classes, SysUtils; + +const + AUDIO_BUFFER_SIZE = 8192; + AUDIO_BUFFER_FLOAT_SAMPLES = AUDIO_BUFFER_SIZE div 4; + +type + PPSingle = ^PSingle; + TSingleArray = array of Single; + TChannelArray = array of TSingleArray; + + { TRingBuffer } + + TRingBuffer = class + private + FMem: PByte; + FWritePos: Integer; + FReadPos: Integer; + FUsedSpace: Integer; + FTotalSpace: Integer; + function GetFreeSpace: Integer; + public + constructor Create(ASize: Integer); + destructor Destroy; override; + function Write(const ASource; ASize: Integer): Integer; + function Read(var ADest; ASize: Integer): Integer; + property FreeSpace: Integer read GetFreeSpace; + property UsedSpace: Integer read FUsedSpace; + + end; + +type + IPAIODataIOInterface = interface + ['IPAIODataIOInterface'] + procedure WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); + end; + + { TPAIOChannelHelper } + + TPAIOChannelHelper = class(IPAIODataIOInterface) + private + FOutputs: TList; + FTarget: IPAIODataIOInterface; // where we will send plexed data. + FBuffers: TChannelArray; + FPos: array of Integer; + // called by the individual channel objects. + procedure WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); + procedure AllocateBuffers; + procedure SendDataToTarget; + public + constructor Create(APlexedTarget: IPAIODataIOInterface); + destructor Destroy; override; + property Outputs: TList read FOutputs;// of IPAIOSplitterJoinerInterface. Each is a channel in order. + procedure Write(AData: PSingle; ASamples: Integer); // this expects interleaved data. + end; + +function NewChannelArray(AChannels: Integer; ASamplesPerChannel: Integer): TChannelArray; +function SplitChannels(AData: PSingle; ASamples: Integer; AChannels: Integer): TChannelArray; +function JoinChannels(AChannelData: TChannelArray; ASamples: Integer = -1): TSingleArray; +function JoinChannels(AChannelData: PPSingle; AChannels: Integer; ASamples: Integer): TSingleArray; + +function Min(A,B: Integer): Integer; +function Max(A,B: Integer): Integer; + +implementation + +{ TPAIOChannelHelper } + +procedure TPAIOChannelHelper.WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); +var + BufIndex: Integer; + BufSize, WCount: Integer; + Written: Integer = 0; +begin + BufIndex := FOutputs.IndexOf(Pointer(ASender)); + + if BufIndex = -1 then + raise Exception.Create('Trying to write data from an unknown instance'); + + AllocateBuffers; + + BufSize := Length(FBuffers[0]); + + While ASamples > 0 do + begin + WCount := Min(BufSize-FPos[BufIndex], ASamples); + Move(AData[Written], FBuffers[BufIndex][0], WCount*SizeOf(Single)); + Inc(Written, WCount); + Dec(ASamples, WCount); + Inc(FPos[BufIndex], WCount); + + if BufIndex = High(FBuffers) then + SendDataToTarget; + end; +end; + +procedure TPAIOChannelHelper.AllocateBuffers; +begin + if Length(FBuffers) <> FOutputs.Count then + begin + SetLength(FBuffers, 0); + FBuffers := NewChannelArray(FOutputs.Count, AUDIO_BUFFER_SIZE*2); + SetLength(FPos, FOutputs.Count); + end; +end; + +procedure TPAIOChannelHelper.SendDataToTarget; +var + Plexed: TSingleArray; + HighestCount: Integer = 0; + i: Integer; +begin + for i := 0 to High(FPos) do + if FPos[i] > HighestCount then + HighestCount:=FPos[i]; + Plexed := JoinChannels(FBuffers, HighestCount); + + FTarget.WriteDataIO(Self, @Plexed[0], Length(Plexed)); + + for i := 0 to High(FPos) do + Dec(FPos[i], HighestCount); +end; + +constructor TPAIOChannelHelper.Create(APlexedTarget: IPAIODataIOInterface); +begin + FOutputs := TList.Create; + FTarget := APlexedTarget; +end; + +destructor TPAIOChannelHelper.Destroy; +begin + FOutputs.Free; + inherited Destroy; +end; + +procedure TPAIOChannelHelper.Write(AData: PSingle; ASamples: Integer); +var + Channels: TChannelArray; + i: Integer; + Pos: Integer = 0; + WCount: Integer; +begin + AllocateBuffers; + Channels := SplitChannels(AData, ASamples, Outputs.Count); + while ASamples > 0 do + begin + WCount := Min(1024, ASamples div Outputs.Count); + for i := 0 to Outputs.Count-1 do + begin + IPAIODataIOInterface(Outputs.Items[i]).WriteDataIO(Self, @Channels[i][Pos], WCount); + end; + Dec(ASamples, WCount * Outputs.Count); + Inc(Pos, WCount); + end; +end; + +{ TRingBuffer } + +function TRingBuffer.GetFreeSpace: Integer; +begin + Result := FTotalSpace-FUsedSpace; +end; + +constructor TRingBuffer.Create(ASize: Integer); +begin + FMem:=Getmem(ASize); + FTotalSpace:=ASize; +end; + +destructor TRingBuffer.Destroy; +begin + Freemem(FMem); + inherited Destroy; +end; + +function TRingBuffer.Write(const ASource; ASize: Integer): Integer; +var + EOB: Integer; // end of buffer + WSize: Integer; + WTotal: Integer = 0; +begin + if FUsedSpace = 0 then + begin + // give the best chance of not splitting the data at buffer end. + FWritePos:=0; + FReadPos:=0; + end; + if ASize > FreeSpace then + raise Exception.Create('Ring buffer overflow'); + Result := ASize; + Inc(FUsedSpace, ASize); + while ASize > 0 do + begin + EOB := FTotalSpace - FWritePos; + WSize := Min(ASize, EOB); + Move(PByte(@ASource)[WTotal], FMem[FWritePos], WSize); + Inc(FWritePos, WSize); + Dec(ASize, WSize); + + if FWritePos >= FTotalSpace then + FWritePos:= 0; + end; +end; + +function TRingBuffer.Read(var ADest; ASize: Integer): Integer; +var + EOB: Integer; // end of buffer + RSize: Integer; + RTotal: Integer = 0; +begin + if ASize > UsedSpace then + raise Exception.Create('Ring buffer underflow'); + ASize := Min(ASize, UsedSpace); + Result := ASize; + + Dec(FUsedSpace, ASize); + while ASize > 0 do + begin + EOB := FTotalSpace - FReadPos; + RSize := Min(EOB, ASize); + Move(FMem[FReadPos], PByte(@ADest)[RTotal],RSize); + Dec(ASize, RSize); + Inc(FReadPos, RSize); + if FReadPos >= FTotalSpace then + FReadPos:=0; + end; +end; + +function Min(A,B: Integer): Integer; +begin + if A < B then Exit(A); + Result := B; +end; + +function Max(A,B: Integer): Integer; +begin + if A > B then Exit(A); + Result := B; +end; + +function NewChannelArray(AChannels: Integer; ASamplesPerChannel: Integer): TChannelArray; +var + i: Integer; +begin + SetLength(Result, AChannels); + for i := 0 to AChannels-1 do + SetLength(Result[i], ASamplesPerChannel); +end; + +// Samples is total samples not samples per channel. +// So Samples = 1000 if 2 Channels have 500 each +function SplitChannels(AData: PSingle; ASamples: Integer; AChannels: Integer): TChannelArray; +var + SamplesPerChannel: Integer; + i, j: Integer; +begin + SamplesPerChannel:=ASamples div AChannels; + //SetLength(Result, AChannels); + Result := NewChannelArray(AChannels, SamplesPerChannel); + for i := 0 to AChannels-1 do + begin + //SetLength(Result[i], SamplesPerChannel); + for j := 0 to SamplesPerChannel-1 do + begin + Result[i][j] := AData[j*AChannels+i]; + end; + end; +end; + +function JoinChannels(AChannelData: TChannelArray; ASamples: Integer): TSingleArray; +var + i: Integer; + j: Integer; + Samples: Integer; +begin + if Length(AChannelData) > 0 then + begin + if ASamples <> -1 then + Samples := ASamples + else + Samples := Length(AChannelData[0]); + + SetLength(Result, Length(AChannelData) * Samples); + for i := 0 to High(AChannelData) do + for j := 0 to Samples-1 do + Result[j*Length(AChannelData)+i] := AChannelData[i][j]; + end + else + SetLength(Result, 0); +end; + +function JoinChannels(AChannelData: PPSingle; AChannels: Integer; + ASamples: Integer): TSingleArray; +var + i: Integer; + j: Integer; +begin + if ASamples > 0 then + begin + SetLength(Result, AChannels * ASamples); + for i := 0 to AChannels-1 do + for j := 0 to ASamples-1 do + Result[j*AChannels+i] := AChannelData[i][j]; + end + else + SetLength(Result, 0); + +end; + +end. + diff --git a/UOS/examples/uos_fdkaacdecoder.pas b/UOS/examples/uos_fdkaacdecoder.pas new file mode 100644 index 0000000..e39693f --- /dev/null +++ b/UOS/examples/uos_fdkaacdecoder.pas @@ -0,0 +1,1495 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Pascal Wrapper + Dynamic loading of fdk_aacdecoder library. + Load library with ad_load() and release with ad_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com / 2024} + +unit uos_fdkaacdecoder; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} +{$MINENUMSIZE 4} + +interface + +uses + dynlibs, + SysUtils; + +type + FDK_MODULE_ID = ( + FDK_NONE = 0, + FDK_TOOLS = 1, + FDK_SYSLIB = 2, + FDK_AACDEC = 3, + FDK_AACENC = 4, + FDK_SBRDEC = 5, + FDK_SBRENC = 6, + FDK_TPDEC = 7, + FDK_TPENC = 8, + FDK_MPSDEC = 9, + FDK_MPEGFILEREAD = 10, + FDK_MPEGFILEWRITE = 11, + FDK_PCMDMX = 31, + FDK_MPSENC = 34, + FDK_TDLIMIT = 35, + FDK_UNIDRCDEC = 38, + + FDK_MODULE_LAST + ); + +type +(** + * Library information. + *) + PPLIB_INFO = ^PLIB_INFO; + PLIB_INFO = ^LIB_INFO; + + LIB_INFO = record + title: MarshaledAString; + build_date: MarshaledAString; + build_time: MarshaledAString; + module_id: FDK_MODULE_ID; + version: integer; + flags: cardinal; + versionStr: array[0..31] of AnsiChar; + end; + +const + _PU = ''; + {$IF Defined(MSWINDOWS)} + {$IFDEF CPUX64} + libfdk_aac = 'libfdk-aac-2.dll'; + {$ENDIF} + {$IFDEF CPUX86} + libfdk_aac = 'libfdk-aac-2.dll'; + {$ENDIF} + {$ELSEIF Defined(DARWIN) or Defined(MACOS)} + libfdk_aac = '@executable_path/../Frameworks/libfdk-aac-2.dylib'; + _PU = '_' + {$ELSEIF Defined(UNIX)} + libfdk_aac = 'libfdk-aac-2.so'; + {$IFEND} + +type + (** + * File format identifiers. + *) + FILE_FORMAT = ( + FF_UNKNOWN = -1, (**< Unknown format. *) + FF_RAW = 0, (**< No container, bit stream data conveyed "as is". *) + + FF_MP4_3GPP = 3, (**< 3GPP file format. *) + FF_MP4_MP4F = 4, (**< MPEG-4 File format. *) + + FF_RAWPACKETS = 5 (**< Proprietary raw packet file. *) + ); + + (** + * Transport type identifiers. + *) + TRANSPORT_TYPE = ( + TT_UNKNOWN = -1, (**< Unknown format. *) + TT_MP4_RAW = 0, (**< "as is" access units (packet based since there is + obviously no sync layer) *) + TT_MP4_ADIF = 1, (**< ADIF bitstream format. *) + TT_MP4_ADTS = 2, (**< ADTS bitstream format. *) + + TT_MP4_LATM_MCP1 = 6, (**< Audio Mux Elements with muxConfigPresent = 1 *) + TT_MP4_LATM_MCP0 = 7, (**< Audio Mux Elements with muxConfigPresent = 0, out + of band StreamMuxConfig *) + + TT_MP4_LOAS = 10, (**< Audio Sync Stream. *) + + TT_DRM = 12 (**< Digital Radio Mondial (DRM30/DRM+) bitstream format. *) + ); + + //TT_IS_PACKET(x) \ + // (((x) == TT_MP4_RAW) || ((x) == TT_DRM) || ((x) == TT_MP4_LATM_MCP0) || \ + // ((x) == TT_MP4_LATM_MCP1)) +function TT_IS_PACKET(x: TRANSPORT_TYPE): Boolean; + +type + (** + * Audio Object Type definitions. + *) + AUDIO_OBJECT_TYPE = ( + AOT_NONE = -1, + AOT_NULL_OBJECT = 0, + AOT_AAC_MAIN = 1, (**< Main profile *) + AOT_AAC_LC = 2, (**< Low Complexity object *) + AOT_AAC_SSR = 3, + AOT_AAC_LTP = 4, + AOT_SBR = 5, + AOT_AAC_SCAL = 6, + AOT_TWIN_VQ = 7, + AOT_CELP = 8, + AOT_HVXC = 9, + AOT_RSVD_10 = 10, (**< (reserved) *) + AOT_RSVD_11 = 11, (**< (reserved) *) + AOT_TTSI = 12, (**< TTSI Object *) + AOT_MAIN_SYNTH = 13, (**< Main Synthetic object *) + AOT_WAV_TAB_SYNTH = 14, (**< Wavetable Synthesis object *) + AOT_GEN_MIDI = 15, (**< General MIDI object *) + AOT_ALG_SYNTH_AUD_FX = 16, (**< Algorithmic Synthesis and Audio FX object *) + AOT_ER_AAC_LC = 17, (**< Error Resilient(ER) AAC Low Complexity *) + AOT_RSVD_18 = 18, (**< (reserved) *) + AOT_ER_AAC_LTP = 19, (**< Error Resilient(ER) AAC LTP object *) + AOT_ER_AAC_SCAL = 20, (**< Error Resilient(ER) AAC Scalable object *) + AOT_ER_TWIN_VQ = 21, (**< Error Resilient(ER) TwinVQ object *) + AOT_ER_BSAC = 22, (**< Error Resilient(ER) BSAC object *) + AOT_ER_AAC_LD = 23, (**< Error Resilient(ER) AAC LowDelay object *) + AOT_ER_CELP = 24, (**< Error Resilient(ER) CELP object *) + AOT_ER_HVXC = 25, (**< Error Resilient(ER) HVXC object *) + AOT_ER_HILN = 26, (**< Error Resilient(ER) HILN object *) + AOT_ER_PARA = 27, (**< Error Resilient(ER) Parametric object *) + AOT_RSVD_28 = 28, (**< might become SSC *) + AOT_PS = 29, (**< PS, Parametric Stereo (includes SBR) *) + AOT_MPEGS = 30, (**< MPEG Surround *) + + AOT_ESCAPE = 31, (**< Signal AOT uses more than 5 bits *) + + AOT_MP3ONMP4_L1 = 32, (**< MPEG-Layer1 in mp4 *) + AOT_MP3ONMP4_L2 = 33, (**< MPEG-Layer2 in mp4 *) + AOT_MP3ONMP4_L3 = 34, (**< MPEG-Layer3 in mp4 *) + AOT_RSVD_35 = 35, (**< might become DST *) + AOT_RSVD_36 = 36, (**< might become ALS *) + AOT_AAC_SLS = 37, (**< AAC + SLS *) + AOT_SLS = 38, (**< SLS *) + AOT_ER_AAC_ELD = 39, (**< AAC Enhanced Low Delay *) + + AOT_USAC = 42, (**< USAC *) + AOT_SAOC = 43, (**< SAOC *) + AOT_LD_MPEGS = 44, (**< Low Delay MPEG Surround *) + + (* Pseudo AOTs *) + AOT_MP2_AAC_LC = 129, (**< Virtual AOT MP2 Low Complexity profile *) + AOT_MP2_SBR = 132, (**< Virtual AOT MP2 Low Complexity Profile with SBR *) + + AOT_DRM_AAC = 143, (**< Virtual AOT for DRM (ER-AAC-SCAL without SBR) *) + AOT_DRM_SBR = 144, (**< Virtual AOT for DRM (ER-AAC-SCAL with SBR) *) + AOT_DRM_MPEG_PS = + 145, (**< Virtual AOT for DRM (ER-AAC-SCAL with SBR and MPEG-PS) *) + AOT_DRM_SURROUND = + 146, (**< Virtual AOT for DRM Surround (ER-AAC-SCAL (+SBR) +MPS) *) + AOT_DRM_USAC = 147 (**< Virtual AOT for DRM with USAC *) + ); + + //CAN_DO_PS(aot) \ + // ((aot) == AOT_AAC_LC || (aot) == AOT_SBR || (aot) == AOT_PS || \ + // (aot) == AOT_ER_BSAC || (aot) == AOT_DRM_AAC) +function CAN_DO_PS(aot: AUDIO_OBJECT_TYPE): Boolean; + + //IS_USAC(aot) ((aot) == AOT_USAC) +function IS_USAC(aot: AUDIO_OBJECT_TYPE): Boolean; + + //IS_LOWDELAY(aot) ((aot) == AOT_ER_AAC_LD || (aot) == AOT_ER_AAC_ELD) +function IS_LOWDELAY(aot: AUDIO_OBJECT_TYPE): Boolean; + +type + (** Channel Mode ( 1-7 equals MPEG channel configurations, others are + * arbitrary). *) + CHANNEL_MODE = ( + MODE_INVALID = -1, + MODE_UNKNOWN = 0, + MODE_1 = 1, (**< C *) + MODE_2 = 2, (**< L+R *) + MODE_1_2 = 3, (**< C, L+R *) + MODE_1_2_1 = 4, (**< C, L+R, Rear *) + MODE_1_2_2 = 5, (**< C, L+R, LS+RS *) + MODE_1_2_2_1 = 6, (**< C, L+R, LS+RS, LFE *) + MODE_1_2_2_2_1 = 7, (**< C, LC+RC, L+R, LS+RS, LFE *) + + MODE_6_1 = 11, (**< C, L+R, LS+RS, Crear, LFE *) + MODE_7_1_BACK = 12, (**< C, L+R, LS+RS, Lrear+Rrear, LFE *) + MODE_7_1_TOP_FRONT = 14, (**< C, L+R, LS+RS, LFE, Ltop+Rtop *) + + MODE_7_1_REAR_SURROUND = 33, (**< C, L+R, LS+RS, Lrear+Rrear, LFE *) + MODE_7_1_FRONT_CENTER = 34, (**< C, LC+RC, L+R, LS+RS, LFE *) + + MODE_212 = 128 (**< 212 configuration, used in ELDv2 *) + ); + + (** + * Speaker description tags. + * Do not change the enumeration values unless it keeps the following + * segmentation: + * - Bit 0-3: Horizontal postion (0: none, 1: front, 2: side, 3: back, 4: lfe) + * - Bit 4-7: Vertical position (0: normal, 1: top, 2: bottom) + *) + AUDIO_CHANNEL_TYPE = ( + ACT_NONE = $00, + ACT_FRONT = $01, (*!< Front speaker position (at normal height) *) + ACT_SIDE = $02, (*!< Side speaker position (at normal height) *) + ACT_BACK = $03, (*!< Back speaker position (at normal height) *) + ACT_LFE = $04, (*!< Low frequency effect speaker postion (front) *) + + ACT_TOP = $10, (*!< Top speaker area (for combination with speaker positions) *) + ACT_FRONT_TOP = $11, (*!< Top front speaker = (ACT_FRONT|ACT_TOP) *) + ACT_SIDE_TOP = $12, (*!< Top side speaker = (ACT_SIDE |ACT_TOP) *) + ACT_BACK_TOP = $13, (*!< Top back speaker = (ACT_BACK |ACT_TOP) *) + + ACT_BOTTOM = $20, (*!< Bottom speaker area (for combination with speaker positions) *) + ACT_FRONT_BOTTOM = $21, (*!< Bottom front speaker = (ACT_FRONT|ACT_BOTTOM) *) + ACT_SIDE_BOTTOM = $22, (*!< Bottom side speaker = (ACT_SIDE |ACT_BOTTOM) *) + ACT_BACK_BOTTOM = $23 (*!< Bottom back speaker = (ACT_BACK |ACT_BOTTOM) *) + ); + + SBR_PS_SIGNALING = ( + SIG_UNKNOWN = -1, + SIG_IMPLICIT = 0, + SIG_EXPLICIT_BW_COMPATIBLE = 1, + SIG_EXPLICIT_HIERARCHICAL = 2 + ); + +const + (** + * Audio Codec flags. + *) + AC_ER_VCB11 = $000001; (*!< aacSectionDataResilienceFlag flag (from ASC): 1 means use + virtual codebooks *) + AC_ER_RVLC = $000002; (*!< aacSpectralDataResilienceFlag flag (from ASC): 1 means use + huffman codeword reordering *) + AC_ER_HCR = $000004; (*!< aacSectionDataResilienceFlag flag (from ASC): 1 means use + virtual codebooks *) + AC_SCALABLE = $000008; (*!< AAC Scalable*) + AC_ELD = $000010; (*!< AAC-ELD *) + AC_LD = $000020; (*!< AAC-LD *) + AC_ER = $000040; (*!< ER syntax *) + AC_BSAC = $000080; (*!< BSAC *) + AC_USAC = $000100; (*!< USAC *) + AC_RSV603DA = $000200; (*!< RSVD60 3D audio *) + AC_HDAAC = $000400; (*!< HD-AAC *) + AC_RSVD50 = $004000; (*!< Rsvd50 *) + AC_SBR_PRESENT = $008000; (*!< SBR present flag (from ASC) *) + AC_SBRCRC = $010000; (*!< SBR CRC present flag. Only relevant for AAC-ELD for now. *) + AC_PS_PRESENT = $020000; (*!< PS present flag (from ASC or implicit) *) + AC_MPS_PRESENT = $040000; (*!< MPS present flag (from ASC or implicit) + *) + AC_DRM = $080000; (*!< DRM bit stream syntax *) + AC_INDEP = $100000; (*!< Independency flag *) + AC_MPEGD_RES = $200000; (*!< MPEG-D residual individual channel data. *) + AC_SAOC_PRESENT = $400000; (*!< SAOC Present Flag *) + AC_DAB = $800000; (*!< DAB bit stream syntax *) + AC_ELD_DOWNSCALE = $1000000; (*!< ELD Downscaled playout *) + AC_LD_MPS = $2000000; (*!< Low Delay MPS. *) + AC_DRC_PRESENT = $4000000; (*!< Dynamic Range Control (DRC) data found. + *) + AC_USAC_SCFGI3 = $8000000; (*!< USAC flag: If stereoConfigIndex is 3 the flag is set. *) + (** + * Audio Codec flags (reconfiguration). + *) + AC_CM_DET_CFG_CHANGE = $000001; (*!< Config mode signalizes the callback to work in config change + detection mode *) + AC_CM_ALLOC_MEM = $000002; (*!< Config mode signalizes the callback to work in memory + allocation mode *) + + (** + * Audio Codec flags (element specific). + *) + AC_EL_USAC_TW = $000001; (*!< USAC time warped filter bank is active *) + AC_EL_USAC_NOISE = $000002; (*!< USAC noise filling is active *) + AC_EL_USAC_ITES = $000004; (*!< USAC SBR inter-TES tool is active *) + AC_EL_USAC_PVC = $000008; (*!< USAC SBR predictive vector coding tool is active *) + AC_EL_USAC_MPS212 = $000010; (*!< USAC MPS212 tool is active *) + AC_EL_USAC_LFE = $000020; (*!< USAC element is LFE *) + AC_EL_USAC_CP_POSSIBLE = $000040; (*!< USAC may use Complex Stereo Prediction in this channel element + *) + AC_EL_ENHANCED_NOISE = $000080; (*!< Enhanced noise filling*) + AC_EL_IGF_AFTER_TNS = $000100; (*!< IGF after TNS *) + AC_EL_IGF_INDEP_TILING = $000200; (*!< IGF independent tiling *) + AC_EL_IGF_USE_ENF = $000400; (*!< IGF use enhanced noise filling *) + AC_EL_FULLBANDLPD = $000800; (*!< enable fullband LPD tools *) + AC_EL_LPDSTEREOIDX = $001000; (*!< LPD-stereo-tool stereo index *) + AC_EL_LFE = $002000; (*!< The element is of type LFE. *) + + (* CODER_CONFIG::flags *) + CC_MPEG_ID = $00100000; + CC_IS_BASELAYER = $00200000; + CC_PROTECTION = $00400000; + CC_SBR = $00800000; + CC_SBRCRC = $00010000; + CC_SAC = $00020000; + CC_RVLC = $01000000; + CC_VCB11 = $02000000; + CC_HCR = $04000000; + CC_PSEUDO_SURROUND = $08000000; + CC_USAC_NOISE = $10000000; + CC_USAC_TW = $20000000; + CC_USAC_HBE = $40000000; + +type + (** Generic audio coder configuration structure. *) + TCODER_CONFIG = record + aot: AUDIO_OBJECT_TYPE; (**< Audio Object Type (AOT). *) + extAOT: AUDIO_OBJECT_TYPE; (**< Extension Audio Object Type (SBR). *) + channelMode: CHANNEL_MODE; (**< Channel mode. *) + channelConfigZero: byte; (**< Use channel config zero + pce although a + standard channel config could be signaled. *) + samplingRate: integer; (**< Sampling rate. *) + extSamplingRate: integer; (**< Extended samplerate (SBR). *) + downscaleSamplingRate: integer; (**< Downscale sampling rate (ELD downscaled mode) + *) + bitRate: integer; (**< Average bitrate. *) + samplesPerFrame: integer; (**< Number of PCM samples per codec frame and audio + channel. *) + noChannels: integer; (**< Number of audio channels. *) + bitsFrame: integer; + nSubFrames: integer; (**< Amount of encoder subframes. 1 means no subframing. *) + BSACnumOfSubFrame: integer; (**< The number of the sub-frames which are grouped and + transmitted in a super-frame (BSAC). *) + BSAClayerLength: integer; (**< The average length of the large-step layers in bytes + (BSAC). *) + flags: cardinal; (**< flags *) + matrixMixdownA: byte; (**< Matrix mixdown index to put into PCE. Default value + 0 means no mixdown coefficient, valid values are 1-4 + which correspond to matrix_mixdown_idx 0-3. *) + headerPeriod: byte; (**< Frame period for sending in band configuration + buffers in the transport layer. *) + + stereoConfigIndex: byte; (**< USAC MPS stereo mode *) + sbrMode: byte; (**< USAC SBR mode *) + sbrSignaling: SBR_PS_SIGNALING; (**< 0: implicit signaling, 1: backwards + compatible explicit signaling, 2: + hierarcical explicit signaling *) + + rawConfig: array[0..63] of byte; (**< raw codec specific config as bit stream *) + rawConfigBits: integer; (**< Size of rawConfig in bits *) + + sbrPresent: byte; + psPresent: byte; + end; + +const + USAC_ID_BIT = 16; (** USAC element IDs start at USAC_ID_BIT *) + +type + (** MP4 Element IDs. *) + MP4_ELEMENT_ID = ( + (* mp4 element IDs *) + ID_NONE = -1, (**< Invalid Element helper ID. *) + ID_SCE = 0, (**< Single Channel Element. *) + ID_CPE = 1, (**< Channel Pair Element. *) + ID_CCE = 2, (**< Coupling Channel Element. *) + ID_LFE = 3, (**< LFE Channel Element. *) + ID_DSE = 4, (**< Currently one Data Stream Element for ancillary data is + supported. *) + ID_PCE = 5, (**< Program Config Element. *) + ID_FIL = 6, (**< Fill Element. *) + ID_END = 7, (**< Arnie (End Element = Terminator). *) + ID_EXT = 8, (**< Extension Payload (ER only). *) + ID_SCAL = 9, (**< AAC scalable element (ER only). *) + (* USAC element IDs *) + ID_USAC_SCE = 0 + USAC_ID_BIT, (**< Single Channel Element. *) + ID_USAC_CPE = 1 + USAC_ID_BIT, (**< Channel Pair Element. *) + ID_USAC_LFE = 2 + USAC_ID_BIT, (**< LFE Channel Element. *) + ID_USAC_EXT = 3 + USAC_ID_BIT, (**< Extension Element. *) + ID_USAC_END = 4 + USAC_ID_BIT, (**< Arnie (End Element = Terminator). *) + ID_LAST + ); + + (* usacConfigExtType q.v. ISO/IEC DIS 23008-3 Table 52 and ISO/IEC FDIS + * 23003-3:2011(E) Table 74*) + CONFIG_EXT_ID = ( + (* USAC and RSVD60 3DA *) + ID_CONFIG_EXT_FILL = 0, + (* RSVD60 3DA *) + ID_CONFIG_EXT_DOWNMIX = 1, + ID_CONFIG_EXT_LOUDNESS_INFO = 2, + ID_CONFIG_EXT_AUDIOSCENE_INFO = 3, + ID_CONFIG_EXT_HOA_MATRIX = 4, + ID_CONFIG_EXT_SIG_GROUP_INFO = 6 + (* 5-127 => reserved for ISO use *) + (* > 128 => reserved for use outside of ISO scope *) + ); + + //IS_CHANNEL_ELEMENT(elementId) \ + // ((elementId) == ID_SCE || (elementId) == ID_CPE || (elementId) == ID_LFE || \ + // (elementId) == ID_USAC_SCE || (elementId) == ID_USAC_CPE || \ + // (elementId) == ID_USAC_LFE) +function IS_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; + + //IS_MP4_CHANNEL_ELEMENT(elementId) \ + // ((elementId) == ID_SCE || (elementId) == ID_CPE || (elementId) == ID_LFE) +function IS_MP4_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; + +const + EXT_ID_BITS = 4; (**< Size in bits of extension payload type tags. *) + +type + (** Extension payload types. *) + EXT_PAYLOAD_TYPE = ( + EXT_FIL = $00, + EXT_FILL_DATA = $01, + EXT_DATA_ELEMENT = $02, + EXT_DATA_LENGTH = $03, + EXT_UNI_DRC = $04, + EXT_LDSAC_DATA = $09, + EXT_SAOC_DATA = $0a, + EXT_DYNAMIC_RANGE = $0b, + EXT_SAC_DATA = $0c, + EXT_SBR_DATA = $0d, + EXT_SBR_DATA_CRC = $0e + ); + + //IS_USAC_CHANNEL_ELEMENT(elementId) \ + // ((elementId) == ID_USAC_SCE || (elementId) == ID_USAC_CPE || \ + // (elementId) == ID_USAC_LFE) +function IS_USAC_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; + +type + (** MPEG-D USAC & RSVD60 3D audio Extension Element Types. *) + USAC_EXT_ELEMENT_TYPE = ( + (* usac *) + ID_EXT_ELE_FILL = $00, + ID_EXT_ELE_MPEGS = $01, + ID_EXT_ELE_SAOC = $02, + ID_EXT_ELE_AUDIOPREROLL = $03, + ID_EXT_ELE_UNI_DRC = $04, + (* rsv603da *) + ID_EXT_ELE_OBJ_METADATA = $05, + ID_EXT_ELE_SAOC_3D = $06, + ID_EXT_ELE_HOA = $07, + ID_EXT_ELE_FMT_CNVRTR = $08, + ID_EXT_ELE_MCT = $09, + ID_EXT_ELE_ENHANCED_OBJ_METADATA = $0d, + (* reserved for use outside of ISO scope *) + ID_EXT_ELE_VR_METADATA = $81, + ID_EXT_ELE_UNKNOWN = $FF + ); + + (** + * Proprietary raw packet file configuration data type identifier. + *) + TP_CONFIG_TYPE = ( + TC_NOTHING = 0, (* No configuration available -> in-band configuration. *) + TC_RAW_ADTS = 2, (* Transfer type is ADTS. *) + TC_RAW_LATM_MCP1 = 6, (* Transfer type is LATM with SMC present. *) + TC_RAW_SDC = 21 (* Configuration data field is Drm SDC. *) + + ); + +const + (* AAC capability flags *) + CAPF_AAC_LC = $00000001; (**< Support flag for AAC Low Complexity. *) + CAPF_ER_AAC_LD = $00000002; (**< Support flag for AAC Low Delay with Error Resilience tools. + *) + CAPF_ER_AAC_SCAL = $00000004; (**< Support flag for AAC Scalable. *) + CAPF_ER_AAC_LC = $00000008; (**< Support flag for AAC Low Complexity with Error Resilience + tools. *) + CAPF_AAC_480 = $00000010; (**< Support flag for AAC with 480 framelength. *) + CAPF_AAC_512 = $00000020; (**< Support flag for AAC with 512 framelength. *) + CAPF_AAC_960 = $00000040; (**< Support flag for AAC with 960 framelength. *) + CAPF_AAC_1024 = $00000080; (**< Support flag for AAC with 1024 framelength. *) + CAPF_AAC_HCR = $00000100; (**< Support flag for AAC with Huffman Codeword Reordering. *) + CAPF_AAC_VCB11 = $00000200; (**< Support flag for AAC Virtual Codebook 11. *) + CAPF_AAC_RVLC = $00000400; (**< Support flag for AAC Reversible Variable Length Coding. *) + CAPF_AAC_MPEG4 = $00000800; (**< Support flag for MPEG file format. *) + CAPF_AAC_DRC = $00001000; (**< Support flag for AAC Dynamic Range Control. *) + CAPF_AAC_CONCEALMENT = $00002000; (**< Support flag for AAC concealment. *) + CAPF_AAC_DRM_BSFORMAT = $00004000; (**< Support flag for AAC DRM bistream format. *) + CAPF_ER_AAC_ELD = $00008000; (**< Support flag for AAC Enhanced Low Delay with Error + Resilience tools. *) + CAPF_ER_AAC_BSAC = $00010000; (**< Support flag for AAC BSAC. *) + CAPF_AAC_ELD_DOWNSCALE = $00040000; (**< Support flag for AAC-ELD Downscaling *) + CAPF_AAC_USAC_LP = $00100000; (**< Support flag for USAC low power mode. *) + CAPF_AAC_USAC = $00200000; (**< Support flag for Unified Speech and Audio Coding (USAC). *) + CAPF_ER_AAC_ELDV2 = $00800000; (**< Support flag for AAC Enhanced Low Delay with MPS 212. *) + CAPF_AAC_UNIDRC = $01000000; (**< Support flag for MPEG-D Dynamic Range Control (uniDrc). *) + + (* Transport capability flags *) + CAPF_ADTS = $00000001; (**< Support flag for ADTS transport format. *) + CAPF_ADIF = $00000002; (**< Support flag for ADIF transport format. *) + CAPF_LATM = $00000004; (**< Support flag for LATM transport format. *) + CAPF_LOAS = $00000008; (**< Support flag for LOAS transport format. *) + CAPF_RAWPACKETS = $00000010; (**< Support flag for RAW PACKETS transport format. *) + CAPF_DRM = $00000020; (**< Support flag for DRM/DRM+ transport format. *) + CAPF_RSVD50 = $00000040; (**< Support flag for RSVD50 transport format *) + + (* SBR capability flags *) + CAPF_SBR_LP = $00000001; (**< Support flag for SBR Low Power mode. *) + CAPF_SBR_HQ = $00000002; (**< Support flag for SBR High Quality mode. *) + CAPF_SBR_DRM_BS = $00000004; (**< Support flag for *) + CAPF_SBR_CONCEALMENT = $00000008; (**< Support flag for SBR concealment. *) + CAPF_SBR_DRC = $00000010; (**< Support flag for SBR Dynamic Range Control. *) + CAPF_SBR_PS_MPEG = $00000020; (**< Support flag for MPEG Parametric Stereo. *) + CAPF_SBR_PS_DRM = $00000040; (**< Support flag for DRM Parametric Stereo. *) + CAPF_SBR_ELD_DOWNSCALE = $00000080; (**< Support flag for ELD reduced delay mode *) + CAPF_SBR_HBEHQ = $00000100; (**< Support flag for HQ HBE *) + + (* PCM utils capability flags *) + CAPF_DMX_BLIND = $00000001; (**< Support flag for blind downmixing. *) + CAPF_DMX_PCE = $00000002; (**< Support flag for guided downmix with data from MPEG-2/4 + Program Config Elements (PCE). *) + CAPF_DMX_ARIB = $00000004; (**< Support flag for PCE guided downmix with slightly different + equations and levels to fulfill ARIB standard. *) + CAPF_DMX_DVB = $00000008; (**< Support flag for guided downmix with data from DVB ancillary + data fields. *) + CAPF_DMX_CH_EXP = $00000010; (**< Support flag for simple upmixing by dublicating channels or + adding zero channels. *) + CAPF_DMX_6_CH = $00000020; (**< Support flag for 5.1 channel configuration (input and + output). *) + CAPF_DMX_8_CH = $00000040; (**< Support flag for 6 and 7.1 channel configurations (input and + output). *) + CAPF_DMX_24_CH = $00000080; (**< Support flag for 22.2 channel configuration (input and + output). *) + CAPF_LIMITER = $00002000; (**< Support flag for signal level limiting. + *) + + (* MPEG Surround capability flags *) + CAPF_MPS_STD = $00000001; (**< Support flag for MPEG Surround. *) + CAPF_MPS_LD = $00000002; (**< Support flag for Low Delay MPEG Surround. + *) + CAPF_MPS_USAC = $00000004; (**< Support flag for USAC MPEG Surround. *) + CAPF_MPS_HQ = $00000010; (**< Support flag indicating if high quality processing is + supported *) + CAPF_MPS_LP = $00000020; (**< Support flag indicating if partially complex (low power) + processing is supported *) + CAPF_MPS_BLIND = $00000040; (**< Support flag indicating if blind processing is supported *) + CAPF_MPS_BINAURAL = $00000080; (**< Support flag indicating if binaural output is possible *) + CAPF_MPS_2CH_OUT = $00000100; (**< Support flag indicating if 2ch output is possible *) + CAPF_MPS_6CH_OUT = $00000200; (**< Support flag indicating if 6ch output is possible *) + CAPF_MPS_8CH_OUT = $00000400; (**< Support flag indicating if 8ch output is possible *) + CAPF_MPS_1CH_IN = $00001000; (**< Support flag indicating if 1ch dmx input is possible *) + CAPF_MPS_2CH_IN = $00002000; (**< Support flag indicating if 2ch dmx input is possible *) + CAPF_MPS_6CH_IN = $00004000; (**< Support flag indicating if 5ch dmx input is possible *) + + (* \endcond *) + + + (* + * ############################################################################################## + * Library versioning + * ############################################################################################## + *) + + (** + * Convert each member of version numbers to one single numeric version + * representation. + * \param lev0 1st level of version number. + * \param lev1 2nd level of version number. + * \param lev2 3rd level of version number. + *) + //LIB_VERSION(lev0, lev1, lev2) \ + // ((lev0 << 24 & = $ff000000) | (lev1 << 16 & = $00ff0000) | \ + // (lev2 << 8 & = $0000ff00)) + +function LIB_VERSION(lev0: byte; lev1: byte; lev2: byte): integer; + + (** + * Build text string of version. + *) + //LIB_VERSION_STRING(info) \ + // FDKsprintf((info)->versionStr, "%d.%d.%d", (((info)->version >> 24) & = $ff), \ + // (((info)->version >> 16) & = $ff), \ + // (((info)->version >> 8) & = $ff)) +function LIB_VERSION_STRING(info: LIB_INFO): string; + + + (** Initialize library info. *) + //static FDK_AUDIO_INLINE void FDKinitLibInfo(LIB_INFO* info) { + // int i; + + // for (i = 0; i < FDK_MODULE_LAST; i++) { + // info[i].module_id = FDK_NONE; + // } + //} +procedure FDKinitLibInfo(var info: array of LIB_INFO); + + + (** Aquire supported features of library. *) + //static FDK_AUDIO_INLINE UINT + //FDKlibInfo_getCapabilities(const LIB_INFO* info, FDK_MODULE_ID module_id) { + // int i; + + // for (i = 0; i < FDK_MODULE_LAST; i++) { + // if (info[i].module_id == module_id) { + // return info[i].flags; + // } + // } + // return 0; + //} +function FDKlibInfo_getCapabilities(const info: array of LIB_INFO; module_id: FDK_MODULE_ID): cardinal; + + + (** Search for next free tab. *) + //static FDK_AUDIO_INLINE INT FDKlibInfo_lookup(const LIB_INFO* info, + // FDK_MODULE_ID module_id) { + // int i = -1; + + // for (i = 0; i < FDK_MODULE_LAST; i++) { + // if (info[i].module_id == module_id) return -1; + // if (info[i].module_id == FDK_NONE) break; + // } + // if (i == FDK_MODULE_LAST) return -1; + + // return i; + //} +function FDKlibInfo_lookup(const info: array of LIB_INFO; module_id: FDK_MODULE_ID): integer; + +type + (* + * ############################################################################################## + * Buffer description + * ############################################################################################## + *) + + (** + * I/O buffer descriptor. + *) + FDK_bufDescr = record + ppBase: Pointer; (*!< Pointer to an array containing buffer base addresses. + Set to NULL for buffer requirement info. *) + pBufSize: PCardinal; (*!< Pointer to an array containing the number of elements + that can be placed in the specific buffer. *) + pEleSize: PCardinal; (*!< Pointer to an array containing the element size for each + buffer in bytes. That is mostly the number returned by the + sizeof() operator for the data type used for the specific + buffer. *) + pBufType: PCardinal; (*!< Pointer to an array of bit fields containing a description + for each buffer. See XXX below for more details. *) + numBufs: cardinal; (*!< Total number of buffers. *) + end; + +(** + * Buffer type description field. + *) +const + FDK_BUF_TYPE_MASK_IO = (cardinal($03) shl 30); + FDK_BUF_TYPE_MASK_DESCR = (cardinal($3F) shl 16); + FDK_BUF_TYPE_MASK_ID = cardinal($FF); + + FDK_BUF_TYPE_INPUT = (cardinal($1) shl 30); + FDK_BUF_TYPE_OUTPUT = (cardinal($2) shl 30); + + FDK_BUF_TYPE_PCM_DATA = (cardinal($1) shl 16); + FDK_BUF_TYPE_ANC_DATA = (cardinal($2) shl 16); + FDK_BUF_TYPE_BS_DATA = (cardinal($4) shl 16); + +const + AACDECODER_LIB_VL0 = 3; + AACDECODER_LIB_VL1 = 2; + AACDECODER_LIB_VL2 = 0; + + +(** + * \brief AAC decoder error codes. + *) +type + AAC_DECODER_ERROR = ( + AAC_DEC_OK = + $0000, (*!< No error occurred. Output buffer is valid and error free. *) + AAC_DEC_OUT_OF_MEMORY = + $0002, (*!< Heap returned NULL pointer. Output buffer is invalid. *) + AAC_DEC_UNKNOWN = + $0005, (*!< Error condition is of unknown reason, or from a another + module. Output buffer is invalid. *) + + (* Synchronization errors. Output buffer is invalid. *) + aac_dec_sync_error_start = $1000, + AAC_DEC_TRANSPORT_SYNC_ERROR = $1001, (*!< The transport decoder had + synchronization problems. Do not + exit decoding. Just feed new + bitstream data. *) + AAC_DEC_NOT_ENOUGH_BITS = $1002, (*!< The input buffer ran out of bits. *) + aac_dec_sync_error_end = $1FFF, + + (* Initialization errors. Output buffer is invalid. *) + aac_dec_init_error_start = $2000, + AAC_DEC_INVALID_HANDLE = + $2001, (*!< The handle passed to the function call was invalid (NULL). *) + AAC_DEC_UNSUPPORTED_AOT = + $2002, (*!< The AOT found in the configuration is not supported. *) + AAC_DEC_UNSUPPORTED_FORMAT = + $2003, (*!< The bitstream format is not supported. *) + AAC_DEC_UNSUPPORTED_ER_FORMAT = + $2004, (*!< The error resilience tool format is not supported. *) + AAC_DEC_UNSUPPORTED_EPCONFIG = + $2005, (*!< The error protection format is not supported. *) + AAC_DEC_UNSUPPORTED_MULTILAYER = + $2006, (*!< More than one layer for AAC scalable is not supported. *) + AAC_DEC_UNSUPPORTED_CHANNELCONFIG = + $2007, (*!< The channel configuration (either number or arrangement) is + not supported. *) + AAC_DEC_UNSUPPORTED_SAMPLINGRATE = $2008, (*!< The sample rate specified in + the configuration is not + supported. *) + AAC_DEC_INVALID_SBR_CONFIG = + $2009, (*!< The SBR configuration is not supported. *) + AAC_DEC_SET_PARAM_FAIL = $200A, (*!< The parameter could not be set. Either + the value was out of range or the + parameter does not exist. *) + AAC_DEC_NEED_TO_RESTART = $200B, (*!< The decoder needs to be restarted, + since the required configuration change + cannot be performed. *) + AAC_DEC_OUTPUT_BUFFER_TOO_SMALL = + $200C, (*!< The provided output buffer is too small. *) + aac_dec_init_error_end = $2FFF, + + (* Decode errors. Output buffer is valid but concealed. *) + aac_dec_decode_error_start = $4000, + AAC_DEC_TRANSPORT_ERROR = + $4001, (*!< The transport decoder encountered an unexpected error. *) + AAC_DEC_PARSE_ERROR = $4002, (*!< Error while parsing the bitstream. Most + probably it is corrupted, or the system + crashed. *) + AAC_DEC_UNSUPPORTED_EXTENSION_PAYLOAD = + $4003, (*!< Error while parsing the extension payload of the bitstream. + The extension payload type found is not supported. *) + AAC_DEC_DECODE_FRAME_ERROR = $4004, (*!< The parsed bitstream value is out of + range. Most probably the bitstream is + corrupt, or the system crashed. *) + AAC_DEC_CRC_ERROR = $4005, (*!< The embedded CRC did not match. *) + AAC_DEC_INVALID_CODE_BOOK = $4006, (*!< An invalid codebook was signaled. + Most probably the bitstream is corrupt, + or the system crashed. *) + AAC_DEC_UNSUPPORTED_PREDICTION = + $4007, (*!< Predictor found, but not supported in the AAC Low Complexity + profile. Most probably the bitstream is corrupt, or has a wrong + format. *) + AAC_DEC_UNSUPPORTED_CCE = $4008, (*!< A CCE element was found which is not + supported. Most probably the bitstream is + corrupt, or has a wrong format. *) + AAC_DEC_UNSUPPORTED_LFE = $4009, (*!< A LFE element was found which is not + supported. Most probably the bitstream is + corrupt, or has a wrong format. *) + AAC_DEC_UNSUPPORTED_GAIN_CONTROL_DATA = + $400A, (*!< Gain control data found but not supported. Most probably the + bitstream is corrupt, or has a wrong format. *) + AAC_DEC_UNSUPPORTED_SBA = + $400B, (*!< SBA found, but currently not supported in the BSAC profile. + *) + AAC_DEC_TNS_READ_ERROR = $400C, (*!< Error while reading TNS data. Most + probably the bitstream is corrupt or the + system crashed. *) + AAC_DEC_RVLC_ERROR = + $400D, (*!< Error while decoding error resilient data. *) + aac_dec_decode_error_end = $4FFF, + (* Ancillary data errors. Output buffer is valid. *) + aac_dec_anc_data_error_start = $8000, + AAC_DEC_ANC_DATA_ERROR = + $8001, (*!< Non severe error concerning the ancillary data handling. *) + AAC_DEC_TOO_SMALL_ANC_BUFFER = $8002, (*!< The registered ancillary data + buffer is too small to receive the + parsed data. *) + AAC_DEC_TOO_MANY_ANC_ELEMENTS = $8003, (*!< More than the allowed number of + ancillary data elements should be + written to buffer. *) + aac_dec_anc_data_error_end = $8FFF + + ); + + (** Macro to identify initialization errors. Output buffer is invalid. *) + //#define IS_INIT_ERROR(err) \ + // ((((err) >= aac_dec_init_error_start) && ((err) <= aac_dec_init_error_end)) \ + // ? 1 \ + // : 0) + (** Macro to identify decode errors. Output buffer is valid but concealed. *) + //#define IS_DECODE_ERROR(err) \ + // ((((err) >= aac_dec_decode_error_start) && \ + // ((err) <= aac_dec_decode_error_end)) \ + // ? 1 \ + // : 0) +(** + * Macro to identify if the audio output buffer contains valid samples after + * calling aacDecoder_DecodeFrame(). Output buffer is valid but can be + * concealed. + *) + //#define IS_OUTPUT_VALID(err) (((err) == AAC_DEC_OK) || IS_DECODE_ERROR(err)) + +(*! \enum AAC_MD_PROFILE + * \brief The available metadata profiles which are mostly related to downmixing. The values define the arguments + * for the use with parameter ::AAC_METADATA_PROFILE. + *) + AAC_MD_PROFILE = ( + AAC_MD_PROFILE_MPEG_STANDARD = + 0, (*!< The standard profile creates a mixdown signal based on the + advanced downmix metadata (from a DSE). The equations and default + values are defined in ISO/IEC 14496:3 Ammendment 4. Any other + (legacy) downmix metadata will be ignored. No other parameter will + be modified. *) + AAC_MD_PROFILE_MPEG_LEGACY = + 1, (*!< This profile behaves identical to the standard profile if advanced + downmix metadata (from a DSE) is available. If not, the + matrix_mixdown information embedded in the program configuration + element (PCE) will be applied. If neither is the case, the module + creates a mixdown using the default coefficients as defined in + ISO/IEC 14496:3 AMD 4. The profile can be used to support legacy + digital TV (e.g. DVB) streams. *) + AAC_MD_PROFILE_MPEG_LEGACY_PRIO = + 2, (*!< Similar to the ::AAC_MD_PROFILE_MPEG_LEGACY profile but if both + the advanced (ISO/IEC 14496:3 AMD 4) and the legacy (PCE) MPEG + downmix metadata are available the latter will be applied. + *) + AAC_MD_PROFILE_ARIB_JAPAN = + 3 (*!< Downmix creation as described in ABNT NBR 15602-2. But if advanced + downmix metadata (ISO/IEC 14496:3 AMD 4) is available it will be + preferred because of the higher resolutions. In addition the + metadata expiry time will be set to the value defined in the ARIB + standard (see ::AAC_METADATA_EXPIRY_TIME). + *) + ); + +(*! \enum AAC_DRC_DEFAULT_PRESENTATION_MODE_OPTIONS + * \brief Options for handling of DRC parameters, if presentation mode is not indicated in bitstream + *) + AAC_DRC_DEFAULT_PRESENTATION_MODE_OPTIONS = ( + AAC_DRC_PARAMETER_HANDLING_DISABLED = -1, (*!< DRC parameter handling + disabled, all parameters are + applied as requested. *) + AAC_DRC_PARAMETER_HANDLING_ENABLED = + 0, (*!< Apply changes to requested DRC parameters to prevent clipping. *) + AAC_DRC_PRESENTATION_MODE_1_DEFAULT = + 1, (*!< Use DRC presentation mode 1 as default (e.g. for Nordig) *) + AAC_DRC_PRESENTATION_MODE_2_DEFAULT = + 2 (*!< Use DRC presentation mode 2 as default (e.g. for DTG DBook) *) + ); + +(** + * \brief AAC decoder setting parameters + *) + AACDEC_PARAM = ( + AAC_PCM_DUAL_CHANNEL_OUTPUT_MODE = + $0002, (*!< Defines how the decoder processes two channel signals: \n + 0: Leave both signals as they are (default). \n + 1: Create a dual mono output signal from channel 1. \n + 2: Create a dual mono output signal from channel 2. \n + 3: Create a dual mono output signal by mixing both channels + (L' = R' = 0.5*Ch1 + 0.5*Ch2). *) + AAC_PCM_OUTPUT_CHANNEL_MAPPING = + $0003, (*!< Output buffer channel ordering. 0: MPEG PCE style order, 1: + WAV file channel order (default). *) + AAC_PCM_LIMITER_ENABLE = + $0004, (*!< Enable signal level limiting. \n + -1: Auto-config. Enable limiter for all + non-lowdelay configurations by default. \n + 0: Disable limiter in general. \n + 1: Enable limiter always. + It is recommended to call the decoder + with a AACDEC_CLRHIST flag to reset all + states when the limiter switch is changed + explicitly. *) + AAC_PCM_LIMITER_ATTACK_TIME = $0005, (*!< Signal level limiting attack time + in ms. Default configuration is 15 + ms. Adjustable range from 1 ms to 15 + ms. *) + AAC_PCM_LIMITER_RELEAS_TIME = $0006, (*!< Signal level limiting release time + in ms. Default configuration is 50 + ms. Adjustable time must be larger + than 0 ms. *) + AAC_PCM_MIN_OUTPUT_CHANNELS = + $0011, (*!< Minimum number of PCM output channels. If higher than the + number of encoded audio channels, a simple channel extension is + applied (see note 4 for exceptions). \n -1, 0: Disable channel + extension feature. The decoder output contains the same number + of channels as the encoded bitstream. \n 1: This value is + currently needed only together with the mix-down feature. See + ::AAC_PCM_MAX_OUTPUT_CHANNELS and note 2 below. \n + 2: Encoded mono signals will be duplicated to achieve a + 2/0/0.0 channel output configuration. \n 6: The decoder + tries to reorder encoded signals with less than six channels to + achieve a 3/0/2.1 channel output signal. Missing channels will + be filled with a zero signal. If reordering is not possible the + empty channels will simply be appended. Only available if + instance is configured to support multichannel output. \n 8: + The decoder tries to reorder encoded signals with less than + eight channels to achieve a 3/0/4.1 channel output signal. + Missing channels will be filled with a zero signal. If + reordering is not possible the empty channels will simply be + appended. Only available if instance is configured to + support multichannel output.\n NOTE: \n + 1. The channel signaling (CStreamInfo::pChannelType and + CStreamInfo::pChannelIndices) will not be modified. Added empty + channels will be signaled with channel type + AUDIO_CHANNEL_TYPE::ACT_NONE. \n + 2. If the parameter value is greater than that of + ::AAC_PCM_MAX_OUTPUT_CHANNELS both will be set to the same + value. \n + 3. This parameter will be ignored if the number of encoded + audio channels is greater than 8. *) + AAC_PCM_MAX_OUTPUT_CHANNELS = + $0012, (*!< Maximum number of PCM output channels. If lower than the + number of encoded audio channels, downmixing is applied + accordingly (see note 5 for exceptions). If dedicated metadata + is available in the stream it will be used to achieve better + mixing results. \n -1, 0: Disable downmixing feature. The + decoder output contains the same number of channels as the + encoded bitstream. \n 1: All encoded audio configurations + with more than one channel will be mixed down to one mono + output signal. \n 2: The decoder performs a stereo mix-down + if the number encoded audio channels is greater than two. \n 6: + If the number of encoded audio channels is greater than six the + decoder performs a mix-down to meet the target output + configuration of 3/0/2.1 channels. Only available if instance + is configured to support multichannel output. \n 8: This + value is currently needed only together with the channel + extension feature. See ::AAC_PCM_MIN_OUTPUT_CHANNELS and note 2 + below. Only available if instance is configured to support + multichannel output. \n NOTE: \n + 1. Down-mixing of any seven or eight channel configuration + not defined in ISO/IEC 14496-3 PDAM 4 is not supported by this + software version. \n + 2. If the parameter value is greater than zero but smaller + than ::AAC_PCM_MIN_OUTPUT_CHANNELS both will be set to same + value. \n + 3. This parameter will be ignored if the number of encoded + audio channels is greater than 8. *) + AAC_METADATA_PROFILE = + $0020, (*!< See ::AAC_MD_PROFILE for all available values. *) + AAC_METADATA_EXPIRY_TIME = $0021, (*!< Defines the time in ms after which all + the bitstream associated meta-data (DRC, + downmix coefficients, ...) will be reset + to default if no update has been + received. Negative values disable the + feature. *) + + AAC_CONCEAL_METHOD = $0100, (*!< Error concealment: Processing method. \n + 0: Spectral muting. \n + 1: Noise substitution (see ::CONCEAL_NOISE). + \n 2: Energy interpolation (adds additional + signal delay of one frame, see + ::CONCEAL_INTER. only some AOTs are + supported). \n *) + AAC_DRC_BOOST_FACTOR = + $0200, (*!< MPEG-4 / MPEG-D Dynamic Range Control (DRC): Scaling factor + for boosting gain values. Defines how the boosting DRC factors + (conveyed in the bitstream) will be applied to the decoded + signal. The valid values range from 0 (don't apply boost + factors) to 127 (fully apply boost factors). Default value is 0 + for MPEG-4 DRC and 127 for MPEG-D DRC. *) + AAC_DRC_ATTENUATION_FACTOR = $0201, (*!< MPEG-4 / MPEG-D DRC: Scaling factor + for attenuating gain values. Same as + ::AAC_DRC_BOOST_FACTOR but for + attenuating DRC factors. *) + AAC_DRC_REFERENCE_LEVEL = + $0202, (*!< MPEG-4 / MPEG-D DRC: Target reference level / decoder target + loudness.\n Defines the level below full-scale (quantized in + steps of 0.25dB) to which the output audio signal will be + normalized to by the DRC module.\n The parameter controls + loudness normalization for both MPEG-4 DRC and MPEG-D DRC. The + valid values range from 40 (-10 dBFS) to 127 (-31.75 dBFS).\n + Example values:\n + 124 (-31 dBFS) for audio/video receivers (AVR) or other + devices allowing audio playback with high dynamic range,\n 96 + (-24 dBFS) for TV sets or equivalent devices (default),\n 64 + (-16 dBFS) for mobile devices where the dynamic range of audio + playback is restricted.\n Any value smaller than 0 switches off + loudness normalization and MPEG-4 DRC. *) + AAC_DRC_HEAVY_COMPRESSION = + $0203, (*!< MPEG-4 DRC: En-/Disable DVB specific heavy compression (aka + RF mode). If set to 1, the decoder will apply the compression + values from the DVB specific ancillary data field. At the same + time the MPEG-4 Dynamic Range Control tool will be disabled. By + default, heavy compression is disabled. *) + AAC_DRC_DEFAULT_PRESENTATION_MODE = + $0204, (*!< MPEG-4 DRC: Default presentation mode (DRC parameter + handling). \n Defines the handling of the DRC parameters boost + factor, attenuation factor and heavy compression, if no + presentation mode is indicated in the bitstream.\n For options, + see ::AAC_DRC_DEFAULT_PRESENTATION_MODE_OPTIONS.\n Default: + ::AAC_DRC_PARAMETER_HANDLING_DISABLED *) + AAC_DRC_ENC_TARGET_LEVEL = + $0205, (*!< MPEG-4 DRC: Encoder target level for light (i.e. not heavy) + compression.\n If known, this declares the target reference + level that was assumed at the encoder for calculation of + limiting gains. The valid values range from 0 (full-scale) to + 127 (31.75 dB below full-scale). This parameter is used only + with ::AAC_DRC_PARAMETER_HANDLING_ENABLED and ignored + otherwise.\n Default: 127 (worst-case assumption).\n *) + AAC_UNIDRC_SET_EFFECT = $0206, (*!< MPEG-D DRC: Request a DRC effect type for + selection of a DRC set.\n Supported indices + are:\n -1: DRC off. Completely disables + MPEG-D DRC.\n 0: None (default). Disables + MPEG-D DRC, but automatically enables DRC + if necessary to prevent clipping.\n 1: Late + night\n 2: Noisy environment\n 3: Limited + playback range\n 4: Low playback level\n 5: + Dialog enhancement\n 6: General + compression. Used for generally enabling + MPEG-D DRC without particular request.\n *) + AAC_UNIDRC_ALBUM_MODE = + $0207, (*!< MPEG-D DRC: Enable album mode. 0: Disabled (default), 1: + Enabled.\n Disabled album mode leads to application of gain + sequences for fading in and out, if provided in the + bitstream.\n Enabled album mode makes use of dedicated album + loudness information, if provided in the bitstream.\n *) + AAC_QMF_LOWPOWER = + $0300, (*!< Quadrature Mirror Filter (QMF) Bank processing mode. \n + -1: Use internal default. \n + 0: Use complex QMF data mode. \n + 1: Use real (low power) QMF data mode. \n *) + AAC_TPDEC_CLEAR_BUFFER = + $0603 (*!< Clear internal bit stream buffer of transport layers. The + decoder will start decoding at new data passed after this event + and any previous data is discarded. *) + + ); + +(** + * \brief This structure gives information about the currently decoded audio + * data. All fields are read-only. + *) + PCStreamInfo = ^TCStreamInfo; + + TCStreamInfo = record + (* These five members are the only really relevant ones for the user. *) + sampleRate: integer; (*!< The sample rate in Hz of the decoded PCM audio signal. *) + frameSize: integer; (*!< The frame size of the decoded PCM audio signal. \n + Typically this is: \n + 1024 or 960 for AAC-LC \n + 2048 or 1920 for HE-AAC (v2) \n + 512 or 480 for AAC-LD and AAC-ELD \n + 768, 1024, 2048 or 4096 for USAC *) + numChannels: integer; (*!< The number of output audio channels before the rendering + module, i.e. the original channel configuration. *) + pChannelType: array of AUDIO_CHANNEL_TYPE; (*!< Audio channel type of each output audio channel. *) + pChannelIndices: array of byte; (*!< Audio channel index for each output audio + channel. See ISO/IEC 13818-7:2005(E), 8.5.3.2 + Explicit channel mapping using a + program_config_element() *) + (* Decoder internal members. *) + aacSampleRate: integer; (*!< Sampling rate in Hz without SBR (from configuration + info) divided by a (ELD) downscale factor if present. *) + profile: integer; (*!< MPEG-2 profile (from file header) (-1: not applicable (e. g. + MPEG-4)). *) + aot: AUDIO_OBJECT_TYPE; (*!< Audio Object Type (from ASC): is set to the appropriate value + for MPEG-2 bitstreams (e. g. 2 for AAC-LC). *) + channelConfig: integer; (*!< Channel configuration (0: PCE defined, 1: mono, 2: + stereo, ... *) + bitRate: integer; (*!< Instantaneous bit rate. *) + aacSamplesPerFrame: integer; (*!< Samples per frame for the AAC core (from ASC) + divided by a (ELD) downscale factor if present. \n + Typically this is (with a downscale factor of 1): + \n 1024 or 960 for AAC-LC \n 512 or 480 for + AAC-LD and AAC-ELD *) + aacNumChannels: integer; (*!< The number of audio channels after AAC core + processing (before PS or MPS processing). CAUTION: This + are not the final number of output channels! *) + extAot: AUDIO_OBJECT_TYPE; (*!< Extension Audio Object Type (from ASC) *) + extSamplingRate: integer; (*!< Extension sampling rate in Hz (from ASC) divided by + a (ELD) downscale factor if present. *) + + outputDelay: cardinal; (*!< The number of samples the output is additionally + delayed by.the decoder. *) + flags: cardinal; (*!< Copy of internal flags. Only to be written by the decoder, + and only to be read externally. *) + + epConfig: shortint; (*!< epConfig level (from ASC): only level 0 supported, -1 + means no ER (e. g. AOT=2, MPEG-2 AAC, etc.) *) + (* Statistics *) + numLostAccessUnits: integer; (*!< This integer will reflect the estimated amount of + lost access units in case aacDecoder_DecodeFrame() + returns AAC_DEC_TRANSPORT_SYNC_ERROR. It will be + < 0 if the estimation failed. *) + + numTotalBytes: int64; (*!< This is the number of total bytes that have passed + through the decoder. *) + numBadBytes: int64; (*!< This is the number of total bytes that were considered + with errors from numTotalBytes. *) + numTotalAccessUnits: int64; (*!< This is the number of total access units that + have passed through the decoder. *) + numBadAccessUnits: int64; (*!< This is the number of total access units that + were considered with errors from numTotalBytes. *) + + (* Metadata *) + drcProgRefLev: shortint; (*!< DRC program reference level. Defines the reference + level below full-scale. It is quantized in steps of + 0.25dB. The valid values range from 0 (0 dBFS) to 127 + (-31.75 dBFS). It is used to reflect the average + loudness of the audio in LKFS according to ITU-R BS + 1770. If no level has been found in the bitstream the + value is -1. *) + drcPresMode: shortint; (*!< DRC presentation mode. According to ETSI TS 101 154, + this field indicates whether light (MPEG-4 Dynamic Range + Control tool) or heavy compression (DVB heavy + compression) dynamic range control shall take priority + on the outputs. For details, see ETSI TS 101 154, table + C.33. Possible values are: \n -1: No corresponding + metadata found in the bitstream \n 0: DRC presentation + mode not indicated \n 1: DRC presentation mode 1 \n 2: + DRC presentation mode 2 \n 3: Reserved *) + outputLoudness: integer; (*!< Audio output loudness in steps of -0.25 dB. Range: 0 + (0 dBFS) to 231 (-57.75 dBFS).\n A value of -1 + indicates that no loudness metadata is present.\n If + loudness normalization is active, the value corresponds + to the target loudness value set with + ::AAC_DRC_REFERENCE_LEVEL.\n If loudness normalization + is not active, the output loudness value corresponds to + the loudness metadata given in the bitstream.\n + Loudness metadata can originate from MPEG-4 DRC or + MPEG-D DRC. *) + + end; + + HANDLE_AACDECODER = ^AAC_DECODER_INSTANCE; + + AAC_DECODER_INSTANCE = record + HANDLE_AACDECODER: Pointer; (*!< Pointer to a AAC decoder instance. *) + end; + + (** + * \brief Initialize ancillary data buffer. + * + * \param self AAC decoder handle. + * \param buffer Pointer to (external) ancillary data buffer. + * \param size Size of the buffer pointed to by buffer. + * \return Error code. + *) +var + + aacDecoder_AncDataInit: function(self: HANDLE_AACDECODER; buffer: PByte; size: integer): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Get one ancillary data element. + * + * \param self AAC decoder handle. + * \param index Index of the ancillary data element to get. + * \param ptr Pointer to a buffer receiving a pointer to the requested + * ancillary data element. + * \param size Pointer to a buffer receiving the length of the requested + * ancillary data element. + * \return Error code. + *) + aacDecoder_AncDataGet: function(self: HANDLE_AACDECODER; index: integer; var ptr: PByte; var size: integer): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Set one single decoder parameter. + * + * \param self AAC decoder handle. + * \param param Parameter to be set. + * \param value Parameter value. + * \return Error code. + *) + aacDecoder_SetParam: function(const self: HANDLE_AACDECODER; const param: AACDEC_PARAM; const Value: integer): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Get free bytes inside decoder internal buffer. + * \param self Handle of AAC decoder instance. + * \param pFreeBytes Pointer to variable receiving amount of free bytes inside + * decoder internal buffer. + * \return Error code. + *) + aacDecoder_GetFreeBytes: function(const self: HANDLE_AACDECODER; var pFreeBytes: cardinal): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Open an AAC decoder instance. + * \param transportFmt The transport type to be used. + * \param nrOfLayers Number of transport layers. + * \return AAC decoder handle. + *) + aacDecoder_Open: function(transportFmt: TRANSPORT_TYPE; nrOfLayers: cardinal): HANDLE_AACDECODER; + cdecl; + +(** + * \brief Explicitly configure the decoder by passing a raw AudioSpecificConfig + * (ASC) or a StreamMuxConfig (SMC), contained in a binary buffer. This is + * required for MPEG-4 and Raw Packets file format bitstreams as well as for + * LATM bitstreams with no in-band SMC. If the transport format is LATM with or + * without LOAS, configuration is assumed to be an SMC, for all other file + * formats an ASC. + * + * \param self AAC decoder handle. + * \param conf Pointer to an unsigned char buffer containing the binary + * configuration buffer (either ASC or SMC). + * \param length Length of the configuration buffer in bytes. + * \return Error code. + *) + aacDecoder_ConfigRaw: function(self: HANDLE_AACDECODER; conf: Pointer; const length: PCardinal): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Submit raw ISO base media file format boxes to decoder for parsing + * (only some box types are recognized). + * + * \param self AAC decoder handle. + * \param buffer Pointer to an unsigned char buffer containing the binary box + * data (including size and type, can be a sequence of multiple boxes). + * \param length Length of the data in bytes. + * \return Error code. + *) + aacDecoder_RawISOBMFFData: function(self: HANDLE_AACDECODER; buffer: PByte; length: cardinal): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Fill AAC decoder's internal input buffer with bitstream data from the + * external input buffer. The function only copies such data as long as the + * decoder-internal input buffer is not full. So it grabs whatever it can from + * pBuffer and returns information (bytesValid) so that at a subsequent call of + * %aacDecoder_Fill(), the right position in pBuffer can be determined to grab + * the next data. + * + * \param self AAC decoder handle. + * \param pBuffer Pointer to external input buffer. + * \param bufferSize Size of external input buffer. This argument is required + * because decoder-internally we need the information to calculate the offset to + * pBuffer, where the next available data is, which is then + * fed into the decoder-internal buffer (as much as + * possible). Our example framework implementation fills the + * buffer at pBuffer again, once it contains no available valid bytes anymore + * (meaning bytesValid equal 0). + * \param bytesValid Number of bitstream bytes in the external bitstream buffer + * that have not yet been copied into the decoder's internal bitstream buffer by + * calling this function. The value is updated according to + * the amount of newly copied bytes. + * \return Error code. + *) + aacDecoder_Fill: function(self: HANDLE_AACDECODER; pBuffer: PByte; var bufferSize: cardinal; + var bytesValid: cardinal): AAC_DECODER_ERROR; + cdecl; + +const + (** Flag for aacDecoder_DecodeFrame(): Trigger the built-in error concealment + * module to generate a substitute signal for one lost frame. New input data + * will not be considered. + *) + AACDEC_CONCEAL = 1; + (** Flag for aacDecoder_DecodeFrame(): Flush all filterbanks to get all delayed + * audio without having new input data. Thus new input data will not be + * considered. + *) + AACDEC_FLUSH = 2; + (** Flag for aacDecoder_DecodeFrame(): Signal an input bit stream data + * discontinuity. Resync any internals as necessary. + *) + AACDEC_INTR = 4; + (** Flag for aacDecoder_DecodeFrame(): Clear all signal delay lines and history + * buffers. CAUTION: This can cause discontinuities in the output signal. + *) + AACDEC_CLRHIST = 8; + +(** + * \brief Decode one audio frame + * + * \param self AAC decoder handle. + * \param pTimeData Pointer to external output buffer where the decoded PCM + * samples will be stored into. + * \param timeDataSize Size of external output buffer. + * \param flags Bit field with flags for the decoder: \n + * (flags & AACDEC_CONCEAL) == 1: Do concealment. \n + * (flags & AACDEC_FLUSH) == 2: Discard input data. Flush + * filter banks (output delayed audio). \n (flags & AACDEC_INTR) == 4: Input + * data is discontinuous. Resynchronize any internals as + * necessary. \n (flags & AACDEC_CLRHIST) == 8: Clear all signal delay lines and + * history buffers. + * \return Error code. + *) +var + + aacDecoder_DecodeFrame: function(self: HANDLE_AACDECODER; pTimeData: PSmallInt; const timeDataSize: integer; + const flags: cardinal): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief De-allocate all resources of an AAC decoder instance. + * + * \param self AAC decoder handle. + * \return void. + *) + aacDecoder_Close: procedure(self: HANDLE_AACDECODER); + cdecl; + +(** + * \brief Get CStreamInfo handle from decoder. + * + * \param self AAC decoder handle. + * \return Reference to requested CStreamInfo. + *) + aacDecoder_GetStreamInfo: function(self: HANDLE_AACDECODER): PCStreamInfo; + cdecl; + +(** + * \brief Get decoder library info. + * + * \param info Pointer to an allocated LIB_INFO structure. + * \return 0 on success. + *) + aacDecoder_GetLibInfo: function(var info: array of LIB_INFO): integer; + cdecl; + +var + ad_Handle: TLibHandle = dynlibs.NilHandle; + {$if defined(cpu32) and defined(windows)} // try load dependency if not in /windows/system32/ + gc_Handle :TLibHandle=dynlibs.NilHandle; + {$endif} + +var + ReferenceCounter: cardinal = 0; + +function ad_IsLoaded: Boolean; inline; + +function ad_Load(const libfilename: string): Boolean; + +procedure ad_Unload(); + + +implementation + +function ad_IsLoaded: Boolean; +begin + Result := (ad_Handle <> dynlibs.NilHandle); +end; + +procedure ad_Unload; +begin + // < Reference counting + if ReferenceCounter > 0 then + Dec(ReferenceCounter); + if ReferenceCounter > 0 then + Exit; + // > + if ad_IsLoaded then + begin + DynLibs.UnloadLibrary(ad_Handle); + ad_Handle := DynLibs.NilHandle; + {$if defined(cpu32) and defined(windows)} + if gc_Handle <> DynLibs.NilHandle then begin + DynLibs.UnloadLibrary(gc_Handle); + gc_Handle:=DynLibs.NilHandle; + end; + {$endif} + end; +end; + +function ad_Load(const libfilename: string): Boolean; +var + thelib, thelibgcc: string; +begin + Result := False; + if ad_Handle <> 0 then + begin + Inc(ReferenceCounter); + Result := True; {is it already there ?} + end + else + begin + {$if defined(cpu32) and defined(windows)} + if Length(libfilename) = 0 then thelibgcc := 'libgcc_s_dw2-1.dll' else + thelibgcc := IncludeTrailingBackslash(ExtractFilePath(libfilename)) + 'libgcc_s_dw2-1.dll'; + gc_Handle:= DynLibs.SafeLoadLibrary(thelibgcc); + {$endif} + {go & load the library} + if Length(libfilename) = 0 then + thelib := libfdk_aac + else + thelib := libfilename; + ad_Handle := DynLibs.SafeLoadLibrary(thelib); // obtain the handle we want + if ad_Handle <> DynLibs.NilHandle then + begin {now we tie the functions to the VARs from above} + + Pointer(aacDecoder_Fill) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_Fill')); + Pointer(aacDecoder_DecodeFrame) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_DecodeFrame')); + Pointer(aacDecoder_GetStreamInfo) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_GetStreamInfo')); + Pointer(aacDecoder_Open) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_Open')); + Pointer(aacDecoder_SetParam) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_SetParam')); + Pointer(aacDecoder_Close) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_Close')); + + end; + Result := ad_IsLoaded; + ReferenceCounter := 1; + end; + +end; + +function TT_IS_PACKET(x: TRANSPORT_TYPE): Boolean; +begin + Result := ((x = TRANSPORT_TYPE.TT_MP4_RAW) or (x = TRANSPORT_TYPE.TT_DRM) or (x = TRANSPORT_TYPE.TT_MP4_LATM_MCP0) or (x = TRANSPORT_TYPE.TT_MP4_LATM_MCP1)); +end; + +function CAN_DO_PS(aot: AUDIO_OBJECT_TYPE): Boolean; +begin + Result := ((aot = AUDIO_OBJECT_TYPE.AOT_AAC_LC) or (aot = AUDIO_OBJECT_TYPE.AOT_SBR) or (aot = AUDIO_OBJECT_TYPE.AOT_PS) or (aot = AUDIO_OBJECT_TYPE.AOT_ER_BSAC) or (aot = AUDIO_OBJECT_TYPE.AOT_DRM_AAC)); +end; + +function IS_USAC(aot: AUDIO_OBJECT_TYPE): Boolean; +begin + Result := aot = AUDIO_OBJECT_TYPE.AOT_USAC; +end; + +function IS_LOWDELAY(aot: AUDIO_OBJECT_TYPE): Boolean; +begin + Result := (aot = AUDIO_OBJECT_TYPE.AOT_ER_AAC_LD) or (aot = AUDIO_OBJECT_TYPE.AOT_ER_AAC_ELD); +end; + +function IS_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; +begin + Result := (elementId = MP4_ELEMENT_ID.ID_SCE) or (elementId = MP4_ELEMENT_ID.ID_CPE) or (elementId = MP4_ELEMENT_ID.ID_LFE) or (elementId = MP4_ELEMENT_ID.ID_USAC_SCE) or + (elementId = MP4_ELEMENT_ID.ID_USAC_CPE) or (elementId = MP4_ELEMENT_ID.ID_USAC_LFE); +end; + +function IS_MP4_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; +begin + Result := (elementId = MP4_ELEMENT_ID.ID_SCE) or (elementId = MP4_ELEMENT_ID.ID_CPE) or (elementId = MP4_ELEMENT_ID.ID_LFE); +end; + +function IS_USAC_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; +begin + Result := (elementId = MP4_ELEMENT_ID.ID_USAC_SCE) or (elementId = MP4_ELEMENT_ID.ID_USAC_CPE) or (elementId = MP4_ELEMENT_ID.ID_USAC_LFE); +end; + +function LIB_VERSION(lev0: byte; lev1: byte; lev2: byte): integer; +begin + Result := (lev0 shl 24) or (lev1 shl 16) or (lev2 shl 8); +end; + +function LIB_VERSION_STRING(info: LIB_INFO): string; +begin + Result := string(info.versionStr); + if info.versionStr = '' then + Result := Format('%d.%d.%d', [(info.versionStr), ((info.version shr 24) and $ff), ((info.version shr 16) and $ff), ((info.version shr 8) and $ff)]); +end; + +(** Initialize library info. *) +procedure FDKinitLibInfo(var info: array of LIB_INFO); +var + i: integer; +begin + for i := 0 to integer(FDK_MODULE_ID.FDK_MODULE_LAST) - 1 do + info[i].module_id := FDK_MODULE_ID.FDK_NONE; +end; + +(** Aquire supported features of library. *) +function FDKlibInfo_getCapabilities(const info: array of LIB_INFO; module_id: FDK_MODULE_ID): cardinal; +var + i: integer; +begin + Result := 0; + for i := 0 to integer(FDK_MODULE_ID.FDK_MODULE_LAST) - 1 do + if Info[i].module_id = module_id then + begin + Result := Info[i].flags; + break; + end; +end; + + +function FDKlibInfo_lookup(const info: array of LIB_INFO; module_id: FDK_MODULE_ID): integer; +var + i: integer; +begin + Result := -1; + for i := 0 to integer(FDK_MODULE_ID.FDK_MODULE_LAST) - 1 do + if Info[i].module_id = module_id then + begin + Result := -1; + Exit; + end + else if Info[i].module_id = FDK_MODULE_ID.FDK_NONE then + begin + Result := i; + Exit; + end + else if i = integer(FDK_MODULE_ID.FDK_MODULE_LAST) then + begin + Result := -1; + Exit; + end; +end; + + +end. + diff --git a/UOS/examples/uos_flat.pas b/UOS/examples/uos_flat.pas new file mode 100644 index 0000000..d69872e --- /dev/null +++ b/UOS/examples/uos_flat.pas @@ -0,0 +1,2547 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{ License : modified LGPL. + Fred van Stappen fiens@hotmail.com } + +// This is the "Flat Layer" of uos => for universal methods. + +unit uos_flat; + +{$mode objfpc}{$H+}{$inline on} +{$PACKRECORDS C} + +// For custom configuration of directive to compiler ---> uos_define.inc +{$I uos_define.inc} + +interface + +uses + + {$IF DEFINED(Java)} + uos_jni, + {$endif} + + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + fpg_base, + {$ENDIF} + + ctypes, classes, math, SysUtils, uos; + + {$IF DEFINED(bs2b)} + const + BS2B_HIGH_CLEVEL = (CInt32(700)) or ((CInt32(30)) shl 16); + BS2B_MIDDLE_CLEVEL = (CInt32(500)) or ((CInt32(45)) shl 16); + BS2B_LOW_CLEVEL = (CInt32(360)) or ((CInt32(60)) shl 16); + { Easy crossfeed levels (Obsolete) } + BS2B_HIGH_ECLEVEL = (CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_MIDDLE_ECLEVEL = (CInt32(500)) or ((CInt32(72)) shl 16); + BS2B_LOW_ECLEVEL = (CInt32(360)) or ((CInt32(84)) shl 16); + BS2B_DEFAULT_CLEVEL = (CInt32(700)) or ((CInt32(45)) shl 16); + BS2B_CMOY_CLEVEL =(CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_JMEIER_CLEVEL = (CInt32(650)) or ((CInt32(95)) shl 16); + {$endif} + +{$IF DEFINED(synthesizer)} +const +// musical note ==> frequency in hertz +// Latin: Do, Ré, Mi, Fa, Sol, La, Si +// Dièse = _d example la0_d +la0 = 55.0; +la0_d = 58.3; +si0 = 61.7; +do0 = 65.4; +do0_d = 69.3; +re0 = 73.4; +re0_d =77.8; +mi0 =82.4; +fa0 = 87.3; +fa0_d = 92.5; +sol0 = 98.0; +sol0_d = 103.8; +la1 = 110.0; +la1_d = 116.5; +si1 = 123.5; +do1 = 130.8; +do1_d = 138.6; +re1 = 146.8; +re1_d =155.6; +mi1 =164.8; +fa1 = 174.6; +fa1_d = 185.0; +sol1 = 196.0; +sol1_d = 207.7; +la2 = 220.0; +la2_d = 233.1; +si2 = 2246.9; +do2 = 261.6; +do2_d = 277.2; +re2 = 293.7; +re2_d =311.1; +mi2 =329.6; +fa2 = 349.2; +fa2_d = 370.0; +sol2 = 392.0; +sol2_d = 415.3; +la3 = 440.0; +la3_d = 466.2; +si3 = 493.9; +do3 = 523.3; +do3_d = 554.4; +re3 = 587.3; +re3_d = 622.3; +mi3 = 659.3; +fa3 = 698.5; +fa3_d = 740.0; +sol3 = 784.0; +sol3_d = 830.6; +la4 = 880.0; +la4_d = 932.4; +si4 = 987.8; +do4 = 1046.6; +do4_d = 1108.8; +re4 = 1174.6; +re4_d = 1244.6; +mi4 = 1318.6; +fa4 = 1397.0; +fa4_d = 1480.0; +sol4 = 1568.0; +sol4_d = 1661.2; +la5 = 1760.0; + +// English musique note +// A, B, C, D, E, F, G +a0 = 55.0; +a0_s = 58.3; +b0 = 61.7; +c0 = 65.4; +c0_s = 69.3; +d0 = 73.4; +d0_s =77.8; +e0 =82.4; +f0 = 87.3; +f0_s = 92.5; +g0 = 98.0; +g0_s = 103.8; +a1 = 110.0; +a1_s = 116.5; +b1 = 123.5; +c1 = 130.8; +c1_s = 138.6; +d1 = 146.8; +d1_s =155.6; +e1 =164.8; +f1 = 174.6; +f1_s = 185.0; +g1 = 196.0; +g1_s = 207.7; +a2 = 220.0; +a2_s = 233.1; +b2 = 2246.9; +c2 = 261.6; +c2_s = 277.2; +d2 = 293.7; +d2_s =311.1; +e2 =329.6; +f2 = 349.2; +f2_s = 370.0; +g2 = 392.0; +g2_s = 415.3; +a3 = 440.0; +a3_s = 466.2; +b3 = 493.9; +c3 = 523.3; +c3_s = 554.4; +d3 = 587.3; +d3_s = 622.3; +e3 = 659.3; +f3 = 698.5; +f3_s = 740.0; +g3 = 784.0; +g3_s = 830.6; +a4 = 880.0; +a4_s = 932.4; +b4 = 987.8; +c4 = 1046.6; +c4_s = 1108.8; +d4 = 1174.6; +d4_s = 1244.6; +e4 = 1318.6; +f4 = 1397.0; +f4_s = 1480.0; +g4 = 1568.0; +g4_s = 1661.2; +a5 = 1760.0; +{$endif} + + type + TDArFloat = array of cfloat; + + TDArShort = array of cInt16; + TDArLong = array of cInt32; + + TDArPARFloat = array of TDArFloat; + TDArIARFloat = array of TDArPARFloat; + + PDArFloat = ^TDArFloat; + PDArShort = ^TDArShort; + PDArLong = ^TDArLong; + + type + + {$if DEFINED(java)} + TProc = JMethodID ; + {$else} + TProc = procedure of object; + {$endif} + + type + {$if not defined(fs32bit)} + Tcount_t = cint64; { used for file sizes } + {$else} + Tcount_t = cint; + {$endif} + PMemoryStream = ^TmemoryStream; + + type + TuosF_Data = Tuos_Data; + TuosF_FFT = Tuos_FFT ; + TuosF_BufferInfos = Tuos_BufferInfos; + +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + const + MSG_CUSTOM1 = FPGM_USER + 1; + {$ENDIF} + +// General public procedure/function (accessible for library uos too) + +function uos_GetInfoLibraries() : PChar ; + +function uos_Int16ToFloat32(Inbuf: TDArFloat): TDArFloat; +// convert buffer int16 into float32. + +{$IF DEFINED(portaudio)} +procedure uos_GetInfoDevice(); + +procedure uos_UpdateDevice(); + +function uos_GetInfoDeviceStr() : PChar ; +{$endif} + +function uos_TestLoadLibrary(Filename: Pchar): boolean; +// test a library to check if it can be loaded; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName, fdkaacFilename : PChar) : cint32; +// load libraries... if libraryfilename = nil => do not load it... You may load what and when you want... +// PortAudio => needed for dealing with audio-device input/output +// SndFile => needed for dealing with ogg, vorbis, flac and wav audio-files +// Mpg123 => needed for dealing with mp* audio-files +// Mp4ff and Faad => needed for dealing with acc, m4a audio-files +// opusfile => needed for dealing with opus audio-files +// XMPFileName => needed for dealing with mod files +// fdkaacFilename => needed for dealing with webstreamm aac files. + +// If you want to load libraries from system, replace it by "'system'" +// If some libraries are not needed, replace it by "nil", + +// for example : uos_loadlib('system', SndFileFileName, 'system', nil, nil, nil, OpusFileFileName, nil, nil) + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName : PChar) : cint32; +// The same but without fdkaac. (for compatibility with previous version) + +function uos_LoadLib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName: PChar) : cint32; +// The same but without fdkaac and libxmp. (for compatibility with previous version) + +procedure uos_unloadlib(); +// Unload all libraries... +procedure uos_free(); +// Free uos; +// To use when program terminate. Do not forget to call it before close application... + +procedure uos_unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: boolean); +// Custom Unload libraries... if true, then unload the library. You may unload what and when you want... + +function uos_loadPlugin(PluginName, PluginFilename: PChar) : cint32; +// load plugin... + +{$IF DEFINED(shout)} +function uos_LoadServerLib(ShoutFileName, OpusFileName : PChar) : cint32; +// Shout => needed for dealing with IceCast server +// Opus => needed for dealing with encoding opus stream + +procedure uos_unloadServerLib(); +// Unload server libraries... Do not forget to call it before close application... +{$endif} + +procedure uos_UnloadPlugin(PluginName: PChar); + +// PlayerIndex : from 0 to what your computer can do ! (depends of ram, cpu, soundcard, ...) +// If PlayerIndex already exists, it will be overwriten... +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} +function uos_CreatePlayer(PlayerIndex: cint32; AParent: TObject) : boolean; +{$else} +function uos_CreatePlayer(PlayerIndex: cint32): boolean; +{$endif} + +{$IF DEFINED(portaudio)} +function uos_AddIntoDevOut(PlayerIndex: cint32): cint32; + +// Add a Output into Device Output with custom parameters + function uos_AddIntoDevOut(PlayerIndex: cint32; Device: cint32; Latency: CDouble; + SampleRate: CDouble; Channels: cint32; SampleFormat: cint32 ; + FramesCount: cint32 ; ChunkCount: cint32): cint32; +// 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 (= 65536) +// ChunkCount : default : -1 (= 512) +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoDevOut(-1,-1,-1,-1,0,-1,-1); + {$endif} + +function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a input from audio file with default parameters + +function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32): cint32; +// Add a input from audio file with custom parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of audio file +// 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 (65536) +// result : Input Index in array -1 = error +// example : InputIndex1 := uos_AddFromFile(0, edit5.Text,-1,0); + +function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat) : cint32; +// Add a Output into memory buffer +// outmemory : pointer of buffer to use to store memory. +// example : OutputIndex1 := uos_AddIntoMemoryBuffer(0, pointer(bufmemory)); + +function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat; SampleRate: CDouble; SampleFormat: LongInt; + Channels: LongInt; FramesCount: LongInt): LongInt; +// Add a Output into memory buffer with custom parameters +// outmemory : pointer of buffer to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (0:float32) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 1024 * 2) + +function uos_AddIntoMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; + SampleRate: CDouble; SampleFormat: LongInt ; Channels: LongInt; FramesCount: LongInt; Audioformat: cint32): LongInt; +// Add a Output into TMemoryStream +// MemoryStream : the TMemoryStream to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 4096) +// AudioFormat : default : -1 (wav) (0:wav, 1:ogg); + +function uos_AddFromMemoryBuffer(PlayerIndex: cint32; MemoryBuffer: TDArFloat; Bufferinfos: Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// Add a input from memory buffer with custom parameters +// MemoryBuffer : the buffer +// Bufferinfos : infos of the buffer +// 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 ';')// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)// SampleRate : delault : -1 (44100)// FramesCount : default : -1 (4096) +// FramesCount : default : -1 (65536 div Channels) +// result : Input Index in array -1 = error +// example : InputIndex1 := AddFromMemoryBuffer(mybuffer, buffinfos,-1,1024); + +function uos_AddFromMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; + TypeAudio: cint32; OutputIndex: cint32; SampleFormat: cint32 ; FramesCount: cint32): cint32; +// 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 := AddFromMemoryStream(0, mymemorystream,-1,-1,0,1024); + +function uos_AddFromMemoryStreamDec(PlayerIndex: cint32; var MemoryStream: TMemoryStream; var Bufferinfos: Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// MemoryStream : Memory-stream of decoded audio (like created by AddIntoMemoryStream) +// Bufferinfos : infos of the Memory-stream +// 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 ';') +// FramesCount : default : -1 (4096) +// result : Input Index in array -1 = error + +function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a input from audio file with default parameters + +function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ; numbuf : cint): cint32; +// Add a input from audio file and store it into memory with custom parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of audio file +// 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 (65536) +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) +// result : Input Index in array -1 = error +// example : InputIndex1 := uos_AddFromFile(0, edit5.Text,-1,0,-1); + + {$IF DEFINED(shout)} +function uos_AddIntoIceServer(PlayerIndex: cint32; SampleRate : CDouble; Channels: cint; SampleFormat: cint; + EncodeType: cint; Port: cint; Host: pchar; User: pchar; Password: pchar; MountFile :pchar): cint32; +// Add a Output into a IceCast server for audio-web-streaming +// SampleRate : delault : -1 (48100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// EncodeType : default : -1 (0:Music) (0: Music, 1:Voice) +// SampleFormat : -1 default : float32 : (0:float32, 1:Int16) +// Port : default : -1 (= 8000) +// Host : default : 'def' (= '127.0.0.1') +// User : default : 'def' (= 'source') +// Password : default : 'def' (= 'hackme') +// MountFile : default : 'def' (= '/example.opus') +// result : Output Index in array -1 = error + {$endif} + +{$IF DEFINED(webstream)} +function uos_AddFromURL(PlayerIndex: cint32; URL: PChar): cint32; +// Add a Input from Audio URL with default parameters + +function uos_AddFromURL(PlayerIndex: cint32; URL: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32; AudioFormat: cint32 ; ICYon : boolean): cint32; +// Add a Input from Audio URL with custom parameters +// URL : URL of audio file +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output +// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : default : -1 (4096) +// AudioFormat : default : -1 (mp3) (0: mp3, 1: opus) +// example : InputIndex := AddFromURL(0,'http://someserver/somesound.mp3',-1,-1,-1,-1); +{$ENDIF} + +function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; + Channels: cint32; SampleFormat: cint32 ; FramesCount: cint32 ; FileFormat: cint32): cint32; +// Add a Output into audio wav file with custom parameters from TFileStream +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : default : -1 (2:Int16) (1:Int32, 2:Int16) +// FramesCount : default : -1 (= 65536) +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg); +// result :Output Index in array -1 = error +// example : OutputIndex1 := uos_AddIntoFile(0,edit5.Text,-1,-1, 0, 1); + +function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a Output into audio wav file with Default parameters from TFileStream +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file + +function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; + Channels: LongInt; SampleFormat: LongInt ; FramesCount: LongInt; FileFormat: cint32): LongInt; + // Add a Output into audio wav file with Custom parameters from TMemoryStream +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : -1 default : Int16 : (1:Int32, 2:Int16) +// FramesCount : -1 default : 65536 div channels +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom); +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoFileFromMem(0, edit5.Text,-1,-1,0, -1); + +function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a Output into audio wav file with Default parameters from TMemoryStream +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file + +{$IF DEFINED(portaudio)} +function uos_AddFromDevIn(PlayerIndex: cint32; Device: cint32; Latency: CDouble; + SampleRate: CDouble; OutputIndex: cint32; + SampleFormat: cint32; FramesCount : cint32; ChunkCount: cint32): cint32; +// Add a Input from Device Input with custom parameters +// PlayerIndex : Index of a existing Player +// Device ( -1 is default Input device ) +// Latency ( -1 is latency suggested ) +// SampleRate : delault : -1 (44100) +// 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) +// ChunkCount : default : -1 (= 512) +// result : Output Index in array +// example : OutputIndex1 := uos_AddFromDevIn(0,-1,-1,-1,-1,-1,-1); + +function uos_AddFromDevIn(PlayerIndex: cint32): cint32; +// Add a Input from Device Input with default parameters +// PlayerIndex : Index of a existing Player +{$endif} + +function uos_AddFromEndlessMuted(PlayerIndex: cint32; Channels : cint32; FramesCount: cint32): cint32; +// Add a input from Endless Muted dummy sine wav +// FramesCount = FramesCount of input-to-follow +// Channels = Channels of input-to-follow. + +{$IF DEFINED(synthesizer)} +function uos_AddFromSynth(PlayerIndex: cint32; Channels: integer; WaveTypeL, WaveTypeR: shortint; + FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; + duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32; + OutputIndex: cint32; SampleFormat: cint32 ; SampleRate: CDouble ; 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, 2= triangle, 3=sawtooth used for mono and stereo) +// WaveTypeR: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth 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 + +procedure uos_InputSetSynth(PlayerIndex: cint32; InputIndex: cint32; WaveTypeL, WaveTypeR: shortint; + FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; duration: cint32; + NbHarmonic: cint32; EvenHarmonics: cint32; Enable: boolean); +// InputIndex: one existing input index +// WaveTypeL: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth used for mono and stereo) +// WaveTypeR: default: -1 (0) (00 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth 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 ; +{$endif} + +procedure uos_BeginProc(PlayerIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute at begining, before loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_EndProc(PlayerIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute at end, after loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_EndProcOnly(PlayerIndex: cint32; Proc: TProconly); +// Assign the procedure (not of object) to execute at end, after loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_LoopBeginProc(PlayerIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute at begin of loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_LoopEndProc(PlayerIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute at end of loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_LoopProcIn(PlayerIndex: cint32; InIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute inside the loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_LoopProcOut(PlayerIndex: cint32; OutIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute inside the loop +// PlayerIndex : Index of a existing Player +// OutIndex : Index of a existing Output + +{$IF DEFINED(noiseremoval)} +procedure uos_InputAddDSPNoiseRemoval(PlayerIndex: cint32; InputIndex: cint32); + +procedure uos_InputSetDSPNoiseRemoval(PlayerIndex: cint32; InputIndex: cint32; Enable: boolean); + +procedure uos_OutputAddDSPNoiseRemoval(PlayerIndex: cint32; OutputIndex: cint32); + +procedure uos_OutputSetDSPNoiseRemoval(PlayerIndex: cint32; OutputIndex: cint32; Enable: boolean); +{$endif} + +function uos_InputAddDSP1ChanTo2Chan(PlayerIndex: cint32; InputIndex: cint32): cint32; +// Convert mono 1 channel input to stereo 2 channels input. +// Works only if the input is mono 1 channel othewise stereo 2 chan is keeped. +// InputIndex : InputIndex of a existing Input +// result : index of DSPIn in array +// example DSPIndex1 := InputAddDSP1ChanTo2Chan(InputIndex1); + +function uos_InputAddDSPVolume(PlayerIndex: cint32; InputIndex: cint32; VolLeft: double; + VolRight: double) : cint32 ; +// DSP Volume changer +// PlayerIndex : Index of a existing Player +// InputIndex : InputIndex of a existing Input +// VolLeft : Left volume +// VolRight : Right volume + // result : index of DSPIn in array +// example uos_InputAddDSPVolume(0,InputIndex1,1,1); + +procedure uos_OutputAddDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; VolLeft: double; + VolRight: double) ; +// DSP Volume changer +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// VolLeft : Left volume +// VolRight : Right volume +// result : -1 nothing created, otherwise index of DSPIn in array +// example DSPIndex1 := uos_OutputAddDSPVolume(0,oututIndex1,1,1); + +procedure uos_InputSetDSPVolume(PlayerIndex: cint32; InputIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); +// InputIndex : InputIndex of a existing Input +// PlayerIndex : Index of a existing Player +// VolLeft : Left volume +// VolRight : Right volume +// Enable : Enabled +// example uos_InputSetDSPVolume(0,InputIndex1,DSPIndex1,1,0.8,True); + +procedure uos_OutputSetDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); +// OutputIndex : OutputIndex of a existing Output +// PlayerIndex : Index of a existing Player +// VolLeft : Left volume +// VolRight : Right volume +// Enable : Enabled +// example uos_OutputSetDSPVolume(0,outputIndex1,DSPIndex1,1,0.8,True); + +function uos_InputAddDSP(PlayerIndex: cint32; InputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; Proc: TProc): cint32; +// add a DSP procedure for input +// PlayerIndex : Index of a existing Player +// InputIndex : Input Index of a existing input +// BeforeFunc : Function to do before the buffer is filled +// AfterFunc : Function to do after the buffer is filled +// EndedFunc : Function to do at end of thread +// LoopProc : external procedure of object to synchronize after DSP done +// result : -1 nothing created, otherwise index of DSPin in array (DSPinIndex) +// example : DSPinIndex1 := uos_InputAddDSP(0,InputIndex1,@beforereverse,@afterreverse,nil); + +procedure uos_InputSetDSP(PlayerIndex: cint32; InputIndex: cint32; DSPinIndex: cint32; Enable: boolean); +// PlayerIndex : Index of a existing Player +// InputIndex : Input Index of a existing input +// DSPIndexIn : DSP Index of a existing DSP In +// Enable : DSP enabled +// example : uos_InputSetDSP(0,InputIndex1,DSPinIndex1,True); + +function uos_OutputAddDSP(PlayerIndex: cint32; OutputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; Proc: TProc): cint32; +// usefull if multi output +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// BeforeFunc : Function to do before the buffer is filled +// AfterFunc : Function to do after the buffer is filled just before to give to output +// EndedFunc : Function to do at end of thread +// LoopProc : external procedure of object to synchronize after DSP done +// result : index of DSPout in array +// example :DSPoutIndex1 := uos_OutputAddDSP(0,OutputIndex1,nil,@volumeproc,nil,nil); + +procedure uos_OutputSetDSP(PlayerIndex: cint32; OutputIndex: cint32; DSPoutIndex: cint32; Enable: boolean); +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// DSPoutIndex : DSPoutIndex of existing DSPout +// Enable : DSP enabled +// example : uos_OutputSetDSP(0,OutputIndex1,DSPoutIndex1,True); + +function uos_InputAddFilter(PlayerIndex: cint32; InputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// 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 ) +// LoopProc : external procedure of object to synchronize after DSP done +// result : index of DSPIn in array + +function uos_InputGetBuffer(PlayerIndex: cint32; InputIndex: cint32): TDArFloat; +// Get current buffer + +procedure uos_InputSetFilter(PlayerIndex: cint32; InputIndex: cint32; FilterIndex: cint32; TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// 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 + +function uos_OutputAddFilter(PlayerIndex: cint32; OutputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// Output : InputIndex of a existing Output +// 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 +// result : index of DSPIn in array + +procedure uos_OutputSetFilter(PlayerIndex: cint32; OutputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// OuputIndex : InputIndex of a existing Output +// 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 + +function uos_AddPlugin(PlayerIndex: cint32; PlugName: PChar; SampleRate: CDouble; + Channels: cint32): cint32 ; +// Add a plugin , result is PluginIndex +// PlayerIndex : Index of a existing Player +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// 'soundtouch' and 'bs2b' PlugName is registred. + +{$IF DEFINED(soundtouch)} +procedure uos_SetPluginSoundTouch(PlayerIndex: cint32; PluginIndex: cint32; Tempo: cfloat; + Pitch: cfloat; Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +// PlayerIndex : Index of a existing Player + +procedure uos_SetPluginGetBPM(PlayerIndex: cint32; PluginIndex: cint32; numofframes: integer; loop : boolean; + Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +// numofframes: number of frames to analyse (-1 = 512 x frames) +// loop: do new detection after previous. +{$endif} + +{$IF DEFINED(bs2b)} +procedure uos_SetPluginBs2b(PlayerIndex: cint32; PluginIndex: cint32; + level: CInt32; fcut: CInt32; feed: CInt32; Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +{$endif} + +function uos_GetStatus(PlayerIndex: cint32) : cint32 ; +// Get the status of the player : -1 => error, 0 => has stopped, 1 => is running, 2 => is paused. + +procedure uos_InputSeek(PlayerIndex: cint32; InputIndex: cint32; pos: Tcount_t); +// change position in sample + +procedure uos_InputSeekSeconds(PlayerIndex: cint32; InputIndex: cint32; pos: cfloat); +// change position in seconds + +procedure uos_InputSeekTime(PlayerIndex: cint32; InputIndex: cint32; pos: TTime); +// change position in time format + +procedure uos_InputSetEnable(PlayerIndex: cint32; InputIndex: cint32; enabled: boolean); +// set enable true or false (usefull for multi input) + +procedure uos_OutputSetEnable(PlayerIndex: cint32; OutputIndex: cint32; enabled: boolean); +// set enable true or false (usefull for multi outputput) + +function uos_InputLength(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : Length of Input in samples + +function uos_InputLengthSeconds(PlayerIndex: cint32; InputIndex: cint32): cfloat; +// InputIndex : InputIndex of existing input +// result : Length of Input in seconds + +function uos_InputLengthTime(PlayerIndex: cint32; InputIndex: cint32): TTime; +// InputIndex : InputIndex of existing input +// result : Length of Input in time format + +function uos_InputPosition(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : current postion in sample + +procedure uos_InputSetFrameCount(PlayerIndex: cint32; InputIndex: cint32 ; framecount : cint32); +// set number of frames to be done. (usefull for recording and level precision) + +procedure uos_InputSetLevelEnable(PlayerIndex: cint32; InputIndex: cint32 ; enable : cint32); +// set level calculation (default is 0) +// InputIndex : InputIndex of existing input +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. +// 3 => calcul before and after all DSP procedures. + +procedure uos_InputSetPositionEnable(PlayerIndex: cint32; InputIndex: cint32 ; enable : cint32); +// set position calculation (default is 1) +// InputIndex : InputIndex of existing input +// 0 => no calcul +// 1 => calcul position. + +procedure uos_InputSetLevelArrayEnable(PlayerIndex: cint32; InputIndex: cint32 ; levelcalc : cint32); +// set add level calculation in level-array (default is 0) +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. + +function uos_InputGetLevelArray(PlayerIndex: cint32; InputIndex: cint32) : TDArFloat; + +function uos_InputGetLevelLeft(PlayerIndex: cint32; InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : left level(volume) from 0 to 1 + +function uos_InputGetLevelRight(PlayerIndex: cint32; InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : right level(volume) from 0 to 1 + +function uos_InputFiltersGetLevelString(PlayerIndex: cint32; InputIndex: cint32): string; +// InputIndex : InputIndex of existing input +// result : list of left|right levels separed by $ character + +function uos_InputFiltersGetLevelArray(PlayerIndex: cint32; InputIndex: cint32): TDArFloat; +// InputIndex : InputIndex of existing input +// result : array of float of each filter. + //in format levelfilter0left,levelfilter0right,levelfilter1left,levelfilter2right,... + +{$IF DEFINED(soundtouch)} +function uos_InputGetBPM(PlayerIndex: cint32; InputIndex: cint32): CDouble; +// InputIndex : InputIndex of existing input +// result : Beats per minuts +{$endif} + +function uos_InputPositionSeconds(PlayerIndex: cint32; InputIndex: cint32): float; +// InputIndex : InputIndex of existing input +// result : current postion of Input in seconds + +function uos_InputPositionTime(PlayerIndex: cint32; InputIndex: cint32): TTime; +// InputIndex : InputIndex of existing input +// result : current postion of Input in time format + +function uos_InputUpdateTag(PlayerIndex: cint32;InputIndex: cint32): boolean; +// for mp3 and opus files only + +{$IF DEFINED(webstream) and DEFINED(mpg123)} +function uos_InputUpdateICY(PlayerIndex: cint32; InputIndex: cint32; var icy_data : pchar): integer; +// for mp3 only +{$endif} + +function uos_InputGetTagTitle(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagArtist(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagAlbum(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagDate(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagComment(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagTag(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagTrack(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagGenre(PlayerIndex: cint32; InputIndex: cint32): pchar; +// Tag infos + +function uos_InputGetSampleRate(PlayerIndex: cint32; InputIndex: cint32): CDouble; +// InputIndex : InputIndex of existing input +// result : default sample rate + +function uos_InputGetChannels(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : default channels + +procedure uos_PlayEx(PlayerIndex: cint32; no_free: Boolean; nloop: Integer; paused: boolean= false); +// Start playing with free at end as parameter and assign loop + +procedure uos_Play(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing + +Procedure uos_PlayPaused(PlayerIndex: cint32; nloop: Integer = 0) ;// Start play paused with loop + +Procedure uos_PlayNoFree(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing but do not free the player after stop + +Procedure uos_PlayNoFreePaused(PlayerIndex: cint32; nloop: Integer = 0) ;// Start play paused with loop but not free player at end + +Procedure uos_FreePlayer(PlayerIndex: cint32) ;// Works only when PlayNoFree() was used: free the player + +procedure uos_RePlay(PlayerIndex: cint32);// Resume playing after pause + +procedure uos_Stop(PlayerIndex: cint32);// Stop playing and free thread + +procedure uos_Pause(PlayerIndex: cint32);// Pause playing + +function uos_GetVersion() : cint32 ;// version of uos + +function uos_SetGlobalEvent(PlayerIndex: cint32; isenabled : boolean) : boolean; +// Set the RTL Events Global (will pause/start/replay all the players synchro with same rtl event)) +// result : true if set ok. + + {$IF DEFINED(soundtouch)} +function uos_GetBPM(TheBuffer: TDArFloat; Channels: cint32; SampleRate: CDouble) : CDouble; +// From SoundTouch plugin +{$endif} + +function uos_File2Buffer(Filename: Pchar; SampleFormat: cint32 ; var bufferinfos: Tuos_BufferInfos ; frompos : cint; numbuf : cint ): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max of frames) +// result : The memory buffer +// example : buffmem := uos_File2buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + +function uos_Stream2Buffer(AudioFile: TMemoryStream; SampleFormat: int32 ; var outmemory: TDArFloat; var bufferinfos: Tuos_BufferInfos ; frompos : cint; numbuf : cint): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max frames of buffers) +// result : The memory buffer +// example : buffmem := uos_Stream2Buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + +procedure uos_File2File(FilenameIN: Pchar; FilenameOUT: Pchar; SampleFormat: cint32 ; typeout: cint32 ); +// Create a audio file from a audio file. +// FileNameIN : filename of audio file IN (ogg, flac, wav, mp3, opus, aac,...) +// FileNameOUT : filename of audio file OUT (wav, pcm, custom) +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// typeout : Type of out file (-1:default=wav, 0:wav, 1:pcm, 2:custom) +// example : InputIndex1 := uos_File2File(edit5.Text,0,buffmem); + +procedure uos_MemStream2Wavfile(FileName: UTF8String; Data: TMemoryStream; BitsPerSample, chan : integer; + samplerate: CDouble); +// Create a audio wav file from a TMemoryStream. +// FileName : filename of wav saved file +// data : the memorystream +// BitsPerSample : 16 or 32 (bit) +// chan : number of channels +// samplerate : sample rate + +procedure uos_CustBufferInfos(var bufferinfos: Tuos_BufferInfos; SampleRate: CDouble; SampleFormat : cint32; Channels: cint32 ; Length: cint32); +// to initialize a custom bufferinfos: needed for AddFromMemoryBuffer() if no bufferinfos was created. +// all infos refer to the buffer used ---> length = length of the buffer div channels. + +var + uosDeviceInfos: array of Tuos_DeviceInfos; + uosLoadResult: Tuos_LoadResult; + uosDeviceCount: cint32; + uosDefaultDeviceIn: cint32; + uosDefaultDeviceOut: cint32; + //firstload : boolean = true; + +implementation + +function PlayersNotFree: Boolean; +Var + i: Integer; +begin + if uosPlayersStat <> nil then + for i:= 0 to Length(uosPlayersStat)-1 do + if uosPlayersStat[i] <> -1 then + begin + Result:= True; + Exit; + end; + Result:= False; +end; + +function PlayerNotFree(indexplayer : integer): Boolean; +begin + if uosPlayersStat <> nil then + if uosPlayersStat[indexplayer] <> -1 then + begin + Result:= True; + Exit; + end; + Result:= False; +end; + +{$IF DEFINED(noiseremoval)} +procedure uos_InputAddDSPNoiseRemoval(PlayerIndex: cint32; InputIndex: cint32); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].StreamIn[InputIndex].data.DSPNoiseIndex := + uosPlayers[PlayerIndex].InputAddDSPNoiseRemoval(InputIndex); +end; + +procedure uos_InputSetDSPNoiseRemoval(PlayerIndex: cint32; InputIndex: cint32; Enable: boolean); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].InputSetDSPNoiseRemoval(InputIndex, Enable); +end; + +procedure uos_OutputAddDSPNoiseRemoval(PlayerIndex: cint32; OutputIndex: cint32); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].StreamOut[OutputIndex].data.DSPNoiseIndex := + uosPlayers[PlayerIndex].OutputAddDSPNoiseRemoval(OutputIndex); +end; + +procedure uos_OutputSetDSPNoiseRemoval(PlayerIndex: cint32; OutputIndex: cint32; Enable: boolean); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].OutputSetDSPNoiseRemoval(OutputIndex, Enable); +end; +{$endif} + +function uos_SetGlobalEvent(PlayerIndex: cint32; isenabled : boolean) : boolean; +// Set the RTL Events Global (will pause/start/replay all the players synchro with same rtl event)) +// result : true if set ok. +begin +result := false; +if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].SetGlobalEvent(isenabled); +end; + +function uos_InputAddDSPVolume(PlayerIndex: cint32; InputIndex: cint32; VolLeft: double; + VolRight: double) : cint32; +begin +result:= -1; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + begin + uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.DSPVolumeIndex := uosPlayers[PlayerIndex].InputAddDSPVolume(InputIndex, VolLeft, VolRight); + result := uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.DSPVolumeIndex; + end; +end; +// DSP Volume changer +// PlayerIndex : Index of a existing Player +// InputIndex : InputIndex of a existing Input +// VolLeft : Left volume +// VolRight : Right volume +// result : -1 nothing created, otherwise index of DSPIn in array +// example DSPIndex1 := uos_InputAddDSPVolume(0,InputIndex1,1,1); + +procedure uos_OutputAddDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; VolLeft: double; + VolRight: double); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].StreamOut[OutputIndex].Data.DSPVolumeIndex := uosPlayers[PlayerIndex].OutputAddDSPVolume(OutputIndex, VolLeft, VolRight); +end; +// DSP Volume changer +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// VolLeft : Left volume +// VolRight : Right volume +// result : -1 nothing created, otherwise index of DSPIn in array +// example DSPIndex1 := uos_OutputAddDSPVolume(0,InputIndex1,1,1); + +procedure uos_InputSetDSPVolume(PlayerIndex: cint32; InputIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].InputSetDSPVolume(InputIndex, uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.DSPVolumeIndex, VolLeft, VolRight, Enable); +end; +// InputIndex : InputIndex of a existing Input +// PlayerIndex : Index of a existing Player +// VolLeft : Left volume +// VolRight : Right volume +// Enable : Enabled +// example uos_InputSetDSPVolume(0,InputIndex1,1,0.8,True); + +procedure uos_OutputSetDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].OutputSetDSPVolume(OutputIndex, uosPlayers[PlayerIndex].StreamOut[OutputIndex].Data.DSPVolumeIndex, VolLeft, VolRight, Enable); +end; +// OutputIndex : OutputIndex of a existing Output +// PlayerIndex : Index of a existing Player +// VolLeft : Left volume +// VolRight : Right volume +// Enable : Enabled +// example uos_OutputSetDSPVolume(0,InputIndex1,1,0.8,True); + +{$IF DEFINED(webstream) and DEFINED(mpg123)} +function uos_InputUpdateICY(PlayerIndex: cint32; InputIndex: cint32; var icy_data : pchar): integer; +// for mp3 only +begin + Result := -1; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputUpdateICY(InputIndex, icy_data) ; + end; +{$endif} + +function uos_InputUpdateTag(PlayerIndex: cint32;InputIndex: cint32): boolean; +// for mp3 and opus files only + begin + Result := false; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputUpdateTag(InputIndex) ; + end; + +function uos_InputGetTagTitle(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagTitle(InputIndex) ; + end; + +function uos_InputGetTagArtist(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result :=nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagArtist(InputIndex) ; + end; + +function uos_InputGetTagAlbum(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagAlbum(InputIndex) ; + end; + +function uos_InputGetTagComment(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagComment(InputIndex) ; + end; + +function uos_InputGetTagTag(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagTag(InputIndex) ; + end; + +function uos_InputGetTagTrack(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagTrack(InputIndex) ; + end; + +function uos_InputGetTagGenre(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagGenre(InputIndex) ; + end; + +function uos_InputGetTagDate(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagDate(InputIndex) ; + end; + +function uos_InputAddDSP(PlayerIndex: cint32; InputIndex: cint32; BeforeFunc : TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; Proc: TProc): cint32; +// add a DSP procedure for input +// PlayerIndex : Index of a existing Player +// InputIndex : Input Index of a existing input +// BeforeFunc : Function to do before the buffer is filled +// AfterFunc : Function to do after the buffer is filled +// EndedFunc : Function to do at end of thread +// LoopProc : external procedure to do after the buffer is filled +// result : index of DSPin in array (DSPinIndex) +// example : DSPinIndex1 := uos_InputAddDSP(0,InputIndex1,@beforereverse,@afterreverse,nil); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputAddDSP(InputIndex, BeforeFunc, AfterFunc, EndedFunc, Proc) ; +end; + +procedure uos_InputSetDSP(PlayerIndex: cint32; InputIndex: cint32; DSPinIndex: cint32; Enable: boolean); +// PlayerIndex : Index of a existing Player +// InputIndex : Input Index of a existing input +// DSPIndexIn : DSP Index of a existing DSP In +// Enable : DSP enabled +// example : uos_InputSetDSP(0,InputIndex1,DSPinIndex1,True); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].InputSetDSP(InputIndex, DSPinIndex, Enable) ; +end; + +function uos_OutputAddDSP(PlayerIndex: cint32; OutputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc : TFunc; Proc: TProc): cint32;// usefull if multi output +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// BeforeFunc : Function to do before the buffer is filled +// AfterFunc : Function to do after the buffer is filled just before to give to output +// EndedFunc : Function to do at end of thread +// LoopProc : external procedure to do after the buffer is filled +// result :index of DSPout in array +// example :DSPoutIndex1 := uos_OutputAddDSP(0,OutputIndex1,@volumeproc,nil,nil); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].OutputAddDSP(OutputIndex, BeforeFunc, AfterFunc, EndedFunc, Proc) ; +end; + +procedure uos_OutputSetDSP(PlayerIndex: cint32; OutputIndex: cint32; DSPoutIndex: cint32; Enable: boolean); +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// DSPoutIndex : DSPoutIndex of existing DSPout +// Enable : DSP enabled +// example : uos_OutputSetDSP(0,OutputIndex1,DSPoutIndex1,True); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].OutputSetDSP(OutputIndex, DSPoutIndex, Enable) ; +end; + +function uos_InputAddFilter(PlayerIndex: cint32; InputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// 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 +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputAddFilter(InputIndex, + TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, AlsoBuf, LoopProc) ; +end; + +procedure uos_InputSetFilter(PlayerIndex: cint32; InputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// 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 + +begin +if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetFilter(InputIndex, FilterIndex, + TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, + AlsoBuf, LoopProc, Enable); +end; + +function uos_OutputAddFilter(PlayerIndex: cint32; OutputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// Output : InputIndex of a existing Output +// 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 +// result : index of DSPIn in array +begin + result := -1 ; +if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + +result := uosPlayers[PlayerIndex].OutputAddFilter(OutputIndex, + TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, AlsoBuf, LoopProc) ; + +end; + +procedure uos_OutputSetFilter(PlayerIndex: cint32; OutputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// OuputIndex : InputIndex of a existing Output +// 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 +begin +if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].OutputSetFilter(OutputIndex, FilterIndex, + TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, + AlsoBuf, LoopProc, Enable); +end; + +{$IF DEFINED(portaudio)} +function uos_AddFromDevIn(PlayerIndex: cint32; Device: cint32; Latency: CDouble; + SampleRate: CDouble; OutputIndex: cint32; + SampleFormat: cint32; FramesCount : cint32; ChunkCount: cint32): cint32; +// Add a Input from Device Input with custom parameters +// PlayerIndex : Index of a existing Player +// Device ( -1 is default Input device ) +// Latency ( -1 is latency suggested ) ) +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// 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 (65536) +// ChunkCount : default : -1 (= 512) +// result : Output Index in array , -1 is error +// example : OutputIndex1 := uos_AddFromDevIn(0,-1,-1,-1,-1,-1,-1); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromDevIn(Device, Latency, SampleRate, OutputIndex, + SampleFormat, FramesCount, ChunkCount) ; +end; + +function uos_AddFromDevIn(PlayerIndex: cint32): cint32; +// Add a Input from Device Input with custom parameters +// PlayerIndex : Index of a existing Player +begin +result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromDevIn(-1, -1, -1, -1, -1, -1, -1) ; +end; +{$endif} + +function uos_AddFromEndlessMuted(PlayerIndex: cint32; Channels : cint32; FramesCount: cint32): cint32; +// Add a input from Endless Muted dummy sine wav +// FramesCount = FramesCount of input-to-follow +// Channels = Channels of input-to-follow. + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromEndlessMuted(Channels, FramesCount) ; +end; + +{$IF DEFINED(synthesizer)} +function uos_AddFromSynth(PlayerIndex: cint32; Channels: integer; WaveTypeL, WaveTypeR: shortint; + FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; + duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32; + OutputIndex: cint32; SampleFormat: cint32 ; SampleRate: CDouble ; 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, 2= triangle, 3=sawtooth used for mono and stereo) +// WaveTypeR: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth 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 + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromSynth(Channels,WaveTypeL, WaveTypeR, FrequencyL, + FrequencyR, VolumeL, VolumeR, Duration, NbHarmonics, EvenHarmonics, OutputIndex, + SampleFormat, SampleRate, FramesCount) ; +end; + +procedure uos_InputSetSynth(PlayerIndex: cint32; InputIndex: cint32; WaveTypeL, WaveTypeR: shortint; + 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, 2= triangle, 3=sawtooth used for mono and stereo) +// WaveTypeR: do not change: -1 (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth 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; + + begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetSynth(InputIndex, WaveTypeL, WaveTypeR , + FrequencyL, FrequencyR, VolumeL, VolumeR, Duration, NbHarmonic, EvenHarmonics, Enable) ; +end; +{$endif} + +function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; + Channels: cint32; SampleFormat: cint32 ; FramesCount: cint32 ; FileFormat: cint32): cint32; +// Add a Output into audio wav file with custom parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : default : -1 (2:Int16) (1:Int32, 2:Int16) +// FramesCount : default : -1 (= 65536) +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg); +// result :Output Index in array -1 = error +// example : OutputIndex1 := uos_AddIntoFile(0,edit5.Text,-1,-1, 0, 1); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoFile(Filename, SampleRate, Channels, SampleFormat, FramesCount, FileFormat); +end; + +function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a Output into audio wav file with Default parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoFile(Filename, -1, -1, -1, -1, -1); +end; + +function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; + Channels: LongInt; SampleFormat: LongInt ; FramesCount: LongInt; FileFormat: cint32): LongInt; +// Add a Output into audio wav file with Custom parameters +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : -1 default : Int16 : (1:Int32, 2:Int16) +// FramesCount : -1 default : 65536 div channels +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom); +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoFileFromMem(edit5.Text,-1,-1,0, -1,-1); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoFileFromMem(Filename, SampleRate, Channels, SampleFormat, FramesCount, FileFormat); +end; + +function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a Output into audio wav file with Default parameters from TMemoryStream +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoFileFromMem(Filename, -1, -1, -1, -1, -1); +end; + + {$IF DEFINED(shout)} +function uos_AddIntoIceServer(PlayerIndex: cint32; SampleRate : CDouble; Channels: cint; SampleFormat: cint; + EncodeType: cint; Port: cint; Host: pchar; User: pchar; Password: pchar; MountFile :pchar): cint32; +// Add a Output into a IceCast server for audio-web-streaming// SampleRate : delault : -1 (48100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// EncodeType : default : -1 (0:Music) (0: Music, 1:Voice) +// SampleFormat : -1 default : float32 : (0:float32, 1:Int16) +// Port : default : -1 (= 8000) +// Host : default : 'def' (= '127.0.0.1') +// User : default : 'def' (= 'source') +// Password : default : 'def' (= 'hackme') +// MountFile : default : 'def' (= '/example.opus') +// result : Output Index in array -1 = error + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoIceServer(SampleRate, Channels, SampleFormat, EncodeType, Port, + Host, User, Password, MountFile ); +end; + {$endif} + +{$IF DEFINED(portaudio)} + function uos_AddIntoDevOut(PlayerIndex: cint32; Device: cint32; Latency: CDouble; + SampleRate: CDouble; Channels: cint32; SampleFormat: cint32 ; + FramesCount: cint32 ; ChunkCount: cint32): cint32; +// Add a Output into Device Output with custom parameters +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoDevOut(Device, Latency, SampleRate, Channels, SampleFormat , FramesCount, ChunkCount); +end; + +function uos_AddIntoDevOut(PlayerIndex: cint32): cint32; +// Add a Output into Device Output with default parameters +begin + Result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoDevOut(-1, -1, -1, -1, -1 ,-1, -1); +end; +{$endif} + +function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32): cint32; +// Add a input from audio file with custom parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of audio file +// 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 (65536) +// result : Input Index in array -1 = error +// example : InputIndex1 := AddFromFile(0, edit5.Text,-1,-1); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromFile(Filename, OutputIndex, SampleFormat, FramesCount); +end; + +function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a input from audio file with default parameters +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromFile(Filename, -1, -1, -1); +end; + +function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat) : cint32; +// Add a Output into memory buffer +// outmemory : pointer of buffer to use to store memory. +// example : OutputIndex1 := uos_AddIntoMemoryBuffer(0, pointer(bufmemory)); + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoMemoryBuffer(outmemory); +end; + +function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat; SampleRate: CDouble; SampleFormat: LongInt; + Channels: LongInt; FramesCount: LongInt): LongInt; +// Add a Output into memory buffer +// outmemory : pointer of buffer to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (0:float32) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 1024 * 2) + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoMemoryBuffer(outmemory, SampleRate,SampleFormat,Channels,FramesCount); +end; + +function uos_AddIntoMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; +SampleRate: CDouble; SampleFormat: LongInt ; Channels: LongInt; FramesCount: LongInt; Audioformat: cint32): LongInt; +// Add a Output into TMemoryStream +// MemoryStream : the TMemoryStream to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 4096) +// AudioFormat : default : -1 (wav) (0:wav, 1:ogg); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoMemoryStream(MemoryStream, + SampleRate,SampleFormat,Channels,FramesCount, AudioFormat); +end; + +function uos_AddFromMemoryBuffer(PlayerIndex: cint32; MemoryBuffer: TDArFloat; Bufferinfos: Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// Add a input from memory buffer with custom parameters +// MemoryBuffer : the buffer +// Bufferinfos : infos of the buffer +// 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 ';')// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)// SampleRate : delault : -1 (44100)// FramesCount : default : -1 (4096) +// FramesCount : default : -1 (65536 div Channels) +// result : Input Index in array -1 = error +// example : InputIndex1 := AddFromMemoryBuffer(mybuffer, buffinfos,-1,1024); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromMemoryBuffer(MemoryBuffer, Bufferinfos, OutputIndex, FramesCount); +end; + +function uos_AddFromMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; + TypeAudio: cint32; OutputIndex: cint32; SampleFormat: cint32 ; FramesCount: cint32): cint32; +// 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 := AddFromMemoryStream(0, mymemorystream,-1,-1,0,1024); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromMemoryStream(MemoryStream, TypeAudio, OutputIndex, SampleFormat, FramesCount); +end; + +function uos_AddFromMemoryStreamDec(PlayerIndex: cint32; var MemoryStream: TMemoryStream; var Bufferinfos: Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// MemoryStream : Memory-stream of decoded audio (like created by AddIntoMemoryStream) +// Bufferinfos : infos of the Memory-stream +// 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 ';') +// FramesCount : default : -1 (4096) +// result : Input Index in array -1 = error +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromMemoryStreamDec(MemoryStream, Bufferinfos, OutputIndex, FramesCount); +end; + +function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ; numbuf : cint): cint32; +// Add a input from audio file and store it into memory with custom parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of audio file +// 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 (65536) +// result : Input Index in array -1 = error +// example : InputIndex1 := uos_AddFromFileIntoMemory(0, edit5.Text, -1, 0, -1); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromFileIntoMemory(Filename, OutputIndex, SampleFormat, FramesCount, numbuf); +end; + +function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a input from audio file and store it into memory with default parameters +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromFileIntoMemory(Filename, -1, -1, -1, -1); +end; + +{$IF DEFINED(webstream)} +function uos_AddFromURL(PlayerIndex: cint32; URL: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32; AudioFormat: cint32 ; ICYon : boolean): cint32; +// Add a Input from Audio URL +// URL : URL of audio file +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output +// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : default : -1 (4096) +// AudioFormat : default : -1 (mp3) (0: mp3, 1: opus) +// ICYon : ICY data on/off +// Add a Input from Audio URL +// URL : URL of audio file (like 'http://someserver/somesound.mp3') +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output +// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : default : -1 (65536) +// AudioFormat : default : -1 (mp3) (0: mp3, 1: opus) +// example : InputIndex := uos_AddFromURL('http://someserver/somesound.mp3',-1,-1,-1,-1, false); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromURL(URL, OutputIndex, SampleFormat, FramesCount, AudioFormat , ICYon); +end; + +function uos_AddFromURL(PlayerIndex: cint32; URL: PChar): cint32; +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromURL(URL, -1, -1, -1, -1, false); +end; +{$ENDIF} + +function uos_AddPlugin(PlayerIndex: cint32; PlugName: PChar; SampleRate: CDouble; + Channels: cint32): cint32; +// Add a plugin , result is PluginIndex +// PlayerIndex : Index of a existing Player +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// 'soundtouch' and 'bs2b' PlugName are registred. +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddPlugin(PlugName, SampleRate, Channels); +end; + +{$IF DEFINED(soundtouch)} +procedure uos_SetPluginSoundTouch(PlayerIndex: cint32; PluginIndex: cint32; Tempo: cfloat; + Pitch: cfloat; Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +// PlayerIndex : Index of a existing Player +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].SetPluginSoundTouch(PluginIndex, Tempo, Pitch, Enable); +end; + +procedure uos_SetPluginGetBPM(PlayerIndex: cint32; PluginIndex: cint32; numofframes: integer; loop : boolean; + Enable: boolean); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].SetPluginGetBPM(PluginIndex, numofframes, loop, Enable); +end; + +{$endif} + +{$IF DEFINED(bs2b)} + procedure uos_SetPluginBs2b(PlayerIndex: cint32; PluginIndex: cint32; level: CInt32; fcut: CInt32; + feed: CInt32; Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +// PlayerIndex : Index of a existing Player +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].SetPluginBs2b(PluginIndex, level, fcut, feed, Enable); +end; +{$endif} + +procedure uos_InputSeek(PlayerIndex: cint32; InputIndex: cint32; pos: Tcount_t); +// change position in sample +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSeek(InputIndex, pos); +end; + +function uos_GetStatus(PlayerIndex: cint32) : cint32 ; +// Get the status of the player : -1 => error, 0 => has stopped, 1 => is running, 2 => is paused. +begin +result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if assigned(uosPlayers[PlayerIndex]) then + begin + if uosPlayersStat[PlayerIndex] = 1 then + result := uosPlayers[PlayerIndex].Status else result := -1 ; + end else result := -1 ; +end; + +procedure uos_InputSeekSeconds(PlayerIndex: cint32; InputIndex: cint32; pos: cfloat); +// change position in seconds +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSeekSeconds(InputIndex, pos); +end; + +procedure uos_InputSeekTime(PlayerIndex: cint32; InputIndex: cint32; pos: TTime); +// change position in time format +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSeekTime(InputIndex, pos); +end; + +function uos_InputGetBuffer(PlayerIndex: cint32; InputIndex: cint32): TDArFloat; +// Get current buffer +begin +//{ + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputGetBuffer(InputIndex) ; +// } +end; + +function uos_InputLength(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : Length of Input in samples +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputLength(InputIndex) ; +end; + +function uos_InputLengthSeconds(PlayerIndex: cint32; InputIndex: cint32): cfloat; +// InputIndex : InputIndex of existing input +// result : Length of Input in seconds +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputLengthSeconds(InputIndex) ; +end; + +function uos_InputLengthTime(PlayerIndex: cint32; InputIndex: cint32): TTime; +// InputIndex : InputIndex of existing input +// result : Length of Input in time format +begin +Result := sysutils.EncodeTime(0, 0, 0, 0); + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputLengthTime(InputIndex) ; +end; + +function uos_InputPosition(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : current postion in sample +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputPosition(InputIndex) ; +end; + +procedure uos_InputSetFrameCount(PlayerIndex: cint32; InputIndex: cint32 ; framecount : cint32); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetFrameCount(InputIndex, framecount) ; +end; + +procedure uos_InputSetLevelEnable(PlayerIndex: cint32; InputIndex: cint32 ; enable : cint32); +// set level calculation (default is 0) +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. +// 3 => calcul before and after all DSP procedures. + +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetLevelEnable(InputIndex, enable) ; +end; + +procedure uos_InputSetEnable(PlayerIndex: cint32; InputIndex: cint32; enabled: boolean); +// set enable true or false +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetEnable(InputIndex, enabled) ; +end; + +procedure uos_OutputSetEnable(PlayerIndex: cint32; OutputIndex: cint32; enabled: boolean); +// set enable true or false (usefull for multi outputput) +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].OutputSetEnable(OutputIndex, enabled) ; +end; + +procedure uos_InputSetPositionEnable(PlayerIndex: cint32; InputIndex: cint32 ; enable : cint32); +// set position calculation (default is 0) +// 0 => no calcul +// 1 => calcul position. +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetPositionEnable(InputIndex, enable) ; +end; + +procedure uos_InputSetLevelArrayEnable(PlayerIndex: cint32; InputIndex: cint32 ; levelcalc : cint32); +// set add level calculation in level-array (default is 0) +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetLevelArrayEnable(InputIndex, levelcalc) ; +end; + +function uos_InputGetLevelArray(PlayerIndex: cint32; InputIndex: cint32) : TDArFloat; +begin + result := uosLevelArray[PlayerIndex][InputIndex] ; +end; + +function uos_InputGetLevelLeft(PlayerIndex: cint32; InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : left level(volume) from 0 to 1 +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputGetLevelLeft(InputIndex) ; +end; + +function uos_InputFiltersGetLevelString(PlayerIndex: cint32 ; InputIndex: cint32): string; +// InputIndex : InputIndex of existing input +// filterIndex : Filterindex of existing filter +// result : list of left|right levels separed by $ character +begin + result := ''; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputFiltersGetLevelString(InputIndex) ; +end; + +function uos_InputFiltersGetLevelArray(PlayerIndex: cint32; InputIndex: cint32): TDArFloat; +// InputIndex : InputIndex of existing input +// result : array of float of each filter. + //in format levelfilter0left,levelfilter0right,levelfilter1left,levelfilter2right,.. +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputFiltersGetLevelArray(InputIndex) ; +end; + +function uos_InputGetSampleRate(PlayerIndex: cint32; InputIndex: cint32): CDouble; +// InputIndex : InputIndex of existing input +// result : default sample rate +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) and + (length(uosPlayers[PlayerIndex].StreamIn) > 0) and (InputIndex +1 <= length(uosPlayers[PlayerIndex].StreamIn)) + then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.SamplerateRoot; +end; + +function uos_InputGetChannels(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : default channels +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) and + (length(uosPlayers[PlayerIndex].StreamIn) > 0) and (InputIndex +1 <= length(uosPlayers[PlayerIndex].StreamIn)) + then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.Channels; +end; + +function uos_InputGetLevelRight(PlayerIndex: cint32; InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : right level(volume) from 0 to 1 +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputGetLevelRight(InputIndex) ; +end; + +{$IF DEFINED(soundtouch)} +function uos_InputGetBPM(PlayerIndex: cint32; InputIndex: cint32): CDouble; +// InputIndex : InputIndex of existing input +// result : Beats per minuts +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputGetBPM(InputIndex) ; +end; +{$endif} + +function uos_InputPositionSeconds(PlayerIndex: cint32; InputIndex: cint32): float; +// InputIndex : InputIndex of existing input +// result : current postion of Input in seconds +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputPositionSeconds(InputIndex) ; +end; + +function uos_InputPositionTime(PlayerIndex: cint32; InputIndex: cint32): TTime; +// InputIndex : InputIndex of existing input +// result : current postion of Input in time format +begin +Result := sysutils.EncodeTime(0, 0, 0, 0); + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputPositionTime(InputIndex) ; +end; + +function uos_InputAddDSP1ChanTo2Chan(PlayerIndex: cint32; InputIndex: cint32): cint32; +// Convert mono 1 channel input to stereo 2 channels input. +// Works only if the input is mono 1 channel othewise stereo 2 chan is keeped. +// InputIndex : InputIndex of a existing Input +// result : index of DSPIn in array +// example DSPIndex1 := InputAddDSP1ChanTo2Chan(InputIndex1); +begin +Result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputAddDSP1ChanTo2Chan(InputIndex) ; +end; + +Procedure uos_PlayEx(PlayerIndex: cint32; + no_free: Boolean; nloop: Integer; paused: boolean= false);// Start playing with free at end as parameter and assign loop + +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].PlayEx(no_free,nloop, paused ) ; +end; + +Procedure uos_Play(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uos_PlayEx(PlayerIndex, False,nloop); +end; + +Procedure uos_PlayPaused(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing paused +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uos_PlayEx(PlayerIndex, False,nloop,true); +end; + +Procedure uos_PlayNoFree(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing but do not free the player after stop +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uos_PlayEx(PlayerIndex, True,nloop); +end; + +Procedure uos_PlayNoFreePaused(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing paused but do not free the player after stop +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uos_PlayEx(PlayerIndex, True,nloop, true); +end; + +Procedure uos_FreePlayer(PlayerIndex: cint32) ; +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].FreePlayer() ; +end; + +procedure uos_RePlay(PlayerIndex: cint32);// Resume playing after pause +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].RePlay() ; +end; + +procedure uos_Stop(PlayerIndex: cint32);// Stop playing and if uos_Play() was used: free the player +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + begin +uosPlayers[PlayerIndex].Stop(); +{$IF DEFINED(mse)} + freeandnil(uosPlayers[PlayerIndex]); + uosPlayersStat[PlayerIndex] := -1 ; +{$endif} +end; +end; + +procedure uos_Pause(PlayerIndex: cint32);// Pause playing +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].Pause() ; +end; + +procedure uos_BeginProc(PlayerIndex: cint32; Proc: TProc ); +// Assign the procedure of object to execute at begin, before loop +// PlayerIndex : Index of a existing Player +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].BeginProc := Proc; +end; + +procedure uos_EndProc(PlayerIndex: cint32; Proc: TProc ); +// Assign the procedure of object to execute at end, after loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].EndProc := Proc; +end; + +procedure uos_EndProcOnly(PlayerIndex: cint32; Proc: TProconly ); +// Assign the procedure (not of object) to execute at end, after loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].EndProcOnly := Proc; +end; + +procedure uos_LoopBeginProc(PlayerIndex: cint32; Proc: TProc ); +// Assign the procedure of object to execute at begin, before loop +// PlayerIndex : Index of a existing Player +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].LoopBeginProc := Proc; +end; + +procedure uos_LoopEndProc(PlayerIndex: cint32; Proc: TProc ); +// Assign the procedure of object to execute at end, after loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].LoopEndProc := Proc; +end; + +procedure uos_LoopProcIn(PlayerIndex: cint32; InIndex: cint32; Proc: TProc ); +// Assign the procedure of object to execute inside the loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].StreamIn[InIndex].LoopProc := Proc; +end; + +procedure uos_LoopProcOut(PlayerIndex: cint32; OutIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute inside the loop +// PlayerIndex : Index of a existing Player +// OutIndex : Index of a existing Output +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].StreamOut[OutIndex].LoopProc := Proc; +end; + +function uos_File2Buffer(Filename: Pchar; SampleFormat: cint32 ; var bufferinfos: Tuos_BufferInfos ; frompos : cint; numbuf : cint ): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max of frames) +// result : The memory buffer +// example : buffmem := uos_File2buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + begin +result := uos.uos_File2Buffer(Filename, SampleFormat, bufferinfos, frompos, numbuf ) ; + end; + +function uos_Stream2Buffer(AudioFile: TMemoryStream; SampleFormat: int32 ; var outmemory: TDArFloat; var bufferinfos: Tuos_BufferInfos ; frompos : cint; numbuf : cint): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max frames of buffers) +// result : The memory buffer +// example : buffmem := uos_Stream2Buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + begin +result := uos.uos_Stream2Buffer(AudioFile, SampleFormat, outmemory, bufferinfos, frompos, numbuf ) ; + end; + +{$IF DEFINED(soundtouch)} +function uos_GetBPM(TheBuffer: TDArFloat; Channels: cint32; SampleRate: CDouble) : CDouble; +// From SoundTouch plugin +begin + result := uos.uos_GetBPM(TheBuffer, Channels, SampleRate); + end; +{$endif} + +procedure uos_CustBufferInfos(var bufferinfos: Tuos_BufferInfos; SampleRate: CDouble; SampleFormat : cint32; Channels: cint32 ; Length: cint32); +// to initialize a custom bufferinfos: needed for AddFromMemoryBuffer() if no bufferinfos was created. +// all infos refer to the buffer used ---> length = length of the buffer div channels. +begin + uos.uos_CustBufferInfos(bufferinfos, SampleRate, SampleFormat, Channels, Length); + end; + +procedure uos_File2File(FilenameIN: Pchar; FilenameOUT: Pchar; SampleFormat: cint32 ; typeout: cint32 ); +// Create a audio file from a audio file. +// FileNameIN : filename of audio file IN (ogg, flac, wav, mp3, opus, aac,...) +// FileNameOUT : filename of audio file OUT (wav, pcm, custom) +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// typeout : Type of out file (-1:default=wav, 0:wav, 1:pcm, 2:custom)// example : InputIndex1 := uos_File2File(edit5.Text,0,buffmem); + begin + uos.uos_File2File(FilenameIN, FilenameOUT, SampleFormat, typeout); + end; + +procedure uos_MemStream2Wavfile(FileName: UTF8String; Data: TMemoryStream; BitsPerSample, + chan: integer; samplerate : CDouble); +// Create a audio wav file from a TMemoryStream. +// FileName : filename of wav saved file +// data : the memorystream +// BitsPerSample : 16 or 32 (bit) +// chan : number of channels +// samplerate : sample rate + begin + uos.uos_MemStream2Wavfile(FileName,Data,BitsPerSample, chan, samplerate); + end; + +function uos_TestLoadLibrary(Filename: Pchar): boolean; +// test a library to check if it can be loaded; +begin +result := uos.uos_TestLoadLibrary(FileName); +end; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName, fdkaacFilename : PChar) : cint32; + begin +result := uos.uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, + FaadFileName, opusfileFileName, XMPFileName, fdkaacFilename) ; + end; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName: PChar) : cint32; + begin +result := uos.uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName, nil, nil) ; + end; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName : PChar) : cint32; + begin +result := uos.uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName, XMPFileName, nil) ; + end; + + +function uos_loadPlugin(PluginName, PluginFilename: PChar) : cint32; +// load plugin... +begin +result := uos.uos_loadPlugin(PluginName, PluginFilename) ; +end; + +function uos_Int16ToFloat32(Inbuf: TDArFloat): TDArFloat; +// convert buffer int16 into float32. +begin +result := uos.CvInt16ToFloat32(Inbuf); +end; + +{$IF DEFINED(shout)} +function uos_LoadServerLib(ShoutFileName, OpusFileName : PChar) : cint32; +// Shout => needed for dealing with IceCast server +// Opus => needed for dealing with encoding opus stream +begin +result := uos.uos_LoadServerLib(ShoutFileName, OpusFileName) ; + end; + +procedure uos_unloadServerLib(); +// Unload server libraries... Do not forget to call it before close application... + begin + uos.uos_unloadServerLib() ; + end; +{$endif} + +function uos_GetVersion() : cint32 ; +begin +result := uos.uos_GetVersion() ; +end; + +procedure uos_unloadlib() ; + var + x: cint32; + nt : integer = 300; + begin + if assigned(uosPlayers) then + begin + if (length(uosPlayers) > 0) then + for x := 0 to high(uosPlayers) do + if uosPlayersStat[x] = 1 then + begin + if uosPlayers[x].Status > 0 then + begin + uosPlayers[x].nofree := false; + uosPlayers[x].Stop(); + end; + end; + + while (PlayersNotFree = true) and (nt > 0) do + begin + Sleep(10); + Dec(nt); + end; + + setlength(uosPlayers, 0) ; + setlength(uosPlayersStat, 0) ; + end; + + uos.uos_unloadlib() ; +end; + +procedure uos_unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac : boolean); +// Custom Unload libraries... if true, then delete the library. You may unload what and when you want... +begin +uos.uos_unloadlibcust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac) ; +uosLoadResult:= uos.uosLoadResult; +end; + +procedure uos_UnloadPlugin(PluginName: PChar); +begin +uos.uos_UnloadPlugin(PluginName) ; +uosLoadResult:= uos.uosLoadResult; +end; + +function uos_GetInfoLibraries() : PChar ; +begin +result := uos.uos_GetInfoLibraries(); +end; + +{$IF DEFINED(portaudio)} +procedure uos_GetInfoDevice(); +begin +uos.uos_GetInfoDevice(); +setlength(uosDeviceInfos,length(uos.uosDeviceInfos)); + +uosDeviceInfos := uos.uosDeviceInfos; + +uosDeviceCount:= uos.uosDeviceCount; +uosDefaultDeviceIn:= uos.uosDefaultDeviceIn; +uosDefaultDeviceOut:= uos.uosDefaultDeviceOut; +end; + +procedure uos_UpdateDevice(); +begin +uos.uos_UpdateDevice(); +uosDeviceCount:= uos.uosDeviceCount; +uosDefaultDeviceIn:= uos.uosDefaultDeviceIn; +uosDefaultDeviceOut:= uos.uosDefaultDeviceOut; +end; + +function uos_GetInfoDeviceStr() : PChar ; +begin +result := uos.uos_GetInfoDeviceStr(); +uosDeviceCount:= uos.uosDeviceCount; +uosDefaultDeviceIn:= uos.uosDefaultDeviceIn; +uosDefaultDeviceOut:= uos.uosDefaultDeviceOut; +end; +{$endif} + +function uos_CreatePlayer(PlayerIndex : cint32): boolean; +// Create the player , PlayerIndex1 : from 0 to what your computer can do ! +// If PlayerIndex exists already, it will be overwriten... + var +x : cint32; +nt : integer = 200; +begin +result := false; + +uos_stop(PlayerIndex); // cannot hurt ! + +if PlayerIndex >= 0 then +begin +if PlayerIndex + 1 > length(uosPlayers) then +begin + setlength(uosPlayers,PlayerIndex + 1) ; + uosPlayers[PlayerIndex] := nil; + setlength(uosPlayersStat,PlayerIndex + 1) ; + setlength(uosLevelArray,PlayerIndex + 1) ; +end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('before uosPlayers[PlayerIndex] <> nil '); + {$endif} + + if (uosPlayers[PlayerIndex] <> nil) then + begin + uosPlayers[PlayerIndex].FreePlayer; + Sleep(20); + while (PlayerNotFree(PlayerIndex) = true) and (nt > 0) do + begin + Sleep(10); + Dec(nt); + end; + + end; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('after uosPlayers[PlayerIndex] <> nil '); +{$endif} + + uosPlayers[PlayerIndex] := Tuos_Player.Create(); + + result:= True; + + uosPlayers[PlayerIndex].Index := PlayerIndex; +//notice player is created + uosPlayersStat[PlayerIndex] := 1 ; + + for x := 0 to length(uosPlayersStat) -1 do + if uosPlayersStat[x] <> 1 then + begin + uosPlayersStat[x] := -1 ; + uosPlayers[x] := nil ; + end; + + end; +end; + +procedure uos_Free(); +var +x : integer; +nt : shortint = 100; +begin + +// needed for MSE and if some players are still playing +if length(uosPlayers) > 0 then + for x := 0 to length(uosPlayers) -1 do + if assigned(uosPlayers[x]) then + begin + uosPlayers[x].nofree := false; + uos_playpaused(x); + uos_stop(x); + end; + +while (PlayersNotFree = true) and (nt > 0) do + begin + Sleep(10); + Dec(nt); + end; + sleep(100); + uos.uos_free(); +end; + +end. diff --git a/UOS/examples/uos_httpgetthread.pas b/UOS/examples/uos_httpgetthread.pas new file mode 100644 index 0000000..ece9b09 --- /dev/null +++ b/UOS/examples/uos_httpgetthread.pas @@ -0,0 +1,158 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{ This is HTTP Thread Getter + created by Andrew Haines -> andrewd207@aol.com + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com} + +unit uos_httpgetthread; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + Pipes; + +type + + { TThreadHttpGetter } + + TThreadHttpGetter = class(TThread) + private + FOutStream: TOutputPipeStream; + FWantedURL: string; + FIcyMetaInt: int64; + FOnIcyMetaInt: TNotifyEvent; + property OnIcyMetaInt: TNotifyEvent read FOnIcyMetaInt write FOnIcyMetaInt; + procedure DoIcyMetaInt; + function GetRedirectURL(AResponseStrings: TStrings): string; + procedure Headers(Sender: TObject); + protected + procedure Execute; override; + public + FIsRunning: Boolean; + ICYenabled: Boolean; + property IcyMetaInt: int64 read FIcyMetaInt; + property IsRunning: Boolean read FIsRunning; + constructor Create(AWantedURL: string; AOutputStream: TOutputPipeStream); + end; + +implementation + +uses + fphttpclient, + openssl, { This implements the procedure InitSSLInterface } + opensslsockets; + + { TThreadHttpGetter } + +function TThreadHttpGetter.GetRedirectURL(AResponseStrings: TStrings): string; +var + S: string; + F: integer; + Search: string = 'location:'; +begin + Result := ''; + for S in AResponseStrings do + begin + // WriteLn(S); + F := Pos(Search, Lowercase(s)); + + if F > 0 then + begin + Inc(F, Length(Search)); + Exit(Trim(Copy(S, F, Length(S) - F + 1))); + end; + end; +end; + +procedure TThreadHttpGetter.DoIcyMetaInt; +begin + if Assigned(FOnIcyMetaInt) then + FOnIcyMetaInt(Self); +end; + +procedure TThreadHttpGetter.Headers(Sender: TObject); +begin + FIcyMetaInt := StrToInt64Def(TFPHTTPClient(Sender).GetHeader(TFPHTTPClient(Sender).ResponseHeaders, 'icy-metaint'), 0); + if (FIcyMetaInt > 0) and (FOnIcyMetaInt <> nil) then + Synchronize(@DoIcyMetaInt); +end; + +procedure TThreadHttpGetter.Execute; +var + Http: TFPHTTPClient; + URL: string; + err: shortint = 0; +begin + URL := FWantedURL; + if pos(' ', URL) > 0 then + FIsRunning := False + else + begin + InitSSLInterface; + Http := TFPHTTPClient.Create(nil); + http.AllowRedirect := True; + http.IOTimeout := 2000; + repeat + try + Http.RequestHeaders.Clear; + if ICYenabled = True then + Http.OnHeaders := @Headers; + // writeln(' avant http.get'); + Http.Get(URL, FOutStream); + // writeln(' apres http.get'); + except + on e: EHTTPClient do + begin + // writeln(' Http.ResponseStatusCode ' +inttostr(Http.ResponseStatusCode)); + if (Http.ResponseStatusCode > 399) or (Http.ResponseStatusCode < 1) then // not accessible + begin + FIsRunning := False; + break; + end; + if Http.ResponseStatusCode = 302 then + begin + URL := GetRedirectURL(Http.ResponseHeaders); + if URL <> '' then + Continue; + end + else + Break; + // raise E; + end; + on e: Exception do + begin + // WriteLn(e.Message); + end + else + // Raise; + Break; + end; + Break; + until (False); + try + //FOutStream.Free; + Http.Free; + finally + // make sure this is set to false when done + FIsRunning := False; + end; + end; +end; + +constructor TThreadHttpGetter.Create(AWantedURL: string; AOutputStream: TOutputPipeStream); +begin + inherited Create(True); + ICYenabled := False; + FIsRunning := True; + FWantedURL := AWantedURL; + FOutStream := AOutputStream; + // Start; +end; + +end. + diff --git a/UOS/examples/uos_jni.pas b/UOS/examples/uos_jni.pas new file mode 100644 index 0000000..d05385d --- /dev/null +++ b/UOS/examples/uos_jni.pas @@ -0,0 +1,573 @@ +unit uos_jni; + +{$ifdef fpc} +{$mode delphi} + {$packrecords c} +{$endif} + +{$macro on} +{$ifdef mswindows} +{$define jnicall:=stdcall} +{$else} +{$define jnicall:=cdecl} +{$endif} + +interface + +(* + * Manifest constants. + *) +const JNI_FALSE=0; + JNI_TRUE=1; + + JNI_VERSION_1_1=$00010001; + JNI_VERSION_1_2=$00010002; + JNI_VERSION_1_4=$00010004; + JNI_VERSION_1_6=$00010006; + + JNI_OK=0; // no error + JNI_ERR=-1; // generic error + JNI_EDETACHED=-2; // thread detached from the VM + JNI_EVERSION=-3; // JNI version error + + JNI_COMMIT=1; // copy content, do not free buffer + JNI_ABORT=2; // free buffer w/o copying back + +(* + * Type definitions. + *) +type va_list=pointer; + + jboolean=byte; // unsigned 8 bits + jbyte=shortint; // signed 8 bits + jchar=word; // unsigned 16 bits + jshort=smallint; // signed 16 bits + jint=longint; // signed 32 bits + jlong=int64; // signed 64 bits + jfloat=single; // 32-bit IEEE 754 + jdouble=double; // 64-bit IEEE 754 + + jsize=jint; // "cardinal indices and sizes" + + Pjboolean=^jboolean; + Pjbyte=^jbyte; + Pjchar=^jchar; + Pjshort=^jshort; + Pjint=^jint; + Pjlong=^jlong; + Pjfloat=^jfloat; + Pjdouble=^jdouble; + + Pjsize=^jsize; + + // Reference type + jobject=pointer; + jclass=jobject; + jstring=jobject; + jarray=jobject; + jobjectArray=jarray; + jbooleanArray=jarray; + jbyteArray=jarray; + jcharArray=jarray; + jshortArray=jarray; + jintArray=jarray; + jlongArray=jarray; + jfloatArray=jarray; + jdoubleArray=jarray; + jthrowable=jobject; + jweak=jobject; + jref=jobject; + + PPointer=^pointer; + Pjobject=^jobject; + Pjclass=^jclass; + Pjstring=^jstring; + Pjarray=^jarray; + PjobjectArray=^jobjectArray; + PjbooleanArray=^jbooleanArray; + PjbyteArray=^jbyteArray; + PjcharArray=^jcharArray; + PjshortArray=^jshortArray; + PjintArray=^jintArray; + PjlongArray=^jlongArray; + PjfloatArray=^jfloatArray; + PjdoubleArray=^jdoubleArray; + Pjthrowable=^jthrowable; + Pjweak=^jweak; + Pjref=^jref; + + _jfieldID=record // opaque structure + end; + jfieldID=^_jfieldID;// field IDs + PjfieldID=^jfieldID; + + _jmethodID=record // opaque structure + end; + jmethodID=^_jmethodID;// method IDs + PjmethodID=^jmethodID; + + PJNIInvokeInterface=^JNIInvokeInterface; + + Pjvalue=^jvalue; + jvalue={$ifdef packedrecords}packed{$endif} record + case integer of + 0:(z:jboolean); + 1:(b:jbyte); + 2:(c:jchar); + 3:(s:jshort); + 4:(i:jint); + 5:(j:jlong); + 6:(f:jfloat); + 7:(d:jdouble); + 8:(l:jobject); + end; + + jobjectRefType=( + JNIInvalidRefType=0, + JNILocalRefType=1, + JNIGlobalRefType=2, + JNIWeakGlobalRefType=3); + + PJNINativeMethod=^JNINativeMethod; + JNINativeMethod={$ifdef packedrecords}packed{$endif} record + name:pchar; + signature:pchar; + fnPtr:pointer; + end; + + PJNINativeInterface=^JNINativeInterface; + + _JNIEnv={$ifdef packedrecords}packed{$endif} record + functions:PJNINativeInterface; + end; + + _JavaVM={$ifdef packedrecords}packed{$endif} record + functions:PJNIInvokeInterface; + end; + + C_JNIEnv=^JNINativeInterface; + JNIEnv=^JNINativeInterface; + JavaVM=^JNIInvokeInterface; + + PPJNIEnv=^PJNIEnv; + PJNIEnv=^JNIEnv; + + PPJavaVM=^PJavaVM; + PJavaVM=^JavaVM; + + JNINativeInterface={$ifdef packedrecords}packed{$endif} record + reserved0:pointer; + reserved1:pointer; + reserved2:pointer; + reserved3:pointer; + + GetVersion:function(Env:PJNIEnv):JInt; jnicall; + DefineClass:function(Env:PJNIEnv;const Name:pchar;Loader:JObject;const Buf:PJByte;Len:JSize):JClass; jnicall; + FindClass:function(Env:PJNIEnv;const Name:pchar):JClass; jnicall; + + // Reflection Support + FromReflectedMethod:function(Env:PJNIEnv;Method:JObject):JMethodID; jnicall; + FromReflectedField:function(Env:PJNIEnv;Field:JObject):JFieldID; jnicall; + ToReflectedMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;IsStatic:JBoolean):JObject; jnicall; + + GetSuperclass:function(Env:PJNIEnv;Sub:JClass):JClass; jnicall; + IsAssignableFrom:function(Env:PJNIEnv;Sub:JClass;Sup:JClass):JBoolean; jnicall; + + // Reflection Support + ToReflectedField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;IsStatic:JBoolean):JObject; jnicall; + + Throw:function(Env:PJNIEnv;Obj:JThrowable):JInt; jnicall; + ThrowNew:function(Env:PJNIEnv;AClass:JClass;const Msg:pchar):JInt; jnicall; + ExceptionOccurred:function(Env:PJNIEnv):JThrowable; jnicall; + ExceptionDescribe:procedure(Env:PJNIEnv); jnicall; + ExceptionClear:procedure(Env:PJNIEnv); jnicall; + FatalError:procedure(Env:PJNIEnv;const Msg:pchar); jnicall; + + // Local Reference Management + PushLocalFrame:function(Env:PJNIEnv;Capacity:JInt):JInt; jnicall; + PopLocalFrame:function(Env:PJNIEnv;Result:JObject):JObject; jnicall; + + NewGlobalRef:function(Env:PJNIEnv;LObj:JObject):JObject; jnicall; + DeleteGlobalRef:procedure(Env:PJNIEnv;GRef:JObject); jnicall; + DeleteLocalRef:procedure(Env:PJNIEnv;Obj:JObject); jnicall; + IsSameObject:function(Env:PJNIEnv;Obj1:JObject;Obj2:JObject):JBoolean; jnicall; + + // Local Reference Management + NewLocalRef:function(Env:PJNIEnv;Ref:JObject):JObject; jnicall; + EnsureLocalCapacity:function(Env:PJNIEnv;Capacity:JInt):JObject; jnicall; + + AllocObject:function(Env:PJNIEnv;AClass:JClass):JObject; jnicall; + NewObject:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JObject; jnicall; + NewObjectV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject; jnicall; + NewObjectA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject; jnicall; + + GetObjectClass:function(Env:PJNIEnv;Obj:JObject):JClass; jnicall; + IsInstanceOf:function(Env:PJNIEnv;Obj:JObject;AClass:JClass):JBoolean; jnicall; + + GetMethodID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JMethodID; jnicall; + + CallObjectMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JObject; jnicall; + CallObjectMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JObject; jnicall; + CallObjectMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JObject; jnicall; + + CallBooleanMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JBoolean; jnicall; + CallBooleanMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JBoolean; jnicall; + CallBooleanMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JBoolean; jnicall; + + CallByteMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JByte; jnicall; + CallByteMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JByte; jnicall; + CallByteMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JByte; jnicall; + + CallCharMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JChar; jnicall; + CallCharMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JChar; jnicall; + CallCharMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JChar; jnicall; + + CallShortMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JShort; jnicall; + CallShortMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JShort; jnicall; + CallShortMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JShort; jnicall; + + CallIntMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JInt; jnicall; + CallIntMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JInt; jnicall; + CallIntMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JInt; jnicall; + + CallLongMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JLong; jnicall; + CallLongMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JLong; jnicall; + CallLongMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JLong; jnicall; + + CallFloatMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JFloat; jnicall; + CallFloatMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JFloat; jnicall; + CallFloatMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JFloat; jnicall; + + CallDoubleMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JDouble; jnicall; + CallDoubleMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JDouble; jnicall; + CallDoubleMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JDouble; jnicall; + + CallVoidMethod:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID); jnicall; + CallVoidMethodV:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list); jnicall; + CallVoidMethodA:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue); jnicall; + + CallNonvirtualObjectMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JObject; jnicall; + CallNonvirtualObjectMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject; jnicall; + CallNonvirtualObjectMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject; jnicall; + + CallNonvirtualBooleanMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JBoolean; jnicall; + CallNonvirtualBooleanMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JBoolean; jnicall; + CallNonvirtualBooleanMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JBoolean; jnicall; + + CallNonvirtualByteMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JByte; jnicall; + CallNonvirtualByteMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JByte; jnicall; + CallNonvirtualByteMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JByte; jnicall; + + CallNonvirtualCharMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JChar; jnicall; + CallNonvirtualCharMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JChar; jnicall; + CallNonvirtualCharMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JChar; jnicall; + + CallNonvirtualShortMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JShort; jnicall; + CallNonvirtualShortMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JShort; jnicall; + CallNonvirtualShortMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JShort; jnicall; + + CallNonvirtualIntMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JInt; jnicall; + CallNonvirtualIntMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JInt; jnicall; + CallNonvirtualIntMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JInt; jnicall; + + CallNonvirtualLongMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JLong; jnicall; + CallNonvirtualLongMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JLong; jnicall; + CallNonvirtualLongMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JLong; jnicall; + + CallNonvirtualFloatMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JFloat; jnicall; + CallNonvirtualFloatMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JFloat; jnicall; + CallNonvirtualFloatMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JFloat; jnicall; + + CallNonvirtualDoubleMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JDouble; jnicall; + CallNonvirtualDoubleMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JDouble; jnicall; + CallNonvirtualDoubleMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JDouble; jnicall; + + CallNonvirtualVoidMethod:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID); jnicall; + CallNonvirtualVoidMethodV:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list); jnicall; + CallNonvirtualVoidMethodA:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue); jnicall; + + GetFieldID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JFieldID; jnicall; + + GetObjectField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JObject; jnicall; + GetBooleanField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JBoolean; jnicall; + GetByteField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JByte; jnicall; + GetCharField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JChar; jnicall; + GetShortField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JShort; jnicall; + GetIntField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JInt; jnicall; + GetLongField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JLong; jnicall; + GetFloatField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JFloat; jnicall; + GetDoubleField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JDouble; jnicall; + + SetObjectField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JObject); jnicall; + SetBooleanField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JBoolean); jnicall; + SetByteField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JByte); jnicall; + SetCharField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JChar); jnicall; + SetShortField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JShort); jnicall; + SetIntField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JInt); jnicall; + SetLongField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JLong); jnicall; + SetFloatField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JFloat); jnicall; + SetDoubleField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JDouble); jnicall; + + GetStaticMethodID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JMethodID; jnicall; + + CallStaticObjectMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JObject; jnicall; + CallStaticObjectMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject; jnicall; + CallStaticObjectMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject; jnicall; + + CallStaticBooleanMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JBoolean; jnicall; + CallStaticBooleanMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JBoolean; jnicall; + CallStaticBooleanMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JBoolean; jnicall; + + CallStaticByteMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JByte; jnicall; + CallStaticByteMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JByte; jnicall; + CallStaticByteMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JByte; jnicall; + + CallStaticCharMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JChar; jnicall; + CallStaticCharMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JChar; jnicall; + CallStaticCharMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JChar; jnicall; + + CallStaticShortMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JShort; jnicall; + CallStaticShortMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JShort; jnicall; + CallStaticShortMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JShort; jnicall; + + CallStaticIntMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JInt; jnicall; + CallStaticIntMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JInt; jnicall; + CallStaticIntMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JInt; jnicall; + + CallStaticLongMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JLong; jnicall; + CallStaticLongMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JLong; jnicall; + CallStaticLongMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JLong; jnicall; + + CallStaticFloatMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JFloat; jnicall; + CallStaticFloatMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JFloat; jnicall; + CallStaticFloatMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JFloat; jnicall; + + CallStaticDoubleMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JDouble; jnicall; + CallStaticDoubleMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JDouble; jnicall; + CallStaticDoubleMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JDouble; jnicall; + + CallStaticVoidMethod:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID); jnicall; + CallStaticVoidMethodV:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list); jnicall; + CallStaticVoidMethodA:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue); jnicall; + + GetStaticFieldID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JFieldID; jnicall; + GetStaticObjectField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JObject; jnicall; + GetStaticBooleanField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JBoolean; jnicall; + GetStaticByteField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JByte; jnicall; + GetStaticCharField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JChar; jnicall; + GetStaticShortField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JShort; jnicall; + GetStaticIntField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JInt; jnicall; + GetStaticLongField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JLong; jnicall; + GetStaticFloatField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JFloat; jnicall; + GetStaticDoubleField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JDouble; jnicall; + + SetStaticObjectField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JObject); jnicall; + SetStaticBooleanField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JBoolean); jnicall; + SetStaticByteField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JByte); jnicall; + SetStaticCharField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JChar); jnicall; + SetStaticShortField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JShort); jnicall; + SetStaticIntField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JInt); jnicall; + SetStaticLongField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JLong); jnicall; + SetStaticFloatField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JFloat); jnicall; + SetStaticDoubleField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JDouble); jnicall; + + NewString:function(Env:PJNIEnv;const Unicode:PJChar;Len:JSize):JString; jnicall; + GetStringLength:function(Env:PJNIEnv;Str:JString):JSize; jnicall; + GetStringChars:function(Env:PJNIEnv;Str:JString;IsCopy:PJBoolean):PJChar; jnicall; + ReleaseStringChars:procedure(Env:PJNIEnv;Str:JString;const Chars:PJChar); jnicall; + + NewStringUTF:function(Env:PJNIEnv;const UTF:pchar):JString; jnicall; + GetStringUTFLength:function(Env:PJNIEnv;Str:JString):JSize; jnicall; + GetStringUTFChars:function(Env:PJNIEnv;Str:JString;IsCopy:PJBoolean):pchar; jnicall; + ReleaseStringUTFChars:procedure(Env:PJNIEnv;Str:JString;const Chars:pchar); jnicall; + + GetArrayLength:function(Env:PJNIEnv;AArray:JArray):JSize; jnicall; + + NewObjectArray:function(Env:PJNIEnv;Len:JSize;AClass:JClass;Init:JObject):JObjectArray; jnicall; + GetObjectArrayElement:function(Env:PJNIEnv;AArray:JObjectArray;Index:JSize):JObject; jnicall; + SetObjectArrayElement:procedure(Env:PJNIEnv;AArray:JObjectArray;Index:JSize;Val:JObject); jnicall; + + NewBooleanArray:function(Env:PJNIEnv;Len:JSize):JBooleanArray; jnicall; + NewByteArray:function(Env:PJNIEnv;Len:JSize):JByteArray; jnicall; + NewCharArray:function(Env:PJNIEnv;Len:JSize):JCharArray; jnicall; + NewShortArray:function(Env:PJNIEnv;Len:JSize):JShortArray; jnicall; + NewIntArray:function(Env:PJNIEnv;Len:JSize):JIntArray; jnicall; + NewLongArray:function(Env:PJNIEnv;Len:JSize):JLongArray; jnicall; + NewFloatArray:function(Env:PJNIEnv;Len:JSize):JFloatArray; jnicall; + NewDoubleArray:function(Env:PJNIEnv;Len:JSize):JDoubleArray; jnicall; + + GetBooleanArrayElements:function(Env:PJNIEnv;AArray:JBooleanArray;IsCopy:PJBoolean):PJBoolean; jnicall; + GetByteArrayElements:function(Env:PJNIEnv;AArray:JByteArray;IsCopy:PJBoolean):PJByte; jnicall; + GetCharArrayElements:function(Env:PJNIEnv;AArray:JCharArray;IsCopy:PJBoolean):PJChar; jnicall; + GetShortArrayElements:function(Env:PJNIEnv;AArray:JShortArray;IsCopy:PJBoolean):PJShort; jnicall; + GetIntArrayElements:function(Env:PJNIEnv;AArray:JIntArray;IsCopy:PJBoolean):PJInt; jnicall; + GetLongArrayElements:function(Env:PJNIEnv;AArray:JLongArray;IsCopy:PJBoolean):PJLong; jnicall; + GetFloatArrayElements:function(Env:PJNIEnv;AArray:JFloatArray;IsCopy:PJBoolean):PJFloat; jnicall; + GetDoubleArrayElements:function(Env:PJNIEnv;AArray:JDoubleArray;IsCopy:PJBoolean):PJDouble; jnicall; + + ReleaseBooleanArrayElements:procedure(Env:PJNIEnv;AArray:JBooleanArray;Elems:PJBoolean;Mode:JInt); jnicall; + ReleaseByteArrayElements:procedure(Env:PJNIEnv;AArray:JByteArray;Elems:PJByte;Mode:JInt); jnicall; + ReleaseCharArrayElements:procedure(Env:PJNIEnv;AArray:JCharArray;Elems:PJChar;Mode:JInt); jnicall; + ReleaseShortArrayElements:procedure(Env:PJNIEnv;AArray:JShortArray;Elems:PJShort;Mode:JInt); jnicall; + ReleaseIntArrayElements:procedure(Env:PJNIEnv;AArray:JIntArray;Elems:PJInt;Mode:JInt); jnicall; + ReleaseLongArrayElements:procedure(Env:PJNIEnv;AArray:JLongArray;Elems:PJLong;Mode:JInt); jnicall; + ReleaseFloatArrayElements:procedure(Env:PJNIEnv;AArray:JFloatArray;Elems:PJFloat;Mode:JInt); jnicall; + ReleaseDoubleArrayElements:procedure(Env:PJNIEnv;AArray:JDoubleArray;Elems:PJDouble;Mode:JInt); jnicall; + + GetBooleanArrayRegion:procedure(Env:PJNIEnv;AArray:JBooleanArray;Start:JSize;Len:JSize;Buf:PJBoolean); jnicall; + GetByteArrayRegion:procedure(Env:PJNIEnv;AArray:JByteArray;Start:JSize;Len:JSize;Buf:PJByte); jnicall; + GetCharArrayRegion:procedure(Env:PJNIEnv;AArray:JCharArray;Start:JSize;Len:JSize;Buf:PJChar); jnicall; + GetShortArrayRegion:procedure(Env:PJNIEnv;AArray:JShortArray;Start:JSize;Len:JSize;Buf:PJShort); jnicall; + GetIntArrayRegion:procedure(Env:PJNIEnv;AArray:JIntArray;Start:JSize;Len:JSize;Buf:PJInt); jnicall; + GetLongArrayRegion:procedure(Env:PJNIEnv;AArray:JLongArray;Start:JSize;Len:JSize;Buf:PJLong); jnicall; + GetFloatArrayRegion:procedure(Env:PJNIEnv;AArray:JFloatArray;Start:JSize;Len:JSize;Buf:PJFloat); jnicall; + GetDoubleArrayRegion:procedure(Env:PJNIEnv;AArray:JDoubleArray;Start:JSize;Len:JSize;Buf:PJDouble); jnicall; + + SetBooleanArrayRegion:procedure(Env:PJNIEnv;AArray:JBooleanArray;Start:JSize;Len:JSize;Buf:PJBoolean); jnicall; + SetByteArrayRegion:procedure(Env:PJNIEnv;AArray:JByteArray;Start:JSize;Len:JSize;Buf:PJByte); jnicall; + SetCharArrayRegion:procedure(Env:PJNIEnv;AArray:JCharArray;Start:JSize;Len:JSize;Buf:PJChar); jnicall; + SetShortArrayRegion:procedure(Env:PJNIEnv;AArray:JShortArray;Start:JSize;Len:JSize;Buf:PJShort); jnicall; + SetIntArrayRegion:procedure(Env:PJNIEnv;AArray:JIntArray;Start:JSize;Len:JSize;Buf:PJInt); jnicall; + SetLongArrayRegion:procedure(Env:PJNIEnv;AArray:JLongArray;Start:JSize;Len:JSize;Buf:PJLong); jnicall; + SetFloatArrayRegion:procedure(Env:PJNIEnv;AArray:JFloatArray;Start:JSize;Len:JSize;Buf:PJFloat); jnicall; + SetDoubleArrayRegion:procedure(Env:PJNIEnv;AArray:JDoubleArray;Start:JSize;Len:JSize;Buf:PJDouble); jnicall; + + RegisterNatives:function(Env:PJNIEnv;AClass:JClass;const Methods:PJNINativeMethod;NMethods:JInt):JInt; jnicall; + UnregisterNatives:function(Env:PJNIEnv;AClass:JClass):JInt; jnicall; + + MonitorEnter:function(Env:PJNIEnv;Obj:JObject):JInt; jnicall; + MonitorExit:function(Env:PJNIEnv;Obj:JObject):JInt; jnicall; + + GetJavaVM:function(Env:PJNIEnv;VM:PJavaVM):JInt; jnicall; + + // String Operations + GetStringRegion:procedure(Env:PJNIEnv;Str:JString;Start:JSize;Len:JSize;Buf:PJChar); jnicall; + GetStringUTFRegion:procedure(Env:PJNIEnv;Str:JString;Start:JSize;Len:JSize;Buf:pchar); jnicall; + + // Array Operations + GetPrimitiveArrayCritical:function(Env:PJNIEnv;AArray:JArray;IsCopy:PJBoolean):pointer; jnicall; + ReleasePrimitiveArrayCritical:procedure(Env:PJNIEnv;AArray:JArray;CArray:pointer;Mode:JInt); jnicall; + + // String Operations + GetStringCritical:function(Env:PJNIEnv;Str:JString;IsCopy:PJBoolean):PJChar; jnicall; + ReleaseStringCritical:procedure(Env:PJNIEnv;Str:JString;CString:PJChar); jnicall; + + // Weak Global References + NewWeakGlobalRef:function(Env:PJNIEnv;Obj:JObject):JWeak; jnicall; + DeleteWeakGlobalRef:procedure(Env:PJNIEnv;Ref:JWeak); jnicall; + + // Exceptions + ExceptionCheck:function(Env:PJNIEnv):JBoolean; jnicall; + + // J2SDK1_4 + NewDirectByteBuffer:function(Env:PJNIEnv;Address:pointer;Capacity:JLong):JObject; jnicall; + GetDirectBufferAddress:function(Env:PJNIEnv;Buf:JObject):pointer; jnicall; + GetDirectBufferCapacity:function(Env:PJNIEnv;Buf:JObject):JLong; jnicall; + + // added in JNI 1.6 + GetObjectRefType:function(Env:PJNIEnv;AObject:JObject):jobjectRefType; jnicall; + end; + + JNIInvokeInterface={$ifdef packedrecords}packed{$endif} record + reserved0:pointer; + reserved1:pointer; + reserved2:pointer; + + DestroyJavaVM:function(PVM:PJavaVM):JInt; jnicall; + AttachCurrentThread:function(PVM:PJavaVM;PEnv:PPJNIEnv;Args:pointer):JInt; jnicall; + DetachCurrentThread:function(PVM:PJavaVM):JInt; jnicall; + GetEnv:function(PVM:PJavaVM;PEnv:Ppointer;Version:JInt):JInt; jnicall; + AttachCurrentThreadAsDaemon:function(PVM:PJavaVM;PEnv:PPJNIEnv;Args:pointer):JInt; jnicall; + end; + + JavaVMAttachArgs={$ifdef packedrecords}packed{$endif} record + version:jint; // must be >= JNI_VERSION_1_2 + name:pchar; // NULL or name of thread as modified UTF-8 str + group:jobject; // global ref of a ThreadGroup object, or NULL + end; + +(** + * JNI 1.2+ initialization. (As of 1.6, the pre-1.2 structures are no + * longer supported.) + *) + + PJavaVMOption=^JavaVMOption; + JavaVMOption={$ifdef packedrecords}packed{$endif} record + optionString:pchar; + extraInfo:pointer; + end; + + JavaVMInitArgs={$ifdef packedrecords}packed{$endif} record + version:jint; // use JNI_VERSION_1_2 or later + nOptions:jint; + options:PJavaVMOption; + ignoreUnrecognized:Pjboolean; + end; + +(* + * VM initialization functions. + * + * Note these are the only symbols exported for JNI by the VM. + *) +{$ifdef jniexternals} +function JNI_GetDefaultJavaVMInitArgs(p:pointer):jint; jnicall;external 'jni' name 'JNI_GetDefaultJavaVMInitArgs'; +function JNI_CreateJavaVM(vm:PPJavaVM;AEnv:PPJNIEnv;p:pointer):jint; jnicall;external 'jni' name 'JNI_CreateJavaVM'; +function JNI_GetCreatedJavaVMs(vm:PPJavaVM;ASize:jsize;p:Pjsize):jint; jnicall;external 'jni' name 'JNI_GetCreatedJavaVMs'; +{$endif} + +(* + * Prototypes for functions exported by loadable shared libs. These are + * called by JNI, not provided by JNI. + *) + +const curVM:PJavaVM=nil; + curEnv:PJNIEnv=nil; + +(* +function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint; jnicall; +procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer); jnicall; +*) + +(* Helper Routines *) +function JNI_JStringToString( PEnv : PJNIEnv; JStr : JString ) : string; +function JNI_StringToJString( PEnv : PJNIEnv; const AString : PAnsiChar ) : JString; + +implementation + +function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint; jnicall; +begin + curVM:=vm; + result:=JNI_VERSION_1_6; +end; + +procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer); jnicall; +begin +end; + +function JNI_JStringToString( PEnv : PJNIEnv; JStr : JString ) : string; +var + IsCopy: PJBoolean; + Chars: PAnsiChar; +begin + if JStr = nil then + begin + Result := ''; + Exit; + end; + + Chars := PEnv^.GetStringUTFChars(PEnv, JStr, IsCopy); + if Chars = nil then + Result := '' + else + begin + Result := string(Chars); + PEnv^.ReleaseStringUTFChars(PEnv, JStr, Chars); + end; +end; + +function JNI_StringToJString( PEnv : PJNIEnv; const AString : PAnsiChar ) : JString; +begin + Result := PEnv^.NewStringUTF( PEnv, PAnsiChar( AString ) ); +end; + +end. diff --git a/UOS/examples/uos_libsndfile.pas b/UOS/examples/uos_libsndfile.pas new file mode 100644 index 0000000..5f1eba4 --- /dev/null +++ b/UOS/examples/uos_libsndfile.pas @@ -0,0 +1,785 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading version with reference counting of LibSndFile.pas. + Load the library with sf_load() and release with sf_unload(). + Thanks to Phoenix for sf_open_virtual (TMemoryStream as input) + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com } + +unit uos_libsndfile; + +{$IFDEF FPC} + {$mode objfpc}{$H+} + {$PACKENUM 4}(* use 4-byte enums *) + {$PACKRECORDS C}(* C/C++-compatible record packing *) + {$MACRO ON}//don't know whatfor ! +{$ELSE} + {$MINENUMSIZE 4}(* use 4-byte enums *) +{** MINENUMSIZE is equivalent to Z+} +{$ENDIF} + +{$LONGSTRINGS ON} +{** LONGSTRINGS is equivalent to H+} + +interface + +uses + dynlibs, classes, + ctypes; + +const +libsf= + {$IFDEF unix} + {$IFDEF darwin} + 'libsndfile.1.dylib'; + {$ELSE} + 'libsndfile.so.1'; + {$ENDIF} + {$ELSE} + 'sndfile.dll'; + {$ENDIF} + +type + PMemoryStream = ^TMemoryStream; + +type + {$IF Defined(MSWINDOWS)} + off_t = int64; + {$ELSE} + off_t = clonglong; + size_t = culong; + {$ENDIF} + +const + //* Major formats. *// + SF_FORMAT_WAV = $010000; // Microsoft WAV format (little endian default). + SF_FORMAT_AIFF = $020000; // Apple/SGI AIFF format (big endian). + SF_FORMAT_AU = $030000; // Sun/NeXT AU format (big endian). + SF_FORMAT_RAW = $040000; // RAW PCM data. + SF_FORMAT_PAF = $050000; // Ensoniq PARIS file format. + SF_FORMAT_SVX = $060000; // Amiga IFF / SVX8 / SV16 format. + SF_FORMAT_NIST = $070000; // Sphere NIST format. + SF_FORMAT_VOC = $080000; // VOC files. + SF_FORMAT_IRCAM = $0A0000; // Berkeley/IRCAM/CARL + SF_FORMAT_W64 = $0B0000; // Sonic Foundry's 64 bit RIFF/WAV + SF_FORMAT_MAT4 = $0C0000; // Matlab (tm) V4.2 / GNU Octave 2.0 + SF_FORMAT_MAT5 = $0D0000; // Matlab (tm) V5.0 / GNU Octave 2.1 + SF_FORMAT_PVF = $0E0000; // Portable Voice Format + SF_FORMAT_XI = $0F0000; // Fasttracker 2 Extended Instrument + SF_FORMAT_HTK = $100000; // HMM Tool Kit format + SF_FORMAT_SDS = $110000; // Midi Sample Dump Standard + SF_FORMAT_AVR = $120000; // Audio Visual Research + SF_FORMAT_WAVEX = $130000; // MS WAVE with WAVEFORMATEX + SF_FORMAT_SD2 = $160000; // Sound Designer 2 + SF_FORMAT_FLAC = $170000; // FLAC lossless file format + SF_FORMAT_CAF = $180000; // Core Audio File format + SF_FORMAT_OGG = $200000; // Xiph OGG container + + +const + //Subtypes from here on. + SF_FORMAT_PCM_S8 = $0001; // Signed 8 bit data + SF_FORMAT_PCM_16 = $0002; // Signed 16 bit data + SF_FORMAT_PCM_24 = $0003; // Signed 24 bit data + SF_FORMAT_PCM_32 = $0004; // Signed 32 bit data + + SF_FORMAT_PCM_U8 = $0005; // Unsigned 8 bit data (WAV and RAW only) + + SF_FORMAT_FLOAT = $0006; // 32 bit float data + SF_FORMAT_DOUBLE = $0007; // 64 bit float data + + SF_FORMAT_ULAW = $0010; // U-Law encoded. + SF_FORMAT_ALAW = $0011; // A-Law encoded. + SF_FORMAT_IMA_ADPCM = $0012; // IMA ADPCM. + SF_FORMAT_MS_ADPCM = $0013; // Microsoft ADPCM. + + SF_FORMAT_GSM610 = $0020; // GSM 6.10 encoding. + SF_FORMAT_VOX_ADPCM = $0021; // OKI / Dialogix ADPCM + + SF_FORMAT_G721_32 = $0030; // 32kbs G721 ADPCM encoding. + SF_FORMAT_G723_24 = $0031; // 24kbs G723 ADPCM encoding. + SF_FORMAT_G723_40 = $0032; // 40kbs G723 ADPCM encoding. + + SF_FORMAT_DWVW_12 = $0040; // 12 bit Delta Width Variable Word encoding. + SF_FORMAT_DWVW_16 = $0041; // 16 bit Delta Width Variable Word encoding. + SF_FORMAT_DWVW_24 = $0042; // 24 bit Delta Width Variable Word encoding. + SF_FORMAT_DWVW_N = $0043; // N bit Delta Width Variable Word encoding. + + SF_FORMAT_DPCM_8 = $0050; // 8 bit differential PCM (XI only) + SF_FORMAT_DPCM_16 = $0051; // 16 bit differential PCM (XI only) + + SF_FORMAT_VORBIS = $0060; // Xiph Vorbis encoding. + + +const + //* Endian-ness options. *// + SF_ENDIAN_FILE = $00000000; // Default file endian-ness. + SF_ENDIAN_LITTLE = $10000000; // Force little endian-ness. + SF_ENDIAN_BIG = $20000000; // Force big endian-ness. + SF_ENDIAN_CPU = $30000000; // Force CPU endian-ness. + + SF_FORMAT_SUBMASK = $0000FFFF; + SF_FORMAT_TYPEMASK = $0FFF0000; + SF_FORMAT_ENDMASK = $30000000; + +{ +** The following are the valid command numbers for the sf_command() +** interface. The use of these commands is documented in the file +** command.html in the doc directory of the source code distribution. +} +const + SFC_GET_LIB_VERSION = $1000; + SFC_GET_LOG_INFO = $1001; + + SFC_GET_NORM_DOUBLE = $1010; + SFC_GET_NORM_FLOAT = $1011; + SFC_SET_NORM_DOUBLE = $1012; + SFC_SET_NORM_FLOAT = $1013; + SFC_SET_SCALE_FLOAT_INT_READ = $1014; + + SFC_GET_SIMPLE_FORMAT_COUNT = $1020; + SFC_GET_SIMPLE_FORMAT = $1021; + + SFC_GET_FORMAT_INFO = $1028; + + SFC_GET_FORMAT_MAJOR_COUNT = $1030; + SFC_GET_FORMAT_MAJOR = $1031; + SFC_GET_FORMAT_SUBTYPE_COUNT = $1032; + SFC_GET_FORMAT_SUBTYPE = $1033; + + SFC_CALC_SIGNAL_MAX = $1040; + SFC_CALC_NORM_SIGNAL_MAX = $1041; + SFC_CALC_MAX_ALL_CHANNELS = $1042; + SFC_CALC_NORM_MAX_ALL_CHANNELS = $1043; + SFC_GET_SIGNAL_MAX = $1044; + SFC_GET_MAX_ALL_CHANNELS = $1045; + + SFC_SET_ADD_PEAK_CHUNK = $1050; + + SFC_UPDATE_HEADER_NOW = $1060; + SFC_SET_UPDATE_HEADER_AUTO = $1061; + + SFC_FILE_TRUNCATE = $1080; + + SFC_SET_RAW_START_OFFSET = $1090; + + SFC_SET_DITHER_ON_WRITE = $10A0; + SFC_SET_DITHER_ON_READ = $10A1; + + SFC_GET_DITHER_INFO_COUNT = $10A2; + SFC_GET_DITHER_INFO = $10A3; + + SFC_GET_EMBED_FILE_INFO = $10B0; + + SFC_SET_CLIPPING = $10C0; + SFC_GET_CLIPPING = $10C1; + + SFC_GET_INSTRUMENT = $10D0; + SFC_SET_INSTRUMENT = $10D1; + + SFC_GET_LOOP_INFO = $10E0; + + SFC_GET_BROADCAST_INFO = $10F0; + SFC_SET_BROADCAST_INFO = $10F1; + + // Following commands for testing only. + SFC_TEST_IEEE_FLOAT_REPLACE = $6001; + + { + ** SFC_SET_ADD_* values are deprecated and will disappear at some + ** time in the future. They are guaranteed to be here up to and + ** including version 1.0.8 to avoid breakage of existing software. + ** They currently do nothing and will continue to do nothing. + } + SFC_SET_ADD_DITHER_ON_WRITE = $1070; + SFC_SET_ADD_DITHER_ON_READ = $1071; + +{ +** String types that can be set and read from files. Not all file types +** support this and even the file types which support one, may not support +** all string types. +} +const + SF_STR_TITLE = $01; + SF_STR_COPYRIGHT = $02; + SF_STR_SOFTWARE = $03; + SF_STR_ARTIST = $04; + SF_STR_COMMENT = $05; + SF_STR_DATE = $06; + SF_STR_ALBUM = $07; + SF_STR_LICENSE = $08; + SF_STR_TRACKNUMBER = $09; + SF_STR_GENRE = $10; + +{ +** Use the following as the start and end index when doing metadata +** transcoding. +} + SF_STR_FIRST = SF_STR_TITLE; + SF_STR_LAST = SF_STR_GENRE; + +const + // True and false + SF_FALSE = 0; + SF_TRUE = 1; + +const + // Modes for opening files. + SFM_READ = $10; + SFM_WRITE = $20; + SFM_RDWR = $30; + +{ +** Public error values. These are guaranteed to remain unchanged +** for the duration of the library major version number. +** There are also a large number of private error numbers which are +** internal to the library which can change at any time. +} +const + SF_ERR_NO_ERROR = 0; + SF_ERR_UNRECOGNISED_FORMAT = 1; + SF_ERR_SYSTEM = 2; + SF_ERR_MALFORMED_FILE = 3; + SF_ERR_UNSUPPORTED_ENCODING = 4; + +//A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. + +type + TSNDFILE_HANDLE = pointer; // this is not a usual pointer, more like a THandle .. +// so NOT called "PSndFile_handle" +// => we never access members of the internal +// structure where the pointer points to ! +// Everything is managed by the DLL internally !!! +//PSNDFILE_tag = PSNDFILE; + + { +** The following typedef is system specific and is defined when libsndfile is. +** compiled. uos_count_t can be one of loff_t (Linux), off_t (*BSD), +** off64_t (Solaris), __int64_t (Win32) etc. +} +type + Puos_count_t = ^Tuos_count_t; + Tuos_count_t = off_t; + +const + SF_COUNT_MAX = ctypes.clonglong($7FFFFFFFFFFFFFFF); + +{ +** A pointer to a SF_INFO structure is passed to sf_open_read () and filled in. +** On write, the SF_INFO structure is filled in by the user and passed into +** sf_open_write (). +} + +type + PSF_INFO = ^TSF_INFO; + + TSF_INFO = record + frames: Tuos_count_t; + // Used to be called samples. Changed to avoid confusion. + samplerate: ctypes.cint; + channels: ctypes.cint; + format: ctypes.cint; + sections: ctypes.cint; + seekable: ctypes.cint; + end; + +{ +** The SF_FORMAT_INFO struct is used to retrieve information about the sound +** file formats libsndfile supports using the sf_command () interface. +** +** Using this interface will allow applications to support new file formats +** and encoding types when libsndfile is upgraded, without requiring +** re-compilation of the application. +** +** Please consult the libsndfile documentation (particularly the information +** on the sf_command () interface) for examples of its use. +} + +type + PSF_FORMAT_INFO = ^TSF_FORMAT_INFO; + + TSF_FORMAT_INFO = record + format: ctypes.cint; + Name: ctypes.pcchar; + extention: ctypes.pcchar; + end; + +{ +** Enums and typedefs for adding dither on read and write. +** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE +** and SFC_SET_DITHER_ON_READ. +} +const + SFD_DEFAULT_LEVEL = 0; + SFD_CUSTOM_LEVEL = $40000000; + + SFD_NO_DITHER = 500; + SFD_WHITE = 501; + SFD_TRIANGULAR_PDF = 502; + +type + PSF_DITHER_INFO = ^TSF_DITHER_INFO; + + TSF_DITHER_INFO = record + type_: ctypes.cint; + level: ctypes.cdouble; + Name: ctypes.pcchar; + end; + +{ +** Struct used to retrieve information about a file embedded within a +** larger file. See SFC_GET_EMBED_FILE_INFO. +} +type + PSF_EMBED_FILE_INFO = ^TSF_EMBED_FILE_INFO; + + TSF_EMBED_FILE_INFO = record + offset: Tuos_count_t; + length: Tuos_count_t; + end; + +// Structs used to retrieve music sample information from a file. + +const + // The loop mode field in SF_INSTRUMENT will be one of the following. + SF_LOOP_NONE = 800; + SF_LOOP_FORWARD = 801; + SF_LOOP_BACKWARD = 802; + SF_LOOP_ALTERNATING = 803; + +type + PSF_INSTRUMENT = ^TSF_INSTRUMENT; + + TSF_INSTRUMENT = record + gain: ctypes.cint; + basenote, + detune: ctypes.cchar; + velocity_lo, + velocity_hi: ctypes.cchar; + loop_count: ctypes.cint; + loops: array[0..15] of record + mode: ctypes.cint; + start: ctypes.cuint; + end_: ctypes.cuint; + Count: ctypes.cuint; + end; + end; + +// Struct used to retrieve loop information from a file. +type + PSF_LOOP_INFO = ^TSF_LOOP_INFO; + + TSF_LOOP_INFO = record + time_sig_num: ctypes.cushort; + // any positive integer > 0 + time_sig_den: ctypes.cushort; + // any positive power of 2 > 0 + loop_mode: ctypes.cint; // see SF_LOOP enum + + num_beats: ctypes.cint; + // this is NOT the amount of quarter notes !!! + // a full bar of 4/4 is 4 beats + // a full bar of 7/8 is 7 beats + + bpm: ctypes.cfloat; + // suggestion, as it can be calculated using other fields: + // file's lenght, file's sampleRate and our time_sig_den + // -> bpms are always the amount of _quarter notes_ per minute + + root_key: ctypes.cint; + // MIDI note, or -1 for None + future: array[0..5] of ctypes.cint; + end; + + +{ +** Struct used to retrieve broadcast (EBU) information from a file. +** Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE. +} +type + PSF_BROADCAST_INFO = ^TSF_BROADCAST_INFO; + + TSF_BROADCAST_INFO = record + description: array[0..255] of char;//ctypes.cchar; + originator: array[0..31] of char;//ctypes.cchar; + originator_reference: array[0..31] of char;//ctypes.cchar; + origination_date: array[0..9] of char;//ctypes.cchar; + origination_time: array[0..7] of char;//ctypes.cchar; + time_reference_low: ctypes.cuint;//ctypes.cint; + time_reference_high: ctypes.cuint;//ctypes.cint; + version: ctypes.cshort; + umid: array[0..63] of char;//ctypes.cchar; + reserved: array[0..189] of char;//ctypes.cchar; + coding_history_size: ctypes.cuint; + coding_history: array[0..255] of char;//ctypes.cchar; + end; + + // Thanks to Phoenix + type + //pm_get_filelen = ^tm_get_filelen; + tm_get_filelen = + function (pms: PMemoryStream): Tuos_count_t; cdecl; + //pm_seek = ^tm_seek; + tm_seek = + function (offset: Tuos_count_t; whence: cint32; pms: PMemoryStream): Tuos_count_t; cdecl; + //pm_read = ^tm_read; + tm_read = + function (const buf: Pointer; count: Tuos_count_t; pms: PMemoryStream): Tuos_count_t; cdecl; + //pm_write = ^tm_write; + tm_write = + function (const buf: Pointer; count: Tuos_count_t; pms: PMemoryStream): Tuos_count_t; cdecl; + //pm_tell = ^tm_tell; + tm_tell = + function (pms: PMemoryStream): Tuos_count_t; cdecl; + + TSF_VIRTUAL = packed record + sf_vio_get_filelen : tm_get_filelen; + seek : tm_seek; + read : tm_read; + write : tm_write; + tell : tm_tell; + end; + + PSF_VIRTUAL = ^TSF_VIRTUAL; + +{ +** Open the specified file for read, write or both. On error, this will +** return a NULL pointer. To find the error number, pass a NULL SNDFILE +** to sf_perror () or sf_error_str (). +** All calls to sf_open() should be matched with a call to sf_close(). +} +//////////////////////////////////////////////////////////////////////////////////////// + +function sf_open(path: string; mode: ctypes.cint; + var sfinfo: TSF_INFO): TSNDFILE_HANDLE; + +////// Dynamic load : Vars that will hold our dynamically loaded functions.. +var + sf_open_native: function(path: PChar; + mode: ctypes.cint; sfinfo: PSF_INFO): TSNDFILE_HANDLE; cdecl; + +var +sf_version_string: function(): PChar; cdecl; + +var + sf_open_fd: function(fd: ctypes.cint; mode: ctypes.cint; sfinfo: PSF_INFO; + close_desc: ctypes.cint): TSNDFILE_HANDLE; cdecl; + +var + sf_open_virtual: function(sfvirtual: PSF_VIRTUAL; mode: ctypes.cint; + sfinfo: PSF_INFO; user_data: Pointer): TSNDFILE_HANDLE; cdecl; + +var + sf_error: function(sndfile: TSNDFILE_HANDLE): ctypes.cint; cdecl; + +var + sf_strerror: function(sndfile: TSNDFILE_HANDLE): PChar; cdecl; + +var + sf_error_number: function(errnum: ctypes.cint): PChar; cdecl; + +var + sf_perror: function(sndfile: TSNDFILE_HANDLE): ctypes.cint; cdecl; + +var + sf_error_str: function(sndfile: TSNDFILE_HANDLE; + str: ctypes.pcchar; len: size_t): ctypes.cint; cdecl; + +{ + In libsndfile there are 4 functions with the same name (sf_command), 3 of them use the parameter "overload". + In dynamic loading (because of var) we use 4 different names for the 4 functions sf_command : + sf_command_pointer, sf_command_double, sf_command_array, sf_command_tsf. All that 4 functions gonna point + to sf_command in libsndfile library. +} + +var + sf_command_pointer: function(sndfile: TSNDFILE_HANDLE; command: ctypes.cint; + Data: Pointer; datasize: ctypes.cint): ctypes.cint; cdecl; + +var + sf_command_double: function(sndfile: TSNDFILE_HANDLE; command: ctypes.cint; + var Data: double; datasize: ctypes.cint): ctypes.cint; cdecl; + +var + sf_command_array: function(sndfile: TSNDFILE_HANDLE; command: ctypes.cint; + var Data: array of char; datasize: ctypes.cint): ctypes.cint; cdecl; + +var + sf_command_tsf: function(sndfile: TSNDFILE_HANDLE; command: ctypes.cint; + var Data: TSF_BROADCAST_INFO; datasize: ctypes.cint): ctypes.cint; cdecl; + +var + sf_format_check: function(var info: TSF_INFO): ctypes.cint; cdecl; + +{ +** Seek within the waveform data chunk of the SNDFILE. sf_seek () uses +** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as +** stdio.h function fseek (). +** An offset of zero with whence set to SEEK_SET will position the +** read / write pointer to the first data sample. +** On success sf_seek returns the current position in (multi-channel) +** samples from the start of the file. +** Please see the libsndfile documentation for moving the read pointer +** separately from the write pointer on files open in mode SFM_RDWR. +** On error all of these functions return -1. +} + +//the following CONST values originally are NOT in libsndfile.pas: +const + SEEK_SET = 0; //* seek relative to beginning of file */ + +const + SEEK_CUR = 1; //* seek relative to current file position */ + +const + SEEK_END = 2; //* seek relative to end of file */ + +const + SEEK_DATA = 3; //* seek to the next data */ + +const + SEEK_HOLE = 4; //* seek to the next hole */ + +const + SEEK_MAX = SEEK_HOLE; + +var + sf_seek: function(sndfile: TSNDFILE_HANDLE; frame: Tuos_count_t; + whence: ctypes.cint): Tuos_count_t; cdecl; + +{ +** Functions for retrieving and setting string data within sound files. +** Not all file types support this features; AIFF and WAV do. For both +** functions, the str_type parameter must be one of the SF_STR_* values +** defined above. +** On error, sf_set_string() returns non-zero while sf_get_string() +** returns NULL. +} +var + sf_set_string: function(sndfile: TSNDFILE_HANDLE; str_type: ctypes.cint; + str: ctypes.pcchar): ctypes.cint; cdecl; + +var + sf_get_string: function(sndfile: TSNDFILE_HANDLE; + str_type: ctypes.cint): PChar; cdecl; + +var + sf_read_raw: function(sndfile: TSNDFILE_HANDLE; ptr: Pointer; + bytes: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_write_raw: function(sndfile: TSNDFILE_HANDLE; ptr: Pointer; + bytes: Tuos_count_t): Tuos_count_t; cdecl; + +{ +** Functions for reading and writing the data chunk in terms of frames. +** The number of items actually read/written = frames * number of channels. +** sf_xxxx_raw read/writes the raw data bytes from/to the file +** sf_xxxx_short passes data in the native short format +** sf_xxxx_int passes data in the native int format +** sf_xxxx_float passes data in the native float format +** sf_xxxx_double passes data in the native double format +** All of these read/write function return number of frames read/written. +} +var + sf_readf_short: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcshort; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_writef_short: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcshort; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_readf_int: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcint; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_writef_int: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcint; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_readf_float: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcfloat; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_writef_float: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcfloat; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_readf_double: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcdouble; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_writef_double: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcdouble; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +{ +** Functions for reading and writing the data chunk in terms of items. +** Otherwise similar to above. +** All of these read/write function return number of items read/written. +} +var + sf_read_short: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcshort; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_write_short: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcshort; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_read_int: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcint; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_write_int: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcint; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_read_float: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcfloat; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_write_float: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcfloat; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_read_double: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcdouble; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_write_double: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcdouble; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +{ +** Close the SNDFILE and clean up all memory allocations associated +** with this file. +** Returns 0 on success, or an error number. +} +var + sf_close: function(sndfile: TSNDFILE_HANDLE): ctypes.cint; cdecl; + +{ +** If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file +** to force the writing of data to disk. If the file is opened SFM_READ +** no action is taken. +} +var + sf_write_sync: function(sndfile: TSNDFILE_HANDLE): ctypes.cint; cdecl; + +{Special function for dynamic loading of lib ...} + +var + sf_Handle: TLibHandle; +// this will hold our handle for the lib; it functions nicely as a mutli-lib prevention unit as well... + +function sf_Load(const libfilename: string): boolean; // load the lib + +procedure sf_Unload(); +// unload and frees the lib from memory : do not forget to call it before close application. + +function sf_IsLoaded: boolean; + +implementation + +var + ReferenceCounter: cardinal = 0; // Reference counter + +function sf_Load(const libfilename: string): boolean; +var +thelib: string; +begin + Result := False; + if sf_Handle <> 0 then + begin + Result := True {is it already there ?}; + //Reference counting + Inc(ReferenceCounter); + end + else + begin {go & load the library} + if Length(libfilename) = 0 then thelib := libsf else thelib := libfilename; + sf_Handle := DynLibs.SafeLoadLibrary(thelib); // obtain the handle we want + if sf_Handle <> DynLibs.NilHandle then + begin {now we tie the functions to the VARs from above} + + Pointer(sf_version_string) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_version_string')); + Pointer(sf_open_native) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_open')); + Pointer(sf_open_fd) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_open_fd')); + Pointer(sf_open_virtual) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_open_virtual')); + Pointer(sf_error) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_error')); + Pointer(sf_strerror) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_strerror')); + Pointer(sf_error_number) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_error_number')); + Pointer(sf_perror) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_perror')); + Pointer(sf_error_str) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_error_str')); + Pointer(sf_command_pointer) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_command')); + Pointer(sf_command_array) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_command')); + Pointer(sf_command_double) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_command')); + Pointer(sf_command_tsf) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_command')); + Pointer(sf_format_check) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_format_check')); + Pointer(sf_seek) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_seek')); + Pointer(sf_set_string) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_set_string')); + Pointer(sf_get_string) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_get_string')); + Pointer(sf_read_raw) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_read_raw')); + Pointer(sf_write_raw) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_write_raw')); + Pointer(sf_readf_short) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_readf_short')); + Pointer(sf_writef_short) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_writef_short')); + Pointer(sf_readf_int) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_readf_int')); + Pointer(sf_writef_int) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_writef_int')); + Pointer(sf_readf_float) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_readf_float')); + Pointer(sf_writef_float) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_writef_float')); + Pointer(sf_readf_double) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_readf_double')); + Pointer(sf_writef_double) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_writef_double')); + Pointer(sf_read_short) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_read_short')); + Pointer(sf_write_short) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_write_short')); + Pointer(sf_read_int) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_read_int')); + Pointer(sf_write_int) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_write_int')); + Pointer(sf_read_float) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_read_float')); + Pointer(sf_write_float) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_write_float')); + Pointer(sf_read_double) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_read_double')); + Pointer(sf_write_double) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_write_double')); + Pointer(sf_close) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_close')); + Pointer(sf_write_sync) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_write_sync')); + + end; + Result := sf_IsLoaded; + ReferenceCounter := 1; + end; + +end; + +procedure sf_Unload; +begin + // < Reference counting + if ReferenceCounter > 0 then + Dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if sf_IsLoaded then + begin + DynLibs.UnloadLibrary(sf_Handle); + sf_Handle := DynLibs.NilHandle; + end; + +end; + +function sf_open(path: string; mode: ctypes.cint; + var sfinfo: TSF_INFO): TSNDFILE_HANDLE; +begin + Result := sf_open_native(PChar(path), mode, @sfinfo); +end; + +function sf_IsLoaded: boolean; +begin + Result := (sf_Handle <> dynlibs.NilHandle); +end; + +end. diff --git a/UOS/examples/uos_libxmp.pas b/UOS/examples/uos_libxmp.pas new file mode 100644 index 0000000..9754bab --- /dev/null +++ b/UOS/examples/uos_libxmp.pas @@ -0,0 +1,428 @@ +unit uos_libxmp; +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Pascal Wrapper + Dynamic loading of libxmp library. + Load library with xmp_load() and release with xmp_unload(). + License : modified LGPL. + by Fred vS | fiens@hotmail.com | 2024} + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + dynlibs, + sysutils, + CTypes; + +const + XMP_VERSION = '4.6.0'; + XMP_VERCODE = $040600; + XMP_VER_MAJOR = 4; + XMP_VER_MINOR = 6; + XMP_VER_RELEASE = 0; + +const +{$IFDEF windows} + XMP_LIB_NAME = 'libxmp.dll'; +{$ENDIF} + +{$IFDEF unix} + {$IFDEF darwin} + XMP_LIB_NAME = 'libxmp.dylib'; + {$ELSE} + XMP_LIB_NAME = 'libxmp.so.4.6.0'; + {$ENDIF} +{$ENDIF} + +const + XMP_NAME_SIZE = 64; + + // Note event constants + XMP_KEY_OFF = $81; + XMP_KEY_CUT = $82; + XMP_KEY_FADE = $83; + + // Sample format flags + XMP_FORMAT_8BIT = 1 shl 0; + XMP_FORMAT_UNSIGNED = 1 shl 1; + XMP_FORMAT_MONO = 1 shl 2; + + // Player parameters + XMP_PLAYER_AMP = 0; + XMP_PLAYER_MIX = 1; + XMP_PLAYER_INTERP = 2; + XMP_PLAYER_DSP = 3; + XMP_PLAYER_FLAGS = 4; + XMP_PLAYER_CFLAGS = 5; + XMP_PLAYER_SMPCTL = 6; + XMP_PLAYER_VOLUME = 7; + XMP_PLAYER_STATE = 8; + XMP_PLAYER_SMIX_VOLUME = 9; + XMP_PLAYER_DEFPAN = 10; + XMP_PLAYER_MODE = 11; + XMP_PLAYER_MIXER_TYPE = 12; + XMP_PLAYER_VOICES = 13; + + // Interpolation types + XMP_INTERP_NEAREST = 0; + XMP_INTERP_LINEAR = 1; + XMP_INTERP_SPLINE = 2; + + // DSP effect types + XMP_DSP_LOWPASS = 1 shl 0; + XMP_DSP_ALL = XMP_DSP_LOWPASS; + + // Player state + XMP_STATE_UNLOADED = 0; + XMP_STATE_LOADED = 1; + XMP_STATE_PLAYING = 2; + + // Player flags + XMP_FLAGS_VBLANK = 1 shl 0; + XMP_FLAGS_FX9BUG = 1 shl 1; + XMP_FLAGS_FIXLOOP = 1 shl 2; + XMP_FLAGS_A500 = 1 shl 3; + + // Player modes + XMP_MODE_AUTO = 0; + XMP_MODE_MOD = 1; + XMP_MODE_NOISETRACKER = 2; + XMP_MODE_PROTRACKER = 3; + XMP_MODE_S3M = 4; + XMP_MODE_ST3 = 5; + XMP_MODE_ST3GUS = 6; + XMP_MODE_XM = 7; + XMP_MODE_FT2 = 8; + XMP_MODE_IT = 9; + XMP_MODE_ITSMP = 10; + + // Mixer types + XMP_MIXER_STANDARD = 0; + XMP_MIXER_A500 = 1; + XMP_MIXER_A500F = 2; + + // Sample flags + XMP_SMPCTL_SKIP = 1 shl 0; + + // Limits + XMP_MAX_KEYS = 121; + XMP_MAX_ENV_POINTS = 32; + XMP_MAX_MOD_LENGTH = 256; + XMP_MAX_CHANNELS = 64; + XMP_MAX_SRATE = 49170; + XMP_MIN_SRATE = 4000; + XMP_MIN_BPM = 20; + XMP_MAX_FRAMESIZE = 5 * XMP_MAX_SRATE * 2 div XMP_MIN_BPM; + + // Error codes + XMP_END = 1; + XMP_ERROR_INTERNAL = 2; + XMP_ERROR_FORMAT = 3; + XMP_ERROR_LOAD = 4; + XMP_ERROR_DEPACK = 5; + XMP_ERROR_SYSTEM = 6; + XMP_ERROR_INVALID = 7; + XMP_ERROR_STATE = 8; + +type + xmp_context = PChar; + +type + xmp_channel = record + pan: integer; // Pan de canal (0x80 centrum) + vol: integer; // Volume of canal + flg: integer; // Flags of canal + end; + + xmp_pattern = record + rows: integer; + index: array[1..1] of integer; + end; + + xmp_event = record + note: byte; + ins: byte; + vol: byte; + fxt: byte; + fxp: byte; + f2t: byte; + f2p: byte; + _flag: byte; + end; + + xmp_track = record + rows: integer; + event: array[1..1] of xmp_event; + end; + + xmp_envelope = record + flg: integer; + npt: integer; + scl: integer; + sus: integer; + sue: integer; + lps: integer; + lpe: integer; + Data: array[1..XMP_MAX_ENV_POINTS * 2] of smallint; + end; + + xmp_subinstrument = record + vol: integer; + gvl: integer; + pan: integer; + xpo: integer; + fin: integer; + vwf: integer; + vde: integer; + vra: integer; + vsw: integer; + rvv: integer; + sid: integer; + nna: integer; + dct: integer; + dca: integer; + ifc: integer; + ifr: integer; + end; + + xmp_instrument = record + Name: array[0..31] of char; + vol: integer; + nsm: integer; + rls: integer; + aei: xmp_envelope; + pei: xmp_envelope; + fei: xmp_envelope; + map: array[0..XMP_MAX_KEYS] of record + ins: byte; + xpo: shortint; + end; + sub: ^xmp_subinstrument; + extra: Pointer; + end; + + xmp_sample = record + Name: array[0..31] of char; + len: integer; + lps: integer; + lpe: integer; + flg: integer; + Data: PByte; + end; + + xmp_sequence = record + entry_point: integer; + duration: integer; + end; + + xmp_module = record + Name: array[0..XMP_NAME_SIZE - 1] of char; + typ: array[0..XMP_NAME_SIZE - 1] of char; + pat: integer; + trk: integer; + chn: integer; + ins: integer; + smp: integer; + spd: integer; + bpm: integer; + len: integer; + rst: integer; + gvl: integer; + xxp: ^xmp_pattern; + xxt: ^xmp_track; + xxi: ^xmp_instrument; + xxs: ^xmp_sample; + xxc: array[0..XMP_MAX_CHANNELS - 1] of xmp_channel; + xxo: array[0..XMP_MAX_MOD_LENGTH] of byte; + end; + + xmp_test_info = record + Name: array[0..XMP_NAME_SIZE - 1] of char; + type_: array[0..XMP_NAME_SIZE - 1] of char; + end; + + xmp_module_info = record + md5: array[0..15] of byte; + vol_base: integer; + module: ^xmp_module; + comment: PChar; + num_sequences: integer; + seq_data: ^xmp_sequence; + end; + + xmp_channel_info = record + period: longword; + position: longword; + pitchbend: smallint; + note: byte; + instrument: byte; + sample: byte; + volume: byte; + pan: byte; + reserved: byte; + event: xmp_event; + end; + + xmp_frame_info = record + pos: integer; + pattern: integer; + row: integer; + num_rows: integer; + frame: integer; + speed: integer; + bpm: integer; + time: integer; + total_time: integer; + frame_time: integer; + buffer: Pointer; + buffer_size: integer; + total_size: integer; + volume: integer; + loop_count: integer; + virt_channels: integer; + virt_used: integer; + sequence: integer; + channel_info: array[0..XMP_MAX_CHANNELS - 1] of xmp_channel_info; + end; + + xmp_callbacks = record + read_func: function(dest: Pointer; len, nmemb: longword; priv: Pointer): longword; + seek_func: function(priv: Pointer; offset: longint; whence: integer): integer; + tell_func: function(priv: Pointer): longint; + close_func: function(priv: Pointer): integer; + end; + + { Dynamic load : Vars that will hold our dynamically loaded functions... + + *************************** functions ******************************* } + +var + xmp_create_context: function: pointer; cdecl; + xmp_free_context: procedure(ctx: Pointer); cdecl; + xmp_load_module: function(ctx: Pointer; const filename: PChar): Integer; cdecl; + xmp_load_module_from_memory: function(ctx: xmp_context; const Data: Pointer; size: longint): integer; cdecl; + xmp_load_module_from_file: function(ctx: xmp_context; file_: Pointer; size: longint): integer; cdecl; + xmp_load_module_from_callbacks: function(ctx: xmp_context; file_: Pointer; callbacks: xmp_callbacks): integer; cdecl; + xmp_test_module: function(const filename: PChar; info: xmp_test_info): Integer; cdecl; + xmp_release_module: procedure(ctx: xmp_context); cdecl; + xmp_start_player: function(ctx: xmp_context; rate: Integer; flags: Integer): Integer; cdecl; + xmp_play_buffer: function(ctx: xmp_context; buffer: Pointer; size: Integer; loop: Integer): Integer; cdecl; + xmp_get_frame_info: procedure(ctx: xmp_context; var info: xmp_frame_info); cdecl; + xmp_end_player: procedure(ctx: xmp_context); cdecl; + xmp_get_module_info: procedure(ctx: xmp_context; var info: xmp_module_info); cdecl; + xmp_get_format_list: function(): PAnsiChar; cdecl; + xmp_stop_module: procedure(ctx: xmp_context); cdecl; + xmp_restart_module: procedure(ctx: xmp_context); cdecl; + xmp_channel_vol: function(ctx: xmp_context; channel: Integer; volume: Integer): Integer; cdecl; + xmp_set_player: function(ctx: xmp_context; param: Integer; value: Integer): Integer; cdecl; + +// Not used yet... +//function xmp_test_module_from_memory(const data: Pointer; size: LongInt; info: xmp_test_info): Integer; cdecl; external 'xmp'; +//function xmp_test_module_from_file(file_: Pointer; info: xmp_test_info): Integer; cdecl; external 'xmp'; +//function xmp_test_module_from_callbacks(file_: Pointer; callbacks: xmp_callbacks; info: xmp_test_info): Integer; cdecl; external 'xmp'; +//procedure xmp_scan_module(ctx: xmp_context); cdecl; external 'xmp'; +//function xmp_play_frame(ctx: xmp_context): Integer; cdecl; external 'xmp'; +//procedure xmp_inject_event(ctx: xmp_context; channel: Integer; var event: xmp_event); cdecl; external 'xmp';//function xmp_next_position(ctx: xmp_context): Integer; cdecl; external 'xmp'; +//function xmp_prev_position(ctx: xmp_context): Integer; cdecl; external 'xmp'; +//function xmp_set_position(ctx: xmp_context; pos: Integer): Integer; cdecl; external 'xmp'; +//function xmp_set_row(ctx: xmp_context; row: Integer): Integer; cdecl; external 'xmp'; +//function xmp_set_tempo_factor(ctx: xmp_context; factor: Double): Integer; cdecl; external 'xmp';//function xmp_seek_time(ctx: xmp_context; time: Integer): Integer; cdecl; external 'xmp'; +//function xmp_channel_mute(ctx: xmp_context; channel: Integer; mute: Integer): Integer; cdecl; external 'xmp';//function xmp_get_player(ctx: xmp_context; param: Integer): Integer; cdecl; external 'xmp'; +//function xmp_set_instrument_path(ctx: xmp_context; const path: PChar): Integer; cdecl; external 'xmp'; + + +{Special function for dynamic loading of lib ...} + +var + xmp_Handle: TLibHandle = dynlibs.NilHandle; + {$if defined(cpu32) and defined(windows)} // try load dependency if not in /windows/system32/ + gc_Handle :TLibHandle=dynlibs.NilHandle; + {$endif} +var + ReferenceCounter: cardinal = 0; // Reference counter + +function xmp_IsLoaded: Boolean; inline; + +function xmp_Load(const libfilename: string): Boolean; // load the lib + +procedure xmp_Unload(); // unload and frees the lib from memory : do not forget to call it before close application. + +implementation + +function xmp_IsLoaded: boolean; +begin + Result := (xmp_Handle <> dynlibs.NilHandle); +end; + +Function xmp_Load(const libfilename:string) :boolean; +var +thelib, thelibgcc: string; +begin + Result := False; + if xmp_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin + {$if defined(cpu32) and defined(windows)} + if Length(libfilename) = 0 then thelibgcc := 'libgcc_s_dw2-1.dll' else + thelibgcc := IncludeTrailingBackslash(ExtractFilePath(libfilename)) + 'libgcc_s_dw2-1.dll'; + gc_Handle:= DynLibs.SafeLoadLibrary(thelibgcc); + {$endif} + +{go & load the library} + if Length(libfilename) = 0 then thelib := XMP_LIB_NAME else thelib := libfilename; + xmp_Handle:=DynLibs.LoadLibrary(thelib); // obtain the handle we want + if xmp_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} + +Pointer(xmp_create_context):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_create_context')); +Pointer(xmp_free_context):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_free_context')); +Pointer(xmp_load_module):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_load_module')); +Pointer(xmp_load_module_from_memory):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_load_module_from_memory')); +Pointer(xmp_load_module_from_file):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_load_module_from_file')); +Pointer(xmp_load_module_from_callbacks):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_load_module_from_callbacks')); +Pointer(xmp_test_module):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_test_module')); +Pointer(xmp_release_module):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_release_module')); +Pointer(xmp_start_player):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_start_player')); +Pointer(xmp_play_buffer):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_play_buffer')); +Pointer(xmp_get_frame_info):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_get_frame_info')); +Pointer(xmp_end_player):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_end_player')); +Pointer(xmp_get_module_info):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_get_module_info')); +Pointer(xmp_get_format_list):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_get_format_list')); +Pointer(xmp_stop_module):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_stop_module')); +Pointer(xmp_restart_module):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_restart_module')); +Pointer(xmp_channel_vol):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_channel_vol')); +Pointer(xmp_set_player):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_set_player')); +end; + Result := xmp_IsLoaded; + ReferenceCounter:=1; +end; + +end; + +Procedure xmp_Unload; +begin + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + if xmp_IsLoaded then + begin + DynLibs.UnloadLibrary(xmp_Handle); + xmp_Handle:=DynLibs.NilHandle; + {$if defined(cpu32) and defined(windows)} + if gc_Handle <> DynLibs.NilHandle then begin + DynLibs.UnloadLibrary(gc_Handle); + gc_Handle:=DynLibs.NilHandle; + end; + {$endif} + end; +end; + + +end. + diff --git a/UOS/examples/uos_mpg123.pas b/UOS/examples/uos_mpg123.pas new file mode 100644 index 0000000..0334dae --- /dev/null +++ b/UOS/examples/uos_mpg123.pas @@ -0,0 +1,1117 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{ This is the dynamical loader for mpg123 library with reference counting. + Load the library with mp_load() and release with mp_unload(). + License : modified LGPL. + Fred van Stappen fiens@hotmail.com } + +unit uos_mpg123; + +interface + +{$DEFINE newversion} // uncomment for mpg123 new version +{$mode objfpc}{$H+} + +uses + ctypes, + classes, dynlibs; + +const +libmp= + {$IFDEF unix} + {$IFDEF darwin} + 'libmpg123.0.dylib'; + {$ELSE} + 'libmpg123.so.0'; + {$ENDIF} + {$ELSE} + 'mpg123.dll'; + {$ENDIF} + +const + SEEK_SET = 0; //* seek relative to beginning of file */ + SEEK_CUR = 1; //* seek relative to current file position */ + SEEK_END = 2; //* seek relative to end of file */ + SEEK_DATA = 3; //* seek to the next data */ + SEEK_HOLE = 4; //* seek to the next hole */ + SEEK_MAX = SEEK_HOLE; + + +type + {$IF Defined(MSWINDOWS)} + off_t = int64; + {$ELSE} + off_t = clonglong; + {$ENDIF} + + Puos_count_t = ^Tuos_count_t; + Tuos_count_t = off_t; + + PMemoryStream = ^TMemoryStream; + + Tmpg123_handle = Pointer; + Tmpg123_init = function(): integer; cdecl; + Tmpg123_exit = procedure; cdecl; + Tmpg123_new = function(const decoder: PChar; + var error: integer): Tmpg123_handle; cdecl; + Tmpg123_delete = procedure(mh: Tmpg123_handle); cdecl; + +const + MPG123_VERBOSE = 0; // set verbosity value for enabling messages + // to stderr, >= 0 makes sense (integer) + MPG123_FLAGS = 1; + // set all flags, p.ex val = MPG123_GAPLESS|MPG123_MONO_MIX (integer) + MPG123_ADD_FLAGS = 2; // add some flags (integer) + MPG123_FORCE_RATE = 3; + // when value > 0, force output rate to that value (integer) + MPG123_DOWN_SAMPLE = 4; // 0=native rate, 1=half rate, 2=quarter rate (integer) + MPG123_RVA = 5; // one of the RVA choices above (integer) + MPG123_DOWNSPEED = 6; // play a frame N times (integer) + MPG123_UPSPEED = 7; // play every Nth frame (integer) + MPG123_START_FRAME = 8; // start with this frame (skip frames before that, integer) + MPG123_DECODE_FRAMES = 9; // decode only this number of frames (integer) + MPG123_ICY_INTERVAL = 10; + // stream contains ICY metadata with this interval (integer) + MPG123_OUTSCALE = 11; // the scale for output samples (amplitude - integer + // or float according to mpg123 output format, normally integer) + MPG123_TIMEOUT = 12; // timeout for reading from a stream (not supported + // on win32, integer) + MPG123_REMOVE_FLAGS = 13; // remove some flags (inverse of MPG123_ADD_FLAGS, integer) + MPG123_RESYNC_LIMIT = 14; // Try resync on frame parsing for that many bytes + // or until end of stream (<0 ... integer). + MPG123_INDEX_SIZE = 15; // Set the frame index size (if supported). + // Values <0 mean that the index is allowed to grow + // dynamically in these steps (in positive direction, + // of course) -- Use this when you really want a + // full index with every individual frame. + MPG123_PREFRAMES = 16; + +{** mpg123_param_flags - Flag bits for MPG123_FLAGS, use the usual binary or to combine. **} + MPG123_FORCE_MONO = $7; // 0111 Force some mono mode: This is a test bitmask + // for seeing if any mono forcing is active. + MPG123_MONO_LEFT = $1; // 0001 Force playback of left channel only. + MPG123_MONO_RIGHT = $2; // 0010 Force playback of right channel only. + MPG123_MONO_MIX = $4; // 0100 Force playback of mixed mono. + MPG123_FORCE_STEREO = $8; // 1000 Force stereo output. + MPG123_FORCE_8BIT = $10; // 00010000 Force 8bit formats. + MPG123_QUIET = $20; + // 00100000 Suppress any printouts (overrules verbose). *) + MPG123_GAPLESS = $40; // 01000000 Enable gapless decoding (default on + // if libmpg123 has support). + MPG123_NO_RESYNC = $80; + // 10000000 Disable resync stream after error. *) + MPG123_SEEKBUFFER = $100; // 000100000000 Enable small buffer on non-seekable + // streams to allow some peek-ahead (for better MPEG sync). + MPG123_FUZZY = $200; // 001000000000 Enable fuzzy seeks (guessing byte + // offsets or using approximate seek points from Xing TOC) + (* 1.72 *) + MPG123_FORCE_FLOAT = $400; // 010000000000 Force floating point output + // (32 or 64 bits depends on mpg123 internal precision). + MPG123_PLAIN_ID3TEXT = $800; + MPG123_IGNORE_STREAMLENGTH = $1000; + + {$IF DEFINED(newversion)} + MPG123_IGNORE_INFOFRAME = $4000; + MPG123_AUTO_RESAMPLE = $8000; + MPG123_PICTURE = $10000; + MPG123_NO_PEEK_END = $20000; + MPG123_SKIP_ID3V2 = $2000; + MPG123_FORCE_SEEKABLE = $40000; + {$endif} + +{** mpg123_param_rva - Choices for MPG123_RVA **} + MPG123_RVA_OFF = 0; // RVA disabled (default). + MPG123_RVA_MIX = 1; // Use mix/track/radio gain. + MPG123_RVA_ALBUM = 2; // Use album/audiophile gain + MPG123_RVA_MAX = MPG123_RVA_ALBUM; // The maximum RVA code, may increase in future. + +type + Tmpg123_param = function(mh: Tmpg123_handle; mpg123_parms_type: integer; + Value: longint; fvalue: double): integer; cdecl; + Tmpg123_getparam = function(mh: Tmpg123_handle; mpg123_parms_type: integer; + var val: longint; var fval: double): integer; cdecl; + +{** mpg123_feature_set - ??? **} +const + MPG123_FEATURE_ABI_UTF8OPEN = 0; + MPG123_FEATURE_OUTPUT_8BIT = 1; + MPG123_FEATURE_OUTPUT_16BIT = 2; + MPG123_FEATURE_OUTPUT_32BIT = 3; + MPG123_FEATURE_INDEX = 4; + MPG123_FEATURE_PARSE_ID3V2 = 5; + MPG123_FEATURE_DECODE_LAYER1 = 6; + MPG123_FEATURE_DECODE_LAYER2 = 7; + MPG123_FEATURE_DECODE_LAYER3 = 8; + MPG123_FEATURE_DECODE_ACCURATE = 9; + MPG123_FEATURE_DECODE_DOWNSAMPLE = 10; + MPG123_FEATURE_DECODE_NTOM = 11; + MPG123_FEATURE_PARSE_ICY = 12; + MPG123_FEATURE_TIMEOUT_READ = 13; + +type + Tmpg123_feature = function(const feature_key: shortint): cardinal; cdecl; + +const + MPG123_DONE = -12; // Message: Track ended. + MPG123_NEW_FORMAT = -11; + // Message: Output format will be different on next call. + MPG123_NEED_MORE = -10; // Message: For feed reader: "Feed me more!" + MPG123_ERR = -1; // <Generic Error> + MPG123_OK = 0; // <Success> + MPG123_BAD_OUTFORMAT = 1; // Unable to set up output format! + MPG123_BAD_CHANNEL = 2; // Invalid channel number specified. + MPG123_BAD_RATE = 3; // Invalid sample rate specified. + MPG123_ERR_16TO8TABLE = 4; + // Unable to allocate memory for 16 to 8 converter table! + MPG123_BAD_PARAM = 5; // Bad parameter id! + MPG123_BAD_BUFFER = 6; + // Bad buffer given -- invalid pointer or too small size. + MPG123_OUT_OF_MEM = 7; // Out of memory -- some malloc() failed. + MPG123_NOT_INITIALIZED = 8; // You didn't initialize the library! + MPG123_BAD_DECODER = 9; // Invalid decoder choice. + MPG123_BAD_HANDLE = 10; // Invalid mpg123 handle. + MPG123_NO_BUFFERS = 11; // Unable to initialize frame buffers (out of memory?). + MPG123_BAD_RVA = 12; // Invalid RVA mode. + MPG123_NO_GAPLESS = 13; // This build doesn't support gapless decoding. + MPG123_NO_SPACE = 14; // Not enough buffer space. + MPG123_BAD_TYPES = 15; // Incompatible numeric data types. + MPG123_BAD_BAND = 16; // Bad equalizer band. + MPG123_ERR_NULL = 17; + // Null pointer given where valid storage address needed. + MPG123_ERR_READER = 18; // Error reading the stream. + MPG123_NO_SEEK_FROM_END = 19; // Cannot seek from end (end is not known). + MPG123_BAD_WHENCE = 20; // Invalid 'whence' for seek function. + MPG123_NO_TIMEOUT = 21; // Build does not support stream timeouts. + MPG123_BAD_FILE = 22; // File access error. + MPG123_NO_SEEK = 23; // Seek not supported by stream. + MPG123_NO_READER = 24; // No stream opened. + MPG123_BAD_PARS = 25; // Bad parameter handle. + MPG123_BAD_INDEX_PAR = 26; // Bad parameters to mpg123_index() + MPG123_OUT_OF_SYNC = 27; // Lost track in bytestream and did not try to resync. + MPG123_RESYNC_FAIL = 28; // Resync failed to find valid MPEG data. + MPG123_NO_8BIT = 29; // No 8bit encoding possible. + MPG123_BAD_ALIGN = 30; // Stack aligmnent error + MPG123_NULL_BUFFER = 31; // NULL input buffer with non-zero size... + MPG123_NO_RELSEEK = 32; // Relative seek not possible (screwed up file offset) + MPG123_NULL_POINTER = 33; + // You gave a null pointer somewhere where you shouldn't have. + MPG123_BAD_KEY = 34; // Bad key value given. + MPG123_NO_INDEX = 35; // No frame index in this build. + MPG123_INDEX_FAIL = 36; // Something with frame index went wrong. + (* 1.72 *) + MPG123_BAD_DECODER_SETUP = 37; // Something prevents a proper decoder setup + MPG123_MISSING_FEATURE = 38; // This feature has not been built into libmpg123. + MPG123_BAD_VALUE = 39; + MPG123_LSEEK_FAILED = 40; + MPG123_BAD_CUSTOM_IO = 41; + MPG123_LFS_OVERFLOW = 42; + +type + Tmpg123_plain_strerror = function(errcode: integer): PChar; cdecl; + Tmpg123_strerror = function(mh: Tmpg123_handle): PChar; cdecl; + Tmpg123_errcode = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_decoders = function(): PPChar; cdecl; + Tmpg123_supported_decoders = function(): PPchar; cdecl; + Tmpg123_decoder = function(mh: Tmpg123_handle; + var decoder_name: PChar): integer; cdecl; + Tmpg123_current_decoder = function(mh: Tmpg123_handle): PChar; cdecl; + +const // mpg123_enc_enum + MPG123_ENC_8 = $00f; (**< 0000 0000 1111 Some 8 bit integer encoding. *) + MPG123_ENC_16 = $040; (**< 0000 0100 0000 Some 16 bit integer encoding. *) + MPG123_ENC_32 = $100; (**< 0001 0000 0000 Some 32 bit integer encoding. *) + MPG123_ENC_SIGNED = $080; (**< 0000 1000 0000 Some signed integer encoding. *) + MPG123_ENC_FLOAT = $800; (**< 1110 0000 0000 Some float encoding. *) + MPG123_ENC_SIGNED_16 = (MPG123_ENC_16 or MPG123_ENC_SIGNED or $10); + (**< 0000 1101 0000 signed 16 bit *) + MPG123_ENC_UNSIGNED_16 = (MPG123_ENC_16 or $20); + (**< 0000 0110 0000 unsigned 16 bit*) + MPG123_ENC_UNSIGNED_8 = $01; + (**< 0000 0000 0001 unsigned 8 bit*) + MPG123_ENC_SIGNED_8 = (MPG123_ENC_SIGNED or $02); + (**< 0000 1000 0010 signed 8 bit*) + MPG123_ENC_ULAW_8 = $04; + (**< 0000 0000 0100 ulaw 8 bit*) + MPG123_ENC_ALAW_8 = $08; + (**< 0000 0000 1000 alaw 8 bit *) + MPG123_ENC_SIGNED_32 = MPG123_ENC_32 or MPG123_ENC_SIGNED or $1000; + (**< 0001 1001 0000 signed 32 bit *) + MPG123_ENC_UNSIGNED_32 = MPG123_ENC_32 or $2000; + (**< 0001 0010 0000 unsigned 32 bit *) + MPG123_ENC_FLOAT_32 = $200; + (**< 0010 0000 0000 32bit float *) + MPG123_ENC_FLOAT_64 = $400; + (**< 0100 0000 0000 64bit float *) + MPG123_ENC_ANY = MPG123_ENC_SIGNED_16 or MPG123_ENC_UNSIGNED_16 or + MPG123_ENC_UNSIGNED_8 or MPG123_ENC_SIGNED_8 or + MPG123_ENC_ULAW_8 or MPG123_ENC_ALAW_8 or + MPG123_ENC_SIGNED_32 or MPG123_ENC_UNSIGNED_32 or + MPG123_ENC_FLOAT_32 or MPG123_ENC_FLOAT_64; (**< any encoding *) + + MPG123_LEFT = $1; + MPG123_RIGHT = $2; + MPG123_LR = $3; + +type +{$if defined(cpu64)} + cuint64 = qword; + size_t = cuint64; +{$else} + cuint32 = longword; + size_t = cuint32; +{$endif} + + psize_t = ^size_t; + coff_t = size_t; //Int64; + PLong = Pointer; + pplong = array of PLong; + PInteger = Pointer; + PPInteger = array of PInteger; + + Tmpg123_rates = procedure(var list: pplong; var number: size_t); cdecl; + Tmpg123_encodings = procedure(var list: ppinteger; var number: size_t); cdecl; + Tmpg123_encsize = function(encoding: integer): integer; cdecl; + Tmpg123_format_none = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_format_all = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_format = function(mh: Tmpg123_handle; rate: cardinal; + channels: integer; encodings: integer): integer; cdecl; + Tmpg123_format_support = function(mh: Tmpg123_handle; rate: cardinal; + encoding: integer): integer; cdecl; + Tmpg123_getformat = function(mh: Tmpg123_handle; var rate: cardinal; + var channels, encoding: integer): integer; cdecl; + Tmpg123_open = function(mh: Tmpg123_handle; path: PChar): integer; cdecl; + Tmpg123_open_fd = function(mh: Tmpg123_handle; fd: integer): integer; cdecl; + +{$IF DEFINED(newversion)} + Tmpg123_open_handle = function(mh: Tmpg123_handle; pha: pointer): integer; cdecl; + {* Use an opaque handle as bitstream input. This works only with the + * replaced I/O from mpg123_replace_reader_handle()! + * mpg123_close() will call the cleanup callback for your handle (if you gave one). + * \return MPG123_OK on success + } + Tmpg123_replace_reader_handle = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer ; cleanup : pointer): integer; cdecl; + {* Replace I/O functions with your own ones operating on some kind of handle instead of integer descriptors. + * The handle is a void pointer, so you can pass any data you want... + * mpg123_open_handle() is the call you make to use the I/O defined here. + * There is no fallback to internal read/seek here. + * Note: As it would be troublesome to mess with this while having a file open, + * this mpg123_close() is implied here. + * \param r_read The callback for reading (behaviour like posix read). + * \param r_lseek The callback for seeking (like posix lseek). + * \param cleanup A callback to clean up an I/O handle on mpg123_close, can be NULL for none (you take care of cleaning your handles). } + + Tmpg123_replace_reader = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer): integer; cdecl; + Tmpg123_getformat2 = function(mh: Tmpg123_handle; var rate: cardinal; + var channels, encoding: integer; var clear_flag: integer): integer; cdecl; + Tmpg123_framelength = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_framepos = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_spf = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_meta_free = procedure(mh: Tmpg123_handle); cdecl; + Tmpg123_set_index = function(mh: Tmpg123_handle; var offsets: PPInteger; + step: coff_t; fill: size_t): integer; + +{$if not(defined(cpu64) and defined(unix))} + Tmpg123_open_32 = function(mh: Tmpg123_handle; path: PChar): integer; cdecl; + Tmpg123_open_fd_32 = function(mh: Tmpg123_handle; fd: integer): integer; cdecl; + Tmpg123_open_handle_32 = function(mh: Tmpg123_handle; pha: pointer): integer; cdecl; + Tmpg123_decode_frame_32 = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + Tmpg123_framebyframe_decode_32 = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + Tmpg123_framepos_32 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tell_32 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tellframe_32 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_seek_32 = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer): integer; cdecl; + Tmpg123_feedseek_32 = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer; var input_offset: coff_t): coff_t; cdecl; + Tmpg123_seek_frame_32 = function(mh: Tmpg123_handle; frameoff: coff_t; + whence: integer): coff_t; cdecl; + Tmpg123_timeframe_32 = function(mh: Tmpg123_handle; sec: double): coff_t; cdecl; + Tmpg123_index_32 = function(mh: Tmpg123_handle; var offsets: PPInteger; + var step: coff_t; var fill: size_t): integer; + Tmpg123_set_index_32 = function(mh: Tmpg123_handle; var offsets: PPInteger; + step: coff_t; fill: size_t): integer; + Tmpg123_position_32 = function(mh: Tmpg123_handle; frame_offset: coff_t; + buffered_bytes: coff_t; + var current_frame: coff_t; var frames_left: coff_t; + var current_seconds: double; + var seconds_left: double): integer; cdecl; + Tmpg123_framelength_32 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_length_32 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_set_filesize_32 = function(mh: Tmpg123_handle; size: coff_t): integer; cdecl; + Tmpg123_replace_reader_32 = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer): integer; cdecl; + Tmpg123_replace_reader_handle_32 = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer ; cleanup : pointer): integer; cdecl; +{$endif} + + + Tmpg123_open_64 = function(mh: Tmpg123_handle; path: PChar): integer; cdecl; + Tmpg123_open_fd_64 = function(mh: Tmpg123_handle; fd: integer): integer; cdecl; + Tmpg123_open_handle_64 = function(mh: Tmpg123_handle; pha: pointer): integer; cdecl; + Tmpg123_decode_frame_64 = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + Tmpg123_framebyframe_decode_64 = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + Tmpg123_framepos_64 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tell_64 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tellframe_64 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_seek_64 = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer): integer; cdecl; + Tmpg123_feedseek_64 = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer; var input_offset: coff_t): coff_t; cdecl; + Tmpg123_seek_frame_64 = function(mh: Tmpg123_handle; frameoff: coff_t; + whence: integer): coff_t; cdecl; + Tmpg123_timeframe_64 = function(mh: Tmpg123_handle; sec: double): coff_t; cdecl; + Tmpg123_index_64 = function(mh: Tmpg123_handle; var offsets: PPInteger; + var step: coff_t; var fill: size_t): integer; + Tmpg123_set_index_64 = function(mh: Tmpg123_handle; var offsets: PPInteger; + step: coff_t; fill: size_t): integer; + Tmpg123_position_64 = function(mh: Tmpg123_handle; frame_offset: coff_t; + buffered_bytes: coff_t; + var current_frame: coff_t; var frames_left: coff_t; + var current_seconds: double; + var seconds_left: double): integer; cdecl; + Tmpg123_framelength_64 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_length_64 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_set_filesize_64 = function(mh: Tmpg123_handle; size: coff_t): integer; cdecl; + Tmpg123_replace_reader_64 = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer): integer; cdecl; + Tmpg123_replace_reader_handle_64 = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer ; cleanup : pointer): integer; cdecl; +{$endif} + + Tmpg123_open_feed = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_close = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_read = function(mh: Tmpg123_handle; outmemory: pcfloat; + outmemsize: size_t; var done: size_t): integer; cdecl; + Tmpg123_feed = function(mh: Tmpg123_handle; inbuf: Pointer; + size: size_t): integer; cdecl; + Tmpg123_decode = function(mh: Tmpg123_handle; inmemory: Pointer; + inmemsize: size_t; outmemory: Pointer; + outmemsize: size_t; var done: size_t): integer; cdecl; + Tmpg123_decode_frame = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + +{$IF DEFINED(newversion)} + Tmpg123_framebyframe_decode = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + Tmpg123_framebyframe_next = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_framedata = function(mh: Tmpg123_handle; var header: longint; + bodydata: PPChar; var bodybytes: size_t): integer; cdecl; +{$endif} + + Tmpg123_tell = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tellframe = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tell_stream = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_seek = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer): integer; cdecl; + Tmpg123_feedseek = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer; var input_offset: coff_t): coff_t; + cdecl; + Tmpg123_seek_frame = function(mh: Tmpg123_handle; frameoff: coff_t; + whence: integer): coff_t; cdecl; + Tmpg123_timeframe = function(mh: Tmpg123_handle; sec: double): coff_t; cdecl; + Tmpg123_index = function(mh: Tmpg123_handle; var offsets: PPInteger; + var step: coff_t; var fill: size_t): integer; + Tmpg123_position = function(mh: Tmpg123_handle; frame_offset: coff_t; + buffered_bytes: coff_t; + var current_frame: coff_t; var frames_left: coff_t; + var current_seconds: double; + var seconds_left: double): integer; cdecl; + Tmpg123_eq = function(mh: Tmpg123_handle; mpg123_channels_channel: integer; + band: integer; val: double): integer; cdecl; + Tmpg123_geteq = function(mh: Tmpg123_handle; mpg123_channels_channel: integer; + band: integer): double; cdecl; + Tmpg123_reset_eq = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_volume = function(mh: Tmpg123_handle; vol: double): integer; cdecl; + Tmpg123_volume_change = function(mh: Tmpg123_handle; change: double): integer; cdecl; + Tmpg123_getvolume = function(mh: Tmpg123_handle; var base: double; + var really: double; var rva_db: double): integer; + cdecl; + +const + MPG123_CBR = 0; (**< Constant Bitrate Mode (default) *) + MPG123_VBR = 1; (**< Variable Bitrate Mode *) + MPG123_ABR = 2; (**< Average Bitrate Mode *) + +(** enum mpg123_version - Enumeration of the MPEG Versions *) + MPG123_1_0 = 0; (**< MPEG Version 1.0 *) + MPG123_2_0 = 1; (**< MPEG Version 2.0 *) + MPG123_2_5 = 2; (**< MPEG Version 2.5 *) + +(** enum mpg123_mode - Enumeration of the MPEG Audio mode. + * Only the mono mode has 1 channel, the others have 2 channels. *) + MPG123_M_STEREO = 0; (**< Standard Stereo. *) + MPG123_M_JOINT = 1; (**< Joint Stereo. *) + MPG123_M_DUAL = 2; (**< Dual Channel. *) + MPG123_M_MONO = 3; (**< Single Channel. *) + + (** enum mpg123_flags - Enumeration of the MPEG Audio flag bits *) + MPG123_CRC = $1; (**< The bitstream is error protected using 16-bit CRC. *) + MPG123_COPYRIGHT = $2; (**< The bitstream is copyrighted. *) + MPG123_PRIVATE = $4; (**< The private bit has been set. *) + MPG123_ORIGINAL = $8; (**< The bitstream is an original, not a copy. *) + +(** Data structure for storing information about a frame of MPEG Audio *) +type + pmpg123_frameinfo = ^Tmpg123_frameinfo; + Tmpg123_frameinfo = record + mpg123_version_version: longword; (**< The MPEG version (1.0/2.0/2.5). *) + layer: integer; (**< The MPEG Audio Layer (MP1/MP2/MP3). *) + rate: longword; (**< The sampling rate in Hz. *) + mpg123_mode_mode: longint; + (**< The audio mode (Mono, Stereo, Joint-stero, Dual Channel). *) + mode_ext: integer; (**< The mode extension bit flag. *) + framesize: integer; (**< The size of the frame (in bytes). *) + mpg123_flags_flags: longword; (**< MPEG Audio flag bits. *) + emphasis: integer; (**< The emphasis type. *) + bitrate: integer; (**< Bitrate of the frame (kbps). *) + abr_rate: integer; (**< The target average bitrate. *) + mpg123_vbr_vbr: longword; (**< The VBR mode. *) + end; + + Tmpg123_info = function(mh: Tmpg123_handle; + var mi: Tmpg123_frameinfo): integer; cdecl; + Tmpg123_safe_buffer = function(): size_t; cdecl; + Tmpg123_scan = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_length = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_set_filesize = function(mh: Tmpg123_handle; size: coff_t): integer; cdecl; + Tmpg123_tpf = function(mh: Tmpg123_handle): double; cdecl; + Tmpg123_clip = function(mh: Tmpg123_handle): longint; cdecl; + +const + MPG123_ACCURATE = 1; +(**< Query if positons are currently accurate (integer value, 0 if false, 1 if true) *) + +type + Tmpg123_getstate = function(mh: Tmpg123_handle; mpg123_state_key: integer; + var val: longint; var fval: double): integer; cdecl; + Pmpg123_string = ^Tmpg123_string; + + Tmpg123_string = record + p: PChar; (**< pointer to the string data *) + size: size_t; (**< raw number of bytes allocated *) + fill: size_t; + (**< number of used bytes (including closing zero byte) *) + end; + + Tmpg123_init_string = procedure(psb: Pmpg123_string); cdecl; + Tmpg123_free_string = procedure(psb: Pmpg123_string); cdecl; + Tmpg123_resize_string = function(psb: Pmpg123_string; news: size_t): integer; cdecl; + Tmpg123_grow_string = function(psb: Pmpg123_string; news: size_t): integer; cdecl; + Tmpg123_copy_string = function(strfrom, strto: Pmpg123_string): integer; cdecl; + Tmpg123_add_string = function(psb: Pmpg123_string; stuff: PChar): integer; cdecl; + Tmpg123_add_substring = function(psb: Pmpg123_string; stuff: PChar; + strfrom, Count: size_t): integer; cdecl; + Tmpg123_set_string = function(psb: Pmpg123_string; stuff: PChar): integer; cdecl; + Tmpg123_set_substring = function(psb: Pmpg123_string; stuff: PChar; + strfrom, Count: size_t): integer; cdecl; + Tmpg123_strlen = function(psb: Pmpg123_string; utf8: integer): size_t; + +{$IF DEFINED(newversion)} + Tmpg123_chomp_string = function(psb: Pmpg123_string): integer; +{$endif} + +const + mpg123_text_unknown = 0; + mpg123_text_utf8 = 1; + mpg123_text_latin1 = 2; + mpg123_text_icy = 3; + mpg123_text_cp1252 = 4; + mpg123_text_utf16 = 5; + mpg123_text_utf16bom = 6; + mpg123_text_utf16be = 7; + mpg123_text_max = 7; + mpg123_id3_latin1 = 0; + mpg123_id3_utf16bom = 1; + mpg123_id3_utf16be = 2; + mpg123_id3_utf8 = 3; + mpg123_id3_enc_max = 3; + + type + Tmpg123_enc_from_id3 = function(id3_enc_byte: byte): integer; cdecl; + Tmpg123_store_utf8 = function(psb: Pmpg123_string; mpg123_text_encoding: integer; + var Source: byte; + source_size: size_t): integer; cdecl; + Pmpg123_text = ^Tmpg123_text; + + Tmpg123_text = record + lang: array[0..2] of char; + (**< Three-letter language code (not terminated). *) + id: array[0..3] of char; + (**< The ID3v2 text field id, like TALB, TPE2, ... (4 characters, no string termination). *) + description: Tmpg123_string; (**< Empty for the generic comment... *) + Text: Tmpg123_string; (**< ... *) + end; + +{$IF DEFINED(newversion)} + {* The picture type values from ID3v2. } + mpg123_id3_pic_type = Longint; + const + mpg123_id3_pic_other = 0; + mpg123_id3_pic_icon = 1; + mpg123_id3_pic_other_icon = 2; + mpg123_id3_pic_front_cover = 3; + mpg123_id3_pic_back_cover = 4; + mpg123_id3_pic_leaflet = 5; + mpg123_id3_pic_media = 6; + mpg123_id3_pic_lead = 7; + mpg123_id3_pic_artist = 8; + mpg123_id3_pic_conductor = 9; + mpg123_id3_pic_orchestra = 10; + mpg123_id3_pic_composer = 11; + mpg123_id3_pic_lyricist = 12; + mpg123_id3_pic_location = 13; + mpg123_id3_pic_recording = 14; + mpg123_id3_pic_performance = 15; + mpg123_id3_pic_video = 16; + mpg123_id3_pic_fish = 17; + mpg123_id3_pic_illustration = 18; + mpg123_id3_pic_artist_logo = 19; + mpg123_id3_pic_publisher_logo = 20; + + {* Sub data structure for ID3v2, for storing picture data including comment. + * This is for the ID3v2 APIC field. You should consult the ID3v2 specification + * for the use of the APIC field ("frames" in ID3v2 documentation, I use "fields" + * here to separate from MPEG frames). } + + type + PPmpg123_picture = ^Pmpg123_picture; + Pmpg123_picture = ^Tmpg123_picture; + + Tmpg123_picture = record + pictype : char; + description : Tmpg123_string; + mime_type : Tmpg123_string; + size : size_t; + data : Pbyte; + end; + +{$endif} + +type + PPmpg123_id3v2 = ^Pmpg123_id3v2; + Pmpg123_id3v2 = ^Tmpg123_id3v2; + + Tmpg123_id3v2 = record + Version: byte; (**< 3 or 4 for ID3v2.3 or ID3v2.4. *) + Title: Pmpg123_string; + (**< Title string (pointer into text_list). *) + Artist: Pmpg123_string; + (**< Artist string (pointer into text_list). *) + Album: Pmpg123_string; + (**< Album string (pointer into text_list). *) + Year: Pmpg123_string; + (**< The year as a string (pointer into text_list). *) + Genre: Pmpg123_string; (**< Genre String (pointer into text_list). The genre string(s) + may very well need postprocessing, esp. for ID3v2.3. *) + Comment: Pmpg123_string; + (**< Pointer to last encountered comment text with empty description. *) + (* Encountered ID3v2 fields are appended to these lists. + There can be multiple occurences, the pointers above always point + to the last encountered data. *) + Comment_list: Pmpg123_text; (**< Array of comments. *) + NumComments: size_t; (**< Number of comments. *) + Text: Pmpg123_text; (**< Array of ID3v2 text fields *) + NumTexts: size_t; (**< Numer of text fields. *) + Extra: Pmpg123_text; + (**< The array of extra (TXXX) fields. *) + NumExtras: size_t; + (**< Number of extra text (TXXX) fields. *) + + {$IF DEFINED(newversion)} + picture : Pmpg123_picture; + pictures : size_t; + {$endif} + end; + + PPmpg123_id3v1 = ^Pmpg123_id3v1; + Pmpg123_id3v1 = ^Tmpg123_id3v1; + Tmpg123_id3v1 = record + tag: array[0..2] of char; + (**< Always the string "TAG", the classic intro. *) + title: array[0..29] of char; (**< Title string. *) + artist: array[0..29] of char; (**< Artist string. *) + album: array[0..29] of char; (**< Album string. *) + year: array[0..3] of char; (**< Year string. *) + comment: array[0..29] of char; (**< Comment string. *) + genre: byte; (**< Genre index. *) + end; + +const + MPG123_ID3_ = $03; + (**< 0011 There is some ID3 info. Also matches 0010 or NEW_ID3. *) + MPG123_NEW_ID3_ = $01; + (**< 0001 There is ID3 info that changed since last call to mpg123_id3. *) + MPG123_ICY_ = $0C; + (**< 1100 There is some ICY info. Also matches 0100 or NEW_ICY.*) + MPG123_NEW_ICY_ = $04; +(**< 0100 There is ICY info that changed since last call to mpg123_icy. *) + +type + Tmpg123_meta_check = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_id3 = function(mh: Tmpg123_handle; v1: PPmpg123_id3v1; + v2: PPmpg123_id3v2): integer; cdecl; + Tmpg123_icy = function(mh: Tmpg123_handle; var icy_meta: PChar): integer; cdecl; + // Tmpg123_icy = function(mh: Tmpg123_handle; icy_meta: PPChar): integer; cdecl; + Tmpg123_icy2utf8 = function(icy_text: PChar): PChar; cdecl; + +const + _NUM_CHANNELS = 2; + _MPG123_RATES = 9; + _MPG123_ENCODINGS = 10; + +type + Pmpg123_pars = ^Tmpg123_pars; + + Tmpg123_pars = record + verbose: integer; (* verbose level *) + flags: longword; (* combination of above *) + force_rate: longword; + down_sample: integer; + rva: integer; (* (which) rva to do: + 0: nothing, + 1: radio/mix/track + 2: album/audiophile *) + halfspeed: longword; + doublespeed: longword; + {$IFNDEF WINDOWS} + timeout: longword; + {$ENDIF} + audio_caps: array[0.._NUM_CHANNELS - 1, 0.._MPG123_RATES, + 0.._MPG123_ENCODINGS - 1] of char; + (* long start_frame; *)(* frame offset to begin with *) + (* long frame_number;*)(* number of frames to decode *) + icy_interval: longword; + outscale: double; // longword ? + resync_limit: longword; + index_size: longint; + (* Long, because: negative values have a meaning. *) + dummy: array[0..64] of byte; // dummy + end; + + Tmpg123_parnew = function(mp: Pmpg123_pars; decoder: PChar; + var error: integer): Tmpg123_handle; cdecl; + Tmpg123_new_pars = function(var error: integer): Pmpg123_pars; cdecl; + Tmpg123_delete_pars = procedure(mp: Pmpg123_pars); cdecl; + Tmpg123_fmt_none = function(mp: Pmpg123_pars): integer; cdecl; + Tmpg123_fmt_all = function(mp: Pmpg123_pars): integer; cdecl; + Tmpg123_fmt = function(mh: Pmpg123_pars; rate: longword; + channels, encodings: integer): integer; cdecl; + Tmpg123_fmt_support = function(mh: Pmpg123_pars; rate: longword; + encoding: integer): integer; cdecl; + Tmpg123_par = function(mp: Pmpg123_pars; mpg123_parms_type: integer; + Value: longword; fvalue: double): integer; + cdecl; + Tmpg123_getpar = function(mp: Pmpg123_pars; mpg123_parms_type: integer; + var val: longword; var fval: double) + : integer; cdecl; + Tmpg123_replace_buffer = function(mh: Tmpg123_handle; Data: Pointer; + size: size_t): integer; cdecl; + + Tmpg123_outblock = function(mh: Tmpg123_handle): size_t; cdecl; + +{ *** the mpg123 library functions : ***************************************** } +var + mpg123_init: Tmpg123_init; + mpg123_exit: Tmpg123_exit; + mpg123_new: Tmpg123_new; + mpg123_delete: Tmpg123_delete; + + mpg123_param: Tmpg123_param; + mpg123_getparam: Tmpg123_getparam; + mpg123_feature: Tmpg123_feature; + + mpg123_plain_strerror: Tmpg123_plain_strerror; + mpg123_strerror: Tmpg123_strerror; + mpg123_errcode: Tmpg123_errcode; + mpg123_decoders: Tmpg123_decoders; + mpg123_supported_decoders: Tmpg123_supported_decoders; + mpg123_decoder: Tmpg123_decoder; + mpg123_current_decoder: Tmpg123_current_decoder; + + mpg123_rates: Tmpg123_rates; + mpg123_encodings: Tmpg123_encodings; + mpg123_encsize: Tmpg123_encsize; + mpg123_format_none: Tmpg123_format_none; + mpg123_format_all: Tmpg123_format_all; + mpg123_format: Tmpg123_format; + mpg123_format_support: Tmpg123_format_support; + mpg123_getformat: Tmpg123_getformat; + mpg123_getformat2: Tmpg123_getformat2; + +(** \defgroup mpg123_input mpg123 file input and decoding + * Functions for input bitstream and decoding operations. *) + + mpg123_open: Tmpg123_open; + mpg123_open_fd: Tmpg123_open_fd; + +{$IF DEFINED(newversion)} +{$if not(defined(cpu64) and defined(unix))} + mpg123_open_32: Tmpg123_open_32; + mpg123_open_fd_32: Tmpg123_open_fd_32; + mpg123_open_handle_32 : Tmpg123_open_handle_32; +{$ifend} + mpg123_open_64: Tmpg123_open_64; + mpg123_open_fd_64: Tmpg123_open_fd_64; + mpg123_open_handle: Tmpg123_open_handle; + mpg123_open_handle_64: Tmpg123_open_handle_64; + mpg123_replace_reader: Tmpg123_replace_reader; + mpg123_replace_reader_handle: Tmpg123_replace_reader_handle; + mpg123_set_index: Tmpg123_set_index; + {$endif} + + mpg123_open_feed: Tmpg123_open_feed; + mpg123_close: Tmpg123_close; + mpg123_read: Tmpg123_read; + mpg123_feed: Tmpg123_feed; + mpg123_decode: Tmpg123_decode; + mpg123_decode_frame: Tmpg123_decode_frame; + mpg123_framepos: Tmpg123_framepos; + +{$IF DEFINED(newversion)} + {$if not(defined(cpu64) and defined(unix))} + mpg123_decode_frame_32: Tmpg123_decode_frame_32; + mpg123_framebyframe_decode_32: Tmpg123_framebyframe_decode_32; + mpg123_tell_32: Tmpg123_tell_32; + mpg123_framepos_32: Tmpg123_framepos_32; + mpg123_tellframe_32: Tmpg123_tellframe_32; + mpg123_seek_32: Tmpg123_seek_32; + mpg123_seek_frame_32: Tmpg123_seek_frame_32; + mpg123_timeframe_32: Tmpg123_timeframe_32; + mpg123_index_32: Tmpg123_index_32; + mpg123_set_index_32: Tmpg123_set_index_32; + mpg123_position_32: Tmpg123_position_32; + mpg123_framelength_32: Tmpg123_framelength_32; + mpg123_length_32: Tmpg123_length_32; + mpg123_set_filesize_32: Tmpg123_set_filesize_32; + mpg123_replace_reader_32: Tmpg123_replace_reader_32; + mpg123_replace_reader_handle_32: Tmpg123_replace_reader_handle_32; + {$ifend} + mpg123_framebyframe_decode: Tmpg123_framebyframe_decode; + mpg123_framebyframe_next: Tmpg123_framebyframe_next; + mpg123_framedata: Tmpg123_framedata; + mpg123_decode_frame_64: Tmpg123_decode_frame_64; + mpg123_framebyframe_decode_64: Tmpg123_framebyframe_decode_64; + mpg123_tell_64: Tmpg123_tell_64; + mpg123_framepos_64: Tmpg123_framepos_64; + mpg123_tellframe_64: Tmpg123_tellframe_64; + mpg123_seek_64: Tmpg123_seek_64; + mpg123_seek_frame_64: Tmpg123_seek_frame_64; + mpg123_timeframe_64: Tmpg123_timeframe_64; + mpg123_index_64: Tmpg123_index_64; + mpg123_set_index_64: Tmpg123_set_index_64; + mpg123_position_64: Tmpg123_position_64; + mpg123_framelength_64: Tmpg123_framelength_64; + mpg123_length_64: Tmpg123_length_64; + mpg123_set_filesize_64: Tmpg123_set_filesize_64; + mpg123_replace_reader_64: Tmpg123_replace_reader_64; + mpg123_replace_reader_handle_64: Tmpg123_replace_reader_handle_64; +{$endif} + + mpg123_tell: Tmpg123_tell; + mpg123_tellframe: Tmpg123_tellframe; + mpg123_tell_stream: Tmpg123_tell_stream; + mpg123_seek: Tmpg123_seek; + mpg123_feedseek: Tmpg123_feedseek; + mpg123_seek_frame: Tmpg123_seek_frame; + mpg123_timeframe: Tmpg123_timeframe; + mpg123_index: Tmpg123_index; + mpg123_position: Tmpg123_position; + +(** \defgroup mpg123_voleq mpg123 volume and equalizer **) + mpg123_eq: Tmpg123_eq; + mpg123_geteq: Tmpg123_geteq; + mpg123_reset_eq: Tmpg123_reset_eq; + mpg123_volume: Tmpg123_volume; + mpg123_volume_change: Tmpg123_volume_change; + mpg123_getvolume: Tmpg123_getvolume; + +(** \defgroup mpg123_status mpg123 status and information **) + mpg123_info: Tmpg123_info; + mpg123_safe_buffer: Tmpg123_safe_buffer; + mpg123_scan: Tmpg123_scan; + mpg123_length: Tmpg123_length; + mpg123_framelength: Tmpg123_framelength; + mpg123_set_filesize: Tmpg123_set_filesize; + mpg123_tpf: Tmpg123_tpf; + mpg123_spf: Tmpg123_spf; + mpg123_clip: Tmpg123_clip; + mpg123_getstate: Tmpg123_getstate; + +(** \defgroup mpg123_metadata mpg123 metadata handling *) + mpg123_init_string: Tmpg123_init_string; + mpg123_free_string: Tmpg123_free_string; + mpg123_resize_string: Tmpg123_resize_string; + mpg123_grow_string: Tmpg123_grow_string; + mpg123_copy_string: Tmpg123_copy_string; + mpg123_add_string: Tmpg123_add_string; + mpg123_add_substring: Tmpg123_add_substring; + mpg123_set_string: Tmpg123_set_string; + mpg123_set_substring: Tmpg123_set_substring; + mpg123_strlen: Tmpg123_strlen; + mpg123_chomp_string :Tmpg123_chomp_string; + + mpg123_enc_from_id3: Tmpg123_enc_from_id3; + mpg123_store_utf8: Tmpg123_store_utf8; + + mpg123_meta_check: Tmpg123_meta_check; + mpg123_meta_free: Tmpg123_meta_free; + mpg123_id3: Tmpg123_id3; + mpg123_icy: Tmpg123_icy; + mpg123_icy2utf8: Tmpg123_icy2utf8; + +(** \defgroup mpg123_advpar mpg123 advanced parameter API *) + mpg123_parnew: Tmpg123_parnew; + mpg123_new_pars: Tmpg123_new_pars; + mpg123_delete_pars: Tmpg123_delete_pars; + mpg123_fmt_none: Tmpg123_fmt_none; + mpg123_fmt_all: Tmpg123_fmt_all; + mpg123_fmt: Tmpg123_fmt; + mpg123_fmt_support: Tmpg123_fmt_support; + mpg123_par: Tmpg123_par; + mpg123_getpar: Tmpg123_getpar; + mpg123_replace_buffer: Tmpg123_replace_buffer; + mpg123_outblock: Tmpg123_outblock; + +{Special function for dynamic loading of lib ...} + +var + Mp_Handle: TLibHandle; + // this will hold our handle for the lib; it functions nicely as a mutli-lib prevention unit as well... + ReferenceCounter: cardinal = 0; // Reference counter + +function mp_IsLoaded: boolean; inline; +function mp_load(const libfilename: string): boolean; // load the lib + +function mp_unload(): boolean; +// unload and frees the lib from memory : do not forget to call it before close application. + +implementation + +function mp_IsLoaded: boolean; +begin + Result := (Mp_Handle <> dynlibs.NilHandle); +end; + +function mp_unload(): boolean; +begin +result := false; + // < Reference counting + if ReferenceCounter > 0 then + Dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if mp_IsLoaded then + begin + mpg123_exit ; + DynLibs.UnloadLibrary(mp_Handle); + mp_Handle := DynLibs.NilHandle; + result := true; + end; +end; + +function Mp_Load(const libfilename: string): boolean; +var +thelib: string; +begin + Result := False; + if Mp_Handle <> 0 then + begin + Result := True; {is it already there ?} + Inc(ReferenceCounter); + end + else + begin {go & load the library} + if Length(libfilename) = 0 then thelib := libmp else thelib := libfilename; + Mp_Handle := DynLibs.SafeLoadLibrary(thelib); // obtain the handle we want + if Mp_Handle <> DynLibs.NilHandle then + + begin + mpg123_init := Tmpg123_init(GetProcAddress(Mp_Handle, 'mpg123_init')); + mpg123_exit := Tmpg123_exit(GetProcAddress(Mp_Handle, 'mpg123_exit')); + mpg123_new := Tmpg123_new(GetProcAddress(Mp_Handle, 'mpg123_new')); + mpg123_delete := Tmpg123_delete(GetProcAddress(Mp_Handle, 'mpg123_delete')); + mpg123_param := Tmpg123_param(GetProcAddress(Mp_Handle, 'mpg123_param')); + mpg123_getparam := Tmpg123_getparam( + GetProcAddress(Mp_Handle, 'mpg123_getparam')); + mpg123_plain_strerror := Tmpg123_plain_strerror( + GetProcAddress(Mp_Handle, 'mpg123_plain_strerror')); + mpg123_strerror := Tmpg123_strerror( + GetProcAddress(Mp_Handle, 'mpg123_strerror')); + mpg123_errcode := Tmpg123_errcode(GetProcAddress(Mp_Handle, 'mpg123_errcode')); + mpg123_decoders := Tmpg123_decoders( + GetProcAddress(Mp_Handle, 'mpg123_decoders')); + mpg123_supported_decoders := + Tmpg123_supported_decoders(GetProcAddress(Mp_Handle, 'mpg123_supported_decoders')); + mpg123_decoder := Tmpg123_decoder(GetProcAddress(Mp_Handle, 'mpg123_decoder')); + mpg123_rates := Tmpg123_rates(GetProcAddress(Mp_Handle, 'mpg123_rates')); + mpg123_encodings := Tmpg123_encodings( + GetProcAddress(Mp_Handle, 'mpg123_encodings')); + mpg123_format_none := Tmpg123_format_none( + GetProcAddress(Mp_Handle, 'mpg123_format_none')); + mpg123_format_all := Tmpg123_format_all( + GetProcAddress(Mp_Handle, 'mpg123_format_all')); + mpg123_format := Tmpg123_format(GetProcAddress(Mp_Handle, 'mpg123_format')); + mpg123_format_support := Tmpg123_format_support( + GetProcAddress(Mp_Handle, 'mpg123_format_support')); + mpg123_getformat := Tmpg123_getformat( + GetProcAddress(Mp_Handle, 'mpg123_getformat')); + mpg123_open := Tmpg123_open(GetProcAddress(Mp_Handle, 'mpg123_open')); + mpg123_open_fd := Tmpg123_open_fd(GetProcAddress(Mp_Handle, 'mpg123_open_fd')); + + {$IF DEFINED(newversion)} + mpg123_open_handle := Tmpg123_open_handle(GetProcAddress(Mp_Handle, 'mpg123_open_handle')); + mpg123_replace_reader := Tmpg123_replace_reader(GetProcAddress(Mp_Handle, + 'mpg123_replace_reader')); + mpg123_replace_reader_handle := Tmpg123_replace_reader_handle(GetProcAddress(Mp_Handle, + 'mpg123_replace_reader_handle')); + mpg123_framebyframe_decode := Tmpg123_framebyframe_decode( + GetProcAddress(Mp_Handle, 'mpg123_framebyframe_decode')); + mpg123_framebyframe_next := Tmpg123_framebyframe_next( + GetProcAddress(Mp_Handle, 'mpg123_framebyframe_next')); + mpg123_framedata := Tmpg123_framedata( + GetProcAddress(Mp_Handle, 'mpg123_framedata')); + mpg123_meta_free := Tmpg123_meta_free( + GetProcAddress(Mp_Handle, 'mpg123_meta_free')); + mpg123_strlen := Tmpg123_strlen( + GetProcAddress(Mp_Handle, 'mpg123_strlen')); + mpg123_chomp_string := Tmpg123_chomp_string( + GetProcAddress(Mp_Handle, 'mpg123_chomp_string')); + mpg123_getformat2 := Tmpg123_getformat2( + GetProcAddress(Mp_Handle, 'mpg123_getformat2')); + mpg123_framepos := Tmpg123_framepos(GetProcAddress(Mp_Handle, 'mpg123_framepos')); + mpg123_framelength := Tmpg123_framelength(GetProcAddress(Mp_Handle, 'mpg123_framelength')); + mpg123_encsize := Tmpg123_encsize(GetProcAddress(Mp_Handle, 'mpg123_encsize')); + mpg123_set_index := Tmpg123_set_index(GetProcAddress(Mp_Handle, 'mpg123_set_index')); + + {$if not(defined(cpu64) and defined(unix))} + mpg123_open_32 := Tmpg123_open_32(GetProcAddress(Mp_Handle, 'mpg123_open_32')); + mpg123_open_fd_32 := Tmpg123_open_fd_32(GetProcAddress(Mp_Handle, 'mpg123_open_fd_32')); + mpg123_open_handle_32 := Tmpg123_open_handle_32(GetProcAddress(Mp_Handle, 'mpg123_open_handle_32')); + mpg123_decode_frame_32 := Tmpg123_decode_frame_32(GetProcAddress(Mp_Handle, 'mpg123_decode_frame_32')); + mpg123_framebyframe_decode_32 := Tmpg123_framebyframe_decode_32(GetProcAddress(Mp_Handle, 'mpg123_framebyframe_decode_32')); + mpg123_tell_32 := Tmpg123_tell_32(GetProcAddress(Mp_Handle, 'mpg123_tell_32')); + mpg123_framepos_32 := Tmpg123_framepos_32(GetProcAddress(Mp_Handle, 'mpg123_framepos_32')); + mpg123_tellframe_32 := Tmpg123_tellframe_32(GetProcAddress(Mp_Handle, 'mpg123_tellframe_32')); + mpg123_seek_32 := Tmpg123_seek_32(GetProcAddress(Mp_Handle, 'mpg123_seek_32')); + mpg123_seek_frame_32 := Tmpg123_seek_frame_32(GetProcAddress(Mp_Handle, 'mpg123_seek_frame_32')); + mpg123_timeframe_32 := Tmpg123_timeframe_32(GetProcAddress(Mp_Handle, 'mpg123_timeframe_32')); + mpg123_index_32 := Tmpg123_index_32(GetProcAddress(Mp_Handle, 'mpg123_index_32')); + mpg123_set_index_32 := Tmpg123_set_index_32(GetProcAddress(Mp_Handle, 'mpg123_set_index_32')); + mpg123_position_32 := Tmpg123_position_32(GetProcAddress(Mp_Handle, 'mpg123_position_32')); + mpg123_framelength_32 := Tmpg123_framelength_32(GetProcAddress(Mp_Handle, 'mpg123_framelength_32')); + mpg123_length_32 := Tmpg123_length_32(GetProcAddress(Mp_Handle, 'mpg123_length_32')); + mpg123_set_filesize_32 := Tmpg123_set_filesize_32(GetProcAddress(Mp_Handle, 'mpg123_set_filesize_32')); + mpg123_replace_reader_32 := Tmpg123_replace_reader_32(GetProcAddress(Mp_Handle, 'mpg123_replace_reader_32')); + mpg123_replace_reader_handle_32 := Tmpg123_replace_reader_handle_32(GetProcAddress(Mp_Handle, 'mpg123_replace_reader_handle_32')); + {$endif} + + mpg123_open_64 := Tmpg123_open_64(GetProcAddress(Mp_Handle, 'mpg123_open_64')); + mpg123_open_fd_64 := Tmpg123_open_fd_64(GetProcAddress(Mp_Handle, 'mpg123_open_fd_64')); + mpg123_open_handle_64 := Tmpg123_open_handle_64(GetProcAddress(Mp_Handle, 'mpg123_open_handle_64')); + mpg123_decode_frame_64 := Tmpg123_decode_frame_64(GetProcAddress(Mp_Handle, 'mpg123_decode_frame_64')); + mpg123_framebyframe_decode_64 := Tmpg123_framebyframe_decode_64(GetProcAddress(Mp_Handle, 'mpg123_framebyframe_decode_64')); + mpg123_tell_64 := Tmpg123_tell_64(GetProcAddress(Mp_Handle, 'mpg123_tell_64')); + mpg123_framepos_64 := Tmpg123_framepos_64(GetProcAddress(Mp_Handle, 'mpg123_framepos_64')); + mpg123_tellframe_64 := Tmpg123_tellframe_64(GetProcAddress(Mp_Handle, 'mpg123_tellframe_64')); + mpg123_seek_64 := Tmpg123_seek_64(GetProcAddress(Mp_Handle, 'mpg123_seek_64')); + mpg123_seek_frame_64 := Tmpg123_seek_frame_64(GetProcAddress(Mp_Handle, 'mpg123_seek_frame_64')); + mpg123_timeframe_64 := Tmpg123_timeframe_64(GetProcAddress(Mp_Handle, 'mpg123_timeframe_64')); + mpg123_index_64 := Tmpg123_index_64(GetProcAddress(Mp_Handle, 'mpg123_index_64')); + mpg123_set_index_64 := Tmpg123_set_index_64(GetProcAddress(Mp_Handle, 'mpg123_set_index_64')); + mpg123_position_64 := Tmpg123_position_64(GetProcAddress(Mp_Handle, 'mpg123_position_64')); + mpg123_framelength_64 := Tmpg123_framelength_64(GetProcAddress(Mp_Handle, 'mpg123_framelength_64')); + mpg123_length_64 := Tmpg123_length_64(GetProcAddress(Mp_Handle, 'mpg123_length_64')); + mpg123_set_filesize_64 := Tmpg123_set_filesize_64(GetProcAddress(Mp_Handle, 'mpg123_set_filesize_64')); + mpg123_replace_reader_64 := Tmpg123_replace_reader_64(GetProcAddress(Mp_Handle, 'mpg123_replace_reader_64')); + mpg123_replace_reader_handle_64 := Tmpg123_replace_reader_handle_64(GetProcAddress(Mp_Handle, 'mpg123_replace_reader_handle_64')); + + {$endif} + + mpg123_open_feed := Tmpg123_open_feed( + GetProcAddress(Mp_Handle, 'mpg123_open_feed')); + mpg123_close := Tmpg123_close(GetProcAddress(Mp_Handle, 'mpg123_close')); + mpg123_read := Tmpg123_read(GetProcAddress(Mp_Handle, 'mpg123_read')); + mpg123_decode := Tmpg123_decode(GetProcAddress(Mp_Handle, 'mpg123_decode')); + mpg123_decode_frame := Tmpg123_decode_frame( + GetProcAddress(Mp_Handle, 'mpg123_decode_frame')); + mpg123_tell := Tmpg123_tell(GetProcAddress(Mp_Handle, 'mpg123_tell')); + mpg123_tellframe := Tmpg123_tellframe( + GetProcAddress(Mp_Handle, 'mpg123_tellframe')); + mpg123_seek := Tmpg123_seek(GetProcAddress(Mp_Handle, 'mpg123_seek')); + mpg123_feedseek := Tmpg123_feedseek( + GetProcAddress(Mp_Handle, 'mpg123_feedseek')); + mpg123_seek_frame := Tmpg123_seek_frame( + GetProcAddress(Mp_Handle, 'mpg123_seek_frame')); + mpg123_timeframe := Tmpg123_timeframe( + GetProcAddress(Mp_Handle, 'mpg123_timeframe')); + mpg123_index := Tmpg123_index(GetProcAddress(Mp_Handle, 'mpg123_index')); + mpg123_position := Tmpg123_position( + GetProcAddress(Mp_Handle, 'mpg123_position')); + mpg123_eq := Tmpg123_eq(GetProcAddress(Mp_Handle, 'mpg123_eq')); + mpg123_reset_eq := Tmpg123_reset_eq( + GetProcAddress(Mp_Handle, 'mpg123_reset_eq')); + mpg123_volume := Tmpg123_volume(GetProcAddress(Mp_Handle, 'mpg123_volume')); + mpg123_volume_change := Tmpg123_volume_change( + GetProcAddress(Mp_Handle, 'mpg123_volume_change')); + mpg123_getvolume := Tmpg123_getvolume( + GetProcAddress(Mp_Handle, 'mpg123_getvolume')); + mpg123_info := Tmpg123_info(GetProcAddress(Mp_Handle, 'mpg123_info')); + mpg123_safe_buffer := Tmpg123_safe_buffer( + GetProcAddress(Mp_Handle, 'mpg123_safe_buffer')); + mpg123_scan := Tmpg123_scan(GetProcAddress(Mp_Handle, 'mpg123_scan')); + mpg123_length := Tmpg123_length(GetProcAddress(Mp_Handle, 'mpg123_length')); + mpg123_tpf := Tmpg123_tpf(GetProcAddress(Mp_Handle, 'mpg123_tpf')); + mpg123_spf := Tmpg123_spf(GetProcAddress(Mp_Handle, 'mpg123_spf')); + mpg123_clip := Tmpg123_clip(GetProcAddress(Mp_Handle, 'mpg123_clip')); + mpg123_init_string := Tmpg123_init_string( + GetProcAddress(Mp_Handle, 'mpg123_init_string')); + mpg123_free_string := Tmpg123_free_string( + GetProcAddress(Mp_Handle, 'mpg123_free_string')); + mpg123_resize_string := Tmpg123_resize_string( + GetProcAddress(Mp_Handle, 'mpg123_resize_string')); + mpg123_copy_string := Tmpg123_copy_string( + GetProcAddress(Mp_Handle, 'mpg123_copy_string')); + mpg123_add_string := Tmpg123_add_string( + GetProcAddress(Mp_Handle, 'mpg123_add_string')); + mpg123_add_substring := Tmpg123_add_substring( + GetProcAddress(Mp_Handle, 'mpg123_add_substring')); + mpg123_set_string := Tmpg123_set_string( + GetProcAddress(Mp_Handle, 'mpg123_set_string')); + mpg123_set_substring := Tmpg123_set_substring( + GetProcAddress(Mp_Handle, 'mpg123_set_substring')); + mpg123_meta_check := Tmpg123_meta_check( + GetProcAddress(Mp_Handle, 'mpg123_meta_check')); + mpg123_id3 := Tmpg123_id3(GetProcAddress(Mp_Handle, 'mpg123_id3')); + mpg123_icy := Tmpg123_icy(GetProcAddress(Mp_Handle, 'mpg123_icy')); + mpg123_parnew := Tmpg123_parnew(GetProcAddress(Mp_Handle, 'mpg123_parnew')); + mpg123_new_pars := Tmpg123_new_pars( + GetProcAddress(Mp_Handle, 'mpg123_new_pars')); + mpg123_delete_pars := Tmpg123_delete_pars( + GetProcAddress(Mp_Handle, 'mpg123_delete_pars')); + mpg123_fmt_none := Tmpg123_fmt_none( + GetProcAddress(Mp_Handle, 'mpg123_fmt_none')); + mpg123_fmt_all := Tmpg123_fmt_all(GetProcAddress(Mp_Handle, 'mpg123_fmt_all')); + mpg123_fmt := Tmpg123_fmt(GetProcAddress(Mp_Handle, 'mpg123_fmt')); + mpg123_fmt_support := Tmpg123_fmt_support( + GetProcAddress(Mp_Handle, 'mpg123_fmt_support')); + mpg123_par := Tmpg123_par(GetProcAddress(Mp_Handle, 'mpg123_par')); + mpg123_getpar := Tmpg123_getpar(GetProcAddress(Mp_Handle, 'mpg123_getpar')); + mpg123_replace_buffer := Tmpg123_replace_buffer( + GetProcAddress(Mp_Handle, 'mpg123_replace_buffer')); + mpg123_outblock := Tmpg123_outblock( + GetProcAddress(Mp_Handle, 'mpg123_outblock')); + end; + Result := mp_IsLoaded; + ReferenceCounter := 1; + + end; +end; + +end. diff --git a/UOS/examples/uos_opus.pas b/UOS/examples/uos_opus.pas new file mode 100644 index 0000000..690225c --- /dev/null +++ b/UOS/examples/uos_opus.pas @@ -0,0 +1,694 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Pascal Wrapper + Dynamic loading of Opus library. + Load library with op_load() and release with op_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com} + +unit uos_opus; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} +{$PACKENUM 4}(* use 4-byte enums *) + +interface + +uses + dynlibs, CTypes, SysUtils; + +const + OPUS_OK = 0; + OPUS_BAD_ARG = -1; + OPUS_BUFFER_TOO_SMALL = -2; + OPUS_INTERNAL_ERROR = -3; + OPUS_INVALID_PACKET = -4; + OPUS_UNIMPLEMENTED = -5; + OPUS_INVALID_STATE = -6; + OPUS_ALLOC_FAIL = -7; + + OPUS_APPLICATION_VOIP = 2048; + OPUS_APPLICATION_AUDIO = 2049; + OPUS_APPLICATION_RESTRICTED_LOWDELAY = 2051; + + OPUS_SIGNAL_VOICE = 3001; // Signal being encoded is voice + OPUS_SIGNAL_MUSIC = 3002; // Signal being encoded is music + + OPUS_BANDWIDTH_NARROWBAND = 1101; // 4 kHz bandpass @hideinitializer + OPUS_BANDWIDTH_MEDIUMBAND = 1102; // 6 kHz bandpass @hideinitializer + OPUS_BANDWIDTH_WIDEBAND = 1103; // 8 kHz bandpass @hideinitializer + OPUS_BANDWIDTH_SUPERWIDEBAND = 1104; // 12 kHz bandpass @hideinitializer + OPUS_BANDWIDTH_FULLBAND = 1105; // 20 kHz bandpass @hideinitializer + + OPUS_FRAMESIZE_ARG = 5000; // Select frame size from the argument (default) + OPUS_FRAMESIZE_2_5_MS = 5001; // Use 2.5 ms frames + OPUS_FRAMESIZE_5_MS = 5002; // Use 5 ms frames + OPUS_FRAMESIZE_10_MS = 5003; // Use 10 ms frames + OPUS_FRAMESIZE_20_MS = 5004; // Use 20 ms frames + OPUS_FRAMESIZE_40_MS = 5005; // Use 40 ms frames + OPUS_FRAMESIZE_60_MS = 5006; // Use 60 ms frames + +const + OPUS_SET_APPLICATION_REQUEST = 4000; + OPUS_GET_APPLICATION_REQUEST = 4001; + OPUS_SET_BITRATE_REQUEST = 4002; + OPUS_GET_BITRATE_REQUEST = 4003; + OPUS_SET_MAX_BANDWIDTH_REQUEST = 4004; + OPUS_GET_MAX_BANDWIDTH_REQUEST = 4005; + OPUS_SET_VBR_REQUEST = 4006; + OPUS_GET_VBR_REQUEST = 4007; + OPUS_SET_BANDWIDTH_REQUEST = 4008; + OPUS_GET_BANDWIDTH_REQUEST = 4009; + OPUS_SET_COMPLEXITY_REQUEST = 4010; + OPUS_GET_COMPLEXITY_REQUEST = 4011; + OPUS_SET_INBAND_FEC_REQUEST = 4012; + OPUS_GET_INBAND_FEC_REQUEST = 4013; + OPUS_SET_PACKET_LOSS_PERC_REQUEST = 4014; + OPUS_GET_PACKET_LOSS_PERC_REQUEST = 4015; + OPUS_SET_DTX_REQUEST = 4016; + OPUS_GET_DTX_REQUEST = 4017; + OPUS_SET_VBR_CONSTRAINT_REQUEST = 4020; + OPUS_GET_VBR_CONSTRAINT_REQUEST = 4021; + OPUS_SET_FORCE_CHANNELS_REQUEST = 4022; + OPUS_GET_FORCE_CHANNELS_REQUEST = 4023; + OPUS_SET_SIGNAL_REQUEST = 4024; + OPUS_GET_SIGNAL_REQUEST = 4025; + OPUS_GET_LOOKAHEAD_REQUEST = 4027; + OPUS_RESET_STATE_REQUEST = 4028; + OPUS_GET_SAMPLE_RATE_REQUEST = 4029; + OPUS_GET_FINAL_RANGE_REQUEST = 4031; + OPUS_GET_PITCH_REQUEST = 4033; + OPUS_SET_GAIN_REQUEST = 4034; + OPUS_GET_GAIN_REQUEST = 4045; + OPUS_SET_LSB_DEPTH_REQUEST = 4036; + OPUS_GET_LSB_DEPTH_REQUEST = 4037; + OPUS_GET_LAST_PACKET_DURATION_REQUEST = 4039; + OPUS_SET_EXPERT_FRAME_DURATION_REQUEST = 4040; + OPUS_GET_EXPERT_FRAME_DURATION_REQUEST = 4041; + OPUS_SET_PREDICTION_DISABLED_REQUEST = 4042; + OPUS_GET_PREDICTION_DISABLED_REQUEST = 4043; + OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST = 5120; + OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST = 5122; + +type + TOpusEncoder = Pointer; + TOpusDecoder = Pointer; + TOpusRepacketizer = Pointer; + TOpusMSDecoder = pointer; + TOpusMSEncoder = pointer; + + TOpusFrames = array [0..47] of Pointer; + TOpusFrameSizes = array [0..47] of cint; + +type + TRequestValueType = (orPointer, orInteger, orXY, orNoValue); + TOpusCTLRequestRecord = record + Request: Word; + case ReqType: TRequestValueType of + orPointer: (PtrValue: Pointer); + orInteger: (IntValue: cint); + orXY: (XValue: cint; YValue: pointer); + end; + + var + opus_get_version_string: function(): PAnsiChar; cdecl; opus_strerror: function(error: cint): PAnsiChar; cdecl; + opus_encode: function(st: TOpusEncoder; pcm : pcfloat; frame_size: cint; + var data; max_data_bytes: cint): cint; cdecl; + opus_encode_float: function(st: TOpusEncoder; pcm : pcfloat; frame_size: cint; var data; max_data_bytes: cint): cint; cdecl; + opus_encoder_create: function(Fs: cint; channels, application: cint; out error: cint): TOpusEncoder; cdecl; + + opus_encoder_ctli: function(st: TOpusEncoder; const reqrequest: word ; reqval : cint ): cint; cdecl; + opus_encoder_ctlp: function(st: TOpusEncoder; const reqrequest: word ; reqval : pointer ): cint; cdecl; + opus_encoder_ctlxy: function(st: TOpusEncoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl; + opus_encoder_ctln: function(st: TOpusEncoder; const reqrequest: word): cint; cdecl; + + opus_encoder_destroy: procedure(st: TOpusEncoder); cdecl; + opus_encoder_get_size: function(channels: cint): cint; cdecl; + opus_encoder_init: function(st: TOpusEncoder; Fs: cint; channels, application: cint): cint; cdecl; + + opus_decode: function(st: TOpusDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl; + opus_decode_float: function(st: TOpusDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl; + opus_decoder_create: function(fs: cint; channels: cint; out error: cint): TOpusDecoder; cdecl; + + opus_decoder_ctli: function(st: TOpusDecoder; const reqrequest: word ; reqval : cint ): cint; cdecl; + opus_decoder_ctlp: function(st: TOpusDecoder; const reqrequest: word ; reqval : pointer ): cint; cdecl; + opus_decoder_ctlxy: function(st: TOpusDecoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl; + opus_decoder_ctln: function(st: TOpusDecoder; const reqrequest: word): cint; cdecl; + + opus_decoder_destroy: procedure(st: TOpusDecoder); cdecl; + opus_decoder_get_nb_samples: function(st: TOpusDecoder; const packet; len: cint): cint; cdecl; + opus_decoder_get_size: function(channels: cint): cint; cdecl; + opus_decoder_init: function(st: TOpusDecoder; Fs: cint; channels: cint): cint; cdecl; + opus_packet_get_bandwidth: function(const packet): cint; cdecl; + opus_packet_get_nb_channels: function(const packet): cint; cdecl; + opus_packet_get_nb_frames: function(const packet; len: cint): cint; cdecl; + opus_packet_get_nb_samples: function(const packet; len, fs: cint): cint; cdecl; + opus_packet_get_samples_per_frame: function(const packet; fs: cint): cint; cdecl; + opus_packet_parse: function(const packet; var out_toc: Pointer; var frames: TOpusFrames; var size: TOpusFrameSizes; var payload_offset: cint): cint; cdecl; + opus_pcm_soft_clip: procedure(pcm : pcfloat; frame_size, channels: cint; var softclip_mem: Double); cdecl; + + opus_multistream_packet_pad: function(var data; len, new_len, nb_streams: cint): cint; cdecl; + opus_multistream_packet_unpad: function(var data; len, nb_streams: cint): cint; cdecl; + opus_packet_pad: function(var data; len, new_len: cint): cint; cdecl; + opus_packet_unpad: function(var data; len: cint): cint; cdecl; + opus_repacketizer_cat: function(rp: TOpusRepacketizer; const data; len: cint): cint; cdecl; + opus_repacketizer_create: function: TOpusRepacketizer; cdecl; + opus_repacketizer_destroy: procedure(rp: TOpusRepacketizer); cdecl; + opus_repacketizer_get_nb_frames: function(rp: TOpusRepacketizer): cint; cdecl; + opus_repacketizer_get_size: function: cint; cdecl; + opus_repacketizer_init: function(rp: TOpusRepacketizer): TOpusRepacketizer; cdecl; + opus_repacketizer_out: function(rp: TOpusRepacketizer; var data; maxlen: cint): cint; cdecl; + opus_repacketizer_out_range: function(rp: TOpusRepacketizer; var data; maxlen: cint): cint; cdecl; + + opus_multistream_decode: function(st: TOpusMSDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl; + opus_multistream_decode_float: function(st: TOpusMSDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl; + opus_multistream_decoder_create: function(fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte; out error: cint): TOpusMSDecoder; cdecl; + + opus_multistream_decoder_ctli: function(st: TOpusMSDecoder; const reqrequest: word ; reqval : cint ): cint; cdecl; + opus_multistream_decoder_ctlp: function(st: TOpusMSDecoder; const reqrequest: word ; reqval : pointer ): cint; cdecl; + opus_multistream_decoder_ctlxy: function(st: TOpusMSDecoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl; + opus_multistream_decoder_ctln: function(st: TOpusMSDecoder; const reqrequest: word): cint; cdecl; + + opus_multistream_decoder_destroy: procedure(st: TOpusMSDecoder); cdecl; + opus_multistream_decoder_get_size: function(streams, coupled_streams: cint): cint; cdecl; + opus_multistream_decoder_init: function(st: TOpusMSDecoder; fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte): cint; cdecl; + + opus_multistream_encode: function(st: TOpusMSEncoder; pcm : pcfloat; frame_size: cint; var data; max_data_bytes: cint): cint; cdecl; + opus_multistream_encode_float: function(st: TOpusMSEncoder; pcm : pcfloat; frame_size: cint; var data; max_data_bytes: cint): cint; cdecl; + opus_multistream_encoder_create: function(Fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte; application: cint; out error: cint): TOpusMSEncoder; cdecl; + + opus_multistream_encoder_ctli: function(st: TOpusMSEncoder; const reqrequest: word ; reqval : cint ): cint; cdecl; + opus_multistream_encoder_ctlp: function(st: TOpusMSEncoder; const reqrequest: word ; reqval : pointer ): cint; cdecl; + opus_multistream_encoder_ctlxy: function(st: TOpusMSEncoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl; + opus_multistream_encoder_ctln: function(st: TOpusMSEncoder; const reqrequest: word ): cint; cdecl; + + opus_multistream_encoder_destroy: procedure(st: TOpusMSEncoder); cdecl; + opus_multistream_encoder_get_size: function(streams, coupled_streams: cint): cint; cdecl; + opus_multistream_encoder_init: function(st: TOpusMSEncoder; fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte; application: cint): cint; cdecl; + + opus_multistream_surround_encoder_create: function(Fs: cint; channels, mapping_family, streams, coupled_streams: cint; const mapping: array of Byte; application: cint; out error: cint): TOpusMSEncoder; cdecl; + opus_multistream_surround_encoder_get_size: function(channels, mapping_family: cint): cint; cdecl; + opus_multistream_surround_encoder_init: function(st: TOpusMSEncoder; fs: cint; channels, mapping_family, streams, coupled_streams: cint; const mapping: array of Byte; application: cint): cint; cdecl; + +function opus_encoder_ctl(st: TOpusEncoder; const req: TOpusCTLRequestRecord): Integer; inline; +function opus_decoder_ctl(st: TOpusdecoder; const req: TOpusCTLRequestRecord): Integer; inline; + +function opus_multistream_encoder_ctl(st: TOpusMSEncoder; const req: TOpusCTLRequestRecord): cint; inline; +function opus_multistream_decoder_ctl(st: TOpusMSdecoder; const req: TOpusCTLRequestRecord): cint; inline; + +// Macros for opus_encode_ctl. +function OPUS_GET_APPLICATION(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_BITRATE(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_COMPLEXITY(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_DTX(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_EXPERT_FRAME_DURATION(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_FORCE_CHANNELS(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_LOOKAHEAD(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_LSB_DEPTH(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_MAX_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_PACKET_LOSS_PERC(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_PREDICTION_DISABLED(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_SIGNAL(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_VBR(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_VBR_CONSTRAINT(var x: cint): TOpusCTLRequestRecord; inline; + +function OPUS_SET_APPLICATION(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_BITRATE(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_COMPLEXITY(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_DTX(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_EXPERT_FRAME_DURATION(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_FORCE_CHANNELS(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_INBAND_FEC(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_LSB_DEPTH(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_MAX_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_PACKET_LOSS_PERC(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_PREDICTION_DISABLED(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_SIGNAL(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_VBR(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_VBR_CONSTRAINT(x: cint): TOpusCTLRequestRecord; inline; + +// For opus_decoder_ctl and opus_encoder_ctl. +function OPUS_GET_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_FINAL_RANGE(var x: Cardinal): TOpusCTLRequestRecord; inline; +function OPUS_GET_SAMPLE_RATE(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_RESET_STATE: TOpusCTLRequestRecord; inline; + +// For the opus_decode_ctl. +function OPUS_GET_GAIN(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_LAST_PACKET_DURATION(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_PITCH(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_GAIN(x: cint): TOpusCTLRequestRecord; inline; + +function OPUS_MULTISTREAM_GET_DECODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline; +function OPUS_MULTISTREAM_GET_ENCODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline; + + var op_Handle:TLibHandle=dynlibs.NilHandle; + + var ReferenceCounter : cardinal = 0; + +function op_IsLoaded : boolean; inline; + +Function op_Load(const libfilename:string) :boolean; + +Procedure op_Unload; + +implementation + +function op_IsLoaded: boolean; +begin + Result := (op_Handle <> dynlibs.NilHandle); +end; + +Procedure op_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if op_IsLoaded then + begin + DynLibs.UnloadLibrary(op_Handle); + op_Handle:=DynLibs.NilHandle; + end; +end; + +Function op_Load (const libfilename:string) :boolean; +begin + Result := False; + if op_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin {go & load the library} + if Length(libfilename) = 0 then exit; + op_Handle:=DynLibs.SafeLoadLibrary(libfilename); // obtain the handle we want + if op_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} +Pointer(opus_get_version_string):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_get_version_string')); +Pointer(opus_strerror):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_strerror')); +Pointer(opus_encode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encode')); +Pointer(opus_encode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encode_float')); +Pointer(opus_encoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_create')); + +Pointer(opus_encoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl')); +Pointer(opus_encoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl')); +Pointer(opus_encoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl')); +Pointer(opus_encoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl')); + +Pointer(opus_encoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_destroy')); +Pointer(opus_encoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_get_size')); +Pointer(opus_encoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_init')); +Pointer(opus_decode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decode')); +Pointer(opus_decode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decode_float')); +Pointer(opus_decoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_create')); + +Pointer(opus_decoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl')); +Pointer(opus_decoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl')); +Pointer(opus_decoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl')); +Pointer(opus_decoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl')); + +Pointer(opus_decoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_destroy')); +Pointer(opus_decoder_get_nb_samples):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_get_nb_samples')); +Pointer(opus_decoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_get_size')); +Pointer(opus_decoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_init')); +Pointer(opus_packet_get_bandwidth):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_bandwidth')); +Pointer(opus_packet_get_nb_channels):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_nb_channels')); +Pointer(opus_packet_get_nb_frames):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_nb_frames')); +Pointer(opus_packet_get_nb_samples):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_nb_samples')); +Pointer(opus_packet_get_samples_per_frame):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_samples_per_frame')); +Pointer( opus_packet_parse):=DynLibs.GetProcedureAddress(OP_Handle,PChar(' opus_packet_parse')); +Pointer(opus_pcm_soft_clip):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_pcm_soft_clip')); +Pointer(opus_multistream_packet_pad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_packet_pad')); +Pointer(opus_multistream_packet_unpad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_packet_unpad')); +Pointer(opus_packet_pad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_pad')); +Pointer(opus_packet_unpad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_unpad')); +Pointer(opus_repacketizer_cat):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_cat')); +Pointer(opus_repacketizer_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_create')); +Pointer(opus_repacketizer_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('oopus_repacketizer_destroy')); +Pointer(opus_repacketizer_get_nb_frames):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_get_nb_frames')); +Pointer(opus_repacketizer_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_get_size')); +Pointer(opus_repacketizer_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_init')); +Pointer(opus_repacketizer_out):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_out')); +Pointer(opus_repacketizer_out_range):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_out_range')); +Pointer(opus_multistream_decode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decode')); +Pointer(opus_multistream_decode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decode_float')); +Pointer(opus_multistream_decoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_create')); + +Pointer(opus_multistream_decoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl')); +Pointer(opus_multistream_decoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl')); +Pointer(opus_multistream_decoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl')); +Pointer(opus_multistream_decoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl')); + +Pointer(opus_multistream_decoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_destroy')); +Pointer(opus_multistream_decoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_get_size')); +Pointer(opus_multistream_decoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_init')); +Pointer(opus_multistream_encode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encode')); +Pointer(opus_multistream_encode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encode_float')); +Pointer(opus_multistream_encoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_create')); + +Pointer(opus_multistream_encoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl')); +Pointer(opus_multistream_encoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl')); +Pointer(opus_multistream_encoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl')); +Pointer(opus_multistream_encoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl')); + +Pointer(opus_multistream_encoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_destroy')); +Pointer(opus_multistream_encoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_get_size')); +Pointer(opus_multistream_encoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_init')); +Pointer(opus_multistream_surround_encoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_surround_encoder_create')); +Pointer(opus_multistream_surround_encoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_surround_encoder_get_size')); +Pointer(opus_multistream_surround_encoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_surround_encoder_init')); + +end; + Result := op_IsLoaded; + ReferenceCounter:=1; +end; + +end; + + +function OPUS_GET_APPLICATION(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_APPLICATION_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_BITRATE(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_BITRATE_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_COMPLEXITY(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_COMPLEXITY_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_DTX(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_DTX_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_EXPERT_FRAME_DURATION(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_EXPERT_FRAME_DURATION_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_FORCE_CHANNELS(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_FORCE_CHANNELS_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_LOOKAHEAD(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_LOOKAHEAD_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_LSB_DEPTH(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_LSB_DEPTH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_MAX_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_MAX_BANDWIDTH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_PACKET_LOSS_PERC(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_PACKET_LOSS_PERC_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_PREDICTION_DISABLED(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_PREDICTION_DISABLED_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_SIGNAL(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_SIGNAL_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_VBR(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_VBR_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_VBR_CONSTRAINT(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_VBR_CONSTRAINT_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_SET_APPLICATION(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_APPLICATION_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_BANDWIDTH_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_BITRATE(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_BITRATE_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_COMPLEXITY(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_COMPLEXITY_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_DTX(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_DTX_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_EXPERT_FRAME_DURATION(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_EXPERT_FRAME_DURATION_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_FORCE_CHANNELS(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_FORCE_CHANNELS_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_INBAND_FEC(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_INBAND_FEC_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_LSB_DEPTH(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_LSB_DEPTH_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_MAX_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_MAX_BANDWIDTH_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_PACKET_LOSS_PERC(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_PACKET_LOSS_PERC_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_PREDICTION_DISABLED(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_PREDICTION_DISABLED_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_SIGNAL(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_SIGNAL_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_VBR(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_VBR_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_VBR_CONSTRAINT(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_VBR_CONSTRAINT_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_GET_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_BANDWIDTH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_FINAL_RANGE(var x: Cardinal): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_BANDWIDTH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_SAMPLE_RATE(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_BANDWIDTH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_RESET_STATE: TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_RESET_STATE_REQUEST; + Result.ReqType := orNoValue; +end; + +function OPUS_GET_GAIN(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_GAIN_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_LAST_PACKET_DURATION(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_LAST_PACKET_DURATION_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_PITCH(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_PITCH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_SET_GAIN(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_GAIN_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_MULTISTREAM_GET_DECODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST; + Result.ReqType := orXY; + Result.XValue := x; + Result.YValue := @y; +end; + +function OPUS_MULTISTREAM_GET_ENCODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST; + Result.ReqType := orXY; + Result.XValue := x; + Result.YValue := @y; +end; + +function opus_encoder_ctl(st: TOpusEncoder; const req: TOpusCTLRequestRecord): Integer; inline; +begin + case req.ReqType of + orPointer: Result := opus_encoder_ctlp(st, req.Request, req.PtrValue); + orInteger: Result := opus_encoder_ctli(st, req.Request, req.IntValue); + orXY: Result := opus_encoder_ctlxy(st, req.Request, req.XValue, req.YValue); + orNoValue: Result := opus_encoder_ctln(st, req.Request); + else + Result := OPUS_BAD_ARG; + end; +end; + +function opus_decoder_ctl(st: TOpusDecoder; const req: TOpusCTLRequestRecord): Integer; inline; +begin + case req.ReqType of + orPointer: Result := opus_decoder_ctlp(st, req.Request, req.PtrValue); + orInteger: Result := opus_decoder_ctli(st, req.Request, req.IntValue); + orXY: Result := opus_decoder_ctlxy(st, req.Request, req.XValue, req.YValue); + orNoValue: Result := opus_decoder_ctln(st, req.Request); + else + Result := OPUS_BAD_ARG; + end; +end; + +function opus_multistream_encoder_ctl(st: TOpusMSEncoder; const req: TOpusCTLRequestRecord): Integer; inline; +begin + case req.ReqType of + orPointer: Result := opus_multistream_encoder_ctlp(st, req.Request, req.PtrValue); + orInteger: Result := opus_multistream_encoder_ctli(st, req.Request, req.IntValue); + orXY: Result := opus_multistream_encoder_ctlxy(st, req.Request, req.XValue, req.YValue); + orNoValue: Result := opus_multistream_encoder_ctln(st, req.Request); + else + Result := OPUS_BAD_ARG; + end; +end; + +function opus_multistream_decoder_ctl(st: TOpusMSDecoder; const req: TOpusCTLRequestRecord): Integer; inline; +begin + case req.ReqType of + orPointer: Result := opus_multistream_decoder_ctlp(st, req.Request, req.PtrValue); + orInteger: Result := opus_multistream_decoder_ctli(st, req.Request, req.IntValue); + orXY: Result := opus_multistream_decoder_ctlxy(st, req.Request, req.XValue, req.YValue); + orNoValue: Result := opus_multistream_decoder_ctln(st, req.Request); + else + Result := OPUS_BAD_ARG; + end; +end; + +end. diff --git a/UOS/examples/uos_opusfile.pas b/UOS/examples/uos_opusfile.pas new file mode 100644 index 0000000..9266b57 --- /dev/null +++ b/UOS/examples/uos_opusfile.pas @@ -0,0 +1,471 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Pascal Wrapper + Dynamic loading of OpusFile library. + Load library with of_load() and release with of_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com} + +unit uos_OpusFile; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + ctypes, dynlibs, classes, pipes, SysUtils; + +type + TOpusFile = ^OpusFile; + OpusFile = record + end; + +const +libop= + {$IFDEF unix} +{$IFDEF darwin} + 'libopusfile.0.dylib'; + {$ELSE} +'libopusfile.so.0'; + {$ENDIF} + {$ELSE} + 'opusfile.dll'; + {$ENDIF} + +// Error Codes +const + OP_FALSE = -1; + OP_HOLE = -3; + OP_EREAD = -128; + OP_EFAULT = -129; + OP_EIMPL = -130; + OP_EINVAL = -131; + OP_ENOTVORBIS = -132; + OP_EBADHEADER = -133; + OP_EVERSION = -134; + OP_ENOTAUDIO = -135; + OP_EBADPACKET = -136; + OP_EBADLINK = -137; + OP_ENOSEEK = -138; + OP_EBADTIMESTAMP = -139; + +{ +/**A request did not succeed.*/ +#define OP_FALSE (-1) +/*Currently not used externally.*/ +#define OP_EOF (-2) +/**There was a hole in the page sequence numbers (e.g., a page was corrupt or + missing).*/ +#define OP_HOLE (-3) +/**An underlying read, seek, or tell operation failed when it should have + succeeded.*/ +#define OP_EREAD (-128) +/**A <code>NULL</code> pointer was passed where one was unexpected, or an + internal memory allocation failed, or an internal library error was + encountered.*/ +#define OP_EFAULT (-129) +/**The stream used a feature that is not implemented, such as an unsupported + channel family.*/ +#define OP_EIMPL (-130) +/**One or more parameters to a function were invalid.*/ +#define OP_EINVAL (-131) +/**A purported Ogg Opus stream did not begin with an Ogg page, a purported + header packet did not start with one of the required strings, "OpusHead" or + "OpusTags", or a link in a chained file was encountered that did not + contain any logical Opus streams.*/ +#define OP_ENOTFORMAT (-132) +/**A required header packet was not properly formatted, contained illegal + values, or was missing altogether.*/ +#define OP_EBADHEADER (-133) +/**The ID header contained an unrecognized version number.*/ +#define OP_EVERSION (-134) +/*Currently not used at all.*/ +#define OP_ENOTAUDIO (-135) +/**An audio packet failed to decode properly. + This is usually caused by a multistream Ogg packet where the durations of + the individual Opus packets contained in it are not all the same.*/ +#define OP_EBADPACKET (-136) +/**We failed to find data we had seen before, or the bitstream structure was + sufficiently malformed that seeking to the target destination was + impossible.*/ +#define OP_EBADLINK (-137) +/**An operation that requires seeking was requested on an unseekable stream.*/ +#define OP_ENOSEEK (-138) +/**The first or last granule position of a link failed basic validity checks.*/ +#define OP_EBADTIMESTAMP (-139) +} + +type + TOP_PIC_FORMAT = (OP_PIC_FORMAT_UNKNOWN = -1, OP_PIC_FORMAT_URL, OP_PIC_FORMAT_JPEG, + OP_PIC_FORMAT_PNG, OP_PIC_FORMAT_GIF); +type + TOpusHead = THandle; + TOpusStream = THandle; + + op_read_func = function (stream: Pointer; var buffer; nbytes: cint): cint; cdecl; + op_seek_func = function (stream: Pointer; offset: Int64; whence: cint): cint; cdecl; + op_tell_func = function (stream: Pointer): Int64; cdecl; + op_close_func = function (stream: Pointer): cint; cdecl; + + TOpusFileCallbacks = record + read: op_read_func; + seek: op_seek_func; + tell: op_tell_func; + close: op_close_func; + end; + +function OpusReadCB(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +function OpusReadCBuosURL(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +function OpusReadCBuosMS(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +function OpusSeekCB(stream: Pointer; offset: Int64; whence: cint): cint; cdecl; +function OpusTellCB(stream: Pointer): Int64; cdecl; +function OpusCloseCB(stream: Pointer): cint; cdecl; +function OpusSeekCBMS(stream: Pointer; offset: Int64; whence: cint): cint; cdecl; +function OpusTellCBMS(stream: Pointer): Int64; cdecl; + +const + op_callbacks: TOpusFileCallbacks = (read: @OpusReadCB; + seek: @OpusSeekCB; + tell: @OpusTellCB; + close: nil); + + uos_callbacks: TOpusFileCallbacks = (read: @OpusReadCBuosURL; + seek: @OpusSeekCB; + tell: @OpusTellCB; + close: nil); + + uos_callbacksms: TOpusFileCallbacks = (read: @OpusReadCBuosms; + seek: @OpusSeekCBms; + tell: @OpusTellCBms; + close: nil); + + +type + TOpusMSDecoder = Pointer; + op_decode_cb_func = function(ctx: Pointer; decoder: TOpusMSDecoder; pcm : pcfloat; op: Pointer; + nsamples, nchannels, format, li: pcint): cint; cdecl; + TOpusTags = record + user_comments: PPAnsiChar; // The array of comment string vectors + comment_lengths: Pcint; // An array of the corresponding length of each vector, in bytes + comments: cint; // The total number of comment streams + vendor: PAnsiChar; // The null-terminated vendor string. This identifies the software used to encode the stream. + end; + POpusTags = ^TOpusTags; + + TOpusPictureTag = record + Pic_Type: cint; { The picture type according to the ID3v2 APIC frame: + <ol start="0"> + <li>Other</li> + <li>32x32 pixels 'file icon' (PNG only)</li> + <li>Other file icon</li> + <li>Cover (front)</li> + <li>Cover (back)</li> + <li>Leaflet page</li> + <li>Media (e.g. label side of CD)</li> + <li>Lead artist/lead performer/soloist</li> + <li>Artist/performer</li> + <li>Conductor</li> + <li>Band/Orchestra</li> + <li>Composer</li> + <li>Lyricist/text writer</li> + <li>Recording Location</li> + <li>During recording</li> + <li>During performance</li> + <li>Movie/video screen capture</li> + <li>A bright colored fish</li> + <li>Illustration</li> + <li>Band/artist logotype</li> + <li>Publisher/Studio logotype</li> + </ol> } + mime_type: PAnsiChar; // The MIME type of the picture, in printable ASCII characters 0x20-0x7E. + description: PAnsiChar; // The description of the picture, in UTF-8 + width: Cardinal; + height: Cardinal; + depth: Cardinal; // The color depth of the picture in bits-per-pixel + colors: Cardinal; // For indexed-color pictures (e.g., GIF), the number of colors used, or 0 + data_length: Cardinal; + data: Pointer; + format: TOP_PIC_FORMAT; // The format of the picture data, if known. OP_PIC_FORMAT_UNKNOWN..OP_PIC_FORMAT_GIF + end; + +var + + op_fopen: function(out cb: TOpusFileCallbacks; path: PAnsiChar; mode: PAnsiChar): TOpusStream; cdecl; + + op_freopen: function(out cb: TOpusFileCallbacks; path: PAnsiChar; mode: PAnsiChar; stream: TOpusStream): TOpusStream;cdecl; + op_mem_stream_create: function(out cb: TOpusFileCallbacks; const data; size: cuint): TOpusStream; cdecl; + + opus_head_parse: function(head: TOpusHead; const data; len: cuint): cint;cdecl; + opus_granule_sample: function(head: TOpusHead; gp: Int64): Int64;cdecl; + opus_tags_parse: function(out tags: TOpusTags; const data; len: cuint): cint;cdecl; + opus_tags_copy: function(var dst: TOpusTags; const src: TOpusTags): cint;cdecl; + opus_tags_init: procedure(var tags: TOpusTags);cdecl; + opus_tags_add: function(var dst: TOpusTags; tag, value: PAnsiChar): cint;cdecl; + opus_tags_add_comment: function(var dst: TOpusTags; comment: PAnsiChar): cint;cdecl; + opus_tags_set_binary_suffix: function(var tags: TOpusTags; const data; len: cint): cint;cdecl; + opus_tags_query: function(const tags: TOpusTags; tag: PAnsiChar; count: cint): cint;cdecl; + opus_tags_query_count: function(const tags: TOpusTags; tag: PAnsiChar): cint;cdecl; + opus_tags_get_binary_suffix: function(const tags: TOpusTags; out len: cint): cint;cdecl; + opus_tags_get_album_gain: function(const tags: TOpusTags; out gain_q8: cint): cint;cdecl; + opus_tags_get_track_gain: function(const tags: TOpusTags; out gain_q8: cint): cint;cdecl; + opus_tags_clear: procedure(var tags: TOpusTags);cdecl; + opus_tagcompare: function(tag_name, comment: PAnsiChar): cint;cdecl; + opus_tagncompare: function(tag_name: PAnsiChar; tag_len: cint; comment: PAnsiChar): cint;cdecl; + opus_picture_tag_parse: function(out pic: TOpusPictureTag; tag: PAnsiChar): cint;cdecl; + opus_picture_tag_init: procedure(var pic: TOpusPictureTag);cdecl; + opus_picture_tag_clear: procedure(var pic: TOpusPictureTag);cdecl; + + op_test: function(head: TOpusHead; const initial_data; initial_bytes: cuint): cint;cdecl; + op_open_file: function(path: PAnsiChar; out error: cint): TOpusFile;cdecl; + op_open_memory: function(const data; const _size: cuint; out error: cint): TOpusFile;cdecl; + op_open_callbacks: function(const source; const cb: TOpusFileCallbacks; + const initial_data; initial_bytes: cuint; out error: cint): TOpusFile; {$IFDEF windows} cdecl;{$ENDIF} // with cdecl ---> crash in linux, strange ??? + op_test_file: function(path: PAnsiChar; out error: cint): TOpusFile;cdecl; + // op_test_url: function(path: PAnsiChar; out error: cint): TOpusFile; + op_test_memory: function(const data; const size: cuint; out error: cint): TOpusFile;cdecl; + op_test_callbacks: function(const source; const cb: TOpusFileCallbacks; const initial_data; initial_bytes: cuint; + out error: cint): TOpusFile; {$IFDEF windows} cdecl;{$ENDIF} // with cdecl ---> crash in linux, strange ??? + op_test_open: function(OpusFile: TOpusFile): cint; cdecl; + op_free: function(OpusFile: TOpusFile): cint; cdecl; + + op_seekable: function(OpusFile: TOpusFile): cint;cdecl; + op_link_count: function(OpusFile: TOpusFile): cint;cdecl; + op_serialno: function(OpusFile: TOpusFile; li: pcint): Cardinal;cdecl; + op_channel_count: function(OpusFile: TOpusFile; li: pcint): cint;cdecl; + op_raw_total: function(OpusFile: TOpusFile; li: pcint): Int64;cdecl; + op_pcm_total: function(OpusFile: TOpusFile; li: pcint): Int64;cdecl; + op_head: function(OpusFile: TOpusFile; li: pcint): TOpusHead;cdecl; + op_tags: function(OpusFile: TOpusFile; li: pcint): POpusTags;cdecl; + op_current_link: function(OpusFile: TOpusFile): cint;cdecl; + op_bitrate: function(OpusFile: TOpusFile; li: pcint): cint;cdecl; + op_bitrate_instant: function(OpusFile: TOpusFile): cint;cdecl; + op_raw_tell: function(OpusFile: TOpusFile): Int64;cdecl; + op_pcm_tell: function(OpusFile: TOpusFile): Int64;cdecl; + + op_raw_seek: function(OpusFile: TOpusFile; byte_offset: cInt64): cint;cdecl; + op_pcm_seek: function(OpusFile: TOpusFile; pcm_offset: cInt64): cint;cdecl; + + op_set_gain_offset: function(OpusFile: TOpusFile; gain_type: cint; gain_offset_q8: cint): cint;cdecl; + op_set_dither_enabled: procedure(OpusFile: TOpusFile; enabled: cint);cdecl; + + op_read: function(OpusFile: TOpusFile; pcm : pcint; SampleCount: cint; li: pcint): cint;cdecl; + op_read_float: function(OpusFile: TOpusFile; pcm : pcfloat; SampleCount: cint; li: pcint): cint;cdecl; + op_read_stereo: function(OpusFile: TOpusFile; pcm : pcint; SampleCount: cint): cint;cdecl; + op_read_float_stereo: function(OpusFile: TOpusFile; pcm : pcfloat; SampleCount: cint): cint;cdecl; + + of_Handle:TLibHandle=dynlibs.NilHandle; + + op_Handle:TLibHandle=dynlibs.NilHandle; + + {$IFDEF windows} + lc_Handle:TLibHandle=dynlibs.NilHandle; + wt_Handle:TLibHandle=dynlibs.NilHandle; + og_Handle:TLibHandle=dynlibs.NilHandle; + {$endif} + + ReferenceCounter : cardinal = 0; + + function of_IsLoaded : boolean; inline; + + Function of_Load(const libfilename:string) :boolean; // load the lib + + Procedure of_Unload; + +implementation + + function of_IsLoaded: boolean; +begin + Result := (of_Handle <> dynlibs.NilHandle); +end; + +Procedure of_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if of_IsLoaded then + begin + DynLibs.UnloadLibrary(of_Handle); + of_Handle:=DynLibs.NilHandle; + DynLibs.UnloadLibrary(op_Handle); + op_Handle:=DynLibs.NilHandle; + {$IFDEF windows} + DynLibs.UnloadLibrary(lc_Handle); + lc_Handle:=DynLibs.NilHandle; + DynLibs.UnloadLibrary(wt_Handle); + wt_Handle:=DynLibs.NilHandle; + DynLibs.UnloadLibrary(og_Handle); + og_Handle:=DynLibs.NilHandle; + {$endif} + + end; +end; + +Function of_Load (const libfilename:string) :boolean; +begin + Result := False; + if of_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin {go & load the library} + if Length(libfilename) = 0 then + begin + {$IFDEF windows} + wt_Handle:= DynLibs.SafeLoadLibrary('libwinpthread-1.dll'); + lc_Handle:= DynLibs.SafeLoadLibrary('libgcc_s_sjlj-1.dll'); + og_Handle:= DynLibs.SafeLoadLibrary('libogg-0.dll'); + op_Handle:= DynLibs.SafeLoadLibrary('libopus-0.dll'); + {$else} + op_Handle:= DynLibs.SafeLoadLibrary('libopus.so'); + {$endif} + of_Handle:=DynLibs.SafeLoadLibrary(libop); + end + else + begin + {$IFDEF windows} + wt_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libwinpthread-1.dll'); + lc_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libgcc_s_sjlj-1.dll'); + og_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libogg-0.dll'); + op_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libopus-0.dll'); + {$else} + op_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libopus.so'); + {$endif} + of_Handle:=DynLibs.SafeLoadLibrary(libfilename); + end; + + + if of_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} +Pointer(op_fopen):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_fopen')); +Pointer(op_freopen):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_freopen')); +Pointer(op_mem_stream_create):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_mem_stream_create')); +Pointer(opus_head_parse):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_head_parse')); +Pointer(opus_granule_sample):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_granule_sample')); +Pointer(opus_tags_parse):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_parse')); +Pointer(opus_tags_copy):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_copy')); +Pointer(opus_tags_init):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_init')); +Pointer(opus_tags_add):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_add')); +Pointer(opus_tags_add_comment):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_add_comment')); +Pointer(opus_tags_set_binary_suffix):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_set_binary_suffix')); +Pointer(opus_tags_query):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_query')); +Pointer(opus_tags_query_count):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_query_count')); +Pointer(opus_tags_get_binary_suffix):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_get_binary_suffix')); +Pointer(opus_tags_get_album_gain):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_get_album_gain')); +Pointer(opus_tags_get_track_gain):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_get_track_gain')); +Pointer(opus_tags_clear):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_clear')); +Pointer(opus_tagcompare):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tagcompare')); +Pointer(opus_tagncompare):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tagncompare')); +Pointer(opus_picture_tag_parse):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_picture_tag_parse')); +Pointer(opus_picture_tag_init):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_picture_tag_init')); +Pointer(opus_picture_tag_clear):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_picture_tag_clear')); +Pointer(op_test):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test')); +Pointer(op_free):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_free')); +Pointer(op_open_file):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_open_file')); +Pointer(op_open_memory):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_open_memory')); +Pointer(op_open_callbacks):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_open_callbacks')); +Pointer(op_test_file):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test_file')); +//Pointer(op_test_url):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test_url')); +Pointer(op_test_memory):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test_memory')); +Pointer(op_test_callbacks):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test_callbacks')); +Pointer(op_test_open):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test_open')); +Pointer(op_seekable):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_seekable')); +Pointer(op_link_count):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_link_count')); +Pointer(op_serialno):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_serialno')); +Pointer(op_channel_count):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_channel_count')); +Pointer(op_raw_total):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_raw_total')); +Pointer(op_pcm_total):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_pcm_total')); +Pointer(op_head):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_head')); +Pointer(op_tags):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_tags')); +Pointer(op_current_link):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_current_link')); +Pointer(op_bitrate):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_bitrate')); +Pointer(op_bitrate_instant):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_bitrate_instant')); +Pointer(op_raw_tell):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_raw_tell')); +Pointer(op_raw_seek):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_raw_seek')); +Pointer(op_pcm_seek):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_pcm_seek')); +Pointer(op_set_gain_offset):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_set_gain_offset')); +Pointer(op_set_dither_enabled):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_set_dither_enabled')); +Pointer(op_read):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_read')); +Pointer(op_read_float):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_read_float')); +Pointer(op_read_stereo):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_read_stereo')); +Pointer(op_read_float_stereo):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_read_float_stereo')); + +end; + Result := of_IsLoaded; + ReferenceCounter:=1; +end; + +end; + +function OpusReadCB(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +begin + if nbytes<>0 + then + result := FileRead(THandle(stream^), Buffer, nbytes) + else + result := 0; +end; + +function OpusReadCBuosURL(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +begin + if nbytes<>0 + then + result := TInputPipeStream(stream^).read(Buffer, nbytes) + else + result := 0; +end; + +function OpusReadCBuosMS(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +begin + if nbytes<>0 + then + result := TMemoryStream(stream^).read(Buffer, nbytes) + else + result := 0; +end; + +function OpusSeekCB(stream: Pointer; offset: Int64; whence: cint): cint; cdecl; +var + Seek_Result: Int64; +begin + Seek_Result := FileSeek(THandle(stream^), offset, whence); + if Seek_Result=-1 + then + Result := -1 + else + Result := 0; +end; + +function OpusTellCB(stream: Pointer): Int64; cdecl; +begin + Result := FileSeek(THandle(stream^), 0, 1); +end; + +function OpusSeekCBms(stream: Pointer; offset: Int64; whence: cint): cint; cdecl; +var + Seek_Result: Int64; +begin + Seek_Result := TMemoryStream(stream^).seek(offset, whence); + if Seek_Result=-1 + then + Result := -1 + else + Result := 0; +end; + +function OpusTellCBms(stream: Pointer): Int64; cdecl; +begin +Result := TMemoryStream(stream^).seek(0, 1); + end; + +function OpusCloseCB(stream: Pointer): cint; cdecl; +begin + FileClose(THandle(stream^)); + Result := 0; +end; + +end. diff --git a/UOS/examples/uos_opusurl.pas b/UOS/examples/uos_opusurl.pas new file mode 100644 index 0000000..86b4d92 --- /dev/null +++ b/UOS/examples/uos_opusurl.pas @@ -0,0 +1,93 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Pascal Wrapper + Dynamic loading of OpusURL library. + Load library with ou_load() and release with ou_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com} + +unit uos_Opusurl; + +{$mode objfpc}{$H+} + +interface + +uses + ctypes, uos_Opusfile, dynlibs, SysUtils; + +// Error Codes +const + OP_FALSE = -1; + OP_HOLE = -3; + OP_EREAD = -128; + OP_EFAULT = -129; + OP_EIMPL = -130; + OP_EINVAL = -131; + OP_ENOTVORBIS = -132; + OP_EBADHEADER = -133; + OP_EVERSION = -134; + OP_ENOTAUDIO = -135; + OP_EBADPACKET = -136; + OP_EBADLINK = -137; + OP_ENOSEEK = -138; + OP_EBADTIMESTAMP = -139; + +var + + op_open_url: function(path: PAnsiChar; out error: Integer): TOpusFile; + op_test_url: function(path: PAnsiChar; out error: Integer): TOpusFile; + + ou_Handle:TLibHandle=dynlibs.NilHandle; + + ReferenceCounter : cardinal = 0; // Reference counter + + function ou_IsLoaded : boolean; inline; + + Function ou_Load(const libfilename:string) :boolean; // load the lib + + Procedure ou_Unload; + +implementation + + function ou_IsLoaded: boolean; +begin + Result := (ou_Handle <> dynlibs.NilHandle); +end; + +Procedure ou_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if ou_IsLoaded then + begin + DynLibs.UnloadLibrary(ou_Handle); + ou_Handle:=DynLibs.NilHandle; + end; +end; + +Function ou_Load (const libfilename:string) :boolean; +begin + Result := False; + if ou_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin {go & load the library} + if Length(libfilename) = 0 then exit; + ou_Handle:=DynLibs.SafeLoadLibrary(libfilename); // obtain the handle we want + if ou_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} +Pointer(op_open_url):=DynLibs.GetProcedureAddress(OU_Handle,PChar('op_open_url')); +Pointer(op_test_url):=DynLibs.GetProcedureAddress(OU_Handle,PChar('op_test_url')); +end; + Result := ou_IsLoaded; + ReferenceCounter:=1; +end; + +end; + +end. diff --git a/UOS/examples/uos_portaudio.pas b/UOS/examples/uos_portaudio.pas new file mode 100644 index 0000000..8e73cbc --- /dev/null +++ b/UOS/examples/uos_portaudio.pas @@ -0,0 +1,389 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading version of PortAudio Pascal Wrapper. + Load library with pa_load() and release with pa_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com + Reference counting added by Max Karpushin / homeplaner@yandex.ru} + +unit uos_portaudio; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + dynlibs, CTypes; + +const +libpa= + {$IFDEF unix} +{$IFDEF darwin} + 'libportaudio.2.dylib'; + {$ELSE} + 'libportaudio.so.2'; + {$ENDIF} + {$ELSE} + 'portaudio.dll'; + {$ENDIF} + +type + PaError = CInt32; + PaErrorCode =( + paNotInitialized := -10000, + paUnanticipatedHostError, + paInvalidChannelCount, + paInvalidSampleRate, + paInvalidDevice, + paInvalidFlag, + paSampleFormatNotSupported, + paBadIODeviceCombination, + paInsufficientMemory, + paBufferTooBig, + paBufferTooSmall, + paNullCallback, + paBadStreamPtr, + paTimedOut, + paInternalError, + paDeviceUnavailable, + paIncompatibleHostApiSpecificStreamInfo, + paStreamIsStopped, + paStreamIsNotStopped, + paInputOverflowed, + paOutputUnderflowed, + paHostApiNotFound, + paInvalidHostApi, + paCanNotReadFromACallbackStream, + paCanNotWriteToACallbackStream, + paCanNotReadFromAnOutputOnlyStream, + paCanNotWriteToAnInputOnlyStream, + paIncompatibleStreamHostApi, + paBadBufferPtr, + paNoError := 0 + ); + + PaDeviceIndex = CInt32; + + PaHostApiIndex = CInt32; + + PaHostApiTypeId =(paInDevelopment := 0, + paDirectSound := 1, + paMME := 2, + paASIO := 3, + paSoundManager := 4, + paCoreAudio := 5, + paOSS := 7, + paALSA := 8, + paAL := 9, + paBeOS := 10, + paWDMKS := 11, + paJACK := 12, + paWASAPI := 13, + paAudioScienceHPI := 14 + ); + + PaHostApiInfo = record + structVersion : CInt32; + _type : PaHostApiTypeId ; + _name : Pchar; + deviceCount : CInt32; + defaultInputDevice : PaDeviceIndex; + defaultOutputDevice : PaDeviceIndex; + end; + PPaHostApiInfo = ^PaHostApiInfo; + + PaHostErrorInfo = record + hostApiType : PaHostApiTypeId; + errorCode : CLong; + errorText : PChar; + end; + PPaHostErrorInfo = ^PaHostErrorInfo; + + PaTime = CDouble; + + PaSampleFormat = pCULongLong; + + PaDeviceInfo = record + structVersion : CInt32; + _name : PChar; + hostApi : PaHostApiIndex; + maxInputChannels : CInt32; + maxOutputChannels : CInt32; + defaultLowInputLatency : PaTime; + defaultLowOutputLatency : PaTime; + defaultHighInputLatency : PaTime; + defaultHighOutputLatency : PaTime; + defaultSampleRate : CDouble; + end; + PPaDeviceInfo = ^PaDeviceInfo; + + PaStreamParameters = record + device : PaDeviceIndex; + channelCount : CInt32; + sampleFormat : PaSampleFormat; + suggestedLatency : PaTime; + hostApiSpecificStreamInfo : Pointer; + end; + PPaStreamParameters = ^PaStreamParameters; + + // ************************* Streaming types ************************* + + PaStream = Pointer; + PPaStream = ^PaStream; + PPPaStream = ^PPaStream; + + PaStreamFlags = CULong; + + PaStreamCallbackTimeInfo = record + inputBufferAdcTime : PaTime; + currentTime : PaTime; + outputBufferDacTime : PaTime; + end; + PPaStreamCallbackTimeInfo = ^PaStreamCallbackTimeInfo; + + PaStreamCallbackFlags = CULong; + + PaStreamCallbackResult =( + paContinue := 0, + paComplete := 1, + paAbort := 2); + + PaStreamCallback = function( + input : Pointer; + output : Pointer; + frameCount : CULong; + timeInfo : PPaStreamCallbackTimeInfo; + statusFlags : PaStreamCallbackFlags; + userData : Pointer) : CInt32; + PPaStreamCallback = ^PaStreamCallback; + + PaStreamFinishedCallback = procedure(userData : Pointer); + PPaStreamFinishedCallback = ^PaStreamFinishedCallback; + + PaStreamInfo = record + structVersion : CInt32; + inputLatency : PaTime; + outputLatency : PaTime; + sampleRate : CDouble; + end; + PPaStreamInfo = ^PaStreamInfo; + + const + paFormatIsSupported = 0; + paFramesPerBufferUnspecified = 0; + paNoDevice = PaDeviceIndex(-1); + paUseHostApiSpecificDeviceSpecification = PaDeviceIndex(-2); + paFloat32 = PaSampleFormat($00000001); + paInt32 = PaSampleFormat($00000002); + paInt24 = PaSampleFormat($00000004); + paInt16 = PaSampleFormat($00000008); + paInt8 = PaSampleFormat($00000010); + paUInt8 = PaSampleFormat($00000020); + paCustomFormat = PaSampleFormat($00010000); + paNonInterleaved = PaSampleFormat($80000000); + paNoFlag = PaStreamFlags(0); + paClipOff = PaStreamFlags($00000001); + paDitherOff = PaStreamFlags($00000002); + paNeverDropInput = PaStreamFlags($00000004); + paPrimeOutputBuffersUsingStreamCallback = PaStreamFlags($00000008); + paPlatformSpecificFlags = PaStreamFlags($FFFF0000); + paInputUnderflow = PaStreamCallbackFlags($00000001); + paInputOverflow = PaStreamCallbackFlags($00000002); + paOutputUnderflow = PaStreamCallbackFlags($00000004); + paOutputOverflow = PaStreamCallbackFlags($00000008); + paPrimingOutput = PaStreamCallbackFlags($00000010); + + ////// Dynamic load : Vars that will hold our dynamically loaded functions... + +// *************************** functions ******************************* + + var Pa_GetVersion: function():CInt32 ; cdecl; + + var Pa_GetVersionText: function():PChar ; cdecl; + + var Pa_GetErrorText: function(errorCode : PaError):PChar ; cdecl; + + var Pa_Initialize: function():PaError ; cdecl; + + var Pa_Terminate: function():PaError ; cdecl; + + var Pa_GetHostApiCount: function():PaHostApiIndex ; cdecl; + + var Pa_GetDefaultHostApi: function():PaHostApiIndex ; cdecl; + + var Pa_GetHostApiInfo: function(hostApi : PaHostApiIndex):PPaHostApiInfo ; cdecl; + + var Pa_HostApiTypeIdToHostApiIndex: function(_type : PaHostApiTypeId):PaHostApiIndex ; cdecl; + + var Pa_HostApiDeviceIndexToDeviceIndex: function(hostApi : PaHostApiIndex;hostApiDeviceIndex : CInt32):PaDeviceIndex ; cdecl; + + var Pa_GetLastHostErrorInfo: function():PPaHostErrorInfo ; cdecl; + +// ************** Device enumeration and capabilities ****************** + + var Pa_GetDeviceCount: function:PaDeviceIndex ; cdecl; + + var Pa_GetDefaultInputDevice: function:PaDeviceIndex ; cdecl; + + var Pa_GetDefaultOutputDevice: function:PaDeviceIndex ; cdecl; + + var Pa_GetDeviceInfo: function(device : PaDeviceIndex):PPaDeviceInfo ; cdecl; + + var Pa_IsFormatSupported: function(inputParameters,outputParameters : PPaStreamParameters; sampleRate : CDouble):PaError ; cdecl; + +// *********************** Stream function ***************************** + + var Pa_OpenStream: function(stream : PPPaStream; + inputParameters : PPaStreamParameters; + outputParameters : PPaStreamParameters; + sampleRate : CDouble; + framesPerBuffer : CULong; + streamFlags : PaStreamFlags; + streamCallback : PPaStreamCallback; + userData : Pointer):PaError ; cdecl; + + var Pa_OpenDefaultStream: function(stream : PPPaStream; + numInputChannels : CInt32; + numOutputChannels : CInt32; + sampleFormat : PaSampleFormat; + sampleRate : CDouble; + framesPerBuffer : CULong; + streamCallback : PPaStreamCallback; + userData : Pointer):PaError ; cdecl; + + var Pa_CloseStream: function(stream : PPaStream):PaError ; cdecl; + + var Pa_SetStreamFinishedCallback: function(stream : PPaStream; + streamFinishedCallback : PPaStreamFinishedCallback):PaError ; cdecl; + + var Pa_StartStream: function(stream : PPaStream):PaError ; cdecl; + + var Pa_StopStream: function(stream : PPaStream):PaError ; cdecl; + + var Pa_AbortStream: function(stream : PPaStream):PaError ; cdecl; + + var Pa_IsStreamStopped: function(stream : PPaStream):PaError ; cdecl; + + var Pa_IsStreamActive: function(stream : PPaStream):PaError ; cdecl; + + var Pa_GetStreamInfo: function(stream : PPaStream):PPaStreamInfo ; cdecl; + + var Pa_GetStreamTime: function(stream : PPaStream):Patime ; cdecl; + + var Pa_GetStreamCpuLoad: function(stream : PPaStream):CDouble ; cdecl; + + var Pa_ReadStream: function(stream : PPaStream; buffer : pcfloat ;frames : CULong):PaError ; cdecl; + + var Pa_WriteStream: function(stream : PPaStream; buffer : pcfloat ;frames : CULong):PaError ; cdecl; + + var Pa_GetStreamReadAvailable: function(stream : PPaStream):CSLong ; cdecl; + + var Pa_GetStreamWriteAvailable: function(stream : PPaStream):CSLong ; cdecl; + +// ****************** Miscellaneous utilities ************************** + + var Pa_GetSampleSize: function(format : PaSampleFormat):PaError ; cdecl; + + var Pa_Sleep: function(msec : CLong) : integer; cdecl; + + /////////////////////////////////////////////// + + {Special function for dynamic loading of lib ...} + + var Pa_Handle:TLibHandle=dynlibs.NilHandle; // this will hold our handle for the lib; it functions nicely as a mutli-lib prevention unit as well... + + var ReferenceCounter : cardinal = 0; // Reference counter + + function Pa_IsLoaded : boolean; inline; + + Function Pa_Load(const libfilename:string) :boolean; // load the lib + + Procedure Pa_Unload(); // unload and frees the lib from memory : do not forget to call it before close application. + + ///////////////////////////////////////////////////////////////////////////////////////////////// + +implementation + +function Pa_IsLoaded: boolean; +begin + Result := (Pa_Handle <> dynlibs.NilHandle); +end; + +Function Pa_Load (const libfilename:string) :boolean; +var +thelib: string; +begin + Result := False; + if Pa_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin {go & load the library} + if Length(libfilename) = 0 then thelib := libpa else thelib := libfilename; + Pa_Handle:=DynLibs.SafeLoadLibrary(thelib); // obtain the handle we want + if Pa_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} + +Pointer(Pa_GetVersion):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetVersion')); +Pointer(Pa_GetVersionText):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetVersionText')); +Pointer(Pa_GetErrorText):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetErrorText')); +Pointer(Pa_Initialize):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_Initialize')); +Pointer(Pa_Terminate):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_Terminate')); +Pointer(Pa_GetHostApiCount):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetHostApiCount')); +Pointer(Pa_GetDefaultHostApi):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetDefaultHostApi')); +Pointer(Pa_GetHostApiInfo):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetHostApiInfo')); +Pointer(Pa_HostApiTypeIdToHostApiIndex):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_HostApiTypeIdToHostApiIndex')); +Pointer(Pa_HostApiDeviceIndexToDeviceIndex):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_HostApiDeviceIndexToDeviceIndex')); +Pointer(Pa_GetLastHostErrorInfo):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetLastHostErrorInfo')); +////////////////// +Pointer(Pa_GetDeviceCount):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetDeviceCount')); +Pointer(Pa_GetDefaultInputDevice):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetDefaultInputDevice')); +Pointer(Pa_GetDefaultOutputDevice):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetDefaultOutputDevice')); +Pointer(Pa_GetDeviceInfo):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetDeviceInfo')); +Pointer(Pa_IsFormatSupported):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_IsFormatSupported')); +////////////////////// +Pointer(Pa_OpenStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_OpenStream')); +Pointer(Pa_OpenDefaultStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_OpenDefaultStream')); +Pointer(Pa_CloseStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_CloseStream')); +Pointer(Pa_SetStreamFinishedCallback):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_SetStreamFinishedCallback')); +Pointer(Pa_StartStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_StartStream')); +Pointer(Pa_StopStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_StopStream')); +Pointer(Pa_AbortStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_AbortStream')); +Pointer(Pa_IsStreamStopped):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_IsStreamStopped')); +Pointer(Pa_IsStreamActive):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_IsStreamActive')); +Pointer(Pa_GetStreamInfo):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetStreamInfo')); +Pointer(Pa_GetStreamTime):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetStreamTime')); +Pointer(Pa_GetStreamCpuLoad):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetStreamCpuLoad')); +Pointer(Pa_ReadStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_ReadStream')); +Pointer(Pa_WriteStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_WriteStream')); +Pointer(Pa_GetStreamReadAvailable):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetStreamReadAvailable')); +Pointer(Pa_GetStreamWriteAvailable):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetStreamWriteAvailable')); +Pointer(Pa_GetSampleSize):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetSampleSize')); +Pointer(Pa_Sleep):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_Sleep')); +end; + Result := Pa_IsLoaded; + ReferenceCounter:=1; +end; + +end; + +Procedure Pa_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if Pa_IsLoaded then + begin + Pa_Terminate(); + DynLibs.UnloadLibrary(Pa_Handle); + Pa_Handle:=DynLibs.NilHandle; + end; +end; + +end. + diff --git a/UOS/examples/uos_shout.pas b/UOS/examples/uos_shout.pas new file mode 100644 index 0000000..254a10b --- /dev/null +++ b/UOS/examples/uos_shout.pas @@ -0,0 +1,264 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading version of IceCast_Shout Pascal Wrapper. + Load library with sha_load() and release with sh_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com } + +unit uos_shout; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + dynlibs, CTypes, sysutils; + + const + SHOUT_THREADSAFE = 1; + SHOUT_TLS = 1; + SHOUTERR_SUCCESS = 0; + SHOUTERR_INSANE = -1; + SHOUTERR_NOCONNECT = -2; + SHOUTERR_NOLOGIN = -3; + SHOUTERR_SOCKET = -4; + SHOUTERR_MALLOC = -5; + SHOUTERR_METADATA = -6; + SHOUTERR_CONNECTED = -7; + SHOUTERR_UNCONNECTED = -8; + SHOUTERR_UNSUPPORTED = -9; + SHOUTERR_BUSY = -10; + SHOUTERR_NOTLS = -11; + SHOUTERR_TLSBADCERT = -12; + SHOUTERR_RETRY = -13; + SHOUT_FORMAT_OGG = 0; + SHOUT_FORMAT_MP3 = 1; + SHOUT_FORMAT_WEBM = 2; + SHOUT_FORMAT_WEBMAUDIO = 3; + SHOUT_FORMAT_VORBIS = SHOUT_FORMAT_OGG; + SHOUT_PROTOCOL_HTTP = 0; + SHOUT_PROTOCOL_XAUDIOCAST = 1; + SHOUT_PROTOCOL_ICY = 2; + SHOUT_PROTOCOL_ROARAUDIO = 3; + SHOUT_TLS_DISABLED = 0; + SHOUT_TLS_AUTO = 1; + SHOUT_TLS_AUTO_NO_PLAIN = 2; + SHOUT_TLS_RFC2818 = 11; + SHOUT_TLS_RFC2817 = 12; + SHOUT_AI_BITRATE = 'bitrate'; + SHOUT_AI_SAMPLERATE = 'samplerate'; + SHOUT_AI_CHANNELS = 'channels'; + SHOUT_AI_QUALITY = 'quality'; + SHOUT_META_NAME = 'name'; + SHOUT_META_URL = 'url'; + SHOUT_META_GENRE = 'genre'; + SHOUT_META_DESCRIPTION = 'description'; + SHOUT_META_IRC = 'irc'; + SHOUT_META_AIM = 'aim'; + SHOUT_META_ICQ = 'icq'; + + type + shout_t = pointer; + Pshout_t = ^shout_t; + {$if defined(cpu64)} + cuint64 = qword; + size_t = cuint64; +{$else} + cuint32 = longword; + size_t = cuint32; +{$endif} + + psize_t = ^size_t; + + shout_metadata_t = pointer; + Pshout_metadata_t = ^shout_metadata_t; + +// methods +var + + shout_init: procedure();cdecl; + shout_shutdown: procedure();cdecl; + shout_version: function(var major:cint; var minor:cint; var patch:cint):pchar;cdecl; + shout_new: function(): Pshout_t;cdecl; + shout_free: procedure(shhandle :Pshout_t);cdecl; + shout_get_error: function(shhandle :Pshout_t):pchar;cdecl; + shout_get_errno: function(shhandle :Pshout_t):cint;cdecl; + shout_get_connected: function(shhandle :Pshout_t):cint;cdecl; + shout_set_host: function(shhandle :Pshout_t; host: pchar):cint;cdecl; + shout_get_host: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_port: function(shhandle :Pshout_t; port:cushort):cint;cdecl; + shout_get_port: function(shhandle :Pshout_t):cushort;cdecl; + shout_set_agent: function(shhandle :Pshout_t; agent:pchar):cint;cdecl; + shout_get_agent: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_tls: function(shhandle :Pshout_t; mode:cint):cint;cdecl; + shout_get_tls: function(shhandle :Pshout_t):cint;cdecl; + shout_set_ca_directory: function(shhandle :Pshout_t; directory:pchar):cint;cdecl; + shout_get_ca_directory: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_ca_file: function(shhandle :Pshout_t; thefile:pchar):cint;cdecl; + shout_get_ca_file: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_allowed_ciphers: function(shhandle :Pshout_t; ciphers:pchar):cint;cdecl; + shout_get_allowed_ciphers: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_user: function(shhandle :Pshout_t; username:pchar):cint;cdecl; + shout_get_user: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_password: function(shhandle :Pshout_t; password:pchar):cint;cdecl; + shout_get_password: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_client_certificate: function(shhandle :Pshout_t; certificate:pchar):cint;cdecl; + shout_get_client_certificate: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_mount: function(shhandle :Pshout_t; mount:pchar):cint;cdecl; + shout_get_mount: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_name: function(shhandle :Pshout_t; name:pchar):cint;cdecl; + shout_get_name: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_url: function(shhandle :Pshout_t; url:pchar):cint;cdecl; + shout_get_url: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_genre: function(shhandle :Pshout_t; genre:pchar):cint;cdecl; + shout_get_genre: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_description: function(shhandle :Pshout_t; description:pchar):cint;cdecl; + shout_get_description: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_dumpfile: function(shhandle :Pshout_t; dumpfile:pchar):cint;cdecl; + shout_get_dumpfile: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_audio_info: function(shhandle :Pshout_t; name:pchar; value:pchar):cint;cdecl; + shout_get_audio_info: function(shhandle :Pshout_t; name:pchar):pchar;cdecl; + shout_set_meta: function(shhandle :Pshout_t; name:pchar; value:pchar):cint;cdecl; + shout_get_meta: function(shhandle :Pshout_t; name:pchar):pchar;cdecl; + shout_set_public: function(shhandle :Pshout_t; make_public:cuint):cint;cdecl; + shout_get_public: function(shhandle :Pshout_t):cuint;cdecl; + shout_set_format: function(shhandle :Pshout_t; format:cuint):cint;cdecl; + shout_get_format: function(shhandle :Pshout_t):cuint;cdecl; + shout_set_protocol: function(shhandle :Pshout_t; protocol:cuint):cint;cdecl; + shout_get_protocol: function(shhandle :Pshout_t):cuint;cdecl; + shout_set_nonblocking: function(shhandle :Pshout_t; nonblocking:cuint):cint;cdecl; + shout_get_nonblocking: function(shhandle :Pshout_t):cuint;cdecl; + shout_open: function(shhandle :Pshout_t):cint;cdecl; + shout_close: function(shhandle :Pshout_t):cint;cdecl; + //shout_send: function(shhandle :Pshout_t; data:pcuchar; len:size_t):cint;cdecl; + shout_send: function(shhandle :Pshout_t; data:pbyte; len:size_t):cint;cdecl; + shout_send_raw: function(shhandle :Pshout_t; data:pcuchar; len:size_t):size_t;cdecl; + shout_queuelen: function(shhandle :Pshout_t):size_t;cdecl; + shout_sync: procedure(shhandle :Pshout_t);cdecl; + shout_delay: function(shhandle :Pshout_t):cint;cdecl; + shout_set_metadata: function(shhandle :Pshout_t; var metadata:shout_metadata_t):cint;cdecl; + shout_metadata_new: function():Pshout_metadata_t;cdecl; + shout_metadata_free: procedure(var shhandle:shout_metadata_t);cdecl; + shout_metadata_add: function(var shhandle:shout_metadata_t; name:pchar; value:pchar):cint;cdecl; + + sh_Handle:TLibHandle=dynlibs.NilHandle; // this will hold our handle for the lib; it functions nicely as a mutli-lib prevention unit as well... + + ReferenceCounter : cardinal = 0; // Reference counter + + function sh_IsLoaded : boolean; inline; + + Function sh_Load(const libfilename:string) :boolean; // load the lib + + Procedure sh_Unload(); // unload and frees the lib from memory : do not forget to call it before close application. + + +implementation + +function sh_IsLoaded: boolean; +begin + Result := (sh_Handle <> dynlibs.NilHandle); +end; + +Function sh_Load (const libfilename:string) :boolean; +begin + Result := False; + if sh_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin {go & load the library} + if Length(libfilename) = 0 then exit; + sh_Handle:=DynLibs.SafeLoadLibrary(libfilename); // obtain the handle we want + if sh_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} + +Pointer(shout_init):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_init')); +Pointer(shout_shutdown):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_shutdown')); +Pointer(shout_version):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_version')); +Pointer(shout_new):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_new')); +Pointer(shout_free):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_free')); +Pointer(shout_get_error):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_error')); +Pointer(shout_get_errno):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_errno')); +Pointer(shout_get_connected):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_connected')); +Pointer(shout_set_host):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_host')); +Pointer(shout_get_host):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_host')); +Pointer(shout_set_port):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_port')); +Pointer(shout_get_port):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_port')); +Pointer(shout_set_agent):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_agent')); +Pointer(shout_get_agent):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_agent')); +Pointer(shout_set_tls):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_tls')); +Pointer(shout_get_tls):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_tls')); +Pointer(shout_set_ca_directory):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_ca_directory')); +Pointer(shout_get_ca_directory):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_ca_directory')); +Pointer(shout_set_ca_file):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_ca_file')); +Pointer(shout_get_ca_file):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_ca_file')); +Pointer(shout_set_allowed_ciphers):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_allowed_ciphers')); +Pointer(shout_get_allowed_ciphers):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_allowed_ciphers')); +Pointer(shout_set_user):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_user')); +Pointer(shout_get_user):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_user')); +Pointer(shout_set_password):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_password')); +Pointer(shout_get_password):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_password')); +Pointer(shout_set_client_certificate):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_client_certificate')); +Pointer(shout_get_client_certificate):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_client_certificate')); +Pointer(shout_set_mount):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_mount')); +Pointer(shout_get_mount):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_mount')); +Pointer(shout_set_name):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_name')); +Pointer(shout_get_name):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_name')); +Pointer(shout_set_url):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_url')); +Pointer(shout_get_url):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_url')); +Pointer(shout_set_genre):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_genre')); +Pointer(shout_get_genre):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_genre')); +Pointer(shout_set_description):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_description')); +Pointer(shout_get_description):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_description')); +Pointer(shout_set_dumpfile):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_dumpfile')); +Pointer(shout_get_dumpfile):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_dumpfile')); +Pointer(shout_set_audio_info):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_audio_info')); +Pointer(shout_get_audio_info):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_audio_info')); +Pointer(shout_set_meta):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_meta')); +Pointer(shout_get_meta):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_meta')); +Pointer(shout_set_public):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_public')); +Pointer(shout_get_public):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_public')); +Pointer(shout_set_format):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_format')); +Pointer(shout_get_format):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_format')); +Pointer(shout_set_protocol):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_protocol')); +Pointer(shout_get_protocol):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_protocol')); +Pointer(shout_set_nonblocking):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_nonblocking')); +Pointer(shout_get_nonblocking):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_nonblocking')); +Pointer(shout_open):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_open')); +Pointer(shout_close):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_close')); +Pointer(shout_send):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_send')); +Pointer(shout_send_raw):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_send_raw')); +Pointer(shout_queuelen):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_queuelen')); +Pointer(shout_sync):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_sync')); +Pointer(shout_delay):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_delay')); +Pointer(shout_set_metadata):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_metadata')); +Pointer(shout_metadata_new):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_metadata_new')); +Pointer(shout_metadata_free):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_metadata_free')); +Pointer(shout_metadata_add):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_metadata_add')); + +end; + Result := sh_IsLoaded; + ReferenceCounter:=1; +end; + +end; + +Procedure sh_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if sh_IsLoaded then + begin + shout_shutdown(); + DynLibs.UnloadLibrary(sh_Handle); + sh_Handle:=DynLibs.NilHandle; + end; +end; + +end. diff --git a/UOS/examples/uos_soundtouch.pas b/UOS/examples/uos_soundtouch.pas new file mode 100644 index 0000000..4b178be --- /dev/null +++ b/UOS/examples/uos_soundtouch.pas @@ -0,0 +1,216 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading + Unix compatible version of SoundTouch Pascal Wrapper + from Sandro Cumerlato <sandro.cumerlato@gmail.com>. + of the original C version of Olli Parviainen <oparviai@iki.fi>. + + Added BPMdetect method too. + Load library with St_load() and release with St_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com} + +unit uos_soundtouch; + +{$mode objfpc}{$H+} + +{$PACKRECORDS C} + +interface + +uses + ctypes, DynLibs; + +const +libst= + +{$IFDEF darwin} + 'libSoundTouchDLL.dylib'; + {$ELSE} + {$IFDEF unix} + 'libSoundTouch.so.1'; + {$ELSE} + {$if defined(cpu64)} + 'SoundTouch_x64.dll'; + {$else} + 'SoundTouch.dll'; + {$endif} + {$ENDIF} + {$ENDIF} + +{$IF not DEFINED(windows)} +type + THandle = pointer; +{$endif} + +type + Tt_bs2bdp = ^Tt_bs2bd; + Tt_bs2bd = packed record + level : CInt32; + srate : CInt32; + a0_lo : CDouble; + b1_lo : CDouble; + a0_hi : CDouble; + a1_hi : CDouble; + b1_hi : CDouble; + gain : CDouble; + lfs : packed record + asis : array[0..1] of cdouble; + lo : array[0..1] of cdouble; + hi : array[0..1] of cdouble; + end; + end; + +var + bpm_createInstance: function(chan: CInt32; sampleRate : CInt32): THandle; cdecl; + bpm_destroyInstance: procedure(h: THandle); cdecl; + bpm_getBpm: function(h: THandle): cfloat; cdecl; + bpm_putSamples: procedure(h: THandle; const samples: pcfloat; + numSamples: cardinal); cdecl; + + soundtouch_clear: procedure(h: THandle); cdecl; + soundtouch_createInstance: function(): THandle; cdecl; + soundtouch_flush: procedure(h: THandle); cdecl; + soundtouch_getSetting: function(h: THandle; settingId: integer): integer; cdecl; + soundtouch_getVersionId: function(): cardinal; cdecl; + soundtouch_getVersionString2: procedure(VersionString: PAnsiChar; + bufferSize: integer); cdecl; + soundtouch_getVersionString: function(): PAnsiChar; cdecl; + soundtouch_isEmpty: function(h: THandle): integer; cdecl; + soundtouch_numSamples: function(h: THandle): cardinal; cdecl; + soundtouch_numUnprocessedSamples: function(h: THandle): cardinal; cdecl; + soundtouch_putSamples: procedure(h: THandle; const samples: pcfloat; + numSamples: cardinal); cdecl; + soundtouch_receiveSamples: function(h: THandle; outBuffer: pcfloat; + maxSamples: cardinal): cardinal; cdecl; + soundtouch_setChannels: procedure(h: THandle; numChannels: cardinal); cdecl; + soundtouch_setPitch: procedure(h: THandle; newPitch: single); cdecl; + soundtouch_setPitchOctaves: procedure(h: THandle; newPitch: single); cdecl; + soundtouch_setPitchSemiTones: procedure(h: THandle; newPitch: single); cdecl; + soundtouch_setRate: procedure(h: THandle; newRate: single); cdecl; + soundtouch_setRateChange: procedure(h: THandle; newRate: single); cdecl; + soundtouch_setSampleRate: procedure(h: THandle; srate: cardinal); cdecl; + soundtouch_destroyInstance: procedure(h: THandle); cdecl; + soundtouch_setSetting: function(h: THandle; settingId: integer; Value: integer): boolean; cdecl; + soundtouch_setTempo: procedure(h: THandle; newTempo: single); cdecl; + soundtouch_setTempoChange: procedure(h: THandle; newTempo: single); cdecl; + + LibHandle:TLibHandle=dynlibs.NilHandle; // this will hold our handle for the lib + ReferenceCounter : cardinal = 0; // Reference counter + +function ST_IsLoaded : boolean; inline; +function ST_Load(const libfilename: string): boolean; // load the lib +procedure ST_Unload(); // unload and frees the lib from memory : do not forget to call it before close application. + +implementation + +function ST_IsLoaded: boolean; +begin + Result := (LibHandle <> dynlibs.NilHandle); +end; + +function ST_Load(const libfilename: string): boolean; +var +thelib: string; +begin + Result := False; + if LibHandle<>0 then +begin + Inc(ReferenceCounter); +result:=true +end else begin + if Length(libfilename) = 0 then thelib := libst else thelib := libfilename; + LibHandle:=DynLibs.SafeLoadLibrary(thelib); // obtain the handle we want. + if LibHandle <> DynLibs.NilHandle then + begin + try + Pointer(soundtouch_createInstance) := + GetProcAddress(LibHandle, 'soundtouch_createInstance'); + if Pointer(soundtouch_createInstance) = nil then // not the SoundTouchDLL library. + begin + ST_Unload; + result := false end + else + begin + Pointer(soundtouch_clear) := + GetProcAddress(LibHandle, 'soundtouch_clear'); + Pointer(soundtouch_destroyInstance) := + GetProcAddress(LibHandle, 'soundtouch_destroyInstance'); + Pointer(soundtouch_flush) := + GetProcAddress(LibHandle, 'soundtouch_flush'); + Pointer(soundtouch_getSetting) := + GetProcAddress(LibHandle, 'soundtouch_getSetting'); + Pointer(soundtouch_getVersionId) := + GetProcAddress(LibHandle, 'soundtouch_getVersionId'); + Pointer(soundtouch_getVersionString2) := + GetProcAddress(LibHandle, 'soundtouch_getVersionString2'); + Pointer(soundtouch_getVersionString) := + GetProcAddress(LibHandle, 'soundtouch_getVersionString'); + Pointer(soundtouch_isEmpty) := + GetProcAddress(LibHandle, 'soundtouch_isEmpty'); + Pointer(soundtouch_numSamples) := + GetProcAddress(LibHandle, 'soundtouch_numSamples'); + Pointer(soundtouch_numUnprocessedSamples) := + GetProcAddress(LibHandle, 'soundtouch_numUnprocessedSamples'); + Pointer(soundtouch_putSamples) := + GetProcAddress(LibHandle, 'soundtouch_putSamples'); + Pointer(soundtouch_receiveSamples) := + GetProcAddress(LibHandle, 'soundtouch_receiveSamples'); + Pointer(soundtouch_setChannels) := + GetProcAddress(LibHandle, 'soundtouch_setChannels'); + Pointer(soundtouch_setPitch) := + GetProcAddress(LibHandle, 'soundtouch_setPitch'); + Pointer(soundtouch_setPitchOctaves) := + GetProcAddress(LibHandle, 'soundtouch_setPitchOctaves'); + Pointer(soundtouch_setPitchSemiTones) := + GetProcAddress(LibHandle, 'soundtouch_setPitchSemiTones'); + Pointer(soundtouch_setRate) := + GetProcAddress(LibHandle, 'soundtouch_setRate'); + Pointer(soundtouch_setRateChange) := + GetProcAddress(LibHandle, 'soundtouch_setRateChange'); + Pointer(soundtouch_setSampleRate) := + GetProcAddress(LibHandle, 'soundtouch_setSampleRate'); + Pointer(soundtouch_setSetting) := + GetProcAddress(LibHandle, 'soundtouch_setSetting'); + Pointer(soundtouch_setTempo) := + GetProcAddress(LibHandle, 'soundtouch_setTempo'); + Pointer(soundtouch_setTempoChange) := + GetProcAddress(LibHandle, 'soundtouch_setTempoChange'); + + Pointer(bpm_createInstance) := + GetProcAddress(LibHandle, 'bpm_createInstance'); + Pointer(bpm_destroyInstance) := + GetProcAddress(LibHandle, 'bpm_destroyInstance'); + Pointer(bpm_getBpm) := + GetProcAddress(LibHandle, 'bpm_getBpm'); + Pointer(bpm_putSamples) := + GetProcAddress(LibHandle, 'bpm_putSamples'); + + Result := St_IsLoaded; + ReferenceCounter:=1; + + end; + + except + ST_Unload; + end; + end; +end; +end; + +procedure ST_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + + if LibHandle <> DynLibs.NilHandle then + begin + DynLibs.UnloadLibrary(LibHandle); + LibHandle := DynLibs.NilHandle; + end; +end; + +end. diff --git a/UOS/examples/waveform.lpi b/UOS/examples/waveform.lpi new file mode 100644 index 0000000..ba5bd97 --- /dev/null +++ b/UOS/examples/waveform.lpi @@ -0,0 +1,357 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="12"/> + <General> + <Flags> + <CompatibilityMode Value="True"/> + </Flags> + <Title Value="WaveForm"/> + <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="2014 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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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="6"> + <Unit0> + <Filename Value="waveform.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="1"/> + <CursorPos X="2" Y="7"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main_wf.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <TopLine Value="251"/> + <CursorPos X="105" Y="251"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit1> + <Unit2> + <Filename Value="uos.pas"/> + <EditorIndex Value="3"/> + <TopLine Value="3069"/> + <CursorPos X="2" Y="3087"/> + <UsageCount Value="100"/> + <Loaded Value="True"/> + </Unit2> + <Unit3> + <Filename Value="uos_flat.pas"/> + <EditorIndex Value="4"/> + <TopLine Value="121"/> + <CursorPos X="3" Y="136"/> + <UsageCount Value="19"/> + <Loaded Value="True"/> + </Unit3> + <Unit4> + <Filename Value="main_sp.pas"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <TopLine Value="409"/> + <CursorPos X="27" Y="411"/> + <UsageCount Value="11"/> + </Unit4> + <Unit5> + <Filename Value="simpleplayer_fpGUI.pas"/> + <EditorIndex Value="2"/> + <TopLine Value="353"/> + <CursorPos X="2" Y="361"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit5> + </Units> + <JumpHistory Count="29" HistoryIndex="28"> + <Position1> + <Filename Value="uos.pas"/> + <Caret Line="1040" Column="22" TopLine="1029"/> + </Position1> + <Position2> + <Filename Value="uos.pas"/> + <Caret Line="1454" Column="53" TopLine="1443"/> + </Position2> + <Position3> + <Filename Value="uos.pas"/> + <Caret Line="1984" Column="57" TopLine="1974"/> + </Position3> + <Position4> + <Filename Value="uos.pas"/> + <Caret Line="2060" Column="60" TopLine="2050"/> + </Position4> + <Position5> + <Filename Value="uos.pas"/> + <Caret Line="2067" Column="60" TopLine="2057"/> + </Position5> + <Position6> + <Filename Value="uos.pas"/> + <Caret Line="2125" Column="60" TopLine="2115"/> + </Position6> + <Position7> + <Filename Value="uos.pas"/> + <Caret Line="2200" Column="59" TopLine="2190"/> + </Position7> + <Position8> + <Filename Value="uos_flat.pas"/> + <Caret Line="1112" Column="45" TopLine="1107"/> + </Position8> + <Position9> + <Filename Value="uos_flat.pas"/> + <Caret Line="1110" Column="2" TopLine="1100"/> + </Position9> + <Position10> + <Filename Value="uos_flat.pas"/> + <Caret Line="397" Column="32" TopLine="391"/> + </Position10> + <Position11> + <Filename Value="main_wf.pas"/> + <Caret Line="355" Column="94" TopLine="173"/> + </Position11> + <Position12> + <Filename Value="uos_flat.pas"/> + <Caret Line="79" Column="27" TopLine="68"/> + </Position12> + <Position13> + <Filename Value="uos_flat.pas"/> + <Caret Line="81" Column="27" TopLine="68"/> + </Position13> + <Position14> + <Filename Value="uos_flat.pas"/> + <Caret Line="1090" Column="10" TopLine="1086"/> + </Position14> + <Position15> + <Filename Value="uos_flat.pas"/> + <Caret Line="51" Column="6" TopLine="36"/> + </Position15> + <Position16> + <Filename Value="uos.pas"/> + <Caret Line="3174" Column="62" TopLine="97"/> + </Position16> + <Position17> + <Filename Value="main_wf.pas"/> + <Caret Line="376" Column="30" TopLine="355"/> + </Position17> + <Position18> + <Filename Value="main_wf.pas"/> + <Caret Line="112" Column="32" TopLine="108"/> + </Position18> + <Position19> + <Filename Value="main_wf.pas"/> + <Caret Line="175" Column="27" TopLine="167"/> + </Position19> + <Position20> + <Filename Value="main_wf.pas"/> + <Caret Line="397" Column="15" TopLine="361"/> + </Position20> + <Position21> + <Filename Value="uos.pas"/> + <Caret Line="71" Column="2" TopLine="59"/> + </Position21> + <Position22> + <Filename Value="main_wf.pas"/> + <Caret Line="246" Column="5" TopLine="227"/> + </Position22> + <Position23> + <Filename Value="main_wf.pas"/> + <Caret Line="216" Column="74" TopLine="194"/> + </Position23> + <Position24> + <Filename Value="uos.pas"/> + <Caret Line="6105" Column="26" TopLine="6075"/> + </Position24> + <Position25> + <Filename Value="uos.pas"/> + <Caret Line="717" Column="35" TopLine="701"/> + </Position25> + <Position26> + <Filename Value="main_wf.pas"/> + <Caret Line="238" Column="32" TopLine="238"/> + </Position26> + <Position27> + <Filename Value="uos.pas"/> + <Caret Line="5927" Column="35" TopLine="5910"/> + </Position27> + <Position28> + <Filename Value="uos.pas"/> + <Caret Line="4264" Column="90" TopLine="4245"/> + </Position28> + <Position29> + <Filename Value="uos.pas"/> + <Caret Line="3087" Column="2" TopLine="3069"/> + </Position29> + </JumpHistory> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="WaveForm"/> + </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"/> + <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> diff --git a/UOS/examples/waveform.lpr b/UOS/examples/waveform.lpr new file mode 100644 index 0000000..06bedbb --- /dev/null +++ b/UOS/examples/waveform.lpr @@ -0,0 +1,22 @@ +program waveform; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + cthreads, + cwstring, {$ENDIF} {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, + main_wf { you can add units after this }; + + +begin + Application.Title := 'WaveForm'; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + + diff --git a/UOS/examples/waveform.prj b/UOS/examples/waveform.prj new file mode 100644 index 0000000..3c72c55 --- /dev/null +++ b/UOS/examples/waveform.prj @@ -0,0 +1,1354 @@ +[componentpalette] +order0=0 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/waveform.prj +findinfiledialog=37 + [findinfileadialogfo.subdirs] + value=1 + [findinfileadialogfo.inopenfiles] + value=0 + [findinfileadialogfo.wholeword] + value=0 + [findinfileadialogfo.casesensitive] + value=0 + [findinfileadialogfo.indirectories] + value=1 + [findinfileadialogfo.mask] + value="*.pas" "*.pp" "*.inc" + history=1 + "*.pas" "*.pp" "*.inc" + [findinfileadialogfo.dir] + filenames=1 + /home/graemeg/devel/ + filehistory=1 + /home/graemeg/devel/ + filefilterindex=0 + filefilter="*.pas" "*.pp" "*.inc" + filecolwidth=174 + x=0 + y=0 + cx=0 + cy=0 + [findinfileadialogfo.findtext] + value=lapAutoAdjustForDPI + history=2 + lapAutoAdjustForDPI + + [findinfileadialogfo] + stackedunder= + x=268 + y=415 + cx=339 + cy=251 +options=114 + [projectoptionsfo.toolshortcuts] + dropdowncolwidths=3 + 70 + 70 + 70 + [projectoptionsfo.twidgetgrid3] + propcolwidthref=726 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + width4=128 + sortdescend4=0 + width5=251 + sortdescend5=0 + width6=296 + sortdescend6=0 + width7=50 + sortdescend7=0 + width8=1 + sortdescend8=0 + width9=297 + sortdescend9=0 + [projectoptionsfo.twidgetgrid4] + propcolwidthref=550 + width0=96 + sortdescend0=0 + sortdescend1=0 + width2=73 + sortdescend2=0 + width3=263 + sortdescend3=0 + width4=277 + sortdescend4=0 + sorted=0 + col=-1073741823 + row=-1073741823 + rowheight=16 + [projectoptionsfo.newfile] + firsttab=0 + index=0 + [projectoptionsfo.fontaliasgrid] + propcolwidthref=389 + width0=98 + sortdescend0=0 + width1=378 + sortdescend1=0 + width2=50 + sortdescend2=0 + width3=50 + sortdescend3=0 + width4=50 + sortdescend4=0 + width5=50 + sortdescend5=0 + width6=70 + sortdescend6=0 + [projectoptionsfo.macrosplitter] + x=0 + y=120 + xprop=1 + yprop=0.23976608187135 + [projectoptionsfo.macrogrid] + propcolwidthref=481 + sortdescend0=0 + sortdescend1=0 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=146 + sortdescend10=0 + width11=465 + sortdescend11=0 + [projectoptionsfo.comment_1] + value= + [projectoptionsfo.comment_B] + value= + [projectoptionsfo.comment_M] + value= + [projectoptionsfo.makegroupbox] + firsttab=0 + index=4 + [projectoptionsfo.exceptionsgrid] + propcolwidthref=710 + width0=47 + sortdescend0=0 + width1=704 + sortdescend1=0 + [projectoptionsfo.ttabwidget1] + firsttab=0 + index=5 + [projectoptionsfo.filefiltergrid] + propcolwidthref=621 + width0=112 + sortdescend0=0 + width1=614 + sortdescend1=0 + [projectoptionsfo.ttabwidget2] + firsttab=0 + index=1 + [projectoptionsfo.setting_tab] + firsttab=0 + index=2 + [projectoptionsfo] + stackedunder= + x=479 + y=27 + cx=759 + cy=568 +settings=8 + [settings_form] + x=447 + y=148 + cx=471 + cy=446 + wsize=0 + active=1 + visible=1 +mainfile=${PROJECTNAME}.lpr +targetfile=${PROJECTNAME}${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=11 + ${lcldir}* + ${lcldir}/components/* + ${lcldir}/* + ${lcldir}/lcl/* + ${lcldir}/interfaces/* + ${lcldir}/lcl/interfaces/gtk2 + ${lcldir}/lcl/interfaces/qt + ${lcldir}/lcl/interfaces/win32 + ${lcldir}/lcl/components/* + ${lcldir}/lcl/include + ${lcldir}/lcl +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=8 + -l -Mobjfpc -Sh + -gl + -ghl + -B + -O- + -O3 -XX -CX -Xs + -vi + -FUunits/ +makeoptpurpose=8 + + + + + + + + +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=14 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + Program + Unit + Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}default/program.pas + ${TEMPLATEDIR}default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}default/mainform.pas + ${TEMPLATEDIR}default/simpleform.pas + ${TEMPLATEDIR}default/dockingform.pas + ${TEMPLATEDIR}default/datamodule.pas + ${TEMPLATEDIR}default/subform.pas + ${TEMPLATEDIR}default/scrollboxform.pas + ${TEMPLATEDIR}default/tabform.pas + ${TEMPLATEDIR}default/dockpanelform.pas + ${TEMPLATEDIR}default/report.pas + ${TEMPLATEDIR}default/pascform.pas + ${TEMPLATEDIR}default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}default/mainform.mfm + ${TEMPLATEDIR}default/simpleform.mfm + ${TEMPLATEDIR}default/dockingform.mfm + ${TEMPLATEDIR}default/datamodule.mfm + ${TEMPLATEDIR}default/subform.mfm + ${TEMPLATEDIR}default/scrollboxform.mfm + ${TEMPLATEDIR}default/tabform.mfm + ${TEMPLATEDIR}default/dockpanelform.mfm + ${TEMPLATEDIR}default/report.mfm + ${TEMPLATEDIR}default/pascform.mfm + ${TEMPLATEDIR}default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=0 +enablepurpose=0 +checkmethods=1 +colorerror=-1610612712 +colorwarning=-1610612717 +colornote=-1610612716 +usercolors=30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +usercolorcomment=30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=1 +settingsdebugger=1 +settingsstorage=1 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=8 + 63 + 2 + 0 + 2 + 2 + 61 + 4095 + 63 +compilerusedon=29 + 4095 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 4095 + 0 + 0 + 0 + 0 + 0 +exeusedon=14 + 4095 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date=15:21:42 26/03/2017 +project_comment= +aftcommandon=0 +unitdirson=11 + 987135 + 987135 + 987135 + 987135 + 987135 + 987135 + 0 + 0 + 987135 + 987135 + 987135 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=10 + + + + + + + + + + +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + -1 +uid=0 +sourcefilemasks=3 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.mfm" +syntaxdeffiles=3 + ${SYNTAXDEFDIR}pascal_ideu.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=4 +linenumberson=1 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=1 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=16 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=0 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=0 +path=0 +line=0 +address=0 +addbkpt=0 +ignore=0 +condition=0 +panels=1 + panel1 +units= + ( + a=0,8228,6,Pascal Units + ) +cmodules= + ( + a=0,8228,6,C Modules + ) +files= + ( + a=0,8228,6,Text Files + ) +[componentstore] +storedir=/home/fred/msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=100 +x=0 +y=0 +cx=0 +cy=0 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=0 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=2 + 0,0 + 0,276 +bookmarks0=0 +bookmarks1=0 +sourcefiles=2 + ${PROJECTDIR}/waveform.lpr + ${PROJECTDIR}/main_wf.pas +relpaths=2 + waveform.lpr + main_wf.pas +ismoduletexts=2 + 0 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=1 +[layout] +windowlayout=587 + [mainfo.basedock] + splitdir=2 + useroptions=11395 + parent=mainfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=668 + ncy=0 + x=0 + y=0 + cx=1147 + cy=605 + rcx=0 + rcy=0 + [mainfo] + splitdir=0 + useroptions=838860925 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=125 + y=46 + cx=1157 + cy=621 + rcx=0 + rcy=0 + children=1 + basedock,0,0,1147,605 + focusedchild=0 + wsize=0 + active=1 + visible=1 + [targetconsolefo] + splitdir=0 + useroptions=805322857 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=493 + y=171 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=805322857 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=444 + y=431 + cx=418 + cy=126 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=805322875 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=805322859 + stackedunder=stackfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=805355627 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=205 + cy=456 + rcx=0 + rcy=0 + [projecttreefo.grid] + propcolwidthref=88 + width0=117 + sortdescend0=0 + width1=82 + sortdescend1=0 + sorted=0 + col=1 + row=-1073741823 + rowheight=16 + [stackfo] + splitdir=0 + useroptions=805331049 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=423 + y=321 + cx=344 + cy=155 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=805322857 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=332 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=149 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=172 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=memoryfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo] + splitdir=0 + useroptions=805322859 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=316 + y=249 + cx=316 + cy=484 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [objectinspectorfo.grid] + propcolwidthref=306 + width0=136 + sortdescend0=0 + width1=164 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=805322875 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=805331049 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1262 + rcy=583 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=805388395 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=513 + cx=1147 + cy=92 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=805331067 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=805331051 + stackedunder= + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=240 + y=139 + cx=956 + cy=77 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=0 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1147 + cy=51 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=805452931 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1147 + ncy=54 + x=0 + y=0 + cx=1147 + cy=54 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/main_wf.pas + history=50 + /home/fred/uos/examples/main_wf.pas + /home/fred/ideu/src/confideu.pas + /home/fred/ideu/src/ideusettings.pas + /home/fred/ideu/src/msewidgets.pas + /home/fred/strumpract/src/aboutform.pas + /home/fred/strumpract/src/main.pas + /home/fred/strumpract/src/config.pas + /home/fred/uos/examples/uoslib.pas + /home/fred/uos/examples/uos_libsndfile.pas + /home/fred/uos/examples/consoleplay.pas + /home/fred/uos/examples/uos.pas + /home/fred/uoslib/src/uos_mpg123.pas + /home/fred/uoslib/src/uos_libsndfile.pas + /home/fred/uoslib/src/uos_portaudio.pas + /home/fred/uoslib/examples/demos/java/ReadMe.txt + /home/fred/lib_namesh.inc + /home/fred/msewidgets.pas + /home/fred/uoslib/src/uoslib.pas + /home/fred/strumpract/src/define.inc + /home/fred/strumpract/src/uos.pas + /home/fred/mseconsts.pas + /home/fred/ideu/src/mseconsts.pas + /home/fred/msegui/lib/common/kernel/mseconsts.pas + /home/fred/uos/examples/multiplayer_fpGUI.pas + /home/fred/uos/examples/uos_dsp_utils.pas + /home/fred/uos/src/uos_flat.pas + /home/fred/uos/src/uos_mpg123.pas + /home/fred/uos/src/uos.pas + /home/fred/uos/src/uos_aac.pas + /home/fred/strumpract/src/strumpract.pas + /home/fred/uos/examples/SimplePlayer_MSE.pas + /home/fred/uos/examples/consolebpmdetect.pas + /home/fred/strumpract/src/songplayer2.pas + /home/fred/strumpract/src/drums.pas + /home/fred/strumpract/src/infos.pas + /home/fred/uos/src/uos_soundtouch.pas + /home/fred/uos/examples/uos_soundtouch.pas + /home/fred/uos/examples/consoleplaymemorybuffer.pas + /home/fred/uos/examples/simpleplayer_fpGUI.pas + /home/fred/strumpract/src/filelistform.pas + /home/fred/strumpract/src/songplayer.pas + /home/fred/strumpract/src/commander.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/confmsegui.pas + /home/fred/ideu/src/conffpgui.pas + /home/fred/ideu/src/confdebugger.pas + /home/fred/ideu/src/confcompiler.pas + /home/fred/ideu/src/aboutform.pas + /home/fred/ideu_15_7_17/src/msedesigner.pas + /home/fred/Téléchargements/ideU-296c231f492dc77aa758c3f555e5d3e0a62c7a19/src/msedesigner.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=0 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=208 + y=0 + cx=939 + cy=456 + rcx=0 + rcy=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=threadsfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=838958571 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=54 + cx=1147 + cy=456 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/waveform_fpGUI.lpi b/UOS/examples/waveform_fpGUI.lpi new file mode 100644 index 0000000..e2c212b --- /dev/null +++ b/UOS/examples/waveform_fpGUI.lpi @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="10"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasTitleStatement Value="False"/> + <LRSInOutputDirectory Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="Wave Form 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="waveform_fpGUI.pas"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="WaveForm_FPG"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <Optimizations> + <OptimizationLevel Value="3"/> + </Optimizations> + </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> diff --git a/UOS/examples/waveform_fpGUI.pas b/UOS/examples/waveform_fpGUI.pas new file mode 100644 index 0000000..bbbddd0 --- /dev/null +++ b/UOS/examples/waveform_fpGUI.pas @@ -0,0 +1,319 @@ +program waveform_fpGUI; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX} + cthreads, {$ENDIF} + SysUtils, + Classes, + fpg_base, + fpg_main, + fpg_widget, + uos_flat, + ctypes, + fpg_style_chrome_silver_flatmenu, + fpg_stylemanager, + {%units 'Auto-generated GUI code'} + fpg_form, + fpg_editbtn, + fpg_label, + fpg_button {%endunits}; + +type + + Twaveform = class(TfpgForm) + private + {@VFD_HEAD_BEGIN: waveform} + FilenameEdit1: TfpgFileNameEdit; + Label1: TfpgLabel; + Button1: TfpgButton; + Custom1: TfpgWidget; + {@VFD_HEAD_END: waveform} + public + procedure AfterCreate; override; + procedure drawwave(Sender: TObject); + procedure btnDrawClick(Sender: TObject); + procedure btnCloseClick(Sender: TObject); + procedure DrawWaveForm; + end; + +var + opath, fnsf, fnmp, ordir: string; + PlayerIndex1, In1Index, filelength, framewanted: integer; + poswav, chan: integer; + waveformdata: array of cfloat; + + + {@VFD_NEWFORM_DECL} + + {@VFD_NEWFORM_IMPL} + + procedure Twaveform.DrawWaveForm; + begin + waveformdata := uos_InputGetLevelArray(PlayerIndex1, In1Index); + fpgapplication.ProcessMessages; + button1.tag := 1; + custom1.Visible := True; + + end; + + procedure Twaveform.btndrawclick(Sender: TObject); + begin + custom1.Visible := False; + + windowtitle := 'Wave Form. uos version ' + IntToStr(uos_getversion()); + + PlayerIndex1 := 0; + + //// Create the player. + uos_CreatePlayer(PlayerIndex1); + //// PlayerIndex : from 0 to what your computer can do ! + //// If PlayerIndex exists already, it will be overwriten... + + //// add input from audio file with default parameters + In1Index := uos_AddFromFile(PlayerIndex1, PChar(FilenameEdit1.filename)); + + //// no output because only decode the steam for wave form + + /// get the length of the audio file + filelength := uos_InputLength(PlayerIndex1, In1Index); + + chan := uos_InputGetChannels(PlayerIndex1, In1Index); + + // writeln('chan = ' + inttostr(chan)); + // writeln('filelength = ' + inttostr(filelength)); + + ///// set calculation of level/volume into array (usefull for wave form procedure) + uos_InputSetLevelArrayEnable(PlayerIndex1, In1Index, 2); + ///////// set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + + //// determine how much frame will be designed + framewanted := filelength div custom1.Width; + + uos_InputSetFrameCount(PlayerIndex1, In1Index, framewanted); + + ///// Assign the procedure of object to execute at end of stream + uos_EndProc(PlayerIndex1, @DrawWaveForm); + + uos_Play(PlayerIndex1); /////// everything is ready, here we are, lets do it... + + end; + + procedure Twaveform.drawwave(Sender: TObject); + begin + if button1.tag = 0 then + with Custom1 do + begin + Canvas.GradientFill(GetClientRect, clgreen, clBlack, gdVertical); + Canvas.TextColor := clWhite; + Canvas.DrawText(60, 20, 'uos'); + end + else + begin + Custom1.Canvas.GradientFill(GetClientRect, clwhite, clblack, gdVertical); + + poswav := 0; + + while poswav < length(waveformdata) div chan do + begin + if chan = 2 then + begin + Custom1.Canvas.setcolor(cldarkgreen); + + Custom1.Canvas.drawLine(poswav, Custom1.Height div 2, poswav, ((Custom1.Height div 2) - 1) - round( + (waveformdata[poswav * 2]) * (Custom1.Height / 2) - 1)); + + Custom1.Canvas.setcolor(clred); + Custom1.Canvas.drawLine(poswav, (Custom1.Height div 2) + 2, poswav, ((Custom1.Height div 2) + 1) + round( + (waveformdata[(poswav * 2) + 1]) * (Custom1.Height / 2) + 1)); + end; + if chan = 1 then + begin + Custom1.Canvas.setcolor(cldarkgreen); + Custom1.Canvas.drawLine(poswav, 0, poswav, ((Custom1.Height) - 1) - round((waveformdata[poswav]) * (Custom1.Height) - 1)); + end; + Inc(poswav); + end; + Custom1.Canvas.TextColor := clBlack; + Custom1.Canvas.DrawText(60, 20, 'Right Channel'); + + Custom1.Canvas.TextColor := clWhite; + Custom1.Canvas.DrawText(60, Custom1.Height - 40, 'Left Channel'); + + end; + + end; + + procedure Twaveform.btnCloseClick(Sender: TObject); + begin + uos_UnloadLib(); + end; + + procedure Twaveform.AfterCreate; + begin + {%region 'Auto-generated GUI code' -fold} + + {@VFD_BODY_BEGIN: waveform} + Name := 'waveform'; + SetPosition(267, 185, 841, 475); + WindowTitle := 'Wave Form'; + IconName := ''; + Hint := ''; + WindowPosition := wpScreenCenter; + BackgroundColor := clmoneygreen; + Ondestroy := @btnCloseClick; + + FilenameEdit1 := TfpgFileNameEdit.Create(self); + with FilenameEdit1 do + begin + Name := 'FilenameEdit1'; + SetPosition(28, 28, 360, 24); + ExtraHint := ''; + FileName := ''; + Filter := ''; + InitialDir := ''; + TabOrder := 1; + end; + + Label1 := TfpgLabel.Create(self); + with Label1 do + begin + Name := 'Label1'; + SetPosition(164, 12, 80, 15); + FontDesc := '#Label1'; + Hint := ''; + Text := 'Audio file'; + end; + + Button1 := TfpgButton.Create(self); + with Button1 do + begin + Name := 'Button1'; + SetPosition(400, 28, 412, 23); + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 3; + Text := 'Draw Wave Form'; + onclick := @btndrawClick; + end; + + Custom1 := TfpgWidget.Create(self); + with Custom1 do + begin + Name := 'Custom1'; + SetPosition(2, 68, 836, 404); + OnPaint := @drawwave; + end; + + {@VFD_BODY_END: waveform} + {%endregion} + + + ordir := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0))); + // Height := 197; + {$IFDEF Windows} + {$if defined(cpu64)} + fnsf := ordir + 'lib\Windows\64bit\LibSndFile-64.dll'; + fnmp := ordir + 'lib\Windows\64bit\LibMpg123-64.dll'; + +{$else} + fnsf := ordir + 'lib\Windows\32bit\LibSndFile-32.dll'; + fnmp := ordir + 'lib\Windows\32bit\LibMpg123-32.dll'; + {$endif} + FilenameEdit1.FileName := ordir + 'sound\test.mp3'; + {$ENDIF} + + {$IFDEF Darwin} + {$IFDEF CPU32} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + FilenameEdit1.FileName := ordir + 'sound/test.mp3'; + fnsf := opath + '/lib/Mac/32bit/LibSndFile-32.dylib'; + fnmp := opath + '/lib/Mac/32bit/LibMpg123-32.dylib'; + {$ENDIF} + {$IFDEF CPU64} + opath := ordir; + opath := copy(opath, 1, Pos('/uos', opath) - 1); + FilenameEdit1.FileName := ordir + 'sound/test.mp3'; + fnsf := opath + '/lib/Mac/64bit/LibSndFile-64.dylib'; + fnmp:= opath + '/lib/Mac/64bit/LibMpg123-64.dylib'; + {$ENDIF} + {$ENDIF} + + + {$if defined(CPUAMD64) and defined(linux) } + fnsf := ordir + 'lib/Linux/64bit/LibSndFile-64.so'; + fnmp := ordir + 'lib/Linux/64bit/LibMpg123-64.so'; + FilenameEdit1.FileName := ordir + 'sound/test.mp3'; + {$ENDIF} + {$if defined(cpu86) and defined(linux)} + fnsf := ordir + 'lib/Linux/32bit/LibSndFile-32.so'; + fnmp := ordir + 'lib/Linux/32bit/LibMpg123-32.so'; + FilenameEdit1.FileName := ordir + 'sound/test.mp3'; + {$ENDIF} + {$if defined(linux) and defined(cpuarm)} + fnsf := ordir + 'lib/Linux/arm_raspberrypi/libsndfile-arm.so'; + fnmp := ordir + 'lib/Linux//arm_raspberrypi/libmpg123-arm.so'; + FilenameEdit1.FileName := ordir + 'sound/test.mp3'; + {$ENDIF} + + {$if defined(linux) and defined(cpuaarch64)} + fnsf := ordir + 'lib/Linux/aarch64_raspberrypi/libportaudio_aarch64.so'; + fnmp := ordir + 'lib/Linux/aarch64_raspberrypi/libmpg123_aarch64.so'; + FilenameEdit1.FileName := ordir + 'sound/test.mp3'; + {$ENDIF} + + {$IFDEF freebsd} + {$if defined(cpu64)} + fnsf := ordir + 'lib/FreeBSD/64bit/libsndfile-64.so'; + fnmp := ordir + 'lib/FreeBSD/64bit/libmpg123-64.so'; + {$else} + fnsf := ordir + 'lib/FreeBSD/32bit/libsndfile-32.so'; + fnmp := ordir + 'lib/FreeBSD/32bit/libmpg123-32.so'; + {$endif} + FilenameEdit1.FileName := ordir + 'sound/test.mp3'; + {$ENDIF} + +{$if defined(CPUAMD64) and defined(linux) } + // For Linux amd64, check libsndfile.so + if uos_TestLoadLibrary(PChar(fnsf)) = false then + fnsf := fnsf + '.2'; +{$endif} + + if uos_LoadLib(nil, PChar(fnsf), PChar(fnmp), nil, nil, nil, nil) = 0 then + button1.Enabled := True + else + begin + button1.Enabled := False; + button1.Text := 'Error while loading libraries :-('; + end; + + end; + + procedure MainProc; + var + frm: Twaveform; + begin + fpgApplication.Initialize; + try + if fpgStyleManager.SetStyle('Chrome silver flat menu') then + fpgStyle := fpgStyleManager.Style; + fpgApplication.CreateForm(Twaveform, frm); + fpgApplication.MainForm := frm; + frm.Show; + fpgApplication.Run; + finally + uos_free; + frm.Free; + end; + end; + +begin + MainProc; +end. + diff --git a/UOS/examples/waveform_fpGUI.prj b/UOS/examples/waveform_fpGUI.prj new file mode 100644 index 0000000..74c8104 --- /dev/null +++ b/UOS/examples/waveform_fpGUI.prj @@ -0,0 +1,1404 @@ +[componentpalette] +order0=50 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 34 + 33 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 +order1=0 +order2=0 +order3=0 +order4=0 +order5=0 +order6=0 +order7=0 +order8=0 +order9=0 +order10=0 +order11=0 +order12=0 +order13=0 +order14=0 +order15=0 +order16=0 +order17=0 +order18=0 +[projectoptions] +projectdir=/home/fred/uos/examples +projectfilename=/home/fred/uos/examples/waveform_fpGUI.prj +settings=8 + [settings_form] + x=492 + y=41 + cx=446 + cy=660 + wsize=0 + active=1 + visible=1 +imagelisteditor=89 + [imagelisteditorfo.statfile1] + currentversion=0 + [imagelisteditorfo.filedialog] + filenames=1 + /home/fred/ideu/src/ideu24.png + filenamescust=0 + filecolwidth=588 + x=489 + y=233 + cx=635 + cy=431 + nopanel=0 + compact=0 + showoptions=0 + hidehistory=0 + hideicons=0 + showhidden=0 + colnamewidth=211 + colsizewidth=81 + colextwidth=45 + coldatewidth=119 + splitterplaces=254 + splitterlateral=137 + lastdir=/home/fred/ideu/src/ + filehistory=50 + /home/fred/ideu/src/ideu24.png + /home/fred/Documents/fpgui_windows.png + /home/fred/Documents/python.png + /home/fred/Documents/c.png + /home/fred/Documents/java.png + /home/fred/Documents/pas2.png + /home/fred/Documents/pas3.png + /home/fred/Documents/pas1.png + /home/fred/strumpract/src/images/image.png + /home/fred/strumpract/src/images/audio.png + /home/fred/strumpract/text.png + /home/fred/Pictures/imagesideu/bugnew64no2.png + /home/fred/Pictures/imagesideu/pause_64bleudisable.png + /home/fred/Pictures/imagesideu/pause_64bleu.png + /home/fred/Pictures/imagesideu/trianglebleudown64_2.png + /home/fred/Pictures/imagesideu/trianglebleudouble64_2.png + /home/fred/Pictures/imagesideu/compile64_3disable.png + /home/fred/Pictures/imagesideu/stop_64disable.png + /home/fred/Pictures/imagesideu/stop_64.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2disable.png + /home/fred/Pictures/imagesideu/trianglevertflip64_2.png + /home/fred/Pictures/imagesideu/trianglevertdown64_2.png + /home/fred/Pictures/imagesideu/trianglevertdouble64_2.png + /home/fred/Pictures/imagesideu/trianglevert64_3.png + /home/fred/Pictures/imagesideu/bugnew64no.png + /home/fred/Pictures/imagesideu/bugnew64.png + /home/fred/Pictures/imagesideu/compile64_3.png + /home/fred/ideu/src/images/pausedisable.png + /home/fred/ideu/src/images/terminaloff.png + /home/fred/ideu/src/images/terminalon.png + /home/fred/ideu/src/images/debugoff.png + /home/fred/ideu/src/images/debugon.png + /home/fred/ideu/src/images/downdisable.png + /home/fred/ideu/src/images/beforedisable.png + /home/fred/ideu/src/images/ffdisable.png + /home/fred/ideu/src/images/playdisable.png + /home/fred/ideu/src/images/stopdisable.png + /home/fred/ideu/src/images/right.png + /home/fred/ideu/src/images/righton.png + /home/fred/ideu/src/images/left.png + /home/fred/ideu/src/images/lefton.png + /home/fred/ideu/src/images/stopenable.png + /home/fred/ideu/src/images/eyesdark.png + /home/fred/ideu/src/images/eyeslight.png + /home/fred/ideu/src/images/glist2.png + /home/fred/ideu/src/images/glist.png + /home/fred/ideu/src/images/beauty.png + /home/fred/ideu/src/images/fondbookmark.png + filefilterindex=4 + filefilter=*.png + [imagelisteditorfo.transparentcolor] + value=-2147483642 + [imagelisteditorfo.stretch] + value=1 + [imagelisteditorfo] + x=40 + y=175 + cx=785 + cy=421 + wsize=0 + active=1 + visible=1 +sysenvmanagereditor=34 + [msesysenvmanagereditorfo.grid] + propcolwidthref=1019 + width0=123 + sortdescend0=0 + width1=116 + sortdescend1=0 + width2=74 + sortdescend2=0 + sortdescend3=0 + sortdescend4=0 + sortdescend5=0 + sortdescend6=0 + sortdescend7=0 + sortdescend8=0 + sortdescend9=0 + width10=50 + sortdescend10=0 + width11=123 + sortdescend11=0 + width12=382 + sortdescend12=0 + width13=88 + sortdescend13=0 + width14=87 + sortdescend14=0 + [msesysenvmanagereditorfo] + stackedunder= + x=83 + y=49 + cx=1212 + cy=619 + wsize=0 + active=1 + visible=1 +mainfile=waveform_fpGUI.pas +targetfile=waveform_fpGUI${EXEEXT} +messageoutputfile= +makecommand=${COMPILER} +makedir= +unitdirs=2 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ +unitpref=-Fu +incpref=-Fi +libpref=-Fl +objpref=-Fo +targpref=-o +befcommand=0 +aftcommand=0 +makeoptions=5 + -l -Mobjfpc -Sh -Fcutf8 + -gl -O- + -B + -FUunits + -O2 -XX -CX -Xs +makeoptpurpose=0 +compilerused=29 + ${COMPILER} (Default) + Pascal 1 + Pascal 2 + Pascal 3 + Pascal 4 + Pascal 5 + Pascal 6 + Pascal 7 + Pascal 8 + C 1 + C 2 + C 3 + C 4 + C 5 + C 6 + C 7 + C 8 + Java 1 + Java 2 + Java 3 + Java 4 + Python 1 + Python 2 + Python 3 + Python 4 + Other 1 + Other 2 + Other 3 + Other 4 +debuggerused=6 + ${DEBUGGER} (Default) + Debugger 1 + Debugger 2 + Debugger 3 + Debugger 4 + None +exeused=15 + ${EXEEXT} (Default) + No Extension + .exe + .com + .bin + .prog + .pyc + .class + .java + .so + .dll + .lib + .o + .res + .inf +codetemplatedirs=1 + ${TEMPLATEDIR} +toolmenus=0 +toolfiles=0 +toolparams=0 +fontnames=0 +scriptbeforecopy= +scriptaftercopy= +newprojectfiles=0 +newprojectfilesdest=0 +newfinames=3 + MSE Program + MSE Unit + MSE Textfile +newfifilters=3 + "*.pas" "*.pp" + "*.pas" "*.pp" + +newfiexts=3 + pas + pas + +newfisources=3 + ${TEMPLATEDIR}/fpc_mse/default/program.pas + ${TEMPLATEDIR}/fpc_mse/default/unit.pas + +newfonames=11 + Mainform + Simple Form + Docking Form + Datamodule + Subform + Scrollboxform + Tabform + Dockpanel + Report + Scriptform + Inherited Form +newfonamebases=11 + form + form + form + module + form + form + form + form + report + script + form +newfosources=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.pas + ${TEMPLATEDIR}fpc_mse/default/simpleform.pas + ${TEMPLATEDIR}fpc_mse/default/dockingform.pas + ${TEMPLATEDIR}fpc_mse/default/datamodule.pas + ${TEMPLATEDIR}fpc_mse/default/subform.pas + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.pas + ${TEMPLATEDIR}fpc_mse/default/tabform.pas + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.pas + ${TEMPLATEDIR}fpc_mse/default/report.pas + ${TEMPLATEDIR}fpc_mse/default/pascform.pas + ${TEMPLATEDIR}fpc_mse/default/inheritedform.pas +newfoforms=11 + ${TEMPLATEDIR}fpc_mse/default/mainform.mfm + ${TEMPLATEDIR}fpc_mse/default/simpleform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockingform.mfm + ${TEMPLATEDIR}fpc_mse/default/datamodule.mfm + ${TEMPLATEDIR}fpc_mse/default/subform.mfm + ${TEMPLATEDIR}fpc_mse/default/scrollboxform.mfm + ${TEMPLATEDIR}fpc_mse/default/tabform.mfm + ${TEMPLATEDIR}fpc_mse/default/dockpanelform.mfm + ${TEMPLATEDIR}fpc_mse/default/report.mfm + ${TEMPLATEDIR}fpc_mse/default/pascform.mfm + ${TEMPLATEDIR}fpc_mse/default/inheritedform.mfm +forcezorder=0 +stripmessageesc=0 +copymessages=0 +closemessages=1 +enablepurpose=0 +enablesource=0 +checkmethods=1 +colorerror=-1610612717 +colorwarning=-1610612712 +colornote=-1610612716 +colorhint=15134207 +usercolors=0 +usercolorcomment=0 +formatmacronames=0 +formatmacrovalues=0 +settingsfile= +settingseditor=0 +settingsdebugger=0 +settingsstorage=0 +settingsprojecttree=0 +settingsautoload=0 +settingsautosave=0 +modulenames=0 +moduletypes=0 +modulefiles=0 +befcommandon=0 +makeoptionson=5 + 4095 + 4095 + 4063 + 34 + 32 +compilerusedon=29 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +debuggerusedon=6 + 69631 + 0 + 0 + 0 + 0 + 0 +exeusedon=15 + 69631 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +comment_M= +comment_B= +comment_1= +comment_2= +comment_3= +comment_4= +comment_5= +comment_6= +comment_7= +comment_8= +comment_9= +comment_0= +project_name= +project_creator= +project_copyright= +project_license= +project_time= +project_date= +project_comment= +aftcommandon=0 +unitdirson=2 + 69631 + 69631 +macroon=0 +macronames=0 +macrovalues=0 +macrogroup=0 +groupcomments=0 +toolsave=0 +toolhide=0 +toolparse=0 +toolmessages=0 +toolshortcuts=0 +fontalias=0 +fontancestors=0 +fontheights=0 +fontwidths=0 +fontoptions=0 +fontxscales=0 +expandprojectfilemacros=0 +loadprojectfile=0 +newinheritedforms=11 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +uid=0 +sourcefilemasks=5 + "*.pas" "*.dpr" "*.lpr" "*.pp" "*.inc" + "*.c" "*.cc" "*.h" + "*.java" + "*.pyw" + "*.mfm" +syntaxdeffiles=5 + ${SYNTAXDEFDIR}pascal.sdef + ${SYNTAXDEFDIR}cpp.sdef + ${SYNTAXDEFDIR}java.sdef + ${SYNTAXDEFDIR}python.sdef + ${SYNTAXDEFDIR}objecttext.sdef +filemasknames=3 + Source + Forms + All Files +filemasks=3 + "*.pp" "*.pas" "*.inc" "*.dpr" "*.lpr" + *.mfm + * +showgrid=1 +snaptogrid=1 +moveonfirstclick=1 +noformdesignerdocking=0 +componenthints=1 +gridsizex=8 +gridsizey=8 +autoindent=1 +blockindent=1 +linenumberson=0 +rightmarginon=1 +rightmarginchars=80 +scrollheight=0 +tabstops=4 +spacetabs=0 +showtabs=0 +tabindent=0 +editfontname=mseide_source +editfontheight=0 +editfontwidth=0 +editfontextraspace=0 +editfontcolor=-1879048183 +editbkcolor=-1879048186 +statementcolor=14745599 +pairmarkcolor=-1610612712 +editfontantialiased=1 +editmarkbrackets=1 +editmarkpairwords=1 +fpgdesigner=1 +backupfilecount=2 +encoding=1 +eolstyle=1 +trimtrailingwhitespace=0 +codetemplatedirs=1 + ${TEMPLATEDIR} +debugcommand=${DEBUGGER} +debugoptions= +debugtarget= +runcommand= +xtermcommand=xterm -S${PTSN}/${PTSH} +remoteconnection= +uploadcommand= +gdbprocessor=auto +gdbservercommand= +gdbservercommandattach= +beforeconnect= +afterconnect= +beforeload= +afterload= +beforerun= +sourcebase= +sourcedirs=3 + ${MSELIBDIR}kernel/$TARGETOSDIR/ + ${MSELIBDIR}*/ + ./ +defines=0 +progparameters= +progworkingdirectory= +envvarnames=0 +envvarvalues=0 +defineson=0 +stoponexception=0 +valuehints=1 +activateonbreak=1 +raiseonbreak=1 +showconsole=0 +externalconsole=0 +settty=1 +gdbdownload=0 +downloadalways=0 +restartgdbbeforeload=0 +startupbkpt=0 +startupbkpton=0 +gdbsimulator=0 +gdbserverstartonce=0 +gdbloadtimeout= +gdbserverwait=0 +nogdbserverexit=0 +gdbservertty=0 +exceptclassnames=1 + EconvertError +exceptignore=1 + 0 +nodebugbeginend=0 +fpcgdbworkaround=1 +sigsettings=27 + 1,1,T,F + 3,3,T,F + 4,4,T,F + 6,6,T,F + 7,7,T,F + 8,8,T,F + 9,9,T,F + 10,10,T,F + 11,11,T,F + 12,12,T,F + 13,13,T,F + 15,15,T,F + 16,16,T,F + 17,17,F,F + 18,18,T,F + 19,19,T,F + 20,20,T,F + 21,21,T,F + 22,22,T,F + 23,23,T,F + 24,24,T,F + 25,25,T,F + 26,26,T,F + 27,27,T,F + 28,28,T,F + 29,29,T,F + 30,30,T,F +defaultmake=1 +[breakpoints] +on=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +path=27 + /usr/home/fred/ideu_prog/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/msesyntaxpainter.pas + /home/fred/ideu/src/msesyntaxedit.pas + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/msegui/lib/common/kernel/linux/cwstring.pas + /home/fred/ideu/src/main.pas + /home/fred/ideu/src/actionsmodule.pas + /home/fred/ideu/src/dialogfiles.pas + /home/fred/ideu/src/templates/fpc_mse/default.prj + /home/fred/ideu/src/commandorform.pas + /home/fred/fpGUIlibDemo_python/fpgui-test.pyw + /home/fred/ideu/src/make.pas + /home/fred/ideu/src/sourceform.pas + /home/fred/ideu/src/projectoptionsform.pas + /home/fred/ideu/src/main.pas + /home/fred/mseide-msegui/lib/common/kernel/windows/mseguiintf.pas + /home/fred/mseide-msegui/lib/common/widgets/msewidgets.pas + /home/fred/mseide-msegui/lib/common/image/mseformattgaread.pas + /home/fred/mseide-msegui/lib/common/db/firebird.pas + /home/fred/ideu/src/main.pas +line=27 + 2129 + 1164 + 523 + 3156 + 660 + 119 + 1116 + 2358 + 2274 + 2551 + 3350 + 119 + 478 + 456 + 66 + 684 + 98 + 15 + 787 + 904 + 2591 + 5009 + 1882 + 6131 + 18 + 8 + 2601 +address=27 + 4868715 + 4692069 + 4840941 + 4893608 + 8223418 + 8511777 + 8891382 + 8095124 + 8093068 + 8100826 + 8118112 + 5887456 + 4840013 + 4679705 + 4412444 + 0 + 4723305 + 0 + 8884306 + 4705770 + 8101959 + 4943079 + 4977452 + 6353008 + 8590717 + 10573405 + 4882128 +addbkpt=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +ignore=27 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +condition=27 + + + + + + + + + + + + + + + + + + + + + + + + + + + +panels=1 + panel1 +units= + ( + a=0,8229,6,Pascal Units + ) +cmodules= + ( + a=0,8229,6,C Modules + ) +files= + ( + a=0,8229,6,Text Files + ) +[componentstore] +storedir=/home/fred/mseide-msegui/apps/ide/compstore/ +filename= +[components] +[selecteditpage] +colwidth=158 +x=331 +y=135 +cx=704 +cy=473 +[progparams] +progparamhistory=0 +workdirparamhistory=0 +envvarons=0 +[edit] +hintwidth=382 +hintheight=0 +finddtext= +findhistory=0 +findoptions=1 +editpos=1 + 0,0 +bookmarks0=0 +sourcefiles=1 + ${PROJECTDIR}/waveform_fpGUI.pas +relpaths=1 + waveform_fpGUI.pas +ismoduletexts=1 + 0 +modules=0 +moduleoptions=0 +visiblemodules=0 +nomenumodules=0 +[sourcefo.files_tab] +firsttab=0 +index=0 +[layout] +windowlayout=522 + [mainfo.basedock] + splitdir=2 + useroptions=268450944 + [mainfo] + splitdir=0 + useroptions=301990011 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=65 + y=70 + cx=1231 + cy=621 + rcx=0 + rcy=0 + wsize=0 + active=1 + visible=1 + [findmessagefo.findtext] + value= + history=0 + [findmessagefo.casesensitive] + value=0 + [findmessagefo.copytoclip] + value=0 + [targetconsolefo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=495 + y=172 + cx=497 + cy=314 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [threadsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=362 + y=177 + cx=355 + cy=107 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo] + splitdir=0 + useroptions=268451963 + stackedunder=dialogfilesfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=453 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [memoryfo.add] + value=0 + [memoryfo.memon] + value=0 + [memoryfo.bitwidth] + value=0 + [memoryfo.cnt] + value=0 + [disassfo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=162 + y=502 + cx=564 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [findinfilefo] + splitdir=0 + useroptions=268451947 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=239 + y=115 + cx=678 + cy=414 + rcx=0 + rcy=0 + [projecttreefo] + splitdir=0 + useroptions=268484715 + stackedunder=conflangfo + parent= + mdistate=3 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=24 + y=95 + cx=181 + cy=449 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [projecttreefo.grid] + propcolwidthref=30 + width0=141 + sortdescend0=0 + width1=28 + sortdescend1=0 + sorted=0 + col=1 + row=0 + rowheight=17 + [stackfo] + splitdir=0 + useroptions=268460137 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=337 + y=280 + cx=427 + cy=144 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo] + splitdir=0 + useroptions=268451945 + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=537 + y=26 + cx=483 + cy=210 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [watchpointsfo.grid] + propcolwidthref=352 + sortdescend0=0 + values1=0 + values1_ci=-1 + width1=33 + sortdescend1=0 + values2=0 + width2=158 + sortdescend2=0 + width4=34 + sortdescend4=0 + values5=0 + values5_ci=-1 + width5=38 + sortdescend5=0 + values6=0 + width6=184 + sortdescend6=0 + [breakpointsfo] + splitdir=0 + useroptions=268451947 + stackedunder=projecttreefo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=107 + y=404 + cx=477 + cy=128 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [breakpointsfo.bkptson] + value=1 + [objectinspectorfo.grid] + propcolwidthref=242 + width0=58 + sortdescend0=0 + width1=178 + sortdescend1=0 + [symbolfo] + splitdir=0 + useroptions=268451963 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=142 + y=257 + cx=361 + cy=137 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [symbolfo.grid] + propcolwidthref=207 + values0=18 + + + + + + + + + + + + + + + + + + + width0=111 + sortdescend0=0 + width1=125 + sortdescend1=0 + [symbolfo.symbol] + [watchfo] + splitdir=0 + useroptions=268460137 + parent=mainfo.basedock + visible=0 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=53 + y=0 + cx=247 + cy=44 + rcx=1129 + rcy=679 + [watchfo.grid] + propcolwidthref=121 + values0=0 + values0_ci=-1 + sortdescend0=0 + values1=0 + width1=66 + sortdescend1=0 + values3=0 + values3_ci=-1 + sortdescend3=0 + values4=0 + values4_ci=-1 + width4=13 + sortdescend4=0 + [watchfo.watchon] + [watchfo.expression] + [watchfo.watcheson] + value=1 + [messagefo] + splitdir=0 + useroptions=268550251 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=512 + cx=1221 + cy=88 + rcx=0 + rcy=0 + [componentstorefo] + splitdir=0 + useroptions=268460155 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=100 + y=100 + cx=445 + cy=354 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentstorefo.grid] + propcolwidthref=435 + width0=111 + sortdescend0=0 + sortdescend1=0 + width2=160 + sortdescend2=0 + width3=185 + sortdescend3=0 + [componentstorefo.storefiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.groupfiledialog] + filenames=1 + /home/fred/mseide-msegui/apps/ide/compstore/ + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir=/home/fred/mseide-msegui/apps/ide/compstore/ + filehistory=0 + filefilterindex=0 + filefilter= + [componentstorefo.compfiledialog] + filenames=0 + filecolwidth=0 + x=0 + y=0 + cx=0 + cy=0 + lastdir= + filehistory=0 + filefilterindex=0 + filefilter= + [componentpalettefo] + splitdir=0 + useroptions=268460139 + stackedunder= + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=428 + y=66 + cx=440 + cy=129 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [componentpalettefo.componentpages] + activetab=1 + [debuggerfo] + splitdir=0 + useroptions=24683 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=52 + rcx=0 + rcy=0 + [debuggerfo.basedock] + splitdir=2 + useroptions=268582019 + parent=debuggerfo.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=1219 + ncy=60 + x=0 + y=0 + cx=1221 + cy=60 + rcx=0 + rcy=0 + [debuggerfo.edit_options] + value=X + [debuggerfo.edit_compilernum] + value=0 + [debuggerfo.edit_compiler] + value=Pascal + [debuggerfo.file_history] + value=/home/fred/uos/examples/waveform_fpGUI.pas + history=2 + /home/fred/uos/examples/waveform_fpGUI.pas + ${PROJECTDIR}/main.pas + [debuggerfo.project_options] + value=1 + [debuggerfo.hints] + value=1 + [sourcefo] + splitdir=0 + useroptions=16489 + parent=mainfo.panel1.container + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=0 + cx=1221 + cy=454 + rcx=0 + rcy=0 + [sourcefo.files_tab] + firsttab=0 + index=0 + [confideufo.usedefaulteditoroptions] + value=0 + [cpuc86_64fo] + irqoff=0 + splitdir=0 + useroptions=268451947 + stackedunder=mainfo + parent= + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=183 + y=113 + cx=352 + cy=277 + rcx=0 + rcy=0 + wsize=0 + active=0 + visible=0 + [mainfo.panel1] + splitdir=1 + useroptions=302022123 + parent=mainfo.basedock + visible=1 + mdistate=0 + nx=0 + ny=0 + ncx=0 + ncy=0 + x=0 + y=55 + cx=1221 + cy=454 + rcx=0 + rcy=0 +[targetconsole] +finddtext= +findhistory=0 +findoptions=1 diff --git a/UOS/examples/wavevrtform.lpi b/UOS/examples/wavevrtform.lpi new file mode 100644 index 0000000..59ce5fa --- /dev/null +++ b/UOS/examples/wavevrtform.lpi @@ -0,0 +1,371 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="12"/> + <General> + <Flags> + <CompatibilityMode Value="True"/> + </Flags> + <Title Value="wavevrtform"/> + <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="2014 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? <?MAINTAINER_EMAIL?> ?DATER? +"/> + <Item4 Name="lazpackager/deb/tpl_control" Value="Source: ?PACKAGE_NAME? +Maintainer: ?MAINTAINER? <?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="7"> + <Unit0> + <Filename Value="wavevrtform.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="1"/> + <CursorPos X="49" Y="13"/> + <UsageCount Value="200"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main_wf.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="-1"/> + <TopLine Value="242"/> + <CursorPos X="32" Y="238"/> + <UsageCount Value="200"/> + </Unit1> + <Unit2> + <Filename Value="uos.pas"/> + <EditorIndex Value="3"/> + <TopLine Value="3069"/> + <CursorPos X="2" Y="3087"/> + <UsageCount Value="100"/> + <Loaded Value="True"/> + </Unit2> + <Unit3> + <Filename Value="uos_flat.pas"/> + <EditorIndex Value="4"/> + <TopLine Value="13"/> + <CursorPos X="61" Y="25"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit3> + <Unit4> + <Filename Value="main_sp.pas"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <TopLine Value="409"/> + <CursorPos X="27" Y="411"/> + <UsageCount Value="11"/> + </Unit4> + <Unit5> + <Filename Value="simpleplayer_fpGUI.pas"/> + <EditorIndex Value="2"/> + <TopLine Value="353"/> + <CursorPos X="2" Y="361"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit5> + <Unit6> + <Filename Value="main_wfvrt.pas"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <TopLine Value="184"/> + <CursorPos X="56" Y="188"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit6> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="uos_flat.pas"/> + <Caret Line="1090" Column="10" TopLine="1086"/> + </Position1> + <Position2> + <Filename Value="uos_flat.pas"/> + <Caret Line="51" Column="6" TopLine="36"/> + </Position2> + <Position3> + <Filename Value="uos.pas"/> + <Caret Line="3174" Column="62" TopLine="97"/> + </Position3> + <Position4> + <Filename Value="uos.pas"/> + <Caret Line="71" Column="2" TopLine="59"/> + </Position4> + <Position5> + <Filename Value="uos.pas"/> + <Caret Line="6105" Column="26" TopLine="6075"/> + </Position5> + <Position6> + <Filename Value="uos.pas"/> + <Caret Line="717" Column="35" TopLine="701"/> + </Position6> + <Position7> + <Filename Value="uos.pas"/> + <Caret Line="5927" Column="35" TopLine="5910"/> + </Position7> + <Position8> + <Filename Value="uos.pas"/> + <Caret Line="4264" Column="90" TopLine="4245"/> + </Position8> + <Position9> + <Filename Value="uos.pas"/> + <Caret Line="3087" Column="2" TopLine="3069"/> + </Position9> + <Position10> + <Filename Value="main_wfvrt.pas"/> + </Position10> + <Position11> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="442" Column="3" TopLine="431"/> + </Position11> + <Position12> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="58" Column="15" TopLine="49"/> + </Position12> + <Position13> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="298" Column="20" TopLine="283"/> + </Position13> + <Position14> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="58" Column="32" TopLine="49"/> + </Position14> + <Position15> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="182" Column="5" TopLine="175"/> + </Position15> + <Position16> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="228" Column="67" TopLine="213"/> + </Position16> + <Position17> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="223" TopLine="215"/> + </Position17> + <Position18> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="228" Column="18" TopLine="228"/> + </Position18> + <Position19> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="164" Column="3" TopLine="161"/> + </Position19> + <Position20> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="235" Column="3" TopLine="231"/> + </Position20> + <Position21> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="266" Column="26" TopLine="252"/> + </Position21> + <Position22> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="267" Column="26" TopLine="253"/> + </Position22> + <Position23> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="269" Column="26" TopLine="255"/> + </Position23> + <Position24> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="365" Column="120" TopLine="363"/> + </Position24> + <Position25> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="440" Column="72" TopLine="433"/> + </Position25> + <Position26> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="454" Column="44" TopLine="446"/> + </Position26> + <Position27> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="183" Column="46" TopLine="168"/> + </Position27> + <Position28> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="184" Column="46" TopLine="169"/> + </Position28> + <Position29> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="365" Column="3" TopLine="363"/> + </Position29> + <Position30> + <Filename Value="main_wfvrt.pas"/> + <Caret Line="370" Column="9" TopLine="363"/> + </Position30> + </JumpHistory> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="wavevrtform"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <SmallerCode Value="True"/> + </CodeGeneration> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf3"/> + <StripSymbols Value="True"/> + <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> diff --git a/UOS/examples/wavevrtform.lpr b/UOS/examples/wavevrtform.lpr new file mode 100644 index 0000000..911780c --- /dev/null +++ b/UOS/examples/wavevrtform.lpr @@ -0,0 +1,22 @@ +program wavevrtform; + +{$mode objfpc}{$H+} + {$DEFINE UseCThreads} + +uses + {$IFDEF UNIX} {$IFDEF UseCThreads} + cthreads, + cwstring, {$ENDIF} {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, + main_wfvrt { you can add units after this }; + + +begin + Application.Title := 'WaveForm'; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + + diff --git a/UOS/license.txt b/UOS/license.txt new file mode 100644 index 0000000..0848dbf --- /dev/null +++ b/UOS/license.txt @@ -0,0 +1,470 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent modules, +and to copy and distribute the resulting executable under terms of your choice, +provided that you also meet, for each linked independent module, the terms +and conditions of the license of that module. An independent module is a +module which is not derived from or based on this library. If you modify this +library, you may extend this exception to your version of the library, but +you are not obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/UOS/log.txt b/UOS/log.txt new file mode 100644 index 0000000..eb59186 --- /dev/null +++ b/UOS/log.txt @@ -0,0 +1,62 @@ +{********************************************************************************** +* United Openlibraries of Sound ( uos ) * +* -------------------------------------- * +* * +* United procedures to access Open Sound (IN/OUT) libraries * +* * +* With Big contributions of (in alphabetic order) * +* Andrew, BigChimp, Blaazen, Franklyn, KpjComp, Leledumbo, Phoenix, Sandro. * +* * +* Fred van Stappen / fiens@hotmail.com * +* * +* * +*********************************************************************************** +* 1 th changes: 2012-07-20 (First shot) * +* 2 th changes: 2012-07-31 (Mono thread, only one stream) * +* 3 th changes: 2012-11-13 (Mono thread, multi streams) * +* 4 th changes: 2012-11-14 (Multi threads, multi streams) * +* 5 th changes: 2012-11-27 (Event pause, position, volume, reverse) * +* 6 th changes: 2012-12-31 (Class/Oop look, DSP, multi IN/OUT) * +* 7 th changes: 2013-01-12 (Float resolution for all, new DSP proc) * +* 8 th changes: 2013-01-21 (Record, Direct Wire, Save to file, new DSP proc) * +* 9 th changes: 2013-01-28 (FFT, Filters HighPass, LowPass, BandSelect, * +* BandReject, BandPass) * +* 10 th changes: 2013-02-02 (Dibo's time methods, Max Karpushin * +* reference counting in PortAudio) * +* 11 th changes: 2013-05-03 (Fully FP/fpGUI/Lazarus compatible) * +* 12 th changes: 2014-10-01 (Added GetLevel(...) ) * +* 13 th changes: 2014-02-01 (Added Plugin + Dynamic Buffer => uos version 1.0) * +* 14 th changes: 2014-03-01 (String=>PChar, GetSampleRate, => uos version 1.2) * +* 15 th changes: 2014-03-16 (uos_flat + uos => uos version 1.3) * +* 16 th changes: 2014-06-16 (Java uos library compatible) * +* 17 th changes: 2015-03-15 (FreeBSD and MSEgui compatible) * +* 18 th changes: 2015-03-20 (Andrew's Audio Internet Streaming) * +* 19 th changes: 2016-01-31 (Stereo to BinAural (bs2b) plugin + new LoadLib() * +* 20 th changes: 2016-02-21 (Andrew's Noise Removal DSP) * +* 21 th changes: 2016-02-26 (Franklyn A. Harlow : AAC (m4a) and CD audio) * +* 22 th changes: 2016-10-24 (First shot of Synthesizer input) * +* 23 th changes: 2017-01-20 (Opus and OpusFile libraries wrappers included) * +* 24 th changes: 2017-02-02 (Opus web streaming) * +* 25 th changes: 2017-02-20 (First steps IceCast+Shout server web streaming) * +* 26 th changes: 2017-02-20 (AddFromFileIntoMemory() input from file into memory) * +* 27 th changes: 2017-03-02 (AddFromMemoryBuffer() input from memory buffer) * +* 28 th changes: 2017-03-09 (Phoenix's AddFromMemoryStream() from MemoryStream) * +* 29 th changes: 2017-04-16 (Main thread.execute splitted into sub-methods) * +* 30 th changes: 2017-07-19 (Martin MSE environement, uos_Player is a class now) * +* 31 th changes: 2017-11-26 (Added GetBPM from last commit of SoundTouch plugin) * +* 32 th changes: 2018-02-06 (Added InputFiltersGetLevel and spectrum features) * +* 33 th changes: 2020-11-10 (Synthesizer uses LookupTable, thanks to Blaazen.) * +* 34 th changes: 2020-12-25 (Aarch64-Linux compatible, updated all examples) * +* 35 th changes: 2020-12-30 (uos_AddIntoFile() can encode in ogg format) * +* 36 th changes: 2021-20-16 (Synth waves sine, triangle, square and sawtooth) * +* 37 th changes: 2022-03-16 (Added missing Album and Track tag) * * +* 38 th changes: 2022-03-20 (Methods inlined) * +* 39 th changes: 2023-12-27 (Added uos_UpdateDevice(). Sample rate is float) * +* 40 th changes: 2024-04-22 (Changed all round() with roundmath()) * +* 41 th changes: 2024-06-16 (Added OpenBSD compatibility and libraries) * +* 42 th changes: 2024-08-15 (Webstreamning for https too.) * +* 43 th changes: 2024-08-24 (Fixed memory leak in uos_AddFromURL()) * +* 44 th changes: 2024-09-15 (Added libxmp to read mod, it, s3m, xm and others) * +* 45 th changes: 2024-09-29 (Added libfdk-aac to do websteam of aac files) * +* * +***********************************************************************************} diff --git a/UOS/modifiedLGPL.txt b/UOS/modifiedLGPL.txt new file mode 100644 index 0000000..fb2d17a --- /dev/null +++ b/UOS/modifiedLGPL.txt @@ -0,0 +1,24 @@ +This is the file modifiedLGPL, it applies to all uos sources +distributed by members of the uos Development Team. +All files contains headers showing the appropriate license. + +These files are distributed under the GNU Library Public License +(see the file licence.txt) with the following modification: + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent modules, +and to copy and distribute the resulting executable under terms of your choice, +provided that you also meet, for each linked independent module, the terms +and conditions of the license of that module. An independent module is a +module which is not derived from or based on this library. If you modify this +library, you may extend this exception to your version of the library, but +you are not obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + +If you didn't receive a copy of the file COPYING.txt, contact: + Free Software Foundation, Inc., + 675 Mass Ave + Cambridge, MA 02139 + USA + diff --git a/UOS/readme.md b/UOS/readme.md new file mode 100644 index 0000000..82fc65f --- /dev/null +++ b/UOS/readme.md @@ -0,0 +1,39 @@ +![uos2](https://user-images.githubusercontent.com/3421249/71642778-1fa59400-2cb1-11ea-953b-06658f3b986d.png) + +# uos : United OpenLib of Sound. + + +uos unifies the best open-source audio libraries. + +For fpc, fpGUI, MSEgui and LCL. + +With uos you can: + +. Listen to mp3, ogg, wav, flac, m4a, aac, opus, mod, it, s3m, xm, cda, ... audio files. + +. Deal with 16, 32 integer or float 32 bit resolution. + +. Do internet audio streaming of mp3, opus and aac files. + +. Record all types of input into wav or ogg file with 16 or 32 bit resolution. + +. Add DSP effects and filters, however many you want and record it. + +. Listen to multiple input and output. + +. Produce sound from built-in synthesizer. + +uos can use: PortAudio, SndFile, Mpg123, Faad, Mp4ff, Opus, OpusFile, Libxmp, fdk-aac +audio libraries and SoundTouch, Bs2b audio-effect libraries. + +Included in the package: + +. Examples fpGUI, MSEgui, LCL and console. + +. Binaries of libraries included for Linux, arm32-aarch64 Rapsberry Pi, Windows, Mac OSX, OpenBSD and FreeBSD. + +See you at uos forum: http://uos-forum.108.s1.nabble.com + + +Fred van Stappen fiens@hotmail.com + diff --git a/UOS/readme_examples.txt b/UOS/readme_examples.txt new file mode 100644 index 0000000..2c68793 --- /dev/null +++ b/UOS/readme_examples.txt @@ -0,0 +1,25 @@ +All examples are using uos_flat. + +uos_flat is a over-layer for uos that takes care about class declarations. +You do not have to declare anything in your main application. +All methods have a "universal procedurial" syntax. + +If you prefer to use uos directly, SimplePlayer_noflat shows how to do. +This way all methods can be used as oop. (java flavour). + + +Warning: to play Opus files, you should: + +For Windows: +copy /uos/examples/lib/Windows/32bit/libopus-0.dll +and paste into your windows/system directory. + +For Linux/FreeBSD: +copy /uos/examples/lib/Linux-or-FreeBSD/64it/libopus.so +and paste into /usr/local/lib directory + +Fre;D + + + + diff --git a/UOS/src/laz_uos.lpk b/UOS/src/laz_uos.lpk new file mode 100644 index 0000000..6cb1a01 --- /dev/null +++ b/UOS/src/laz_uos.lpk @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <Package Version="5"> + <PathDelim Value="\"/> + <Name Value="laz_uos"/> + <Author Value="Fred van Stappen"/> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <SearchPaths> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Description Value="uos : United OpenLib of Sound. +uos unifies the best open-source audio libraries. +For fpc, fpGUI, MSEgui and LCL. +With uos you can: + Listen to mp3, ogg, wav, flac, m4a, opus, cda ... audio files. + Deal with 16, 32 integer or float 32 bit resolution. + Do internet audio streaming. + Record all types of input into wav file with 16 or 32 bit resolution. + Add DSP effects and filters, however many you want and record it. + Listen to multiple input and output. + Produce sound from built-in synthesizer. +uos can use: +PortAudio, SndFile, Mpg123, Faad, Mp4ff, Opus, OpusFile audio libraries and +SoundTouch, Bs2b audio-effect libraries. + +Included in the package: + Examples fpGUI, MSEgui, LCL and console. + Binaries of libraries for Linux, arm-Rapsberry Pi, Windows, Mac osX, FreeBSD."/> + <License Value="GNU Library or "Lesser" General Public License (LGPL)"/> + <Version Major="1"/> + <CompatibilityMode Value="True"/> + <RequiredPkgs Count="1"> + <Item1> + <PackageName Value="FCL"/> + </Item1> + </RequiredPkgs> + <UsageOptions> + <UnitPath Value="$(PkgOutDir)"/> + </UsageOptions> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + </Package> +</CONFIG> diff --git a/UOS/src/laz_uos.pas b/UOS/src/laz_uos.pas new file mode 100644 index 0000000..df3d517 --- /dev/null +++ b/UOS/src/laz_uos.pas @@ -0,0 +1,12 @@ +{ This file was automatically created by Lazarus. Do not edit! + This source is only used to compile and install the package. + } + +unit laz_uos; + +{$warn 5023 off : no warning about unused units} +interface + +implementation + +end. diff --git a/UOS/src/lib/x86_64-win64/laz_uos.compiled b/UOS/src/lib/x86_64-win64/laz_uos.compiled new file mode 100644 index 0000000..ee4879b --- /dev/null +++ b/UOS/src/lib/x86_64-win64/laz_uos.compiled @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <Lazarus Version="4.0"/> + <Compiler Value="C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe" Date="1520657216"/> + <Params Value="-MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -FuC:\Users\indrajith\Documents\projects\package-search\package-zerch\UOS\src\ -FuC:\lazarus\packager\units\x86_64-win64 -FUC:\Users\indrajith\Documents\projects\package-search\package-zerch\UOS\src\lib\x86_64-win64\ laz_uos.pas"/> +</CONFIG> diff --git a/UOS/src/lib/x86_64-win64/laz_uos.ppu b/UOS/src/lib/x86_64-win64/laz_uos.ppu new file mode 100644 index 0000000..73b0da1 Binary files /dev/null and b/UOS/src/lib/x86_64-win64/laz_uos.ppu differ diff --git a/UOS/src/uos.pas b/UOS/src/uos.pas new file mode 100644 index 0000000..369fe3e --- /dev/null +++ b/UOS/src/uos.pas @@ -0,0 +1,12754 @@ + + +{This unit is part of United Openlibraries of Sound (uos) + This is the main uos unit. + License : modified LGPL.3 + Fred van Stappen fiens@hotmail.com } + +unit uos; + +{$mode objfpc}{$H+}{$inline on} +{$PACKRECORDS C} + +// For custom configuration of directive to compiler ---> uos_define.inc +{$I uos_define.inc} + +interface + +uses + +{$IF DEFINED(mse)} +msegui, msethread, +{$endif} + +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} +fpg_base, fpg_main, +{$endif} + +{$IF DEFINED(Java)} +uos_jni, +{$endif} + +{$IF DEFINED(webstream)} +uos_httpgetthread, Pipes, +{$ENDIF} + +{$IF DEFINED(portaudio)} +uos_portaudio, +{$endif} + +{$IF DEFINED(xmp)} +uos_libxmp, +{$endif} + +{$IF DEFINED(sndfile)} +uos_LibSndFile, +{$endif} + +{$IF DEFINED(mpg123)} +uos_Mpg123, +{$endif} + +{$IF DEFINED(soundtouch)} +uos_soundtouch, +{$endif} + +{$IF DEFINED(bs2b)} +uos_bs2b, +{$endif} + +{$IF DEFINED(noiseremoval)} +uos_dsp_noiseremoval, +{$endif} + +{$IF DEFINED(neaac)} +uos_aac, +{$endif} + +{$IF DEFINED(fdkaac)} +uos_fdkaacdecoder, +{$endif} + +{$IF DEFINED(opus)} +uos_opusfile, +{$endif} + +{$IF DEFINED(shout)} +uos_shout, uos_opus, +{$endif} + +{$IF DEFINED(cdrom)} +uos_cdrom, +{$endif} + +Classes, DynLibs, ctypes, Math, sysutils; + +const + uos_version : cint32 = 2241001; + +{$IF DEFINED(bs2b)} + BS2B_HIGH_CLEVEL = (CInt32(700)) or ((CInt32(30)) shl 16); + BS2B_MIDDLE_CLEVEL = (CInt32(500)) or ((CInt32(45)) shl 16); + BS2B_LOW_CLEVEL = (CInt32(360)) or ((CInt32(60)) shl 16); + { Easy crossfeed levels (Obsolete) } + BS2B_HIGH_ECLEVEL = (CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_MIDDLE_ECLEVEL = (CInt32(500)) or ((CInt32(72)) shl 16); + BS2B_LOW_ECLEVEL = (CInt32(360)) or ((CInt32(84)) shl 16); + BS2B_DEFAULT_CLEVEL = (CInt32(700)) or ((CInt32(45)) shl 16); + BS2B_CMOY_CLEVEL = (CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_JMEIER_CLEVEL = (CInt32(650)) or ((CInt32(95)) shl 16); +{$endif} + +{$IF DEFINED(synthesizer)} +const + // musical note ==> frequency in hertz + // Latin: Do, Ré, Mi, Fa, Sol, La, Si + // Dièse = _d example la0_d + la0 = 55.0; + la0_d = 58.3; + si0 = 61.7; + do0 = 65.4; + do0_d = 69.3; + re0 = 73.4; + re0_d = 77.8; + mi0 = 82.4; + fa0 = 87.3; + fa0_d = 92.5; + sol0 = 98.0; + sol0_d = 103.8; + la1 = 110.0; + la1_d = 116.5; + si1 = 123.5; + do1 = 130.8; + do1_d = 138.6; + re1 = 146.8; + re1_d = 155.6; + mi1 = 164.8; + fa1 = 174.6; + fa1_d = 185.0; + sol1 = 196.0; + sol1_d = 207.7; + la2 = 220.0; + la2_d = 233.1; + si2 = 2246.9; + do2 = 261.6; + do2_d = 277.2; + re2 = 293.7; + re2_d = 311.1; + mi2 = 329.6; + fa2 = 349.2; + fa2_d = 370.0; + sol2 = 392.0; + sol2_d = 415.3; + la3 = 440.0; + la3_d = 466.2; + si3 = 493.9; + do3 = 523.3; + do3_d = 554.4; + re3 = 587.3; + re3_d = 622.3; + mi3 = 659.3; + fa3 = 698.5; + fa3_d = 740.0; + sol3 = 784.0; + sol3_d = 830.6; + la4 = 880.0; + la4_d = 932.4; + si4 = 987.8; + do4 = 1046.6; + do4_d = 1108.8; + re4 = 1174.6; + re4_d = 1244.6; + mi4 = 1318.6; + fa4 = 1397.0; + fa4_d = 1480.0; + sol4 = 1568.0; + sol4_d = 1661.2; + la5 = 1760.0; + + // English musique note + // A, B, C, D, E, F, G + a0 = 55.0; + a0_s = 58.3; + b0 = 61.7; + c0 = 65.4; + c0_s = 69.3; + d0 = 73.4; + d0_s = 77.8; + e0 = 82.4; + f0 = 87.3; + f0_s = 92.5; + g0 = 98.0; + g0_s = 103.8; + a1 = 110.0; + a1_s = 116.5; + b1 = 123.5; + c1 = 130.8; + c1_s = 138.6; + d1 = 146.8; + d1_s = 155.6; + e1 = 164.8; + f1 = 174.6; + f1_s = 185.0; + g1 = 196.0; + g1_s = 207.7; + a2 = 220.0; + a2_s = 233.1; + b2 = 2246.9; + c2 = 261.6; + c2_s = 277.2; + d2 = 293.7; + d2_s = 311.1; + e2 = 329.6; + f2 = 349.2; + f2_s = 370.0; + g2 = 392.0; + g2_s = 415.3; + a3 = 440.0; + a3_s = 466.2; + b3 = 493.9; + c3 = 523.3; + c3_s = 554.4; + d3 = 587.3; + d3_s = 622.3; + e3 = 659.3; + f3 = 698.5; + f3_s = 740.0; + g3 = 784.0; + g3_s = 830.6; + a4 = 880.0; + a4_s = 932.4; + b4 = 987.8; + c4 = 1046.6; + c4_s = 1108.8; + d4 = 1174.6; + d4_s = 1244.6; + e4 = 1318.6; + f4 = 1397.0; + f4_s = 1480.0; + g4 = 1568.0; + g4_s = 1661.2; + a5 = 1760.0; +{$endif} + +{$IF DEFINED(shout)} + cFRAME_SIZE = 960; + cSAMPLE_RATE = 48000; + cAPPLICATION = OPUS_APPLICATION_AUDIO; + cBITRATE = 64000; + cMAX_FRAME_SIZE = 6 * 960; + cMAX_PACKET_SIZE = 3 * 1276; +{$endif} + +type + TDummyThread = class(TThread) + protected + procedure execute; + override; + end; + +{$IF DEFINED(mse)} +{$else} + +type + TuosThread = class(TThread) + protected + procedure execute; + override; + public + theparent : Tobject; + + constructor Create(CreateSuspended: boolean; AParent: TObject; + Const StackSize: SizeUInt = DefaultStackSize); + overload; + virtual; + procedure DoTerminate; + override; + end; +{$endif} + +type + TDArFloat = array of cfloat; + TDArShort = array of cInt16; + TDArLong = array of cInt32; + + TDArPARFloat = array of TDArFloat; + TDArIARFloat = array of TDArPARFloat; + + PDArFloat = ^TDArFloat; + PDArShort = ^TDArShort; + PDArLong = ^TDArLong; + + {$IF not DEFINED(windows)} + THandle = pointer; + TArray = single; +{$endif} + +type + Tuos_BufferInfos = record + SampleRate: CDouble; + SampleRateRoot: CDouble; + SampleFormat: cint32; + Channels: cint32; + Filename: UTF8String; + Title: UTF8String; + Copyright: UTF8String; + Software: UTF8String; + Artist: UTF8String; + Comment: UTF8String; + Date: string; + Tag: array[0..2] of char; + Album: UTF8String; + Genre: string; + Track: string; + HDFormat: cint32; + Sections: cint32; + Encoding: cint32; + bitrate: cint32; + Length: cint32; + // length samples total + LibOpen: shortint; + Ratio: byte; + end; + +type +{$if not defined(fs32bit)} + Tcount_t = cint64; { used for file sizes } +{$else} + Tcount_t = cint32; +{$endif} + +type + Tuos_LoadResult = record + PAloadError: shortint; + SFloadError: shortint; + MPloadError: shortint; + PCloadError: shortint; + STloadError: shortint; + BSloadError: shortint; + AAloadError: shortint; + OPloadError: shortint; + XMloadError: shortint; + FAloadError: shortint; + PAinitError: shortint; + MPinitError: shortint; + end; + +type + Tuos_Init = class(TObject) + public + evGlobalPause: PRTLEvent; + // for global pausing + + constructor Create; + private + + PA_FileName: pchar; + // PortAudio + SF_FileName: pchar; + // SndFile + MP_FileName: pchar; + // Mpg123 + AA_FileName : PChar; + // Faad + M4_FileName : PChar; + // Mp4ff + OF_FileName : PChar; + // opusfile + XM_FileName : PChar; + // XMP + FA_FileName : PChar; + // Fdkaac + Plug_ST_FileName: pchar; + // Plugin SoundTouch + GetBMP + Plug_BS_FileName: pchar; + // Plugin bs2b + +{$IF DEFINED(portaudio)} + DefDevOut: PaDeviceIndex; + DefDevOutInfo: PPaDeviceInfo; + DefDevOutAPIInfo: PPaHostApiInfo; + DefDevIn: PaDeviceIndex; + DefDevInInfo: PPaDeviceInfo; + DefDevInAPIInfo: PPaHostApiInfo; +{$endif} + + function loadlib: cint32; + procedure unloadlib; + procedure unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: boolean); + function InitLib: cint32; + procedure unloadPlugin(PluginName: Pchar); + end; + +type + Tuos_DeviceInfos = record + DeviceNum: cint32; + DeviceName: UTF8String; + DeviceType: UTF8String; + DefaultDevIn: boolean; + DefaultDevOut: boolean; + ChannelsIn: cint32; + ChannelsOut: cint32; + SampleRate: CDouble; + LatencyHighIn: CDouble; + LatencyLowIn: CDouble; + LatencyHighOut: CDouble; + LatencyLowOut: CDouble; + HostAPIName: UTF8String; + end; + +type + Tuos_WaveHeaderChunk = packed record + wFormatTag: smallint; + wChannels: word; + wSamplesPerSec: cint32; + wAvgBytesPerSec: cint32; + wBlockAlign: word; + wBitsPerSample: word; + wcbSize: word; + end; + +type + Tuos_FileBuffer = record + ERROR: word; + wSamplesPerSec: cint32; + wBitsPerSample: word; + wChannels: word; + FileFormat: shortint; + Data: TFileStream; + DataMS: TMemoryStream; + end; + +type + Tuos_Data = record + // Global data + Enabled: boolean; + + TypePut: shortint; + // -1 : nothing. + // for Input : 0: from audio encoded file, 1: from input device (like mic), + // 2: from internet audio stream, 3: from Synthesizer, 4: from memory buffer, + // 5: from endless-muted, 6: from decoded memorystream + + // for Output : 0: into wav file from filestream, 1: into output device Portaudio, 2: into stream server, + // 3: into memory buffer, 4: into wav file from memorystream, 5: into memorystream, + // 6: into ogg file from filestream, 7: into ogg memorystream + + Seekable: boolean; + Status: byte; + Buffer: TDArFloat; + MemoryBuffer: TDArFloat; + MemoryStream : Tmemorystream; + + posmem : longint; + + {$IF DEFINED(opus)} + BufferTMP: tbytes; + {$endif} + + DSPVolumeIndex : cint32; + DSPNoiseIndex : cint32; + VLeft, VRight: double; + hasfilters : boolean; + nbfilters : cint32; + incfilters : cint32; + levelfilters : string; + levelfiltersar : TDArFloat; + PositionEnable : shortint; + LevelEnable : shortint; + LevelLeft, LevelRight: cfloat; + levelArrayEnable : shortint; + +{$IF DEFINED(synthesizer)} + LookupTableLeft, LookupTableRight: array [0..1023] of CFloat; + PosInTableLeft, PosInTableRight: Double; + typLsine, typRsine: cint32; + freqLsine, freqRsine: cfloat; + dursine, posdursine: cint32; + harmonic: cint32; + evenharm: shortint; +{$endif} + +{$if defined(cpu64)} + Wantframes: Tcount_t; + OutFrames: Tcount_t; +{$else} + Wantframes: cint32; + OutFrames: cint32; +{$endif} + + SamplerateRoot: CDouble; + SampleRate: CDouble; + SampleFormat: cint32; + Channels: cint32; + lastbuf: shortint; + + // audio file data + HandleSt: pointer; + {$IF DEFINED(opus)} + HandleOP: TOpusFile; + {$endif} + Filename: UTF8String; + Title: UTF8String; + Copyright: UTF8String; + Software: UTF8String; + Artist: UTF8String; + Comment: UTF8String; + Date: string; + Tag: array[0..2] of char; + Album: UTF8String; + Genre: string; + Track: string; + HDFormat: cint32; + {$IF DEFINED(sndfile)} + Frames: Tcount_t; + {$else} + Frames: cint32; + {$endif} + Sections: cint32; + Encoding: cint32; + bitrate: cint32; + Length: cint32; + // length samples total + LibOpen: shortint; + // -1: nothing open, 0: sndfile open, 1: mpg123 open, 2: aac open, 3: cdrom, 4: opus, 5: xmp + Ratio: byte; + // if mpg123 or aac then ratio := 2 + + BPM : cfloat; + numbuf : integer; + Output: cint32; + + {$if defined(cpu64)} + // TO CHECK + Position: cint32; + Poseek: cint32; + {$else} + Position: cint32; + Poseek: cint32; + {$endif} + + end; + +type + TArray01 = array[0..1] of cfloat; + + Tuos_FFT = class(TObject) + public + + TypeFilterL, TypeFilterR: byte; + LowFrequencyL, HighFrequencyL: cfloat; + LowFrequencyR, HighFrequencyR: cfloat; + GainL, GainR: cfloat; + + // Left + a3, a32: array[0..2] of cfloat; + b2, x0, x1, y0, y1, b22, x02, x12, y02, y12: TArray01; + C, D, C2, D2 : cfloat; + + // Right + a3R, a32R: array[0..2] of cfloat; + b2R, x0R, x1R, y0R, y1R, b22R, x02R, x12R, y02R, y12R: TArray01; + CR, DR, C2R, D2R : cfloat; + + AlsoBuf: boolean; + VirtualBuffer: TDArFloat; + levelstring : string; + + {$IF DEFINED(noiseremoval)} + FNoise : TuosNoiseRemoval; + {$endif} + + constructor Create; + end; + +type + TFunc = function (Var Data: Tuos_Data; Var FFT: Tuos_FFT): TDArFloat; + + {$if DEFINED(java)} + TProc = JMethodID ; + {$else} + TProc = procedure of object; + {$endif} + + TProcOnly = procedure ; + + {$IF DEFINED(bs2b) or DEFINED(soundtouch)} + TPlugFunc = function (bufferin: TDArFloat; plugHandle: THandle; Abs2bd : Tt_bs2bdp; Var inputData: + Tuos_Data; + param1: float; param2: float; param3: float; param4: float; + param5: float; param6: float; param7: float; param8: float): TDArFloat; + {$endif} + +type + Tuos_DSP = class(TObject) + public + Enabled: boolean; + BefFunc: TFunc; + // function to execute before buffer is filled + AftFunc: TFunc; + // function to execute after buffer is filled + EndFunc: TFunc; + // function to execute at end of thread; + LoopProc: TProc; + // External Procedure of object to synchronize after buffer is filled + + // for FFT + fftdata: Tuos_FFT; + + {$IF DEFINED(Java)} + procedure LoopProcjava; + {$endif} + + constructor Create; + + destructor Destroy; + override; + + end; + +type + Tuos_InStream = class(TObject) + {$IF DEFINED(webstream)} + private + procedure UpdateIcyMetaInterval; + {$endif} + public + Data: Tuos_Data; + DSP: array of Tuos_DSP; + + MemoryStreamDec : TMemoryStream; + + {$IF DEFINED(neaac)} + AACI: TAACInfo; + {$endif} + + {$IF DEFINED(cdrom)} + pCD: PCDROMInfo; + {$endif} + + // for web streaming + {$IF DEFINED(webstream)} + httpget: TThreadHttpGetter; + // threaded http getter + {$IF DEFINED(windows)} + {$if defined(cpu64)} + InHandle : Qword; + OutHandle: Qword; + {$else} + InHandle : longword; + OutHandle: longword; + {$ENDIF} + {$else} + InHandle : cint32; + OutHandle: cint32; + {$endif} + InPipe: TInputPipeStream; + OutPipe: TOutputPipeStream; + {$ENDIF} + {$IF DEFINED(portaudio)} + PAParam: PaStreamParameters; + {$endif} + LoopProc: TProc; + // External Procedure of object to synchronize after buffer is filled + + {$IF DEFINED(Java)} + procedure LoopProcjava; + {$endif} + + constructor Create; + + destructor Destroy; + override; + end; + +type + Tuos_OutStream = class(TObject) + public + Data: Tuos_Data; + BufferOut: PDArFloat; + MemorySteamOut: TMemoryStream; + DSP: array of Tuos_DSP; + {$IF DEFINED(portaudio)} + PAParam: PaStreamParameters; + {$endif} + {$IF DEFINED(shout)} + encoder: TOpusEncoder; + cbits: array [0..cMAX_PACKET_SIZE - 1] of Byte; + // cbits: tbytes; + {$endif} + FileBuffer: Tuos_FileBuffer; + LoopProc: TProc; + // External Procedure of object to synchronize after buffer is filled + {$IF DEFINED(Java)} + procedure LoopProcjava; + {$endif} + + constructor Create; + + destructor Destroy; + override; + end; + + Tuos_Plugin = class(TObject) + public + Enabled: boolean; + Name: string; + PlugHandle: THandle; + + {$IF DEFINED(bs2b) or DEFINED(soundtouch)} + Abs2b : Tt_bs2bdp; + PlugFunc: TPlugFunc; + {$endif} + param1: float; + param2: float; + param3: float; + param4: float; + param5: float; + param6: float; + param7: float; + param8: float; + Buffer: TDArFloat; + + constructor Create; + end; + +type + Tuos_Player = class(tobject) + protected + {$IF DEFINED(mse)} + thethread : tmsethread; + {$else} + thethread : TuosThread; + {$endif} + evPause: PRTLEvent; + // for pausing + procedure ReadFile(x : integer); + inline; + {$IF DEFINED(webstream)} + procedure ReadUrl(x : integer); + inline; + {$endif} + {$IF DEFINED(synthesizer)} + procedure ReadSynth(x : integer); + inline; + procedure FillLookupTable(x, typewave, channel, + AHarmonics: Integer; EvenHarmonics: shortint); + inline; + {$endif} + procedure ReadEndless(x : integer); + inline; + procedure ReadMem(x : integer); + inline; + procedure ReadMemDec(x : integer); + inline; + {$IF DEFINED(portaudio)} + procedure ReadDevice(x : integer); + inline; + {$endif} + procedure WriteOutPlug(x:integer; x2 : integer); + inline; + procedure WriteOut(x:integer; x2 : integer); + inline; + procedure CheckIfPaused ; + inline; + procedure DoBeginMethods; + inline; + procedure DoLoopBeginMethods; + inline; + procedure DoLoopEndMethods; + inline; + procedure DoArrayLevel(x: integer); + inline; + procedure DoSeek(x: integer); + inline; + procedure DoDSPinBeforeBufProc(x: integer); + inline; + procedure DoDSPinAfterBufProc(x: integer); + inline; + procedure DoDSPOutAfterBufProc(x: integer); + inline; + procedure DoMainLoopProc(x: integer); + inline; + procedure SeekIfTerminated; + inline; + procedure DoTerminateNoFreePlayer; + inline; + procedure DoTerminatePlayer; + inline; + procedure DoEndProc; + inline; + + {$IF DEFINED(mse)} + function execute(thread: tmsethread): integer; + inline; + {$endif} + + public + isAssigned: boolean ; + isGlobalPause: boolean ; + Status: cint32; + + //if use -1 value (default) -> not alterate uosPlayers[],.. + Index: cint32; + + intobuf : boolean; + // to check, needed for filetobuf + + NLooped : Integer; + // -1 infinite loop; 0 no loop; > 0 n-loop + + NoFree : boolean; + // Do not free the player at end of thread. + + BeginProc: TProc ; + // External procedure of object to execute at begin of thread + + LoopBeginProc: TProc; + // External procedure of object to execute at each begin of loop + + LoopEndProc: TProc; + // External procedure of object to execute at each end of loop + + EndProc: TProc; + // Procedure of object to execute at end of thread + + EndProcOnly: TProcOnly ; + // Procedure to execute at end of thread (not of object) + + StreamIn: array of Tuos_InStream; + StreamOut: array of Tuos_OutStream; + PlugIn: array of Tuos_Plugin; + + {$IF DEFINED(Java)} + PEnv : PJNIEnv; + Obj: JObject; + procedure beginprocjava; + procedure endprocjava; + procedure LoopBeginProcjava; + procedure LoopEndProcjava; + {$endif} + + constructor create(); + + destructor Destroy; + override; + + function IsLooped: Boolean; + + function SetGlobalEvent(isenabled : boolean) : boolean; + +// Set the RTL Events Global (will pause/start/replay all the players synchro with same rtl event)) + // result : true if set ok. + + // Audio methods + + procedure PlayEx(no_free: Boolean; nloop: Integer; paused: boolean= false); + // Start playing with free at end as parameter and assign loop + + procedure Play(nloop: Integer = 0) ; + // Start playing with loop + + procedure PlayPaused(nloop: Integer = 0) ; + // Start play paused with loop + + procedure RePlay(); + // Resume playing after pause + + procedure Stop(); + // Stop playing and free thread + + procedure Pause(); + // Pause playing + + procedure PlayNoFree(nloop: Integer = 0) ; + // Starting but do not free the player after stop with loop + + procedure PlayNoFreePaused(nloop: Integer = 0) ; + // Start play paused with loop but not free player at end + + procedure FreePlayer() ; + // Free the player: works only when PlayNoFree() was called. + + {$IF DEFINED(portaudio)} + function AddIntoDevOut(Device: cint32; Latency: CDouble; + SampleRate: CDouble; Channels: cint32; SampleFormat: cint32 ; + FramesCount: cint32 ; ChunkCount: cint32 ): cint32; + // 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 (= 65536) + // ChunkCount : default : -1 (= 512) + // result : Output Index in array -1 = error + // example : OutputIndex1 := AddIntoDevOut(-1,-1,-1,-1,0,-1,-1); +{$endif} + + function AddIntoFile(Filenamepath: PChar; SampleRate: CDouble; + Channels: cint32; SampleFormat: cint32 ; FramesCount: cint32 ; FileFormat + : cint32): cint32; + // Add a Output into audio wav file with custom parameters from TFileStream + // FileName : filename of saved audio wav file + // SampleRate : delault : -1 (44100) + // Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + // SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) + // FramesCount : default : -1 (= 4096) + // FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg); + // result : Output Index in array -1 = error + // example : OutputIndex1 := AddIntoFile(edit5.Text,-1,-1, 0, -1, -1); + + function AddIntoFileFromMem(Filenamepath: PChar; SampleRate: CDouble; + Channels: LongInt; SampleFormat: LongInt ; FramesCount: LongInt; + FileFormat: cint32): LongInt; + // Add a Output into audio wav file with custom parameters from TMemoryStream + // FileName : filename of saved audio wav file + // SampleRate : delault : -1 (44100) + // Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + // SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) + // FramesCount : default : -1 (= 4096) + // FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom); + // result : Output Index in array -1 = error + // example : OutputIndex1 := AddIntoFileFromBuf(edit5.Text,-1,-1, 0, -1); + + function AddIntoMemoryBuffer(outmemory: PDArFloat) : cint32; + // Add a Output into memory buffer + // outmemory : pointer of buffer to use to store memory. + // example : OutputIndex1 := AddIntoMemoryBuffer(bufmemory); + + function AddIntoMemoryBuffer(outmemory: PDArFloat; SampleRate: CDouble; SampleFormat: + LongInt; + Channels: LongInt; FramesCount: LongInt): LongInt; + // Add a Output into TMemoryStream + // outmemory : pointer of buffer to use to store memory. + // SampleRate : delault : -1 (44100) + // SampleFormat : default : -1 (0:float32) ( 1:Int32, 2:Int16) + // Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + // FramesCount : default : -1 (= 65536) + + function AddIntoMemoryStream(Var MemoryStream: TMemoryStream; SampleRate: CDouble; + SampleFormat: LongInt ; Channels: LongInt; FramesCount: LongInt; + AudioFormat: cint32): LongInt; + // Add a Output into TMemoryStream + // MemoryStream : the TMemoryStream to use to store memory. + // SampleRate : delault : -1 (44100) + // SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) + // Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + // FramesCount : default : -1 (= 4096) + // AudioFormat : default : -1 (wav) (0:wav, 1:ogg); + + {$IF DEFINED(shout)} + function AddIntoIceServer(SampleRate : CDouble; Channels: cint; SampleFormat: cint; + EncodeType: cint; Port: cint; Host: pchar; User: pchar; Password: + pchar; MountFile :pchar): cint32; + // Add a Output into a IceCast server for audio-web-streaming + // SampleRate : delault : -1 (48000) + // Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) + // SampleFormat : -1 default : float32 : (0:float32, 1:Int16) + // EncodeType : default : -1 (0:Music) (0: Music, 1:Voice) + // Port : default : -1 (= 8000) + // Host : default : 'def' (= '127.0.0.1') + // User : default : 'def' (= 'source') + // Password : default : 'def' (= 'hackme') + // MountFile : default : 'def' (= '/example.opus') + // result : Output Index in array -1 = error + {$endif} + +{$IF DEFINED(portaudio)} + function AddFromDevIn(Device: cint32; Latency: CDouble; + SampleRate: CDouble; OutputIndex: cint32; + SampleFormat: cint32; FramesCount : cint32 ; ChunkCount: cint32): cint32 + ; + + // Add a Input from Device Input with custom parameters + // Device ( -1 is default Input device ) + // Latency ( -1 is latency suggested ) ) + // SampleRate : delault : -1 (44100) + +// 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) + // ChunkCount : default : -1 (= 512) + // result : otherwise Output Index in array -1 = error + // example : OutputIndex1 := AddFromDevice(-1,-1,-1,-1,-1, -1); +{$endif} + + function AddFromEndlessMuted(Channels : cint32; FramesCount: cint32): cint32; + // Add a input from Endless Muted dummy sine wav + // FramesCount = FramesCount of input-to-follow + // Channels = Channels of input-to-follow. + + function InputGetBuffer(InputIndex: cint32): TDArFloat; + // Get current buffer + +{$IF DEFINED(synthesizer)} + function AddFromSynth(Channels: integer; WaveTypeL, WaveTypeR: shortint; + FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; + duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32; + OutputIndex: cint32; SampleFormat: cint32 ; SampleRate: CDouble ; + 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, 2= triangle, 3=sawtooth used for mono and stereo) + +// WaveTypeR: default: -1 (0) (0 = sine-wave, 1 = square-wave, 2= triangle, , 3=sawtooth 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 + + procedure InputSetSynth(InputIndex: cint32; WaveTypeL, WaveTypeR: shortint; + 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, 2= triangle, 3=sawtooth used for mono and stereo) + +// WaveTypeR: do not change: -1 (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth 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 ; +{$endif} + + function AddFromFile(Filename: Pchar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32): cint32; + // Add a input from audio file with custom parameters + // FileName : filename of audio file + +// 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 := AddFromFile(edit5.Text,-1,0,-1); + + function AddFromFileIntoMemory(Filename: Pchar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ; numbuf : cint): + cint32 + ; + // Add a input from audio file and store it into memory with custom parameters + // FileName : filename of audio file + +// 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) + +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) + // result : Input Index in array -1 = error + // example : InputIndex1 := AddFromFileIntoMemory(edit5.Text,-1,0,-1, -1); + + function AddFromMemoryBuffer(Var MemoryBuffer: TDArFloat; Var Bufferinfos: Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; + // Add a input from memory buffer with custom parameters + // MemoryBuffer : the buffer + // Bufferinfos : infos of the buffer + +// 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 ';')// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)// SampleRate : delault : -1 (44100)// FramesCount : default : -1 (4096) + // FramesCount : default : -1 (65536 div Channels) + // result : Input Index in array -1 = error + // example : InputIndex1 := AddFromMemoryBuffer(mybuffer, buffinfos,-1,1024); + + function AddFromMemoryStream(Var MemoryStream: TMemoryStream; + TypeAudio: cint32; OutputIndex: cint32; SampleFormat: cint32 ; + FramesCount: cint32): cint32; + // 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 := AddFromMemoryStream(mymemorystream,-1,-1,0,1024); + + function AddFromMemoryStreamDec(Var MemoryStream: TMemoryStream; Var Bufferinfos: + Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; + // MemoryStream : Memory-stream of decoded audio (like created by AddIntoMemoryStream) + // Bufferinfos : infos of the Memory-stream + +// 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 ';') + // FramesCount : default : -1 (4096) + // result : Input Index in array -1 = error + +{$IF DEFINED(webstream)} + function AddFromURL(URL: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ; AudioFormat: cint32 ; ICYon: + boolean): cint32; + // Add a Input from Audio URL + // URL : URL of audio file + +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output + // SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) + // FramesCount : default : -1 (4096) + // AudioFormat : default : -1 (mp3) (0: mp3, 1: opus) + // ICYon : ICY data on/off + // example : InputIndex := AddFromURL('http://someserver/somesound.mp3',-1,-1,-1,-1,false); +{$ENDIF} + + function AddPlugin(PlugName: Pchar; SampleRate: CDouble; + Channels: cint32): cint32; + // Add a plugin , result is PluginIndex + // SampleRate : delault : -1 (44100) + // Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) + // 'soundtouch' 'getbpm' and 'bs2b' PlugName are registred. + +{$IF DEFINED(soundtouch)} + procedure SetPluginSoundTouch(PluginIndex: cint32; Tempo: cfloat; + Pitch: cfloat; Enable: boolean); + // PluginIndex : PluginIndex Index of a existing Plugin. + + procedure SetPluginGetBPM(PluginIndex: cint32; numofframes: integer; loop : boolean; + Enable: boolean); + // PluginIndex : PluginIndex Index of a existing Plugin. + // numofframes: number of frames to analyse (-1 = 512 x frames) + // loop: do new detection after previous. +{$endif} + +{$IF DEFINED(bs2b)} + procedure SetPluginBs2b(PluginIndex: cint32; level: CInt32; fcut: CInt32; + feed: CInt32; Enable: boolean); + // PluginIndex : PluginIndex Index of a existing Plugin. +{$endif} + + function GetStatus() : cint32 ; + // Get the status of the player : 0 => has stopped, 1 => is running, 2 => is paused, + // -1 => error or not yet played, only created. + + procedure InputSeek(InputIndex: cint32; pos: Tcount_t); + // change position in sample + + procedure InputSeekSeconds(InputIndex: cint32; pos: cfloat); + // change position in seconds + + procedure InputSeekTime(InputIndex: cint32; pos: TTime); + // change position in time format + + procedure InputSetEnable(InputIndex: cint32; enabled: boolean); + // set enable true or false + + function InputLength(InputIndex: cint32): cint32; + inline; + // InputIndex : InputIndex of existing input + // result : Length of Input in samples + + function InputLengthSeconds(InputIndex: cint32): cfloat; + inline; + // InputIndex : InputIndex of existing input + // result : Length of Input in seconds + + function InputLengthTime(InputIndex: cint32): TTime; + inline; + // InputIndex : InputIndex of existing input + // result : Length of Input in time format + + function InputPosition(InputIndex: cint32): cint32; + inline; + // InputIndex : InputIndex of existing input + // result : current postion in sample + + function InputPositionSeconds(InputIndex: cint32): float; + inline; + // InputIndex : InputIndex of existing input + // result : current postion of Input in seconds + + function InputPositionTime(InputIndex: cint32): TTime; + inline; + // InputIndex : InputIndex of existing input + // result : current postion of Input in time format + + procedure InputSetFrameCount(InputIndex: cint32 ; framecount : cint32); + inline; + // set number of frames to be done. (usefull for recording and level precision) + + procedure InputSetLevelEnable(InputIndex: cint32 ; levelcalc : cint32); + // set level calculation (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + // 3 => calcul before and after all DSP procedures. + + procedure InputSetPositionEnable(InputIndex: cint32 ; poscalc : cint32); + // set position calculation (default is 0) + // 0 => no calcul + // 1 => calcul of position. + + procedure InputSetLevelArrayEnable(InputIndex: cint32 ; levelcalc : cint32); + // set add level calculation in level-array (default is 0) + // 0 => no calcul + // 1 => calcul before all DSP procedures. + // 2 => calcul after all DSP procedures. + + function InputGetLevelLeft(InputIndex: cint32): double; + inline; + // InputIndex : InputIndex of existing input + // result : left level from 0 to 1 + + function InputGetLevelRight(InputIndex: cint32): double; + inline; + // InputIndex : InputIndex of existing input + // result : right level from 0 to 1 + + function InputFiltersGetLevelString(InputIndex: cint32): string; + inline; + // InputIndex : InputIndex of existing input + // filterIndex : Filterindex of existing filter + // result : list of left|right levels separed by $ character + + function InputFiltersGetLevelArray(InputIndex: cint32): TDArFloat; + inline; + // InputIndex : InputIndex of existing input + // result : array of float of each filter. + //in format levelfilter0left,levelfilter0right,levelfilter1left,levelfilter2right,... + +{$IF DEFINED(soundtouch)} + function InputGetBPM(InputIndex: cint32): CDouble; + inline; + // InputIndex : InputIndex of existing input + // result : left level from 0 to 1 +{$endif} + + function InputUpdateTag(InputIndex: cint32): boolean; + inline; + +{$IF DEFINED(webstream) and DEFINED(mpg123)} + function InputUpdateICY(InputIndex: cint32; Var icy_data : pchar): integer; + inline; +{$endif} + + function InputGetTagTitle(InputIndex: cint32): pchar; + inline; + function InputGetTagArtist(InputIndex: cint32): pchar; + inline; + function InputGetTagAlbum(InputIndex: cint32): pchar; + inline; + function InputGetTagDate(InputIndex: cint32): pchar; + inline; + function InputGetTagComment(InputIndex: cint32): pchar; + inline; + function InputGetTagTrack(InputIndex: cint32): pchar; + inline; + function InputGetTagGenre(InputIndex: cint32): pchar; + inline; + function InputGetTagTag(InputIndex: cint32): pchar; + inline; + // Tag infos + + function InputAddDSP(InputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; LoopProc: TProc ): cint32; + // add a DSP procedure for input + // InputIndex d: Input Index of a existing input + // BeforeFunc : function to do before the buffer is filled + // AfterFunc : function to do after the buffer is filled + // EndedFunc : function to do after thread is finish + // LoopProc : external procedure of object to synchronize after the buffer is filled + // result : index of DSPin in array (DSPinIndex) + // example : DSPinIndex1 := InputAddDSP(InputIndex1,@beforereverse,@afterreverse,nil); + + procedure InputSetDSP(InputIndex: cint32; DSPinIndex: cint32; Enable: boolean); + // InputIndex : Input Index of a existing input + // DSPIndexIn : DSP Index of a existing DSP In + // Enable : DSP enabled + // example : InputSetDSP(InputIndex1,DSPinIndex1,True); + + procedure OutputSetEnable(OutputIndex: cint32; enabled: boolean); + // set enable true or false + + function OutputAddDSP(OutputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; LoopProc: TProc): cint32; + // usefull if multi output + // OutputIndex : OutputIndex of a existing Output + // BeforeFunc : function to do before the buffer is filled + // AfterFunc : function to do after the buffer is filled just before to give to output + // EndedFunc : function to do after thread is finish + // LoopProc : external procedure of object to synchronize after the buffer is filled + // result : index of DSPout in array + // example :DSPoutIndex1 := OutputAddDSP(OutputIndex1,@volumeproc,nil,nil); + + procedure OutPutSetDSP(OutputIndex: cint32; DSPoutIndex: cint32; Enable: boolean); + // OutputIndex : OutputIndex of a existing Output + // DSPoutIndex : DSPoutIndex of existing DSPout + // Enable : DSP enabled + // example : OutPutSetDSP(OutputIndex1,DSPoutIndex1,True); + + function InputAddFilter(InputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; + // 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 ) + // LoopProc : external procedure of object to synchronize after DSP done + // result : index of DSPIn in array + + procedure InputSetFilter(InputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); + // 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 + + function OutputAddFilter(OutputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; + // Output : InputIndex of a existing Output + // 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 + // result : index of DSPIn in array + + procedure OutputSetFilter(OutputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); + // OuputIndex : InputIndex of a existing Output + // 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 + + function DSPLevel(Data: Tuos_Data): Tuos_Data; + inline; + // to get level of buffer (volume) + + function InputAddDSP1ChanTo2Chan(InputIndex: cint32): cint32; + // Convert mono 1 channel input to stereo 2 channels input. + // Works only if the input is mono 1 channel othewise stereo 2 chan is keeped. + // InputIndex : InputIndex of a existing Input + // result : index of DSPIn in array + // example DSPIndex1 := InputAddDSP1ChanTo2Chan(InputIndex1); + + function InputAddDSPVolume(InputIndex: cint32; VolLeft: double; + VolRight: double): cint32; + // DSP Volume changer + // InputIndex : InputIndex of a existing Input + // VolLeft : Left volume + // VolRight : Right volume + // result : index of DSPIn in array + // example DSPIndex1 := InputAddDSPVolume(InputIndex1,1,1); + + function OutputAddDSPVolume(OutputIndex: cint32; VolLeft: double; + VolRight: double): cint32; + // DSP Volume changer + // OutputIndex : OutputIndex of a existing Output + // VolLeft : Left volume + // VolRight : Right volume + // result : otherwise index of DSPIn in array + // example DSPIndex1 := OutputAddDSPVolume(InputIndex1,1,1); + +{$IF DEFINED(noiseremoval)} + function InputAddDSPNoiseRemoval(InputIndex: cint32): cint32; + // DSP Noise Removal + // InputIndex : InputIndex of a existing Input + // result : otherwise index of DSPIn in array + // example DSPIndex1 := InputAddDSPNoiseRemoval(InputIndex1); + + procedure InputSetDSPNoiseRemoval(InputIndex: cint32; Enable: boolean); + + function OutputAddDSPNoiseRemoval(OutputIndex: cint32): cint32; + // DSP Noise Removal + // InputIndex : OutputIndex of a existing Output + // result : otherwise index of DSPOut in array + // example DSPIndex1 := OutputAddDSPNoiseRemoval(OutputIndex1); + + procedure OutputSetDSPNoiseRemoval(OutputIndex: cint32; Enable: boolean); +{$endif} + + procedure InputSetDSPVolume(InputIndex: cint32; DSPVolIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); + inline; + // InputIndex : InputIndex of a existing Input + // DSPIndex : DSPIndex of a existing DSP + // VolLeft : Left volume + // VolRight : Right volume + // Enable : Enabled + // example InputSetDSPVolume(InputIndex1,DSPIndex1,1,0.8,True); + + procedure OutputSetDSPVolume(OutputIndex: cint32; DSPVolIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); + inline; + // OutputIndex : OutputIndex of a existing Output + // DSPIndex : DSPIndex of a existing DSP + // VolLeft : Left volume + // VolRight : Right volume + // Enable : Enabled + // example OutputSetDSPVolume(InputIndex1,DSPIndex1,1,0.8,True); + + end; + + // General public procedure/function (accessible for library uos too) + +function uos_GetInfoLibraries() : Pansichar ; + + {$IF DEFINED(portaudio)} + +procedure uos_UpdateDevice(); + +procedure uos_GetInfoDevice(); + +function uos_GetInfoDeviceStr() : Pansichar ; + {$endif} + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName, fdkaacFilename : PChar) : cint32; +// load libraries... if libraryfilename = '' => do not load it... You may load what and when you want... +// PortAudio => needed for dealing with audio-device +// SndFile => needed for dealing with ogg, vorbis, flac and wav audio-files +// Mpg123 => needed for dealing with mp* audio-files +// Mp4ff and Faad => needed for dealing with acc, m4a audio-files +// opusfile => needed for dealing with opus audio-files +// XMP => needed for dealing with MOD audio-files +// Fdkaac => needed for webstreaming of aac files. + +// If you want to load libraries from system, replace it by "'system'" +// If some libraries are not needed, replace it by "nil", + +// for example : uos_loadlib('system', SndFileFileName, 'system', nil, nil, nil, OpusFileFileName, nil, nil) + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName : PChar) : cint32; +// The same but without fdkaac. (for compatibility with previous version) + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName : PChar) : cint32; +// The same but without libxmp and fdkaac. (for compatibility with previous version) + +procedure uos_unloadlib(); +// Unload all libraries... Do not forget to call it before close application... + +{$IF DEFINED(shout)} +function uos_LoadServerLib(ShoutFileName, OpusFileName : PChar) : cint32; +// Shout => needed for dealing with IceCast server +// Opus => needed for dealing with encoding opus stream + +procedure uos_unloadServerLib(); +// Unload server libraries... Do not forget to call it before close application... +{$endif} + +procedure uos_unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: boolean); +// Custom Unload libraries... if true, then unload the library. You may unload what and when you want... + +function uos_loadPlugin(PluginName, PluginFilename: PChar) : cint32; +// load plugin... + +{$IF DEFINED(soundtouch)} +function uos_GetBPM(TheBuffer: TDArFloat; Channels: cint32; SampleRate: CDouble) : CDouble; +inline; +// From SoundTouch plugin +{$endif} + +procedure uos_unloadPlugin(PluginName: PChar); +// Unload Plugin... + +procedure uos_Free(); +// To call at end of application. +// If uos_flat.pas was used, it will free all the uos_player created. + +function uos_GetVersion() : cint32 ; +inline; +// version of uos + +function uos_File2Buffer(Filename: Pchar; SampleFormat: cint32 ; Var bufferinfos: Tuos_BufferInfos ; + frompos : cint; numbuf : cint ): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) + + +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max of frames) +// result : The memory buffer +// example : buffmem := uos_File2buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + +function uos_Stream2Buffer(AudioFile: TMemoryStream; SampleFormat: int32 ; Var outmemory: TDArFloat; + Var bufferinfos: Tuos_BufferInfos ; frompos : cint; numbuf : cint): + TDArFloat +; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) + +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) +// result : The memory buffer +// example : buffmem := uos__Stream2Buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + +procedure uos_File2File(FilenameIN: Pchar; FilenameOUT: Pchar; SampleFormat: cint32 ; typeout: + cint32 ); +// Create a audio file from a audio file. +// FileNameIN : filename of audio file IN (ogg, flac, wav, mp3, opus, aac,...) +// FileNameOUT : filename of audio file OUT (wav, pcm, custom) +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// typeout : Type of out file (-1:default=wav, 0:wav, 1:pcm, 2:custom) +// example : InputIndex1 := uos_File2File(edit5.Text,0,buffmem); + +procedure uos_MemStream2Wavfile(FileName: UTF8String; Data: TMemoryStream; BitsPerSample, chan: + integer; + samplerate : CDouble); +// Create a audio wav file from a TMemoryStream. +// FileName : filename of wav saved file +// data : the memorystream +// BitsPerSample : 16 or 32 (bit) +// chan : number of channels +// samplerate : sample rate + +function CvInt16ToFloat32(Inbuf: TDArFloat): TDArFloat; +inline; +// convert buffer int16 into float32. + +procedure uos_CustBufferInfos(Var bufferinfos: Tuos_BufferInfos; SampleRate: CDouble; SampleFormat + : cint32; Channels: cint32 ; Length: cint32); +inline; +// to initialize a custom bufferinfos: needed for AddFromMemoryBuffer() if no bufferinfos was created. +// all infos refer to the buffer used ---> length = length of the buffer div channels. + +function uos_TestLoadLibrary(Filename: Pchar): boolean; inline; +// test a library to check if it can be loaded; + + +const + // error + noError = 0; + FilePAError = 10; + LoadPAError = 11; + FileSFError = 20; + LoadSFError = 21; + FileMPError = 30; + LoadMPError = 31; + LoadOPError = 41; + FileOPError = 50; + // uos Audio + Stereo = 2; + Mono = 1; + + {$IF DEFINED(android)} + DefRate = 48000; + {$else} + DefRate = 44100; + {$endif} + + // Write wav file + ReadError = 1; + HeaderError = 2; + DataError = 3; + FileCorrupt = 4; + IncorectFileFormat = 5; + HeaderWriteError = 6; + StreamError = 7; + // FFT Filters + fBandAll = 0; + fBandSelect = 1; + fBandReject = 2; + fBandPass = 3; + fLowPass = 4; + fHighPass = 5; + + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + MSG_CUSTOM1 = FPGM_USER + 1; + {$endif} + +var + theinc : integer = 0; + theincbpm : integer = 0; + tempload : boolean = false; + paversion : UTF8String = ''; + sfversion : UTF8String = ''; + mpversion : UTF8String = ''; + tempSamplerate : CDouble; + tempSampleFormat, tempchan, tempratio, tempLibOpen, tempLength : cint32; + tempoutmemory: TDArFloat; + uosPlayers: array of Tuos_Player; + uosPlayersStat : array of cint32; + uosLevelArray : TDArIARFloat ; + uosDeviceInfos: array of Tuos_DeviceInfos; + uosLoadResult: Tuos_LoadResult; + uosDeviceCount: cint32 = 0; + uosDefaultDeviceIn: cint32 = -1; + uosDefaultDeviceOut: cint32 = -1; + uosInit: Tuos_Init = nil; + uosisactif : boolean = true; + + {$IF DEFINED(windows)} + old8087cw: word; + {$endif} + + {$IF DEFINED(Java)} + theclass : JClass; + {$endif} + +implementation + +function uos_TestLoadLibrary(Filename: Pchar): boolean; +// test a library to check if it can be loaded; +var +test_Handle: TLibHandle = NilHandle; +begin + result := false; + test_Handle := DynLibs.SafeLoadLibrary(Filename); + if test_Handle <> DynLibs.NilHandle then + begin + DynLibs.UnloadLibrary(test_Handle); + test_Handle := DynLibs.NilHandle; + result := true; + end; +end; + +procedure TDummyThread.Execute; +begin + FreeOnTerminate := True; + Terminate; +end; + +function RoundMath(aV:double): int64; +overload; +begin + if aV>=0 then + result := Trunc(aV+0.5) + else + result := Trunc(aV-0.5); +end; + +function RoundMath(aV:single): int64; +overload; +begin + if aV>=0 then + result := Trunc(aV+0.5) + else + result := Trunc(aV-0.5); +end; + +function FormatBuf(Inbuf: TDArFloat; format: cint32): TDArFloat; +inline; +var + x: cint32; + ps: PDArShort; + // if input is Int16 format + pl: PDArLong; + // if input is Int32 format + pf: PDArFloat; + // if input is Float32 format +begin + + case format of + 2: + begin + ps := @inbuf; + for x := 0 to high(inbuf) do + ps^[x] := cint16(trunc(ps^[x])); + end; + 1: + begin + pl := @inbuf; + for x := 0 to high(inbuf) do + pl^[x] := cint32(trunc(pl^[x])); + end; + 0: + begin + pf := @inbuf; + for x := 0 to high(inbuf) do + pf^[x] := cfloat(pf^[x]); + end; + end; + Result := Inbuf; +end; + +function CvFloat32ToInt16(Inbuf: TDArFloat): TDArShort; +inline; +var + x, i: cint32; + arsh: TDArShort; +begin + SetLength(arsh, length(inbuf)); + for x := 0 to high(Inbuf) do + begin + i := trunc(Inbuf[x] * 32768); + if i > 32767 then + i := 32767 + else + if i < -32768 then + i := -32768; + arsh[x] := i; + end; + Result := arsh; +end; + +function CvFloat32ToInt32(Inbuf: TDArFloat): TDArLong; +inline; +var + i: int64; + x : cint32; + arlo: TDArLong; +begin + SetLength(arlo, length(inbuf)); + for x := 0 to high(Inbuf) do + begin + i := trunc(Inbuf[x] * 2147483647); + if i > 2147483647 then + i := 2147483647 + else + if i < -2147483648 then + i := -2147483648; + arlo[x] := i; + end; + Result := arlo; +end; + +function CvFloat32ToInt32fl(Inbuf: TDArFloat; nb:integer): TDArFloat; +inline; +var + x : cint32; + pl2: PDArLong; + // if input is Int32 format + pf: PDArfloat; + buffer2 : TDArFloat; + +begin + pf := @Inbuf; + pl2 := @Buffer2; + + setlength(buffer2,nb); + + for x := 0 to nb -1 do + begin + pl2^[x] := trunc((pf^[x]) * 2147483647); + end; + Result := buffer2; +end; + +function CvInt16ToFloat32(Inbuf: TDArFloat): TDArFloat; +inline; +var + x: cint32; + arfl: TDArFloat; + ps: PDArShort; +begin + setlength(arfl,length(Inbuf)); + ps := @inbuf; + for x := 0 to high(Inbuf) do + arfl[x] := ps^[x] / 32768; + Result := arfl; +end; + +function CvSteroToMono(Inbuf: TDArFloat; len : cint32): TDArFloat; +inline; +var + x, y: cint32; + arsh: TDArFloat; +begin + + if len > 0 then + begin + setlength(arsh, len); + + x := 0; + y := 0; + + while x < (len * 2)-1 do + begin + + + // TODO -> this takes only chan1, not (chan1+chan2)/2 -> it get bad noise dont know why ???... + // arsh[y] := trunc((Inbuf[x] + Inbuf[x+1])/ 2) ; + + arsh[y] := Inbuf[x+1] ; + + inc(y); + x := x + 2 ; + end; + + Result := arsh; + end + else Result := Inbuf; +end; + +function CvInt32ToFloat32(Inbuf: TDArFloat): TDArFloat; +inline; +var + x: cint32; + arfl: TDArFloat; + pl: PDArLong; +begin + setlength(arfl,length(Inbuf)); + pl := @inbuf; + for x := 0 to high(Inbuf) do + arfl[x] := pl^[x] / 2147483647; + Result := arfl; +end; + +// convert a Tmemory stream into a wav file. +procedure uos_MemStream2Wavfile(FileName: UTF8String; Data: TMemoryStream; BitsPerSample, chan: + integer; + samplerate : CDouble); +var + f: TFileStream; + wFileSize: LongInt; + wChunkSize: LongInt; + ID: array[0..3] of char; + Header: Tuos_WaveHeaderChunk; +begin + f := Nil; + f := TFileStream.Create(FileName, fmCreate); + f.Seek(0, soFromBeginning); + try + ID := 'RIFF'; + f.WriteBuffer(ID, 4); + wFileSize := 0; + f.WriteBuffer(wFileSize, 4); + ID := 'WAVE'; + f.WriteBuffer(ID, 4); + ID := 'fmt '; + f.WriteBuffer(ID, 4); + wChunkSize := SizeOf(Header); + f.WriteBuffer(wChunkSize, 4); + Header.wFormatTag := 1; + + Header.wChannels := chan; + + Header.wSamplesPerSec := roundmath(samplerate); + + Header.wBitsPerSample := BitsPerSample; + + Header.wBlockAlign := chan * (BitsPerSample Div 8); + + Header.wAvgBytesPerSec := roundmath(samplerate) * Header.wBlockAlign; + + Header.wcbSize := 0; + f.WriteBuffer(Header, SizeOf(Header)); + except + +end; +try + ID := 'data'; + f.WriteBuffer(ID, 4); + wChunkSize := Data.Size; + f.WriteBuffer(wChunkSize, 4); +except +end; + +Data.Seek(0, soFromBeginning); +f.CopyFrom(Data, Data.Size); +f.Seek(SizeOf(ID), soFromBeginning); +wFileSize := f.Size - SizeOf(ID) - SizeOf(wFileSize); +f.write(wFileSize, 4); +f.Free; +end; + +function WriteWaveFromMem(FileName: UTF8String; Data: Tuos_FileBuffer): word; +var + f: TFileStream; + wFileSize: LongInt; + wChunkSize: LongInt; + ID: array[0..3] of char; + Header: Tuos_WaveHeaderChunk; +begin + Result := noError; + f := Nil; + f := TFileStream.Create(FileName, fmCreate); + f.Seek(0, soFromBeginning); + if Data.FileFormat = 0 then + begin + // wav file + try + ID := 'RIFF'; + f.WriteBuffer(ID, 4); + wFileSize := 0; + f.WriteBuffer(wFileSize, 4); + ID := 'WAVE'; + f.WriteBuffer(ID, 4); + ID := 'fmt '; + f.WriteBuffer(ID, 4); + wChunkSize := SizeOf(Header); + f.WriteBuffer(wChunkSize, 4); + Header.wFormatTag := 1; + + Header.wChannels := Data.wChannels; + + Header.wSamplesPerSec := Data.wSamplesPerSec; + + Header.wBlockAlign := Data.wChannels * (Data.wBitsPerSample Div 8); + + Header.wAvgBytesPerSec := Data.wSamplesPerSec * Header.wBlockAlign; + Header.wBitsPerSample := Data.wBitsPerSample; + Header.wcbSize := 0; + f.WriteBuffer(Header, SizeOf(Header)); + except + Result := HeaderWriteError; + end; + try + ID := 'data'; + f.WriteBuffer(ID, 4); + wChunkSize := Data.DataMS.Size; + f.WriteBuffer(wChunkSize, 4); + except + Result := StreamError; +end; + +end; + +Data.DataMS.Seek(0, soFromBeginning); +f.CopyFrom(Data.DataMS, Data.DataMS.Size); +f.Seek(SizeOf(ID), soFromBeginning); +wFileSize := f.Size - SizeOf(ID) - SizeOf(wFileSize); +f.write(wFileSize, 4); +f.Free; +end; + + +procedure WriteWave(FileName: UTF8String; Data: Tuos_FileBuffer); +var + wFileSize: cint32; + ID: array[0..3] of char; +begin + Data.data.Position := 42; + //(after 'data') + Data.data.write(Data.data.Size, 4); + ID := 'RIFF'; + Data.data.Seek(SizeOf(ID), soFromBeginning); + wFileSize := Data.data.Size - SizeOf(ID) - SizeOf(wFileSize); + Data.data.write(wFileSize, 4); + Data.data.Free; +end; + +{$IF DEFINED(sndfile) or DEFINED(mpg123)} +function mpg_read_stream(ahandle: Pointer; AData: Pointer; ACount: Integer): Integer; +inline; +cdecl; +var + Stream: TStream absolute ahandle; +begin + Result := Stream.Read(AData^, ACount); +end; + +function mpg_seek_stream(ahandle: Pointer; offset: Integer; + whence: Integer): Integer; +cdecl; +var + Stream: TStream absolute ahandle; +begin + try + case whence of + SEEK_SET : Result := Stream.Seek(offset, soFromBeginning); + SEEK_CUR : Result := Stream.Seek(offset, soFromCurrent); + SEEK_END : Result := Stream.Seek(offset, soFromEnd); + else + Result := 0; + end; + except + Result := 0; +end; +end; + +procedure mpg_close_stream(ahandle: Pointer); +// not used, uos does it... +begin + TObject(ahandle).Free; +end; +{$endif} + +{$IF DEFINED(webstream)} +// should use this for pipes vs memorystream ? +function mpg_seek_url(ahandle: Pointer; aoffset: Integer): Integer; +cdecl; +var + Stream: TStream absolute ahandle; +begin + // pipe streams are not seekable but memory and filestreams are + Result := 0; + try + if aoffset > 0 then + Result := Stream.Seek(aoffset, soFromCurrent); + except + Result := 0; +end; +end; +{$endif} + +function Filetobuffer(Filename: Pchar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32; Var outmemory: TDArFloat; + Var bufferinfos: Tuos_BufferInfos; frompos: cint; numbuf : cint ): TDArFloat; +// Add a input from audio file with custom parameters +// FileName : filename of audio file + +// 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) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer +// frompos : from position (default : -1 = from begining, otherwise position in song) + +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) +// result : Input Index in array -1 = error +// example : InputIndex1 := Filetobuffer(edit5.Text,-1,0,-1, buffmem, buffinfos, -1); +var + theplayer : Tuos_Player; + in1 : cint32; +begin + theplayer := Tuos_Player.Create(); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('begin Filetobuffer'); + {$endif} + + In1 := theplayer.AddFromFile( pchar(Filename), OutputIndex, SampleFormat, FramesCount) ; + if in1 > -1 then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('in1 = ' + inttostr(in1)); + writeln('theplayer.InputLength(In1) = ' + inttostr(theplayer.InputLength(In1))); + {$endif} + + SetLength(outmemory, 0); + + tempchan := theplayer.StreamIn[in1].Data.Channels; + tempratio := theplayer.StreamIn[in1].Data.ratio; + tempSampleFormat := theplayer.StreamIn[in1].Data.SampleFormat; + tempSamplerate := theplayer.StreamIn[in1].Data.Samplerate; + templength := theplayer.StreamIn[in1].Data.Length; + + bufferinfos.SampleRate := theplayer.StreamIn[in1].Data.Samplerate; + bufferinfos.SampleRateRoot := theplayer.StreamIn[in1].Data.Samplerate; + bufferinfos.SampleFormat := theplayer.StreamIn[in1].Data.SampleFormat; + bufferinfos.Channels := theplayer.StreamIn[in1].Data.Channels; + bufferinfos.Filename := theplayer.StreamIn[in1].Data.Filename; + bufferinfos.Title := theplayer.StreamIn[in1].Data.Title; + bufferinfos.Copyright := theplayer.StreamIn[in1].Data.Copyright; + bufferinfos.Software := theplayer.StreamIn[in1].Data.Software; + bufferinfos.Artist := theplayer.StreamIn[in1].Data.Artist; + bufferinfos.Comment := theplayer.StreamIn[in1].Data.Comment; + bufferinfos.Date := theplayer.StreamIn[in1].Data.Date; + bufferinfos.Tag := theplayer.StreamIn[in1].Data.Tag; + bufferinfos.Album := theplayer.StreamIn[in1].Data.Album; + bufferinfos.Genre := theplayer.StreamIn[in1].Data.Genre; + bufferinfos.Track := theplayer.StreamIn[in1].Data.Track; + bufferinfos.HDFormat := theplayer.StreamIn[in1].Data.HDFormat; + bufferinfos.Sections := theplayer.StreamIn[in1].Data.Sections; + bufferinfos.Encoding := theplayer.StreamIn[in1].Data.Encoding; + bufferinfos.bitrate := theplayer.StreamIn[in1].Data.bitrate; + bufferinfos.Length := theplayer.StreamIn[in1].Data.Length; + bufferinfos.LibOpen := 0; + bufferinfos.Ratio := 2 ; + + theplayer.StreamIn[in1].Data.numbuf := numbuf; + + theplayer.AddIntoMemoryBuffer( @outmemory ); + theplayer.Play(0); + + if frompos > 0 then theplayer.inputseek(in1,frompos); + + while (theplayer.getstatus > 0) do + sleep(100); + + end; + + {$IF DEFINED(mse)} + theplayer.destroy; + {$endif} + result := outmemory; +end; + + {$IF DEFINED(soundtouch)} +function uos_GetBPM(TheBuffer: TDArFloat; Channels: cint32; SampleRate: CDouble) : CDouble; +inline; +// From SoundTouch plugin +var + BPMhandle : THandle; + sr, ch : cint32; +begin + + if SampleRate = -1 then sr := 44100 + else sr := roundmath(SampleRate); + if Channels = -1 then ch := 2 + else ch := Channels; + + BPMhandle := bpm_createInstance(ch,sr); + bpm_putSamples(BPMhandle, pcfloat(thebuffer), length(thebuffer) div Channels); + + result := bpm_getBpm(BPMhandle); + + bpm_destroyInstance(BPMhandle); + +end; + {$endif} + +function uos_File2Buffer(Filename: Pchar; SampleFormat: cint32 ; Var bufferinfos: Tuos_BufferInfos ; + frompos : cint; numbuf : cint ): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) + +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max of frames) +// result : The memory buffer +// example : buffmem := uos_File2buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + {$IF DEFINED(uos_debug) and DEFINED(unix)} +var + i : integer; + st : string; + {$endif} +begin + + result := Filetobuffer(Filename,-1, SampleFormat, 1024, result, bufferinfos, frompos, numbuf); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('After Filetobuffer'); + writeln('length(result) =' +inttostr(length(result))); + st := ''; + for i := 0 to length(result) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(result[i]); + WriteLn('OUTPUT DATA into portaudio------------------------------'); + WriteLn(st); + {$endif} + +end; + +function Streamtobuffer(AudioFile:TMemoryStream; OutputIndex: cint32;SampleFormat: cint32 ; + FramesCount: cint32; + Var outmemory: TDArFloat; Var bufferinfos: Tuos_BufferInfos; frompos: cint; + numbuf : cint): TDArFloat; +// Add a input from audio file with custom parameters +// FileName : filename of audio file + +// 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) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer +// frompos : from position (default : -1 = from begining, otherwise position in song) + +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) +// result : Input Index in array -1 = error +// example : InputIndex1 := streamtobuffer(edit5.Text,-1,0,-1, buffmem, buffinfos, -1); + +var + theplayer : Tuos_Player; + in1 : cint32; + +begin + theplayer := Tuos_Player.Create(); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('begin Filetobuffer'); + {$endif} + + //In1 := theplayer.AddFromFile( pchar(Filename), OutputIndex, SampleFormat, FramesCount) ; + In1 := theplayer.AddFromMemoryStream( AudioFile,-1, OutputIndex, SampleFormat, FramesCount) ; + + if in1 > -1 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('in1 = ' + inttostr(in1)); + writeln('theplayer.InputLength(In1) = ' + inttostr(theplayer.InputLength(In1))); + {$endif} + + SetLength(outmemory, 0); + + tempchan := theplayer.StreamIn[in1].Data.Channels; + tempratio := theplayer.StreamIn[in1].Data.ratio; + tempSampleFormat := theplayer.StreamIn[in1].Data.SampleFormat; + tempSamplerate := theplayer.StreamIn[in1].Data.Samplerate; + templength := theplayer.StreamIn[in1].Data.Length; + + bufferinfos.SampleRate := theplayer.StreamIn[in1].Data.Samplerate; + bufferinfos.SampleRateRoot := theplayer.StreamIn[in1].Data.Samplerate; + bufferinfos.SampleFormat := theplayer.StreamIn[in1].Data.SampleFormat; + bufferinfos.Channels := theplayer.StreamIn[in1].Data.Channels; + bufferinfos.Filename := theplayer.StreamIn[in1].Data.Filename; + bufferinfos.Title := theplayer.StreamIn[in1].Data.Title; + bufferinfos.Copyright := theplayer.StreamIn[in1].Data.Copyright; + bufferinfos.Software := theplayer.StreamIn[in1].Data.Software; + bufferinfos.Artist := theplayer.StreamIn[in1].Data.Artist; + bufferinfos.Comment := theplayer.StreamIn[in1].Data.Comment; + bufferinfos.Date := theplayer.StreamIn[in1].Data.Date; + bufferinfos.Tag := theplayer.StreamIn[in1].Data.Tag; + bufferinfos.Album := theplayer.StreamIn[in1].Data.Album; + bufferinfos.Track := theplayer.StreamIn[in1].Data.Track; + bufferinfos.Genre := theplayer.StreamIn[in1].Data.Genre; + bufferinfos.HDFormat := theplayer.StreamIn[in1].Data.HDFormat; + bufferinfos.Sections := theplayer.StreamIn[in1].Data.Sections; + bufferinfos.Encoding := theplayer.StreamIn[in1].Data.Encoding; + bufferinfos.bitrate := theplayer.StreamIn[in1].Data.bitrate; + bufferinfos.Length := theplayer.StreamIn[in1].Data.Length; + bufferinfos.LibOpen := 0; + bufferinfos.Ratio := 2 ; + + theplayer.StreamIn[in1].Data.numbuf := numbuf; + + theplayer.AddIntoMemoryBuffer( @outmemory ); + theplayer.Play(0); + if frompos > 0 then theplayer.inputseek(in1,frompos); + + while (theplayer.getstatus > 0) do + sleep(100); + + end; + {$IF DEFINED(mse)} + theplayer.destroy; + {$endif} + result := outmemory; +end; + +function uos_Stream2Buffer(AudioFile: TMemoryStream; SampleFormat: int32 ; + Var outmemory: TDArFloat; Var bufferinfos: Tuos_BufferInfos ; frompos: + cint; numbuf : cint): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) + +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) +// result : The memory buffer +// example : buffmem := uos_File2buffer(edit5.Text,0,buffmem, buffinfos, -1); +begin + result := Streamtobuffer(AudioFile,-1, SampleFormat, -1, outmemory, bufferinfos, frompos, numbuf); +end; + +procedure uos_File2File(FilenameIN: Pchar; FilenameOUT: Pchar; SampleFormat: cint32 ; typeout: + cint32 ); +// Create a audio file from a audio file. +// FileNameIN : filename of audio file IN (ogg, flac, wav, mp3, opus, aac,...) +// FileNameOUT : filename of audio file OUT (wav, pcm, custom) +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) + +// typeout : Type of out file (-1:default=wav, 0:wav, 1:pcm, 2:custom)// example : InputIndex1 := uos_File2File(edit5.Text,0,buffmem); +var + theplayer : Tuos_Player; + in1 : cint32; +begin + + theplayer := Tuos_Player.Create(); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('begin File2file'); + {$endif} + In1 := theplayer.AddFromFile( pchar(FilenameIN), -1, SampleFormat, -1) ; + if in1 > -1 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('in1 = ' + inttostr(in1)); + writeln('theplayer.InputLength(In1) = ' + inttostr(theplayer.InputLength(In1))); + {$endif} + + theplayer.AddIntoFile(FilenameOUT, theplayer.StreamIn[0].data.samplerate, + theplayer.StreamIn[0].data.channels, SampleFormat, -1 , typeout); + + theplayer.Play(0); + + while (theplayer.getstatus > 0) do + sleep(100); + end; + {$IF DEFINED(mse)} + theplayer.destroy; + {$endif} +end; + + {$IF DEFINED(mse)} + {$else} + +constructor TuosThread.Create(CreateSuspended: boolean; AParent: TObject; + Const StackSize: SizeUInt); +begin + theparent := AParent; + FreeOnTerminate := true; + inherited Create(CreateSuspended, StackSize); + Priority := tpTimeCritical; +end; + {$endif} + +function Tuos_Player.GetStatus() : cint32 ; + + +// Get the status of the player : -1 => error or not yet played, 0 => has stopped, 1 => is running, 2 => is paused. +begin + result := -1 ; + if (isAssigned = True) then result := Status + else result := -1 ; +end; + +function Tuos_Player.IsLooped: Boolean; +inline; +begin + Result := (NLooped <> 0) And + (NLooped <> 1); +end; + +procedure Tuos_Player.PlayEx(no_free: Boolean; nloop: Integer; paused: boolean= false); +var + x: cint32; +begin + if (isAssigned = True) and (not IsLooped) then + begin + NLooped := nloop; + NoFree := no_free; + + {$IF DEFINED(portaudio)} + for x := 0 to high(StreamOut) do + if StreamOut[x].Data.HandleSt <> nil then + Pa_StartStream(StreamOut[x].Data.HandleSt); + {$endif} + + for x := 0 to high(StreamIn) do + begin + {$IF DEFINED(portaudio)} + if (StreamIn[x].Data.HandleSt <> nil) and (StreamIn[x].Data.TypePut = 1) then + Pa_StartStream(StreamIn[x].Data.HandleSt); + {$endif} + + if (no_free = true) and (StreamIn[x].Data.HandleSt <> nil) + and (StreamIn[x].Data.TypePut = 4) then + StreamIn[x].Data.posmem := 0; + + if (no_free = true) and (StreamIn[x].Data.HandleSt <> nil) + and ((StreamIn[x].Data.TypePut = 0) or (StreamIn[x].Data.TypePut = 4)) then + InputSeek(x, 0); + + StreamIn[x].Data.status := 1 ; + + end; + + Status := 1; + + if isGlobalPause = true then + RTLeventSetEvent(uosInit.evGlobalPause) + else + RTLeventSetEvent(evPause); + + if paused = true then + begin + if isGlobalPause = true then + RTLeventReSetEvent(uosInit.evGlobalPause) + else + RTLeventResetEvent(evPause); + end; + + //protect from multiple instances of thread + if thethread = nil then + begin + {$IF DEFINED(mse)} + thethread := tmsethread.create(@execute); + {$else} + thethread := tuosthread.Create(false,self); + {$endif} + end; + end; +end; + +procedure Tuos_Player.PlayPaused(nloop: Integer = 0) ; +inline; +// Start play paused with loop +begin + PlayEx(False,nloop,true); +end; + +procedure Tuos_Player.PlayNoFreePaused(nloop: Integer = 0) ; +inline; +// Start play paused with loop and not free player at end +begin + PlayEx(true,nloop,true); +end; + +procedure Tuos_Player.Play(nloop: Integer = 0) ; +inline; +begin + PlayEx(False,nloop); +end; + +procedure Tuos_Player.PlayNoFree(nloop: Integer = 0) ; +inline; +begin + PlayEx(True,nloop); +end; + +procedure Tuos_Player.FreePlayer(); +// Works only when PlayNoFree() was used: free the player +begin + if isAssigned then + begin + NLooped := 0; + NoFree := False; + //if it has never been put into play (= there is no thread for free).. + if thethread = nil then + Play(); + Stop; + end; +end; + +procedure Tuos_Player.RePlay(); +// Resume Playing after Pause +begin + if (Status > 0) and (isAssigned = True) and + (not IsLooped) then + begin + Status := 1; + if isGlobalPause = true then + RTLeventSetEvent(uosInit.evGlobalPause) + else + RTLeventSetEvent(evPause); + end; +end; + +procedure Tuos_Player.Stop(); +begin + //writeln(inttostr(Status)); + if (Status <> 0) and (isAssigned = True) then + begin + if status < 0 then playpaused; + NLooped := 0; + if isGlobalPause = true then + RTLeventSetEvent(uosInit.evGlobalPause) + else + RTLeventSetEvent(evPause); + Status := 0; + end; +end; + +procedure Tuos_Player.Pause(); +begin + if (Status > 0) and (isAssigned = True) then + begin + if isGlobalPause = true then + RTLeventReSetEvent(uosInit.evGlobalPause) + else + RTLeventResetEvent(evPause); + Status := 2; + end; +end; + +procedure Tuos_Player.InputSeek(InputIndex:cint32; pos: Tcount_t); +// change position in samples +begin + if (isAssigned = True) then StreamIn[InputIndex].Data.Poseek := pos; +end; + +procedure Tuos_Player.InputSeekSeconds(InputIndex: cint32; pos: cfloat); +// change position in seconds +begin + if (isAssigned = True) then StreamIn[InputIndex].Data.Poseek := + trunc(pos * StreamIn[InputIndex] + .Data.SampleRate); +end; + +procedure Tuos_Player.InputSeekTime(InputIndex: cint32; pos: TTime); +// change position in time format +var + ho, mi, se, ms: word; + possample : cint32; +begin + if (isAssigned = True) then + begin + sysutils.DecodeTime(pos, ho, mi, se, ms); + + possample := trunc(((ho * 3600) + (mi * 60) + se + (ms / 1000)) * + StreamIn[InputIndex].Data.SampleRate); + + StreamIn[InputIndex].Data.Poseek := possample; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('TTime: '+ timetostr(pos)); + WriteLn('SeekTime() : Data.Poseek: '+ inttostr(possample)); + {$endif} + end; +end; + +procedure Tuos_Player.InputSetEnable(InputIndex: cint32; enabled: boolean); +// set enable true or false +begin + StreamIn[InputIndex].data.Enabled := enabled; +end; + +function Tuos_Player.InputLength(InputIndex: cint32): cint32; +// gives length in samples +begin + result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.Length; +end; + +function Tuos_Player.InputLengthSeconds(InputIndex: cint32): cfloat; +begin + result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.Length / StreamIn[InputIndex]. + Data.SampleRate; +end; + +function Tuos_Player.InputLengthTime(InputIndex: cint32): TTime; +var + tmp: cfloat; + h, m, s, ms: word; +begin + Result := sysutils.EncodeTime(0, 0, 0, 0); + if (isAssigned = True) then tmp := InputLengthSeconds(InputIndex); + ms := trunc(frac(tmp) * 1000); + h := trunc(tmp / 3600); + m := trunc(tmp / 60 - h * 60); + s := trunc(tmp - (h * 3600 + m * 60)); + Result := sysutils.EncodeTime(h, m, s, ms); +end; + +function Tuos_Player.InputPosition(InputIndex: cint32): cint32; +// gives current position +begin + Result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.Position; +end; + +procedure Tuos_Player.InputSetFrameCount(InputIndex: cint32 ; framecount : cint32); +begin + if (isAssigned = True) then + + case StreamIn[InputIndex].Data.LibOpen of + 0: + StreamIn[InputIndex].Data.Wantframes := (framecount * StreamIn[InputIndex].Data.Channels) ; + + 1: + StreamIn[InputIndex].Data.Wantframes := (framecount * StreamIn[InputIndex].Data.Channels) + * 2 ; + + 2: + StreamIn[InputIndex].Data.Wantframes := (framecount * StreamIn[InputIndex].Data.Channels) ; + + 3: + StreamIn[InputIndex].Data.Wantframes := (framecount * StreamIn[InputIndex].Data.Channels) ; + + 4: + StreamIn[InputIndex].Data.Wantframes := (framecount * StreamIn[InputIndex].Data.Channels) ; + + end; +end; + +procedure Tuos_Player.InputSetLevelArrayEnable(InputIndex: cint32 ; levelcalc : cint32); +// set add level calculation in level-array (default is 0) +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. +begin + if (isAssigned = True) then + begin + if index + 1 > length(uosLevelArray) then + setlength(uosLevelArray,index + 1) ; + if InputIndex + 1 > length(uosLevelArray[index]) then + setlength(uosLevelArray[index],InputIndex + 1) ; + setlength(uosLevelArray[index][InputIndex],0) ; + StreamIn[InputIndex].Data.levelArrayEnable := levelcalc; + end; +end; + +procedure Tuos_Player.InputSetLevelEnable(InputIndex: cint32 ; levelcalc : cint32); +// set level calculation (default is 0) +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. +// 3 => calcul before and after all DSP procedures. + +begin + if (isAssigned = True) then + StreamIn[InputIndex].Data.levelEnable := levelcalc; +end; + +procedure Tuos_Player.InputSetPositionEnable(InputIndex: cint32 ; poscalc : cint32); +// set position calculation (default is 0) +// 0 => no calcul +// 1 => calcul position procedures. +begin + if (isAssigned = True) then + StreamIn[InputIndex].Data.PositionEnable := poscalc; +end; + +function Tuos_Player.InputGetLevelLeft(InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : left level(volume) from 0 to 1 +begin + Result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.LevelLeft; +end; + +function Tuos_Player.InputGetLevelRight(InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : right level(volume) from 0 to 1 +begin + Result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.LevelRight; +end; + +function Tuos_Player.InputFiltersGetLevelString(InputIndex: cint32): string; +// InputIndex : InputIndex of existing input +// result : list of left|right levels separed by $ character +begin + Result := ''; + if (isAssigned = True) then Result := StreamIn[InputIndex].data.Levelfilters; +end; + +function Tuos_Player.InputFiltersGetLevelArray(InputIndex: cint32): TDArFloat; +// InputIndex : InputIndex of existing input +// result : array of float of each filter. +//in format levelfilter0left,levelfilter0right,levelfilter1left,levelfilter2right,... +begin + if (isAssigned = True) then Result := StreamIn[InputIndex].data.Levelfiltersar; +end; + +{$IF DEFINED(soundtouch)} +function Tuos_Player.InputGetBPM(InputIndex: cint32): CDouble; +// InputIndex : InputIndex of existing input +// result : Beat per minuts +begin + Result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.BPM; +end; +{$endif} + +function Tuos_Player.InputPositionSeconds(InputIndex: cint32): float; +begin + Result := 0; + if (isAssigned = True) then Result := StreamIn[InputIndex].Data.Position / StreamIn[InputIndex]. + Data.SampleRate; +end; + +function Tuos_Player.InputPositionTime(InputIndex: cint32): TTime; +var + tmp: float = 0.0; + h: word = 0; + m: word = 0; + s: word = 0; + ms: word = 0; + +begin + Result := sysutils.EncodeTime(0, 0, 0, 0); + if (isAssigned = True) then + begin + tmp := InputPositionSeconds(InputIndex); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('InputPositionTime(): InputPositionSeconds: '+ floattostr(tmp)); + {$endif} + ms := trunc(frac(tmp) * 1000); + h := trunc(tmp / 3600); + m := trunc(tmp / 60 - h * 60); + s := trunc(tmp - (h * 3600 + m * 60)); + Result := sysutils.EncodeTime(h, m, s, ms); + end; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('EncodeTime(): '+ timetostr(Result)); + {$endif} +end; + +// for mp3 and opus files only +function Tuos_Player.InputUpdateTag(InputIndex: cint32): boolean; + +{$IF DEFINED(mpg123) or DEFINED(opus) } +var + {$endif} + + {$IF DEFINED(mpg123)} + // problems with mpg123 + // mpinfo: Tmpg123_frameinfo; + // mpid3v2: Tmpg123_id3v2; + BufferTag: array[1..128] of char; + F: file; + {$endif} + + {$IF DEFINED(opus)} + s: UTF8String; + j: Integer; + OpusTag: POpusTags; + LComment: PPAnsiChar; + LcommentLength: PInteger; + {$endif} + +begin + + Result := false; + if (isAssigned = True) then + begin + {$IF DEFINED(mpg123)} + if StreamIn[InputIndex].Data.LibOpen = 1 then// mp3 + begin + //mpg123_info(StreamIn[InputIndex].Data.HandleSt, MPinfo); + // custom code for reading ID3Tag ---> problems with mpg123_id3() + + AssignFile(F, StreamIn[InputIndex].Data.Filename); + FileMode := fmOpenRead + fmShareDenyNone; + Reset(F, 1); + Seek(F, FileSize(F) - 128); + BlockRead(F, BufferTag, SizeOf(BufferTag)); + CloseFile(F); + + StreamIn[InputIndex].Data.tag := copy(BufferTag, 1, 3); + StreamIn[InputIndex].Data.title := copy(BufferTag, 4, 30); + StreamIn[InputIndex].Data.artist := copy(BufferTag, 34, 30); + StreamIn[InputIndex].Data.album := copy(BufferTag, 64, 30); + StreamIn[InputIndex].Data.date := copy(BufferTag, 94, 4); + StreamIn[InputIndex].Data.comment := copy(BufferTag, 98, 29); + StreamIn[InputIndex].Data.track := inttostr(ord(BufferTag[127])); + StreamIn[InputIndex].Data.genre := inttostr(ord(BufferTag[128])); + + Result := true; + // ? freeandnil(MPinfo); + end; +{$endif} + +{$IF DEFINED(opus)} + if StreamIn[InputIndex].Data.LibOpen = 4 then// opus + begin + OpusTag := op_tags(StreamIn[InputIndex].Data.HandleOP, Nil); + + if OpusTag<>nil + + then + begin + + if OpusTag^.comments>0 + then + begin + + LComment := OpusTag^.user_comments; + LcommentLength := OpusTag^.comment_lengths; + for j := 0 to OpusTag^.comments - 1 do + begin + SetLength(s, LcommentLength^); + move(Pointer(LComment^)^, Pointer(s)^, LcommentLength^); + + if j = 1 then StreamIn[InputIndex].Data.title := s; + if j = 2 then StreamIn[InputIndex].Data.artist := s; + if j = 3 then StreamIn[InputIndex].Data.album := s; + if j = 4 then StreamIn[InputIndex].Data.date := s; + if j = 5 then StreamIn[InputIndex].Data.comment := s; + if j = 6 then StreamIn[InputIndex].Data.tag := s; + + inc(LComment); + inc(LcommentLength); + end; + result := true; + end; + end; + end; + {$endif} + end; +end; + +{$IF DEFINED(webstream)} +// for mp3 files only +function Tuos_Player.InputUpdateICY(InputIndex: cint32; Var icy_data : pchar): integer; +begin + Result := -1; + if (isAssigned = True) then + begin + if StreamIn[InputIndex].Data.LibOpen = 1 then// mp3 + if assigned(StreamIn[InputIndex].httpget) then + if StreamIn[InputIndex].httpget.ICYenabled = true then + begin + {$IF DEFINED(mpg123)} + Result := mpg123_icy(StreamIn[InputIndex].Data.HandleSt, icy_data); + {$endif} + end; + end; +end; +{$ENDIF} + +function Tuos_Player.InputGetTagTitle(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.title); +end; + +function Tuos_Player.InputGetTagArtist(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.Artist); +end; + +function Tuos_Player.InputGetTagAlbum(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.album); +end; + +function Tuos_Player.InputGetTagComment(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.comment); +end; + +function Tuos_Player.InputGetTagTrack(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.track); +end; + +function Tuos_Player.InputGetTagGenre(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.genre); +end; + +function Tuos_Player.InputGetTagTag(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.tag); +end; + +function Tuos_Player.InputGetTagDate(InputIndex: cint32): pchar; +begin + Result := Nil; + if (isAssigned = True) then Result := pchar(StreamIn[InputIndex].Data.date); +end; + +procedure Tuos_Player.InputSetDSP(InputIndex: cint32; DSPinIndex: cint32; + Enable: boolean); +begin + StreamIn[InputIndex].DSP[DSPinIndex].Enabled := Enable; +end; + +procedure Tuos_Player.OutputSetDSP(OutputIndex: cint32; DSPoutIndex: cint32; + Enable: boolean); +begin + StreamOut[OutputIndex].DSP[DSPoutIndex].Enabled := Enable; +end; + +function Tuos_Player.InputAddDSP(InputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; LoopProc: TProc ): cint32; +begin + SetLength(StreamIn[InputIndex].DSP, Length(StreamIn[InputIndex].DSP) + 1); + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1] := Tuos_DSP.Create(); + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].Enabled := false; + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].BefFunc := BeforeFunc; + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].AftFunc := AfterFunc; + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].EndFunc := EndedFunc; + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].LoopProc := LoopProc; + StreamIn[InputIndex].DSP[Length(StreamIn[InputIndex].DSP) - 1].Enabled := True; + + Result := Length(StreamIn[InputIndex].DSP) - 1; +end; + +procedure Tuos_Player.OutputSetEnable(OutputIndex: cint32; enabled: boolean); +// set enable true or false +begin + StreamOut[OutputIndex].data.Enabled := enabled; +end; + +function Tuos_Player.OutputAddDSP(OutputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; LoopProc: TProc): cint32; +begin + SetLength(StreamOut[OutputIndex].DSP, Length(StreamOut[OutputIndex].DSP) + 1); + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1] := + Tuos_DSP.Create; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].Enabled := false; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].BefFunc := + BeforeFunc; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].AftFunc := + AfterFunc; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].EndFunc := + EndedFunc; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].LoopProc := + LoopProc; + StreamOut[OutputIndex].DSP[Length(StreamOut[OutputIndex].DSP) - 1].Enabled := True; + Result := Length(StreamOut[OutputIndex].DSP) - 1; +end; + +procedure Tuos_Player.InputSetFilter(InputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: + cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: + cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// 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 +// 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 + +begin + if isAssigned = true then + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.AlsoBuf := AlsoBuf; + StreamIn[InputIndex].DSP[FilterIndex].Enabled := Enable; + + if LowFrequencyL = -1 then + LowFrequencyL := StreamIn[InputIndex].DSP[FilterIndex].fftdata.LowFrequencyL; + if LowFrequencyL = -1 then + LowFrequencyL := StreamIn[InputIndex].DSP[FilterIndex].fftdata.HighFrequencyL; + if GainL <> -1 then + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Gainl := cfloat(Gainl); + + if LowFrequencyR = -1 then + LowFrequencyR := StreamIn[InputIndex].DSP[FilterIndex].fftdata.LowFrequencyR; + if LowFrequencyR = -1 then + LowFrequencyR := StreamIn[InputIndex].DSP[FilterIndex].fftdata.HighFrequencyR; + if GainR <> -1 then + StreamIn[InputIndex].DSP[FilterIndex].fftdata.GainR := cfloat(GainR); + + if TypeFilterL <> -1 then + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.typefilterL := TypeFilterL; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C2 := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D2 := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[2] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22[1] := 0.0; + + case TypeFilterL of + 1: // DSPFFTBandSelect := DSPFFTBandReject + DSPFFTBandPass + begin + // DSPFFTBandReject + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * (HighFrequencyL - + LowFrequencyl + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamIn[InputIndex + ].DSP[FilterIndex].fftdata.C + ); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.D * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[1]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.C) + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + // DSPFFTBandPass + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C2 := + 1 / Tan(Pi * (HighFrequencyl - + LowFrequencyl + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D2 := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[0] := + 1 / (1 + StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.C2); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32[2] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22[0] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C2 * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.D2 * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22[1] := + (StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C2 - 1 + ) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32[0] + ; + // + end; + + 2: // DSPFFTBandReject + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * (HighFrequencyl - + LowFrequencyl + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamIn[InputIndex + ].DSP[FilterIndex].fftdata.C + ); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.D * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[1]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.C) + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + end; + + 3: // DSPFFTBandPass + begin + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := + 1 / Tan(Pi * (HighFrequencyl - + LowFrequencyl + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamIn[InputIndex + ].DSP[FilterIndex].fftdata.C + ); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.D * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := + (StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C - 1) + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + end; + + 4: // DSPFFTLowPass + begin + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := + 1 / Tan(Pi * LowFrequencyl / + StreamIn[InputIndex].Data. + SampleRate); + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex] + .fftdata.C + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := + 2 * StreamIn[InputIndex].DSP + [FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := + 2 * (1 - StreamIn[InputIndex + ].DSP[FilterIndex].fftdata.C + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex] + .fftdata.C + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + end; + + 5: // DSPFFTHighPass + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * HighFrequencyl / + StreamIn[InputIndex].Data. + SampleRate); + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex] + .fftdata.C + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[1] := + + -2 * StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.a3[ + 0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[0] := + 2 * (StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C - 1) + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex] + .fftdata.C + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3[0]; + end; + end; + end; + + if TypeFilterR <> -1 then + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.typefilterR := TypeFilterR; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Dr := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C2r := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D2r := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[2] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22r[0] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22r[1] := 0.0; + + case TypeFilterR of + 1: // DSPFFTBandSelect := DSPFFTBandReject + DSPFFTBandPass + begin + // DSPFFTBandReject + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * (HighFrequencyr - + LowFrequencyr + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + LowFrequencyr) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Dr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[1] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.Cr + ) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + // DSPFFTBandPass + StreamIn[InputIndex].DSP[FilterIndex].fftdata.C2r := + 1 / Tan(Pi * (HighFrequencyr - + LowFrequencyr + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.D2r := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + LowFrequencyr + ) shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[0] := + 1 / (1 + StreamIn[ + InputIndex].DSP[ + FilterIndex].fftdata.C2r); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a32r[2] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32r[ + 0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22r[0] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C2r * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.D2r * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32r[ + 0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b22r[1] := + (StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.C2r - + 1) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a32r[ + 0]; + // + end; + + 2: // DSPFFTBandReject + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * (HighFrequencyr - + LowFrequencyr + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + LowFrequencyr) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Dr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[1] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.Cr + ) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + end; + + 3: // DSPFFTBandPass + begin + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := + 1 / Tan(Pi * (HighFrequencyr- + LowFrequencyr + 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + LowFrequencyr) + shr 1) / + StreamIn[InputIndex].Data. + SampleRate); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := 0.0; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := + -StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Dr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr - 1 + ) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + end; + + 4: // DSPFFTLowPass + begin + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := + 1 / Tan(Pi * LowFrequencyr / + StreamIn[InputIndex].Data. + SampleRate); + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + Sqrt(2) * StreamIn + [InputIndex].DSP[ + FilterIndex].fftdata.Cr + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := + 2 * StreamIn[InputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := + 2 * (1 - StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + end; + + 5: // DSPFFTHighPass + begin + StreamIn[InputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * HighFrequencyr / + StreamIn[InputIndex].Data. + SampleRate); + + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + Sqrt(2) * StreamIn + [InputIndex].DSP[ + FilterIndex].fftdata.Cr + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr); + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[1] := + + -2 * StreamIn[InputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[0] := + 2 * (StreamIn[InputIndex]. + DSP[FilterIndex].fftdata.Cr + * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr - 1 + ) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + StreamIn[InputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - Sqrt(2) * StreamIn[ + InputIndex].DSP[FilterIndex + ].fftdata.Cr + + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.Cr) * + StreamIn[InputIndex].DSP[ + FilterIndex].fftdata.a3r[0] + ; + end; + end; + end; + end; +end; + +procedure Tuos_Player.OutputSetFilter(OutputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: + cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: + cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// OuputIndex : InputIndex of a existing Output +// 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 +begin + if isAssigned = true then + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.AlsoBuf := AlsoBuf; + StreamOut[OutputIndex].DSP[FilterIndex].Enabled := Enable; + + if LowFrequencyL = -1 then + LowFrequencyL := StreamOut[OutputIndex].DSP[FilterIndex].fftdata.LowFrequencyL; + if LowFrequencyL = -1 then + LowFrequencyL := StreamOut[OutputIndex].DSP[FilterIndex].fftdata.HighFrequencyL; + if GainL <> -1 then + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Gainl := cfloat(Gainl); + + if LowFrequencyR = -1 then + LowFrequencyR := StreamOut[OutputIndex].DSP[FilterIndex].fftdata.LowFrequencyR; + if LowFrequencyR = -1 then + LowFrequencyR := StreamOut[OutputIndex].DSP[FilterIndex].fftdata.HighFrequencyR; + if GainR <> -1 then + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.GainR := cfloat(GainR); + + if TypeFilterL <> -1 then + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.typefilterL := TypeFilterL; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C2 := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D2 := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[2] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22[1] := 0.0; + + case TypeFilterL of + 1: // DSPFFTBandSelect := DSPFFTBandReject + DSPFFTBandPass + begin + // DSPFFTBandReject + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * (HighFrequencyL - + LowFrequencyl + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl + ) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata.D + * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[1 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - StreamOut[OutputIndex + ].DSP[FilterIndex].fftdata + .C) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + // DSPFFTBandPass + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C2 := + 1 / Tan(Pi * (HighFrequencyl + - LowFrequencyl + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D2 := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + + LowFrequencyl) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C2); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32[2] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a32[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22[0] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + C2 * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + D2 * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a32[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22[1] := + (StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + C2 - 1) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a32[0]; + // + end; + + 2: // DSPFFTBandReject + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * (HighFrequencyl - + LowFrequencyl + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl + ) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata.D + * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[1 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - StreamOut[OutputIndex + ].DSP[FilterIndex].fftdata + .C) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + end; + + 3: // DSPFFTBandPass + begin + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := + 1 / Tan(Pi * (HighFrequencyl - + LowFrequencyl + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyl + LowFrequencyl + ) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata.C + * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.D * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := + (StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata.C + - 1) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + end; + + 4: // DSPFFTLowPass + begin + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := + 1 / Tan(Pi * LowFrequencyl / + StreamOut[OutputIndex].Data. + SampleRate); + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + Sqrt(2) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C + + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := + 2 * StreamOut[OutputIndex] + .DSP[FilterIndex].fftdata. + a3[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := + 2 * (1 - StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - Sqrt(2) * StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C + + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + end; + + 5: // DSPFFTHighPass + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C := + Tan(Pi * HighFrequencyl / + StreamOut[OutputIndex].Data. + SampleRate); + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[0] := + 1 / (1 + Sqrt(2) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C + + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[1] := + + -2 * StreamOut[OutputIndex + ].DSP[FilterIndex].fftdata + .a3[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3[2] := + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[0] := + 2 * (StreamOut[OutputIndex + ].DSP[FilterIndex].fftdata + .C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C - + 1) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2[1] := + (1 - Sqrt(2) * StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C + + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.C) * + StreamOut[OutputIndex].DSP + [FilterIndex].fftdata.a3[0 + ]; + end; + + end; + end; + + if TypeFilterR <> -1 then + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.typefilterR := TypeFilterR; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Dr := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C2r := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D2r := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[2] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22r[0] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22r[1] := 0.0; + + case TypeFilterR of + 1: // DSPFFTBandSelect := DSPFFTBandReject + DSPFFTBandPass + begin + // DSPFFTBandReject + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * (HighFrequencyr - + LowFrequencyr + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + + LowFrequencyr) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Dr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[1]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr) + * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + // DSPFFTBandPass + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.C2r := + 1 / Tan(Pi * (HighFrequencyr + - LowFrequencyr + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.D2r := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + + LowFrequencyr) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.C2r + ); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a32r[2] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .a32r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22r[0] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .C2r * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .D2r * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .a32r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b22r[1] := + (StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .C2r - 1) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata + .a32r[0]; + // + end; + + 2: // DSPFFTBandReject + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * (HighFrequencyr - + LowFrequencyr + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + + LowFrequencyr) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Dr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[1]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr) + * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + end; + + 3: // DSPFFTBandPass + begin + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := + 1 / Tan(Pi * (HighFrequencyr- + LowFrequencyr + 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Dr := + 2 * Cos(2 * Pi * (roundmath( + HighFrequencyr + + LowFrequencyr) shr 1) / + StreamOut[OutputIndex].Data. + SampleRate); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := 0.0; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := + -StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Dr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr - 1) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + end; + + 4: // DSPFFTLowPass + begin + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := + 1 / Tan(Pi * LowFrequencyr / + StreamOut[OutputIndex].Data. + SampleRate); + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + Sqrt(2) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr + + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := + 2 * StreamOut[OutputIndex + ].DSP[FilterIndex]. + fftdata.a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := + 2 * (1 - StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - Sqrt(2) * StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr + + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + end; + + 5: // DSPFFTHighPass + begin + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Cr := + Tan(Pi * HighFrequencyr / + StreamOut[OutputIndex].Data. + SampleRate); + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[0] := + 1 / (1 + Sqrt(2) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr + + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr); + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[1] := + + -2 * StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.a3r[ + 0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.a3r[2] := + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[0] := + 2 * (StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr - 1) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + StreamOut[OutputIndex].DSP[FilterIndex].fftdata.b2r[1] := + (1 - Sqrt(2) * StreamOut[ + OutputIndex].DSP[ + FilterIndex].fftdata.Cr + + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + Cr) * + StreamOut[OutputIndex]. + DSP[FilterIndex].fftdata. + a3r[0]; + end; + end; + end; + end; +end; + +{$IF DEFINED(soundtouch)} +function SoundTouchPlug(bufferin: TDArFloat; plugHandle: THandle; notneeded :Tt_bs2bdp; Var + inputData: Tuos_Data; + notused1: float; notused2: float; notused3: float; notused4: float; + notused5: float; notused6: float; notused7: float; notused8: float): + + TDArFloat +; +var + ratio : shortint; + numoutbuf, x1, x2: cint32; + BufferplugFLTMP: TDArFloat; + BufferplugFL: TDArFloat; +begin + + case inputData.LibOpen of + 0: ratio := 1; + // sndfile + 1: + begin + // mpg123 + case inputData.SampleFormat of + 0: ratio := 2; + // float32 + 1: ratio := 2; + // int32 + 2: ratio := 1; + // int16 + end; + end; + 2: ratio := 1; + 3: ratio := 1; + // cdrom + 4: ratio := 1; + // opus + 5: ratio := 1; + // xmp + end; + + if inputData.LibOpen <> 4 then//not working yet for opus files + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln(); + writeln('_____Begin Sound touch_____'); + writeln('soundtouch_putSamples: Length(bufferin) = ' + inttostr(length(bufferin))); + writeln('outframes = ' + inttostr(inputData.outframes)+ + ' ratio = ' + inttostr(ratio)+' channels = ' + inttostr(inputData.Channels)); + {$endif} + + if inputData.outframes > 0 then + begin + soundtouch_putSamples(plugHandle, pcfloat(bufferin), + inputData.outframes div cint(inputData.Channels * ratio)); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('inputData.outframes div trunc(inputData.Channels * ratio) = ' + + inttostr(inputData.outframes Div inputData.Channels * ratio)); + {$endif} + + SetLength(BufferplugFL, 0); + SetLength(BufferplugFLTMP, 0); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Length(BufferplugFL) = ' + + inttostr(Length(BufferplugFL))); + writeln('Length(Bufferin) = ' + + inttostr(Length(Bufferin))); + writeln('Length(BufferplugFLTMP) = ' + + inttostr(Length(BufferplugFLTMP))); + {$endif} + + SetLength(BufferplugFLTMP,(Length(Bufferin))); + + +{ + x2 := 0 ; +while x2 < Length(BufferplugFLTMP) do +begin +BufferplugFLTMP[x2] := 0.0 ; +inc(x2); +end; +} + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('2_Length(BufferplugFLTMP) = ' + + inttostr(Length(BufferplugFLTMP))); + {$endif} + + numoutbuf := 1; + + while numoutbuf > 0 do + begin + + numoutbuf := soundtouch_receiveSamples(PlugHandle, + pcfloat(BufferplugFLTMP), inputData.outframes); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('numoutbuf = ' + inttostr(numoutbuf)); + {$endif} + + if numoutbuf > 0 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('SetLength(BufferplugFL) = ' + inttostr(length(BufferplugFL) + trunc( + + numoutbuf + * + + inputData + . + + Channels + ))); + {$endif} + + SetLength(BufferplugFL, length(BufferplugFL) + trunc(numoutbuf * inputData. + Channels)); + // works only with 2 channels. + + x2 := Length(BufferplugFL) - (numoutbuf * inputData.Channels); + + for x1 := 0 to trunc(numoutbuf * inputData.Channels) -1 do + begin + BufferplugFL[x1 + x2] := BufferplugFLTMP[x1]; + end; + end; + end; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('inputData.outframes = Length(BufferplugFL) = ' + inttostr(inputData.outframes)); + writeln('_____End Sound touch_____'); + {$endif} + + inputData.outframes := Length(BufferplugFL) Div inputData.Channels; + + Result := BufferplugFL; + end + else + begin + SetLength(bufferin, inputData.outframes); + Result := bufferin; + end; +end; + +function GetBPMPlug(bufferin: TDArFloat; plugHandle: THandle; notneeded :Tt_bs2bdp; Var inputData: + Tuos_Data; + numframes: float; loop: float; notused3: float; notused4: float; + notused5: float; notused6: float; notused7: float; notused8: float): TDArFloat; +var + ratio : shortint; +begin + + case inputData.LibOpen of + 0: ratio := 1; + // sndfile + 1: + begin + // mpg123 + case inputData.SampleFormat of + 0: ratio := 2; + // float32 + 1: ratio := 2; + // int32 + 2: ratio := 1; + // int16 + end; + end; + 2: ratio := 1; + 3: ratio := 1; + // cdrom + 4: ratio := 1; + // opus + 5: ratio := 1; + // xmp + end; + + if inputData.LibOpen <> 4 then//not working yet for opus files + begin + // writeln('getBPM init '); + if (theincbpm < numframes) and (theincbpm > -1) then + begin + bpm_putSamples(plugHandle, pcfloat(bufferin), length(bufferin) div inputData.channels); + end + else + begin + if theincbpm > -1 then + begin + inputData.BPM := bpm_getBpm(plugHandle); + // writeln('inputData.BPM := ' + floattostr(inputData.BPM)); + if loop = 1 then theincbpm := 0 + else theincbpm := -1; + + end; + end; + + if theincbpm > -1 then inc(theincbpm); + + SetLength(bufferin, inputData.outframes Div ratio); + Result := bufferin; + end; +end; + + +{$endif} + +{$IF DEFINED(bs2b)} +function bs2bPlug(bufferin: TDArFloat; notneeded: THandle; Abs2bd : Tt_bs2bdp; Var inputData: + Tuos_Data; + notused1: float; notused2: float; notused3: float; notused4: float; + notused5: float; notused6: float; notused7: float; notused8: float): TDArFloat; +var + x, x2: cint32; + Bufferplug: TDArFloat; +begin + + if (inputData.libopen = 0) or (inputData.libopen = 2) or (inputData.libopen = 3) or (inputData. + libopen = 4) or (inputData.libopen = 5) then + x2 := trunc(inputData.ratio * (inputData.outframes Div trunc(inputData.channels))) ; + + if (inputData.libopen = 1) then + begin + if inputData.SampleFormat < 2 then + x2 := trunc((inputData.outframes Div trunc(inputData.channels))) + else x2 := trunc(inputData.ratio * (inputData.outframes Div trunc(inputData.channels))) ; + end; + + SetLength(Bufferplug,x2); + + x := 0; + + while x < x2 do + begin + + Bufferplug[x] := bufferin[x] ; + Bufferplug[x+1] := bufferin[x+1] ; + bs2b_cross_feed_f(Abs2bd,Bufferplug[x],1); + bs2b_cross_feed_f(Abs2bd,Bufferplug[x+1],2); + x := x +2; + end; + Result := Bufferplug; +end; +{$endif} + +function Tuos_Player.AddPlugin(PlugName: PChar; SampleRate: CDouble; + Channels: cint32): cint32; +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// Result is PluginIndex +var + x: cint32; + chan, sr : integer; +begin + x := -1 ; + {$IF DEFINED(soundtouch)} + if lowercase(PlugName) = 'soundtouch' then + begin + // + SetLength(Plugin, Length(Plugin) + 1); + x := Length(Plugin) - 1; + Plugin[x] := Tuos_Plugin.Create(); + Plugin[x].Enabled := false; + Plugin[x].Name := lowercase(PlugName); + Plugin[x].param1 := -1; + Plugin[x].param2 := -1; + Plugin[x].param3 := -1; + Plugin[x].param4 := -1; + Plugin[x].param5 := -1; + Plugin[x].param6 := -1; + Plugin[x].param7 := -1; + Plugin[x].param8 := -1; + Plugin[x].PlugHandle := soundtouch_createInstance(); + if SampleRate = -1 then + soundtouch_setSampleRate(Plugin[x].PlugHandle, 44100) + else + soundtouch_setSampleRate(Plugin[x].PlugHandle, roundmath(SampleRate)); + if Channels = -1 then + soundtouch_setChannels(Plugin[x].PlugHandle, 2) + else + soundtouch_setChannels(Plugin[x].PlugHandle, Channels); + soundtouch_setRate(Plugin[x].PlugHandle, 1); + soundtouch_setTempo(Plugin[x].PlugHandle, 1); + soundtouch_clear(Plugin[x].PlugHandle); + Plugin[x].PlugFunc := @soundtouchplug; + end; + + if lowercase(PlugName) = 'getbpm' then + begin + // + SetLength(Plugin, Length(Plugin) + 1); + x := Length(Plugin) - 1; + Plugin[x] := Tuos_Plugin.Create(); + Plugin[x].Enabled := true; + Plugin[x].Name := lowercase(PlugName); + Plugin[x].param1 := -1; + Plugin[x].param2 := -1; + Plugin[x].param3 := -1; + Plugin[x].param4 := -1; + Plugin[x].param5 := -1; + Plugin[x].param6 := -1; + Plugin[x].param7 := -1; + Plugin[x].param8 := -1; + + if SampleRate = -1 then + sr := 44100 + else + sr := roundmath(SampleRate); + if Channels = -1 then + chan := 2 + else + chan := Channels; + + Plugin[x].PlugHandle := bpm_createInstance(chan,sr); + + Plugin[x].PlugFunc := @getbpmplug; + end; + {$endif} + + {$IF DEFINED(bs2b)} + if lowercase(PlugName) = 'bs2b' then + begin + SetLength(Plugin, Length(Plugin) + 1); + Plugin[Length(Plugin) - 1] := Tuos_Plugin.Create(); + x := Length(Plugin) - 1; + Plugin[x].Name := lowercase(PlugName); + Plugin[x].Enabled := true; + if assigned(Plugin[x].Abs2b) then bs2b_close(Plugin[x].Abs2b) ; + Plugin[x].Abs2b := bs2b_open() ; + + if SampleRate = -1 then + bs2b_set_srate(Plugin[x].Abs2b, 44100) + else + bs2b_set_srate(Plugin[x].Abs2b, roundmath(SampleRate)); + + Plugin[x].param1 := -1; + Plugin[x].param2 := -1; + Plugin[x].param3 := -1; + Plugin[x].param4 := -1; + Plugin[x].param5 := -1; + Plugin[x].param6 := -1; + Plugin[x].param7 := -1; + Plugin[x].param8 := -1; + Plugin[x].PlugFunc := @bs2bplug; + end; + {$endif} + Plugin[x].Enabled := true; + Result := x; +end; + +{$IF DEFINED(soundtouch)} +procedure Tuos_Player.SetPluginSoundTouch(PluginIndex: cint32; + Tempo: cfloat; Pitch: cfloat; Enable: boolean); +begin + soundtouch_setRate(Plugin[PluginIndex].PlugHandle, Pitch); + soundtouch_setTempo(Plugin[PluginIndex].PlugHandle, Tempo); + Plugin[PluginIndex].Enabled := Enable; + Plugin[PluginIndex].param1 := Tempo; + Plugin[PluginIndex].param2 := Pitch; +end; + +procedure Tuos_Player.SetPluginGetBPM(PluginIndex: cint32; numofframes: integer; loop : boolean; + Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +// numofframes: number of frames to analyse (-1 = 512 frames) +// loop: do new detection after previous. +begin + + Plugin[PluginIndex].Enabled := Enable; + + Plugin[PluginIndex].param1 := numofframes; + + if (loop = true) then + Plugin[PluginIndex].param2 := 1 + else Plugin[PluginIndex].param2 := 0; ; +end; +{$endif} + +{$IF DEFINED(bs2b)} +procedure Tuos_Player.SetPluginBs2b(PluginIndex: cint32; + level: CInt32; fcut: CInt32; feed: CInt32; Enable: boolean); +begin + + Plugin[PluginIndex].Enabled := Enable; + + if level > -1 then + begin + bs2b_set_level(Plugin[PluginIndex].Abs2b,level); + Plugin[PluginIndex].param1 := level; + end; + + if fcut > -1 then + begin + bs2b_set_level_fcut(Plugin[PluginIndex].Abs2b,fcut); + Plugin[PluginIndex].param2 := fcut; + end; + + if feed > -1 then + begin + bs2b_set_level_feed(Plugin[PluginIndex].Abs2b,feed); + Plugin[PluginIndex].param3 := feed; + end; + +end; +{$endif} + +function uos_InputGetLevelArray(PlayerIndex: cint32; InputIndex: cint32) : TDArFloat; +begin + result := uosLevelArray[PlayerIndex][InputIndex] ; +end; + +{$IF DEFINED(noiseremoval)} +function uos_NoiseRemoval(Var Data: Tuos_Data; Var fft: Tuos_FFT): TDArFloat; +var + ratio, x: cint32; + Outfr : cint32; + tempr : PSingle; + pf: TDArFloat; +begin + + case Data.LibOpen of + 0: ratio := 1; + // sndfile + 1: ratio := 2; + // mpg123 + 2: ratio := 1; + // aac + 3: ratio := 1; + // cdrom + 4: ratio := 1; + // opus + 5: ratio := 1; + // xmp + end; + + if Data.SampleFormat = 0 then// TODO for Array of integer. + begin + + tempr := fft.FNoise.FilterNoise(pointer(Data.Buffer) , + (Data.OutFrames Div ratio) , Outfr); + + setlength(pf,length(Data.Buffer)); + + for x := 0 to length(pf) -1 do + begin + if x < Outfr then + pf[x] := tempr[x] + else pf[x] := 0.0; + end; + + result := pf ; + + end + else result := Data.Buffer; + // TODO for Array of integer. +end; + {$endif} + +function uos_DSPVolumeIn(Var Data: Tuos_Data;Var fft: Tuos_FFT): TDArFloat; +var + x, ratio: cint32; + vleft, vright: cfloat; + + // volumearray : array of double; + + ps: PDArShort; + // if input is Int16 format + pl: PDArLong; + // if input is Int32 format + pf: PDArFloat; + // if input is Float32 format +begin + //setlength(volumearray,Data.channels); + vleft := Data.VLeft; + vright := Data.VRight; + + case Data.SampleFormat of + 2: // int16 + begin + ps := @Data.Buffer; + for x := 0 to (Data.OutFrames -1) do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + ps^[x] := trunc(ps^[x] * vright) + else + ps^[x] := trunc(ps^[x] * vleft); + end; + // This to avoid distortion + if ps^[x] < (-32760) then ps^[x] := -32760 ; + if ps^[x] > (32760) then ps^[x] := 32760 ; + + end; + + end; + 1: // int32 + begin + pl := @Data.Buffer; + for x := 0 to (Data.OutFrames -1) do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + pl^[x] := trunc(pl^[x] * vright) + else + pl^[x] := trunc(pl^[x] * vleft); + end; + + // This to avoid distortion + if pl^[x] < (-2147000000) then pl^[x] := -2147000000 ; + if pl^[x] > (2147000000) then pl^[x] := 2147000000 ; + + end; + + end; + 0: // float32 + begin + case Data.LibOpen of + 0: ratio := 1; + // sndfile + 1: ratio := 2; + // mpg123 + 2: ratio := 1; + // aac + 3: ratio := 1; + // cdrom + 4: ratio := 1; + // opus + 5: ratio := 1; + // xmp + end; + + pf := @Data.Buffer; + + for x := 0 to (Data.OutFrames div ratio) -1 do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + pf^[x] := pf^[x] * vright + else + pf^[x] := pf^[x] * vleft; + end; + + // This to avoid distortion + if pf^[x] < -1 then pf^[x] := -1; + if pf^[x] > 1 then pf^[x] := 1 ; + + end; + + end; + end; + + Result := Data.Buffer; +end; + +function uos_DSPVolumeOut(Var Data: Tuos_Data;Var fft: Tuos_FFT): TDArFloat; +var + x: cint32; + vleft, vright: cfloat; + ps: PDArShort; + // if output is Int16 format + pl: PDArLong; + // if output is Int32 format + pf: PDArFloat; + // if output is Float32 format +begin + + vleft := Data.VLeft; + vright := Data.VRight; + + case Data.SampleFormat of + 2: // int16 + begin + ps := @Data.Buffer; + for x := 0 to (length(Data.Buffer) -1) do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + ps^[x] := trunc(ps^[x] * vright) + else + ps^[x] := trunc(ps^[x] * vleft); + end; + // This to avoid distortion + if ps^[x] < (-32760) then ps^[x] := -32760 ; + if ps^[x] > (32760) then ps^[x] := 32760 ; + + end; + + end; + 1: // int32 + begin + pl := @Data.Buffer; + for x := 0 to (length(Data.Buffer) -1) do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + pl^[x] := trunc(pl^[x] * vright) + else + pl^[x] := trunc(pl^[x] * vleft); + end; + + // This to avoid distortion + if pl^[x] < (-2147000000) then pl^[x] := -2147000000 ; + if pl^[x] > (2147000000) then pl^[x] := 2147000000 ; + + end; + + end; + 0: // float32 + begin + + pf := @Data.Buffer; + + for x := 0 to (length(Data.Buffer)) -1 do + begin + if (Data.VLeft <> 1) or (Data.Vright <> 1) then + begin + if odd(x) then + pf^[x] := pf^[x] * vright + else + pf^[x] := pf^[x] * vleft; + end; + + // This to avoid distortion + if pf^[x] < -1 then pf^[x] := -1; + if pf^[x] > 1 then pf^[x] := 1 ; + + end; + + end; + end; + + Result := Data.Buffer; +end; + +function Tuos_Player.DSPLevel(Data: Tuos_Data): Tuos_Data; +var + x, ratio: cint32; + ps: PDArShort; + // if input is Int16 format + pl: PDArLong; + // if input is Int32 format + pf: PDArFloat; + // if input is Float32 format + mins, maxs: array[0..1] of cInt16; + // if input is Int16 format + minl, maxl: array[0..1] of cInt32; + // if input is Int32 format + minf, maxf: array[0..1] of cfloat; + // if input is Float32 format +begin + + case Data.SampleFormat of + 2: + begin + mins[0] := 32767; + mins[1] := 32767; + maxs[0] := -32768; + maxs[1] := -32768; + ps := @Data.Buffer; + x := 0; + while x < Data.OutFrames -1 do + begin + if ps^[x] < mins[0] then + mins[0] := ps^[x]; + if ps^[x] > maxs[0] then + maxs[0] := ps^[x]; + + Inc(x, 1); + + if ps^[x] < mins[1] then + mins[1] := ps^[x]; + if ps^[x] > maxs[1] then + maxs[1] := ps^[x]; + + Inc(x, 1); + end; + + if Abs(mins[0]) > Abs(maxs[0]) then + Data.LevelLeft := Sqrt(Abs(mins[0]) / 32768) + else + Data.LevelLeft := Sqrt(Abs(maxs[0]) / 32768); + + if Abs(mins[1]) > Abs(maxs[1]) then + Data.Levelright := Sqrt(Abs(mins[1]) / 32768) + else + Data.Levelright := Sqrt(Abs(maxs[1]) / 32768); + + end; + + 1: + begin + minl[0] := 2147483647; + minl[1] := 2147483647; + maxl[0] := -2147483648; + maxl[1] := -2147483648; + pl := @Data.Buffer; + x := 0; + while x < Data.OutFrames -1 do + begin + if pl^[x] < minl[0] then + minl[0] := pl^[x]; + if pl^[x] > maxl[0] then + maxl[0] := pl^[x]; + + Inc(x, 1); + + if pl^[x] < minl[1] then + minl[1] := pl^[x]; + if pl^[x] > maxl[1] then + maxl[1] := pl^[x]; + + Inc(x, 1); + end; + + if Abs(minl[0]) > Abs(maxl[0]) then + Data.LevelLeft := Sqrt(Abs(minl[0]) / 2147483648) + else + Data.LevelLeft := Sqrt(Abs(maxl[0]) / 2147483648); + + if Abs(minl[1]) > Abs(maxl[1]) then + Data.Levelright := Sqrt(Abs(minl[1]) / 2147483648) + else + Data.Levelright := Sqrt(Abs(maxl[1]) / 2147483648); + end; + + 0: + begin + case Data.LibOpen of + 0: ratio := 1; + // sndfile + 1: ratio := 2; + // mpg123 + 2: ratio := 2; + // aac + 3: ratio := 2; + // cdrom + 4: ratio := 2; + // opus + 5: ratio := 1; + // xmp + end; + + minf[0] := 1; + minf[1] := 1; + maxf[0] := -1; + maxf[1] := -1; + pf := @Data.Buffer; + x := 0; + while x < (Data.OutFrames div ratio)-1 do + begin + if pf^[x] < minf[0] then + minf[0] := pf^[x]; + if pf^[x] > maxf[0] then + maxf[0] := pf^[x]; + + Inc(x, 1); + + if pf^[x] < minf[1] then + minf[1] := pf^[x]; + if pf^[x] > maxf[1] then + maxf[1] := pf^[x]; + + Inc(x, 1); + end; + + if Abs(minf[0]) > Abs(maxf[0]) then + Data.LevelLeft := Sqrt(Abs(minf[0])) + else + Data.LevelLeft := Sqrt(Abs(maxf[0])); + + if Abs(minf[1]) > Abs(maxf[1]) then + Data.Levelright := Sqrt(Abs(minf[1])) + else + Data.Levelright := Sqrt(Abs(maxf[1])); + end; + end; + + Result := Data; +end; + +function DSPLevelString(Buffer: TDArFloat; SampleFormat, Ratio : cint32; Var resfloatleft : cfloat; + Var resfloatright : cfloat): string; +var + x, OutFrames: cint32; + ps: PDArShort; + // if input is Int16 format + pl: PDArLong; + // if input is Int32 format + pf: PDArFloat; + // if input is Float32 format + mins, maxs: array[0..1] of cInt16; + // if input is Int16 format + minl, maxl: array[0..1] of cInt32; + // if input is Int32 format + minf, maxf: array[0..1] of cfloat; + // if input is Float32 format +begin + + OutFrames := length(buffer); + + case SampleFormat of + 2: + begin + mins[0] := 32767; + mins[1] := 32767; + maxs[0] := -32768; + maxs[1] := -32768; + ps := @Buffer; + x := 0; + while x < OutFrames -1 do + begin + if ps^[x] < mins[0] then + mins[0] := ps^[x]; + if ps^[x] > maxs[0] then + maxs[0] := ps^[x]; + + Inc(x, 1); + + if ps^[x] < mins[1] then + mins[1] := ps^[x]; + if ps^[x] > maxs[1] then + maxs[1] := ps^[x]; + + Inc(x, 1); + end; + + if Abs(mins[0]) > Abs(maxs[0]) then + resfloatLeft := Sqrt(Abs(mins[0]) / 32768) + else + resfloatLeft := Sqrt(Abs(maxs[0]) / 32768); + + if Abs(mins[1]) > Abs(maxs[1]) then + resfloatright := Sqrt(Abs(mins[1]) / 32768) + else + resfloatright := Sqrt(Abs(maxs[1]) / 32768); + + end; + + 1: + begin + minl[0] := 2147483647; + minl[1] := 2147483647; + maxl[0] := -2147483648; + maxl[1] := -2147483648; + pl := @Buffer; + x := 0; + while x < OutFrames -1 do + begin + if pl^[x] < minl[0] then + minl[0] := pl^[x]; + if pl^[x] > maxl[0] then + maxl[0] := pl^[x]; + + Inc(x, 1); + + if pl^[x] < minl[1] then + minl[1] := pl^[x]; + if pl^[x] > maxl[1] then + maxl[1] := pl^[x]; + + Inc(x, 1); + end; + + if Abs(minl[0]) > Abs(maxl[0]) then + resfloatLeft := Sqrt(Abs(minl[0]) / 2147483648) + else + resfloatLeft := Sqrt(Abs(maxl[0]) / 2147483648); + + if Abs(minl[1]) > Abs(maxl[1]) then + resfloatright := Sqrt(Abs(minl[1]) / 2147483648) + else + resfloatright := Sqrt(Abs(maxl[1]) / 2147483648); + end; + + 0: + begin + + minf[0] := 1; + minf[1] := 1; + maxf[0] := -1; + maxf[1] := -1; + pf := @Buffer; + x := 0; + while x < (OutFrames div ratio) -1 do + begin + if pf^[x] < minf[0] then + minf[0] := pf^[x]; + if pf^[x] > maxf[0] then + maxf[0] := pf^[x]; + + Inc(x, 1); + + if pf^[x] < minf[1] then + minf[1] := pf^[x]; + if pf^[x] > maxf[1] then + maxf[1] := pf^[x]; + + Inc(x, 1); + end; + + if Abs(minf[0]) > Abs(maxf[0]) then + resfloatLeft := Sqrt(Abs(minf[0])) + else + resfloatLeft := Sqrt(Abs(maxf[0])); + + if Abs(minf[1]) > Abs(maxf[1]) then + resfloatright := Sqrt(Abs(minf[1])) + else + resfloatright := Sqrt(Abs(maxf[1])); + end; + end; + Result := floattostr(resfloatleft) + '|' + floattostr(resfloatright); +end; + + +function uos_BandFilter(Var Data: Tuos_Data; Var fft: Tuos_FFT): TDArFloat; +var + i, ratio: cint32; + ifbuf: boolean; + arg, res, res2: cfloat; + ps, ps2: PDArShort; + // if input is Int16 format + pl, pl2: PDArLong; + // if input is Int32 format + pf, pf2: PDArFloat; + // if input is Float32 format +begin + + ratio := 1; + ifbuf := fft.AlsoBuf; + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + ps2 := @fft.VirtualBuffer; + end; + 1: + begin + pl := @Data.Buffer; + pl2 := @fft.VirtualBuffer; + end; + 0: + begin + case Data.LibOpen of + 0: ratio := 1; + // sndfile + 1: ratio := 2; + // mpg123 + 2: ratio := 2; + // aac + 3: ratio := 2; + // cdrom + 4: ratio := 2; + // opus + 5: ratio := 1; + // xmp + end; + pf := @Data.Buffer; + pf2 := @fft.VirtualBuffer; + end; + end; + i := 0; + while i < (Data.OutFrames div ratio) -1 do + begin + + case Data.SampleFormat of + 2: arg := ps^[i]; + 1: arg := pl^[i]; + 0: arg := pf^[i]; + end; + + res := fft.a3[0] * arg + fft.a3[1] * fft.x0[0] + fft.a3[2] * + fft.x1[0] - fft.b2[0] * fft.y0[0] - fft.b2[1] * fft.y1[0]; + + if fft.typefilterL = 1 then + begin + res2 := fft.a32[0] * arg + fft.a32[1] * fft.x02[0] + fft.a32[2] * + fft.x12[0] - fft.b22[0] * fft.y02[0] - fft.b22[1] * fft.y12[0]; + + case Data.SampleFormat of + 2: + begin + if ifbuf = True then + ps^[i] := trunc((res * 1) + (res2 * fft.gainl)) + else + ps2^[i] := trunc((res * 1) + (res2 * fft.gainl)); + end; + 1: + begin + if ifbuf = True then + pl^[i] := trunc((res * 1) + (res2 * fft.gainl)) + else + pl2^[i] := trunc((res * 1) + (res2 * fft.gainl)); + end; + 0: + begin + + if ifbuf = True then + pf^[i] := ((res * 1) + (res2 * fft.gainl)) + else + pf2^[i] := ((res * 1) + (res2 * fft.gainl)); + end; + end; + + end + else + case Data.SampleFormat of + 2: + begin + + if ifbuf = True then + ps^[i] := trunc((res * fft.gainl)) + else + ps2^[i] := trunc(res * fft.gainl); + end; + 1: + begin + if ifbuf = True then + pl^[i] := trunc((res * fft.gainl)) + else + pl2^[i] := trunc(res * fft.gainl); + end; + 0: + begin + if ifbuf = True then + pf^[i] := ((res * fft.gainl)) + else + pf2^[i] := ((res * fft.gainl)); + end; + end; + + fft.x1[0] := fft.x0[0]; + fft.x0[0] := arg; + fft.y1[0] := fft.y0[0]; + fft.y0[0] := res; + + if fft.typefilterL = 1 then + begin + fft.x12[0] := fft.x02[0]; + fft.x02[0] := arg; + fft.y12[0] := fft.y02[0]; + fft.y02[0] := res2; + end; + + if Data.Channels = 2 then + begin + Inc(i); + case Data.SampleFormat of + 2: arg := ps^[i]; + 1: arg := pl^[i]; + 0: arg := pf^[i]; + end; + res := fft.a3r[0] * arg + fft.a3r[1] * fft.x0r[1] + fft.a3r[2] * + fft.x1r[1] - fft.b2r[0] * fft.y0r[1] - fft.b2r[1] * fft.y1r[1]; + + if fft.typefilterR = 1 then + begin + res2 := fft.a32r[0] * arg + fft.a32r[1] * fft.x02r[1] + + fft.a32r[2] * fft.x12r[1] - fft.b22r[0] * fft.y02r[1] - + fft.b22r[1] * fft.y12r[1]; + + case Data.SampleFormat of + 2: + begin + if ifbuf = True then + ps^[i] := trunc((res * 1) + (res2 * fft.gainr)) + else + ps2^[i] := trunc((res * 1) + (res2 * fft.gainr)); + end; + 1: + begin + if ifbuf = True then + pl^[i] := trunc((res * 1) + (res2 * fft.gainr)) + else + pl2^[i] := trunc((res * 1) + (res2 * fft.gainr)); + end; + 0: + begin + if ifbuf = True then + pf^[i] := ((res * 1) + (res2 * fft.gainr)) + else + pf2^[i] := ((res * 1) + (res2 * fft.gainr)); + end; + end; + + end + else + case Data.SampleFormat of + 2: + begin + if ifbuf = True then + ps^[i] := trunc((res * fft.gainr)) + else + ps2^[i] := trunc((res * fft.gainr)); + end; + 1: + begin + if ifbuf = True then + pl^[i] := trunc((res * fft.gainr)) + else + pl2^[i] := trunc((res * fft.gainr)); + end; + 0: + begin + if ifbuf = True then + pf^[i] := ((res * fft.gainr)) + else + pf2^[i] := ((res * fft.gainr)); + end; + end; + + fft.x1r[1] := fft.x0r[1]; + fft.x0r[1] := arg; + fft.y1r[1] := fft.y0r[1]; + fft.y0r[1] := res; + + if fft.typefilterR = 1 then + begin + fft.x12r[1] := fft.x02r[1]; + fft.x02r[1] := arg; + fft.y12r[1] := fft.y02r[1]; + fft.y02r[1] := res2; + end; + + end; + Inc(i); + end; + + if ifbuf = false then + begin + data.levelfilters := data.levelfilters + '%'+ DSPLevelString(fft.VirtualBuffer, Data. + SampleFormat, data.Ratio, data.levelleft, data.levelright) ; + inc(Data.incfilters); + Data.levelfiltersar[Data.incfilters-1] := data.levelleft; + inc(Data.incfilters); + Data.levelfiltersar[Data.incfilters-1] := data.levelright; + end; + + Result := Data.Buffer; + +end; + +function uos_InputAddDSP1ChanTo2Chan(Var Data: Tuos_Data; Var fft: Tuos_FFT): TDArFloat; +// Convert mono 1 chan input into stereo 2 channels input. +// Works only if the input is mono 1 channel othewise stereo 2 chan is keeped. +// InputIndex : InputIndex of a existing Input +// result : index of DSPIn in array +// example DSPIndex1 := InputAdd1ChanTo2Chan(InputIndex1); +var + x, x2: integer ; + + ps, ps2: PDArShort; + // if input is Int16 format + pl, pl2: PDArLong; + // if input is Int32 format + pf, pf2: PDArFloat; + // if input is Float32 format + + buffer2 : TDArFloat; + +begin + if (Data.channels = 1) then + begin + setlength(Buffer2, Data.OutFrames); + x := 0 ; + x2 := 0 ; + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + ps2 := @Buffer2; + while x < Data.OutFrames -1 do + begin + ps2^[x2] := (ps^[x]); + ps2^[x2+1] := (ps^[x]); + x := x + 1; + x2 := x2 + 2; + end; + end; + + 1: + begin + pl := @Data.Buffer; + pl2 := @Buffer2; + while x < Data.OutFrames -1 do + begin + pl2^[x2] := (pl^[x]); + pl2^[x2+1] := (pl^[x]); + x := x + 1; + x2 := x2 + 2; + end; + end; + + 0: + begin + pf := @Data.Buffer; + pf2 := @Buffer2; + while x < Data.OutFrames -1 do + begin + pf2^[x2] := (pf^[x]); + pf2^[x2+1] := (pf^[x]); + x := x + 1; + x2 := x2 + 2; + end; + end; + end; + data.outframes := length(buffer2); + Result := Buffer2;; + end + else + begin + Result := data.Buffer; + end; + +end; + +function ConvertSampleFormat(Data: Tuos_Data): TDArFloat; +var + x : integer ; + + ps, ps2: PDArShort; + // if input is Int16 format + pl, pl2: PDArLong; + // if input is Int32 format + buffer2 : TDArFloat; + +begin + if (Data.SampleFormat > 0) then + begin + setlength(Buffer2, Data.OutFrames); + x := 0 ; + + case Data.SampleFormat of + 2: + begin + ps := @Data.Buffer; + ps2 := @Buffer2; + while x < Data.OutFrames do + begin + ps2^[x] := (ps^[x]); + x := x + 1; + end; + end; + + 1: + begin + pl := @Data.Buffer; + pl2 := @Buffer2; + while x < Data.OutFrames do + begin + pl2^[x] := (pl^[x]); + x := x + 1; + end; + end; + end; + Result := Buffer2; + end + else + begin + Result := data.Buffer; + end; + +end; + + {$IF DEFINED(noiseremoval)} +function Tuos_Player.InputAddDSPNoiseRemoval(InputIndex: cint32): cint32; +// DSP Noise Removal +// InputIndex : InputIndex of a existing Input +// result : otherwise index of DSPIn in array +// example DSPIndex1 := InputAddDSPNoiseRemoval(InputIndex1); +begin + + Result := InputAddDSP(InputIndex, Nil, @uos_NoiseRemoval, Nil, Nil); + + StreamIn[InputIndex].data.DSPNoiseIndex := Result ; + + StreamIn[InputIndex].DSP[result].fftdata := Tuos_FFT.Create(); + + StreamIn[InputIndex].DSP[result].fftdata.FNoise := + TuosNoiseRemoval.Create(StreamIn[InputIndex]. + data.Channels,roundmath(StreamIn[InputIndex]. + data. + SampleRate)); + + StreamIn[InputIndex].DSP[result].fftdata.FNoise.samprate := + roundmath(StreamIn[InputIndex].data. + SampleRate); + + StreamIn[InputIndex].DSP[result].fftdata.FNoise.WriteProc := + @StreamIn[InputIndex].DSP[result]. + fftdata.FNoise.WriteData; + + StreamIn[InputIndex].DSP[result].fftdata.FNoise.isprofiled := false; + +end; + +procedure Tuos_Player.InputSetDSPNoiseRemoval(InputIndex: cint32; Enable: boolean); + +begin + StreamIn[InputIndex].DSP[StreamIn[InputIndex].data.DSPNoiseIndex].enabled := Enable ; +end; + +function Tuos_Player.OutputAddDSPNoiseRemoval(OutputIndex: cint32): cint32; +// DSP Noise Removal +// OutputIndex : OutputIndex of a existing Output +// result : otherwise index of DSPInOut in array +// example DSPIndex1 := OutputAddDSPNoiseRemoval(OutputIndex1); +begin + + Result := OutputAddDSP(OutputIndex, Nil, @uos_NoiseRemoval, Nil, Nil); + + StreamOut[OutputIndex].data.DSPNoiseIndex := Result ; + + StreamOut[OutputIndex].DSP[result].fftdata := Tuos_FFT.Create(); + + StreamOut[OutputIndex].DSP[result].fftdata.FNoise := + TuosNoiseRemoval.Create(StreamOut[OutputIndex + ].data.Channels,roundmath(StreamOut[ + OutputIndex].data. + SampleRate)); + + StreamOut[OutputIndex].DSP[result].fftdata.FNoise.samprate := + roundmath(StreamOut[OutputIndex]. + data. + SampleRate); + + StreamOut[OutputIndex].DSP[result].fftdata.FNoise.WriteProc := + @StreamOut[OutputIndex].DSP[result] + .fftdata.FNoise.WriteData; + + StreamOut[OutputIndex].DSP[result].fftdata.FNoise.isprofiled := false; + +end; + +procedure Tuos_Player.OutputSetDSPNoiseRemoval(OutputIndex: cint32; Enable: boolean); +begin + StreamOut[OutputIndex].DSP[StreamOut[OutputIndex].data.DSPNoiseIndex].enabled := Enable ; +end; + +{$endif} + +function Tuos_Player.InputAddDSPVolume(InputIndex: cint32; VolLeft: double; + VolRight: double): cint32; +// DSP Volume changer +// InputIndex : InputIndex of a existing Input +// VolLeft : Left volume +// VolRight : Right volume +// result : index of DSPIn in array +// example DSPIndex1 := InputAddDSPVolume(InputIndex1,1,1); +begin + Result := InputAddDSP(InputIndex, Nil, @uos_DSPVolumeIn, Nil, Nil); + StreamIn[InputIndex].Data.VLeft := VolLeft; + StreamIn[InputIndex].Data.VRight := VolRight; +end; + +function Tuos_Player.InputAddDSP1ChanTo2Chan(InputIndex: cint32): cint32; +// Convert mono 1 channel input to stereo 2 channels input. +// Works only if the input is mono 1 channel othewise stereo 2 chan is keeped. +// InputIndex : InputIndex of a existing Input +// result : index of DSPIn in array +// example DSPIndex1 := InputAddDSP1ChanTo2Chan(InputIndex1); +begin + Result := InputAddDSP(InputIndex, Nil, @uos_InputAddDSP1ChanTo2Chan, Nil, Nil); +end; + +function Tuos_Player.OutputAddDSPVolume(OutputIndex: cint32; VolLeft: double; + VolRight: double): cint32; +// DSP Volume changer +// OutputIndex : OutputIndex of a existing Output +// VolLeft : Left volume ( 1 = max) +// VolRight : Right volume ( 1 = max) +// result : index of DSPIn in array +// example DSPIndex1 := OutputAddDSPVolume(OutputIndex1,1,1); +begin + Result := OutputAddDSP(OutputIndex, Nil, @uos_DSPVolumeOut, Nil, Nil); + StreamOut[OutputIndex].Data.VLeft := VolLeft; + StreamOut[OutputIndex].Data.VRight := VolRight; +end; + +procedure Tuos_Player.InputSetDSPVolume(InputIndex: cint32; DSPVolIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); +// InputIndex : InputIndex of a existing Input +// DSPIndex : DSPVolIndex of a existing DSPVolume +// VolLeft : Left volume ( -1 = do not change) +// VolRight : Right volume ( -1 = do not change) +// Enable : Enabled +// example InputSetDSPVolume(InputIndex1,DSPVolIndex1,1,0.8,True); +begin + if VolLeft <> -1 then + StreamIn[InputIndex].Data.VLeft := VolLeft; + if VolRight <> -1 then + StreamIn[InputIndex].Data.VRight := VolRight; + StreamIn[InputIndex].DSP[DSPVolIndex].Enabled := Enable; +end; + +procedure Tuos_Player.OutputSetDSPVolume(OutputIndex: cint32; + DSPVolIndex: cint32; VolLeft: double; VolRight: double; + Enable: boolean); +// OutputIndex : OutputIndex of a existing Output +// DSPIndex : DSPIndex of a existing DSP +// VolLeft : Left volume +// VolRight : Right volume +// Enable : Enabled +// example OutputSetDSPVolume(InputIndex1,DSPIndex1,1,0.8,True); +begin + if VolLeft <> -1 then + StreamOut[OutputIndex].Data.VLeft := VolLeft; + if VolRight <> -1 then + StreamOut[OutputIndex].Data.VRight := VolRight; + StreamOut[OutputIndex].DSP[DSPVolIndex].Enabled := Enable; +end; + +function Tuos_Player.InputAddFilter(InputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: + cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: + cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// InputIndex : InputIndex of a existing Input +// TypeFilterL: Type of filter left: +// ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2 +// 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 +// result : index of DSPIn in array + +var + FilterIndex: cint32; +begin + FilterIndex := InputAddDSP(InputIndex, Nil, @uos_BandFilter, Nil, LoopProc); + + if alsobuf = false then + begin + StreamIn[InputIndex].data.hasfilters := true; + inc(StreamIn[InputIndex].data.nbfilters); + end; + + StreamIn[InputIndex].DSP[FilterIndex].fftdata := + Tuos_FFT.Create(); + + setlength(StreamIn[InputIndex].DSP[FilterIndex].fftdata.Virtualbuffer, length(StreamIn[InputIndex] + .data.buffer)); + + if TypeFilterL = -1 then TypeFilterL := 1; + if TypeFilterR = -1 then TypeFilterR := 1; + + InputSetFilter(InputIndex, FilterIndex, TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, AlsoBuf, LoopProc, True); + + Result := FilterIndex; +end; + +function Tuos_Player.OutputAddFilter(OutputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: + cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: + cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// OutputIndex : InputIndex of a existing Output +// TypeFilterL: Type of filter left: +// ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2 +// 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 +// result : index of DSPIn in array + +var + FilterIndex: cint32; +begin + FilterIndex := OutputAddDSP(OutputIndex, Nil, @uos_BandFilter, Nil, LoopProc); + + if alsobuf = false then + begin + StreamOut[OutputIndex].data.hasfilters := true; + inc(StreamOut[OutputIndex].data.nbfilters); + end; + + StreamOut[OutputIndex].DSP[FilterIndex].fftdata := + Tuos_FFT.Create(); + + setlength(StreamOut[OutputIndex].DSP[FilterIndex].fftdata.Virtualbuffer, + length(StreamOut[OutputIndex].data.buffer)); + + if TypeFilterL = -1 then TypeFilterL := 1; + if TypeFilterR = -1 then TypeFilterR := 1; + + OutputSetFilter(OutputIndex, FilterIndex, TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, AlsoBuf, LoopProc, True); + + Result := FilterIndex; +end; + + +{$IF DEFINED(portaudio)} +function Tuos_Player.AddFromDevIn(Device: cint32; Latency: CDouble; + SampleRate: CDouble; OutputIndex: cint32; + SampleFormat: cint32; FramesCount : cint32; ChunkCount: cint32): + cint32 +; +// Add Input from IN device with custom parameters +// Device ( -1 is default Input device ) +// Latency ( -1 is latency suggested ) +// SampleRate : delault : -1 (44100) + +// 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 : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : -1 default : 4096 +// ChunkCount : default : -1 (= 512) +var + x, err: cint32; +begin + result := -1 ; + + if device = -1 then + err := Pa_GetDefaultInputDevice(); + if err = -1 then result := -2; + + if result <> -2 then + begin + x := 0; + err := -1; + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create(); + x := Length(StreamIn) - 1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.PositionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + + StreamIn[x].PAParam.HostApiSpecificStreamInfo := Nil; + + if device = -1 then + StreamIn[x].PAParam.device := + Pa_GetDefaultInputDevice() + else + StreamIn[x].PAParam.device := cint32(device); + + if SampleRate = -1 then + StreamIn[x].Data.SampleRate := DefRate + else + StreamIn[x].Data.SampleRate := SampleRate; + + StreamIn[x].PAParam.SuggestedLatency := CDouble(0); + + StreamIn[x].PAParam.SampleFormat := paInt16; + + case SampleFormat of + 0: StreamIn[x].PAParam.SampleFormat := paFloat32; + 1: StreamIn[x].PAParam.SampleFormat := paInt32; + 2: StreamIn[x].PAParam.SampleFormat := paInt16; + end; + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := CInt32(2) + else + StreamIn[x].Data.SampleFormat := CInt32(SampleFormat); + + if ((Pa_GetDeviceInfo(StreamIn[x].PAParam.device)^. + maxInputChannels)) > 1 then + StreamIn[x].PAParam.channelCount := CInt32(2) + else + StreamIn[x].PAParam.channelCount := CInt32(1) ; + + StreamIn[x].data.channels := StreamIn[x].PAParam.channelCount; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 4096 + else + StreamIn[x].Data.Wantframes := (FramesCount) ; + + if ChunkCount = -1 then ChunkCount := 512; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes* StreamIn[x].Data.channels); + + // StreamIn[x].Data.outframes := length(StreamIn[x].Data.Buffer); + StreamIn[x].Data.outframes := 0; + + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.TypePut := 1; + StreamIn[x].Data.ratio := 2; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.seekable := False; + StreamIn[x].Data.LibOpen := 2; + StreamIn[x].LoopProc := Nil; + + err := Pa_OpenStream(@StreamIn[x].Data.HandleSt, @StreamIn[x].PAParam, + Nil, CDouble(StreamIn[x].Data.SampleRate), CULong(ChunkCount), paClipOff, Nil, Nil); + + if err <> 0 then + else + begin + StreamIn[x].Data.Enabled := True; + Result := x; + end; + end + else Result := -1; +end; +{$endif} + +function Tuos_Player.InputGetBuffer(InputIndex: cint32): TDArFloat; +// Get current buffer +begin + result := StreamIn[InputIndex].data.Buffer; +end; + +function Tuos_Player.AddFromEndlessMuted(Channels : cint32; FramesCount: cint32): cint32; +// Add a input from Endless Muted dummy sine wav +// FramesCountByChan = FramesCount of input-to-follow div channels of input-to-follow. +var + x, i : cint32; +begin + result := -1 ; + x := 0; + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create(); + x := Length(StreamIn) - 1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.PositionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + + if channels = -1 then + StreamIn[x].data.channels := 2 + else + StreamIn[x].data.channels := Channels; + + StreamIn[x].Data.SampleRate := DefRate; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := trunc(1024 * 2 Div StreamIn[x].Data. + channels) + else + StreamIn[x].Data.Wantframes := FramesCount * 2 Div channels ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes* StreamIn[x].Data.channels); + + StreamIn[x].Data.OutFrames := StreamIn[x].Data.WantFrames ; + + for i := 0 to length(StreamIn[x].Data.Buffer) -1 do + StreamIn[x].Data.Buffer[i] := 0.0; + + StreamIn[x].Data.SampleFormat := CInt32(0); + + StreamIn[x].Data.VLeft := 0; + + StreamIn[x].Data.Vright := 0; + + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.TypePut := 5; + StreamIn[x].Data.HandleSt := pchar('endless'); + StreamIn[x].Data.ratio := 2; + StreamIn[x].Data.Output := -1; + StreamIn[x].Data.seekable := False; + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].LoopProc := Nil; + StreamIn[x].Data.Enabled := True; + Result := x; +end; + +{$IF DEFINED(synthesizer)} +function Tuos_Player.AddFromSynth(Channels: integer; WaveTypeL, WaveTypeR: shortint; + FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; + duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32; + OutputIndex: cint32; SampleFormat: cint32 ; SampleRate: CDouble ; + 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, 2 = triangle, 2= triangle, 3=sawtooth used for mono and stereo) + +// WaveTypeR: default: -1 (0) (0 = sine-wave 1 = square-wave,2 = triangle, 2= triangle, 3=sawtooth used, 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 Harmonies +// 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 + +var + x : cint32; +begin + result := -1 ; + x := 0; + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create(); + x := Length(StreamIn) - 1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.PositionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + + if channels < 1 then + StreamIn[x].data.channels := 2 + else + StreamIn[x].data.channels := channels; + + if SampleRate = -1 then + StreamIn[x].Data.SampleRate := DefRate + else + StreamIn[x].Data.SampleRate := SampleRate; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 1024 + else + StreamIn[x].Data.Wantframes := FramesCount ; + + if FrequencyL = -1 then + StreamIn[x].Data.freqLsine := 440 + else + StreamIn[x].Data.freqLsine := FrequencyL ; + + if FrequencyR = -1 then + StreamIn[x].Data.freqRsine := 440 + else + StreamIn[x].Data.freqRsine := FrequencyR ; + + if WaveTypeL < 1 then + StreamIn[x].Data.typLsine := 0 + else + StreamIn[x].Data.typLsine := WaveTypeL; + + if WaveTypeR < 1 then + StreamIn[x].Data.typRsine := 0 + else + StreamIn[x].Data.typRsine := WaveTypeR; + + StreamIn[x].Data.PosInTableLeft := 0; + StreamIn[x].Data.PosInTableRight := 0; + + if NbHarmonics < 1 then + StreamIn[x].data.harmonic := 0 + else + StreamIn[x].data.harmonic := NbHarmonics; + + if EvenHarmonics < 1 then + StreamIn[x].data.evenharm := 0 + else + StreamIn[x].data.evenharm := 1; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes* StreamIn[x].Data.channels); + + StreamIn[x].Data.posdursine := 0 ; + + if duration = -1 then duration := 1000; + StreamIn[x].Data.dursine := trunc( StreamIn[x].Data.SampleRate * duration / 1000); + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := CInt32(0) + else + StreamIn[x].Data.SampleFormat := CInt32(SampleFormat); + + if VolumeL = -1 then StreamIn[x].Data.VLeft := 1 + else + StreamIn[x].Data.VLeft := VolumeL; + + if VolumeR = -1 then StreamIn[x].Data.Vright := 1 + else + StreamIn[x].Data.Vright := VolumeR; + + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.TypePut := 3; + StreamIn[x].Data.HandleSt := pchar('synth'); + + if (StreamIn[x].Data.SampleFormat = 2) then + StreamIn[x].Data.ratio := StreamIn[x].data.channels + else StreamIn[x].Data.ratio := 2; + + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.seekable := False; + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].LoopProc := Nil; + StreamIn[x].Data.Enabled := True; + + FillLookupTable(x, StreamIn[x].Data.typLsine, 1,StreamIn[x].data.harmonic, StreamIn[x].data. + evenharm); + FillLookupTable(x, StreamIn[x].Data.typRsine, 2,StreamIn[x].data.harmonic, StreamIn[x].data. + evenharm); + + Result := x; +end; + +procedure Tuos_Player.InputSetSynth(InputIndex: cint32; WaveTypeL, WaveTypeR: shortint; + 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, 2 = triangle, 2= triangle, 3=sawtooth used for mono and stereo) + +// WaveTypeR : do not change: -1 (0 = sine-wave 1 = square-wave, 2 = triangle, 2= triangle, 3=sawtooth 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 Harmonies (-1 not change) +// EvenHarmonics: default: -1 (= 0) (0 = all harmonics, 1 = Only even harmonics) +// Enable : true or false ; + +var + newtable : boolean = false; +begin + StreamIn[InputIndex].Data.Enabled := Enable; + + if NbHarmonic <> -1 then + begin + StreamIn[InputIndex].Data.harmonic := NbHarmonic; + newtable := true; + end; + + if EvenHarmonics <> - 1 then + begin + if EvenHarmonics = 0 then + StreamIn[InputIndex].data.evenharm := 0 + else + StreamIn[InputIndex].data.evenharm := 1; + newtable := true; + end; + + if WaveTypeL <> -1 then + begin + StreamIn[InputIndex].Data.typLsine := WaveTypeL; + newtable := true; + end; + + if WaveTypeR <> -1 then + begin + StreamIn[InputIndex].Data.typRsine := WaveTypeR; + newtable := true; + end; + + if FrequencyL <> -1 then + begin + StreamIn[InputIndex].Data.freqLsine := FrequencyL ; + end; + + if FrequencyR <> -1 then + begin + StreamIn[InputIndex].Data.freqRsine := FrequencyR ; + end; + + if VolumeL <> -1 then + begin + StreamIn[InputIndex].Data.VLeft := VolumeL; + end; + + if VolumeR <> -1 then + begin + StreamIn[InputIndex].Data.Vright := VolumeR; + end; + + if Duration <> -1 then StreamIn[InputIndex].Data.dursine := + trunc( StreamIn[InputIndex].Data. + SampleRate * duration / 1000); + + if newtable then + begin + FillLookupTable(InputIndex,StreamIn[InputIndex].Data.typLsine, 1, + StreamIn[InputIndex].Data.harmonic, StreamIn[InputIndex].data.evenharm); + FillLookupTable(InputIndex,StreamIn[InputIndex].Data.typRsine, 2, + StreamIn[InputIndex].Data.harmonic, StreamIn[InputIndex].data.evenharm); + end; + +end; +{$endif} + +{$IF DEFINED(shout)} +function Tuos_Player.AddIntoIceServer(SampleRate : CDouble; Channels: cint; SampleFormat: cint; + EncodeType: cint; Port: cint; Host: pchar; User: pchar; + Password: pchar; MountFile :pchar): cint32; +// Add a Output into a IceCast server for audio-web-streaming +// SampleRate : delault : -1 (48100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// SampleFormat : -1 default : float32 : (0:float32, 1:Int16) +// EncodeType : default : -1 (0:Music) (0: Music, 1:Voice) +// Port : default : -1 (= 8000) +// Host : default : 'def' (= '127.0.0.1') +// User : default : 'def' (= 'source') +// Password : default : 'def' (= 'hackme') +// MountFile : default : 'def' (= '/example.opus') +// result : Output Index in array -1 = error + +var + x, typeenc : cint32; + err : integer = -1; + +begin + + result := -1 ; + x := 0; + err := -1; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + + StreamOut[x].Data.Enabled := false; + + if (EncodeType = -1) or (EncodeType = 0) then typeenc := OPUS_APPLICATION_AUDIO + else + typeenc := OPUS_APPLICATION_VOIP ; + + if SampleRate = -1 then StreamOut[x].Data.SampleRate := 48000 + else + StreamOut[x].Data.SampleRate := SampleRate; + + if Channels = -1 then StreamOut[x].Data.Channels := 2 + else + StreamOut[x].Data.Channels := Channels; + + if SampleFormat = -1 then StreamOut[x].Data.SampleFormat := 0 + else + StreamOut[x].Data.SampleFormat := SampleFormat; + + StreamOut[x].Data.TypePut := 2 ; + + setlength(StreamOut[x].Data.Buffer,1024 *2); + + // setlength(StreamOut[x].Data.Buffer,960); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('before opus_encoder_create ' ); + {$endif} + + // opus encoder + StreamOut[x].encoder := opus_encoder_create(StreamOut[x].Data.SampleRate, + StreamOut[x].Data.Channels, typeenc, err); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if (err<0) + then + begin + WriteLn(Format('failed to create an encoder: %s', [opus_strerror(err)])); + end; + {$endif} + // if (err=0) then + // err := opus_encoder_ctl(StreamOut[x].encoder , OPUS_SET_BITRATE(cBITRATE)); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if (err<0) + then + begin + WriteLn(Format('failed opus_encoder_ctl: %s', [opus_strerror(err)])); + end; + {$endif} + + if err =0 then + begin + + StreamOut[x].Data.HandleSt := Nil; + + shout_init(); + + StreamOut[x].Data.HandleSt := shout_new(); + + if assigned(StreamOut[x].Data.HandleSt) then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('shhandle assigned'); + {$endif} + err := shout_set_host( StreamOut[x].Data.HandleSt, pchar(Host)); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_host ok ' + inttostr(err)) + else + WriteLn('shout_set_host error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + err := shout_set_protocol(StreamOut[x].Data.HandleSt, SHOUT_PROTOCOL_HTTP); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_protocol ' + inttostr(err)) + else + WriteLn('shout_set_protocol error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt) + )); + {$endif} + err := shout_set_port(StreamOut[x].Data.HandleSt, Port); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_port ok ' + inttostr(err)) + else + WriteLn('shout_set_port error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + err := shout_set_password(StreamOut[x].Data.HandleSt, pchar(Password)); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('set_password ok ' + inttostr(err)) + else + WriteLn('set_password error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + err := shout_set_mount(StreamOut[x].Data.HandleSt, pchar(MountFile)); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_mount ok ' + inttostr(err)) + else + WriteLn('shout_set_mount error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + err := shout_set_user(StreamOut[x].Data.HandleSt, pchar(user)); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_user ok ' + inttostr(err)) + else + WriteLn('shout_set_user error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + err := shout_set_format(StreamOut[x].Data.HandleSt, SHOUT_FORMAT_OGG); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_set_format ok ' + inttostr(err)) + else + WriteLn('shout_set_format error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))) + ; + {$endif} + err := shout_open(StreamOut[x].Data.HandleSt); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_open ok ' + inttostr(err)) + else + WriteLn('shout_open error: ' + pchar(shout_get_error(StreamOut[x].Data.HandleSt))); + {$endif} + + if err = SHOUTERR_SUCCESS then + begin + StreamOut[x].Data.Enabled := True; + result := x + end + else + begin + shout_free(StreamOut[x].Data.HandleSt); + StreamOut[Length(StreamOut) - 1].Destroy; + setlength(StreamOut, Length(StreamOut) - 1); + end; + end + else + begin + StreamOut[Length(StreamOut) - 1].Destroy; + setlength(StreamOut, Length(StreamOut) - 1); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('shhandle not assigned') {$endif} ; + end; + end; +end; + {$endif} + +procedure uos_CustBufferInfos(Var bufferinfos: Tuos_BufferInfos; SampleRate: CDouble; SampleFormat + : cint32; Channels: cint32 ; Length: cint32); +begin + bufferinfos.SampleRate := Samplerate; + bufferinfos.SampleRateRoot := Samplerate; + bufferinfos.SampleFormat := SampleFormat; + bufferinfos.Channels := Channels; + bufferinfos.Length := Length; + bufferinfos.LibOpen := 0; + bufferinfos.Ratio := 2 ; +end; + + +function Tuos_Player.AddIntoFileFromMem(Filenamepath: PChar; SampleRate: CDouble; + Channels: LongInt; SampleFormat: LongInt; FramesCount: + LongInt; FileFormat: cint32): LongInt; +// Add a Output into audio wav file with Custom parameters +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : -1 default : Int16 : (1:Int32, 2:Int16) +// FramesCount : -1 default : 65536 div channels +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom); +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoFileFromMem(edit5.Text,-1,-1,0, -1); +var + x: LongInt; +begin + result := -1 ; + x := 0; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + StreamOut[x].Data.Enabled := false; + StreamOut[x].FileBuffer.ERROR := 0; + StreamOut[x].Data.Filename := Filenamepath; + if (FileFormat = -1) or (FileFormat = 0) then + StreamOut[x].FileBuffer.FileFormat := 0 + else StreamOut[x].FileBuffer.FileFormat := FileFormat; + StreamOut[x].Data.TypePut := 4; + FillChar(StreamOut[x].FileBuffer, sizeof(StreamOut[x].FileBuffer), 0); + StreamOut[x].FileBuffer.DataMS := TMemoryStream.Create; + + result := x; + + if (Channels = -1) then + StreamOut[x].FileBuffer.wChannels := 2 + else + StreamOut[x].FileBuffer.wChannels := Channels; + + StreamOut[x].Data.Channels := StreamOut[x].FileBuffer.wChannels; + + if FramesCount = -1 then StreamOut[x].Data.Wantframes := 65536 Div StreamOut[x].Data.Channels + else + StreamOut[x].Data.Wantframes := FramesCount ; + + SetLength(StreamOut[x].Data.Buffer, StreamOut[x].Data.Wantframes*StreamOut[x].Data.Channels); + + if (SampleFormat = -1) or (SampleFormat = 2) then + begin + StreamOut[x].FileBuffer.wBitsPerSample := 16; + StreamOut[x].Data.SampleFormat := 2; + end; + + if (SampleFormat = 1) then + begin + StreamOut[x].FileBuffer.wBitsPerSample := 32; + StreamOut[x].Data.SampleFormat := 1; + end; + + if SampleRate = -1 then + StreamOut[x].FileBuffer.wSamplesPerSec := 44100 + else + StreamOut[x].FileBuffer.wSamplesPerSec := roundmath(samplerate); + + StreamOut[x].Data.Samplerate := StreamOut[x].FileBuffer.wSamplesPerSec; + StreamOut[x].LoopProc := Nil; + StreamOut[x].Data.Enabled := True; +end; + +function Tuos_Player.AddIntoFile(Filenamepath: PChar; SampleRate: CDouble; + Channels: cint32; SampleFormat: cint32 ; FramesCount: cint32 ; + FileFormat: cint32): cint32; +// Add a Output into audio wav file with custom parameters +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) +// FramesCount : default : -1 (= 4096) +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg); +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoFile(edit5.Text,-1,-1, 0, -1, -1); +var + x: cint32; + wChunkSize: cint32; + wFileSize: cint32; + IDwav: array[0..3] of char; + Header: Tuos_WaveHeaderChunk; + {$IF DEFINED(sndfile)} + sfInfo: TSF_INFO; + {$endif} + +begin + result := -1 ; + x := 0; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + StreamOut[x].Data.Enabled := false; + StreamOut[x].FileBuffer.ERROR := 0; + StreamOut[x].Data.Filename := filenamepath; + if (FileFormat = -1) or (FileFormat = 0) then + StreamOut[x].FileBuffer.FileFormat := 0 + else StreamOut[x].FileBuffer.FileFormat := FileFormat; + + FillChar(StreamOut[x].FileBuffer, sizeof(StreamOut[x].FileBuffer), 0); + + result := x; + + if (Channels = -1) then + StreamOut[x].FileBuffer.wChannels := 2 + else + StreamOut[x].FileBuffer.wChannels := Channels; + + StreamOut[x].Data.Channels := StreamOut[x].FileBuffer.wChannels; + + if FramesCount = -1 then StreamOut[x].Data.Wantframes := 65536 Div StreamOut[x].Data.Channels + else + StreamOut[x].Data.Wantframes := FramesCount ; + + SetLength(StreamOut[x].Data.Buffer, StreamOut[x].Data.Wantframes*StreamOut[x].Data.Channels); + + if (SampleFormat = -1) or (SampleFormat = 2) then + begin + StreamOut[x].FileBuffer.wBitsPerSample := 16; + StreamOut[x].Data.SampleFormat := 2; + end; + + if (SampleFormat = 1) then + begin + StreamOut[x].FileBuffer.wBitsPerSample := 32; + StreamOut[x].Data.SampleFormat := 1; + end; + + if (SampleFormat = 0) then + begin + StreamOut[x].FileBuffer.wBitsPerSample := 32; + StreamOut[x].Data.SampleFormat := 0; + end; + + if SampleRate = -1 then + StreamOut[x].FileBuffer.wSamplesPerSec := 44100 + else + StreamOut[x].FileBuffer.wSamplesPerSec := roundmath(samplerate); + + StreamOut[x].Data.Samplerate := StreamOut[x].FileBuffer.wSamplesPerSec; + StreamOut[x].LoopProc := Nil; + + if fileformat = 3 then + begin + // ogg file + {$IF DEFINED(sndfile)} + StreamOut[x].FileBuffer.FileFormat := 3; + StreamOut[x].Data.TypePut := 6 ; + sfInfo.format := SF_FORMAT_OGG Or SF_FORMAT_VORBIS; + sfInfo.channels := StreamOut[x].Data.Channels; + sfInfo.frames := streamOut[x].Data.Wantframes; + SFinfo.samplerate := StreamOut[x].FileBuffer.wSamplesPerSec; + SFinfo.seekable := 0; + StreamOut[x].Data.Enabled := True; + StreamOut[x].Data.HandleSt := sf_open(pchar(FileNamepath), SFM_WRITE, sfInfo); + {$endif} + end + else + begin + // wav file + StreamOut[x].FileBuffer.Data := TFileStream.Create(filenamepath,fmCreate); + StreamOut[x].FileBuffer.Data.Seek(0, soFromBeginning); + StreamOut[x].Data.TypePut := 0 ; + IDwav := 'RIFF'; + StreamOut[x].FileBuffer.Data.WriteBuffer(IDwav, 4); + wFileSize := 0; + StreamOut[x].FileBuffer.Data.WriteBuffer(wFileSize, 4); + IDwav := 'WAVE'; + StreamOut[x].FileBuffer.Data.WriteBuffer(IDwav, 4); + IDwav := 'fmt '; + StreamOut[x].FileBuffer.Data.WriteBuffer(IDwav, 4); + wChunkSize := SizeOf(Header); + StreamOut[x].FileBuffer.Data.WriteBuffer(wChunkSize, 4); + Header.wFormatTag := 1; + + Header.wChannels := StreamOut[x].FileBuffer.wChannels; + + Header.wSamplesPerSec := StreamOut[x].FileBuffer.wSamplesPerSec; + + Header.wBlockAlign := StreamOut[x].FileBuffer.wChannels * (StreamOut[x].FileBuffer. + wBitsPerSample Div 8); + + Header.wAvgBytesPerSec := StreamOut[x].FileBuffer.wSamplesPerSec * Header.wBlockAlign; + Header.wBitsPerSample := StreamOut[x].FileBuffer.wBitsPerSample; + Header.wcbSize := 0; + StreamOut[x].FileBuffer.Data.WriteBuffer(Header, SizeOf(Header)); + IDwav := 'data'; + StreamOut[x].FileBuffer.Data.WriteBuffer(IDwav, 4); + wChunkSize := 0; + StreamOut[x].FileBuffer.Data.WriteBuffer(wChunkSize, 4); + StreamOut[x].Data.Enabled := True; + + end; +end; + +function Tuos_Player.AddIntoMemoryBuffer(outmemory: PDArFloat): cint32; +// Add a Output into memory-bufffer +// outmemory : buffer to use to store memory buffer +// example : OutputIndex1 := AddIntoMemoryBuffer(bufmemory); + +var + x: integer; +begin + result := -1 ; + x := 0; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + StreamOut[x].Data.Enabled := false; + StreamOut[x].Data.TypePut := 3; + Streamout[x].Data.posmem := 0; + Streamout[x].BufferOut := outmemory; + StreamOut[x].Data.channels := 2; + StreamOut[x].Data.Wantframes := 65536 ; + StreamOut[x].Data.SampleFormat := 0; + StreamOut[x].Data.SampleRate := 44100 ; + SetLength(StreamOut[x].Data.Buffer,65536*2); + intobuf := true; + // to check, why ? + result := x; + StreamOut[x].Data.Enabled := True; +end; + +function Tuos_Player.AddIntoMemoryBuffer(outmemory: PDArFloat; SampleRate: CDouble; SampleFormat: + LongInt; + Channels: LongInt; FramesCount: LongInt): LongInt; +// Add a Output into Memory Buffer with parameters. +// outmemory : pointer of buffer to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (0:Float32) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 65536) + +var + x, ch, sr, sf, fr: integer; +begin + result := -1 ; + x := 0; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + StreamOut[x].Data.Enabled := false; + StreamOut[x].Data.TypePut := 3; + Streamout[x].Data.posmem := 0; + Streamout[x].BufferOut := outmemory; + if channels = -1 then ch := 2 + else ch := channels; + StreamOut[x].Data.channels := ch; + if SampleFormat = -1 then sf := 0 + else sf := SampleFormat; + StreamOut[x].Data.SampleFormat := sf; + if FramesCount = -1 then fr := 65536 + else fr := FramesCount; + StreamOut[x].Data.Wantframes := fr ; + if SampleRate = -1 then sr := 44100 + else sr := roundmath(SampleRate); + StreamOut[x].Data.SampleRate := sr ; + + SetLength(StreamOut[x].Data.Buffer,fr*ch); + intobuf := true; + // to check, why ? + result := x; + StreamOut[x].Data.Enabled := True; +end; + + {$IF DEFINED(portaudio)} +function Tuos_Player.AddIntoDevOut(Device: cint32; Latency: CDouble; + SampleRate: CDouble; Channels: cint32; SampleFormat: cint32 ; + FramesCount: cint32 ; ChunkCount: cint32): cint32; +// 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 (= 65536) +// ChunkCount : default : -1 (= 512) +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoDevOut(-1,-1,-1,-1,0,-1,-1); +var + x, x2, err: cint32; + +begin + result := -1 ; + + if device = -1 then + err := Pa_GetDefaultOutputDevice(); + if err = -1 then result := -2; + + if result <> -2 then + begin + x := 0; + err := -1; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + + StreamOut[x].Data.Enabled := false; + + {$IF DEFINED(portaudio)} + StreamOut[x].PAParam.hostApiSpecificStreamInfo := Nil; + if device = -1 then + StreamOut[x].PAParam.device := Pa_GetDefaultOutputDevice() + else + StreamOut[x].PAParam.device := device; + {$endif} + + if SampleRate = -1 then + StreamOut[x].Data.SampleRate := DefRate + else + StreamOut[x].Data.SampleRate := SampleRate; + + {$IF DEFINED(portaudio)} + + if Latency = -1 then + StreamOut[x].PAParam.SuggestedLatency := CDouble((Pa_GetDeviceInfo(StreamOut[x].PAParam. + device)^. defaultHighOutputLatency)) * 1 + else StreamOut[x].PAParam.SuggestedLatency := CDouble(Latency); + + + {$IF DEFINED(android)} + StreamOut[x].PAParam.SampleFormat := paFloat32; + {$else} + StreamOut[x].PAParam.SampleFormat := paInt16; + {$endif} + + case SampleFormat of + 0: StreamOut[x].PAParam.SampleFormat := paFloat32; + 1: StreamOut[x].PAParam.SampleFormat := paInt32; + 2: StreamOut[x].PAParam.SampleFormat := paInt16; + end; + {$endif} + + if SampleFormat = -1 then + StreamOut[x].Data.SampleFormat := 2 + else + StreamOut[x].Data.SampleFormat := SampleFormat; + + if Channels = -1 then + begin + {$IF DEFINED(portaudio)} + StreamOut[x].PAParam.channelCount := 2 ; + {$endif} + StreamOut[x].Data.Channels := 2 ; + end + else + begin + {$IF DEFINED(portaudio)} + StreamOut[x].PAParam.channelCount := CInt32(Channels); + {$endif} + StreamOut[x].Data.Channels := CInt32(Channels); + end; + + if FramesCount = -1 then StreamOut[x].Data.Wantframes := + + {$IF DEFINED(android)} + 1024 * 64 + else + {$else} + 65536 div StreamOut[x].Data.Channels + else + {$endif} + StreamOut[x].Data.Wantframes := FramesCount ; + + if ChunkCount = -1 then ChunkCount := 512; + + SetLength(StreamOut[x].Data.Buffer, StreamOut[x].Data.Wantframes*StreamOut[x].Data.Channels); + + x2 := 0 ; + while x2 < Length(StreamOut[x].Data.Buffer) do + begin + StreamOut[x].Data.Buffer[x2] := 0.0 ; + inc(x2); + end; + + StreamOut[x].Data.TypePut := 1; + + {$IF DEFINED(portaudio)} + err := Pa_OpenStream(@StreamOut[x].Data.HandleSt, Nil, @StreamOut[x].PAParam, CDouble( + StreamOut[x] + .Data.SampleRate), CULong(ChunkCount), paClipOff, Nil, Nil); + + +// err := Pa_OpenDefaultStream(@StreamOut[x].Data.HandleSt, 2, 2, paFloat32, DefRate, 512, nil, nil); + {$endif} + + StreamOut[x].LoopProc := Nil; + if err <> 0 then Result := -1 + else + begin + StreamOut[x].Data.Enabled := True; + Result := x; + end; + end + else Result := -1; +end; + + {$endif} + +{$IF DEFINED(webstream)} + +function Tuos_Player.AddFromURL(URL: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ; AudioFormat: cint32 ; + ICYon : boolean): cint32; +// Add a Input from Audio URL +// URL : URL of audio file + +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output +// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : default : -1 (4096) +// AudioFormat : default : -1 (mp3) (0: mp3, 1: opus, 2:aac) +// ICYon : ICY data on/off +// example : InputIndex := AddFromURL('http://someserver/somesound.mp3',-1,-1,-1,-1,-1, false); + +var + x, err, len, len2, i : cint32; + PipeBufferSize, totsamples : integer; + buffadd : tbytes; + samprat : cint32; + + {$IF DEFINED(mpg123)} + mpinfo: Tmpg123_frameinfo; + // BufferTag: array[1..128] of char; + // F: file; + // mpid3v2: Tmpg123_id3v2; + {$endif} + + {$IF DEFINED(opus)} + s: UTF8String; + j: Integer; + OpusTag: POpusTags; + LComment: PPAnsiChar; + LcommentLength: PInteger; + {$endif} + +begin + result := -1 ; + x := 0; + err := -1; + + SetLength(StreamIn, Length(StreamIn) + 1); + + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + + StreamIn[x].Data.Enabled := false; + + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + + {$IF DEFINED(fdkaac)} + if (AudioFormat = 2) + then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Begin fdkaac'); + {$endif} + + + PipeBufferSize := 1024 * 4; + + CreatePipeHandles(StreamIn[x].InHandle, StreamIn[x].OutHandle, PipeBufferSize); + + StreamIn[x].InPipe := TInputPipeStream.Create(StreamIn[x].InHandle); + StreamIn[x].OutPipe := TOutputPipeStream.Create(StreamIn[x].OutHandle); + + + + StreamIn[x].httpget := TThreadHttpGetter.Create(url, StreamIn[x].OutPipe); + + StreamIn[x].httpget.freeonterminate := true; + + StreamIn[x].httpget.ICYenabled := ICYon; + + //writeln('avant httpget.Start'); + StreamIn[x].httpget.Start; + // writeln('apres httpget.Start'); + + sleep(2000); + + if StreamIn[x].httpget.IsRunning then + begin + + if StreamIn[x].httpget.ICYenabled = true then + CheckSynchronize(1000); + + StreamIn[x].Data.HandleSt := aacDecoder_Open(TRANSPORT_TYPE.TT_MP4_ADTS, 1); + + if StreamIn[x].Data.HandleSt = nil then + begin + // writeln('NOT OK aacDecoder_Open()'); + exit; + end; + // else writeln('OK aacDecoder_Open()'); + + if (aacDecoder_SetParam(StreamIn[x].Data.HandleSt, AAC_CONCEAL_METHOD, 1) <> AAC_DECODER_ERROR + .AAC_DEC_OK) then + begin + // writeln('Unable to set the AAC_CONCEAL_METHOD'); + exit; + end; + + if (aacDecoder_SetParam(StreamIn[x].Data.HandleSt, AAC_PCM_LIMITER_ENABLE, 0) <> + AAC_DECODER_ERROR.AAC_DEC_OK) then + begin + // writeln('Unable to set the AAC_PCM_LIMITER_ENABLE'); + exit; + end; + + // writeln('FIN INIT ------------- AACDecDecode'); + + StreamIn[x].Data.LibOpen := 2; + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else StreamIn[x].Data.SampleFormat := SampleFormat; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 + else + StreamIn[x].Data.Wantframes := FramesCount ; + + StreamIn[x].Data.Channels := 2; + StreamIn[x].Data.samplerate := 44100; + StreamIn[x].Data.ratio := 2; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes * StreamIn[x].Data.channels); + + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := 0; + StreamIn[x].Data.TypePut := 2; + StreamIn[x].Data.seekable := false; + Err := 0; + + end else + begin + result := -1; + StreamIn[x].httpget.Terminate; + sleep(100); + StreamIn[x].inpipe.destroy; + StreamIn[x].outpipe.destroy; + end; + // writeln('----------- FIN add URL -------------' ); + + end; + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('ac StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + {$endif} + + ////////////////// end aac + + {$IF DEFINED(opus)} + if (AudioFormat = 1) + // or (AudioFormat = -1) + then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Begin opus test'); + {$endif} + + if FramesCount= -1 then + totsamples := 4096 + else + totsamples := FramesCount; + + PipeBufferSize := totsamples * sizeOf(Single); + // * 2 + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('totsamples: ' + inttostr(totsamples)); + WriteLn('PipeBufferSize: ' + inttostr(PipeBufferSize)); + {$endif} + + CreatePipeHandles(StreamIn[x].InHandle, StreamIn[x].OutHandle, PipeBufferSize); + StreamIn[x].InPipe := TInputPipeStream.Create(StreamIn[x].InHandle); + StreamIn[x].OutPipe := TOutputPipeStream.Create(StreamIn[x].OutHandle); + + StreamIn[x].httpget := TThreadHttpGetter.Create(url, StreamIn[x].OutPipe); + StreamIn[x].httpget.freeonterminate := true; + StreamIn[x].httpget.ICYenabled := false; + // TODO + + // StreamIn[x].httpget.FIsRunning := True; + + StreamIn[x].httpget.Start; + // WriteLn('StreamIn[x].httpget.Start'); + + sleep(2000); + + if StreamIn[x].httpget.IsRunning then + begin + + len := 1 ; + len2 := 0 ; + + setlength(buffadd, PipeBufferSize); + setlength(StreamIn[x].data.BufferTMP, PipeBufferSize); + + while (len2 < PipeBufferSize) and (len > 0) do + begin + len := StreamIn[x].InPipe.Read(buffadd[0],PipeBufferSize-len2); + if len > 0 then for i := 0 to len -1 do + StreamIn[x].data.BufferTMP[i+len2] := buffadd[i] ; + len2 := len2 + len; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('PipeBufferSize = ' + inttostr(PipeBufferSize)); + WriteLn('InPipe.Read = ' + inttostr(len2)); + WriteLn('----------------------------------'); + //writeln(tencoding.utf8.getstring(StreamIn[x].data.BufferTMP)); + {$endif} + + StreamIn[x].Data.HandleSt := pchar('opusurl'); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('StreamIn[x].Data.HandleSt url assisgned'); + {$endif} + + StreamIn[x].Data.HandleOP := + + +// op_open_callbacks(StreamIn[x].InPipe, uos_callbacks, StreamIn[x].data.BufferTMP[0], PipeBufferSize, err); + op_test_callbacks(StreamIn[x].InPipe, uos_callbacks, StreamIn[x]. + data.BufferTMP[0], PipeBufferSize, err); + // op_test_memory(StreamIn[x].data.BufferTMP[0],PipeBufferSize, Err); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('error: op_test_*: ' + inttostr(err)); + {$endif} + + if Err=0 + then + begin + Err := op_test_open(StreamIn[x].Data.HandleOP); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('error: op_test_open: ' + inttostr(err)); + {$endif} + + if (Err=0) and (op_link_count(StreamIn[x].Data.HandleOP)=1) + then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('OK open'); + {$endif} + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + //tag + + OpusTag := op_tags(StreamIn[x].Data.HandleOP, Nil); + + if OpusTag<>nil + + then + begin + + if OpusTag^.comments>0 + then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn((Format('OpusTag.comments = %d', [OpusTag^.comments]))); + {$endif} + LComment := OpusTag^.user_comments; + LcommentLength := OpusTag^.comment_lengths; + + for j := 0 to OpusTag^.comments - 1 do + begin + SetLength(s, LcommentLength^); + move(Pointer(LComment^)^, Pointer(s)^, LcommentLength^); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn(s); + {$endif} + if j = 1 then StreamIn[x].Data.title := s; + if j = 2 then StreamIn[x].Data.artist := s; + if j = 3 then StreamIn[x].Data.album := s; + if j = 4 then StreamIn[x].Data.date := s; + if j = 5 then StreamIn[x].Data.comment := s; + if j = 6 then StreamIn[x].Data.tag := s; + if j > 6 then StreamIn[x].Data.comment := StreamIn[x].Data.comment + ' ' + + s; + + inc(LComment); + inc(LcommentLength); + end; + end; + end; + + StreamIn[x].Data.Length := op_pcm_total(StreamIn[x].Data.HandleOP, Nil); + StreamIn[x].Data.filename := url; + StreamIn[x].Data.channels := op_channel_count(StreamIn[x].Data.HandleOP, Nil); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn((Format('op_bitrate = %d', [op_bitrate(StreamIn[x].Data.HandleOP, Nil)]))); + WriteLn('Length ' + inttostr(StreamIn[x].Data.Length)); + WriteLn('Data.Channels ' + inttostr(StreamIn[x].Data.channels)); + {$endif} + + StreamIn[x].Data.samplerate := 48000 ; + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.Wantframes := totsamples ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes); + + StreamIn[x].Data.LibOpen := 4; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.TypePut := 2; + StreamIn[x].Data.ratio := 1; + StreamIn[x].Data.seekable := false; + StreamIn[x].LoopProc := Nil; + StreamIn[x].Data.Enabled := True; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('End opus'); + {$endif} + + end; + end; + end else + begin + result := -1; + StreamIn[x].httpget.Terminate; + sleep(100); + StreamIn[x].inpipe.destroy; + StreamIn[x].outpipe.destroy; + end; + end; + {$endif} + + {$IF DEFINED(mpg123)} + if (StreamIn[x].Data.LibOpen = -1) and ((AudioFormat = 0) or (AudioFormat = -1)) then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Begin mpg123'); + {$endif} + + if FramesCount= -1 then + totsamples := $4000 + else + totsamples := FramesCount; + + PipeBufferSize := totsamples ; + + CreatePipeHandles(StreamIn[x].InHandle, StreamIn[x].OutHandle, PipeBufferSize); + + StreamIn[x].InPipe := TInputPipeStream.Create(StreamIn[x].InHandle); + StreamIn[x].OutPipe := TOutputPipeStream.Create(StreamIn[x].OutHandle); + + StreamIn[x].httpget := TThreadHttpGetter.Create(url, StreamIn[x].OutPipe); + + // if StreamIn[x].httpget = nil then writeln('httpget = NIL') else writeln('httpget = OK'); + + StreamIn[x].httpget.freeonterminate := true; + + StreamIn[x].httpget.ICYenabled := ICYon; + + if StreamIn[x].httpget.ICYenabled = true then + StreamIn[x].UpdateIcyMetaInterval ; + + StreamIn[x].httpget.Start; + + sleep(2000); + + if StreamIn[x].httpget.IsRunning then + begin + if StreamIn[x].httpget.ICYenabled = true then + CheckSynchronize(1000); + + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then writeln('===> mpg123_new => ok.') + else writeln('===> mpg123_new NOT ok.') ; + {$endif} + + if Err = 0 then + begin + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + mpg123_format_none(StreamIn[x].Data.HandleSt); + case StreamIn[x].Data.SampleFormat of + 0: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_FLOAT_32); + 1: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_SIGNED_32); + 2: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_SIGNED_16); + end; + + + +// mpg123_replace_reader_handle(StreamIn[x].Data.HandleSt, @mpg_read_stream, @mpg_seek_url, @mpg_close_stream); + mpg123_replace_reader_handle(StreamIn[x].Data.HandleSt, + @mpg_read_stream, @mpg_seek_url, Nil); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then writeln('===> mpg123_replace_reader_handle => ok.') ; + {$endif} + + Err := mpg123_open_handle(StreamIn[x].Data.HandleSt, Pointer(StreamIn[x].InPipe)); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then writeln('===> mpg123_open_handle => ok.') + else + writeln('===> mpg123_open_handle => NOT ok.') ; + {$endif} + + sleep(10); + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_open_handle all => ok.') + else + writeln('===> mpg123_open_handle all => NOT ok.'); + {$endif} + + if err = 0 then + begin + StreamIn[x].Data.filename := URL ; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 1024 + else + StreamIn[x].Data.Wantframes := FramesCount ; + + // StreamIn[x].Data.Wantframes := totsamples; + + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.TypePut := 2; + StreamIn[x].Data.seekable := false; + StreamIn[x].LoopProc := Nil; + + samprat := roundmath(StreamIn[x].Data.samplerate); + + Err := mpg123_getformat(StreamIn[x].Data.HandleSt, + samprat, StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_getformat => ok.') + else + writeln('===> mpg123_getformat => NOT ok.'); + {$endif} + + if err <> 0 then + begin + sleep(50); + samprat := roundmath(StreamIn[x].Data.samplerate); + + Err := mpg123_getformat(StreamIn[x].Data.HandleSt, + samprat, StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + + end; + if err = 0 then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('===> mpg123_getformat => ok'); + {$endif} + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + + StreamIn[x].Data.LibOpen := 1; + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + if StreamIn[x].Data.SampleFormat = 2 then + StreamIn[x].Data.ratio := sizeof(int16) + else + StreamIn[x].Data.ratio := sizeof(int32); + + mpg123_info(StreamIn[x].Data.HandleSt, MPinfo); + + // problems with mpg123 + // mpg123_id3(StreamIn[x].Data.HandleSt, mpid3v1, @mpid3v2); + // mpg123_icy(StreamIn[x].Data.HandleSt, pointer(icytext)); + + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.hdformat := MPinfo.layer; + StreamIn[x].Data.frames := MPinfo.framesize; + StreamIn[x].Data.Length := mpg123_length(StreamIn[x].Data.HandleSt); + + if StreamIn[x].Data.SampleFormat = 0 then + mpg123_param(StreamIn[x].Data.HandleSt, StreamIn[x].Data.Channels, + MPG123_FORCE_FLOAT, 0); + + StreamIn[x].Data.Enabled := True; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('===> mpg123_infos end => ok'); + {$endif} + + end; + end; + end else + begin + result := -1; + StreamIn[x].httpget.Terminate; + sleep(100); + StreamIn[x].inpipe.destroy; + StreamIn[x].outpipe.destroy; + end; + + end; + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before result ' + inttostr(result)); + WriteLn('error ' + inttostr(err)); + WriteLn('StreamIn[x].Data.LibOpen ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('Before Length(StreamIn) ' + inttostr(Length(StreamIn))); + {$endif} + sleep(10); + if StreamIn[x].Data.LibOpen = -1 then + begin + if err <> -133 then + begin + StreamIn[Length(StreamIn) - 1].Destroy; + setlength(StreamIn, Length(StreamIn) - 1); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('After Length(StreamIn) ' + inttostr(Length(StreamIn))); + WriteLn('Result: ' + inttostr(result)); + {$endif} + end; + + result := -1 + end + else + begin + StreamIn[x].Data.Enabled := True; + result := x ; + end; +end; + {$ENDIF} + +function Tuos_Player.AddFromMemoryBuffer(Var MemoryBuffer: TDArFloat; Var Bufferinfos: + Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// Add a input from memory buffer with custom parameters +// MemoryBuffer : the buffer +// Bufferinfos : infos of the buffer + +// 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 ';')// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)// SampleRate : delault : -1 (44100) +// FramesCount : default : -1 (65536 div Channels) +// result : Input Index in array -1 = error +// example : InputIndex1 := AddFromMemoryBuffer(mybuffer, buffinfos,-1,1024); + +var + x : cint32; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st: string; + i : cint32; + {$endif} +begin + + result := -1 ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('AddFromMemoryBuffer Before all.'); + writeln('length(MemoryBuffer) =' +inttostr(length(MemoryBuffer))); + st := ''; + for i := 0 to length(MemoryBuffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(MemoryBuffer[i]); + WriteLn(st); + {$endif} + + // writeln('length(MemoryBuffer) =' +inttostr(length(MemoryBuffer))); + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.typeput := 4; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + + +{ + setlength(StreamIn[x].Data.memorybuffer, length(MemoryBuffer)); + + writeln('length(Data.memorybuffer) =' +inttostr(length(StreamIn[x].Data.memorybuffer))); + + for i := 0 to length(MemoryBuffer) -1 do + StreamIn[x].Data.memorybuffer[i] := MemoryBuffer[i]; + } + + StreamIn[x].Data.memorybuffer := MemoryBuffer; + + sleep(50); + //TODO: it is necessary? + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('AddFromMemoryBuffer Before all.'); + writeln('length(MemoryBuffer) =' +inttostr(length(MemoryBuffer))); + st := ''; + for i := 0 to length(MemoryBuffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(StreamIn[x].Data.memorybuffer[i]); + WriteLn(st); + {$endif} + + StreamIn[x].Data.Length := length(MemoryBuffer); + StreamIn[x].Data.LibOpen := 0; + + StreamIn[x].Data.Channels := Bufferinfos.Channels; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 4096 + else + StreamIn[x].Data.Wantframes := FramesCount; + + StreamIn[x].Data.Samplerate := bufferinfos.SampleRate; + StreamIn[x].Data.SampleRateRoot := Bufferinfos.Samplerate; + StreamIn[x].Data.SampleFormat := Bufferinfos.SampleFormat; + StreamIn[x].Data.Filename := BufferInfos.Filename; + StreamIn[x].Data.Title := BufferInfos.Title; + StreamIn[x].Data.Copyright := BufferInfos.Copyright; + StreamIn[x].Data.Software := BufferInfos.Software; + StreamIn[x].Data.Artist := BufferInfos.Artist; + StreamIn[x].Data.Comment := BufferInfos.Comment; + StreamIn[x].Data.Date := BufferInfos.Date; + StreamIn[x].Data.Tag := BufferInfos.Tag; + StreamIn[x].Data.track := BufferInfos.track; + StreamIn[x].Data.Album := BufferInfos.Album; + StreamIn[x].Data.Genre := BufferInfos.Genre; + StreamIn[x].Data.HDFormat := BufferInfos.HDFormat; + StreamIn[x].Data.Sections := BufferInfos.Sections; + StreamIn[x].Data.Encoding := BufferInfos.Encoding; + StreamIn[x].Data.bitrate := BufferInfos.bitrate; + //StreamIn[x].Data.Length := BufferInfos.Length; + StreamIn[x].Data.LibOpen := 0; + StreamIn[x].Data.ratio := StreamIn[x].Data.Channels; + + StreamIn[x].Data.posmem := 0; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.seekable := true; + StreamIn[x].LoopProc := Nil; + setlength(StreamIn[x].Data.buffer,StreamIn[x].Data.wantframes*StreamIn[x].Data.Channels); + StreamIn[x].Data.Enabled := True; + result := x; +end; + +function Tuos_Player.AddFromFileIntoMemory(Filename: Pchar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32; numbuf : cint +): cint32; +// Add a input from audio file and store it into memory with custom parameters +// FileName : filename of audio file + +// 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 := AddFromFileIntoMemory(edit5.Text,-1,0,-1); +var + x, i : cint32; + bufferinfos: Tuos_bufferinfos; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st: string; + {$endif} + +begin + result := -1 ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('AddFromFileIntoMemory Before all.'); + {$endif} + + if fileexists(filename) then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before setlength.'); + {$endif} + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.typeput := 4; + StreamIn[x].Data.lastbuf := 0; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + // StreamIn[x].Data.wantframes := FramesCount; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Before Filetobuffer'); + {$endif} + + for i := 0 to length(tempoutmemory) -1 do + tempoutmemory[i] := 0.0; + + setlength(tempoutmemory, 0); + + Filetobuffer(Filename, -1, SampleFormat, FramesCount, tempoutmemory, bufferinfos, -1, numbuf); + sleep(50); + + setlength(StreamIn[x].Data.memorybuffer, length(tempoutmemory)); + for i := 0 to length(tempoutmemory) -1 do + StreamIn[x].Data.memorybuffer[i] := tempoutmemory [i]; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('After Filetobuffer'); + writeln('length(tempoutmemory) =' +inttostr(length(tempoutmemory))); + st := ''; + for i := 0 to length(tempoutmemory) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(tempoutmemory[i]); + WriteLn('OUTPUT DATA into portaudio------------------------------'); + WriteLn(st); + {$endif} + + StreamIn[x].Data.Length := tempLength; + StreamIn[x].Data.Samplerate := tempSamplerate; + StreamIn[x].Data.SampleFormat := tempSampleFormat; + StreamIn[x].Data.LibOpen := tempLibOpen; + StreamIn[x].Data.Channels := tempchan; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + StreamIn[x].Data.ratio := tempratio; + StreamIn[x].Data.posmem := 0; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.seekable := true; + StreamIn[x].LoopProc := Nil; + StreamIn[x].Data.Samplerate := bufferinfos.SampleRate; + StreamIn[x].Data.SampleRateRoot := Bufferinfos.Samplerate; + StreamIn[x].Data.SampleFormat := Bufferinfos.SampleFormat; + StreamIn[x].Data.Filename := BufferInfos.Filename; + StreamIn[x].Data.Title := BufferInfos.Title; + StreamIn[x].Data.Copyright := BufferInfos.Copyright; + StreamIn[x].Data.Software := BufferInfos.Software; + StreamIn[x].Data.Artist := BufferInfos.Artist; + StreamIn[x].Data.Comment := BufferInfos.Comment; + StreamIn[x].Data.Date := BufferInfos.Date; + StreamIn[x].Data.Tag := BufferInfos.Tag; + StreamIn[x].Data.Album := BufferInfos.Album; + StreamIn[x].Data.Genre := BufferInfos.Genre; + StreamIn[x].Data.track := BufferInfos.track; + StreamIn[x].Data.HDFormat := BufferInfos.HDFormat; + StreamIn[x].Data.Sections := BufferInfos.Sections; + StreamIn[x].Data.Encoding := BufferInfos.Encoding; + StreamIn[x].Data.bitrate := BufferInfos.bitrate; + StreamIn[x].Data.Length := BufferInfos.Length; + StreamIn[x].Data.LibOpen := 0; + StreamIn[x].Data.Ratio := 2 ; + + setlength(StreamIn[x].Data.buffer,StreamIn[x].Data.wantframes*StreamIn[x].Data.Channels); + StreamIn[x].Data.Enabled := True; + result := x; + end + else result := -2; + +end; + +{$IF DEFINED(sndfile)} +function m_get_filelen(pms: PMemoryStream): tuos_count_t; +cdecl; +begin + Result := pms^.Size; +end; + +function m_seek(offset: tuos_count_t; whence: cint32; pms: PMemoryStream): tuos_count_t; +cdecl; +const + SEEK_SET = 0; + SEEK_CUR = 1; + SEEK_END = 2; +begin + Result := 0 ; + case whence of + SEEK_SET: Result := pms^.Seek(offset, soFromBeginning); + SEEK_CUR: Result := pms^.Seek(offset, soFromCurrent); + SEEK_END: Result := pms^.Seek(offset, soFromEnd); + end; + +end; + +function m_read(Const buf: Pointer; count: Tuos_count_t; pms: PMemoryStream): Tuos_count_t; +cdecl; + +begin + Result := pms^.Read(buf^,count); +end; + +function m_write(Const buf: Pointer; count: Tuos_count_t; pms: PMemoryStream): Tuos_count_t; +cdecl; +begin + Result := pms^.Write(buf^,count); +end; + +function m_tell(pms: PMemoryStream): Tuos_count_t; +cdecl; +begin + Result := pms^.Position; +end; +{$endif} + +function Tuos_Player.AddIntoMemoryStream(Var MemoryStream: TMemoryStream; SampleRate: CDouble; + SampleFormat: LongInt ; Channels: LongInt; FramesCount: + LongInt; AudioFormat: cint32): LongInt; +// Add a Output into TMemoryStream +// MemoryStream : the TMemoryStream to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 4096) +// AudioFormat : default : -1 (wav) (0:wav, 1:ogg); + +var + x, ch, sr, sf, fr: integer; + {$IF DEFINED(sndfile)} + sfInfo: TSF_INFO; + sfVirtual: TSF_VIRTUAL; + {$endif} + +begin + result := -1 ; + x := 0; + SetLength(StreamOut, Length(StreamOut) + 1); + StreamOut[Length(StreamOut) - 1] := Tuos_OutStream.Create(); + x := Length(StreamOut) - 1; + StreamOut[x].Data.Enabled := false; + + if channels = -1 then ch := 2 + else ch := channels; + StreamOut[x].Data.channels := ch; + if SampleFormat = -1 then sf := 2 + else sf := SampleFormat; + StreamOut[x].Data.SampleFormat := sf; + if FramesCount = -1 then fr := 4096 + else fr := FramesCount; + StreamOut[x].Data.Wantframes := fr ; + if SampleRate = -1 then sr := 44100 + else sr := roundmath(SampleRate); + StreamOut[x].Data.SampleRate := sr ; + + SetLength(StreamOut[x].Data.Buffer, StreamOut[x].Data.Wantframes*StreamOut[x].Data.Channels); + + if MemoryStream = nil then + MemoryStream := Tmemorystream.create; + + Streamout[x].MemorySteamOut := MemoryStream; + + Streamout[x].Data.posmem := 0; + + StreamOut[x].Data.TypePut := 5; + + {$IF DEFINED(sndfile)} + with sfVirtual do + begin + sf_vio_get_filelen := @m_get_filelen; + seek := @m_seek; + read := @m_read; + write := @m_write; + tell := @m_tell; + end; + + if (AudioFormat = 0) then + sfInfo.format := SF_FORMAT_WAV Or SF_FORMAT_PCM_16; + if (AudioFormat = 1) then + sfInfo.format := SF_FORMAT_OGG Or SF_FORMAT_VORBIS; + + sfInfo.channels := StreamOut[x].Data.Channels; + sfInfo.frames := streamOut[x].Data.Wantframes; + SFinfo.samplerate := roundmath(StreamOut[x].Data.SampleRate); + SFinfo.seekable := 0; + StreamOut[x].Data.HandleSt := sf_open_virtual(@sfVirtual, SFM_WRITE, @sfInfo, + @StreamOut[x].MemorySteamOut); + {$endif} + result := x; + StreamOut[x].Data.Enabled := True; +end; + +function Tuos_Player.AddFromMemoryStreamDec(Var MemoryStream: TMemoryStream; Var Bufferinfos: + Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// MemoryStream : Memory-stream of decoded audio (like created by AddIntoMemoryStream) +// Bufferinfos : infos of the Memory-stream + +// 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 ';') +// FramesCount : default : -1 (4096) +// result : Input Index in array -1 = error +var + x : integer; +begin + result := -1 ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before all.'); + {$endif} + + if assigned(MemoryStream) then + begin + x := 0; + MemoryStream.Position := 0; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before setlength.'); + {$endif} + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.lastbuf := -1; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.TypePut := 6; + StreamIn[x].Data.seekable := True; + StreamIn[x].LoopProc := Nil; + + StreamIn[x].Data.Channels := Bufferinfos.Channels; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 4096 + else + StreamIn[x].Data.Wantframes := FramesCount; + + StreamIn[x].Data.Samplerate := bufferinfos.SampleRate; + StreamIn[x].Data.SampleRateRoot := Bufferinfos.Samplerate; + StreamIn[x].Data.SampleFormat := Bufferinfos.SampleFormat; + StreamIn[x].Data.Filename := BufferInfos.Filename; + StreamIn[x].Data.Title := BufferInfos.Title; + StreamIn[x].Data.Copyright := BufferInfos.Copyright; + StreamIn[x].Data.Software := BufferInfos.Software; + StreamIn[x].Data.Artist := BufferInfos.Artist; + StreamIn[x].Data.Comment := BufferInfos.Comment; + StreamIn[x].Data.Date := BufferInfos.Date; + StreamIn[x].Data.Tag := BufferInfos.Tag; + StreamIn[x].Data.Album := BufferInfos.Album; + StreamIn[x].Data.Track := BufferInfos.Track; + StreamIn[x].Data.Genre := BufferInfos.Genre; + StreamIn[x].Data.HDFormat := BufferInfos.HDFormat; + StreamIn[x].Data.Sections := BufferInfos.Sections; + StreamIn[x].Data.Encoding := BufferInfos.Encoding; + StreamIn[x].Data.bitrate := BufferInfos.bitrate; + //StreamIn[x].Data.Length := BufferInfos.Length; + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].Data.ratio := StreamIn[x].Data.Channels; + + StreamIn[x].Data.posmem := 0; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.seekable := false; + StreamIn[x].LoopProc := Nil; + streamIn[x].Data.ratio := StreamIn[x].Data.Channels; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + StreamIn[x].MemoryStreamDec := MemoryStream; + + + StreamIn[x].MemoryStreamDec.Position := 0; + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data.Channels); + + StreamIn[x].Data.Enabled := true; + result := x; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('length(StreamIn[x].MemoryStreamDec) = '+inttostr(StreamIn[x].MemoryStreamDec.size)) ; + writeln('length(MemoryStream) = '+inttostr(MemoryStream.size)) ; + WriteLn('Length(StreamIn) = '+ inttostr(x)); + {$endif} + end + else result := -1; + +end; + +function Tuos_Player.AddFromMemoryStream(Var MemoryStream: TMemoryStream; + TypeAudio: cint32; OutputIndex: cint32; SampleFormat: + cint32 ; FramesCount: cint32): cint32; +// MemoryStream : Memory stream of encoded audio file. + +// TypeAudio : default : -1 --> 0 (0: flac, ogg, wav; 1: mp3; 2:opus ; 3:decoded Tmemory-stream; 5:mod, it, xm, s3m) + +// 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 := AddFromMemoryStream(mymemorystream,-1,-1,0,1024); + +var + x, x2, err, len, len2, i : cint32; + PipeBufferSize, totsamples : integer; + buffadd : tbytes; + samprat : cint32; + + {$IF DEFINED(sndfile)} + sfInfo: TSF_INFO; + sfVirtual: TSF_VIRTUAL; + {$endif} + + {$IF DEFINED(opus)} + s: UTF8String; + j: Integer; + OpusTag: POpusTags; + LComment: PPAnsiChar; + LcommentLength: PInteger; + {$endif} + + {$IF DEFINED(mpg123)} + mpinfo: Tmpg123_frameinfo; + // problems with mpg123 + mpid3v1: PPmpg123_id3v1; + refmpid3v1: Tmpg123_id3v1; + mpid3v2: Tmpg123_id3v2; + {$endif} + + {$IF DEFINED(xmp)} + mi: xmp_module_info; + {$endif} + +begin + result := -1 ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before all.'); + {$endif} + + if assigned(MemoryStream) then + begin + x := 0; + MemoryStream.Position := 0; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before setlength.'); + {$endif} + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + err := -1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].Data.lastbuf := -1; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + StreamIn[x].data.MemoryStream := MemoryStream; + StreamIn[x].data.MemoryStream.Position := 0; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Length(StreamIn) = '+ inttostr(x)); + {$endif} + + {$IF DEFINED(sndfile)} + if ((TypeAudio = -1) or (TypeAudio = 0)) and (uosLoadResult.SFloadERROR = 0) then + begin + with sfVirtual do + begin + sf_vio_get_filelen := @m_get_filelen; + seek := @m_seek; + read := @m_read; + write := @m_write; + tell := @m_tell; + end; + + try + Streamin [x] .Data.HandleSt := sf_open_virtual(@sfVirtual, SFM_READ, @sfInfo, @StreamIn[ + x].Data.MemoryStream); + except + StreamIn[x].Data.HandleSt := Nil; + end; + (* try to open the file *) + if StreamIn[x].Data.HandleSt = nil then + begin + StreamIn[x].Data.LibOpen := -1; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open_virtual NOT OK'); + {$endif} + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open_virtual OK'); + {$endif} + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else StreamIn[x].Data.SampleFormat := SampleFormat; + + StreamIn[x].Data.LibOpen := 0; + StreamIn[x].Data.channels := SFinfo.channels; + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data.Channels); + + StreamIn[x].Data.hdformat := SFinfo.format; + StreamIn[x].Data.frames := SFinfo.frames; + StreamIn[x].Data.samplerate := SFinfo.samplerate; + StreamIn[x].Data.samplerateroot := SFinfo.samplerate; + StreamIn[x].Data.sections := SFinfo.sections; + StreamIn[x].Data.copyright := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_COPYRIGHT); + StreamIn[x].Data.software := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_SOFTWARE); + StreamIn[x].Data.comment := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_COMMENT); + StreamIn[x].Data.artist := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_ARTIST); + StreamIn[x].Data.title := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_TITLE); + StreamIn[x].Data.date := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_DATE); + StreamIn[x].Data.track := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_TRACKNUMBER); + StreamIn[x].Data.genre := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_GENRE); + StreamIn[x].Data.album := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_ALBUM); + + StreamIn[x].Data.Length := sfInfo.frames; + err := 0; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open END OK'); + {$endif} + end; + end; + {$endif} + + {$IF DEFINED(xmp)} + if ((StreamIn[x].Data.LibOpen = -1)) then + if ((TypeAudio = 5)) and (uosLoadResult.XMloadERROR = 0) then + begin + StreamIn[x].Data.HandleSt := xmp_create_context(); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if StreamIn[x].Data.HandleSt = nil then WriteLn(' xmp_create_context() NOT OK') + else WriteLn('xmp_create_context() OK'); + {$endif} + + + if xmp_load_module_from_memory(StreamIn[x].Data.HandleSt, + StreamIn[x].Data.MemoryStream.Memory, + StreamIn[x].Data.MemoryStream.size) <> 0 then + begin + StreamIn[x].Data.LibOpen := -1; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('xmp_load_module_from_memory NOT OK'); + {$endif} + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('xmp_load_module_from_memory OK'); + {$endif} + + xmp_start_player(StreamIn[x].Data.HandleSt, 44100, 0); + xmp_get_module_info(StreamIn[x].Data.HandleSt, mi); + // xmp_get_frame_info(StreamIn[x].Data.HandleSt , fi); + + StreamIn[x].Data.LibOpen := 5; + StreamIn[x].Data.channels := 2; + // todo + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + // Need conversion because xmp is always 16 bit + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data. + Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + + x2 := 0 ; + while x2 < Length(Streamin[x].Data.Buffer) do + begin + Streamin[x].Data.Buffer[x2] := 0.0 ; + inc(x2); + end; + + // StreamIn[x].Data.hdformat := SFinfo.format; + // StreamIn[x].Data.frames := SFinfo.frames; + StreamIn[x].Data.samplerate := 44100; + StreamIn[x].Data.samplerateroot := 44100; + // StreamIn[x].Data.sections := SFinfo.sections; + StreamIn[x].Data.title := String(mi.module^.Name); + + StreamIn[x].Data.copyright := ''; + StreamIn[x].Data.software := ''; + + StreamIn[x].Data.comment := String(mi.module^.typ); + StreamIn[x].Data.artist := String(mi.comment); + StreamIn[x].Data.date := ''; + + StreamIn[x].Data.track := ''; + StreamIn[x].Data.genre := ''; + StreamIn[x].Data.album := ''; + + StreamIn[x].Data.Length := 0; + + err := 0; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('XMP_open END OK'); + {$endif} + + end; + end; + {$endif} + + {$IF DEFINED(mpg123)} + // mpg123 + if (((TypeAudio = 1) and (StreamIn[x].Data.LibOpen = -1) + and (uosLoadResult.MPloadERROR = 0))) then + begin + Err := -1; + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err); + + if Err = 0 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('mpg123_new OK'); + {$endif} + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else StreamIn[x].Data.SampleFormat := + SampleFormat + ; + mpg123_format_none(StreamIn[x].Data.HandleSt); + + case StreamIn[x].Data.SampleFormat of + 0: mpg123_format(StreamIn[x].Data.HandleSt, + DefRate, Stereo, + MPG123_ENC_FLOAT_32); + 1: mpg123_format(StreamIn[x].Data.HandleSt, + DefRate, Stereo, + MPG123_ENC_SIGNED_32); + 2: mpg123_format(StreamIn[x].Data.HandleSt, + DefRate, Stereo, + MPG123_ENC_SIGNED_16); + end; + + err := mpg123_replace_reader_handle(StreamIn[x]. + Data.HandleSt, @mpg_read_stream, @ + mpg_seek_stream, Nil); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln( + '===> mpg123_replace_reader_handle => ok.') + else writeln( + '===> mpg123_replace_reader_handle => NOT OK.'); + {$endif} + + Err := mpg123_open_handle(StreamIn[x].Data. + HandleSt, pointer(StreamIn[x].Data. + MemoryStream)); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_open_handle => ok.') + else + writeln('===> mpg123_open_handle => NOT ok.'); + {$endif} + + sleep(10); + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + + samprat := roundmath(StreamIn[x].Data.samplerate); + + if Err = 0 then Err := mpg123_getformat(StreamIn[x]. + Data.HandleSt, + samprat, + StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_getformat => ok.') + else writeln('===> mpg123_getformat => NOT ok.') ; + {$endif} + + if Err = 0 then + begin + mpg123_close(StreamIn[x].Data.HandleSt); + mpg123_delete(StreamIn[x].Data.HandleSt); + + // Close handle and reload with forced resolution + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err + ); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_open_handle => ok.') + else writeln( + '===> mpg123_open_handle => NOT ok.') ; + {$endif} + StreamIn[x].Data.HandleSt := Nil; + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err); + + mpg123_format_none(StreamIn[x].Data.HandleSt); + + samprat := roundmath(StreamIn[x].Data.samplerate); + + + case StreamIn[x].Data.SampleFormat of + 0: mpg123_format(StreamIn[x].Data.HandleSt, + samprat, + StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + 1: mpg123_format(StreamIn[x].Data.HandleSt, + samprat, + StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + 2: mpg123_format(StreamIn[x].Data.HandleSt, + samprat, + StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + end; + + err := mpg123_replace_reader_handle(StreamIn[x]. + Data.HandleSt, @mpg_read_stream, @mpg_seek_stream, Nil); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = 0 then + writeln('===> mpg123_replace_reader_handle => ok.') + else writeln('===> mpg123_replace_reader_handle => NOT OK.'); + {$endif} + + Err := mpg123_open_handle(StreamIn[x].Data. + HandleSt, pointer(StreamIn[x].Data. + MemoryStream)); + + samprat := roundmath(StreamIn[x].Data.samplerate); + + mpg123_getformat(StreamIn[x].Data.HandleSt, + samprat, + StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div + StreamIn[x]. + Data.Channels + else StreamIn[x].Data.Wantframes := FramesCount; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x]. + Data.Wantframes*StreamIn[x].Data. + Channels); + mpg123_info(StreamIn[x].Data.HandleSt, MPinfo); + + + // problems with mpg123 library + mpg123_id3(StreamIn[x].Data.HandleSt, @mpid3v1, @mpid3v2); + // to do : add id2v2 + if (mpid3v1 <> nil) and (mpid3v1^ <> nil) then + begin + refmpid3v1 := mpid3v1^^; + StreamIn[x].Data.title := trim(refmpid3v1.title); + StreamIn[x].Data.artist := refmpid3v1.artist; + StreamIn[x].Data.album := refmpid3v1.album; + StreamIn[x].Data.date := refmpid3v1.year; + StreamIn[x].Data.comment := refmpid3v1.comment; + //StreamIn[x].Data.track := refmpid3v1.comment; + StreamIn[x].Data.tag := refmpid3v1.tag; + StreamIn[x].Data.genre := inttostr(refmpid3v1.genre); + end; + + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.hdformat := MPinfo.layer; + StreamIn[x].Data.frames := MPinfo.framesize; + + if StreamIn[x].Data.SampleFormat = 0 then + mpg123_param(StreamIn[x].Data.HandleSt, + StreamIn[x].Data.Channels, + MPG123_FORCE_FLOAT, 0); + + StreamIn[x].Data.LibOpen := 1; + StreamIn[x].Data.Length := mpg123_length(StreamIn[x].Data.HandleSt); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('StreamIn[x].Data.Length = ' + inttostr( + mpg123_length(StreamIn[x].Data.HandleSt)); + writeln('StreamIn[x].Data.frames = ' + inttostr( + StreamIn[x].Data.frames)); + writeln('END StreamIn[x].Data.samplerate = ' + + inttostr(roundmath(StreamIn[x].Data.samplerate))); + writeln('END StreamIn[x].Data.channels = ' + + inttostr(StreamIn[x].Data.channels)); + {$endif} + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + end; + {$endif} + + {$IF DEFINED(opus)} + if ((TypeAudio = 2) and (StreamIn[x].Data.LibOpen = -1) and + (uosLoadResult.OPloadERROR = 0)) + + then + begin + Err := -1; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before Opus'); + {$endif} + + StreamIn[x].Data.HandleSt := pchar('opus'); + + if FramesCount= -1 then + totsamples := 4096 + else totsamples := FramesCount; + + PipeBufferSize := StreamIn[x].Data.MemoryStream.size; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('totsamples: ' + inttostr(totsamples)); + WriteLn('PipeBufferSize: ' + inttostr(PipeBufferSize)); + {$endif} + + len := 1 ; + len2 := 0 ; + + setlength(buffadd, PipeBufferSize); + setlength(StreamIn[x].data.BufferTMP, PipeBufferSize); + + while (len2 < PipeBufferSize) and (len > 0) do + begin + len := StreamIn[x].Data.MemoryStream.Read(buffadd[0],PipeBufferSize-len2); + + if len > 0 then + for i := 0 to len -1 do + StreamIn[x].data.BufferTMP[i+len2] := buffadd[i] ; + len2 := len2 + len; + end; + + // memory stream not needed anymore ---> converted into buffer + freeandnil(StreamIn[x].Data.MemoryStream); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('PipeBufferSize = ' + inttostr(PipeBufferSize)); + WriteLn('Data.MemoryStream.Read = ' + inttostr(len2)); + WriteLn('----------------------------------'); + //writeln(tencoding.utf8.getstring(StreamIn[x].data.BufferTMP)); + {$endif} + + StreamIn[x].Data.HandleSt := pchar('opusstream'); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('StreamIn[x].Data.HandleSt assisgned'); + {$endif} + + // Can not make work... + + +// StreamIn[x].Data.HandleOP := op_test_callbacks(StreamIn[x].data.MemoryStream, uos_callbacksms, StreamIn[x].data.BufferTMP[0], PipeBufferSize, err); + + // this is a memorystream converted into a buffer, it works... + StreamIn[x].Data.HandleOP := op_test_memory(StreamIn[x].data.BufferTMP[0],PipeBufferSize, Err); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('op_test_file error = '+ inttostr(Err)); + {$endif} + + if Err=0 then + begin + Err := op_test_open(StreamIn[x].Data.HandleOP); + if (Err=0) and (op_link_count(StreamIn[x].Data.HandleOP)=1) then + begin + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else StreamIn[x].Data.SampleFormat := SampleFormat; + + //tag + OpusTag := op_tags(StreamIn[x].Data.HandleOP, Nil); + + if OpusTag<>nil then + begin + if OpusTag^.comments>0 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn((Format('OpusTag.comments = %d', [OpusTag^.comments]))); + {$endif} + LComment := OpusTag^.user_comments; + LcommentLength := OpusTag^.comment_lengths; + for j := 0 to OpusTag^.comments - 1 do + begin + SetLength(s, LcommentLength^); + move(Pointer(LComment^)^, Pointer(s)^, LcommentLength^); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + // WriteLn(s); + {$endif} + + if j = 1 then StreamIn[x].Data.title := s; + if j = 2 then StreamIn[x].Data.artist := s; + if j = 3 then StreamIn[x].Data.album := s; + if j = 4 then StreamIn[x].Data.date := s; + if j = 5 then StreamIn[x].Data.comment := s; + if j = 6 then StreamIn[x].Data.tag := s; + + inc(LComment); + inc(LcommentLength); + end; + end; + end; + // WriteLn((Format('op_bitrate = %d', [op_bitrate(StreamIn[x].Data.HandleOP, nil)]))); + + StreamIn[x].Data.Length := op_pcm_total(StreamIn[x].Data.HandleOP, Nil); + StreamIn[x].Data.channels := op_channel_count(StreamIn[x].Data.HandleOP, Nil); + StreamIn[x].Data.bitrate := op_bitrate(StreamIn[x].Data.HandleOP, Nil); + + // opus use constant sample rate 48k + StreamIn[x].Data.samplerate := 48000 ; + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.Seekable := true; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 4096 * StreamIn[x].Data.Channels + else StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, + StreamIn[x].Data.Wantframes*StreamIn[x].Data.Channels); + + StreamIn[x].Data.LibOpen := 4; + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + end; + end; + {$endif} + + {$IF DEFINED(neaac)} + if (StreamIn[x].Data.LibOpen = -1) and (uosLoadResult.AAloadERROR = 0) then + begin + Err := -1; + + StreamIn[x].AACI := TAACInfo.Create(); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('TAACInfo.Create() = ok'); + {$endif} + { + Case SampleFormat of + 0 : StreamIn[x].AACI:= MP4OpenFile(FileName, FAAD_FMT_FLOAT); + 1 : StreamIn[x].AACI:= MP4OpenFile(FileName, FAAD_FMT_32BIT); + 2 : StreamIn[x].AACI:= MP4OpenFile(FileName, FAAD_FMT_16BIT); + End; + } + if StreamIn[x].AACI <> nil then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('MP4OpenFile() = ok'); + {$endif} + + case StreamIn[x].AACI.outputFormat of + FAAD_FMT_16BIT : StreamIn[x].Data.SampleFormat := 2; + //FAAD_FMT_24BIT : ; + FAAD_FMT_32BIT : StreamIn[x].Data.SampleFormat := 1; + FAAD_FMT_FLOAT : StreamIn[x].Data.SampleFormat := 0; + //FAAD_FMT_DOUBLE: ; + end; + + // StreamIn[x].Data.filename := FileName; + + StreamIn[x].Data.HandleSt := StreamIn[x].AACI.hMP4; + + StreamIn[x].Data.samplerate := StreamIn[x].AACI.SampleRate; + StreamIn[x].Data.channels := StreamIn[x].AACI.Channels; + + case StreamIn[x].AACI.outputFormat of + FAAD_FMT_16BIT : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_16; + //FAAD_FMT_24BIT : ; + FAAD_FMT_32BIT : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_32; + FAAD_FMT_FLOAT : StreamIn[x].Data.encoding := MPG123_ENC_FLOAT_32; + //FAAD_FMT_DOUBLE: ; + end; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes * StreamIn[x].Data.Channels + ); + + StreamIn[x].Data.title := StreamIn[x].AACI.Title; + StreamIn[x].Data.artist := StreamIn[x].AACI.Artist; + StreamIn[x].Data.album := StreamIn[x].AACI.Album; + StreamIn[x].Data.date := StreamIn[x].AACI.Date; + StreamIn[x].Data.comment := StreamIn[x].AACI.Comment; + StreamIn[x].Data.tag[0] := #0; + StreamIn[x].Data.tag[1] := #0; + StreamIn[x].Data.tag[2] := #0; + StreamIn[x].Data.genre := StreamIn[x].AACI.Genre; + StreamIn[x].Data.samplerateroot := StreamIn[x].AACI.SampleRate; + StreamIn[x].Data.hdformat := 0; + StreamIn[x].Data.frames := 0; + StreamIn[x].Data.Length := StreamIn[x].AACI.TotalSamples; + + StreamIn[x].Data.Seekable := StreamIn[x].AACI.Size > 0; + + StreamIn[x].Data.LibOpen := 2 ; + Err := 0; + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('MP4OpenFile() NOT ok'); + {$endif} + end; + + end; + {$endif} + + {$IF DEFINED(cdrom)} + if (StreamIn[x].Data.LibOpen = -1) then + begin + Err := -1; + StreamIn[x].pCD := Nil; + + case SampleFormat of + 2 : StreamIn[x].pCD := CDROM_OpenFile(StreamIn[x].Data.FileName); + end; + + if StreamIn[x].pCD <> nil then + begin + case StreamIn[x].pCD^.BitsPerSample of + 16 : StreamIn[x].Data.SampleFormat := 2; + end; + + StreamIn[x].Data.HandleSt := @StreamIn[x].pCD; + // Uos requires an assigned pointer.... + + StreamIn[x].Data.samplerate := StreamIn[x].pCD^.SampleRate; + StreamIn[x].Data.channels := StreamIn[x].pCD^.Channels; + + case StreamIn[x].pCD^.BitsPerSample of + 16 : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_16; + end; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else StreamIn[x].Data.Wantframes := FramesCount; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes * StreamIn[x].Data.Channels + ); + + StreamIn[x].Data.title := ''; + StreamIn[x].Data.artist := ''; + StreamIn[x].Data.album := ''; + StreamIn[x].Data.date := ''; + StreamIn[x].Data.comment := ''; + StreamIn[x].Data.tag[0] := #0; + StreamIn[x].Data.tag[1] := #0; + StreamIn[x].Data.tag[2] := #0; + StreamIn[x].Data.genre := 0; + StreamIn[x].Data.samplerateroot := StreamIn[x].pCD^.SampleRate; + StreamIn[x].Data.hdformat := 0; + StreamIn[x].Data.frames := 0; + StreamIn[x].Data.Length := StreamIn[x].pCD^.TotalSamples; + + StreamIn[x].Data.LibOpen := 3; + Err := 0; + end; + end; + {$endif} + + if err <> 0 then + begin + result := -1 ; + StreamIn[Length(StreamIn) - 1].Destroy; + setlength(StreamIn, Length(StreamIn) - 1); + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('addfrom memorystream OK'); + {$endif} + Result := x; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.TypePut := 0; + StreamIn[x].Data.seekable := True; + StreamIn[x].LoopProc := Nil; + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else StreamIn[x].Data.SampleFormat := SampleFormat; + + + case StreamIn[x].Data.LibOpen of + -1: ; + {$IF DEFINED(sndfile)} + 0: StreamIn[x].Data.ratio := StreamIn[x].Data.Channels; + {$endif} + {$IF DEFINED(mpg123)} + 1: + begin + if StreamIn[x].Data.SampleFormat = 2 then + StreamIn[x].Data.ratio := streamIn[x].Data.Channels + else StreamIn[x].Data.ratio := 2 * streamIn[x].Data.Channels; + + if StreamIn[x].Data.SampleFormat = 0 then + mpg123_param(StreamIn[x].Data.HandleSt, StreamIn[x].Data.Channels, MPG123_FORCE_FLOAT + , 0); + end; + {$endif} + {$IF DEFINED(neaac)} + 2 : StreamIn[x].Data.ratio := streamIn[x].AACI.Channels; + {$endif} + {$IF DEFINED(cdrom)} + 3 : StreamIn[x].Data.ratio := streamIn[x].pCD^.Channels; + {$endif} + {$IF DEFINED(opus)} + 4 : StreamIn[x].Data.ratio := streamIn[x].Data.Channels; + {$endif} + {$IF DEFINED(xmp)} + 5 : StreamIn[x].Data.ratio := streamIn[x].Data.Channels; + {$endif} + end; + + StreamIn[x].Data.Enabled := True; + end; +end; +end; + +function Tuos_Player.AddFromFile(Filename: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ): cint32; +// Add a Input from Audio file with Custom parameters +// FileName : filename of audio file + +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output +// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : default : -1 (65536 div channels) +// example : InputIndex := AddFromFile('/usr/home/test.ogg',-1,-1,-1); +var + x, x2, err: cint32; + + samprat : integer; + + {$IF DEFINED(sndfile)} + sfInfo: TSF_INFO; + {$endif} + + {$IF DEFINED(opus)} + s: UTF8String; + j: Integer; + OpusTag: POpusTags; + LComment: PPAnsiChar; + LcommentLength: PInteger; + {$endif} + + {$IF DEFINED(xmp)} + mi: xmp_module_info; + {$endif} + + {$IF DEFINED(mpg123)} + mpinfo: Tmpg123_frameinfo; + BufferTag: array[1..128] of char; + F: file; + // problems with mpg123 + // mpid3v2: Tmpg123_id3v2; + {$endif} + +begin + result := -1 ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before all.'); + {$endif} + + if fileexists(filename) then + begin + x := 0; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before setlength.'); + {$endif} + + SetLength(StreamIn, Length(StreamIn) + 1); + StreamIn[Length(StreamIn) - 1] := Tuos_InStream.Create; + x := Length(StreamIn) - 1; + err := -1; + StreamIn[x].Data.Enabled := false; + StreamIn[x].Data.LibOpen := -1; + StreamIn[x].Data.levelEnable := 0; + StreamIn[x].Data.positionEnable := 0; + StreamIn[x].Data.levelArrayEnable := 0; + StreamIn[x].Data.lastbuf := 0; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Length(StreamIn) = '+ inttostr(x)); + {$endif} + + {$IF DEFINED(sndfile)} + if (uosLoadResult.SFloadERROR = 0) then + begin + + StreamIn[x].Data.HandleSt := sf_open(FileName, SFM_READ, sfInfo); + + (* try to open the file *) + if StreamIn[x].Data.HandleSt = nil then + begin + StreamIn[x].Data.LibOpen := -1; + err := -1; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open NOT OK'); + {$endif} + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open OK'); + {$endif} + StreamIn[x].Data.LibOpen := 0; + StreamIn[x].Data.filename := FileName; + StreamIn[x].Data.channels := SFinfo.channels; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data. + Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + x2 := 0 ; + while x2 < Length(Streamin[x].Data.Buffer) do + begin + Streamin[x].Data.Buffer[x2] := 0.0 ; + inc(x2); + end; + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + StreamIn[x].Data.hdformat := SFinfo.format; + StreamIn[x].Data.frames := SFinfo.frames; + StreamIn[x].Data.samplerate := SFinfo.samplerate; + StreamIn[x].Data.samplerateroot := SFinfo.samplerate; + StreamIn[x].Data.sections := SFinfo.sections; + StreamIn[x].Data.title := + sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_TITLE); + StreamIn[x].Data.copyright := + sf_get_string(StreamIn[x].Data.HandleSt, + SF_STR_COPYRIGHT); + StreamIn[x].Data.software := + sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_SOFTWARE) + ; + StreamIn[x].Data.comment := + sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_COMMENT); + StreamIn[x].Data.artist := + sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_ARTIST); + StreamIn[x].Data.date := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_DATE); + + StreamIn[x].Data.track := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_TRACKNUMBER); + StreamIn[x].Data.genre := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_GENRE); + StreamIn[x].Data.album := sf_get_string(StreamIn[x].Data.HandleSt, SF_STR_ALBUM); + + StreamIn[x].Data.Length := sfInfo.frames; + err := 0; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf_open END OK'); + {$endif} + end; + end; + + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('sf StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('sf err = ' + inttostr(err)); + {$endif} + + // XMP + {$IF DEFINED(xmp)} + if (StreamIn[x].Data.LibOpen = -1) and (uosLoadResult.XMloadERROR = 0) then + begin + Err := -1; + + StreamIn[x].Data.HandleSt := xmp_create_context(); + {$IF DEFINED(uos_debug) and DEFINED(unix)} + if StreamIn[x].Data.HandleSt = nil then WriteLn(' xmp_create_context() NOT OK') + else WriteLn(' xmp_create_context() OK'); + {$endif} + + if xmp_load_module(StreamIn[x].Data.HandleSt, PChar(FileName)) <> 0 then + begin + StreamIn[x].Data.LibOpen := -1; + err := -1; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('xmp_load_module NOT OK'); + {$endif} + end + else + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('xmp_load_module() = ok'); + {$endif} + xmp_start_player(StreamIn[x].Data.HandleSt, 44100, 0); + xmp_get_module_info(StreamIn[x].Data.HandleSt, mi); + // xmp_get_frame_info(StreamIn[x].Data.HandleSt , fi); + + StreamIn[x].Data.LibOpen := 5; + StreamIn[x].Data.filename := FileName; + StreamIn[x].Data.channels := 2; + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + // Need conversion because xmp is always 16 bit + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data. + Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + x2 := 0 ; + while x2 < Length(Streamin[x].Data.Buffer) do + begin + Streamin[x].Data.Buffer[x2] := 0.0 ; + inc(x2); + end; + + StreamIn[x].Data.hdformat := 0; + StreamIn[x].Data.frames := 0; + StreamIn[x].Data.samplerate := 44100; + StreamIn[x].Data.samplerateroot := 44100; + // StreamIn[x].Data.sections := SFinfo.sections; + StreamIn[x].Data.title := String(mi.module^.Name); + + StreamIn[x].Data.copyright := ''; + StreamIn[x].Data.software := ''; + + StreamIn[x].Data.comment := String(mi.module^.typ); + StreamIn[x].Data.artist := String(mi.comment); + StreamIn[x].Data.date := ''; + + StreamIn[x].Data.track := ''; + StreamIn[x].Data.genre := ''; + StreamIn[x].Data.album := ''; + + StreamIn[x].Data.Length := 0; + + err := 0; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('XMP_open END OK'); + {$endif} + end; + end; + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('XMP StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('XMP err = ' + inttostr(err)); + {$endif} + + {$IF DEFINED(mpg123)} + if ((StreamIn[x].Data.LibOpen = -1)) and (uosLoadResult.MPloadERROR = 0) then + begin + Err := -1; + + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err); + + if Err = 0 then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('mpg123_new OK'); + {$endif} + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + mpg123_format_none(StreamIn[x].Data.HandleSt); + case StreamIn[x].Data.SampleFormat of + 0: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_FLOAT_32); + 1: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_SIGNED_32); + 2: mpg123_format(StreamIn[x].Data.HandleSt, DefRate, Stereo, + MPG123_ENC_SIGNED_16); + end; + + Err := mpg123_open(StreamIn[x].Data.HandleSt, PChar(FileName)); + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + + samprat := roundmath(StreamIn[x].Data.samplerate); + + if Err = 0 then + Err := mpg123_getformat(StreamIn[x].Data.HandleSt, + samprat, StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + + if Err = 0 then + begin + // Close handle and reload with forced resolution + mpg123_close(StreamIn[x].Data.HandleSt); + mpg123_delete(StreamIn[x].Data.HandleSt); + StreamIn[x].Data.HandleSt := mpg123_new(Nil, Err); + + mpg123_format_none(StreamIn[x].Data.HandleSt); + case StreamIn[x].Data.SampleFormat of + 0: mpg123_format(StreamIn[x].Data.HandleSt, samprat, + StreamIn[x].Data.channels, StreamIn[x].Data.encoding); + 1: mpg123_format(StreamIn[x].Data.HandleSt, samprat, + StreamIn[x].Data.channels, StreamIn[x].Data.encoding); + 2: mpg123_format(StreamIn[x].Data.HandleSt, samprat, + StreamIn[x].Data.channels, StreamIn[x].Data.encoding); + end; + mpg123_open(StreamIn[x].Data.HandleSt, (PChar(FileName))); + mpg123_getformat(StreamIn[x].Data.HandleSt, + samprat, StreamIn[x].Data.channels, + StreamIn[x].Data.encoding); + StreamIn[x].Data.filename := filename; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := + 65536 Div StreamIn[x].Data. + Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + + mpg123_info(StreamIn[x].Data.HandleSt, MPinfo); + + // custom code for reading ID3Tag ---> problems with mpg123_id3() + + AssignFile(F, Filename); + + FileMode := fmOpenRead + fmShareDenyNone; + + Reset(F, 1); + Seek(F, FileSize(F) - 128); + BlockRead(F, BufferTag, SizeOf(BufferTag)); + CloseFile(F); + + StreamIn[x].Data.tag := copy(BufferTag, 1, 3); + StreamIn[x].Data.title := copy(BufferTag, 4, 30); + StreamIn[x].Data.artist := copy(BufferTag, 34, 30); + StreamIn[x].Data.album := copy(BufferTag, 64, 30); + StreamIn[x].Data.date := copy(BufferTag, 94, 4); + StreamIn[x].Data.comment := copy(BufferTag, 98, 30); + StreamIn[x].Data.track := inttostr(ord(BufferTag[127])); + StreamIn[x].Data.genre := inttostr(ord(BufferTag[128])); + + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.hdformat := MPinfo.layer; + StreamIn[x].Data.frames := MPinfo.framesize; + StreamIn[x].Data.Length := mpg123_length(StreamIn[x].Data.HandleSt); + StreamIn[x].Data.LibOpen := 1; + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + end; + + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('mp StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('mp err = ' + inttostr(err)); + {$endif} + + {$IF DEFINED(opus)} + if (StreamIn[x].Data.LibOpen = -1) and (uosLoadResult.OPloadERROR = 0) then + begin + Err := -1; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before Opus'); + {$endif} + + StreamIn[x].Data.HandleSt := pchar('opus'); + StreamIn[x].Data.HandleOP := op_test_file(PChar(FileName), Err); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('op_test_file error = '+ inttostr(Err)); + {$endif} + + if Err=0 + then + begin + Err := op_test_open(StreamIn[x].Data.HandleOP); + if (Err=0) and (op_link_count(StreamIn[x].Data.HandleOP)=1) + then + begin + + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + //tag + + OpusTag := op_tags(StreamIn[x].Data.HandleOP, Nil); + + if OpusTag<>nil + + then + begin + + if OpusTag^.comments>0 + then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn((Format('OpusTag.comments = %d', [OpusTag^.comments]))); + {$endif} + LComment := OpusTag^.user_comments; + LcommentLength := OpusTag^.comment_lengths; + for j := 0 to OpusTag^.comments - 1 do + begin + SetLength(s, LcommentLength^); + move(Pointer(LComment^)^, Pointer(s)^, LcommentLength^); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + // WriteLn(s); + {$endif} + + if j = 1 then StreamIn[x].Data.title := s; + if j = 2 then StreamIn[x].Data.artist := s; + if j = 3 then StreamIn[x].Data.album := s; + if j = 4 then StreamIn[x].Data.date := s; + if j = 5 then StreamIn[x].Data.comment := s; + if j = 6 then StreamIn[x].Data.tag := s; + + inc(LComment); + inc(LcommentLength); + end; + end; + end; + + + // WriteLn((Format('op_bitrate = %d', [op_bitrate(StreamIn[x].Data.HandleOP, nil)]))); + + StreamIn[x].Data.Length := op_pcm_total(StreamIn[x].Data.HandleOP, Nil); + StreamIn[x].Data.filename := FileName; + StreamIn[x].Data.channels := op_channel_count(StreamIn[x].Data.HandleOP, Nil); + + // opus use constant sample rate 48k + StreamIn[x].Data.samplerate := 48000 ; + StreamIn[x].Data.samplerateroot := StreamIn[x].Data.samplerate ; + StreamIn[x].Data.Seekable := true; + + if FramesCount = -1 then StreamIn[x].Data.Wantframes := 4096 * StreamIn[x].Data. + Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes*StreamIn[x].Data. + Channels); + + StreamIn[x].Data.LibOpen := 4; + + end + else + begin + StreamIn[x].Data.LibOpen := -1; + end; + end; + end; +{$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('op StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('op err = ' + inttostr(err)); + {$endif} + + {$IF DEFINED(neaac)} + if (StreamIn[x].Data.LibOpen = -1) and (uosLoadResult.AAloadERROR = 0) then + begin + Err := -1; + + StreamIn[x].AACI := TAACInfo.Create(); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('TAACInfo.Create() = ok'); + {$endif} + + case SampleFormat of + 0 : StreamIn[x].AACI := MP4OpenFile(FileName, FAAD_FMT_FLOAT); + 1 : StreamIn[x].AACI := MP4OpenFile(FileName, FAAD_FMT_32BIT); + 2 : StreamIn[x].AACI := MP4OpenFile(FileName, FAAD_FMT_16BIT); + end; + + if StreamIn[x].AACI <> nil then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('MP4OpenFile() = ok'); + {$endif} + + case StreamIn[x].AACI.outputFormat of + FAAD_FMT_16BIT : StreamIn[x].Data.SampleFormat := 2; + //FAAD_FMT_24BIT : ; + FAAD_FMT_32BIT : StreamIn[x].Data.SampleFormat := 1; + FAAD_FMT_FLOAT : StreamIn[x].Data.SampleFormat := 0; + //FAAD_FMT_DOUBLE: ; + end; + + StreamIn[x].Data.filename := FileName; + + StreamIn[x].Data.HandleSt := StreamIn[x].AACI.hMP4; + + StreamIn[x].Data.samplerate := StreamIn[x].AACI.SampleRate; + StreamIn[x].Data.channels := StreamIn[x].AACI.Channels; + + case StreamIn[x].AACI.outputFormat of + FAAD_FMT_16BIT : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_16; + //FAAD_FMT_24BIT : ; + FAAD_FMT_32BIT : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_32; + FAAD_FMT_FLOAT : StreamIn[x].Data.encoding := MPG123_ENC_FLOAT_32; + //FAAD_FMT_DOUBLE: ; + end; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else + StreamIn[x].Data.Wantframes := FramesCount ; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes * StreamIn[x].Data. + Channels); + + StreamIn[x].Data.title := StreamIn[x].AACI.Title; + StreamIn[x].Data.artist := StreamIn[x].AACI.Artist; + StreamIn[x].Data.album := StreamIn[x].AACI.Album; + StreamIn[x].Data.date := StreamIn[x].AACI.Date; + StreamIn[x].Data.comment := StreamIn[x].AACI.Comment; + StreamIn[x].Data.tag[0] := #0; + StreamIn[x].Data.tag[1] := #0; + StreamIn[x].Data.tag[2] := #0; + StreamIn[x].Data.genre := StreamIn[x].AACI.Genre; + StreamIn[x].Data.samplerateroot := StreamIn[x].AACI.SampleRate; + StreamIn[x].Data.hdformat := 0; + StreamIn[x].Data.frames := 0; + StreamIn[x].Data.Length := StreamIn[x].AACI.TotalSamples; + + StreamIn[x].Data.Seekable := StreamIn[x].AACI.Size > 0; + + StreamIn[x].Data.LibOpen := 2 ; + Err := 0; + end + else + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('MP4OpenFile() NOT ok'); + {$endif} + end; + + end; + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('ac StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('ac err = ' + inttostr(err)); + {$endif} + + + {$IF DEFINED(cdrom)} + if (StreamIn[x].Data.LibOpen = -1) then + begin + Err := -1; + StreamIn[x].pCD := Nil; + + case SampleFormat of + 2 : StreamIn[x].pCD := CDROM_OpenFile(FileName); + end; + + if StreamIn[x].pCD <> nil then + begin + case StreamIn[x].pCD^.BitsPerSample of + 16 : StreamIn[x].Data.SampleFormat := 2; + end; + + StreamIn[x].Data.filename := FileName; + + StreamIn[x].Data.HandleSt := @StreamIn[x].pCD; + // Uos requires an assigned pointer.... + + StreamIn[x].Data.samplerate := StreamIn[x].pCD^.SampleRate; + StreamIn[x].Data.channels := StreamIn[x].pCD^.Channels; + + case StreamIn[x].pCD^.BitsPerSample of + 16 : StreamIn[x].Data.encoding := MPG123_ENC_SIGNED_16; + end; + + if FramesCount = -1 then + StreamIn[x].Data.Wantframes := 65536 Div StreamIn[x].Data.Channels + else + StreamIn[x].Data.Wantframes := FramesCount; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.Wantframes * StreamIn[x].Data. + Channels); + + StreamIn[x].Data.title := ''; + StreamIn[x].Data.artist := ''; + StreamIn[x].Data.album := ''; + StreamIn[x].Data.date := ''; + StreamIn[x].Data.comment := ''; + StreamIn[x].Data.tag[0] := #0; + StreamIn[x].Data.tag[1] := #0; + StreamIn[x].Data.tag[2] := #0; + StreamIn[x].Data.genre := '0'; + StreamIn[x].Data.samplerateroot := StreamIn[x].pCD^.SampleRate; + StreamIn[x].Data.hdformat := 0; + StreamIn[x].Data.frames := 0; + StreamIn[x].Data.Length := StreamIn[x].pCD^.TotalSamples; + + StreamIn[x].Data.LibOpen := 3; + Err := 0; + end; + end; + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('cd StreamIn[x].Data.LibOpen = ' + inttostr(StreamIn[x].Data.LibOpen)); + WriteLn('cd err = ' + inttostr(err)); + {$endif} + + if (err <> 0) or (StreamIn[x].Data.LibOpen = -1) then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('not ok StreamIn[x].Data.LibOpen = -1'); + WriteLn('not ok cd err = ' + inttostr(err)); + {$endif} + + result := -1 ; + StreamIn[Length(StreamIn) - 1].Destroy; + setlength(StreamIn, Length(StreamIn) - 1); + end + else + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('addfromfile OK'); + {$endif} + Result := x; + StreamIn[x].Data.Output := OutputIndex; + StreamIn[x].Data.Status := 1; + StreamIn[x].Data.Position := 0; + StreamIn[x].Data.OutFrames := 0; + StreamIn[x].Data.Poseek := -1; + StreamIn[x].Data.TypePut := 0; + StreamIn[x].Data.seekable := True; + StreamIn[x].LoopProc := Nil; + if SampleFormat = -1 then + StreamIn[x].Data.SampleFormat := 2 + else + StreamIn[x].Data.SampleFormat := SampleFormat; + + case StreamIn[x].Data.LibOpen of + + 0: StreamIn[x].Data.ratio := StreamIn[x].Data.Channels; + + {$IF DEFINED(mpg123)} + 1: + begin + if StreamIn[x].Data.SampleFormat = 2 then + StreamIn[x].Data.ratio := streamIn[x].Data.Channels + else + StreamIn[x].Data.ratio := 2 * streamIn[x].Data.Channels; + + if StreamIn[x].Data.SampleFormat = 0 then + mpg123_param(StreamIn[x].Data.HandleSt, StreamIn[x].Data.Channels, + MPG123_FORCE_FLOAT, 0); + end; + {$endif} + {$IF DEFINED(neaac)} + 2 : StreamIn[x].Data.ratio := streamIn[x].AACI.Channels; + {$endif} + {$IF DEFINED(cdrom)} + 3 : StreamIn[x].Data.ratio := streamIn[x].pCD^.Channels; + {$endif} + {$IF DEFINED(opus)} + 4 : StreamIn[x].Data.ratio := streamIn[x].Data.Channels; + {$endif} + {$IF DEFINED(xmp)} + 5 : StreamIn[x].Data.ratio := streamIn[x].Data.Channels; + {$endif} + end; + StreamIn[x].Data.Enabled := True; + end; + end + else result := -2; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('result = ' + inttostr(result)); + WriteLn('cd err = ' + inttostr(err)); + {$endif} +end; + +procedure Tuos_Player.ReadEndless(x : integer); +begin +{ + Nothing to do: all is done with AddFromEndlessMuted. + } +end; + +{$IF DEFINED(synthesizer)} +procedure Tuos_Player.FillLookupTable(x, typewave, channel, AHarmonics: Integer; + EvenHarmonics : shortint); +var + i, j, l: Integer; + nPI_l, attenuation: Double; + thesample: single; +begin + l := 1024; + nPI_l := 2*PI/l; + + for i:=0 to l-1 do + begin + if typewave = 0 then // sine + begin + thesample := sin(i * nPI_l); + if thesample > 1 then + thesample := 1; + if thesample < -1 then + thesample := -1; + + if Channel = 1 then + StreamIn[x].Data.LookupTableLeft[i] := thesample; + // writeln( floattostr((LookupTableLeft[i])) + ' left '); + + if Channel = 2 then + StreamIn[x].Data.LookupTableRight[i] := thesample; + // writeln( 'right ' + floattostr((LookupTableRight[i]))); + + end; + + if typewave = 1 then // square + begin + if sin(i * nPI_l) >= 0 then + thesample := 1 + else + thesample := -1; + + if Channel = 1 then + StreamIn[x].Data.LookupTableLeft[i] := thesample; + if Channel = 2 then + StreamIn[x].Data.LookupTableRight[i] := thesample; + end; + + if typewave = 2 then // triangle + begin + if Channel = 1 then + begin + if i < (l div 2) + 1 then + thesample := (((l - (i * 2)) / (l / 2))) - 1 + else + thesample := StreamIn[x].Data.LookupTableLeft[l - i]; + if thesample > 1 then + thesample := 1; + if thesample < -1 then + thesample := -1; + StreamIn[x].Data.LookupTableLeft[i] := thesample; + //writeln( floattostr((LookupTableLeft[i])) + ' left '); + end; + + if Channel = 2 then + begin + if i < (l div 2) + 1 then + thesample := (((l - (i * 2)) / (l / 2))) - 1 + else + thesample := StreamIn[x].Data.LookupTableRight[l - i]; + if thesample > 1 then + thesample := 1; + if thesample < -1 then + thesample := -1; + StreamIn[x].Data.LookupTableRight[i] := thesample; + // writeln( floattostr((LookupTableright[i])) + ' right '); + end; + end; + + if typewave = 3 then // Sawtooth + begin + thesample := ((l - i) / (l / 2)) - 1; + if thesample > 1 then + thesample := 1; + if thesample < -1 then + thesample := -1; + + if Channel = 1 then + StreamIn[x].Data.LookupTableLeft[i] := thesample; + if Channel = 2 then + StreamIn[x].Data.LookupTableRight[i] := thesample; + end; + + end; + + if AHarmonics > 0 then + for j:=1 to AHarmonics do + begin + if ((((j mod 2) =1) and (EvenHarmonics=1)) or (EvenHarmonics=0)) then + begin + attenuation := power(j+1, 4); + nPI_l := 2*j*pi/l; + for i:=0 to l-1 do + begin + + if typewave = 0 then + begin + if channel = 1 then + StreamIn[x].Data.LookupTableLeft[i] := + StreamIn[x].Data.LookupTableLeft[i]+sin + (i*nPI_l)/attenuation; + if channel = 2 then + StreamIn[x].Data.LookupTableRight[i] := + StreamIn[x].Data.LookupTableRight[i]+ + sin(i*nPI_l)/attenuation; + end; + + if typewave = 1 then + begin + if channel = 1 then + begin + if sin(i*nPI_l) >= 0 then + StreamIn[x].Data.LookupTableLeft[i] := + StreamIn[x].Data.LookupTableLeft[i] + +(1/attenuation) + else + StreamIn[x].Data.LookupTableLeft[i] := + StreamIn[x].Data.LookupTableLeft[i] + +(-1/attenuation); + end ; + if channel = 2 then + begin + if sin(i*nPI_l) >= 0 then + StreamIn[x].Data.LookupTableRight[i] := + StreamIn[x].Data.LookupTableRight[ + i]+(1/attenuation) + else + StreamIn[x].Data.LookupTableRight[i] := + StreamIn[x].Data.LookupTableRight[ + i]+(-1/attenuation); + end ; + end; + + end; + end; + end; +end; + +procedure Tuos_Player.ReadSynth(x :integer); +var + x2 : integer; + sf1, sf2 : cfloat; + ps: PDArShort; + // if input is Int16 format + pl: PDArLong; + // if input is Int32 format + pf: PDArFloat; + // if input is Float32 format + + i: culong; + chan : integer; + aFreqL, aFreqR, aPosL, aPosR, aStepL, aStepR: cfloat; + +begin + + //for x2 := 0 to length(StreamIn[x].Data.Buffer) + // do StreamIn[x].Data.Buffer[x2] := 0; + + if StreamIn[x].Data.SampleFormat = 2 then ps := @StreamIn[x].Data.Buffer + else + if StreamIn[x].Data.SampleFormat = 1 then pl := @StreamIn[x].Data.Buffer + else + if StreamIn[x].Data.SampleFormat = 0 then pf := @StreamIn[x].Data.Buffer; + + chan := StreamIn[x].Data.channels; + + aPosL := StreamIn[x].Data.PosInTableLeft; + aPosR := StreamIn[x].Data.PosInTableRight; + + aFreqL := StreamIn[x].Data.freqLsine; + aFreqR := StreamIn[x].Data.freqRsine; + + aStepL := (aFreqL*1024/StreamIn[x].Data.samplerate); + aStepR := (aFreqR*1024/StreamIn[x].Data.samplerate);; + + StreamIn[x].Data.posdursine := + StreamIn[x].Data.posdursine + (StreamIn[x].Data.WantFrames Div chan + ); + + x2 := 0 ; + + if (StreamIn[x].Data.posdursine <= StreamIn[x].Data.dursine) or (StreamIn[x].Data.dursine = 0) + then + begin + + while x2 < (length(StreamIn[x].Data.Buffer) div chan) do + begin + + sf2 := 0; + sf1 := 0; + + sf1 := StreamIn[x].Data.VLeft*StreamIn[x].Data.LookupTableLeft[trunc(aPosL) And (1023)]; + aPosL := aPosL+aStepL; + + if chan = 2 then + begin + sf2 := StreamIn[x].Data.VRight*StreamIn[x].Data.LookupTableRight[trunc(aPosR) And ( + 1023)]; + aPosR := aPosR+aStepR; + end; + case StreamIn[x].Data.SampleFormat of + 2: // int16 + begin + ps^[x2] := trunc(sf1 * 32768); + if chan = 2 then ps^[x2+1] := trunc(sf2 * 32768); + end; + 1: // int32 + begin + pl^[x2] := trunc(sf1 * 2147483648); + if chan = 2 then pl^[x2+1] := trunc(sf2 * 2147483648); + end; + 0: // float32 + begin + pf^[x2] := sf1; + if chan = 2 then pf^[x2+1] := sf2 ; + end; + end; + + inc(x2, chan); + end; + + i := trunc(aPosL) Div 1024; + StreamIn[x].Data.PosInTableLeft := aPosL-(i*1024); + i := trunc(aPosR) Div 1024; + StreamIn[x].Data.PosInTableRight := aPosR-(i*1024); + + StreamIn[x].Data.OutFrames := StreamIn[x].Data.WantFrames; + end + else StreamIn[x].Data.OutFrames := 0 ; + +end; +{$endif} + +procedure Tuos_Player.ReadMem(X : integer); +var + x2, wantframestemp : integer; +{$IF DEFINED(uos_debug) and DEFINED(unix)} + i : integer; + st : string; +{$endif} +begin + if length(StreamIn[x].Data.memorybuffer) - StreamIn[x].Data.posmem - (StreamIn[x].Data.WantFrames + + * StreamIn[x].Data.Channels) >= 0 then wantframestemp := (StreamIn[x].Data.WantFrames + * StreamIn[x].Data.Channels) + else + wantframestemp := length(StreamIn[x].Data.memorybuffer) - StreamIn[x].Data.posmem; + + // wantframestemp := StreamIn[x].Data.wantframes; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('length(StreamIn[x].Data.MemoryBuffer) = '+inttostr(length(StreamIn[x].Data.MemoryBuffer)) + ) ; + writeln('StreamIn[x].Data.posmem = '+inttostr(StreamIn[x].Data.posmem)) ; + writeln('wantframestemp = '+inttostr(wantframestemp)) ; +{$endif} + + for x2 := 0 to wantframestemp -1 do + + StreamIn[x].Data.Buffer[x2] := (StreamIn[x].Data.memorybuffer[StreamIn[x].Data.posmem + x2]); + + StreamIn[x].Data.posmem := StreamIn[x].Data.posmem + wantframestemp; + + StreamIn[x].Data.OutFrames := wantframestemp; + + if StreamIn[x].Data.SampleFormat > 0 then + StreamIn[x].Data.Buffer := ConvertSampleFormat(StreamIn[x].Data); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('StreamIn[x].Data.posmem after = '+inttostr(StreamIn[x].Data.posmem)) ; + writeln('StreamIn[x].Data.OutFrames = '+ inttostr(wantframestemp)) ; + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(StreamIn[x].data.Buffer[i]); + WriteLn('OUTPUT DATA AFTER Input from memory ------------------------------'); + WriteLn(st); +{$endif} +end; + +procedure Tuos_Player.ReadMemDec(X : integer); +var + wantframestemp : integer; +{$IF DEFINED(uos_debug) and DEFINED(unix)} + i : integer; + st : string; +{$endif} +begin + + +{ + if length(StreamIn[x].Data.MemoryStream) - StreamIn[x].Data.posmem - (StreamIn[x].Data.WantFrames + +* StreamIn[x].Data.Channels) >= 0 then wantframestemp := (StreamIn[x].Data.WantFrames +* StreamIn[x].Data.Channels) else + wantframestemp := length(StreamIn[x].Data.MemoryStream) - StreamIn[x].Data.posmem; +} + + wantframestemp := (StreamIn[x].Data.WantFrames * StreamIn[x].Data.channels); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('length(StreamIn[x].MemoryStreamDec) = '+inttostr(StreamIn[x].MemoryStreamDec.size)) ; + writeln('StreamIn[x].Data.posmem = '+inttostr(StreamIn[x].Data.posmem)) ; + writeln('wantframestemp = '+inttostr(wantframestemp)) ; +{$endif} + + StreamIn[x].Data.OutFrames := StreamIn[x].MemoryStreamDec.Read(StreamIn[x].Data.Buffer[0] , + wantframestemp); + + StreamIn[x].Data.OutFrames := StreamIn[x].Data.OutFrames Div StreamIn[x].Data.channels; + + StreamIn[x].Data.posmem := StreamIn[x].Data.posmem + wantframestemp; + + // StreamIn[x].Data.OutFrames := wantframestemp; + + if StreamIn[x].Data.SampleFormat > 0 then + StreamIn[x].Data.Buffer := ConvertSampleFormat(StreamIn[x].Data); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('StreamIn[x].Data.posmem after = '+inttostr(StreamIn[x].Data.posmem)) ; + writeln('StreamIn[x].Data.OutFrames = '+ inttostr(wantframestemp)) ; + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(StreamIn[x].data.Buffer[i]); + WriteLn('OUTPUT DATA AFTER Input from memory ------------------------------'); + WriteLn(st); +{$endif} +end; + +procedure Tuos_Player.DoSeek( x : integer); +begin + if StreamIn[x].Data.TypePut = 4 then + StreamIn[x].Data.posmem := 0 + else + + case StreamIn[x].Data.LibOpen of + -1: ; + {$IF DEFINED(sndfile)} + 0: sf_seek(StreamIn[x].Data.HandleSt, StreamIn[x].Data.Poseek, 0); + {$endif} + {$IF DEFINED(mpg123)} + 1: mpg123_seek(StreamIn[x].Data.HandleSt, StreamIn[x].Data.Poseek, 0); + {$endif} + {$IF DEFINED(neaac)} + 2 : MP4Seek(StreamIn[x].AACI, StreamIn[x].Data.Poseek); + {$endif} + {$IF DEFINED(cdrom)} + 3 : ; + {$endif} + {$IF DEFINED(opus)} + 4 : op_pcm_seek(StreamIn[x].Data.HandleOP, StreamIn[x].Data.Poseek); + {$endif} + end; +end; + +procedure Tuos_Player.DoDSPOutAfterBufProc(x: integer); +var + x3 : integer; +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + msg: TfpgMessageParams; + // for fpgui + {$endif} +begin + + for x3 := 0 to high(StreamOut[x].DSP) do + if (StreamOut[x].DSP[x3].Enabled = True) then + begin + if (StreamOut[x].DSP[x3].AftFunc <> nil) then + StreamOut[x].Data.Buffer := + StreamOut[x].DSP[x3].AftFunc(StreamOut[x].Data, + StreamOut[x].DSP[x3].fftdata); + + {$IF DEFINED(mse)} + if (StreamOut[x].DSP[x3].LoopProc <> nil) then + begin + application.queueasynccall(StreamOut[x].DSP[x3].LoopProc); + end; + {$else} + + {$IF not DEFINED(Library)} + if (StreamOut[x].DSP[x3].LoopProc <> nil) then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamOut[x]. + DSP[x3].LoopProc); + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := x3 ; + // the index of the dsp + msg.user.Param2 := 1; + // it is a OUT DSP + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamOut[x].DSP[ + x3].LoopProc); + {$endif} + {$endif} + + {$elseif not DEFINED(java)} + if (StreamOut[x].DSP[x3].LoopProc <> nil) then + StreamOut[x].DSP[x3].LoopProc; + {$else} + if (StreamOut[x].DSP[x3].LoopProc <> nil) then + {$IF FPC_FULLVERSION >= 20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@StreamOut[x]. + DSP[x3].LoopProcjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@StreamOut[x].DSP + [x3].LoopProcjava); + {$endif} + {$endif} + + {$endif} + end; +end; + +procedure Tuos_Player.DoArrayLevel(x: integer); +begin + setlength(uosLevelArray[index][x],length(uosLevelArray[index][x]) +1); + uosLevelArray[index][x][length(uosLevelArray[index][x]) -1 ] := StreamIn[x].Data.LevelLeft; + + setlength(uosLevelArray[index][x],length(uosLevelArray[index][x]) +1); + uosLevelArray[index][x][length(uosLevelArray[index][x]) -1 ] := StreamIn[x].Data.LevelRight; + + // writeln('array length = ' + inttostr(length(uosLevelArray[index][x]))); +end; + +{$IF DEFINED(portaudio)} +procedure Tuos_Player.ReadDevice(x : integer); +var + x2 : integer; +begin + for x2 := 0 to StreamIn[x].Data.WantFrames -1 do + StreamIn[x].Data.Buffer[x2] := cfloat(0.0); + // clear input + Pa_ReadStream(StreamIn[x].Data.HandleSt, + @StreamIn[x].Data.Buffer[0], StreamIn[x].Data.WantFrames); + + // err :=// if you want clean buffer + StreamIn[x].Data.OutFrames := + StreamIn[x].Data.WantFrames * StreamIn[x].Data.Channels; + + +// if err = 0 then StreamIn[x].Data.Status := 1 else StreamIn[x].Data.Status := 0;// if you want clean buffer +end; +{$endif} + +procedure Tuos_Player.DoDSPinBeforeBufProc(x: integer); +var + x2 : integer; +begin + for x2 := 0 to high(StreamIn[x].DSP) do + if (StreamIn[x].DSP[x2].Enabled = True) and + (StreamIn[x].DSP[x2].BefFunc <> nil) then + StreamIn[x].DSP[x2].BefFunc(StreamIn[x].Data, StreamIn[x].DSP[x2].fftdata); +end; + +procedure Tuos_Player.DoDSPinAfterBufProc(x: integer); +var + x2 : integer; +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + msg: TfpgMessageParams; + // for fpgui + {$endif} +begin + for x2 := 0 to high(StreamIn[x].DSP) do + if (StreamIn[x].DSP[x2].Enabled = True) then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin AfterBuffProc 1.'); + {$endif} + if (StreamIn[x].DSP[x2].AftFunc <> nil) then + StreamIn[x].Data.Buffer := + StreamIn[x].DSP[x2].AftFunc(StreamIn[x].Data, + StreamIn[x].DSP[x2].fftdata); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin AfterBuffProc 2.'); + {$endif} + + {$IF DEFINED(mse)} + if (StreamIn[x].DSP[x2].LoopProc <> nil) then + begin + application.queueasynccall(StreamIn[x].DSP[x2].LoopProc) ; + end; + {$else} + + {$IF not DEFINED(Library)} + if (StreamIn[x].DSP[x2].LoopProc <> nil) then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamIn[x].DSP + [x2].LoopProc); + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := x2 ; + // the index of the dsp + msg.user.Param2 := 0; + // it is a In DSP + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamIn[x].DSP[ + x2].LoopProc); + {$endif} + {$endif} + {$elseif not DEFINED(java)} + if (StreamIn[x].DSP[x2].LoopProc <> nil) then + StreamIn[x].DSP[x2].LoopProc; + {$else} + if (StreamIn[x].DSP[x2].LoopProc <> nil) then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@Streamin[x]. + DSP[x2].LoopProcjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@Streamin[x].DSP[ + x2].LoopProcjava); + {$endif} + {$endif} + {$endif} + end; +end; + +procedure Tuos_Player.SeekIfTerminated; +var + x, statustemp : integer; +begin + + statustemp := 0 ; + for x := 0 to high(StreamIn) do + begin + if (StreamIn[x].Data.enabled = true) + then + begin + + if (StreamIn[x].Data.TypePut <> 1) + then + begin + if StreamIn[x].Data.Status = 1 then + statustemp := StreamIn[x].Data.Status; + if (StreamIn[x].Data.Status = 2) and (statustemp = 0) then + statustemp := StreamIn[x].Data.Status; + end + else + if + (StreamIn[x].Data.TypePut = 1) then statustemp := status ; + end ; + end; + + if statustemp <> status then status := statustemp; + + if (status = 0) and IsLooped then + begin + for x:= 0 to high(StreamIn) do + begin + InputSeek(x, 0); + if StreamIn[x].Data.TypePut = 4 then + StreamIn[x].Data.posmem := 0; + StreamIn[x].Data.status := 1; + end; + + Status := 1; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Loop (NLooped: '+IntToStr(NLooped)+')----'); + {$endif} + + if NLooped > 0 then + Dec(NLooped); + end; + +end; + +procedure Tuos_Player.DoLoopEndMethods; +begin +{$IF DEFINED(mse)} + if LoopEndProc <> nil then + begin + application.queueasynccall(LoopEndProc); + end; + {$else} + + {$IF not DEFINED(Library)} + if LoopEndProc <> nil then + + // Execute LoopEndProc procedure + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,LoopEndProc); + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := -2 ; + // it is the first proc + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,LoopEndProc); + {$endif} + {$endif} + {$elseif not DEFINED(java)} + if LoopEndProc <> nil then + LoopEndProc; + {$else} + if LoopEndProc <> nil then + + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@endprocjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@endprocjava); + // Execute EndProc procedure + {$endif} + {$endif} + {$endif} +end; + +procedure Tuos_Player.DoEndProc; +begin +{$IF DEFINED(mse)} + if EndProc <> nil then + application.queueasynccall(EndProc); + {$else} + + {$IF not DEFINED(Library)} + if EndProc <> nil then + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,EndProc); + // Execute EndProc procedure + + //thethread.queue(thethread,EndProc);// Execute EndProc procedure + + {$elseif not DEFINED(java)} + if (EndProc <> nil) then + EndProc; + {$else} + if (EndProc <> nil) then + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@endprocjava); + // Execute EndProc procedure + + {$endif} + + {$endif} +end; + +procedure Tuos_Player.DoTerminateNoFreePlayer; +var + x, x2 : integer; +begin + + for x := 0 to high(StreamIn) do + begin + if (length(StreamIn[x].DSP) > 0) then + for x2 := 0 to high(StreamIn[x].DSP) do + if (StreamIn[x].DSP[x2].EndFunc <> nil) then + StreamIn[x].DSP[x2].EndFunc(StreamIn[x].Data, StreamIn[x].DSP[x2].fftdata); + end; + + for x := 0 to high(StreamOut) do + begin + if (length(StreamOut[x].DSP) > 0) then + for x2 := 0 to high(StreamOut[x].DSP) do + if (StreamOut[x].DSP[x2].EndFunc <> nil) then + StreamOut[x].DSP[x2].EndFunc(StreamOut[x].Data, StreamOut[x].DSP[x2].fftdata); + end; + + if (StreamOut[x].Data.TypePut = 0) then + begin + WriteWave(StreamOut[x].Data.Filename, StreamOut[x].FileBuffer); + // StreamOut[x].FileBuffer.Data.Free; + end; + + if (StreamOut[x].Data.TypePut = 4) then + begin + WriteWaveFromMem(StreamOut[x].Data.Filename, StreamOut[x].FileBuffer); + // StreamOut[x].FileBuffer.Data.Free; + end; + + {$IF DEFINED(sndfile)} + if (StreamOut[x].Data.TypePut = 6) then + begin + sf_write_sync(StreamOut[x].Data.HandleSt); + sf_close(StreamOut[x].Data.HandleSt); + end; + + if (StreamOut[x].Data.TypePut = 5) then + begin + sf_write_sync(StreamOut[x].Data.HandleSt); + sf_close(StreamOut[x].Data.HandleSt); + end; + {$endif} + + {$IF DEFINED(mse)} + if EndProc <> nil then + begin + application.queueasynccall(EndProc); + end; + {$else} + + {$IF not DEFINED(Library)} + if EndProc <> nil then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,EndProc); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,EndProc); + // Execute EndProc procedure + {$endif} + + {$elseif not DEFINED(java)} + if (EndProc <> nil) then + EndProc; + {$else} + if (EndProc <> nil) then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@endprocjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@endprocjava); + // Execute EndProc procedure + {$endif} + + {$endif} + {$endif} + + {$IF DEFINED(portaudio)} + for x := 0 to high(StreamOut) do + if (StreamOut[x].Data.HandleSt <> nil) and + (StreamOut[x].Data.TypePut = 1) then + Pa_StopStream(StreamOut[x].Data.HandleSt); + {$ENDIF} + + if EndProcOnly <> nil then EndProcOnly; + + StreamIn[x].Data.Poseek := 0; + // set to begin + doseek(x); + + Status := 2; + + if isGlobalPause = true then + begin + RTLeventReSetEvent(uosInit.evGlobalPause) + end + else + begin + RTLeventReSetEvent(evPause); + end; + +end; + +procedure Tuos_Player.DoTerminatePlayer; +var + x, x2 : integer; +begin + + if length(PlugIn) > 0 then + begin + for x := 0 to high(PlugIn) do + begin + {$IF DEFINED(soundtouch)} + if Plugin[x].Name = 'soundtouch' then + begin + soundtouch_clear(Plugin[x].PlugHandle); + soundtouch_destroyInstance(Plugin[x].PlugHandle); + end; + + if Plugin[x].Name = 'getbpm' then + begin + bpm_destroyInstance(Plugin[x].PlugHandle); + end; + {$endif} + + {$IF DEFINED(bs2b)} + if Plugin[x].Name = 'bs2b' then + begin + bs2b_close(Plugin[x].Abs2b); + end; + {$endif} + end; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Destroy DSP In'); + {$endif} + + for x := 0 to high(StreamIn) do + begin + if (length(StreamIn[x].DSP) > 0) then + for x2 := 0 to high(StreamIn[x].DSP) do + if (StreamIn[x].DSP[x2].EndFunc <> nil) then + StreamIn[x].DSP[x2].EndFunc(StreamIn[x].Data, StreamIn[x].DSP[x2].fftdata); + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Destroy DSP Out'); + {$endif} + + for x := 0 to high(StreamOut) do + begin + if (assigned(StreamOut[x].DSP)) and (assigned(StreamOut[x])) then if (length(StreamOut[x]. + DSP) > 0) then + for x2 := 0 to high( + StreamOut[x].DSP) do + if (StreamOut[x].DSP[ + x2].EndFunc <> nil) + then + StreamOut[x].DSP[x2] + .EndFunc(StreamOut[x + ].Data, + StreamOut[x + ].DSP[x2]. + fftdata); + end; + + for x := 0 to high(StreamIn) do + if assigned(StreamIn[x].Data.HandleSt) then if (StreamIn[x].Data.HandleSt <> nil) then + case StreamIn[x].Data.TypePut of + 0: case StreamIn[x].Data.LibOpen of + {$IF DEFINED(sndfile)} + 0: sf_close(StreamIn[x].Data.HandleSt); + {$endif} + {$IF DEFINED(mpg123)} + 1: + begin + mpg123_close(StreamIn[x].Data.HandleSt + ); + mpg123_delete(StreamIn[x].Data. + HandleSt); + end; + {$ENDIF} + {$IF DEFINED(neaac)} + 2 : + begin + MP4CloseFile(StreamIn[x].AACI); + end; + {$endif} + {$IF DEFINED(cdrom)} + 3: + begin + CDROM_Close(StreamIn[x].pCD); + end; + {$endif} + {$IF DEFINED(opus)} + 4: + begin + op_free(StreamIn[x].Data.HandleOP); + sleep(50); + // needed ? + end; + {$ENDIF} + + {$IF DEFINED(xmp)} + 5: + begin + xmp_end_player(StreamIn[x].Data. + HandleSt); + xmp_release_module(StreamIn[x].Data. + HandleSt); + xmp_free_context(StreamIn[x].Data. + HandleSt); + end; + {$ENDIF} + + 99: // if nothing was defined + + end; + + {$IF DEFINED(portaudio)} + 1: + begin + Pa_StopStream(StreamIn[x].Data.HandleSt); + Pa_CloseStream(StreamIn[x].Data.HandleSt); + end; + {$endif} + + {$IF DEFINED(webstream)} + 2: + begin + StreamIn[x].httpget.Terminate; + sleep(100); + StreamIn[x].inpipe.destroy; + StreamIn[x].outpipe.destroy; + + case StreamIn[x].Data.LibOpen of + {$IF DEFINED(mpg123)} + 1: + begin + mpg123_close(StreamIn[x].Data. + HandleSt); + mpg123_delete(StreamIn[x].Data. + HandleSt); + end; + {$ENDIF} + {$IF DEFINED(opus)} + 4: + begin + op_free(StreamIn[x].Data.HandleOP); + sleep(50); + // needed ? + end; + {$ENDIF} + {$IF DEFINED(fdkaac)} + 2 : + begin + aacDecoder_Close(StreamIn[x].Data. + HandleSt); + end; + {$ENDIF} + end; + end; + {$ENDIF} + + end; + + for x := 0 to high(StreamOut) do + begin + {$IF DEFINED(portaudio)} + if (StreamOut[x].Data.HandleSt <> nil) and + (StreamOut[x].Data.TypePut = 1) then + begin + Pa_StopStream(StreamOut[x].Data.HandleSt); + Pa_CloseStream(StreamOut[x].Data.HandleSt); + end; + {$ENDIF} + + {$IF DEFINED(shout)} + if (StreamOut[x].Data.TypePut = 2) then + begin + // freeandnil(StreamOut[x].encoder) ; + shout_free(StreamOut[x].Data.HandleSt); + + end; + {$endif} + + if (StreamOut[x].Data.TypePut = 0) then + begin + WriteWave(StreamOut[x].Data.Filename, StreamOut[x].FileBuffer); + // StreamOut[x].FileBuffer.Data.Free; + end; + + if (StreamOut[x].Data.TypePut = 4) then + begin + WriteWaveFromMem(StreamOut[x].Data.Filename, StreamOut[x].FileBuffer); + StreamOut[x].FileBuffer.Data.Free; + end; + + {$IF DEFINED(sndfile)} + + if (StreamOut[x].Data.TypePut = 6) then + begin + sf_close( StreamOut[x].Data.HandleSt); + end; + + if (StreamOut[x].Data.TypePut = 7) then + begin + sf_close( StreamOut[x].Data.HandleSt); + end; + {$endif} + + end; + + +end; + +procedure Tuos_Player.DoMainLoopProc(x: integer); +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} +var + msg: TfpgMessageParams; + // for fpgui + {$endif} +begin + + {$IF DEFINED(mse)} + if StreamIn[x].LoopProc <> nil then + begin + application.queueasynccall(StreamIn[x].LoopProc); + end; + {$else} + + // The synchro main loop procedure + {$IF not DEFINED(Library)} + if StreamIn[x].LoopProc <> nil then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamIn[x].LoopProc) + ; + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := -1 ; + // it is the main loop procedure + msg.user.Param2 := 0 ; + // it is a INput procedure + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,StreamIn[x].LoopProc); + {$endif} + {$endif} + + {$elseif not DEFINED(java)} + if (StreamIn[x].LoopProc <> nil) then + StreamIn[x].LoopProc; + {$else} + if (StreamIn[x].LoopProc <> nil) then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@Streamin[x]. + LoopProcjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@Streamin[x]. + LoopProcjava); + {$endif} + {$endif} + {$endif} +end; + +procedure Tuos_Player.DoBeginMethods; +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} +var + msg: TfpgMessageParams; + // for fpgui + {$endif} +begin +{$IF DEFINED(mse)} + if BeginProc <> nil then + begin + application.queueasynccall(BeginProc); + end; + {$else} + + {$IF not DEFINED(Library)} + if BeginProc <> nil then + // Execute BeginProc procedure + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,BeginProc); + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := -2 ; + // it is the first proc + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,BeginProc); + {$endif} + {$endif} + {$elseif not DEFINED(java)} + if BeginProc <> nil then + BeginProc; + {$else} + if BeginProc <> nil then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@BeginProcjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@BeginProcjava); + {$endif} + {$endif} + {$endif} +end; + +procedure Tuos_Player.DoLoopBeginMethods; +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} +var + msg: TfpgMessageParams; + // for fpgui + {$endif} +begin +{$IF DEFINED(mse)} + if LoopBeginProc <> nil then + begin + application.queueasynccall(LoopBeginProc); + end; + {$else} + {$IF not DEFINED(Library)} + if LoopBeginProc <> nil then + // Execute BeginProc procedure + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,LoopBeginProc); + {$else} + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + begin + msg.user.Param1 := -2 ; + // it is the first proc + fpgPostMessage(self, refer, MSG_CUSTOM1, msg); + end; + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,LoopBeginProc); + {$endif} + {$endif} + {$elseif not DEFINED(java)} + if loopBeginProc <> nil then + loopBeginProc; + {$else} + if loopBeginProc <> nil then + {$IF FPC_FULLVERSION>=20701} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@loopBeginProcjava); + {$else} + thethread.{$IF DEFINED(usequeue)}Queue{$else}Synchronize{$endif}(thethread,@loopBeginProcjava); + {$endif} + {$endif} + {$endif} +end; + +procedure Tuos_Player.WriteOut(x:integer; x2 : integer); +var + err, rat, wantframestemp: integer; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + st : string; + i : integer; +{$endif} + Bufferst2mo: TDArFloat; +begin + // Convert Input format into Output format if needed: + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Convert Input format into Output'); + {$endif} + case StreamOut[x].Data.SampleFormat of + 0: case StreamIn[x2].Data.SampleFormat of + 1: StreamOut[x].Data.Buffer := + CvInt32toFloat32(StreamOut[x].Data.Buffer); + 2: StreamOut[x].Data.Buffer := + CvInt16toFloat32(StreamOut[x].Data.Buffer); + end; + end; + // End convert. + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Finally give buffer to output'); + {$endif} + + // writeln(inttostr(StreamOut[x].Data.TypePut)); + + // Finally give buffer to output + case StreamOut[x].Data.TypePut of + {$IF DEFINED(portaudio)} + 1: // Give to output device using portaudio + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Give to output device'); + writeln('length(StreamOut[x].Data.Buffer) =' + inttostr(length(StreamOut[x].Data.Buffer))); + {$endif} + + if (StreamIn[x2].Data.TypePut <> 1) or + ((StreamIn[x2].Data.TypePut = 1) and (StreamIn[x2].Data.Channels > 1)) then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st := ''; + for i := 0 to length(StreamOut[x].Data.Buffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(StreamOut[x].Data.Buffer[i]); + WriteLn('OUTPUT DATA into portaudio------------------------------'); + //WriteLn(st); + {$endif} + + // err :=// if you want clean buffer + + if assigned(StreamOut[x].Data.HandleSt) then + Pa_WriteStream(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamIn[x2].Data.outframes Div StreamIn + [x2].Data.ratio); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('give to output device 1'); +{$endif} + end + else + begin + // err :=// if you want clean buffer + Pa_WriteStream(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamIn[x2].Data.outframes); + end; + // if err <> 0 then status := 0;// if you want clean buffer ... +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('End give to output device 2'); +{$endif} + end; + {$endif} + + + {$IF DEFINED(shout)} + 2: // Give to IceCast server + begin + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Give to output IceCast server'); + {$endif} + + case StreamOut[x].Data.SampleFormat of + 0: + begin + err := opus_encode_float(StreamOut[x].encoder, @StreamOut[x].Data.Buffer[0], + cFRAME_SIZE*3, StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + 1: + begin + err := opus_encode(StreamOut[x].encoder, @StreamOut[x].Data.Buffer[0], cFRAME_SIZE* + 3, StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + 2: + begin + err := opus_encode(StreamOut[x].encoder, @StreamOut[x].Data.Buffer[0], cFRAME_SIZE*3 + , StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + end; + + StreamOut[x].data.outframes := err; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('opus_encode outframes =' + inttostr(err)); + WriteLn('----------------------------------'); + // writeln(tencoding.utf8.getstring(StreamOut[x].cbits)); + {$endif} + + if err > 0 then + + err := shout_send_raw(StreamOut[x].Data.HandleSt, StreamOut[x].cbits, StreamOut[x].data. + outframes); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_send ok ' + inttostr(err)) + else + WriteLn('shout_send error: '+ inttostr(err) + ' ' + pchar(shout_get_error(StreamOut[x]. + Data.HandleSt))); + writeln('End give output to IceCast server'); + {$endif} + + shout_sync(StreamOut[x].Data.HandleSt); + end; + {$endif} + + 3: + begin + // Give to memory buffer + + wantframestemp := StreamIn[x2].Data.outframes ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before Give to memory ------------------------------'); + st := ''; + for i := 0 to wantframestemp -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(StreamOut[x].Data.Buffer[i]); + WriteLn(st); + WriteLn('OUTPUT DATA AFTER5 ------------------------------'); + writeln('Streamout[x].Data.posmem before = '+inttostr( Streamout[x].Data.posmem)) ; + + writeln('StreamIn[x2].Data.outframes * StreamIn[x2].Data.channels = '+inttostr( StreamIn[x2 + ].Data.outframes * StreamIn[x2].Data.channels)) ; + writeln('length(tempoutmemory) = '+ inttostr(length(tempoutmemory))); + writeln('Begin Give to memory buffer'); + writeln('(StreamIn[x2].Data.outframes ) -1 = ' + + inttostr((StreamIn[x2].Data.outframes) -1)); + {$endif} + + if StreamIn[x2].Data.numbuf > -1 then + begin + // writeln('theinc = ' + inttostr(theinc)); + inc(theinc); + if theinc > StreamIn[x2].Data.numbuf then status := 0 ; + end; + + SetLength(Streamout[x].BufferOut^,length(Streamout[x].BufferOut^) + wantframestemp ); + + Streamout[x].Data.posmem := length(Streamout[x].BufferOut^) - wantframestemp; + + for x2 := 0 to (wantframestemp) -1 do + begin + Streamout[x].BufferOut^[Streamout[x].Data.posmem + x2] := StreamOut[x].Data.Buffer[x2]; + end; + Streamout[x].Data.posmem := Streamout[x].Data.posmem + (wantframestemp); + + // if Streamout[x].Data.SampleFormat > 0 then + //StreamOut[x].Data.Buffer := ConvertSampleFormat(StreamOut[x].Data); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Streamout[x].Data.posmem after = '+inttostr( Streamout[x].Data.posmem)) ; + st := ''; + for i := 0 to length(tempoutmemory) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr(tempoutmemory[i]); + WriteLn('OUTPUT DATA AFTER5 ------------------------------'); + //WriteLn(st); + {$endif} + + end; + + 4: // Give to wav file from TMemoryStream + begin + + case StreamOut[x].Data.SampleFormat of + 0: rat := 2 ; + 1: rat := 2 ; + 2: rat := 1 ; + end; + + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 2) then + begin + + Bufferst2mo := CvSteroToMono(StreamOut[x].Data.Buffer, StreamIn[x2].Data.outframes); + + StreamOut[x].FileBuffer.DataMS.WriteBuffer( + Bufferst2mo[0], + StreamIn[x2].Data.outframes * rat); + end + else + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 1) then + begin + StreamOut[x].FileBuffer.DataMS.WriteBuffer( + StreamOut[x].Data.Buffer[0], StreamIn[x2] + .Data.outframes * StreamIn[x2].Data.ratio + * rat * 2); + end + else + + StreamOut[x].FileBuffer.DataMS.WriteBuffer( + StreamOut[x].Data.Buffer[0], StreamIn[x2]. + Data.outframes * StreamIn[x2].Data.Channels * + rat); + end; + + {$IF DEFINED(sndfile)} + 5: // Give to MemoryStream + begin + + if StreamIn[x2].Data.TypePut = 1 then rat := StreamIn[x2].Data.Channels + else rat := 1; + + // writeln('MemoryStream'); + + if assigned(StreamOut[x].MemorySteamOut) then + + case StreamOut[x].Data.SampleFormat of + + 0: StreamOut[x].Data.OutFrames := + sf_write_float(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes *rat ); + 1: StreamOut[x].Data.OutFrames := + sf_write_int(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes *rat ); + 2: StreamOut[x].Data.OutFrames := + sf_write_short(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes *rat); + end; + end; + + 6: // give to ogg file from Tfilestream + begin + //writeln('ok ogg'); + + + // if StreamIn[x2].Data.outframes = StreamOut[x].Data.Wantframes * StreamOut[x].Data.channels then + case StreamOut[x].Data.SampleFormat of + 0: StreamOut[x].Data.OutFrames := + sf_write_float(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes * StreamOut[x].Data.channels); + 1: StreamOut[x].Data.OutFrames := + sf_write_int(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes * StreamOut[x].Data.channels); + 2: StreamOut[x].Data.OutFrames := + sf_write_short(StreamOut[x].Data.HandleSt, + @StreamOut[x].Data.Buffer[0], StreamOut[x].Data. + Wantframes * StreamOut[x].Data.channels); + end; + sf_write_sync(StreamOut[x].Data.HandleSt); + // writeln(inttostr(StreamOut[x].Data.OutFrames)); + end; + + {$endif} + + + 0: // Give to wav file from TFileStream + begin + case StreamOut[x].Data.SampleFormat of + 0: rat := 2 ; + 1: rat := 2 ; + 2: rat := 1 ; + end; + + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 2) then + begin + + Bufferst2mo := CvSteroToMono(StreamOut[x].Data.Buffer, StreamIn[x2].Data.outframes); + + StreamOut[x].FileBuffer.Data.WriteBuffer( + Bufferst2mo[0], + StreamIn[x2].Data.outframes * rat); + end + else + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 1) then + begin + StreamOut[x].FileBuffer.Data.WriteBuffer( + StreamOut[x].Data.Buffer[0], StreamIn[x2]. + Data.outframes * StreamIn[x2].Data.ratio * + rat * 2); + end + else + + StreamOut[x].FileBuffer.Data.WriteBuffer( + StreamOut[x].Data.Buffer[0], StreamIn[x2].Data. + outframes * StreamIn[x2].Data.Channels * rat); + end; + + end; +end; + +procedure Tuos_Player.WriteOutPlug(x:integer; x2 : integer); +var + x3, x4, err, wantframestemp: integer; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st : string; + i : integer; + {$endif} + BufferplugINFLTMP: TDArFloat; + BufferplugFL: TDArFloat; + BufferplugSH: TDArShort; + BufferplugLO: TDArLong; + Bufferst2mo: TDArFloat; +begin + // convert buffer if needed + case StreamOut[x].Data.SampleFormat of + 1: StreamOut[x].Data.Buffer := + CvInt32toFloat32(StreamOut[x].Data.Buffer); + 2: StreamOut[x].Data.Buffer := + CvInt16toFloat32(StreamOut[x].Data.Buffer); + end; + + // transfer buffer out to temp + SetLength(BufferplugINFLTMP, (StreamIn[x2].Data.outframes) * + StreamIn[x2].Data.Channels); + + if length(BufferplugINFLTMP) > 2 then + for x3 := 0 to (length(BufferplugINFLTMP) div 2) - 1 do + BufferplugINFLTMP[x3] := cfloat(StreamOut[x].Data.Buffer[x3]); + + // dealing with input plugin + for x3 := 0 to high(PlugIn) do + begin + if PlugIn[x3].Enabled = True then + begin + {$IF DEFINED(bs2b) or DEFINED(soundtouch) or DEFINED(noiseremoval)} + BufferplugFL := Plugin[x3].PlugFunc(BufferplugINFLTMP, + Plugin[x3].PlugHandle, Plugin[x3].Abs2b, StreamIn[x2].Data, + Plugin[x3].param1, Plugin[x3].param2, Plugin[x3].param3, Plugin[x3].param4 + , + Plugin[x3].param5, Plugin[x3].param6, Plugin[x3].param7, Plugin[x3].param8 + ); + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('PlugFunc: Length(BufferplugINFLTMP,BufferplugFL) = ' + + inttostr(Length(BufferplugINFLTMP)) + ' , ' + inttostr(Length(BufferplugFL))); + {$endif} + + if (length(PlugIn) > 1) then + begin + // TO CHECK : works only if SoundTouch is last or only plugin + for x4 := 0 to length(BufferplugFL) - 1 do + BufferplugINFLTMP[x4] := cfloat(BufferplugFL[x4]); + end; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('2-PlugFunc: Length(BufferplugINFLTMP,BufferplugFL) = ' + + inttostr(Length(BufferplugINFLTMP)) + ' , ' + inttostr(Length(BufferplugFL))); + {$endif} + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Give the processed input to output.'); + writeln('Length(BufferplugFL) = ' + inttostr(Length(BufferplugFL))); + {$endif} + if Length(BufferplugFL) > 0 then + begin + + case StreamOut[x].Data.SampleFormat of + 1: + begin + SetLength(BufferplugLO, length(BufferplugFL)); + BufferplugLO := CvFloat32ToInt32(BufferplugFL); + end; + 2: + begin + SetLength(BufferplugSH, length(BufferplugFL)); + BufferplugSH := CvFloat32ToInt16(BufferplugFL); + + end; + end; + + case StreamOut[x].Data.TypePut of + + {$IF DEFINED(portaudio)} + 1: // Give to output device + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Before Pa_WriteStream: Length(BufferplugFL) = ' + inttostr(Length(BufferplugFL + ))); + {$endif} + case StreamOut[x].Data.SampleFormat of + 0: + begin + err := + Pa_WriteStream(StreamOut[x].Data.HandleSt, + @BufferplugFL[0], Length(BufferplugFL) Div + StreamIn[x2].Data.Channels); + end; + 1: + begin + BufferplugLO := CvFloat32ToInt32(BufferplugFL); + err := + Pa_WriteStream(StreamOut[x].Data.HandleSt, + @BufferplugLO[0], Length(BufferplugLO) Div + StreamIn[x2].Data.Channels); + end; + 2: + begin + BufferplugSH := CvFloat32ToInt16(BufferplugFL); + + err := + Pa_WriteStream(StreamOut[x].Data.HandleSt, + @BufferplugSH[0], Length(BufferplugSH) Div + StreamIn[x2].Data.Channels); + end; + end; + // if err <> 0 then status := 0;// if you want clean buffer ... + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Pa_WriteStream error = '+ inttostr(err)); + {$endif} + end; + {$endif} + + {$IF DEFINED(shout)} + 2: // Give to IceCast server + begin + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Give to output IceCast server'); + {$endif} + + case StreamOut[x].Data.SampleFormat of + 0: + begin + err := opus_encode_float(StreamOut[x].encoder, @BufferplugFL[0], cFRAME_SIZE, + StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + 1: + begin + err := opus_encode(StreamOut[x].encoder, @BufferplugLO[0], cFRAME_SIZE, + StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + 2: + begin + err := opus_encode(StreamOut[x].encoder, @BufferplugSH[0], cFRAME_SIZE, + StreamOut[x].cbits, cMAX_PACKET_SIZE); + end; + end; + + StreamOut[x].data.outframes := err ; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('opus_encode outframes =' + inttostr(err)); + WriteLn('----------------------------------'); + // writeln(tencoding.utf8.getstring(StreamOut[x].cbits)); + {$endif} + + if err > 0 then + + err := shout_send(StreamOut[x].Data.HandleSt, StreamOut[x].cbits, StreamOut[x].data. + outframes); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + if err = SHOUTERR_SUCCESS then + WriteLn('shout_send ok ' + inttostr(err)) + else + WriteLn('shout_send error: '+ inttostr(err) + ' ' + pchar(shout_get_error(StreamOut[x + ].Data.HandleSt))); + writeln('End give output to IceCast server'); + {$endif} + + shout_sync(StreamOut[x].Data.HandleSt); + // ? + + end; + {$endif} + + 0: + begin + // Give to wav file from TFileStream + + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 2) then + begin + Bufferst2mo := CvSteroToMono(BufferplugFL, Length(BufferplugFL) Div 2); + BufferplugSH := CvFloat32ToInt16(Bufferst2mo); + end + else + begin + BufferplugSH := CvFloat32ToInt16(BufferplugFL); + end; + StreamOut[x].FileBuffer.Data.WriteBuffer(BufferplugSH[0], + Length(BufferplugSH)); + + end; + + 4: + begin + // Give to wav file from TMemoryStream + + if (StreamOut[x].FileBuffer.wChannels = 1) and (StreamIn[x2].Data.Channels = 2) then + begin + Bufferst2mo := CvSteroToMono(BufferplugFL, Length(BufferplugFL) Div 2); + BufferplugSH := CvFloat32ToInt16(Bufferst2mo); + end + else + begin + BufferplugSH := CvFloat32ToInt16(BufferplugFL); + end; + StreamOut[x].FileBuffer.DataMS.WriteBuffer(BufferplugSH[0], + Length(BufferplugSH)); + + end; + + 5: // Give to MemoryStream + begin + + case StreamOut[x].Data.SampleFormat of + 0: StreamOut[x].MemorySteamOut.WriteBuffer(BufferplugFL[0], + Length(BufferplugFL)); + + 1: StreamOut[x].MemorySteamOut.WriteBuffer(BufferplugLO[0], + Length(BufferplugLO)); + + 2: StreamOut[x].MemorySteamOut.WriteBuffer(BufferplugSH[0], + Length(BufferplugSH)); + + end; + end; + + + 3: + begin + // Give to memory buffer + wantframestemp := Length(BufferplugFL) ; + SetLength(Streamout[x].BufferOut^,length(Streamout[x].BufferOut^) + wantframestemp ); + + for x2 := 0 to wantframestemp -1 do + Streamout[x].BufferOut^[Streamout[x].Data.posmem + x2] := BufferplugFL[x2]; + + Streamout[x].Data.posmem := Streamout[x].Data.posmem + wantframestemp; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Streamout[x].Data.posmem = '+inttostr( Streamout[x].Data.posmem)) ; + st := ''; + for i := 0 to length(tempoutmemory) -1 do + st := st + '|' + inttostr(i) + '|' + floattostr(tempoutmemory[i]); + WriteLn('OUTPUT DATA AFTER4 ------------------------------'); + WriteLn(st); + {$endif} + end; + + end; + end; +end; + +{$IF DEFINED(webstream)} +procedure Tuos_Player.ReadUrl(x : integer); +var + err : integer; + + {$IF DEFINED(fdkaac)} + FErrorCode : AAC_DECODER_ERROR; + FByteFilled, FBytesRead : longword; + FOutputBuff : array of cfloat; + FCStreamInfo : PCStreamInfo; + len, len2, len3: integer; + rawAACBuffer: PByte; + {$endif} + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + i : integer; + st : string; +{$endif} +begin + case StreamIn[x].Data.LibOpen of + 1 : + begin +{$IF DEFINED(mpg123)} + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('===> Before mpg123_read') ; +{$endif} + err := + mpg123_read(StreamIn[x].Data.HandleSt, @StreamIn[x].Data.Buffer[0], + StreamIn[x].Data.wantframes, StreamIn[x].Data.outframes); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('===> mpg123_read error => ' + inttostr(err)) ; +{$endif} + StreamIn[x].Data.outframes := + StreamIn[x].Data.outframes Div StreamIn[x].Data.Channels; +{$ENDIF} + end; + + 2: + begin +{$IF DEFINED(fdkaac)} + setlength(FOutputBuff, StreamIn[x].Data.wantframes); + + GetMem(rawAACBuffer,StreamIn[x].Data.wantframes); + + // writeln('avant bytesRead'); + FBytesRead := StreamIn[x].InPipe.Read(rawAACBuffer[0],1024); + + // writeln('StreamIn[x].Data.bytesRead ' + inttostr(StreamIn[x].Data.bytesRead)); + + FByteFilled := FBytesRead; + FErrorCode := aacDecoder_Fill(StreamIn[x].Data.HandleSt,@rawAACBuffer, FBytesRead, + FByteFilled); + + // writeLn('FByteFilled ' + inttostr(FByteFilled)); + + len2 := 0; + len3 := 0; + + while true do + begin + FErrorCode := aacDecoder_DecodeFrame(StreamIn[x].Data.HandleSt, PSmallInt(FOutputBuff), + StreamIn[x].Data.wantframes, 0); + + if (FErrorCode <> AAC_DECODER_ERROR.AAC_DEC_OK) then + begin + if FErrorCode = AAC_DECODER_ERROR.AAC_DEC_NOT_ENOUGH_BITS then + break; + // writeln(Format('Decode failed: %x', [Integer(FErrorCode)])); + end; + // else writeln('Decode ok '); + + FCStreamInfo := aacDecoder_GetStreamInfo(StreamIn[x].Data.HandleSt); + if ((not assigned(FCStreamInfo)) or (FCStreamInfo^.sampleRate <= 0)) then + raise Exception.Create('No stream info'); + + for len := 0 to (FCStreamInfo^.frameSize) -1 do + + begin + // writeln(round(FOutputBuff[len])); + StreamIn[x].Data.Buffer[len + len2] := FOutputBuff[len]; + // writeln((StreamIn[x].Data.Buffer[len + len2])); + inc(len3); + end; + len2 := len2 + FCStreamInfo^.frameSize; + end; + + // StreamIn[x].Data.outframes := len3 * StreamIn[x].Data.Channels; + StreamIn[x].Data.outframes := len3 * 2; + + if StreamIn[x].Data.SampleFormat < 2 then + begin + StreamIn[x].Data.Buffer := CvInt16ToFloat32(StreamIn[x].Data.Buffer); + if StreamIn[x].Data.SampleFormat = 1 then + StreamIn[x].Data.Buffer := CvFloat32toInt32fl(StreamIn[x].Data.Buffer, length( + StreamIn[x].Data.Buffer)); + end; + + freemem(rawAACBuffer); + + // writeln('---------- FIN read url ok '); +{$ENDIF} + end; + + 4 : + begin +{$IF DEFINED(opus)} + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('===> Before op_read_x.') ; +{$endif} + + case StreamIn[x].Data.SampleFormat of + 0: + begin + StreamIn[x].Data.outframes := cint(op_read_float(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0], cint(StreamIn[x].Data. + Wantframes + Div StreamIn[x].Data.channels) , Nil)); + end; + 1: + begin + StreamIn[x].Data.outframes := cint(op_read_float(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0], cint(StreamIn[x].Data. + Wantframes + Div StreamIn[x].Data.channels), Nil)); + + // no int32 format with opus => need a conversion from float32 to int32. + StreamIn[x].Data.Buffer := Cvfloat32ToInt32fl( StreamIn[x].Data.Buffer, + StreamIn[x].Data.outframes * StreamIn[x].Data.Channels ) + ; + end; + 2: + begin + + StreamIn[x].Data.outframes := cint( op_read(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0], cint(StreamIn[x].Data. + Wantframes + Div StreamIn[x].Data.channels), Nil)); + + end; + end; + + setlength(StreamIn[x].data.Buffer, StreamIn[x].Data.outframes * StreamIn[x].Data.Channels) + ; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Seek outframes = '+inttostr(StreamIn[x].Data.outframes)) ; + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + st := st + '|' + inttostr(i) + '|' + floattostr(StreamIn[x].data.Buffer[i]); + WriteLn('OUTPUT DATA AFTER1 ------------------------------'); + // WriteLn(st); + writeln(' StreamIn[x].Data.outframes = '+inttostr(StreamIn[x].Data.outframes * StreamIn[x] + .Data.Channels)) ; +{$endif} + + if StreamIn[x].Data.outframes < 0 then StreamIn[x].Data.outframes := 0 ; + +{$ENDIF} + end; + end; + + if (StreamIn[x].Data.TypePut = 2) and ((StreamIn[x].Data.LibOpen = 1 ) or (StreamIn[x].Data. + LibOpen = 4 )) then + begin + if StreamIn[x].httpget.IsRunning = false then StreamIn[x].Data.status := 0; + // no more data then close the stream + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Check if internet is stopped.'); + {$endif} + end; + +end; +{$endif} + +procedure Tuos_Player.ReadFile(x : integer); +{$IF DEFINED(neaac) or DEFINED(uos_debug)} +var +{$endif} +{$IF DEFINED(neaac)} + outBytes: longword; +{$endif} +{$IF DEFINED(uos_debug) and DEFINED(unix)} + i : integer; + st : string; +{$endif} +begin + + if length(StreamIn[x].Data.Buffer) <> StreamIn[x].Data.Wantframes then + setlength(StreamIn[x].Data.Buffer,StreamIn[x].Data.Wantframes); + + case StreamIn[x].Data.LibOpen of + // Here we are, reading the data and store it in buffer + {$IF DEFINED(sndfile)} + 0: + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before sf_read ' + inttostr(StreamIn[x].Data.Wantframes) + + ' length(StreamIn[x].Data.Buffer ' + + inttostr(length(StreamIn[x].Data.Buffer))); + {$endif} + case StreamIn[x].Data.SampleFormat of + 0: StreamIn[x].Data.OutFrames := + sf_read_float(StreamIn[x].Data.HandleSt, + @StreamIn[x].Data.Buffer[0], StreamIn[x].Data.Wantframes + ); + 1: StreamIn[x].Data.OutFrames := + sf_read_int(StreamIn[x].Data.HandleSt, + @StreamIn[x].Data.Buffer[0], StreamIn[x].Data.Wantframes + ); + 2: StreamIn[x].Data.OutFrames := + sf_read_short(StreamIn[x].Data.HandleSt, + @StreamIn[x].Data.Buffer[0], StreamIn[x].Data.Wantframes + ); + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln(inttostr(StreamIn[x].Data.lastbuf)); + WriteLn('after sf_read'); + {$endif} + if StreamIn[x].Data.outframes < 0 then StreamIn[x].Data.outframes := 0 ; + + if (StreamIn[x].Data.lastbuf < 0) and (StreamIn[x].Data.outframes < StreamIn[x].Data. + wantframes) then + begin + StreamIn[x].Data.outframes := StreamIn[x].Data.wantframes; + StreamIn[x].Data.lastbuf := StreamIn[x].Data.lastbuf -1; + if StreamIn[x].Data.lastbuf = -9 then StreamIn[x].Data.lastbuf := 0; + end; + + setlength(StreamIn[x].data.Buffer,StreamIn[x].Data.outframes); + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + st := ''; + + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + case StreamIn[x].Data.SampleFormat of + 0: st := st + '|' + inttostr(i) + '=' + floattostr(StreamIn[x].data.Buffer[i]); + 1: st := st + '|' + inttostr(i) + '=' + inttostr(cint32(StreamIn[x].data.Buffer[i])); + 2: st := st + '|' + inttostr(i) + '=' + inttostr(cint16(cint32(StreamIn[x].data.Buffer[ + i]))); + end; + + WriteLn('OUTPUT DATA sf_read_() ---------------------------'); + WriteLn('StreamIn[x].Data.outframes = ' + inttostr(StreamIn[x].Data.outframes)); + WriteLn(st); + {$endif} + + end; + {$endif} + {$IF DEFINED(mpg123)} + 1: + begin + + mpg123_read(StreamIn[x].Data.HandleSt, @StreamIn[x].Data.Buffer[0], + StreamIn[x].Data.wantframes, StreamIn[x].Data.outframes); + + if StreamIn[x].Data.outframes < 0 then StreamIn[x].Data.outframes := 0 ; + + setlength(StreamIn[x].data.Buffer,StreamIn[x].Data.outframes Div + (StreamIn[x].Data.channels) ); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + case StreamIn[x].Data.SampleFormat of + 0: st := st + '|' + floattostr(StreamIn[x].data.Buffer[i]); + 1: st := st + '|' + inttostr(cint32(StreamIn[x].data.Buffer[i])); + 2: st := st + '|' + inttostr(cint16(cint32(StreamIn[x].data.Buffer[i]))); + end; + WriteLn('OUTPUT DATA mpg123_read_() ---------------------------'); + // WriteLn(st); + {$endif} + + StreamIn[x].Data.outframes := + StreamIn[x].Data.outframes Div StreamIn[x].Data.Channels; + end; + {$endif} + + {$IF DEFINED(neaac)} + 2 : + begin + StreamIn[x].AACI.lwDataLen := 0; + case StreamIn[x].AACI.outputFormat of + FAAD_FMT_16BIT, FAAD_FMT_32BIT, FAAD_FMT_FLOAT : + begin + outBytes := StreamIn[x].Data. + Wantframes; + MP4GetData(StreamIn[x].AACI, StreamIn + [x].AACI.pData, outBytes); + Move(StreamIn[x].AACI.pData^, + StreamIn[x].Data.Buffer[0], + outBytes); + StreamIn[x].AACI.lwDataLen := + + outBytes + ; + end; + end; + if StreamIn[x].AACI.lwDataLen > (StreamIn[x].AACI.BitsPerSample div 8) then + StreamIn[x].Data.outframes := trunc(StreamIn[x].AACI.lwDataLen Div (StreamIn[x].AACI. + BitsPerSample Div 8)) + else + StreamIn[x].Data.outframes := 0; + + if StreamIn[x].Data.outframes < 0 then StreamIn[x].Data.outframes := 0 ; + + + // setlength(StreamIn[x].data.Buffer,StreamIn[x].Data.outframes * StreamIn[x].Data.channels ); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + case StreamIn[x].Data.SampleFormat of + 0: st := st + '|' + floattostr(StreamIn[x].data.Buffer[i]); + 1: st := st + '|' + inttostr(cint32(StreamIn[x].data.Buffer[i])); + 2: st := st + '|' + inttostr(cint16(cint32(StreamIn[x].data.Buffer[i]))); + end; + WriteLn('OUTPUT DATA MP4GetData() ---------------------------'); + // WriteLn(st); + {$endif} + + end; + {$endif} + + {$IF DEFINED(cdrom)} + 3: + begin + StreamIn[x].pCD^.pDataLen := 0; + case StreamIn[x].pCD^.BitsPerSample of + 16 : + begin + outBytes := StreamIn[x].Data.Wantframes; + CDROM_GetData(StreamIn[x].pCD, StreamIn[x].pCD^.pData, outBytes); + Move(StreamIn[x].pCD^.pData^, StreamIn[x].Data.Buffer[0], outBytes); + StreamIn[x].pCD^.pDataLen := outBytes; + end; + end; + + if StreamIn[x].pCD^.pDataLen > (StreamIn[x].pCD^.BitsPerSample div 8) then + StreamIn[x].Data.outframes := StreamIn[x].pCD^.pDataLen Div (StreamIn[x].pCD^. + BitsPerSample Div 8) + else + StreamIn[x].Data.outframes := 0; + + end; + {$endif} + + {$IF DEFINED(opus)} + 4: + begin + + case StreamIn[x].Data.SampleFormat of + 0: StreamIn[x].Data.outframes := op_read_float(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0], cint(StreamIn[x].Data. + Wantframes Div StreamIn[x].Data.channels), Nil); + 1: + begin + StreamIn[x].Data.outframes := op_read_float(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0],cint(StreamIn[x].Data. + Wantframes Div StreamIn[x].Data.channels), Nil); + + // no int32 format with opus => needs a conversion from float32 to int32. + StreamIn[x].Data.Buffer := Cvfloat32ToInt32fl( StreamIn[x].Data.Buffer, + StreamIn[x].Data.outframes * StreamIn[x].Data.Channels ); + end; + 2: + begin + StreamIn[x].Data.outframes := op_read(StreamIn[x].Data.HandleOP, + @StreamIn[x].Data.Buffer[0], cint(StreamIn[x].Data. + Wantframes), Nil); + end; + + end; + + setlength(StreamIn[x].data.Buffer,int32(StreamIn[x].Data.outframes * StreamIn[x].Data. + Channels)); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st := ''; + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + case StreamIn[x].Data.SampleFormat of + 0: st := st + '|' + floattostr(StreamIn[x].data.Buffer[i]); + 1: st := st + '|' + inttostr(cint32(StreamIn[x].data.Buffer[i])); + 2: st := st + '|' + inttostr(cint16(cint32(StreamIn[x].data.Buffer[i]))); + end; + WriteLn('OUTPUT DATA op_read_ ---------------------------'); + // WriteLn(st); + {$endif} + + if StreamIn[x].Data.outframes < 0 then StreamIn[x].Data.outframes := 0 ; + StreamIn[x].Data.outframes := StreamIn[x].Data.outframes * StreamIn[x].Data.Channels ; + + end; + {$endif} + + {$IF DEFINED(xmp)} + 5: + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before xmp_play_buffer ' + inttostr(StreamIn[x].Data.Wantframes) + + ' length(StreamIn[x].Data.Buffer ' + + inttostr(length(StreamIn[x].Data.Buffer))); + {$endif} + + if xmp_play_buffer(StreamIn[x].Data.HandleSt, + @StreamIn[x].Data.Buffer[0], StreamIn[x].Data.Wantframes * StreamIn[x].Data.channels , 0 + ) < 0 then + StreamIn[x].Data.outframes := 0 + else + begin + StreamIn[x].Data.outframes := StreamIn[x].Data.Wantframes; + + if StreamIn[x].Data.SampleFormat < 2 then + begin + StreamIn[x].Data.Buffer := CvInt16ToFloat32(StreamIn[x].Data.Buffer); + if StreamIn[x].Data.SampleFormat = 1 then + StreamIn[x].Data.Buffer := CvFloat32toInt32fl(StreamIn[x].Data.Buffer, length( + StreamIn[x].Data.Buffer)); + end; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln(inttostr(StreamIn[x].Data.lastbuf)); + WriteLn('after xmp_play_buffer'); + {$endif} + setlength(StreamIn[x].data.Buffer,StreamIn[x].Data.outframes); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + + st := ''; + + for i := 0 to length(StreamIn[x].data.Buffer) -1 do + begin + st := st + '|' + inttostr(i) + '=' + inttostr(cint16(cint32(StreamIn[x].data.Buffer[ + i]))); + end; + + WriteLn('OUTPUT DATA xmp_read_ ---------------------------'); + WriteLn('StreamIn[x].Data.outframes = ' + inttostr(StreamIn[x].Data.outframes)); + // WriteLn(st); + {$endif} + + end; + {$endif} + + 99: // if nothing was defined + end; + + SetLength(StreamIn[x].Data.Buffer, StreamIn[x].Data.outframes); +end; + +procedure Tuos_Player.CheckIfPaused ; +begin + if isGlobalPause = true then + begin + RTLeventWaitFor(uosInit.evGlobalPause); + RTLeventSetEvent(uosInit.evGlobalPause); + end + else + begin + RTLeventWaitFor(evPause); + // is there a pause waiting ? + RTLeventSetEvent(evPause); + end; +end; + +{$IF DEFINED(mse)} +function Tuos_Player.execute(thread: tmsethread): integer; +// The Main Loop Procedure + {$else} +procedure TuosThread.Execute; +// The Main Loop Procedure + {$endif} +var + x, x2, x3 : cint32; + plugenabled: boolean; + curpos: cint64 = 0; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + st : string; + i : integer; + {$endif} + +begin + + theinc := 0; + + +{$IF DEFINED(mse)} + {$else} + with Tuos_Player(theparent) do + begin + {$endif} + + CheckIfPaused ; + // is there a pause waiting ? + + DoBeginMethods(); + + CheckIfPaused ; + // is there a pause waiting ? + + repeat + + if uosisactif then DoLoopBeginMethods + else nofree := false; + + CheckIfPaused ; + // is there a pause waiting ? + // Dealing with input + for x := 0 to high(StreamIn) do + begin + + if (StreamIn[x].data.hasfilters) and uosisactif then + begin + setlength(StreamIn[x].Data.levelfiltersar,StreamIn[x].Data.nbfilters * StreamIn[x]. + Data.channels ); + StreamIn[x].Data.incfilters := 0; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before for x := 0 to high(StreamIn)'); + {$endif} + + CheckIfPaused ; + // is there a pause waiting ? + + if (StreamIn[x].Data.Status > 0) and + (StreamIn[x].Data.Enabled = True) then + begin + + StreamIn[x].Data.levelfilters := ''; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before StreamIn[x].Data.Seekable = True'); + {$endif} + if (StreamIn[x].Data.Poseek > -1) and (StreamIn[x].Data.Seekable = True) and + uosisactif then + begin + // there is a seek waiting + + DoSeek(x); + + curpos := StreamIn[x].Data.Poseek; + StreamIn[x].Data.Poseek := -1; + end; + + if (StreamIn[x].Data.positionEnable = 1) and (StreamIn[x].Data.Seekable = True) + then + StreamIn[x].Data.position := curpos; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin BeforeBufProc 1'); + {$endif} + if (StreamIn[x].Data.Status = 1) and (length(StreamIn[x].DSP) > 0) then + DoDSPinBeforeBufProc(x); + // Procedure in DSP to execute before fill buffer. + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin BeforeBufProc 2'); + {$endif} + + if uosisactif then + begin + CheckIfPaused ; + // is there a pause waiting ? + case StreamIn[x].Data.TypePut of + + 0: // It is a input from audio file. + ReadFile(x); + + {$IF DEFINED(portaudio)} + 1: // for Input from device + ReadDevice(x); + {$endif} + + {$IF DEFINED(webstream)} + 2: // for Input from Internet audio stream. + ReadUrl(x); + {$ENDIF} + + {$IF DEFINED(synthesizer)} + 3: // for Input from Synthesizer + ReadSynth(x); + {$endif} + + 4: // for Input from memory + ReadMem(x); + + 5: // for Input from endless muted + ReadEndless(x); + + 6: // for Input from decoded memory-stream + ReadMemDec(x); + + end; + //case StreamIn[x].Data.TypePut of + + end + else StreamIn[x].Data.OutFrames := 0; + + if StreamIn[x].Data.OutFrames = 0 then StreamIn[x].Data.status := 0; + + if (StreamIn[x].Data.Seekable = True) then if StreamIn[x].Data.OutFrames < 100 then + StreamIn[x].Data.status := 0; + // no more data then close the stream + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('StreamIn[x].Data.status = ' + inttostr(StreamIn[x].Data.status)); + {$endif} + + if StreamIn[x].Data.status > 0 then// still working + begin + + if (StreamIn[x].Data.positionEnable = 1) then + begin + if (StreamIn[x].Data.LibOpen = 1) and (StreamIn[x].Data.SampleFormat < 2) + then + + curpos := curpos + (StreamIn[x].Data.OutFrames Div + (StreamIn[x].Data.Channels * 2)) + // strange outframes float 32 with Mpg123 ? + else + curpos := curpos + (StreamIn[x].Data.OutFrames Div + (StreamIn[x].Data.Channels)); + + StreamIn[x].Data.position := curpos; + // new position + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Getting the level before DSP procedure'); + {$endif} + + if (StreamIn[x].Data.levelEnable = 1) or (StreamIn[x].Data.levelEnable = 3) then + StreamIn[x].Data := DSPLevel(StreamIn[x].Data); + + // Adding level in array-level// ideal for pre-wave form + if (StreamIn[x].Data.levelArrayEnable = 1) then + begin + if (StreamIn[x].Data.levelEnable = 0) or (StreamIn[x].Data.levelEnable = 3) + then + StreamIn[x].Data := DSPLevel(StreamIn[x].Data); + DoArrayLevel(x); + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin AfterBuffProcBefore'); + {$endif} + + if (StreamIn[x].Data.Status = 1) and (length(StreamIn[x].DSP) > 0) then + DoDSPinAfterBufProc(x) ; + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('DSPin AfterBuffProcAfter'); + {$endif} + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('The synchro main loop procedurebefore'); + {$endif} + DoMainLoopProc(x); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Getting the level after DSP procedure'); + {$endif} + + // Getting the level after DSP procedure + if ((StreamIn[x].Data.levelEnable = 2) or (StreamIn[x].Data.levelEnable = 3)) + then StreamIn[x].Data := DSPLevel(StreamIn[x].Data); + + // Adding level in array-level + if (StreamIn[x].Data.levelArrayEnable = 2) then + begin + if (StreamIn[x].Data.levelEnable = 0) or (StreamIn[x].Data.levelEnable = 1) + then + StreamIn[x].Data := DSPLevel(StreamIn[x].Data); + DoArrayLevel(x); + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('End level after DSP procedure'); + {$endif} + + end; + //if StreamIn[x].Data.status > 0 then + + end; + //if (StreamIn[x].Data.Status > 0) and (StreamIn[x].Data.Enabled = True) then + + end; + // end for low(StreamIn[x]) to high(StreamIn[x]) + + // Seeking if StreamIn is terminated + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Seeking if StreamIn is terminated'); + {$endif} + + if status <> 0 then SeekIfTerminated; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('status = ' +inttostr(status)); + {$endif} + + CheckIfPaused ; + // is there a pause waiting ? + + // Give Buffer to Output + if status = 1 then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Give Buffer to Output'); + {$endif} + + if uosisactif then for x := 0 to high(StreamOut) do + + if (StreamOut[x].Data.Enabled = True) + then + begin + + if StreamOut[x].data.hasfilters then + begin + setlength(StreamOut[x].Data.levelfiltersar,StreamOut[x]. + Data.nbfilters * StreamOut[x].Data.channels ); + StreamOut[x].Data.incfilters := 0; + end; + + for x2 := 0 to high(StreamOut[x].Data.Buffer) do + StreamOut[x].Data.Buffer[x2] := cfloat(0.0); + // clear output + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Buffer[x2] := cfloat(0.0)'); + {$endif} + for x2 := 0 to high(StreamIn) do + if (StreamIn[x2].Data.status > 0) and + (StreamIn[x2].Data.Enabled = True) + and ((StreamIn[x2].Data.Output = x) or (StreamIn[x2].Data + .Output = -1)) + then + begin + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('length(StreamIn[x2].Data.Buffer) = ' +inttostr( + length(StreamIn[x2].Data.Buffer))); + writeln('length(StreamOut[x].Data.Buffer) = ' +inttostr( + length(StreamOut[x].Data.Buffer))); + writeln( + + 'for x3 := 0 to high(StreamIn[x2].Data.Buffer) do' + ); + writeln('high(StreamIn[x2].Data.Buffer) = '+ inttostr( + high(StreamIn[x2].Data.Buffer))); + {$endif} + + for x3 := 0 to high(StreamIn[x2].Data.Buffer) do + begin + if x3 < high(StreamOut[x].Data.Buffer) + 1 then + StreamOut[x].Data.Buffer[x3] := + cfloat(StreamOut[x] + .Data.Buffer[x3]) + + cfloat(StreamIn[x2] + .Data.Buffer[x3]); + + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn( + + 'StreamOut[x].Data.Buffer ------------------------------' + ); + st := ''; + for i := 0 to length(StreamOut[0].Data.Buffer) -1 do + st := st + '|' + inttostr(i) + '=' + floattostr( + Streamout[0].Data.Buffer[i]); + // WriteLn(st); + writeln( + + 'for x3 := 0 to high(StreamIn[x2].Data.Buffer) done' + ); + {$endif} + + case StreamIn[x2].Data.LibOpen of + 0: StreamOut[x].Data.outframes := StreamIn[x2].Data. + outframes ; + // sndfile + 1: StreamOut[x].Data.outframes := StreamIn[x2].Data. + outframes Div + StreamIn[x2].Data. + Channels; + // mpg123 + 2: StreamOut[x].Data.outframes := StreamIn[x2].Data. + outframes ; + // aac + 3: StreamOut[x].Data.outframes := StreamIn[x2].Data. + outframes ; + // CDRom + 4: StreamOut[x].Data.outframes := StreamIn[x2].Data. + outframes ; + // opus + end; + + end; + + // copy buffer-in into buffer-out + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('copy buffer-in into buffer-out'); + {$endif} + + // DSPOut AfterBuffProc + if (length(StreamOut[x].DSP) > 0) and uosisactif then + + DoDSPOutAfterBufProc(x) ; + + // apply plugin (ex: SoundTouch Library) + plugenabled := False; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln(' if (length(Plugin) > 0) then'); + {$endif} + + if (length(Plugin) > 0) then + begin + for x3 := 0 to high(PlugIn) do + if Plugin[x3].Enabled = True then + plugenabled := True; + end; + // + + if uosisactif then + begin + if plugenabled = True then + WriteOutPlug(x, x2) + else// No plugin + WriteOut(x, x2); + end; + + end; + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before LoopEndProc ------------------------------'); + {$endif} + + if uosisactif then DoLoopEndMethods; + + if length(StreamIn) > 1 then// clear buffer for multi-input + for x2 := 0 to high(StreamIn) do + for x3 := 0 to high(StreamIn[x2].Data.Buffer) do + StreamIn[x2].Data.Buffer[x3] := cfloat(0.0); + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before if (nofree = true) and (status = 0)-----'); + {$endif} + + if (nofree = true) and (status = 0) then + + DoTerminateNoFreePlayer ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before until status = 0;----'); + {$endif} + + until status = 0; + + // End of Loop --- + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + WriteLn('Before Terminate Thread---'); + {$endif} + + // Terminate Thread + if status = 0 then + begin + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('Status = 0'); + {$endif} + + DoTerminatePlayer; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('EndProc---'); + {$endif} + + if uosisactif then DoEndProc; + + if uosisactif then if EndProcOnly <> nil then EndProcOnly; + + isAssigned := false ; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('EndProc All'); + {$endif} + end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('This is the end...'); + {$endif} + + {$IF DEFINED(mse)} + + {$else} + // FreeOnTerminate:=True; + // terminate(); + end; + {$endif} +end; + +procedure Tuos_Init.unloadPlugin(PluginName: Pchar); +// Unload Plugin... +begin + + {$IF DEFINED(soundtouch)} + if lowercase(PluginName) = 'soundtouch' then st_Unload(); + {$endif} + {$IF DEFINED(bs2b)} + if lowercase(PluginName) = 'bs2b' then bs_Unload(); + {$endif} + +end; + +procedure Tuos_Init.unloadlib; +begin + {$IF DEFINED(sndfile)} + Sf_Unload(); + {$endif} + {$IF DEFINED(mpg123)} + Mp_Unload(); + {$endif} + {$IF DEFINED(xmp)} + xmp_Unload(); + {$endif} + {$IF DEFINED(portaudio)} + Pa_Unload(); + {$endif} + {$IF DEFINED(neaac)} + Aa_Unload; + {$endif} + {$IF DEFINED(fdkaac)} + ad_Unload; + {$endif} + {$IF DEFINED(opus)} + //op_Unload; + of_Unload; + {$endif} + {$IF DEFINED(windows)} + Set8087CW(old8087cw); + {$endif} +end; + +function Tuos_Init.InitLib(): cint32; +begin + Result := -1; + {$IF DEFINED(mpg123)} + if (uosLoadResult.MPloadERROR = 0) then + if mpg123_init() = MPG123_OK then + begin + mpversion := UTF8Decode(mpg123_decoders()^); + uosLoadResult.MPinitError := 0; + Result := 0; + end + else + begin + Result := -2; + uosLoadResult.MPinitError := 1; + end; + {$endif} + + {$IF DEFINED(portaudio)} + if (uosLoadResult.PAloadERROR = 0) then + begin + uosLoadResult.PAinitError := Pa_Initialize(); + paversion := UTF8Decode(Pa_GetVersionText()); + if uosLoadResult.PAinitError = 0 then + begin + Result := 0; + DefDevInInfo := Nil ; + DefDevOutInfo := Nil ; + + DefDevOut := Pa_GetDefaultOutputDevice(); + if DefDevOut >= 0 then + DefDevOutInfo := Pa_GetDeviceInfo(DefDevOut); + if DefDevOutInfo <> nil then + DefDevOutAPIInfo := Pa_GetHostApiInfo(DefDevOutInfo^.hostApi); + + DefDevIn := Pa_GetDefaultInputDevice(); + if DefDevIn >= 0 then + DefDevInInfo := Pa_GetDeviceInfo(DefDevIn); + if DefDevInInfo <> nil then + DefDevInAPIInfo := Pa_GetHostApiInfo(DefDevInInfo^.hostApi); + end; + + end; + {$endif} + + {$IF DEFINED(sndfile)} + if (Result = -1) and (uosLoadResult.SFloadERROR = 0) then + begin + sfversion := UTF8Decode(sf_version_string()); + Result := 0; + end; + {$endif} + + {$IF DEFINED(xmp)} + if (Result = -1) and (uosLoadResult.XMloadERROR = 0) then + begin + Result := 0; + end; + {$endif} + +end; + +function Tuos_Init.loadlib(): cint32; +begin + Result := -1; + uosLoadResult.PAloadERROR := -1; + uosLoadResult.SFloadERROR := -1; + uosLoadResult.MPloadERROR := -1; + uosLoadResult.AAloadError := -1; + uosLoadResult.OPloadERROR := -1; + uosLoadResult.STloadERROR := -1; + uosLoadResult.BSloadERROR := -1; + uosLoadResult.XMloadERROR := -1; + uosLoadResult.FAloadERROR := -1; + + {$IF DEFINED(portaudio)} + if (PA_FileName <> nil) and (PA_FileName <> '') then + begin + if PA_FileName = 'system' then PA_FileName := '' ; + if Pa_Load(PA_FileName) then + begin + // { + Result := 0; + uosLoadResult.PAloadERROR := 0; + uosDefaultDeviceOut := Pa_GetDefaultOutPutDevice(); + uosDefaultDeviceIn := Pa_GetDefaultInPutDevice(); + uosDeviceCount := Pa_GetDeviceCount(); + // } + end + else + uosLoadResult.PAloadERROR := 2; + end + else + uosLoadResult.PAloadERROR := -1; + {$endif} + + {$IF DEFINED(sndfile)} + if (SF_FileName <> nil) and (SF_FileName <> '') then + begin + if Sf_FileName = 'system' then sf_FileName := '' ; + if Sf_Load(SF_FileName) then + begin + uosLoadResult.SFloadERROR := 0; + if uosLoadResult.PAloadERROR = -1 then + Result := 0; + end + else + begin + uosLoadResult.SFloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.SFloadERROR := -1; + {$endif} + + {$IF DEFINED(mpg123)} + if (MP_FileName <> nil) and (MP_FileName <> '') then + begin + if mp_FileName = 'system' then mp_FileName := '' ; + if mp_Load(Mp_FileName) then + begin + uosLoadResult.MPloadERROR := 0; + if (uosLoadResult.PAloadERROR = -1) and (uosLoadResult.SFloadERROR = -1) then + Result := 0; + end + else + begin + uosLoadResult.MPloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.MPloadERROR := -1; + {$endif} + + {$IF DEFINED(neaac)} + if (AA_FileName <> nil) and (AA_FileName <> '') and (M4_FileName <> nil) and (M4_FileName <> '') + then + begin + if m4_FileName = 'system' then m4_FileName := '' ; + if aa_FileName = 'system' then aa_FileName := '' ; + + if aa_load(UTF8String(M4_FileName), UTF8String(AA_FileName)) then + begin + uosLoadResult.AAloadERROR := 0; + if (uosLoadResult.MPloadERROR = -1) and (uosLoadResult.PAloadERROR = -1) and + (uosLoadResult.SFloadERROR = -1) then + Result := 0; + end + else + begin + uosLoadResult.AAloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.AAloadERROR := -1; + {$endif} + + {$IF DEFINED(opus)} + if (OF_FileName <> nil) and (OF_FileName <> '') then + begin + if of_FileName = 'system' then of_FileName := '' ; + if (of_load(UTF8String(OF_FileName))) then + begin + uosLoadResult.OPloadERROR := 0; + if (uosLoadResult.MPloadERROR = -1) and (uosLoadResult.PAloadERROR = -1) and + (uosLoadResult.SFloadERROR = -1) and (uosLoadResult.AAloadERROR = -1) + then + Result := 0; + end + else + begin + uosLoadResult.OPloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.OPloadERROR := -1; + {$endif} + + {$IF DEFINED(xmp)} + if (XM_FileName <> nil) and (XM_FileName <> '') then + begin + if XM_FileName = 'system' then XM_FileName := '' ; + if (xmp_Load(UTF8String(XM_FileName))) then + begin + uosLoadResult.XMloadERROR := 0; + if (uosLoadResult.MPloadERROR = -1) and (uosLoadResult.PAloadERROR = -1) and + (uosLoadResult.SFloadERROR = -1) and (uosLoadResult.AAloadERROR = -1) and + (uosLoadResult.OPloadERROR = -1) + then + Result := 0; + end + else + begin + uosLoadResult.XMloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.XMloadERROR := -1; + {$endif} + + {$IF DEFINED(fdkaac)} + if (FA_FileName <> nil) and (FA_FileName <> '') then + begin + if FA_FileName = 'system' then FA_FileName := '' ; + if (ad_Load(UTF8String(FA_FileName))) then + begin + uosLoadResult.FAloadERROR := 0; + if (uosLoadResult.MPloadERROR = -1) and (uosLoadResult.PAloadERROR = -1) and + (uosLoadResult.SFloadERROR = -1) and (uosLoadResult.AAloadERROR = -1) and + (uosLoadResult.OPloadERROR = -1) and (uosLoadResult.XMloadERROR = -1) + then + Result := 0; + end + else + begin + uosLoadResult.FAloadERROR := 2; + Result := -1; + end; + end + else + uosLoadResult.FAloadERROR := -1; + {$endif} + + if Result = 0 then Result := InitLib(); +end; + + +function uos_loadPlugin(PluginName, PluginFilename: PChar) : cint32; +begin + Result := -1; + {$IF DEFINED(soundtouch)} + if ((lowercase(PluginName) = 'soundtouch') or (lowercase(PluginName) = 'getbpm')) and ( + PluginFileName <> nil) and (PluginFileName <> '') then + begin + if PluginFileName = 'system' then PluginFileName := '' ; + if ST_Load(PluginFileName) then + begin + Result := 0; + uosLoadResult.STloadERROR := 0; + uosInit.Plug_ST_FileName := PluginFileName; + end + else + begin + uosLoadResult.STloadERROR := 2; + Result := -1; + end; + end; + + {$endif} + + {$IF DEFINED(bs2b)} + if (lowercase(PluginName) = 'bs2b') and (PluginFileName <> nil) and (PluginFileName <> '') then + begin + if PluginFileName = 'system' then PluginFileName := '' ; + if BS_Load(PluginFileName) then + begin + Result := 0; + uosLoadResult.BSloadERROR := 0; + uosInit.Plug_BS_FileName := PluginFileName; + end + else + begin + uosLoadResult.BSloadERROR := 2; + Result := -1; + end; + end; + {$endif} +end; + + +{$IF DEFINED(shout)} +function uos_LoadServerLib(ShoutFileName, OpusFileName : PChar) : cint32; +// Shout => needed for dealing with IceCast server +// Opus => needed for dealing with encoding opus stream +begin + Result := -1; + if not fileexists(ShoutFileName) then + else + if sh_Load(UTF8String(ShoutFileName)) then + Result := 0; + + if result = 0 then + if not fileexists(OpusFileName) then + Result := -2 + else + if op_Load(UTF8String(OpusFileName)) then + Result := 0 + else Result := -1 ; +end; + +procedure uos_unloadServerLib(); +// Unload server libraries... Do not forget to call it before close application... +begin + shout_shutdown; + sh_unload; + op_unload; +end; +{$endif} + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName, fdkaacFilename : PChar) : cint32; +begin + result := -1 ; + if not assigned(uosInit) then + begin + + {$IF DEFINED(windows)} + old8087cw := Get8087CW; + Set8087CW($133f); + {$endif} + + uosInit := TUOS_Init.Create; + // Create Libraries Loader-Init + end; + + uosInit.PA_FileName := PortAudioFileName; + uosInit.SF_FileName := SndFileFileName; + uosInit.MP_FileName := Mpg123FileName; + uosInit.AA_FileName := FaadFileName; + uosInit.M4_FileName := Mp4ffFileName; + uosInit.OF_FileName := opusfileFileName; + uosInit.XM_FileName := XMPFileName; + uosInit.FA_FileName := fdkaacFilename; + + result := uosInit.loadlib ; +end; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName : PChar) : cint32; +begin + result := uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, + FaadFileName + , opusfileFileName, XMPFileName, nil); +end; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName: PChar) : cint32; +begin + result := uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, + FaadFileName + , opusfileFileName, Nil, nil); +end; + +function uos_GetVersion() : cint32 ; +begin + result := uos_version ; +end; + +function Tuos_Player.SetGlobalEvent(isenabled : boolean) : boolean; +// Set the RTL Events Global (will pause/start/replay all the players synchro with same rtl event)) +// result : true if set ok. +begin + result := false; + if (isAssigned = True) then + begin + isGlobalPause := isenabled; + result := true; + end; +end; + +procedure uos_unloadlib() ; +begin + if assigned(uosInit) then + begin + uosInit.unloadlib ; + end; +end; + +procedure uos_unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: boolean); +// Custom Unload libraries... if true, then unload the library. You may unload what and when you want... +begin + uosInit.unloadlibcust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac) ; +end; + +procedure uos_UnloadPlugin(PluginName: PChar); +// load plugin... +begin + uosInit.unloadplugin(PluginName); +end; + +function uos_GetInfoLibraries() : PansiChar ; +begin + result := pchar(paversion + ' | Sndfile: ' + sfversion + ' | Mpg123: ' + mpversion); +end; + +{$IF DEFINED(portaudio)} +procedure uos_UpdateDevice(); +begin + Pa_Terminate(); + Pa_Initialize(); +end; + +procedure uos_GetInfoDevice(); +var + x: cint32; + devinf: PPaDeviceInfo; + apiinf: PPaHostApiInfo; +begin + x := 0; + uosDeviceCount := 0; + SetLength(uosDeviceInfos, 0); + + uos_UpdateDevice(); + + if Pa_GetDeviceCount() > 0 then + begin + uosDeviceCount := Pa_GetDeviceCount(); + + SetLength(uosDeviceInfos, uosDeviceCount); + uosDefaultDeviceOut := Pa_GetDefaultOutPutDevice(); + uosDefaultDeviceIn := Pa_GetDefaultInPutDevice(); + + while x < uosDeviceCount do + begin + uosDeviceInfos[x].DeviceNum := x; + + devinf := Pa_GetDeviceInfo(x); + apiinf := Pa_GetHostApiInfo(devinf^.hostApi); + + uosDeviceInfos[x].DeviceName := UTF8Decode(devinf^._name); + uosDeviceInfos[x].HostAPIName := UTF8Decode(apiinf^._name); + + if x = uosDefaultDeviceIn then + uosDeviceInfos[x].DefaultDevIn := True + else + uosDeviceInfos[x].DefaultDevIn := False; + + if x = uosDefaultDeviceOut then + uosDeviceInfos[x].DefaultDevOut := True + else + uosDeviceInfos[x].DefaultDevOut := False; + + uosDeviceInfos[x].ChannelsIn := devinf^.maxInputChannels; + uosDeviceInfos[x].ChannelsOut := devinf^.maxOutPutChannels; + uosDeviceInfos[x].SampleRate := devinf^.defaultSampleRate; + uosDeviceInfos[x].LatencyHighIn := devinf^.defaultHighInputLatency; + uosDeviceInfos[x].LatencyLowIn := devinf^.defaultLowInputLatency; + uosDeviceInfos[x].LatencyHighOut := devinf^.defaultHighOutputLatency; + uosDeviceInfos[x].LatencyLowOut := devinf^.defaultLowOutputLatency; + + if uosDeviceInfos[x].ChannelsIn = 0 then + begin + if uosDeviceInfos[x].ChannelsOut = 0 then + uosDeviceInfos[x].DeviceType := 'None' + else uosDeviceInfos[x].DeviceType := 'Out' ; + end + else + begin + if uosDeviceInfos[x].ChannelsOut = 0 then + uosDeviceInfos[x].DeviceType := 'In' + else uosDeviceInfos[x].DeviceType := 'In/Out' ; + end ; + Inc(x); + end; + end; +end; + +function uos_GetInfoDeviceStr() : PansiChar ; +var + x : cint32 ; + devtmp , bool1, bool2 : UTF8String; +begin + + uos_GetInfoDevice() ; + + x := 0; + devtmp := ''; + + while x < length(uosDeviceInfos) do + begin + if uosDeviceInfos[x].DefaultDevIn then bool1 := 'Yes' + else bool1 := 'No'; + if uosDeviceInfos[x].DefaultDevOut then bool2 := 'Yes' + else bool2 := 'No'; + + devtmp := devtmp + + + 'DeviceNum: ' + inttostr(uosDeviceInfos[x].DeviceNum) + ' |' + + ' Name: ' + uosDeviceInfos[x].DeviceName + ' |' + + ' Type: ' + uosDeviceInfos[x].DeviceType + ' |' + + ' DefIn: ' + bool1 + ' |' + + ' DefOut: ' + bool2 + ' |' + + ' ChanIn: ' + IntToStr(uosDeviceInfos[x ].ChannelsIn)+ ' |' + + ' ChanOut: ' + IntToStr(uosDeviceInfos[x].ChannelsOut) + ' |' + + ' SampleRate: ' + floattostrf(uosDeviceInfos[x].SampleRate, ffFixed, 15, 0) + ' |' + + + ' LatencyHighIn: ' + floattostrf(uosDeviceInfos[x].LatencyHighIn, ffFixed, 15, 8) + + ' |' + + ' LatencyHighOut: ' + floattostrf(uosDeviceInfos[x].LatencyHighOut, ffFixed, 15, 8)+ + ' |' + + ' LatencyLowIn: ' + floattostrf(uosDeviceInfos[x].LatencyLowIn, ffFixed, 15, 8)+ + ' |' + + ' LatencyLowOut: ' + floattostrf(uosDeviceInfos[x].LatencyLowOut, ffFixed, 15, 8)+ + ' |' + + ' HostAPI: ' + uosDeviceInfos[x].HostAPIName ; + if x < length(uosDeviceInfos)-1 then devtmp := devtmp + #13#10 ; + Inc(x); + end; + result := pansichar( devtmp + ' ' ); + + // } +end; +{$endif} + +{$IF DEFINED(Java)} +procedure Tuos_Player.beginprocjava(); +begin + (PEnv^^).CallVoidMethod(PEnv,Obj,BeginProc) ; +end; + +procedure Tuos_Player.endprocjava(); +begin + (PEnv^^).CallVoidMethod(PEnv,Obj,EndProc) ; +end; + +procedure Tuos_Player.LoopBeginProcjava(); +begin + (PEnv^^).CallVoidMethod(PEnv,Obj,LoopBeginProc) ; +end; + +procedure Tuos_Player.LoopEndProcjava(); +begin + (PEnv^^).CallVoidMethod(PEnv,Obj,LoopEndProc) ; +end; + +procedure Tuos_DSP.LoopProcjava(); +begin + // todo +end; + +procedure Tuos_InStream.LoopProcjava(); +begin + // todo +end; + +procedure Tuos_OutStream.LoopProcjava(); +begin + // todo +end; + +{$endif} + +{$IF DEFINED(webstream)} +procedure Tuos_InStream.UpdateIcyMetaInterval; +begin + if Data.HandleSt<>nil then + mpg123_param(Data.HandleSt, MPG123_ICY_INTERVAL, httpget.IcyMetaInt, 0); +end; +{$endif} + +function AssignDefaultForUOSData: Tuos_Data; +var + i: Integer; +begin + with Result do + begin + Enabled := False; + TypePut := -1; + //nothing + Seekable := False; + Status := 0; + // no data + + + SetLength(Buffer,0); + SetLength(MemoryBuffer,0); + MemoryStream := Nil; + posmem := 0; + + {$IF DEFINED(opus)} + SetLength(BufferTMP,0); + {$endif} + + DSPVolumeIndex := -1; + DSPNoiseIndex := -1; + VLeft := 0; + + VRight := 0; + + hasfilters := false; + + nbfilters := 0; + + incfilters := 0; + + PositionEnable := 0; + LevelEnable := 0; + LevelLeft := 0; + LevelRight := 0; + levelArrayEnable := 0; + + //----------------------------// + SampleRate := 44100; + {$IF DEFINED(synthesizer)} + freqLsine := 440; + freqRsine := freqLsine; + dursine := 0; + posdursine := 0; + harmonic := 0; + {$endif} + SamplerateRoot := SampleRate; + //----------------------------// + + Wantframes := 0; + OutFrames := 0; + + SampleFormat := -1; + // default + Channels := -1; + // default + + HandleSt := Nil; + {$IF DEFINED(opus)} + HandleOP := Nil; + {$endif} + + Filename := ''; + Title := ''; + Copyright := ''; + Software := ''; + Artist := ''; + Comment := ''; + Date := ''; + for i:= 0 to High(Tag) do + Tag[i] := #0; + Album := ''; + Genre := ''; + HDFormat := 0; + Frames := 0; + Sections := 0; + Encoding := -1; + // unknow + bitrate := -1; + // unknow + Length := 0; + LibOpen := -1; + // nothing open + Ratio := 0; + + BPM := 0; + + numbuf := -1; + //default + + Output := -1; + //error + + Position := 0; + Poseek := 0; + end; +end; + +constructor Tuos_FFT.Create; +var + i: Integer; +begin + inherited; + + AlsoBuf := False; + + TypeFilterL := 0; + LowFrequencyL := 0; + HighFrequencyL := 0; + GainL := 0; + + for i:= 0 to High(a3) do + a3[i] := 0; + for i:= 0 to High(a32) do + a32[i] := 0; + + for i:= 0 to High(TArray01) do + begin + b2[i] := 0; + x0[i] := 0; + x1[i] := 0; + y0[i] := 0; + y1[i] := 0; + b22[i] := 0; + x02[i] := 0; + x12[i] := 0; + y02[i] := 0; + y12[i] := 0; + end; + + C := 0; + D := 0; + C2 := 0; + D2 := 0; + + TypeFilterR := 0; + LowFrequencyR := 0; + HighFrequencyR := 0; + GainR := 0; + for i:= 0 to High(a3r) do + a3r[i] := 0; + for i:= 0 to High(a32r) do + a32r[i] := 0; + + for i:= 0 to High(TArray01) do + begin + b2r[i] := 0; + x0r[i] := 0; + x1r[i] := 0; + y0r[i] := 0; + y1r[i] := 0; + b22r[i] := 0; + x02r[i] := 0; + x12r[i] := 0; + y02r[i] := 0; + y12r[i] := 0; + end; + + Cr := 0; + Dr := 0; + C2r := 0; + D2r := 0; + + levelstring := ''; + + {$IF DEFINED(noiseremoval)} + FNoise := Nil; + {$endif} +end; + +constructor Tuos_DSP.Create; +begin + inherited; + + Enabled := False; + BefFunc := Nil; + AftFunc := Nil; + EndFunc := Nil; + LoopProc := Nil; + fftdata := Nil; +end; + +constructor Tuos_InStream.Create; +begin + inherited; + + Data := AssignDefaultForUOSData; + SetLength(DSP,0); + + {$IF DEFINED(neaac)} + AACI := Nil; + {$endif} + + {$IF DEFINED(cdrom)} + pCD := Nil; + {$endif} + + {$IF DEFINED(webstream)} + httpget := Nil; + + InHandle := 0; + OutHandle := 0; + + InPipe := Nil; + OutPipe := Nil; + {$ENDIF} + + {$IF DEFINED(portaudio)} + with PAParam do + begin + device := 0; + channelCount := 0; + sampleFormat := Nil; + suggestedLatency := 0; + hostApiSpecificStreamInfo := Nil; + end; + {$endif} + + LoopProc := Nil; +end; + +constructor Tuos_OutStream.Create; +{$IF DEFINED(shout)} +var + i: integer; +{$endif} +begin + inherited; + + Data := AssignDefaultForUOSData; + BufferOut := Nil; + SetLength(DSP,0); + + {$IF DEFINED(portaudio)} + with PAParam do + begin + //TODO: check if the default settings are ok + device := 0; + channelCount := 0; + sampleFormat := Nil; + suggestedLatency := 0; + hostApiSpecificStreamInfo := Nil; + end; + {$endif} + + {$IF DEFINED(shout)} + encoder := Nil; + for i:= 0 to High(cbits) do + cbits[i] := 0; + //byte + {$endif} + + + + with FileBuffer do + begin + ERROR := 0; + wSamplesPerSec := 44100; + wBitsPerSample := 32; + wChannels := 2; + FileFormat := -1; + Data := Nil; + DataMS := Nil; + end; + LoopProc := Nil; + + MemorySteamOut := Nil; + + {$IF DEFINED(Java)} + // procedure LoopProcjava; + {$endif} +end; + +constructor Tuos_Plugin.Create; +begin + inherited; + + Enabled := False; + Name := ''; + + {$IF DEFINED(windows)} + PlugHandle := 0; + {$else} + PlugHandle := Nil; + {$endif} + + {$IF DEFINED(bs2b) or DEFINED(soundtouch)} + Abs2b := Nil; + PlugFunc := Nil; + {$endif} + param1 := -1; + param2 := -1; + param3 := -1; + param4 := -1; + param5 := -1; + param6 := -1; + param7 := -1; + param8 := -1; + + SetLength(Buffer,0); +end; + +constructor Tuos_Init.Create; +begin + {$IF DEFINED(portaudio)} + DefDevOut := -1; + DefDevOutInfo := Nil; + DefDevOutAPIInfo := Nil; + DefDevIn := -1; + DefDevInInfo := Nil; + DefDevInAPIInfo := Nil; + {$endif} + + TDummyThread.Create(false); + evGlobalPause := RTLEventCreate; + + SetExceptionMask(GetExceptionMask + [exZeroDivide] + [exInvalidOp] + + [exDenormalized] + [exOverflow] + [exUnderflow] + [exPrecision]); + uosLoadResult.PAloadERROR := -1; + uosLoadResult.PCloadERROR := -1; + uosLoadResult.SFloadERROR := -1; + uosLoadResult.BSloadERROR := -1; + uosLoadResult.STloadERROR := -1; + uosLoadResult.MPloadERROR := -1; + uosLoadResult.AAloadERROR := -1; + uosLoadResult.OPloadERROR := -1; + uosLoadResult.XMloadERROR := -1; + uosLoadResult.PAinitError := -1; + uosLoadResult.MPinitError := -1; + + PA_FileName := Nil; + // PortAudio + SF_FileName := Nil; + // SndFile + MP_FileName := Nil; + // Mpg123 + AA_FileName := Nil; + // Faad + M4_FileName := Nil; + // Mp4ff + OF_FileName := Nil; + // opusfile + XM_FileName := Nil; + // XMP + Plug_ST_FileName := Nil; + // Plugin SoundTouch + Plug_BS_FileName := Nil; + // Plugin bs2b +end; + +constructor Tuos_Player.create(); +begin + evPause := RTLEventCreate; + + Index := -1; + //default for independent instance + + isAssigned := true; + isGlobalPause := false; + intobuf := false; + NLooped := 0; + NoFree := False; + status := -1; + BeginProc := Nil; + EndProc := Nil; + EndProcOnly := Nil; + loopBeginProc := Nil; + loopEndProc := Nil; + + thethread := Nil; + SetLength(StreamIn,0); + SetLength(StreamOut,0); + SetLength(PlugIn,0); + + {$IF DEFINED(Java)} + PEnv := Nil; + Obj := Nil; + {$endif} +end; + +{$IF DEFINED(mse)} +{$else} +procedure TuosThread.DoTerminate; +begin + {$IF FPC_FULLVERSION>=20701} + //Terminate the thread the calls places into the queuelist will be removed + RemoveQueuedEvents(Self); + {$ENDIF} + //notice that is no longer valid (for safe destroy event of theparent) + Tuos_Player(theparent).thethread := Nil; + //execute player destroy + FreeAndNil(theparent); +end; + {$endif} + +destructor Tuos_Player.Destroy; +var + x: cint32; +begin + + if thethread <> nil then + begin + {$ifdef mse} + thethread.terminate(); + application.waitforthread(thethread); + //calls unlockall()/relockall in order to avoid possible deadlock + thethread.destroy(); + {$endif} + + end; + + if assigned(evPause) then RTLeventdestroy(evPause); + + if length(StreamOut) > 0 then + for x := 0 to high(StreamOut) do + freeandnil(StreamOut[x]); + + if length(StreamIn) > 0 then + for x := 0 to high(StreamIn) do + freeandnil(StreamIn[x]); + + if length(Plugin) > 0 then + for x := 0 to high(Plugin) do + freeandnil(Plugin[x]); + + //Note: if Index = -1 is a independent instance + if Index <> -1 then + begin + //now notice that player is really free + uosPlayersStat[Index] := -1 ; + uosPlayers[Index] := Nil; + end; + + inherited Destroy; + +end; + +destructor Tuos_DSP.Destroy; +begin + if assigned(fftdata) then + begin + {$IF DEFINED(noiseremoval)} + if assigned(fftdata.FNoise) then FreeAndNil(fftdata.FNoise); + {$endif} + FreeandNil(fftdata); + end; + + inherited Destroy; +end; + +destructor Tuos_InStream.Destroy; +var + x: cint32; +begin + {$IF DEFINED(neaac)} + if assigned(AACI) then + begin + if assigned(AACI.fsStream) then + begin + freeandnil(AACI.fsStream); + sleep(100); + end; + freeandnil(AACI); + sleep(100); + end; + {$endif} + if assigned(Data.MemoryStream) then + freeandnil(Data.MemoryStream); + + if length(DSP) > 0 then + for x := 0 to high(DSP) do + freeandnil(DSP[x]); + + inherited Destroy; + +end; + +destructor Tuos_OutStream.Destroy; +var + x: cint32; +begin + if length(DSP) > 0 then + for x := 0 to high(DSP) do + freeandnil(DSP[x]); + + inherited Destroy; +end; + +procedure Tuos_Init.unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: boolean); +// Custom Unload libraries... if true, then unload the library. You may unload what and when you want... +begin + {$IF DEFINED(portaudio)} + if PortAudio = true then Pa_Unload(); + {$endif} + {$IF DEFINED(sndfile)} + if SndFile = true then sf_Unload(); + {$endif} + {$IF DEFINED(mpg123)} + if Mpg123 = true then mp_Unload(); + {$endif} + {$IF DEFINED(xmp)} + if xmp = true then xmp_Unload(); + {$endif} + {$IF DEFINED(fdkaac)} + if fdkaac = true then ad_Unload(); + {$endif} + {$IF DEFINED(neaac)} + if AAC = True then aa_Unload(); + {$endif} + {$IF DEFINED(opus)} + if opus = True then + begin + of_Unload(); + // op_Unload(); + end; + {$endif} +end; + +procedure uos_Free(); +begin + uos_unloadlib() ; + + if assigned(uosInit) then + begin + if assigned(uosInit.evGlobalPause) then + RTLeventdestroy(uosInit.evGlobalPause); + freeandnil(uosInit); + end; +end; + +initialization +SetLength(tempoutmemory,0); +SetLength(uosPlayers,0); +SetLength(uosPlayersStat,0); +SetLength(uosLevelArray,0); +SetLength(uosDeviceInfos,0); +uosInit := Nil; + +end. diff --git a/UOS/src/uos_aac.pas b/UOS/src/uos_aac.pas new file mode 100644 index 0000000..6015fd6 --- /dev/null +++ b/UOS/src/uos_aac.pas @@ -0,0 +1,906 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading version of FAAD2 Pascal Wrapper. + mcwNeAACDec.pas, mcwMP4FF.pas, mcwAAC.pas + By Franklyn A. Harlow Feb 2016 + License : modified LGPL. + mcw* merged into uos_aac by Fred van Stappen / fiens@hotmail.com } + +unit uos_aac; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + Classes, SysUtils, ctypes, math, + dynlibs; + +const + + {$IFDEF unix} +{$IFDEF darwin} +libaa= 'libfaad.2.dylib'; +libm4= 'libmp4ff.0.dylib'; + {$ELSE} +libaa= 'libfaad.so.2'; +libm4= 'libmp4ff.so.0.0.0'; + {$ENDIF} + {$ELSE} +libaa= 'Faad2.dll'; +libm4= 'mp4ff.dll'; + {$ENDIF} + +//////////// from mcwMP4FF.pas By Franklyn A. Harlow +type + + ArSingle = array of Single; + PArSingle = ^ArSingle; + + read_callback_t = function(user_data : Pointer; buffer : pcfloat; length : LongWord) : LongWord; cdecl; + write_callback_t = function(user_data : Pointer; buffer : pcfloat; length : LongWord) : LongWord; cdecl; + seek_callback_t = function(user_data : Pointer; Position : cInt64) : LongWord; cdecl; + truncate_callback_t = function(user_data : Pointer) : LongWord; cdecl; + + mp4ff_callback_t = record + read : read_callback_t; + write : write_callback_t; + seek : seek_callback_t; + truncate : truncate_callback_t; + user_data : Pointer; + end; + p_mp4ff_callback_t = ^mp4ff_callback_t; + + mp4ff_t = pointer; + int32_t = LongInt; + int64_t = cInt64; + uint32_t = LongWord; + +var + mp4ff_open_read : function(f : p_mp4ff_callback_t) : mp4ff_t; cdecl; + mp4ff_open_read_metaonly : function(f : p_mp4ff_callback_t) : mp4ff_t; cdecl; + mp4ff_close : procedure(f : mp4ff_t); cdecl; + mp4ff_get_sample_duration : function(f : mp4ff_t; track, sample : int32_t) : int32_t; cdecl; + mp4ff_get_sample_duration_use_offsets : function(f : mp4ff_t; track, sample : int32_t) : int32_t; cdecl; + mp4ff_get_sample_position : function(f : mp4ff_t; track, sample : int32_t) : int64_t; cdecl; + mp4ff_get_sample_offset : function(f : mp4ff_t; track, sample : int32_t) : int32_t; cdecl; + mp4ff_find_sample : function(f : mp4ff_t; track : int32_t; offset : int64_t; var toskip : int32_t) : int32_t; cdecl; + mp4ff_find_sample_use_offsets : function(f : mp4ff_t; track : int32_t; offset : int64_t; var toskip : int32_t) : int32_t; cdecl; + mp4ff_set_sample_position : function(f : mp4ff_t; track : int32_t; sample : int64_t) : int32_t; cdecl; + mp4ff_read_sample : function(f : mp4ff_t; track, sample : int32_t; var audio_buffer : pcfloat; var bytes : LongWord) : int32_t; cdecl; + mp4ff_read_sample_v2 : function(f : mp4ff_t; track, sample : int32_t; buffer : pcfloat): int32_t; cdecl; //returns 0 on error, number of bytes read on success, use mp4ff_read_sample_getsize_t = function() to check buffer size needed + mp4ff_read_sample_getsize : function(f : mp4ff_t; track, sample : Integer) : int32_t; cdecl; //returns 0 on error, buffer size needed for mp4ff_read_sample_v2_t = function() on success + mp4ff_get_decoder_config : function(f : mp4ff_t; track : Integer; var ppBuf : pcfloat; var pBufSize : LongWord) : int32_t; cdecl; + mp4ff_free_decoder_config : procedure(Buf : pcfloat); cdecl; + mp4ff_get_track_type : function(f : mp4ff_t; const track : Integer) : int32_t; cdecl; + mp4ff_total_tracks : function(f : mp4ff_t) : int32_t; cdecl; + mp4ff_num_samples : function(f : mp4ff_t; track : Integer) : int32_t; cdecl; + mp4ff_time_scale : function(f : mp4ff_t; track : Integer) : int32_t; cdecl; + mp4ff_get_avg_bitrate : function(f : mp4ff_t; track : int32_t) : uint32_t; cdecl; + mp4ff_get_max_bitrate : function(f : mp4ff_t; track : int32_t) : uint32_t; cdecl; + mp4ff_get_track_duration : function(f : mp4ff_t; track : int32_t) : int64_t; cdecl; //returns _t = function(-1) if unknown + mp4ff_get_track_duration_use_offsets : function(f : mp4ff_t; track : int32_t) : Integer; cdecl; //returns _t = function(-1) if unknown + mp4ff_get_sample_rate : function(f : mp4ff_t; track : int32_t) : uint32_t; cdecl; + mp4ff_get_channel_count : function(f : mp4ff_t; track : int32_t) : uint32_t; cdecl; + mp4ff_get_audio_type : function(f : mp4ff_t; track : int32_t) : uint32_t; cdecl; + mp4ff_meta_get_num_items : function(f : mp4ff_t) : Integer; cdecl; + mp4ff_meta_get_by_index : function(f : mp4ff_t; index : LongWord; var item, value : PChar) : Integer; cdecl; + mp4ff_meta_get_title : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_artist : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_writer : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_album : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_date : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_tool : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_comment : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_genre : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_track : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_disc : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_totaltracks : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_totaldiscs : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_compilation : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_tempo : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + mp4ff_meta_get_coverart : function(f : mp4ff_t; var value : PChar) : Integer; cdecl; + +function GetAACTrack(infile : mp4ff_t) : Integer; +procedure Loadmp4ff(mp4ff : AnsiString); +procedure UnLoadMp4ff; +Function isMp4ffLoaded : Boolean; + + //////////// from mcwNeAACDec.pas by Franklyn A. Harlow + Const + { object types for AAC } + MAIN = 1; + LC = 2; + SSR = 3; + LTP = 4; + HE_AAC = 5; + ER_LC = 17; + ER_LTP = 19; + LD = 23; + { special object type for DRM } + DRM_ER_LC = 27; + { header types } + RAW = 0; + ADIF = 1; + ADTS = 2; + LATM = 3; + { SBR signalling } + NO_SBR = 0; + SBR_UPSAMPLED = 1; + SBR_DOWNSAMPLED = 2; + NO_SBR_UPSAMPLED = 3; + { library output formats } + FAAD_FMT_16BIT = 1; + FAAD_FMT_24BIT = 2; + FAAD_FMT_32BIT = 3; + FAAD_FMT_FLOAT = 4; + FAAD_FMT_FIXED = FAAD_FMT_FLOAT; + FAAD_FMT_DOUBLE = 5; + { Capabilities } + { Can decode LC } + LC_DEC_CAP = 1 shl 0; + { Can decode MAIN } + MAIN_DEC_CAP = 1 shl 1; + { Can decode LTP } + LTP_DEC_CAP = 1 shl 2; + { Can decode LD } + LD_DEC_CAP = 1 shl 3; + { Can decode ER } + ERROR_RESILIENCE_CAP = 1 shl 4; + { Fixed point } + FIXED_POINT_CAP = 1 shl 5; + { Channel definitions } + FRONT_CHANNEL_CENTER = 1; + FRONT_CHANNEL_LEFT = 2; + FRONT_CHANNEL_RIGHT = 3; + SIDE_CHANNEL_LEFT = 4; + SIDE_CHANNEL_RIGHT = 5; + BACK_CHANNEL_LEFT = 6; + BACK_CHANNEL_RIGHT = 7; + BACK_CHANNEL_CENTER = 8; + LFE_CHANNEL = 9; + UNKNOWN_CHANNEL = 0; + { DRM channel definitions } + DRMCH_MONO = 1; + DRMCH_STEREO = 2; + DRMCH_SBR_MONO = 3; + DRMCH_SBR_STEREO = 4; + DRMCH_SBR_PS_STEREO = 5; + { A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel, + so at least so much bytes per channel should be available in this stream } + { 6144 bits/channel } + FAAD_MIN_STREAMSIZE = 768; + +Type + PNeAACDec = Pointer; + + NeAAC_byte = {$IFDEF FPC}{$IFDEF CPU64}cuint32 {$ELSE}Byte {$ENDIF}{$ELSE}Byte {$ENDIF}; + NeAAC_word = {$IFDEF FPC}{$IFDEF CPU64}cuint64{$ELSE}Word {$ENDIF}{$ELSE}Word {$ENDIF}; + NeAAC_longword = {$IFDEF FPC}{$IFDEF CPU64}culong {$ELSE}LongWord{$ENDIF}{$ELSE}LongWord{$ENDIF}; + + NeAACDecConfiguration = record + defObjectType : NeAAC_byte; + defSampleRate : NeAAC_longword; + outputFormat : NeAAC_byte; + downMatrix : NeAAC_byte; + useOldADTSFormat : NeAAC_byte; + dontUpSampleImplicitSBR : NeAAC_byte; + end; + TNeAACDecConfiguration = NeAACDecConfiguration; + PNeAACDecConfiguration = ^NeAACDecConfiguration; + + NeAACDecFrameInfo = record + bytesconsumed : NeAAC_longword; + samples : NeAAC_longword; + channels : NeAAC_byte; + error : NeAAC_byte; + samplerate : NeAAC_longword; + sbr : NeAAC_byte; //* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */ + object_type : NeAAC_byte; //* MPEG-4 ObjectType */ + header_type : NeAAC_byte; //* AAC header type; MP4 will be signalled as RAW also */ + num_front_channels : NeAAC_byte; //* multichannel configuration */ + num_side_channels : NeAAC_byte; + num_back_channels : NeAAC_byte; + num_lfe_channels : NeAAC_byte; + channel_position : array[0..63] of NeAAC_byte; + ps : NeAAC_byte; //* PS: 0: off, 1: on */ + end; + TNeAACDecFrameInfo = NeAACDecFrameInfo; + PNeAACDecFrameInfo = ^NeAACDecFrameInfo; + + mp4AudioSpecificConfig = record + objectTypeIndex : NeAAC_byte; + samplingFrequencyIndex : NeAAC_byte; + samplingFrequency : NeAAC_longword; + channelsConfiguration : NeAAC_byte; + frameLengthFlag : NeAAC_byte; //* GA Specific Info */ + dependsOnCoreCoder : NeAAC_byte; + coreCoderDelay : NeAAC_word; + extensionFlag : NeAAC_byte; + aacSectionDataResilienceFlag : NeAAC_byte; + aacScalefactorDataResilienceFlag : NeAAC_byte; + aacSpectralDataResilienceFlag : NeAAC_byte; + epConfig : NeAAC_byte; + sbr_present_flag : NeAAC_byte; + forceUpSampling : NeAAC_byte; + downSampledSBR : NeAAC_byte; + end; + Tmp4AudioSpecificConfig = mp4AudioSpecificConfig; + Pmp4AudioSpecificConfig = ^mp4AudioSpecificConfig; + + var + NeAACDecGetErrorMessage : function(ErrorCode : Byte) : PChar; cdecl; + NeAACDecGetCapabilities : function : LongWord; cdecl; + NeAACDecOpen : function : PNeAACDec; cdecl; + NeAACDecGetCurrentConfiguration : function( hDecoder : PNeAACDec) : PNeAACDecConfiguration; cdecl; + NeAACDecSetConfiguration : function( hDecoder : PNeAACDec; pConfig : PNeAACDecConfiguration) : Byte; cdecl; + NeAACDecInit : function( hDecoder : PNeAACDec; pBuffer : pcfloat; lwBufferLength : LongWord; var lwSampleRate : LongWord; var Channels : Byte) : LongInt; cdecl; + NeAACDecInit2 : function( hDecoder : PNeAACDec; pBuffer : pcfloat; SizeOfDecoderSpecificInfo : LongWord; var lwSampleRate : LongWord; var Channels : Byte) : Byte; cdecl; + NeAACDecPostSeekReset : procedure(hDecoder : PNeAACDec; Frame : LongInt); cdecl; + NeAACDecClose : procedure(hDecoder : PNeAACDec); cdecl; + NeAACDecDecode : function( hDecoder : PNeAACDec; hInfo : PNeAACDecFrameInfo; pBuffer : pcfloat; lwBufferLength : LongWord) : Pointer; cdecl; + NeAACDecDecode2 : function( hDecoder : PNeAACDec; hInfo : PNeAACDecFrameInfo; pBuffer : pcfloat; lwBufferLength : LongWord; var pSampleBuf : Pointer; lwSampleBufSize : LongWord) : Pointer; cdecl; + NeAACDecAudioSpecificConfig : function( pBuffer : pcfloat; lwBufferLength : LongWord; var mp4ASC : mp4AudioSpecificConfig) : Byte; cdecl; + + procedure LoadNeAAC(NeAAC : AnsiString); + Procedure UnLoadNeAAC; + Function Is_NeAAC_Loaded : Boolean; + +////////////////// + +// from mcwAAC.pas from Franklyn A. Harlow +Const + kNeAAC_OK = 1; + kNeAAC_FAIL = 0; + +Type + + TAACIdata = array[0..2024*1024-1] of byte; + + TAACInfo = class(TObject) + public + // libfaad control interface... + fsStream : TFileStream; + pDecoder : PNeAACDec; + hMP4 : mp4ff_t; + + // output interface setup... + Channels : longword; // stereo = 2 + BitsPerSample : longword; // ie short/smallint = 16 + SampleRate : longword; // Frequency = 44100 + outputFormat : byte; // See FAAD_FMT_16BIT etc... + + Bitrate : longword; // 256000 = 256 + + TotalTime : double; // Length in Seconds + + {$if not defined(fs32bit)} + TotalSamples : cint64; + Size : cint64; // in frames + Position : cint64; // in frames + {$else} + TotalSamples : cint; + Size : cint; // in frames + Position : cint; // in frames + {$endif} + + // UoS interface + pData : pcfloat; + lwDataLen : longword; + + // tag info... + Artist : AnsiString; + AlbumArtist : AnsiString; + Album : AnsiString; + Title : AnsiString; + Date : AnsiString; + Genre : AnsiString; + Track : AnsiString; + Comment : AnsiString; + + // internal data... + cbs : mp4ff_callback_t; + _Buf : TAACIdata; + BufTmp : TAACIdata; + fTrack : longint; + fTimescale : longword; // Not actually used + + fBufStart : longword; + fBufEnd : longword; + End; + + Function aa_load(mp4ff, NeAAC: AnsiString): Boolean; + Procedure aa_Unload; + Function isLibAACLoaded : Boolean; + + Function MP4OpenFile(fName : String; OutputFormat : Byte) : TAACInfo; + Procedure MP4CloseFile(var AACI: TAACInfo); + procedure MP4GetData(var AACI: TAACInfo; var Buffer: pcfloat; var Bytes: longword); + function MP4Seek(var AACI: TAACInfo; var SampleNum: longint) : Boolean; + +implementation + +var + // hNeAAC: {$IFDEF MSWINDOWS}longword{$ELSE}{$IFDEF CPU32}longword{$ELSE}PtrInt{$ENDIF}{$ENDIF}; + hNeAAC:TLibHandle=dynlibs.NilHandle; + NeAACLoaded : Boolean; + Mp4ffLoaded : Boolean = False; + hMp4ff:TLibHandle=dynlibs.NilHandle; + +//////////// from mcwNeAACDec.pas By Franklyn A. Harlow + +function CBMP4Read(user_data : Pointer; buffer : pcfloat; length : LongWord) : LongWord; cdecl; +begin + try + Result := LongWord(TAACInfo(user_data).fsStream.Read(buffer^, Integer(length))); + except + Result := 0; + end; +end; + +function CBMP4Write(user_data : Pointer; buffer : pcfloat; length : LongWord) : LongWord; cdecl; +begin + try + Result := LongWord(TAACInfo(user_data).fsStream.Write(buffer^, Integer(length))); + TAACInfo(user_data).fsStream.Position:=0; + except + Result := 0; + end; +end; + +function CBMP4Seek(user_data : Pointer; Position : Int64) : LongWord; cdecl; +begin + try + Result := LongWord(TAACInfo(user_data).fsStream.Seek(Position, soBeginning)); + except + Result := 0; + end; +end; + +function CBMP4Truncate(user_data : Pointer) : LongWord; cdecl; +begin + Result := 0; +end; + +//////////// from mcwAAC.pas By Franklyn A. Harlow + +Function aa_load(mp4ff, NeAAC: AnsiString): Boolean; +Begin + // Safe To Call Multiple times, actual load of Lib checks to see if it is already loaded & + // returns true if it is... + LoadNeAAC(NeAAC); + + Loadmp4ff(mp4ff); + + Result:= Is_NeAAC_Loaded And isMp4ffLoaded; +End; + +Procedure aa_Unload; +Begin + UnLoadNeAAC(); + UnLoadMp4ff(); +End; + +Function isLibAACLoaded : Boolean; +Begin + Result:= Is_NeAAC_Loaded And isMp4ffLoaded; +end; + +Function isFileAAC(fName : AnsiString): Boolean; +Begin + Result:= LowerCase(ExtractFileExt(fName)) = '.m4a'; +end; + +Function MP4OpenFile(fName : String; OutputFormat : Byte) : TAACInfo; +Var + pConfig : PNeAACDecConfiguration; + mp4ASC : mp4AudioSpecificConfig; + + pBuf : pcfloat; + lwBufSize : longword; + lwBufSize2 : longword; + lwSampleRate : longword; + bChannels : byte; + + bRet : Byte; + iRet : LongInt; + pID3 : PAnsiChar; + f : Double; +Begin + Result:= nil; + if not FileExists(fName) then + Exit; + if Not isFileAAC(fName) then + Exit; + // writeln('MP4OpenFileBegin'); + + Result:= TAACInfo.Create; + // writeln('MP4OpenFile3'); + + Result.fsStream:= TFileStream.Create(fName, fmOpenRead or fmShareDenyWrite); + + sleep(1); + + // writeln('MP4OpenFile4'); + Result.cbs.read := @CBMP4Read; + Result.cbs.write := @CBMP4Write; + Result.cbs.seek := @CBMP4Seek; + Result.cbs.truncate := @CBMP4Truncate; + Result.cbs.user_data := Pointer(Result); + // writeln('MP4OpenFile5'); + + Result.pDecoder := NeAACDecOpen(); + // writeln('MP4OpenFile6'); + + pConfig := NeAACDecGetCurrentConfiguration(Result.pDecoder); + // writeln('MP4OpenFile7'); + pConfig^.defObjectType := LC; + pConfig^.defSampleRate := 44100; + pConfig^.outputFormat := OutputFormat; // FAAD_FMT_FLOAT FAAD_FMT_16BIT FAAD_FMT_32BIT + pConfig^.downMatrix := 1; + pConfig^.dontUpSampleImplicitSBR := 0; + + NeAACDecSetConfiguration(Result.pDecoder, pConfig) ; + + pConfig := NeAACDecGetCurrentConfiguration(Result.pDecoder); + // writeln('MP4OpenFile9'); + + case pConfig^.outputFormat of + FAAD_FMT_16BIT : Result.BitsPerSample := 16; + FAAD_FMT_24BIT : Result.BitsPerSample := 24; + FAAD_FMT_32BIT : Result.BitsPerSample := 32; + FAAD_FMT_FLOAT : Result.BitsPerSample := 32; + FAAD_FMT_DOUBLE: Result.BitsPerSample := 64; + end; + // writeln('MP4OpenFile10'); + Result.outputFormat:= pConfig^.outputFormat; + + Result.hMP4 := mp4ff_open_read(@Result.cbs); + // writeln('MP4OpenFile11'); + + Result.fTrack := GetAACTrack(Result.hMP4); + // writeln('MP4OpenFile12'); + + pBuf:= nil; + iRet:= mp4ff_get_decoder_config(Result.hMP4, Result.fTrack, pBuf, lwBufSize); + // writeln('MP4OpenFile13'); + + lwBufSize2:= lwBufSize; + // writeln('MP4OpenFile14'); + + bRet:= NeAACDecInit2(Result.pDecoder, pBuf, lwBufSize, lwSampleRate, bChannels); + // writeln('MP4OpenFile15'); + + Result.SampleRate := mp4ff_get_sample_rate(Result.hMP4, Result.fTrack); + Result.Channels := mp4ff_get_channel_count(Result.hMP4, Result.fTrack); + Result.fTimescale := mp4ff_time_scale(Result.hMP4, Result.fTrack); + Result.Bitrate := mp4ff_get_avg_bitrate(Result.hMP4, Result.fTrack); + Result.Size := mp4ff_num_samples(Result.hMP4, Result.fTrack); + // writeln('MP4OpenFile16'); + + if pBuf <> nil then + begin + bRet:= NeAACDecAudioSpecificConfig(pBuf, lwBufSize2, mp4ASC); + // writeln('MP4OpenFile17'); + + if bRet <> 0 then + Begin + // unix x64, NeAACDecAudioSpecificConfig Fails correct read, + // But if both previous SampleRates match, we'll use them... + {$IFDEF unix}{$IFDEF CPU64} + if Result.SampleRate = lwSampleRate then + Begin + mp4ASC.sbr_present_flag := 0; + mp4ASC.samplingFrequency := lwSampleRate; + End; + {$ENDIF}{$ENDIF} + End; + // writeln('MP4OpenFile18'); + mp4ff_free_decoder_config(pBuf); + // writeln('MP4OpenFile19'); + end; + + f := 1024.0; + if mp4ASC.sbr_present_flag = 1 then + f := f * 2.0; + Result.TotalTime := Result.Size * (f-1.0) / mp4ASC.samplingFrequency; + { ...End} + Result.TotalSamples := Trunc(Result.TotalTime * mp4ASC.samplingFrequency); + // writeln('MP4OpenFile20'); + if mp4ASC.samplingFrequency > Result.SampleRate then + Result.SampleRate:= mp4ASC.samplingFrequency; + + Result.Artist:= ''; + iRet:= mp4ff_meta_get_writer(Result.hMP4, pID3); + if iRet = 1 then + Result.Artist:= pID3; + + Result.AlbumArtist:= ''; + iRet:= mp4ff_meta_get_artist(Result.hMP4, pID3); + if iRet = 1 then + Result.AlbumArtist:= pID3; + + Result.Album:= ''; + iRet:= mp4ff_meta_get_album(Result.hMP4, pID3); + if iRet = 1 then + Result.Album:= pID3; + + Result.Title:= ''; + iRet:= mp4ff_meta_get_title(Result.hMP4, pID3); + if iRet = 1 then + Result.Title:= pID3; + + Result.Date:= ''; + iRet:= mp4ff_meta_get_date(Result.hMP4, pID3); + if iRet = 1 then + Result.Date:= pID3; + + Result.Genre:= ''; + iRet:= mp4ff_meta_get_genre(Result.hMP4, pID3); + if iRet = 1 then + Result.Genre:= pID3; + + Result.Track:= ''; + iRet:= mp4ff_meta_get_track(Result.hMP4, pID3); + if iRet = 1 then + Result.Track:= pID3; + + Result.Comment:= ''; + iRet:= mp4ff_meta_get_comment(Result.hMP4, pID3); + if iRet = 1 then + Result.Comment:= pID3; + + Result.Position := 0; + Result.fBufStart := 0; + Result.fBufEnd := 0; + // writeln('MP4OpenFile End'); +end; + +Procedure MP4CloseFile(var AACI: TAACInfo); +Begin + // writeln('MP4CloseFile1'); + NeAACDecClose(AACI.pDecoder); + sleep(50); + // writeln('MP4CloseFile2'); + mp4ff_close(AACI.hMP4); + // writeln('MP4CloseFile3'); + sleep(50); + end; + +procedure MP4GetData(var AACI: TAACInfo; var Buffer: pcfloat; var Bytes: longword); +var + ReqBytes : longword; + CurBufSize : longword; + NewSampleBuf : Pointer; + NewBytesRead : longword; + NewBytesDecoded : longword; + + Function readNextSample(var audioBuf : pcfloat; var audioSize : longword): longword; + Begin + audioSize := 0; + Result:= 0; + audioBuf := nil; + // writeln('readNextSample'); + if AACI.Position > AACI.Size then + Begin + Result:= 0; + Exit; + end; + Result := mp4ff_read_sample(AACI.hMP4, AACI.fTrack, AACI.Position, audioBuf, audioSize); + Inc(AACI.Position); + end; + + Function getNextChunk(var SampBuf : Pointer; var NBR : longword) : longword; + Var + pAB : pcfloat; + iAB : longword; + frameInfo: NeAACDecFrameInfo; + Begin + NBR:= 0; + // writeln('getNextChunk'); + Result:= 0; + Result:= readNextSample(pAB, iAB); + if Result = 0 then Exit; + SampBuf := NeAACDecDecode(AACI.pDecoder, @frameInfo, pAB, iAB); + if pAB <> nil then + mp4ff_free_decoder_config(pAB); + + NBR:= frameInfo.samples * (AACI.BitsPerSample div 8); + end; + +begin + // writeln('MP4GetData1'); + ReqBytes:= Bytes; + // writeln('MP4GetDataBegin1-2'); + CurBufSize:= AACI.fBufEnd - AACI.fBufStart; + + While ReqBytes > CurBufSize do + Begin + // writeln('MP4GetData31'); + // We need to put more data into Buffer... + + // If We Have Left Over Data... + if CurBufSize > 0 then + Begin + // Save Existing Left over data.. + Move(AACI._Buf[AACI.fBufStart], AACI.BufTmp[0], CurBufSize); + // Put Existing Data to Start of buffer... + Move(AACI.BufTmp[0], AACI._Buf[0], CurBufSize); + end; + + // writeln('MP4GetData32'); + // because we reshuffled buffers, AACI.fBufStart is now 0 + AACI.fBufStart:= 0; + NewSampleBuf := nil; + // Read next block of data + + NewBytesRead:= getNextChunk(NewSampleBuf, NewBytesDecoded); + + // writeln('MP4GetData322'); + if NewBytesRead = 0 then + begin + Buffer := nil; + Bytes := 0; + Exit; + end; + // writeln('MP4GetData33'); + // Append new data to buffer + Move(NewSampleBuf^, AACI._Buf[CurBufSize], NewBytesDecoded); + // Update current unprocessed data count + CurBufSize:= CurBufSize + NewBytesDecoded; + // writeln('MP4GetData34'); + end; + + // writeln('MP4GetData4'); + + // set AACI.fBufEnd to last valid data byte in buffer + AACI.fBufEnd:= CurBufSize; + + // writeln('MP4GetData5'); + + // If requested Byte count is more tha what we have, reduce requested count.. + if Bytes > AACI.fBufEnd - AACI.fBufStart then + Bytes := AACI.fBufEnd - AACI.fBufStart; + + // writeln('MP4GetData6'); + + // pass data back to calling function/procedure + Buffer := @AACI._Buf[AACI.fBufStart]; + + // writeln('MP4GetData7'); + + Inc(AACI.fBufStart, Bytes); + + // writeln('MP4GetData8'); + +end; + +function MP4Seek(var AACI: TAACInfo; var SampleNum: longint) : Boolean; +begin + Result := False; + if (AACI.Size = 0) or (AACI.TotalSamples = 0) then + Exit; + + if SampleNum > AACI.TotalSamples then + SampleNum := AACI.TotalSamples; + + AACI.Position:= Trunc(SampleNum / AACI.TotalSamples * AACI.Size); + Result := True; +end; + +procedure LoadNeAAC(NeAAC : AnsiString); +var +thelib: string; +Begin + if Length(NeAAC) = 0 then thelib := libaa else thelib := NeAAC; + hNeAAC:= DynLibs.SafeLoadLibrary(PChar(thelib)); + NeAACLoaded:= hNeAAC <> dynlibs.NilHandle; + + Pointer(NeAACDecGetErrorMessage) := + GetProcAddress(hNeAAC, PChar('NeAACDecGetErrorMessage')); + Pointer(NeAACDecGetCapabilities) := + GetProcAddress(hNeAAC, PChar('NeAACDecGetCapabilities')); + Pointer(NeAACDecOpen) := + GetProcAddress(hNeAAC, PChar('NeAACDecOpen')); + Pointer(NeAACDecGetCurrentConfiguration) := + GetProcAddress(hNeAAC, PChar('NeAACDecGetCurrentConfiguration')); + Pointer(NeAACDecSetConfiguration) := + GetProcAddress(hNeAAC, PChar('NeAACDecSetConfiguration')); + Pointer(NeAACDecInit) := + GetProcAddress(hNeAAC, PChar('NeAACDecInit')); + Pointer(NeAACDecInit2) := + GetProcAddress(hNeAAC, PChar('NeAACDecInit2')); + Pointer(NeAACDecPostSeekReset) := + GetProcAddress(hNeAAC, PChar('NeAACDecPostSeekReset')); + Pointer(NeAACDecClose) := + GetProcAddress(hNeAAC, PChar('NeAACDecClose')); + Pointer(NeAACDecDecode) := + GetProcAddress(hNeAAC, PChar('NeAACDecDecode')); + Pointer(NeAACDecDecode2) := + GetProcAddress(hNeAAC, PChar('NeAACDecDecode2')); + Pointer(NeAACDecPostSeekReset) := + GetProcAddress(hNeAAC, PChar('NeAACDecPostSeekReset')); + Pointer(NeAACDecAudioSpecificConfig) := + GetProcAddress(hNeAAC, PChar('NeAACDecAudioSpecificConfig')); +end; + +Procedure UnLoadNeAAC; +Begin + if NeAACLoaded then + DynLibs.UnloadLibrary(hNeAAC); + NeAACLoaded:= False; +end; + +Function Is_NeAAC_Loaded : Boolean; +Begin + Result:= NeAACLoaded; +end; + +////////////////////////////// from mcwMP4FF.pas by Franklyn A. Harlow + +function GetAACTrack(infile : mp4ff_t) : Integer; +var + i, rc, numTracks : Integer; + buff : pcfloat; + buff_size : LongWord; + mp4ASC : mp4AudioSpecificConfig; +begin + numTracks := mp4ff_total_tracks(infile); + for i := 0 to numTracks - 1 do + begin + buff := nil; + buff_size:=0; + mp4ff_get_decoder_config(infile, i, buff, buff_size); + if buff <> nil then + begin + rc := NeAACDecAudioSpecificConfig(buff, buff_size, mp4ASC); + mp4ff_free_decoder_config(buff); + if rc < 0 then + continue; + Result := i; + Exit; + end; + end; + Result := -1; +end; + +procedure UnLoadMp4ff; +begin + if Mp4ffLoaded then + + DynLibs.UnloadLibrary(hMp4ff); + + Mp4ffLoaded := False; +end; + +Function isMp4ffLoaded : Boolean; +Begin +Result:= Mp4ffLoaded; +end; + + + procedure Loadmp4ff(mp4ff : AnsiString); + var +thelib: string; +begin + if Mp4ffLoaded then + Exit; + if Length(mp4ff) = 0 then thelib := libm4 else thelib := mp4ff; + hMp4ff := DynLibs.SafeLoadLibrary(PChar(thelib)); + Mp4ffLoaded := hMp4ff <> dynlibs.NilHandle; + + // writeln('hMp4ff' + inttostr(hMp4ff)); + + Pointer(mp4ff_open_read) := + GetProcAddress(hMp4ff, pchar('mp4ff_open_read')); + + // if Pointer(mp4ff_open_read) <> nil then + // writeln('mp4ff_open_read OK') else + // writeln('mp4ff_open_read NOT OK'); + + Pointer(mp4ff_open_read_metaonly) := + GetProcAddress(hMp4ff, PChar('mp4ff_open_read_metaonly')); + Pointer(mp4ff_close) := + GetProcAddress(hMp4ff, PChar('mp4ff_close')); + Pointer(mp4ff_get_sample_duration) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_duration')); + Pointer(mp4ff_get_sample_duration_use_offsets) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_duration_use_offsets')); + Pointer(mp4ff_get_sample_position) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_position')); + Pointer(mp4ff_get_sample_offset) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_offset')); + Pointer(mp4ff_find_sample) := + GetProcAddress(hMp4ff, PChar('mp4ff_find_sample')); + + Pointer(mp4ff_find_sample_use_offsets) := + GetProcAddress(hMp4ff, PChar('mp4ff_find_sample_use_offsets')); + Pointer(mp4ff_set_sample_position) := + GetProcAddress(hMp4ff, PChar('mp4ff_set_sample_position')); + Pointer(mp4ff_read_sample) := + GetProcAddress(hMp4ff, PChar('mp4ff_read_sample')); + Pointer(mp4ff_read_sample_v2) := + GetProcAddress(hMp4ff, PChar('mp4ff_read_sample_v2')); + Pointer(mp4ff_read_sample_getsize) := + GetProcAddress(hMp4ff, PChar('mp4ff_read_sample_getsize')); + Pointer(mp4ff_get_sample_position) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_position')); + Pointer(mp4ff_get_sample_offset) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_offset')); + Pointer(mp4ff_find_sample) := + GetProcAddress(hMp4ff, PChar('mp4ff_find_sample')); + + Pointer(mp4ff_get_decoder_config) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_decoder_config')); + Pointer(mp4ff_get_track_type) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_track_type')); + Pointer(mp4ff_total_tracks) := + GetProcAddress(hMp4ff, PChar('mp4ff_total_tracks')); + Pointer(mp4ff_num_samples) := + GetProcAddress(hMp4ff, PChar('mp4ff_num_samples')); + Pointer(mp4ff_time_scale) := + GetProcAddress(hMp4ff, PChar('mp4ff_time_scale')); + Pointer(mp4ff_get_avg_bitrate) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_avg_bitrate')); + Pointer(mp4ff_get_max_bitrate) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_max_bitrate')); + Pointer(mp4ff_get_track_duration) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_track_duration')); + + Pointer(mp4ff_get_track_duration_use_offsets) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_track_duration_use_offsets')); + Pointer(mp4ff_get_sample_rate) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_sample_rate')); + Pointer(mp4ff_get_channel_count) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_channel_count')); + Pointer(mp4ff_get_audio_type) := + GetProcAddress(hMp4ff, PChar('mp4ff_get_audio_type')); + Pointer(mp4ff_free_decoder_config) := + GetProcAddress(hMp4ff, PChar('mp4ff_free_decoder_config')); + Pointer(mp4ff_meta_get_num_items) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_num_items')); + Pointer(mp4ff_meta_get_by_index) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_by_index')); + Pointer(mp4ff_meta_get_title) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_title')); + + Pointer(mp4ff_meta_get_artist) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_artist')); + Pointer(mp4ff_meta_get_writer) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_writer')); + Pointer(mp4ff_meta_get_album) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_album')); + Pointer(mp4ff_meta_get_date) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_date')); + Pointer(mp4ff_meta_get_tool) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_tool')); + Pointer(mp4ff_meta_get_comment) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_comment')); + Pointer(mp4ff_meta_get_genre) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_genre')); + Pointer(mp4ff_meta_get_track) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_track')); + + Pointer(mp4ff_meta_get_disc) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_disc')); + Pointer(mp4ff_meta_get_totaltracks) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_totaltracks')); + Pointer(mp4ff_meta_get_totaldiscs) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_totaldiscs')); + Pointer(mp4ff_meta_get_compilation) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_compilation')); + Pointer(mp4ff_meta_get_tempo) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_tempo')); + Pointer(mp4ff_meta_get_coverart) := + GetProcAddress(hMp4ff, PChar('mp4ff_meta_get_coverart')); + +end; + +initialization + NeAACLoaded:= False; + SetExceptionMask(GetExceptionMask + [exZeroDivide] + [exInvalidOp] + + [exDenormalized] + [exOverflow] + [exPrecision]); + +finalization +end. diff --git a/UOS/src/uos_bs2b.pas b/UOS/src/uos_bs2b.pas new file mode 100644 index 0000000..f05252d --- /dev/null +++ b/UOS/src/uos_bs2b.pas @@ -0,0 +1,394 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading Pascal Wrapper of + bs2b library of Boris Mikhaylov + Load library with bs_load() and release with bs_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com +} + + +unit uos_bs2b; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + + +interface + +uses + SysUtils, dynlibs, ctypes, math; + +const +libsb= + {$IFDEF unix} + 'libbs2b.so.0'; + {$ELSE} + 'bs2b.dll'; + {$ENDIF} + +{ Minimum/maximum sample rate (Hz) } + BS2B_MINSRATE = 2000; + BS2B_MAXSRATE = 384000; + +{ Minimum/maximum cut frequency (Hz) } +{ bs2b_set_level_fcut() } + BS2B_MINFCUT = 300; + BS2B_MAXFCUT = 2000; + +{ Minimum/maximum feed level (dB * 10 @ low frequencies) } +{ bs2b_set_level_feed() } +{ 1 dB } + BS2B_MINFEED = 10; +{ 15 dB } + BS2B_MAXFEED = 150; + +const + + // for using with bs2b_set_level + + BS2B_HIGH_CLEVEL = (CInt32(700)) or ((CInt32(30)) shl 16); + BS2B_MIDDLE_CLEVEL = (CInt32(500)) or ((CInt32(45)) shl 16); + BS2B_LOW_CLEVEL = (CInt32(360)) or ((CInt32(60)) shl 16); + { Easy crossfeed levels (Obsolete) } + BS2B_HIGH_ECLEVEL = (CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_MIDDLE_ECLEVEL = (CInt32(500)) or ((CInt32(72)) shl 16); + BS2B_LOW_ECLEVEL = (CInt32(360)) or ((CInt32(84)) shl 16); + + BS2B_DEFAULT_CLEVEL = (CInt32(700)) or ((CInt32(45)) shl 16); + BS2B_CMOY_CLEVEL =(CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_JMEIER_CLEVEL = (CInt32(650)) or ((CInt32(95)) shl 16); + +{ Default sample rate (Hz) } +const + BS2B_DEFAULT_SRATE = 44100; + +{ A delay at low frequency by microseconds according to cut frequency } +function bs2b_level_delay(fcut : longint) : longint; + +{ Crossfeed level } +{ Sample rate (Hz) } +{ Lowpass IIR filter coefficients } +{ Highboost IIR filter coefficients } +{ Global gain against overloading } +{ Buffer of last filtered sample: [0] 1-st channel, [1] 2-d channel } +type + Tt_bs2bdp = ^Tt_bs2bd; + Tt_bs2bd = packed record + level : CInt32; + srate : CInt32; + a0_lo : CDouble; + b1_lo : CDouble; + a0_hi : CDouble; + a1_hi : CDouble; + b1_hi : CDouble; + gain : CDouble; + lfs : packed record + asis : array[0..1] of cdouble; + lo : array[0..1] of cdouble; + hi : array[0..1] of cdouble; + end; + end; + +////// Dynamic load : Vars that will hold our dynamically loaded functions... +// *************************** functions ******************************* + +var +{ Open } +bs2b_open : function():Tt_bs2bdp; cdecl; + +{ Close } +bs2b_close : procedure(bs2bdp:Tt_bs2bdp); cdecl; + +{ Sets a new coefficients by new crossfeed value. + * level = ( fcut | feed << 16 ) ) + * where 'feed' is crossfeeding level at low frequencies (dB * 10) + * and 'fcut' is cut frecuency (Hz) + } +bs2b_set_level : procedure(bs2bdp:Tt_bs2bdp; level: CInt32); cdecl; + +{ Return a current crossfeed level value. } +bs2b_get_level : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Sets a new coefficients by new cut frecuency value (Hz). } +bs2b_set_level_fcut : procedure(bs2bdp:Tt_bs2bdp; fcut: CInt32); cdecl; + +{ Return a current cut frecuency value (Hz). } +bs2b_get_level_fcut : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Sets a new coefficients by new crossfeeding level value (dB * 10). } +bs2b_set_level_feed : procedure(bs2bdp:Tt_bs2bdp; feed: CInt32); cdecl; + +{ Return a current crossfeeding level value (dB * 10). } +bs2b_get_level_feed : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Return a current delay value at low frequencies (micro seconds). } +bs2b_get_level_delay : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Clear buffers and sets a new coefficients with new sample rate value. + * srate - sample rate by Hz. } +bs2b_set_srate : procedure(bs2bdp:Tt_bs2bdp; srate: CInt32); cdecl; + +{ Return current sample rate value } +bs2b_get_srate : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Clear buffer } +bs2b_clear : procedure(bs2bdp:Tt_bs2bdp); cdecl; + +{ Return 1 if buffer is clear } +bs2b_is_clear : function(bs2bdp:Tt_bs2bdp): CInt32; cdecl; + +{ Return bs2b version string } +(* Const before declarator ignored *) +bs2b_runtime_version : function():pchar; cdecl; + +{ Return bs2b version integer } +bs2b_runtime_version_int : function(): CInt32; cdecl; + +{ 'bs2b_cross_feed_*' crossfeeds buffer of 'n' stereo samples + * pointed by 'sample'. + * sample[i] - first channel, + * sample[i+1] - second channel. + * Where 'i' is ( i = 0; i < n * 2; i += 2 ) + } +{ sample poits to double floats native endians } +bs2b_cross_feed_d : procedure(bs2bdp:Tt_bs2bdp; var sample:Cdouble; n: CInt32); cdecl; + +{ sample poits to double floats big endians } +bs2b_cross_feed_dbe : procedure(bs2bdp:Tt_bs2bdp; var sample:Cdouble; n: CInt32); cdecl; + +{ sample poits to double floats little endians } +bs2b_cross_feed_dle : procedure(bs2bdp:Tt_bs2bdp; var sample:Cdouble; n: CInt32); cdecl; + +{ sample poits to floats native endians } +bs2b_cross_feed_f : procedure(bs2bdp:Tt_bs2bdp; var sample:Cfloat; n:CInt32); cdecl; + +{ sample poits to floats big endians } +bs2b_cross_feed_fbe : procedure(bs2bdp:Tt_bs2bdp; var sample:Cfloat; n:CInt32); cdecl; + +{ sample poits to floats little endians } +bs2b_cross_feed_fle : procedure(bs2bdp:Tt_bs2bdp; var sample:cfloat; n:CInt32); cdecl; + +{ sample poits to 32bit signed integers native endians } +bs2b_cross_feed_s32 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 32bit unsigned integers native endians } +bs2b_cross_feed_u32 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 32bit signed integers big endians } +bs2b_cross_feed_s32be : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 32bit unsigned integers big endians } +bs2b_cross_feed_u32be : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 32bit signed integers little endians } +bs2b_cross_feed_s32le : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 32bit unsigned integers little endians } +bs2b_cross_feed_u32le : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt32); cdecl; + +{ sample poits to 16bit signed integers native endians } +bs2b_cross_feed_s16 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt16; n:CInt); cdecl; + +{ sample poits to 16bit unsigned integers native endians } +bs2b_cross_feed_u16 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 16bit signed integers big endians } +bs2b_cross_feed_s16be : procedure(bs2bdp:Tt_bs2bdp; var sample:cint16; n:cint); cdecl; + +{ sample poits to 16bit unsigned integers big endians } +bs2b_cross_feed_u16be : procedure(bs2bdp:Tt_bs2bdp; var sample:cint16; n:cint); cdecl; + +{ sample poits to 16bit signed integers little endians } +bs2b_cross_feed_s16le : procedure(bs2bdp:Tt_bs2bdp; var sample:cint16; n:cint); cdecl; + +{ sample poits to 16bit unsigned integers little endians } +bs2b_cross_feed_u16le : procedure(bs2bdp:Tt_bs2bdp; var sample:cint16; n:cint); cdecl; + +{ sample poits to 8bit signed integers } +bs2b_cross_feed_s8 : procedure(bs2bdp:Tt_bs2bdp; var sample:cint8; n:cint); cdecl; + +{ sample poits to 8bit unsigned integers } +bs2b_cross_feed_u8 : procedure(bs2bdp:Tt_bs2bdp; var sample:cint8; n:cint); cdecl; + +{ sample poits to 24bit signed integers native endians } +bs2b_cross_feed_s24 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 24bit unsigned integers native endians } +bs2b_cross_feed_u24 : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 24bit signed integers be endians } +bs2b_cross_feed_s24be : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 24bit unsigned integers be endians } +bs2b_cross_feed_u24be : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 24bit signed integers little endians } +bs2b_cross_feed_s24le : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + +{ sample poits to 24bit unsigned integers little endians } +bs2b_cross_feed_u24le : procedure(bs2bdp:Tt_bs2bdp; var sample:CInt32; n:CInt); cdecl; + + function bs_IsLoaded() : boolean; inline; + + Function bs_Load(const libfilename:string) :boolean; // load the lib + + Procedure bs_Unload(); // unload and frees the lib from memory : do not forget to call it before close application. + +implementation + +function bs2b_level_delay(fcut : longint) : longint; +begin + result:=floor((18700/fcut)*10); +end; + + var + bs_Handle :TLibHandle=dynlibs.NilHandle; + {$IFDEF windows} // try load dependency if not in /windows/system32/ + gc_Handle :TLibHandle=dynlibs.NilHandle; + {$endif} + ReferenceCounter : cardinal = 0; // Reference counter + +function bs_IsLoaded(): boolean; +begin + Result := (bs_Handle <> dynlibs.NilHandle); +end; + +Procedure bs_Unload(); +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if bs_IsLoaded() then + begin + DynLibs.UnloadLibrary(bs_Handle); + bs_Handle:=DynLibs.NilHandle; + {$IFDEF windows} + if gc_Handle <> DynLibs.NilHandle then begin + DynLibs.UnloadLibrary(gc_Handle); + gc_Handle:=DynLibs.NilHandle; + end; + {$endif} + bs2b_open:=nil; + bs2b_close:=nil; + bs2b_set_level:=nil; + bs2b_get_level:=nil; + bs2b_set_level_fcut:=nil; + bs2b_get_level_fcut:=nil; + bs2b_set_level_feed:=nil; + bs2b_get_level_feed:=nil; + bs2b_get_level_delay:=nil; + bs2b_set_srate:=nil; + bs2b_get_srate:=nil; + bs2b_clear:=nil; + bs2b_is_clear:=nil; + bs2b_runtime_version:=nil; + bs2b_runtime_version_int:=nil; + bs2b_cross_feed_d:=nil; + bs2b_cross_feed_dbe:=nil; + bs2b_cross_feed_dle:=nil; + bs2b_cross_feed_f:=nil; + bs2b_cross_feed_fbe:=nil; + bs2b_cross_feed_fle:=nil; + bs2b_cross_feed_s32:=nil; + bs2b_cross_feed_u32:=nil; + bs2b_cross_feed_s32be:=nil; + bs2b_cross_feed_u32be:=nil; + bs2b_cross_feed_s32le:=nil; + bs2b_cross_feed_u32le:=nil; + bs2b_cross_feed_s16:=nil; + bs2b_cross_feed_u16:=nil; + bs2b_cross_feed_s16be:=nil; + bs2b_cross_feed_u16be:=nil; + bs2b_cross_feed_s16le:=nil; + bs2b_cross_feed_u16le:=nil; + bs2b_cross_feed_s8:=nil; + bs2b_cross_feed_u8:=nil; + bs2b_cross_feed_s24:=nil; + bs2b_cross_feed_u24:=nil; + bs2b_cross_feed_s24be:=nil; + bs2b_cross_feed_u24be:=nil; + bs2b_cross_feed_s24le:=nil; + bs2b_cross_feed_u24le:=nil; + end; +end; + + Function bs_Load(const libfilename:string) :boolean; + begin + Result := False; + if bs_Handle<>0 then +begin + Inc(ReferenceCounter); +result:=true {is it already there ?} +end else begin {go & load the library} + if Length(libfilename) = 0 then + begin + {$IFDEF windows} + gc_Handle:= DynLibs.SafeLoadLibrary('libgcc_s_dw2-1.dll'); + {$endif} + bs_Handle:=DynLibs.SafeLoadLibrary(libsb); + end + else + begin + {$IFDEF windows} + gc_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libgcc_s_dw2-1.dll'); + {$endif} + + bs_Handle:=DynLibs.SafeLoadLibrary(libfilename); + end; + + if bs_Handle <> DynLibs.NilHandle then + begin {now we tie the functions to the VARs from above} + + pointer(bs2b_open):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_open')); + pointer(bs2b_close):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_close')); + pointer(bs2b_set_level):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_set_level')); + pointer(bs2b_get_level):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_get_level')); + pointer(bs2b_set_level_fcut):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_set_level_fcut')); + pointer(bs2b_get_level_fcut):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_get_level_fcut')); + pointer(bs2b_set_level_feed):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_set_level_feed')); + pointer(bs2b_get_level_feed):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_get_level_feed')); + pointer(bs2b_get_level_delay):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_get_level_delay')); + pointer(bs2b_set_srate):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_set_srate')); + pointer(bs2b_get_srate):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_get_srate')); + pointer(bs2b_clear):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_clear')); + pointer(bs2b_is_clear):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_is_clear')); + pointer(bs2b_runtime_version):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_runtime_version')); + pointer(bs2b_runtime_version_int):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_runtime_version_int')); + pointer(bs2b_cross_feed_d):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_d')); + pointer(bs2b_cross_feed_dbe):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_dbe')); + pointer(bs2b_cross_feed_dle):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_dle')); + pointer(bs2b_cross_feed_f):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_f')); + pointer(bs2b_cross_feed_fbe):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_fbe')); + pointer(bs2b_cross_feed_fle):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_fle')); + pointer(bs2b_cross_feed_s32):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s32')); + pointer(bs2b_cross_feed_u32):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u32')); + pointer(bs2b_cross_feed_s32be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s32be')); + pointer(bs2b_cross_feed_u32be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u32be')); + pointer(bs2b_cross_feed_s32le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s32le')); + pointer(bs2b_cross_feed_u32le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u32le')); + pointer(bs2b_cross_feed_s16):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s16')); + pointer(bs2b_cross_feed_u16):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u16')); + pointer(bs2b_cross_feed_s16be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s16be')); + pointer(bs2b_cross_feed_u16be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u16be')); + pointer(bs2b_cross_feed_s16le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s16le')); + pointer(bs2b_cross_feed_u16le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u16le')); + pointer(bs2b_cross_feed_s8):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s8')); + pointer(bs2b_cross_feed_u8):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u8')); + pointer(bs2b_cross_feed_s24):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s24')); + pointer(bs2b_cross_feed_u24):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u24')); + pointer(bs2b_cross_feed_s24be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s24be')); + pointer(bs2b_cross_feed_u24be):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u24be')); + pointer(bs2b_cross_feed_s24le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_s24le')); + pointer(bs2b_cross_feed_u24le):=DynLibs.GetProcAddress(bs_handle,PChar('bs2b_cross_feed_u24le')); + end; + Result := bs_IsLoaded; + ReferenceCounter:=1; + end; +end; + +end. + diff --git a/UOS/src/uos_cdrom.pas b/UOS/src/uos_cdrom.pas new file mode 100644 index 0000000..589cf48 --- /dev/null +++ b/UOS/src/uos_cdrom.pas @@ -0,0 +1,797 @@ +{This unit is part of United Openlibraries of Sound (uos)} +{ + From CDRom, CDromLinux, CDRomWindows + By Franklyn A. Harlow Feb 2016 + License : modified LGPL. + Merged by Fred van Stappen fiens/hotmail.com } + +unit uos_cdrom; + +{$mode objfpc}{$H+} + +interface + +uses + {$IFDEF FPC}cdrom,{$ENDIF} +{$IFDEF MSWINDOWS} + Windows, +{$ENDIF} +{$IFDEF unix} + baseunix, +{$ENDIF} + Classes, SysUtils, math; + + Const + CDROM_OK = 0; + CDROM_UNKNOWNERR = -1; + + CD_FRAMESIZE_RAW = 2352; + BUF_SIZE = 75 * CD_FRAMESIZE_RAW; // 75 frames - 1 sec + + kCDDA_Base = 'cdda://sr'; + kCDDA_Track = 'Track%20'; + kCDDA_TrackWin = 'Track'; + +Type + TCDDATrackType = (cdtAudio, cdtData, cdtMixed); + Tmsf = record + min : Byte; + sec : Byte; + Frame : Byte; + end; + TCDDAPosition = record + Track : LongInt; + msf : Tmsf; + end; + TCDDATrackInfo = record + TrackLength : Tmsf; + TrackType : TCDDATrackType; + end; + TCDStatus = (cdsNotReady, cdsReady, cdsPlaying, cdsPaused); + TCDDATOCEntry = record + dwStartSector : LongInt; // Start sector of the track + btFlag : Byte; // Track flags (i.e. data or audio track) + btTrackNumber : Byte; // Track number + end; + + PCDROMInfo = ^TCDROMInfo; + TCDROMInfo = Record + + Channels : longword; // stereo = 2 + BitsPerSample : longword; // ie short/smallint = 16 + SampleRate : longword; // Frequency = 44100 + TotalSamples : Int64; + TotalTime : LongWord; // Seconds + pData : pByte; + pDataLen : longword; + Size : Int64; + Position : Int64; + StartPos : TCDDAPosition; + EndPos : TCDDAPosition; + BufStart : LongWord; + BufEnd : LongWord; + BufSize : LongInt; + Buf : array[1..BUF_SIZE*2] of Byte; + BufTmp : array[1..BUF_SIZE*2] of Byte; + fHandleVaild : longint; // 0< : Impossible, 0: Not Valid, >0 : Valid/Available + CurrentPosition : Tmsf; // Current Position Of Track Being Read + {$IFDEF LIBCDRIP} + Opened : LongInt; + Busy : Boolean; + CurrentDrive : LongInt; + EnableJitterCorrection : Boolean; + LastJitterErrors : LongInt; + ReadSectors : LongInt; + OverlapSectors : LongInt; + CompareSectors : LongInt; + MultiReadCount : LongInt; + Paranoid : Boolean; + ParanoiaMode : LongInt; + LockTray : Boolean; + Status : TCDStatus; + RipSize : LongInt; + {$ENDIF} + {$IFDEF MSWINDOWS} + hCDROM : longword; // CDROM CreateFile Handle + {$ENDIF} + {$IFDEF unix} + hCDROM : longint; // CDROM fpOpen Handle + {$ENDIF} + End; + +Const + EndOfDisc : TCDDAPosition = (Track : 100; msf : (min : 0; sec : 0; frame : 0)); + + Function Frames2MSF(Frames : LongInt) : Tmsf; + Function MSF2Frames(const msf : Tmsf) : LongInt; + Function AddressToSectors (msf : Tmsf): int64; + + Function LoadCDROM(Lib : AnsiString): LongWord; + Function UnloadCDROM: LongWord; + Function isCDROMLoaded : Boolean; + + Function CDROM_GetFileNameDrive(FileName : AnsiString): Byte; + Function CDROM_GetFileNameTrack(FileName : AnsiString): Byte; + + Function CDROM_OpenFile(FileName : AnsiString): PCDROMInfo; + Function CDROM_Open(Drive, Track : Byte): PCDROMInfo; + Function CDROM_Close(var pCDROMI: PCDROMInfo): LongWord; + Function CDROM_GetData(var pCDROMI: PCDROMInfo; var pData: Pointer; var DataLength: longword): LongWord; + + Function GetSystemCDRoms: AnsiString; + +implementation + +Function LoadCDROM(Lib : AnsiString): LongWord; +Begin + Result:= 32767; + end; + +Function UnloadCDROM: LongWord; +Begin + Result:= 32767; + end; + +Function isCDROMLoaded : Boolean; +Begin + Result:= True; + end; + +{$IFDEF unix} +Const + CDROM_LBA = $01; // 'logical block': first frame is #0 + CDROM_MSF = $02; // 'minute-second-frame': binary, not bcd here! + CDROM_DATA_TRACK = $40; + CDROM_LEADOUT = $AA; + + CDROMREADTOCHDR = $5305; // Read TOC header + CDROMREADTOCENTRY = $5306; // Read TOC entry + CDROMREADAUDIO = $530E; // (struct cdrom_read_audio) + CDROM_DRIVE_STATUS = $5326; // Get tray position, etc. + CDROM_DISC_STATUS = $5327; // Get disc type, etc. + + CDS_NO_DISC = 1; + CDS_TRAY_OPEN = 2; + CDS_DRIVE_NOT_READY = 3; + CDS_DISC_OK = 4; + + CDS_AUDIO = 100; + CDS_MIXED = 105; + +type + cdrom_addr = record + case Word of + 1: (msf: Tmsf;); + 2: (lba: longint;); + end; + cdrom_read_audio = record + addr : cdrom_addr; // frame address + addr_format : Byte; // CDROM_LBA or CDROM_MSF + nframes : LongInt; // number of 2352-byte-frames to read at once + buf : PByte; // frame buffer (size: nframes*2352 bytes) + end; + cdrom_tocentry = record + cdte_track : Byte; + cdte_adr_ctrl : Byte; + cdte_format : Byte; + cdte_addr : cdrom_addr; + cdte_datamode : Byte; + end; + cdrom_tochdr = record + cdth_trk0: Byte; // start track + cdth_trk1: Byte; // end track + end; + +// ********************** Private Linux SUPPORT Functions ************************************************************** +function GetTrackInfo(hCDROM: LongInt; Track : LongInt): TCDDATrackInfo; +var + Entry : cdrom_tocentry; + TOC : cdrom_tochdr; + F1 : LongInt; + F2 : LongInt; + Ret : LongInt; +begin + Ret:= fpioctl(hCDROM, CDROMREADTOCHDR, @TOC); + if Ret <> 0 then + raise Exception.Create('mcwCDROM_Linux.GetTrackInfo.fpioctl(CDROMREADTOCHDR) Error : ' + IntToStr(Ret)); + + Entry.cdte_format := CDROM_MSF; + Entry.cdte_track := Track + TOC.cdth_trk0 - 1; + + Ret:= fpioctl(hCDROM, CDROMREADTOCENTRY, @Entry); + if Ret <> 0 then + raise Exception.Create('mcwCDROM_Linux.GetTrackInfo.fpioctl(CDROMREADTOCENTRY) Error : ' + IntToStr(Ret)); + + F1 := MSF2Frames(Entry.cdte_addr.msf); + + if (Entry.cdte_adr_ctrl and CDROM_DATA_TRACK) <> 0 then + Result.TrackType := cdtData + else + Result.TrackType := cdtAudio; + + if Entry.cdte_track < toc.cdth_trk1 then + Inc(Entry.cdte_track) + else + Entry.cdte_track := CDROM_LEADOUT; + + Ret:= fpioctl(hCDROM, CDROMREADTOCENTRY, @Entry); + if Ret <> 0 then + raise Exception.Create('mcwCDROM_Linux.GetTrackInfo.fpioctl(CDROMREADTOCENTRY) #2 Error : ' + IntToStr(Ret)); + + F2 := MSF2Frames(Entry.cdte_addr.msf); + Result.TrackLength:= Frames2MSF(F2 - F1); +end; + +function GetTrackMSF(hCDROM, Track : LongInt): Tmsf; +var + entry : cdrom_tocentry; + hdr : cdrom_tochdr; + Ret : LongInt; +begin + Ret:= fpioctl(hCDROM, CDROMREADTOCHDR, @hdr); + if Ret <> 0 then + raise Exception.Create('mcwCDROM_Linux.GetTrackMSF.fpioctl(CDROMREADTOCHDR) Error : ' + IntToStr(Ret)); + + entry.cdte_format := CDROM_MSF; + entry.cdte_track := Track + hdr.cdth_trk0 - 1; + if entry.cdte_track > hdr.cdth_trk1 then + entry.cdte_track := CDROM_LEADOUT; + + Ret:= fpioctl(hCDROM, CDROMREADTOCENTRY, @entry); + if Ret <> 0 then + raise Exception.Create('mcwCDROM_Linux.GetTrackMSF.fpioctl(CDROMREADTOCENTRY) Error : ' + IntToStr(Ret)); + + Result := entry.cdte_addr.msf; +end; + +function GetPosMSF(hCDROM: LongInt; Pos : TCDDAPosition): Tmsf; +var + msf1 : Tmsf; + frames : longint; +begin + msf1 := GetTrackMSF(hCDROM, Pos.Track); + frames := MSF2Frames(msf1); + frames := frames + MSF2Frames(Pos.msf); + Result := Frames2MSF(frames); +end; + +function GetSize(pCDROMI: PCDROMInfo): Int64; +var + F1 : LongWord; + F2 : LongWord; +begin + F1:= (((pCDROMI^.StartPos.msf.min * 60) + pCDROMI^.StartPos.msf.sec) * 75) + pCDROMI^.StartPos.msf.Frame; + F2:= (((pCDROMI^.EndPos.msf.min * 60) + pCDROMI^.EndPos.msf.sec) * 75) + pCDROMI^.EndPos.msf.Frame; + Result := (F2 - F1) * CD_FRAMESIZE_RAW; +end; +// ********************************************************************************************************************* + +Function CDROM_GetFileNameDrive(FileName : AnsiString): Byte; +Begin + Result:= 255; // Assume Error + if Copy(FileName, 1, Length(kCDDA_Base)) = kCDDA_Base then + Result:= StrToIntDef(FileName[10], 256); +end; + +Function CDROM_GetFileNameTrack(FileName : AnsiString): Byte; +Var + s : AnsiString; +Begin + Result:= 0; + if Pos(kCDDA_Track, FileName) > 0 then + Begin + s:= Copy(FileName, Pos(kCDDA_Track, FileName) + Length(kCDDA_Track), Length(FileName)); + s:= Copy(s, 1, Pos('.', s) -1); + Result:= StrToIntDef(s, 0); + end; +end; + +Function CDROM_OpenFile(FileName : AnsiString): PCDROMInfo; +Var + Drive, Track : Byte; +Begin + Result:= CDROM_Open(CDROM_GetFileNameDrive(FileName), + CDROM_GetFileNameTrack(FileName)); +end; + +Function CDROM_Open(Drive, Track : Byte): PCDROMInfo; +Var + CDRomPath : AnsiString; + slCDROMS : TStringList; + + Res : longint; + Data : longint; + CDTI : TCDDATrackInfo; + CDTrackCount : LongInt; + CDTOC : Array of TTocEntry; +Begin + Result:= nil; + if (Drive = 255) or (Track < 1) then + Exit; + + New(Result); + + // Read Only, CDROMI uses constants and ignores changes to these... + Result^.Channels := 2; + Result^.BitsPerSample:= 16; + Result^.SampleRate := 44100; + + CDRomPath:= '/dev/sr' + IntToStr(Drive); + slCDROMS := TStringList.Create; + Try + slCDROMS.Text:= GetSystemCDRoms; + if slCDROMS.IndexOf(CDRomPath) = -1 then + raise Exception.Create('mcwCDROM_Linux.CDROM_Open.GetSystemCDRoms Error : ' + CDRomPath + ' Not Found.'); + finally + slCDROMS.Free; + end; + + Result^.hCDROM:= fpopen(PAnsiChar(CDRomPath), O_RDONLY or O_NONBLOCK);; + if Result^.hCDROM < 0 then + raise Exception.Create('mcwCDROM_Linux.CDROM_Open.fpopen Error : (' + IntToStr(Result^.hCDROM) + ') On ' + CDRomPath); + + // What State Is CDROM in ? + Res:= fpioctl(Result^.hCDROM, CDROM_DRIVE_STATUS, @Data); + if Res <> CDS_DISC_OK then + Begin + CDROM_Close(Result); + Dispose(Result); + Result:= nil; + Exit; + end; + // CDRom OK, What Kind Of Disk Do We Have? + Res := fpioctl(Result^.hCDROM, CDROM_DISC_STATUS, @Data); + if (Res <> CDS_AUDIO) And (Res <> CDS_MIXED) Then + Begin + CDROM_Close(Result); + Dispose(Result); + Result:= nil; + Exit; + end; + + CDTI := GetTrackInfo(Result^.hCDROM, Track); + if CDTI.TrackType = cdtData then + raise Exception.Create('mcwCDROM_Linux.CDROM_Open : Trying to rip a data track'); + + Result^.StartPos.Track := Track; + Result^.StartPos.msf := GetTrackMSF(Result^.hCDROM, Result^.StartPos.Track); + Result^.EndPos.Track := Track +1; + Result^.EndPos.msf := GetTrackMSF(Result^.hCDROM, Result^.EndPos.Track); + + CDTrackCount := cdrom.ReadCDTOC(CDRomPath, CDTOC); + + if (Result^.EndPos.Track in [1..CDTrackCount]) = False then + raise Exception.Create('mcwCDROM_Linux.CDROM_Open : The end track out of range' + #13 + + IntToStr(Result^.EndPos.Track) + ' Requested, 1..' + IntToStr(CDTrackCount) + ' Allowed...'); + + Result^.CurrentPosition := Result^.StartPos.msf; + Result^.Position := 0; + Result^.Size := GetSize(Result); + Result^.BufStart := 1; + Result^.BufEnd := 0; + Result^.BufSize := BUF_SIZE; + Result^.TotalSamples := Result^.Size div 4; + Result^.TotalTime := floor(Result^.TotalSamples / 44100); + + Inc(Result^.fHandleVaild); + +end; + +Function CDROM_Close(var pCDROMI: PCDROMInfo): LongWord; +Begin + Result := CDROM_UNKNOWNERR; + if pCDROMI^.fHandleVaild = 1 then + fpclose(pCDROMI^.hCDROM); + if pCDROMI^.fHandleVaild > 0 then + Dec(pCDROMI^.fHandleVaild); + Result := CDROM_OK; +end; + +Function CDROM_GetData(var pCDROMI: PCDROMInfo; var pData: Pointer; var DataLength: longword): LongWord; +var + ReqLen : LongWord; + ReqFrames : LongInt; + cdaudio : cdrom_read_audio; + Ret : LongWord; + Res : LongInt; + TmpCount : longword; + Procedure getNextChunk; + Begin + TmpCount:= 0; + + // Have We Reached End On Track ? + if MSF2Frames(pCDROMI^.CurrentPosition) >= MSF2Frames(pCDROMI^.EndPos.msf) then + Begin + pCDROMI^.BufEnd := 0; + pCDROMI^.BufStart := 0; + Exit; + End; + + // This is not first call + if pCDROMI^.BufEnd > 0 then + Begin + // Copy Leftover Data to Start of buffer... + TmpCount:= pCDROMI^.BufEnd - pCDROMI^.BufStart; + Move(pCDROMI^.Buf[pCDROMI^.BufStart], pCDROMI^.BufTmp[1], TmpCount); + Move(pCDROMI^.BufTmp[1], pCDROMI^.Buf[1], TmpCount); + End; + + ReqFrames:= 75; // BUF_SIZE = 1 Sec Worth Data = 75 Frames = In Bytes + if MSF2Frames(pCDROMI^.CurrentPosition) + ReqFrames > MSF2Frames(pCDROMI^.EndPos.msf) then + ReqFrames:= MSF2Frames(pCDROMI^.EndPos.msf) - MSF2Frames(pCDROMI^.CurrentPosition); + + // *** Rip Next Chunk ****************************************** + cdaudio.nframes := ReqFrames; // BUF_SIZE = 1 Sec Worth Data = 75 Frames = In Bytes + cdaudio.addr_format := CDROM_MSF; + cdaudio.addr.msf := pCDROMI^.CurrentPosition; + cdaudio.buf := @pCDROMI^.Buf[TmpCount +1]; + + Res:= fpioctl(pCDROMI^.hCDROM, CDROMREADAUDIO, @cdaudio); + if Res <> 0 then + raise Exception.Create('mcwCDROM_Linux.CDROM_GetData.getNextChunk.fpioctl(CDROMREADAUDIO) Error : ' + IntToStr(fpgeterrno)); + + pCDROMI^.CurrentPosition:= Frames2MSF(MSF2Frames(pCDROMI^.CurrentPosition) + cdaudio.nframes); + + Ret := cdaudio.nframes * CD_FRAMESIZE_RAW; + // *** End Rip Next Chunk *************************************** + + pCDROMI^.BufEnd:= TmpCount + Ret + 1; + pCDROMI^.BufStart := 1; + end; + +begin + // PortAudio expects exact amount of data, anything less causes "Blips" + + // pCDROMI.BufStart = Start Byte of Current Valid, Not Sent Buffer... + // pCDROMI.BufEnd = Last Byte of Current Valid, Not sent Buffer... + + ReqLen:= DataLength; + + if pCDROMI^.fHandleVaild = 0 then + raise Exception.Create('mcwCDROM_Linux.CDROM_GetData Error : Call To GetData Without Vaild CDROM Handle.'); + + // We don't read CDROM every call, only when we need new data... + if (pCDROMI^.BufStart + ReqLen) > pCDROMI^.BufEnd then + getNextChunk; + + // is the amount in buffer less than what was requested... + if DataLength > (pCDROMI^.BufEnd - pCDROMI^.BufStart + 1) then + DataLength := pCDROMI^.BufEnd - pCDROMI^.BufStart + 1; + + // Have We Finished Reading Track ? + if pCDROMI^.BufEnd = 0 then + DataLength:= 0; + + pData:= @pCDROMI^.Buf[pCDROMI^.BufStart]; + + If DataLength > 0 Then + Begin + Inc(pCDROMI^.BufStart, DataLength); + Inc(pCDROMI^.Position, DataLength); + end; + + Result:= DataLength; +end; +{$ENDIF} +////////////////////// +{$IFDEF MSWINDOWS} +const + CDDA = 2; + IOCTL_CDROM_READ_TOC = $00024000; + IOCTL_CDROM_RAW_READ = $0002403E; + IOCTL_STORAGE_CHECK_VERIFY2 = $0002D0800; + MAXIMUM_NUMBER_TRACKS = 100; + CB_CDROMSECTOR = 2048; + +Type + _TRACK_DATA = record + Reserved : UCHAR; + Control_and_Adr: UCHAR; + TrackNumber : UCHAR; + Reserved1 : UCHAR; + Address : array[0..3] of UCHAR; + end; + TRACK_DATA = _TRACK_DATA; + PTRACK_DATA = ^_TRACK_DATA; + _CDROM_TOC = record + Length : WORD; + FirstTrack : UCHAR; + LastTrack : UCHAR; + TrackData : array[0..(MAXIMUM_NUMBER_TRACKS)-1] of TRACK_DATA; + end; + CDROM_TOC = _CDROM_TOC; + PCDROM_TOC = ^_CDROM_TOC; + RAW_READ_INFO = record + DiskOffset : Int64; + SectorCount : Cardinal; + TrackMode : Cardinal; + end; + +Function fpgeterrno(): LongWord; +Begin + Result:= GetLastOSError; +end; + +// ********************** Private Windows SUPPORT Functions ************************************************************ +function GetTrackMSF(Table: CDROM_TOC; Track : LongInt): Tmsf; +begin + Result.min := Table.TrackData[Track -1].Address[1]; + Result.sec := Table.TrackData[Track -1].Address[2]; + Result.Frame:= Table.TrackData[Track -1].Address[3]; +end; + +function GetPosMSF(Table: CDROM_TOC; Pos : TCDDAPosition): Tmsf; +var + msf1 : Tmsf; + frames : longint; +begin + msf1 := GetTrackMSF(Table, Pos.Track); + frames := MSF2Frames(msf1); + frames := frames + MSF2Frames(Pos.msf); + Result := Frames2MSF(frames); +end; + +function GetSize(pCDROMI: PCDROMInfo): Int64; +var + F1 : LongWord; + F2 : LongWord; +begin + F1:= (((pCDROMI^.StartPos.msf.min * 60) + pCDROMI^.StartPos.msf.sec) * 75) + pCDROMI^.StartPos.msf.Frame; + F2:= (((pCDROMI^.EndPos.msf.min * 60) + pCDROMI^.EndPos.msf.sec) * 75) + pCDROMI^.EndPos.msf.Frame; + Result := (F2 - F1) * CD_FRAMESIZE_RAW; +end; +// ********************************************************************************************************************* + +Function CDROM_GetFileNameDrive(FileName : AnsiString): Byte; +Var + driveLetter : Char; + drive : Char; + cdromcount : Byte; + found : Boolean; +Begin + found := False; + driveLetter:= FileName[1]; + cdromcount := 255; + For drive := 'A' to 'Z' do + if GetDriveType(PChar(drive + ':\')) = DRIVE_CDROM then + Begin + Inc(cdromcount); + if drive = driveLetter then + Begin + found:= True; + break; + end; + end; + if not found then + raise Exception.Create('CDROM (BDROM) Drive Not Found !'); + Result := cdromcount; +end; + +Function CDROM_GetFileNameTrack(FileName : AnsiString): Byte; +Var + s : AnsiString; +Begin + // This works on Win7... + s := Copy(Filename, Pos(kCDDA_TrackWin, Filename) + 5, Length(Filename)); + s := Copy(s, 1, Pos('.', s) -1); + Result:= StrToIntDef(s , 0); +end; + +Function CDROM_OpenFile(FileName : AnsiString): PCDROMInfo; +Var + Drive, Track : Byte; +Begin + Result:= CDROM_Open(CDROM_GetFileNameDrive(FileName), + CDROM_GetFileNameTrack(FileName)); +end; + +Function CDROM_Open(Drive, Track : Byte): PCDROMInfo; +Var + CDRomPath : AnsiString; + Table : CDROM_TOC; + BytesRead : LongWord; + Ret : BOOL; + flags : longword; +// Index : LongInt; +Begin + Result:= nil; + if (Drive = 255) or (Track < 1) then + Exit; + + New(Result); + + // Read Only, CDROMI uses constants and ignores changes to these... + Result^.Channels := 2; + Result^.BitsPerSample:= 16; + Result^.SampleRate := 44100; + + CDRomPath:= UpperCase('\\.\CDROM') + IntToStr(Drive); + flags := longword(GENERIC_READ); + + Result^.hCDROM:= CreateFileA(PAnsiChar(CDRomPath), Flags, FILE_SHARE_READ, nil, OPEN_EXISTING, 0, 0 ); + if (Result^.hCDROM = INVALID_HANDLE_VALUE) then + raise Exception.Create('mcwCDROM_Win.CDROM_Open.CreateFileA Error : (' + IntToStr(Result^.hCDROM) + ') On ' + CDRomPath); + + // What State Is CDROM in ? + Ret:= DeviceIoControl(Result^.hCDROM, IOCTL_STORAGE_CHECK_VERIFY2, nil, 0, nil, 0, BytesRead, nil); + if Not Ret then + Begin + CDROM_Close(Result); + Dispose(Result); + Result:= nil; + Exit; + end; + + Ret:= DeviceIoControl(Result^.hCDROM, IOCTL_CDROM_READ_TOC, nil, 0, @Table, sizeof(Table), BytesRead, nil); + if Ret = False then + raise Exception.Create('mcwCDROM_Win.CDROM_Open.DeviceIoControl(IOCTL_CDROM_READ_TOC) Error '); + + Result^.StartPos.Track := Track; + Result^.StartPos.msf := GetTrackMSF(Table, Result^.StartPos.Track); + Result^.EndPos.Track := Track +1; + Result^.EndPos.msf := GetTrackMSF(Table, Result^.EndPos.Track); + Result^.CurrentPosition := Result^.StartPos.msf; + Result^.Position := 0; + Result^.Size := GetSize(Result); + Result^.BufStart := 1; + Result^.BufEnd := 0; + Result^.BufSize := BUF_SIZE; + Result^.TotalSamples := Result^.Size div 4; + Result^.TotalTime := floor(Result^.TotalSamples / 44100); + + Inc(Result^.fHandleVaild); +end; + +Function CDROM_Close(var pCDROMI: PCDROMInfo): LongWord; +Begin + Result := CDROM_UNKNOWNERR; + if pCDROMI^.fHandleVaild = 1 then + CloseHandle(pCDROMI^.hCDROM); + if pCDROMI^.fHandleVaild > 0 then + Dec(pCDROMI^.fHandleVaild); + Result := CDROM_OK; +end; + +Function CDROM_GetData(var pCDROMI: PCDROMInfo; var pData: Pointer; var DataLength: longword): LongWord; +var + ReqLen : LongWord; + ReqFrames : LongInt; + Info : RAW_READ_INFO; + BytesRead : LongWord; + Address : Int64; + Ret : LongWord; + Res : BOOL; + TmpCount : longword; + Procedure getNextChunk; + Begin + TmpCount:= 0; + + // Have We Reached End On Track ? + if MSF2Frames(pCDROMI^.CurrentPosition) >= MSF2Frames(pCDROMI^.EndPos.msf) then + Begin + pCDROMI^.BufEnd := 0; + pCDROMI^.BufStart := 0; + Exit; + End; + + // This is not first call + if pCDROMI^.BufEnd > 0 then + Begin + // Copy Leftover Data to Start of buffer... + TmpCount:= pCDROMI^.BufEnd - pCDROMI^.BufStart; + Move(pCDROMI^.Buf[pCDROMI^.BufStart], pCDROMI^.BufTmp[1], TmpCount); + Move(pCDROMI^.BufTmp[1], pCDROMI^.Buf[1], TmpCount); + End; + // While Linux Can deal With 75 Frame Request, Windows Only 20 (?) + ReqFrames:= 20; // BUF_SIZE = 1 Sec Worth Data = 75 Frames = In Bytes + if MSF2Frames(pCDROMI^.CurrentPosition) + ReqFrames > MSF2Frames(pCDROMI^.EndPos.msf) then + ReqFrames:= MSF2Frames(pCDROMI^.EndPos.msf) - MSF2Frames(pCDROMI^.CurrentPosition); + + // *** Rip Next Chunk ****************************************** + Address:= AddressToSectors(pCDROMI^.CurrentPosition); + + Info.TrackMode := CDDA; + Info.SectorCount:= ReqFrames; + Info.DiskOffset := Address * CB_CDROMSECTOR; + + Res:= DeviceIoControl(pCDROMI^.hCDROM, + IOCTL_CDROM_RAW_READ, + @Info, + sizeof(Info), + @pCDROMI^.Buf[TmpCount +1], + ReqFrames * CD_FRAMESIZE_RAW, + BytesRead, + nil); + if Res = False then + raise Exception.Create('mcwCDROM_Win.CDROM_GetData.getNextChunk.fpioctl(CDROMREADAUDIO) Error : ' + IntToStr(fpgeterrno)); + + pCDROMI^.CurrentPosition:= Frames2MSF(MSF2Frames(pCDROMI^.CurrentPosition) + ReqFrames); + + Ret := BytesRead; // Should Be The same as "ReqFrames * CD_FRAMESIZE_RAW" + // *** End Rip Next Chunk *************************************** + + pCDROMI^.BufEnd:= TmpCount + Ret + 1; + pCDROMI^.BufStart := 1; + end; + +begin + // PortAudio expects exact amount of data, anything less causes "Blips" + + // pCDROMI.BufStart = Start Byte of Current Valid, Not Sent Buffer... + // pCDROMI.BufEnd = Last Byte of Current Valid, Not sent Buffer... + + ReqLen:= DataLength; + + if pCDROMI^.fHandleVaild = 0 then + raise Exception.Create('mcwCDROM_Win.CDROM_GetData Error : Call To GetData Without Vaild CDROM Handle.'); + + // We don't read CDROM every call, only when we need new data... + if (pCDROMI^.BufStart + ReqLen) > pCDROMI^.BufEnd then + getNextChunk; + + // is the amount in buffer less than what was requested... + if DataLength > (pCDROMI^.BufEnd - pCDROMI^.BufStart + 1) then + DataLength := pCDROMI^.BufEnd - pCDROMI^.BufStart + 1; + + // Have We Finished Reading Track ? + if pCDROMI^.BufEnd = 0 then + DataLength:= 0; + + pData:= @pCDROMI^.Buf[pCDROMI^.BufStart]; + + If DataLength > 0 Then + Begin + Inc(pCDROMI^.BufStart, DataLength); + Inc(pCDROMI^.Position, DataLength); + end; + + Result:= DataLength; +end; +{$ENDIF} +///////////////////// + +Function GetSystemCDRoms: AnsiString; +var + Index : longint; + Ret : LongInt; + Devices : Array of string; + sl : TStringList; +begin + Result:= ''; + sl:= TStringList.Create; + + SetLength(Devices, 99); + Ret:= cdrom.GetCDRomDevices(Devices); + If Ret > 0 Then + For Index := 0 To Ret -1 do + sl.Add(Devices[Index]); + + Result:= sl.Text; + sl.Free; +end; + +// ********************** Common Linux/Windows SUPPORT Functions ******************************************************* +Function Frames2MSF(Frames : LongInt) : Tmsf; +var + Temp : Integer; +begin + Temp := Frames div 75; + Result.min := Temp div 60; + Result.sec := Temp mod 60; + Result.Frame := Frames mod 75; +end; + +function MSF2Frames(const msf : Tmsf) : LongInt; +begin + Result := ((msf.min * 60) + msf.sec) * 75 + msf.Frame; +end; + +Function AddressToSectors (msf : Tmsf): int64; +begin + Result:= MSF2Frames(msf) - 150; +end; + +// ********************************************************************************************************************* + +end. + diff --git a/UOS/src/uos_define.inc b/UOS/src/uos_define.inc new file mode 100644 index 0000000..da57a6e --- /dev/null +++ b/UOS/src/uos_define.inc @@ -0,0 +1,35 @@ +{ United Openlibraries of Sound (uos) + License : modified LGPL. + Fred van Stappen fiens@hotmail.com } + +// Compiler definitions + +{.$DEFINE uos_debug} // uncomment for debugging. For console and Unix applications only. + +{.$DEFINE consoleapp} // if FPC version < 2.7.1 uncomment for console application +{.$DEFINE library} // uncomment for building uos library (native and java) +{.$DEFINE java} // uncomment for building uos java library +{.$DEFINE fpgui} // uncomment if FPC version < 2.7.1 and using fpGUI widget +{.$DEFINE mse} // uncomment when using a mse project, use mse mseThread in place of fpc TThread. +{.$DEFINE usequeue} // uncomment to use Thread.Queue instead of Thread.Synchronize for fpc threads, better for LCL widgets. + +{$DEFINE portaudio} // uncomment to enable portaudio In/Out sound port + +{$DEFINE sndfile} // uncomment to enable sndfile (wav, ogg, flac audio file) +{$DEFINE mpg123} // uncomment to enable mpg123 (mp3 audio file) +{$DEFINE neaac} // uncomment to enable neaac (m4a audio file) +{$DEFINE fdkaac} // uncomment to enable aacdecoder (acc audio webstream) +{$DEFINE opus} // uncomment to enable opus (opus audio file) +{$DEFINE xmp} // uncomment to enable xmp (mod, it, mods, audio file) +{.$DEFINE cdrom} // uncomment to enable cdrom audio decoder (cda) + +{$DEFINE soundtouch} // uncomment to enable Soundtouch tempo plugin +{$DEFINE bs2b} // uncomment to enable bs2b stereo to binaural plugin + +{$DEFINE webstream} // uncomment to enable Internet Audio Streaming + +{.$DEFINE shout} // uncomment to enable IceCast-Shout audio web server. + +{$DEFINE noiseremoval} // uncomment to enable Noise Removal DSP + +{$DEFINE synthesizer} // uncomment to enable Synthesizer diff --git a/UOS/src/uos_dsp_noiseremoval.pas b/UOS/src/uos_dsp_noiseremoval.pas new file mode 100644 index 0000000..79af8ea --- /dev/null +++ b/UOS/src/uos_dsp_noiseremoval.pas @@ -0,0 +1,1201 @@ +{This unit is part of United Openlibraries of Sound (uos)} +{ + audacity which this file was converted from is GPLv2 + http://www.audacityteam.org/about/license/ + Converted By Andrew Haines + License : modified LGPL. + Fred van Stappen fiens@hotmail.com + } + +unit uos_dsp_noiseremoval; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, uos_dsp_utils ; + +type + PFFT = ^TFFT; + + { TFFT } + + TFFT = object + BitReversed: PInteger; + SinTable: PSingle; + Points: Integer; + FPCSinTable: array of Single; + function InitializeFFT(FFTLen: Integer): PFFT; static; + procedure EndFFT; + function GetFFT(FFTLen: Integer): PFFT; static; + procedure ReleaseFFT; + procedure InverseRealFFTf(buffer: PSingle); + procedure CleanupFFT; static; // ??? + procedure RealFFTf(buffer: PSingle); + procedure ReorderToTime(Buffer: PSingle; TimeOut: PSingle); + procedure ReorderToFreq(Buffer: PSingle; RealOut: PSingle; ImagOut: PSingle); + end; + +type + PPSingle=^PSingle; + TSingleArray = array of Single; + + TNoiseRemoval = class; + TNoiseWriteProc = procedure(ASender: TObject; AData: PSingle; ASampleCount: Integer) of Object; + + { TNoiseRemoval } + + TNoiseRemoval = class + private + FDoProfile: Boolean; + FHasProfile: Boolean; + + // Parameters chosen before the first phase + FSampleRate: Double; + FWindowSize: Integer; + FSpectrumSize: Integer; + FMinSignalTime: Single; // in secs + + // The frequency-indexed noise threshold derived during the first + // phase of analysis + FNoiseThreshold: array of Single; // length in FSpectrumSize + + // Parameters that affect the noise removal, regardless of how the + // noise profile was extracted + FSensitivity: Double; + FFreqSmoothingHz: Double; + FNoiseGain: Double; // in dB, should be negative + FAttackDecayTime: Double; + FbLeaveNoise: Boolean; + + // change this later + procedure Initialize; + procedure Reset; // StartNewTrack + procedure ProcessSamples(len: Integer; Buffer:PSingle); + procedure FillFirstHistoryWindow; + procedure ApplyFreqSmoothing(ASpec: PSingle); + procedure GetProfile; + procedure RemoveNoise; + procedure RotateHistoryWindows; + procedure FinishTrack; + procedure Cleanup; + private + //FOutputTrack: PSingle; // WaveTrack; + FInSampleCount: Integer; + FOutSampleCount: Integer; + FInputPos: Integer; + FFFT: PFFT; + FFFTBuffer: PSingle; // FWindowSize + FWindow: PSingle; // FWindowSize + FFreqSmoothingBins: Integer; + FAttackDecayBlocks: Integer; + FOneBlockAttackDecay: Single; + FNoiseAttenFactor: Single; + FSensitivityFactor: Single; + FMinSignalBlocks: Integer; + FHistoryLen: Integer; + FInWaveBuffer: PSingle; // FWindowSize + FOutOverlapBuffer: PSingle; // FWindowSize + FSpectrums: array of PSingle; // FHistoryLen x FSpectrumSize + FGains: array of PSingle; // FHistoryLen x FSpectrumSize + FRealFFTs: array of PSingle; // FHistoryLen x FWindowSize + FImagFFTs: array of PSingle; // FHistoryLen x FWindowSize + FWriteProc: TNoiseWriteProc; + FInited: Boolean; + FTotalRead: QWord; + function GetNoiseProfile: TSingleArray; + procedure SetAttackDecayTime(AValue: Double); + procedure SetFreqSmoothingHz(AValue: Double); + procedure SetGain(AValue: Double); + procedure SetNoiseProfile(AValue: TSingleArray); + procedure SetSensitivity(AValue: Double); + public + constructor Create; + destructor Destroy; override; + function Init(ASampleRate: Integer): Boolean; + function Process(AData: PSingle; ASampleCount: Integer; AGetNoiseProfile: Boolean; AMoreComing: Boolean = False): Boolean; + procedure Flush; // finish writing out data in buffers. + + property NoiseProfile: TSingleArray read GetNoiseProfile write SetNoiseProfile; + + // these have defaults + property Sensitivity: Double read FSensitivity write SetSensitivity; + property Gain: Double read FNoiseGain write SetGain; + property FreqSmoothingHz: Double read FFreqSmoothingHz write SetFreqSmoothingHz; + property AttackDecayTime: Double read FAttackDecayTime write SetAttackDecayTime; + property LeaveNoise: Boolean read FbLeaveNoise write FbLeaveNoise; + + // don't mess with these. + property SampleRate: Double read FSampleRate;// write FSampleRate; + property WindowSize: Integer read FWindowSize;// write FWindowSize; + property SpectrumSize: Integer read FSpectrumSize;// write FSpectrumSize; + property MinSignalTime: Single read FMinSignalTime;// write FMinSignalTime; // in secs + + // This must be assigned or av's will occur + property WriteProc: TNoiseWriteProc read FWriteProc write FWriteProc; + end; + +type + + { TNoiseRemovalChannel } + + TNoiseRemovalChannel = class(TNoiseRemoval, IPAIODataIOInterface) + HasProfile: Boolean; + ProfileComplete: Boolean; + procedure WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); + end; + + { TNoiseRemovalMultiChannel } + + TNoiseRemovalMultiChannel = class(IPAIODataIOInterface) + private + FChannels, + FSampleRate: Integer; + FHelper: TPAIOChannelHelper; + FNoise: array of TNoiseRemovalChannel; + FWriteProc: TNoiseWriteProc; + //IPAIODataIOInterface + procedure WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); + procedure DataWrite(ASender: TObject; AData: PSingle; ASampleCount: Integer); + public + constructor Create(AChannels: Integer; ASampleRate: Integer); + destructor Destroy; override; + procedure ReadNoiseProfile(AData: PSingle; ASamples: Integer); + procedure ProcessNoise(AData: PSingle; ASamples: Integer); + procedure Flush; + property WriteProc: TNoiseWriteProc read FWriteProc write FWriteProc; + end; + +{ TuosNoiseRemoval } + type + TuosNoiseRemoval = class(TNoiseRemovalMultiChannel) + OutStream: TStream; + public + isprofiled : boolean ; + samprate : integer ; + procedure WriteData(ASender: TObject; AData: PSingle; ASampleCount: Integer) ; + function FilterNoise(ANoisyAudio: PSingle; InFrames: Integer; out Samples: Integer): PSingle; + end; + + implementation +uses + math; + +const + PI = 3.14159265358979323846; + MAX_HFFT = 10; +var + FFTArray: array[0..MAX_HFFT-1] of PFFT; + FFTLockCount: array[0..MAX_HFFT-1] of Integer; + +{ TMultiChannelNoiseRemoval } + +procedure TNoiseRemovalMultiChannel.WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); +begin + if Assigned(FWriteProc) then + FWriteProc(Self, AData, ASamples); +end; + +procedure TNoiseRemovalMultiChannel.DataWrite(ASender: TObject; AData: PSingle; ASampleCount: Integer); +begin + (FHelper as IPAIODataIOInterface).WriteDataIO(ASender as IPAIODataIOInterface, AData, ASampleCount); +end; + +constructor TNoiseRemovalMultiChannel.Create(AChannels: Integer; + ASampleRate: Integer); +var + i: Integer; +begin + FChannels:=AChannels; + FSampleRate:=ASampleRate; + FHelper := TPAIOChannelHelper.Create(Self); + SetLength(FNoise, AChannels); + for i := 0 to High(FNoise) do + begin + FNoise[i] := TNoiseRemovalChannel.Create; + FNoise[i].WriteProc:=@DataWrite; + FNoise[i].Init(ASampleRate); + FHelper.Outputs.Add(FNoise[i] as IPAIODataIOInterface); + end; +end; + +destructor TNoiseRemovalMultiChannel.Destroy; +var + i: Integer; +begin + for i := 0 to High(FNoise) do + begin + FNoise[i].Free; + end; + SetLength(FNoise, 0); + FHelper.Free; +end; + +procedure TNoiseRemovalMultiChannel.ReadNoiseProfile(AData: PSingle; + ASamples: Integer); +var + i: Integer; +begin + FHelper.Write(AData, ASamples); + for i := 0 to High(FNoise) do + begin + FNoise[i].ProfileComplete:=True; + FNoise[i].Process(nil, 0, True, False); + FNoise[i].HasProfile:=True; + FNoise[i].Init(FSampleRate); + end; +end; + +procedure TNoiseRemovalMultiChannel.ProcessNoise(AData: PSingle; + ASamples: Integer); +begin + FHelper.Write(AData, ASamples); +end; + +procedure TNoiseRemovalMultiChannel.Flush; +var + i: Integer; +begin + for i := 0 to High(FNoise) do + FNoise[i].Flush; +end; + +procedure TNoiseRemovalChannel.WriteDataIO(ASender: IPAIODataIOInterface; + AData: PSingle; ASamples: Integer); +begin + Process(AData, ASamples, not HasProfile, not HasProfile); +end; + +{ TuosNoiseRemoval } + +procedure TuosNoiseRemoval.WriteData(ASender: TObject; AData: PSingle; + ASampleCount: Integer); +begin + OutStream.Write(AData^, ASampleCount*SizeOf(Single)); +end; + +function TuosNoiseRemoval.FilterNoise(ANoisyAudio: PSingle; InFrames: Integer; out Samples: Integer): PSingle; +var + MNoisyAudio: TMemoryStream; + begin + OutStream := TMemoryStream.Create; + + MNoisyAudio := TMemoryStream.Create; + MNoisyAudio.Write(ANoisyAudio^, InFrames*SizeOf(Single)); + MNoisyAudio.Position:=0; + + if isprofiled = false then // take the first chunk as noisy sample + begin + ReadNoiseProfile(PSingle(MNoisyAudio.Memory), MNoisyAudio.Size div SizeOf(Single)); + isprofiled := true; + end; + + Result := nil; + + ProcessNoise(PSingle(MNoisyAudio.Memory), MNoisyAudio.Size div SizeOf(Single)); + + Result:=GetMem(OutStream.Size); + Samples := OutStream.Size div SizeOf(Single); + OutStream.Position:=0; + OutStream.Read(Result^, OutStream.Size); + + MNoisyAudio.free; + OutStream.Free; + + // Result := ANoisyAudio; + end; + +{ TNoiseRemoval } + +function NewFloatArray(ALength: Integer): PSingle; inline; +begin + Result := Getmem(ALength*SizeOf(Single)); +end; + +procedure TNoiseRemoval.Initialize; +var + i: Integer; +begin + FFreqSmoothingBins := Trunc(FFreqSmoothingHz * FWindowSize / FSampleRate); + FAttackDecayBlocks := 1 + Trunc(FAttackDecayTime * FSampleRate / (FWindowSize / 2)); + // Applies to amplitudes, divide by 20: + FNoiseAttenFactor := power(10, FNoiseGain/20); + + // Applies to gain factors which apply to amplitudes, divide by 20: + //FOneBlockAttackDecay := power(10.0, (FNoiseGain / (20.0 * FAttackDecayBlocks))); + FOneBlockAttackDecay := power(10.0, (FNoiseGain / FAttackDecayBlocks) / 20 ); + // Applies to power, divide by 10: + FSensitivityFactor := power(10.0, FSensitivity/10.0); + FMinSignalBlocks := Trunc(FMinSignalTime * FSampleRate / (FWindowSize / 2)); + if( FMinSignalBlocks < 1 ) then + FMinSignalBlocks := 1; + FHistoryLen := (2 * FAttackDecayBlocks) - 1; + + if (FHistoryLen < FMinSignalBlocks) then + FHistoryLen := FMinSignalBlocks; + + SetLength(FSpectrums, FHistoryLen); + SetLength(FGains, FHistoryLen); + SetLength(FRealFFTs, FHistoryLen); + SetLength(FImagFFTs, FHistoryLen); + for i := 0 to FHistoryLen-1 do + begin + FSpectrums[i] := NewFloatArray(FSpectrumSize); + FGains[i] := NewFloatArray(FSpectrumSize); + FRealFFTs[i] := NewFloatArray(FSpectrumSize); + FImagFFTs[i] := NewFloatArray(FSpectrumSize); + end; + + // Initialize the FFT + FFFT := TFFT.InitializeFFT(FWindowSize); + + FFFTBuffer := NewFloatArray(FWindowSize); + FInWaveBuffer := NewFloatArray(FWindowSize); + FWindow := NewFloatArray(FWindowSize); + FOutOverlapBuffer := NewFloatArray(FWindowSize); + + // Create a Hanning window function + for i := 0 to FWindowSize-1 do + FWindow[i] := 0.5 - 0.5 * cos((2.0*pi*i) / FWindowSize); + + if FDoProfile then + begin + FillChar(FNoiseThreshold[0], SizeOf(FNoiseThreshold[0])*FSpectrumSize, 0); + //for i := 0 to FSpectrumSize-1 do + // FNoiseThreshold[i] := float(0); + end; + +end; + +procedure TNoiseRemoval.Reset; +var + i, j: Integer; +begin + for i := 0 to FHistoryLen-1 do + begin + for j := 0 to FSpectrumSize-1 do + begin + FSpectrums[i][j] := 0; + FGains[i][j] := FNoiseAttenFactor; + FRealFFTs[i][j] := 0.0; + FImagFFTs[i][j] := 0.0; + end; + end; + + for j := 0 to FWindowSize-1 do + FOutOverlapBuffer[j] := 0.0; + + FInputPos := 0; + FInSampleCount := 0; + FOutSampleCount := -(FWindowSize div 2) * (FHistoryLen - 1); +end; + +function Min(A, B: Integer): Integer; +begin + if A < B then + Exit(A); + Result := B; +end; + +procedure TNoiseRemoval.ProcessSamples(len: Integer; Buffer: PSingle); +var + i: Integer; + avail: Integer; +begin + //while((len and FOutSampleCount) < FInSampleCount) do + while len > 0 do + begin + avail := Min(len, FWindowSize - FInputPos); + for i := 0 to avail-1 do + FInWaveBuffer[FInputPos + i] := buffer[i]; + buffer += avail; + len -= avail; + FInputPos += avail; + + if (FInputPos = FWindowSize) then + begin + FillFirstHistoryWindow(); + if (FDoProfile) then + GetProfile() + else + RemoveNoise(); + RotateHistoryWindows(); + + // Rotate halfway for overlap-add + //for(i = 0; i < mWindowSize / 2; i++) { + for i := 0 to FWindowSize div 2 -1 do + FInWaveBuffer[i] := FInWaveBuffer[i + FWindowSize div 2]; + + FInputPos := FWindowSize div 2; + end; + end; +end; + +procedure TNoiseRemoval.FillFirstHistoryWindow; +var + i: Integer; +begin + for i := 0 to FWindowSize-1 do + FFFTBuffer[i] := FInWaveBuffer[i]; + FFFT^.RealFFTf(FFFTBuffer); + //for(i = 1; i < (mSpectrumSize-1); i++) { + for i := 1 to FSpectrumSize-2 do + begin + FRealFFTs[0][i] := FFFTBuffer[FFFT^.BitReversed[i] ]; + FImagFFTs[0][i] := FFFTBuffer[FFFT^.BitReversed[i]+1]; + FSpectrums[0][i] := FRealFFTs[0][i]*FRealFFTs[0][i] + FImagFFTs[0][i]*FImagFFTs[0][i]; + FGains[0][i] := FNoiseAttenFactor; + end; + + // DC and Fs/2 bins need to be handled specially + FSpectrums[0][0] := FFFTBuffer[0]*FFFTBuffer[0]; + FSpectrums[0][FSpectrumSize-1] := FFFTBuffer[1]*FFFTBuffer[1]; + FGains[0][0] := FNoiseAttenFactor; + FGains[0][FSpectrumSize-1] := FNoiseAttenFactor; +end; + +function Max(A,B: Integer): Integer; inline; +begin + if A>B then + Exit(A); + Result := B; +end; + +procedure TNoiseRemoval.ApplyFreqSmoothing(ASpec: PSingle); +var + tmp: PSingle; + i, j, j0, j1: Integer; +begin + tmp := NewFloatArray(FSpectrumSize); + for i := 0 to FSpectrumSize-1 do + begin + j0 := Max(0, i - FFreqSmoothingBins); + j1 := Min(FSpectrumSize-1, i + FFreqSmoothingBins); + tmp[i] := 0.0; + //for(j = j0; j <= j1; j++) + for j := j0 to j1-1 do + begin + tmp[i] += Aspec[j]; + end; + tmp[i] := tmp[i] / (j1 - j0 + 1); + end; + + //for(i = 0; i < mSpectrumSize; i++) + for i := 0 to FSpectrumSize-1 do + Aspec[i] := tmp[i]; + + Freemem(Tmp); +end; + +procedure TNoiseRemoval.GetProfile; +var + start, + finish, + i, j: Integer; + min: Single; +begin + // The noise threshold for each frequency is the maximum + // level achieved at that frequency for a minimum of + // mMinSignalBlocks blocks in a row - the max of a min. + + start := FHistoryLen - FMinSignalBlocks; + finish := FHistoryLen; + + + for j := 0 to FSpectrumSize-1 do + begin + min := FSpectrums[start][j]; + for i := start+1 to finish-1 do + if (FSpectrums[i][j] < min) then + min := FSpectrums[i][j]; + + if (min > FNoiseThreshold[j]) then + FNoiseThreshold[j] := min; + end; + + FOutSampleCount += FWindowSize div 2; // what is this for? Not used when we are getting the profile? +end; + +procedure TNoiseRemoval.RemoveNoise; +var + center: Integer; + start, + finish, + i,j : Integer; + min: Single; + out_: Integer; +begin + center := FHistoryLen div 2; + start := center - FMinSignalBlocks div 2; + finish := start + FMinSignalBlocks; + + // Raise the gain for elements in the center of the sliding history + for j := 0 to FSpectrumSize-1 do + begin + min := FSpectrums[start][j]; + //for (i = start+1; i < finish; i++) { + for i := start+1 to finish-1 do + begin + if (FSpectrums[i][j] < min) then + min := FSpectrums[i][j]; + end; + if (min > FSensitivityFactor * FNoiseThreshold[j]) and (FGains[center][j] < 1.0) then + begin + if (FbLeaveNoise) then + FGains[center][j] := 0.0 + else + FGains[center][j] := 1.0; + end + else + begin + if (FbLeaveNoise) then + FGains[center][j] := 1.0; + end; + end; + + // Decay the gain in both directions; + // note that mOneBlockAttackDecay is less than 1.0 + // of linear attenuation per block + for j := 0 to FSpectrumSize-1 do + begin + for i := center+1 to FHistoryLen-1 do + begin + if (FGains[i][j] < FGains[i - 1][j] * FOneBlockAttackDecay) then + FGains[i][j] := FGains[i - 1][j] * FOneBlockAttackDecay; + if (FGains[i][j] < FNoiseAttenFactor) then + FGains[i][j] := FNoiseAttenFactor; + end; + for i := center-1 downto 0 do + begin + if (FGains[i][j] < FGains[i + 1][j] * FOneBlockAttackDecay) then + FGains[i][j] := FGains[i + 1][j] * FOneBlockAttackDecay; + if (FGains[i][j] < FNoiseAttenFactor) then + FGains[i][j] := FNoiseAttenFactor; + end; + end; + + + // Apply frequency smoothing to output gain + out_ := FHistoryLen - 1; // end of the queue + + ApplyFreqSmoothing(FGains[out_]); + + // Apply gain to FFT + //for (j = 0; j < (mSpectrumSize-1); j++) { + for j := 0 to FSpectrumSize-2 do + begin + FFFTBuffer[j*2 ] := FRealFFTs[out_][j] * FGains[out_][j]; + FFFTBuffer[j*2+1] := FImagFFTs[out_][j] * FGains[out_][j]; + end; + // The Fs/2 component is stored as the imaginary part of the DC component + FFFTBuffer[1] := FRealFFTs[out_][FSpectrumSize-1] * FGains[out_][FSpectrumSize-1]; + + // Invert the FFT into the output buffer + FFFT^.InverseRealFFTf(FFFTBuffer); + + // Overlap-add + for j := 0 to FSpectrumSize-2 do + begin + FOutOverlapBuffer[j*2 ] += FFFTBuffer[FFFT^.BitReversed[j] ] * FWindow[j*2 ]; + FOutOverlapBuffer[j*2+1] += FFFTBuffer[FFFT^.BitReversed[j]+1] * FWindow[j*2+1]; + end; + + // Output the first half of the overlap buffer, they're done - + // and then shift the next half over. + + if (FOutSampleCount >= 0) then // ...but not if it's the first half-window + begin + //FOutputTrack->Append((samplePtr)mOutOverlapBuffer, floatSample, mWindowSize / 2); + FWriteProc(Self, FOutOverlapBuffer, FWindowSize div 2); + end; + + + FOutSampleCount += FWindowSize div 2; + //for(j = 0; j < mWindowSize / 2; j++) + for j := 0 to FWindowSize div 2 -1 do + begin + FOutOverlapBuffer[j] := FOutOverlapBuffer[j + (FWindowSize div 2)]; + FOutOverlapBuffer[j + (FWindowSize div 2)] := 0.0; + end +end; + +procedure TNoiseRemoval.RotateHistoryWindows; +var + last: Integer; + i: Integer; + lastSpectrum: PSingle; + lastGain: PSingle; + lastRealFFT: PSingle; + lastImagFFT: PSingle; +begin + last := FHistoryLen - 1; + + // Remember the last window so we can reuse it + lastSpectrum := FSpectrums[last]; + lastGain := FGains[last]; + lastRealFFT := FRealFFTs[last]; + lastImagFFT := FImagFFTs[last]; + + // Rotate each window forward + //for(i = last; i >= 1; i--) { + for i := last downto 1 do + begin + FSpectrums[i] := FSpectrums[i-1]; + FGains[i] := FGains[i-1]; + FRealFFTs[i] := FRealFFTs[i-1]; + FImagFFTs[i] := FImagFFTs[i-1]; + end; + + // Reuse the last buffers as the new first window + FSpectrums[0] := lastSpectrum; + FGains[0] := lastGain; + FRealFFTs[0] := lastRealFFT; + FImagFFTs[0] := lastImagFFT; +end; + +procedure TNoiseRemoval.FinishTrack; +var + empty: PSingle; + i: Integer; +begin + // Keep flushing empty input buffers through the history + // windows until we've output exactly as many samples as + // were input. + // Well, not exactly, but not more than mWindowSize/2 extra samples at the end. + // We'll delete them later in ProcessOne. + empty := NewFloatArray(FWindowSize div 2); + //for(i = 0; i < mWindowSize / 2; i++) + for i := 0 to FWindowSize div 2 -1 do + empty[i] := 0.0; + + while (FOutSampleCount < FInSampleCount) do + ProcessSamples(FWindowSize div 2, empty); + + Freemem(empty); +end; + +procedure TNoiseRemoval.Cleanup; +var + i: Integer; +begin + FFFT^.EndFFT; + + if (FDoProfile) then + ApplyFreqSmoothing(@FNoiseThreshold[0]); + + + for i := 0 to FHistoryLen-1 do + begin + FreeMem(FSpectrums[i]); + FreeMem(FGains[i]); + FreeMem(FRealFFTs[i]); + FreeMem(FImagFFTs[i]); + end; + SetLength(FSpectrums,0); + SetLength(FGains,0); + SetLength(FRealFFTs,0); + SetLength(FImagFFTs,0); + + FreeMem(FFFTBuffer); + FreeMem(FInWaveBuffer); + FreeMem(FWindow); + FreeMem(FOutOverlapBuffer); + + FInited := False; +end; + +function TNoiseRemoval.GetNoiseProfile: TSingleArray; +begin + SetLength(Result, FSpectrumSize); + Move(FNoiseThreshold[0], Result[0], FSpectrumSize); +end; + +procedure TNoiseRemoval.SetAttackDecayTime(AValue: Double); +begin + if FAttackDecayTime=AValue then Exit; + if AValue < 0.0 then AValue := 0; + if AValue > 1.0 then AValue := 1.0; + FAttackDecayTime:=AValue; +end; + +procedure TNoiseRemoval.SetFreqSmoothingHz(AValue: Double); +begin + if FFreqSmoothingHz=AValue then Exit; + if AValue<0 then AValue:=0; + if AValue>1000 then AValue := 1000; + FFreqSmoothingHz:=AValue; +end; + +procedure TNoiseRemoval.SetGain(AValue: Double); +begin + if FNoiseGain=AValue then Exit; + if AValue > 0 then AValue:=0; + if AValue < -48 then AValue := -48; + + FNoiseGain:=AValue; +end; + +procedure TNoiseRemoval.SetNoiseProfile(AValue: TSingleArray); +begin + SetLength(FNoiseThreshold, FSpectrumSize); + Move(AValue[0], FNoiseThreshold[0], FSpectrumSize); + FHasProfile:=True; + + FDoProfile:=False; + Cleanup; // set after FDoProfile so the profile is not processed. + +end; + +procedure TNoiseRemoval.SetSensitivity(AValue: Double); +begin + if FSensitivity=AValue then Exit; + if AValue < -20.0 then AValue:=-20.0; + if AValue > 20.0 then AValue := 20.0; + FSensitivity:=AValue; +end; + +constructor TNoiseRemoval.Create; +begin + FWindowSize:=2048; + FSpectrumSize:= 1 + FWindowSize div 2; + + // loaded prefs + FSensitivity := 0.0; + FNoiseGain := -24.0; + FFreqSmoothingHz := 150.0; + FAttackDecayTime:= 0.15; + FbLeaveNoise:=False; + + FMinSignalTime := 0.05; + FHasProfile := False; + FDoProfile := True; + + SetLength(FNoiseThreshold, FSpectrumSize); + +end; + +destructor TNoiseRemoval.Destroy; +begin + SetLength(FNoiseThreshold, 0); + inherited Destroy; +end; + +function TNoiseRemoval.Init(ASampleRate: Integer): Boolean; +begin + FSampleRate:=ASampleRate; + Initialize; + FInited:=True; + Result := True; + Reset; +end; + +function TNoiseRemoval.Process(AData: PSingle; ASampleCount: Integer; + AGetNoiseProfile: Boolean; AMoreComing: Boolean = False): Boolean; +begin + if not FInited then + Raise Exception.Create('TNoiseRemoval is not Inited'); + + if not AGetNoiseProfile and not FHasProfile then + raise Exception.Create('Tried to remove noise without profile.'); + + FDoProfile:=AGetNoiseProfile; + + if FDoProfile and (FTotalRead = 0) then + begin + Initialize; + reset; + end; + + Inc(FTotalRead, ASampleCount); + ProcessSamples(ASampleCount, AData); + Result := True; + + if AMoreComing then + Exit; + + if {AGetNoiseProfile or }FDoProfile then + begin + FHasProfile:=True; + Cleanup; // triggers the data in FNoiseThreshold to be processed + + // must be set after Cleanup() is called + //FDoProfile:=False; + + //Initialize; + FTotalRead:=0; + end; + + FHasProfile:=True; + FDoProfile := False; + +end; + +procedure TNoiseRemoval.Flush; +begin + if not FInited then + Exit; + + FinishTrack; + Cleanup; // Sets FInited to False +end; + +{ TFFT } + +function TFFT.InitializeFFT(FFTLen: Integer): PFFT; +var + i: Integer; + temp: Integer; + mask: Integer; +begin + Result := New(PFFT); + if Result = nil then + raise EOutOfMemory.Create('Error allocating memory for FFT'); + + + with Result^ do begin + + {* + * FFT size is only half the number of data points + * The full FFT output can be reconstructed from this FFT's output. + * (This optimization can be made since the data is real.) + *} + Points := FFTLen div 2; + + SetLength(FPCSinTable, 2*Points); + SinTable:=@FPCSinTable[0]; + + BitReversed := Getmemory(Points*SizeOf(Integer)); + if BitReversed = nil then + raise EOutOfMemory.Create('Error allocating memory for BitReversed.'); + + for i := 0 to Points-1 do + begin + temp:=0; + mask := Points div 2; + while mask > 0 do + begin + //for(mask=h->Points/2;mask>0;mask >>= 1) + // temp=(temp >> 1) + (i&mask ? h->Points : 0); + temp := (temp shr 1); + if (i and mask) <> 0 then + temp := temp + Points; + //else temp := temp + 0; // why would you do that? + mask := mask shr 1; + end; + + BitReversed[i]:=temp; + end; + + for i := 0 to Points-1 do + begin + SinTable[BitReversed[i] ]:= -sin(2*PI*i/(2*Points)); + SinTable[BitReversed[i]+1]:= -cos(2*PI*i/(2*Points)); + end; + +{$ifdef EXPERIMENTAL_EQ_SSE_THREADED} + // new SSE FFT routines work on live data + for(i=0;i<32;i++) + if((1<<i)&fftlen) + h->pow2Bits=i; +{$endif} + + end; // with Result^ + + +end; + +procedure TFFT.EndFFT; +begin + if Points>0 then + begin + Freemem(BitReversed); + SetLength(FPCSinTable, 0); + SinTable:=nil; + end; + + Dispose(PFFT(@Self)); +end; + +function TFFT.GetFFT(FFTLen: Integer): PFFT; +var + h: Integer = 0; + n: Integer; +begin + n := fftlen div 2; + + while (h<MAX_HFFT) and (FFTArray[h] <> nil) and (n <> FFTArray[h]^.Points) do + begin + if (h<MAX_HFFT) then + begin + if(FFTArray[h] = nil) then + begin + FFTArray[h] := InitializeFFT(fftlen); + FFTLockCount[h] := 0; + end; + Inc(FFTLockCount[h]); + Exit(FFTArray[h]); + end + else begin + // All buffers used, so fall back to allocating a new set of tables + Exit(InitializeFFT(fftlen)); + end; + Inc(h); + end; +end; + +procedure TFFT.ReleaseFFT; +var + h: Integer = 0; +begin + + while (h<MAX_HFFT) and (FFTArray[h] <> @Self) do + begin + if(h<MAX_HFFT) then + begin + Dec(FFTLockCount[h]); + end + else + begin + EndFFT; + end; + Inc(h); + end; +end; + +procedure TFFT.InverseRealFFTf(buffer: PSingle); +var + A, B: PSingle; + sptr: PSingle; + endptr1, endptr2: PSingle; + br1: PInteger; + HRplus,HRminus,HIplus,HIminus: Single; + v1,v2,sin,cos: Single; + ButterfliesPerGroup: Integer; +begin + + ButterfliesPerGroup:=Points div 2; + + //* Massage input to get the input for a real output sequence. */ + A:=@buffer[2]; + B:=@buffer[Points*2-2]; + br1:=@BitReversed[1]; + while(A<B) do + begin + sin:=SinTable[br1^]; + cos:=SinTable[br1[1]]; + //HRplus = (HRminus = *A - *B ) + (*B * 2); + HRminus:=A^-B^; + HRplus:=HRminus+ (B^ *2); + + //HIplus = (HIminus = *(A+1) - *(B+1)) + (*(B+1) * 2); + HIminus:=A[1]-B[1]; + HIplus:=HIminus+(B[1] *2); + + v1 := (sin*HRminus + cos*HIplus); + v2 := (cos*HRminus - sin*HIplus); + A^ := (HRplus + v1) * single(0.5); + B^ := A^ - v1; + A[1] := (HIminus - v2) * single(0.5); + B[1] := A[1] - HIminus; + + A+=2; + B-=2; + Inc(br1); + end; + //* Handle center bin (just need conjugate) */ + A[1] :=-A[1]; + {* Handle DC bin separately - this ignores any Fs/2 component + buffer[1]=buffer[0]=buffer[0]/2;*} + //* Handle DC and Fs/2 bins specially */ + //* The DC bin is passed in as the real part of the DC complex value */ + //* The Fs/2 bin is passed in as the imaginary part of the DC complex value */ + //* (v1+v2) = buffer[0] == the DC component */ + //* (v1-v2) = buffer[1] == the Fs/2 component */ + v1:=0.5*(buffer[0]+buffer[1]); + v2:=0.5*(buffer[0]-buffer[1]); + buffer[0]:=v1; + buffer[1]:=v2; + + {* + * Butterfly: + * Ain-----Aout + * \ / + * / \ + * Bin-----Bout + *} + + endptr1:=@buffer[Points*2]; + + while(ButterfliesPerGroup>0) do + begin + A:=buffer; + B:=@buffer[ButterfliesPerGroup*2]; + sptr:=@SinTable[0]; + + while(A<endptr1) do + begin + sin:=sptr^; Inc(sptr); // *(sptr++); + cos:=sptr^; Inc(sptr); // *(sptr++); + endptr2:=B; + while(A<endptr2) do + begin + v1:=B^*cos - B[1]*sin; + v2:=B^*sin + B[1]*cos; + B^ := (A^+v1)*Single(0.5); + A^ := B^ - v1; Inc(A); Inc(B); //*(A++)=*(B++)-v1; + B^ := (A^ + v2)* Single(0.5); //*B=(*A+v2)*(fft_type)0.5; + A^ := B^ - v2; Inc(A); Inc(B); //*(A++)=*(B++)-v2; + end; + A:=B; + B := @B[ButterfliesPerGroup*2]; + end; + ButterfliesPerGroup := ButterfliesPerGroup shr 1; + end; +end; + +procedure TFFT.CleanupFFT; +var + h: Integer; +begin + + for h :=0 to MAX_HFFT-1do begin + if((FFTLockCount[h] <= 0) and (FFTArray[h] <> nil)) then + begin + FFTArray[h]^.EndFFT; + FFTArray[h] := nil; + end; + end; +end; + +procedure TFFT.RealFFTf(buffer: PSingle); +var + A, B: PSingle; + sptr: PSingle; + endptr1, endptr2: PSingle; + br1, br2: PInteger; + HRplus,HRminus,HIplus,HIminus: Single; + v1,v2,sin_,cos_: Single; + ButterfliesPerGroup: Integer; +begin + ButterfliesPerGroup:=Points div 2; + + {* + * Butterfly: + * Ain-----Aout + * \ / + * / \ + * Bin-----Bout + *} + + endptr1:=buffer+Points*2; + + while(ButterfliesPerGroup>0) do + begin + A:=buffer; + B:=buffer+ButterfliesPerGroup*2; + sptr:=@SinTable[0]; + + while(A<endptr1) do + begin + sin_:=sptr^; + cos_ := sptr[1]; + endptr2:=B; + while(A<endptr2) do + begin + v1 := B^ * cos_ + B[1] * sin_; //v1=*B*cos + *(B+1)*sin; + v2 := B^ * sin_ - B[1] * cos_; //v2=*B*sin - *(B+1)*cos; + B^ := A^+v1; //*B=(*A+v1); + A^ := B^-2*v1; Inc(A); Inc(B); //*(A++)=*(B++)-2*v1; + + B^ := A^-v2; //*B=(*A-v2); + A^ := B^+2*v2; Inc(A); Inc(B); //*(A++)=*(B++)+2*v2; + end; + A:=B; + B:=B+ButterfliesPerGroup*2; + sptr:=sptr+2; + end; + + ButterfliesPerGroup := ButterfliesPerGroup shr 1; + end; + + //* Massage output to get the output for a real input sequence. */ + br1:=@BitReversed[1]; // is this wrong? Should be @BitReversed[0] ; ? + br2:=@BitReversed[Points-1]; + + while(br1<br2) do + begin + sin_:=SinTable[br1[0]]; + cos_:=SinTable[br1[1]]; + A:=@buffer[br1^]; + B:=@buffer[br2^]; + //HRplus = (HRminus = *A - *B ) + (*B * 2); + HRminus := A^ - B^; + HRplus := HRminus + (B^ * 2); + + //HIplus = (HIminus = *(A+1) - *(B+1)) + (*(B+1) * 2); + HIminus := A[1] - B[1]; + HIplus := HIminus + (B[1] * 2); + + v1 := (sin_*HRminus - cos_*HIplus); + v2 := (cos_*HRminus + sin_*HIplus); + A^ := (HRplus + v1) * single(0.5); + B^ := A^ - v1; + A[1] := (HIminus + v2) * single(0.5); + B[1] := A[1] - HIminus; + + Inc(br1); + Dec(br2); + end; + //* Handle the center bin (just need a conjugate) */ + A:=buffer+br1[1]; + A^ := -A^; + {* Handle DC bin separately - and ignore the Fs/2 bin + buffer[0]+=buffer[1]; + buffer[1]=(fft_type)0;*} + ///* Handle DC and Fs/2 bins separately */ + ///* Put the Fs/2 value into the imaginary part of the DC bin */ + v1:=buffer[0]-buffer[1]; + buffer[0]+=buffer[1]; + buffer[1]:=v1; + +end; + +procedure TFFT.ReorderToTime(Buffer: PSingle; TimeOut: PSingle); +var + i: Integer; +begin + // Copy the data into the real outputs + //for(int i=0;i<hFFT->Points;i++) { + for i := 0 to Points-1 do + begin + TimeOut[i*2 ]:=buffer[BitReversed[i] ]; + TimeOut[i*2+1]:=buffer[BitReversed[i]+1]; + end; +end; + +procedure TFFT.ReorderToFreq(Buffer: PSingle; RealOut: PSingle; ImagOut: PSingle + ); +var + i: Integer; +begin + // Copy the data into the real and imaginary outputs + //for(int i=1;i<hFFT->Points;i++) + for i := 1 to Points-1 do + begin + + RealOut[i]:=buffer[BitReversed[i] ]; + ImagOut[i]:=buffer[BitReversed[i]+1]; + end; + RealOut[0] := buffer[0]; // DC component + ImagOut[0] := 0; + RealOut[Points] := buffer[1]; // Fs/2 component + ImagOut[Points] := 0; +end; + +initialization + FillChar(FFTArray, SizeOf(FFTArray), 0); + FillChar(FFTLockCount, SizeOf(FFTLockCount), 0); + +end. + diff --git a/UOS/src/uos_dsp_utils.pas b/UOS/src/uos_dsp_utils.pas new file mode 100644 index 0000000..b861117 --- /dev/null +++ b/UOS/src/uos_dsp_utils.pas @@ -0,0 +1,328 @@ +{This unit is part of United Openlibraries of Sound (uos)} +{ + This unit uses part of Pascal Audio IO package. + (paio_channelhelper, pa_ringbuffer, pa_utils) + Copyright (c) 2016 by Andrew Haines. + + Fred van Stappen fiens@hotmail.com +} + +unit uos_dsp_utils; + +{$mode objfpc}{$H+} +{$interfaces corba} + +interface + +uses + Classes, SysUtils; + +const + AUDIO_BUFFER_SIZE = 8192; + AUDIO_BUFFER_FLOAT_SAMPLES = AUDIO_BUFFER_SIZE div 4; + +type + PPSingle = ^PSingle; + TSingleArray = array of Single; + TChannelArray = array of TSingleArray; + + { TRingBuffer } + + TRingBuffer = class + private + FMem: PByte; + FWritePos: Integer; + FReadPos: Integer; + FUsedSpace: Integer; + FTotalSpace: Integer; + function GetFreeSpace: Integer; + public + constructor Create(ASize: Integer); + destructor Destroy; override; + function Write(const ASource; ASize: Integer): Integer; + function Read(var ADest; ASize: Integer): Integer; + property FreeSpace: Integer read GetFreeSpace; + property UsedSpace: Integer read FUsedSpace; + + end; + +type + IPAIODataIOInterface = interface + ['IPAIODataIOInterface'] + procedure WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); + end; + + { TPAIOChannelHelper } + + TPAIOChannelHelper = class(IPAIODataIOInterface) + private + FOutputs: TList; + FTarget: IPAIODataIOInterface; // where we will send plexed data. + FBuffers: TChannelArray; + FPos: array of Integer; + // called by the individual channel objects. + procedure WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); + procedure AllocateBuffers; + procedure SendDataToTarget; + public + constructor Create(APlexedTarget: IPAIODataIOInterface); + destructor Destroy; override; + property Outputs: TList read FOutputs;// of IPAIOSplitterJoinerInterface. Each is a channel in order. + procedure Write(AData: PSingle; ASamples: Integer); // this expects interleaved data. + end; + +function NewChannelArray(AChannels: Integer; ASamplesPerChannel: Integer): TChannelArray; +function SplitChannels(AData: PSingle; ASamples: Integer; AChannels: Integer): TChannelArray; +function JoinChannels(AChannelData: TChannelArray; ASamples: Integer = -1): TSingleArray; +function JoinChannels(AChannelData: PPSingle; AChannels: Integer; ASamples: Integer): TSingleArray; + +function Min(A,B: Integer): Integer; +function Max(A,B: Integer): Integer; + +implementation + +{ TPAIOChannelHelper } + +procedure TPAIOChannelHelper.WriteDataIO(ASender: IPAIODataIOInterface; AData: PSingle; ASamples: Integer); +var + BufIndex: Integer; + BufSize, WCount: Integer; + Written: Integer = 0; +begin + BufIndex := FOutputs.IndexOf(Pointer(ASender)); + + if BufIndex = -1 then + raise Exception.Create('Trying to write data from an unknown instance'); + + AllocateBuffers; + + BufSize := Length(FBuffers[0]); + + While ASamples > 0 do + begin + WCount := Min(BufSize-FPos[BufIndex], ASamples); + Move(AData[Written], FBuffers[BufIndex][0], WCount*SizeOf(Single)); + Inc(Written, WCount); + Dec(ASamples, WCount); + Inc(FPos[BufIndex], WCount); + + if BufIndex = High(FBuffers) then + SendDataToTarget; + end; +end; + +procedure TPAIOChannelHelper.AllocateBuffers; +begin + if Length(FBuffers) <> FOutputs.Count then + begin + SetLength(FBuffers, 0); + FBuffers := NewChannelArray(FOutputs.Count, AUDIO_BUFFER_SIZE*2); + SetLength(FPos, FOutputs.Count); + end; +end; + +procedure TPAIOChannelHelper.SendDataToTarget; +var + Plexed: TSingleArray; + HighestCount: Integer = 0; + i: Integer; +begin + for i := 0 to High(FPos) do + if FPos[i] > HighestCount then + HighestCount:=FPos[i]; + Plexed := JoinChannels(FBuffers, HighestCount); + + FTarget.WriteDataIO(Self, @Plexed[0], Length(Plexed)); + + for i := 0 to High(FPos) do + Dec(FPos[i], HighestCount); +end; + +constructor TPAIOChannelHelper.Create(APlexedTarget: IPAIODataIOInterface); +begin + FOutputs := TList.Create; + FTarget := APlexedTarget; +end; + +destructor TPAIOChannelHelper.Destroy; +begin + FOutputs.Free; + inherited Destroy; +end; + +procedure TPAIOChannelHelper.Write(AData: PSingle; ASamples: Integer); +var + Channels: TChannelArray; + i: Integer; + Pos: Integer = 0; + WCount: Integer; +begin + AllocateBuffers; + Channels := SplitChannels(AData, ASamples, Outputs.Count); + while ASamples > 0 do + begin + WCount := Min(1024, ASamples div Outputs.Count); + for i := 0 to Outputs.Count-1 do + begin + IPAIODataIOInterface(Outputs.Items[i]).WriteDataIO(Self, @Channels[i][Pos], WCount); + end; + Dec(ASamples, WCount * Outputs.Count); + Inc(Pos, WCount); + end; +end; + +{ TRingBuffer } + +function TRingBuffer.GetFreeSpace: Integer; +begin + Result := FTotalSpace-FUsedSpace; +end; + +constructor TRingBuffer.Create(ASize: Integer); +begin + FMem:=Getmem(ASize); + FTotalSpace:=ASize; +end; + +destructor TRingBuffer.Destroy; +begin + Freemem(FMem); + inherited Destroy; +end; + +function TRingBuffer.Write(const ASource; ASize: Integer): Integer; +var + EOB: Integer; // end of buffer + WSize: Integer; + WTotal: Integer = 0; +begin + if FUsedSpace = 0 then + begin + // give the best chance of not splitting the data at buffer end. + FWritePos:=0; + FReadPos:=0; + end; + if ASize > FreeSpace then + raise Exception.Create('Ring buffer overflow'); + Result := ASize; + Inc(FUsedSpace, ASize); + while ASize > 0 do + begin + EOB := FTotalSpace - FWritePos; + WSize := Min(ASize, EOB); + Move(PByte(@ASource)[WTotal], FMem[FWritePos], WSize); + Inc(FWritePos, WSize); + Dec(ASize, WSize); + + if FWritePos >= FTotalSpace then + FWritePos:= 0; + end; +end; + +function TRingBuffer.Read(var ADest; ASize: Integer): Integer; +var + EOB: Integer; // end of buffer + RSize: Integer; + RTotal: Integer = 0; +begin + if ASize > UsedSpace then + raise Exception.Create('Ring buffer underflow'); + ASize := Min(ASize, UsedSpace); + Result := ASize; + + Dec(FUsedSpace, ASize); + while ASize > 0 do + begin + EOB := FTotalSpace - FReadPos; + RSize := Min(EOB, ASize); + Move(FMem[FReadPos], PByte(@ADest)[RTotal],RSize); + Dec(ASize, RSize); + Inc(FReadPos, RSize); + if FReadPos >= FTotalSpace then + FReadPos:=0; + end; +end; + +function Min(A,B: Integer): Integer; +begin + if A < B then Exit(A); + Result := B; +end; + +function Max(A,B: Integer): Integer; +begin + if A > B then Exit(A); + Result := B; +end; + +function NewChannelArray(AChannels: Integer; ASamplesPerChannel: Integer): TChannelArray; +var + i: Integer; +begin + SetLength(Result, AChannels); + for i := 0 to AChannels-1 do + SetLength(Result[i], ASamplesPerChannel); +end; + +// Samples is total samples not samples per channel. +// So Samples = 1000 if 2 Channels have 500 each +function SplitChannels(AData: PSingle; ASamples: Integer; AChannels: Integer): TChannelArray; +var + SamplesPerChannel: Integer; + i, j: Integer; +begin + SamplesPerChannel:=ASamples div AChannels; + //SetLength(Result, AChannels); + Result := NewChannelArray(AChannels, SamplesPerChannel); + for i := 0 to AChannels-1 do + begin + //SetLength(Result[i], SamplesPerChannel); + for j := 0 to SamplesPerChannel-1 do + begin + Result[i][j] := AData[j*AChannels+i]; + end; + end; +end; + +function JoinChannels(AChannelData: TChannelArray; ASamples: Integer): TSingleArray; +var + i: Integer; + j: Integer; + Samples: Integer; +begin + if Length(AChannelData) > 0 then + begin + if ASamples <> -1 then + Samples := ASamples + else + Samples := Length(AChannelData[0]); + + SetLength(Result, Length(AChannelData) * Samples); + for i := 0 to High(AChannelData) do + for j := 0 to Samples-1 do + Result[j*Length(AChannelData)+i] := AChannelData[i][j]; + end + else + SetLength(Result, 0); +end; + +function JoinChannels(AChannelData: PPSingle; AChannels: Integer; + ASamples: Integer): TSingleArray; +var + i: Integer; + j: Integer; +begin + if ASamples > 0 then + begin + SetLength(Result, AChannels * ASamples); + for i := 0 to AChannels-1 do + for j := 0 to ASamples-1 do + Result[j*AChannels+i] := AChannelData[i][j]; + end + else + SetLength(Result, 0); + +end; + +end. + diff --git a/UOS/src/uos_fdkaacdecoder.pas b/UOS/src/uos_fdkaacdecoder.pas new file mode 100644 index 0000000..e39693f --- /dev/null +++ b/UOS/src/uos_fdkaacdecoder.pas @@ -0,0 +1,1495 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Pascal Wrapper + Dynamic loading of fdk_aacdecoder library. + Load library with ad_load() and release with ad_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com / 2024} + +unit uos_fdkaacdecoder; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} +{$MINENUMSIZE 4} + +interface + +uses + dynlibs, + SysUtils; + +type + FDK_MODULE_ID = ( + FDK_NONE = 0, + FDK_TOOLS = 1, + FDK_SYSLIB = 2, + FDK_AACDEC = 3, + FDK_AACENC = 4, + FDK_SBRDEC = 5, + FDK_SBRENC = 6, + FDK_TPDEC = 7, + FDK_TPENC = 8, + FDK_MPSDEC = 9, + FDK_MPEGFILEREAD = 10, + FDK_MPEGFILEWRITE = 11, + FDK_PCMDMX = 31, + FDK_MPSENC = 34, + FDK_TDLIMIT = 35, + FDK_UNIDRCDEC = 38, + + FDK_MODULE_LAST + ); + +type +(** + * Library information. + *) + PPLIB_INFO = ^PLIB_INFO; + PLIB_INFO = ^LIB_INFO; + + LIB_INFO = record + title: MarshaledAString; + build_date: MarshaledAString; + build_time: MarshaledAString; + module_id: FDK_MODULE_ID; + version: integer; + flags: cardinal; + versionStr: array[0..31] of AnsiChar; + end; + +const + _PU = ''; + {$IF Defined(MSWINDOWS)} + {$IFDEF CPUX64} + libfdk_aac = 'libfdk-aac-2.dll'; + {$ENDIF} + {$IFDEF CPUX86} + libfdk_aac = 'libfdk-aac-2.dll'; + {$ENDIF} + {$ELSEIF Defined(DARWIN) or Defined(MACOS)} + libfdk_aac = '@executable_path/../Frameworks/libfdk-aac-2.dylib'; + _PU = '_' + {$ELSEIF Defined(UNIX)} + libfdk_aac = 'libfdk-aac-2.so'; + {$IFEND} + +type + (** + * File format identifiers. + *) + FILE_FORMAT = ( + FF_UNKNOWN = -1, (**< Unknown format. *) + FF_RAW = 0, (**< No container, bit stream data conveyed "as is". *) + + FF_MP4_3GPP = 3, (**< 3GPP file format. *) + FF_MP4_MP4F = 4, (**< MPEG-4 File format. *) + + FF_RAWPACKETS = 5 (**< Proprietary raw packet file. *) + ); + + (** + * Transport type identifiers. + *) + TRANSPORT_TYPE = ( + TT_UNKNOWN = -1, (**< Unknown format. *) + TT_MP4_RAW = 0, (**< "as is" access units (packet based since there is + obviously no sync layer) *) + TT_MP4_ADIF = 1, (**< ADIF bitstream format. *) + TT_MP4_ADTS = 2, (**< ADTS bitstream format. *) + + TT_MP4_LATM_MCP1 = 6, (**< Audio Mux Elements with muxConfigPresent = 1 *) + TT_MP4_LATM_MCP0 = 7, (**< Audio Mux Elements with muxConfigPresent = 0, out + of band StreamMuxConfig *) + + TT_MP4_LOAS = 10, (**< Audio Sync Stream. *) + + TT_DRM = 12 (**< Digital Radio Mondial (DRM30/DRM+) bitstream format. *) + ); + + //TT_IS_PACKET(x) \ + // (((x) == TT_MP4_RAW) || ((x) == TT_DRM) || ((x) == TT_MP4_LATM_MCP0) || \ + // ((x) == TT_MP4_LATM_MCP1)) +function TT_IS_PACKET(x: TRANSPORT_TYPE): Boolean; + +type + (** + * Audio Object Type definitions. + *) + AUDIO_OBJECT_TYPE = ( + AOT_NONE = -1, + AOT_NULL_OBJECT = 0, + AOT_AAC_MAIN = 1, (**< Main profile *) + AOT_AAC_LC = 2, (**< Low Complexity object *) + AOT_AAC_SSR = 3, + AOT_AAC_LTP = 4, + AOT_SBR = 5, + AOT_AAC_SCAL = 6, + AOT_TWIN_VQ = 7, + AOT_CELP = 8, + AOT_HVXC = 9, + AOT_RSVD_10 = 10, (**< (reserved) *) + AOT_RSVD_11 = 11, (**< (reserved) *) + AOT_TTSI = 12, (**< TTSI Object *) + AOT_MAIN_SYNTH = 13, (**< Main Synthetic object *) + AOT_WAV_TAB_SYNTH = 14, (**< Wavetable Synthesis object *) + AOT_GEN_MIDI = 15, (**< General MIDI object *) + AOT_ALG_SYNTH_AUD_FX = 16, (**< Algorithmic Synthesis and Audio FX object *) + AOT_ER_AAC_LC = 17, (**< Error Resilient(ER) AAC Low Complexity *) + AOT_RSVD_18 = 18, (**< (reserved) *) + AOT_ER_AAC_LTP = 19, (**< Error Resilient(ER) AAC LTP object *) + AOT_ER_AAC_SCAL = 20, (**< Error Resilient(ER) AAC Scalable object *) + AOT_ER_TWIN_VQ = 21, (**< Error Resilient(ER) TwinVQ object *) + AOT_ER_BSAC = 22, (**< Error Resilient(ER) BSAC object *) + AOT_ER_AAC_LD = 23, (**< Error Resilient(ER) AAC LowDelay object *) + AOT_ER_CELP = 24, (**< Error Resilient(ER) CELP object *) + AOT_ER_HVXC = 25, (**< Error Resilient(ER) HVXC object *) + AOT_ER_HILN = 26, (**< Error Resilient(ER) HILN object *) + AOT_ER_PARA = 27, (**< Error Resilient(ER) Parametric object *) + AOT_RSVD_28 = 28, (**< might become SSC *) + AOT_PS = 29, (**< PS, Parametric Stereo (includes SBR) *) + AOT_MPEGS = 30, (**< MPEG Surround *) + + AOT_ESCAPE = 31, (**< Signal AOT uses more than 5 bits *) + + AOT_MP3ONMP4_L1 = 32, (**< MPEG-Layer1 in mp4 *) + AOT_MP3ONMP4_L2 = 33, (**< MPEG-Layer2 in mp4 *) + AOT_MP3ONMP4_L3 = 34, (**< MPEG-Layer3 in mp4 *) + AOT_RSVD_35 = 35, (**< might become DST *) + AOT_RSVD_36 = 36, (**< might become ALS *) + AOT_AAC_SLS = 37, (**< AAC + SLS *) + AOT_SLS = 38, (**< SLS *) + AOT_ER_AAC_ELD = 39, (**< AAC Enhanced Low Delay *) + + AOT_USAC = 42, (**< USAC *) + AOT_SAOC = 43, (**< SAOC *) + AOT_LD_MPEGS = 44, (**< Low Delay MPEG Surround *) + + (* Pseudo AOTs *) + AOT_MP2_AAC_LC = 129, (**< Virtual AOT MP2 Low Complexity profile *) + AOT_MP2_SBR = 132, (**< Virtual AOT MP2 Low Complexity Profile with SBR *) + + AOT_DRM_AAC = 143, (**< Virtual AOT for DRM (ER-AAC-SCAL without SBR) *) + AOT_DRM_SBR = 144, (**< Virtual AOT for DRM (ER-AAC-SCAL with SBR) *) + AOT_DRM_MPEG_PS = + 145, (**< Virtual AOT for DRM (ER-AAC-SCAL with SBR and MPEG-PS) *) + AOT_DRM_SURROUND = + 146, (**< Virtual AOT for DRM Surround (ER-AAC-SCAL (+SBR) +MPS) *) + AOT_DRM_USAC = 147 (**< Virtual AOT for DRM with USAC *) + ); + + //CAN_DO_PS(aot) \ + // ((aot) == AOT_AAC_LC || (aot) == AOT_SBR || (aot) == AOT_PS || \ + // (aot) == AOT_ER_BSAC || (aot) == AOT_DRM_AAC) +function CAN_DO_PS(aot: AUDIO_OBJECT_TYPE): Boolean; + + //IS_USAC(aot) ((aot) == AOT_USAC) +function IS_USAC(aot: AUDIO_OBJECT_TYPE): Boolean; + + //IS_LOWDELAY(aot) ((aot) == AOT_ER_AAC_LD || (aot) == AOT_ER_AAC_ELD) +function IS_LOWDELAY(aot: AUDIO_OBJECT_TYPE): Boolean; + +type + (** Channel Mode ( 1-7 equals MPEG channel configurations, others are + * arbitrary). *) + CHANNEL_MODE = ( + MODE_INVALID = -1, + MODE_UNKNOWN = 0, + MODE_1 = 1, (**< C *) + MODE_2 = 2, (**< L+R *) + MODE_1_2 = 3, (**< C, L+R *) + MODE_1_2_1 = 4, (**< C, L+R, Rear *) + MODE_1_2_2 = 5, (**< C, L+R, LS+RS *) + MODE_1_2_2_1 = 6, (**< C, L+R, LS+RS, LFE *) + MODE_1_2_2_2_1 = 7, (**< C, LC+RC, L+R, LS+RS, LFE *) + + MODE_6_1 = 11, (**< C, L+R, LS+RS, Crear, LFE *) + MODE_7_1_BACK = 12, (**< C, L+R, LS+RS, Lrear+Rrear, LFE *) + MODE_7_1_TOP_FRONT = 14, (**< C, L+R, LS+RS, LFE, Ltop+Rtop *) + + MODE_7_1_REAR_SURROUND = 33, (**< C, L+R, LS+RS, Lrear+Rrear, LFE *) + MODE_7_1_FRONT_CENTER = 34, (**< C, LC+RC, L+R, LS+RS, LFE *) + + MODE_212 = 128 (**< 212 configuration, used in ELDv2 *) + ); + + (** + * Speaker description tags. + * Do not change the enumeration values unless it keeps the following + * segmentation: + * - Bit 0-3: Horizontal postion (0: none, 1: front, 2: side, 3: back, 4: lfe) + * - Bit 4-7: Vertical position (0: normal, 1: top, 2: bottom) + *) + AUDIO_CHANNEL_TYPE = ( + ACT_NONE = $00, + ACT_FRONT = $01, (*!< Front speaker position (at normal height) *) + ACT_SIDE = $02, (*!< Side speaker position (at normal height) *) + ACT_BACK = $03, (*!< Back speaker position (at normal height) *) + ACT_LFE = $04, (*!< Low frequency effect speaker postion (front) *) + + ACT_TOP = $10, (*!< Top speaker area (for combination with speaker positions) *) + ACT_FRONT_TOP = $11, (*!< Top front speaker = (ACT_FRONT|ACT_TOP) *) + ACT_SIDE_TOP = $12, (*!< Top side speaker = (ACT_SIDE |ACT_TOP) *) + ACT_BACK_TOP = $13, (*!< Top back speaker = (ACT_BACK |ACT_TOP) *) + + ACT_BOTTOM = $20, (*!< Bottom speaker area (for combination with speaker positions) *) + ACT_FRONT_BOTTOM = $21, (*!< Bottom front speaker = (ACT_FRONT|ACT_BOTTOM) *) + ACT_SIDE_BOTTOM = $22, (*!< Bottom side speaker = (ACT_SIDE |ACT_BOTTOM) *) + ACT_BACK_BOTTOM = $23 (*!< Bottom back speaker = (ACT_BACK |ACT_BOTTOM) *) + ); + + SBR_PS_SIGNALING = ( + SIG_UNKNOWN = -1, + SIG_IMPLICIT = 0, + SIG_EXPLICIT_BW_COMPATIBLE = 1, + SIG_EXPLICIT_HIERARCHICAL = 2 + ); + +const + (** + * Audio Codec flags. + *) + AC_ER_VCB11 = $000001; (*!< aacSectionDataResilienceFlag flag (from ASC): 1 means use + virtual codebooks *) + AC_ER_RVLC = $000002; (*!< aacSpectralDataResilienceFlag flag (from ASC): 1 means use + huffman codeword reordering *) + AC_ER_HCR = $000004; (*!< aacSectionDataResilienceFlag flag (from ASC): 1 means use + virtual codebooks *) + AC_SCALABLE = $000008; (*!< AAC Scalable*) + AC_ELD = $000010; (*!< AAC-ELD *) + AC_LD = $000020; (*!< AAC-LD *) + AC_ER = $000040; (*!< ER syntax *) + AC_BSAC = $000080; (*!< BSAC *) + AC_USAC = $000100; (*!< USAC *) + AC_RSV603DA = $000200; (*!< RSVD60 3D audio *) + AC_HDAAC = $000400; (*!< HD-AAC *) + AC_RSVD50 = $004000; (*!< Rsvd50 *) + AC_SBR_PRESENT = $008000; (*!< SBR present flag (from ASC) *) + AC_SBRCRC = $010000; (*!< SBR CRC present flag. Only relevant for AAC-ELD for now. *) + AC_PS_PRESENT = $020000; (*!< PS present flag (from ASC or implicit) *) + AC_MPS_PRESENT = $040000; (*!< MPS present flag (from ASC or implicit) + *) + AC_DRM = $080000; (*!< DRM bit stream syntax *) + AC_INDEP = $100000; (*!< Independency flag *) + AC_MPEGD_RES = $200000; (*!< MPEG-D residual individual channel data. *) + AC_SAOC_PRESENT = $400000; (*!< SAOC Present Flag *) + AC_DAB = $800000; (*!< DAB bit stream syntax *) + AC_ELD_DOWNSCALE = $1000000; (*!< ELD Downscaled playout *) + AC_LD_MPS = $2000000; (*!< Low Delay MPS. *) + AC_DRC_PRESENT = $4000000; (*!< Dynamic Range Control (DRC) data found. + *) + AC_USAC_SCFGI3 = $8000000; (*!< USAC flag: If stereoConfigIndex is 3 the flag is set. *) + (** + * Audio Codec flags (reconfiguration). + *) + AC_CM_DET_CFG_CHANGE = $000001; (*!< Config mode signalizes the callback to work in config change + detection mode *) + AC_CM_ALLOC_MEM = $000002; (*!< Config mode signalizes the callback to work in memory + allocation mode *) + + (** + * Audio Codec flags (element specific). + *) + AC_EL_USAC_TW = $000001; (*!< USAC time warped filter bank is active *) + AC_EL_USAC_NOISE = $000002; (*!< USAC noise filling is active *) + AC_EL_USAC_ITES = $000004; (*!< USAC SBR inter-TES tool is active *) + AC_EL_USAC_PVC = $000008; (*!< USAC SBR predictive vector coding tool is active *) + AC_EL_USAC_MPS212 = $000010; (*!< USAC MPS212 tool is active *) + AC_EL_USAC_LFE = $000020; (*!< USAC element is LFE *) + AC_EL_USAC_CP_POSSIBLE = $000040; (*!< USAC may use Complex Stereo Prediction in this channel element + *) + AC_EL_ENHANCED_NOISE = $000080; (*!< Enhanced noise filling*) + AC_EL_IGF_AFTER_TNS = $000100; (*!< IGF after TNS *) + AC_EL_IGF_INDEP_TILING = $000200; (*!< IGF independent tiling *) + AC_EL_IGF_USE_ENF = $000400; (*!< IGF use enhanced noise filling *) + AC_EL_FULLBANDLPD = $000800; (*!< enable fullband LPD tools *) + AC_EL_LPDSTEREOIDX = $001000; (*!< LPD-stereo-tool stereo index *) + AC_EL_LFE = $002000; (*!< The element is of type LFE. *) + + (* CODER_CONFIG::flags *) + CC_MPEG_ID = $00100000; + CC_IS_BASELAYER = $00200000; + CC_PROTECTION = $00400000; + CC_SBR = $00800000; + CC_SBRCRC = $00010000; + CC_SAC = $00020000; + CC_RVLC = $01000000; + CC_VCB11 = $02000000; + CC_HCR = $04000000; + CC_PSEUDO_SURROUND = $08000000; + CC_USAC_NOISE = $10000000; + CC_USAC_TW = $20000000; + CC_USAC_HBE = $40000000; + +type + (** Generic audio coder configuration structure. *) + TCODER_CONFIG = record + aot: AUDIO_OBJECT_TYPE; (**< Audio Object Type (AOT). *) + extAOT: AUDIO_OBJECT_TYPE; (**< Extension Audio Object Type (SBR). *) + channelMode: CHANNEL_MODE; (**< Channel mode. *) + channelConfigZero: byte; (**< Use channel config zero + pce although a + standard channel config could be signaled. *) + samplingRate: integer; (**< Sampling rate. *) + extSamplingRate: integer; (**< Extended samplerate (SBR). *) + downscaleSamplingRate: integer; (**< Downscale sampling rate (ELD downscaled mode) + *) + bitRate: integer; (**< Average bitrate. *) + samplesPerFrame: integer; (**< Number of PCM samples per codec frame and audio + channel. *) + noChannels: integer; (**< Number of audio channels. *) + bitsFrame: integer; + nSubFrames: integer; (**< Amount of encoder subframes. 1 means no subframing. *) + BSACnumOfSubFrame: integer; (**< The number of the sub-frames which are grouped and + transmitted in a super-frame (BSAC). *) + BSAClayerLength: integer; (**< The average length of the large-step layers in bytes + (BSAC). *) + flags: cardinal; (**< flags *) + matrixMixdownA: byte; (**< Matrix mixdown index to put into PCE. Default value + 0 means no mixdown coefficient, valid values are 1-4 + which correspond to matrix_mixdown_idx 0-3. *) + headerPeriod: byte; (**< Frame period for sending in band configuration + buffers in the transport layer. *) + + stereoConfigIndex: byte; (**< USAC MPS stereo mode *) + sbrMode: byte; (**< USAC SBR mode *) + sbrSignaling: SBR_PS_SIGNALING; (**< 0: implicit signaling, 1: backwards + compatible explicit signaling, 2: + hierarcical explicit signaling *) + + rawConfig: array[0..63] of byte; (**< raw codec specific config as bit stream *) + rawConfigBits: integer; (**< Size of rawConfig in bits *) + + sbrPresent: byte; + psPresent: byte; + end; + +const + USAC_ID_BIT = 16; (** USAC element IDs start at USAC_ID_BIT *) + +type + (** MP4 Element IDs. *) + MP4_ELEMENT_ID = ( + (* mp4 element IDs *) + ID_NONE = -1, (**< Invalid Element helper ID. *) + ID_SCE = 0, (**< Single Channel Element. *) + ID_CPE = 1, (**< Channel Pair Element. *) + ID_CCE = 2, (**< Coupling Channel Element. *) + ID_LFE = 3, (**< LFE Channel Element. *) + ID_DSE = 4, (**< Currently one Data Stream Element for ancillary data is + supported. *) + ID_PCE = 5, (**< Program Config Element. *) + ID_FIL = 6, (**< Fill Element. *) + ID_END = 7, (**< Arnie (End Element = Terminator). *) + ID_EXT = 8, (**< Extension Payload (ER only). *) + ID_SCAL = 9, (**< AAC scalable element (ER only). *) + (* USAC element IDs *) + ID_USAC_SCE = 0 + USAC_ID_BIT, (**< Single Channel Element. *) + ID_USAC_CPE = 1 + USAC_ID_BIT, (**< Channel Pair Element. *) + ID_USAC_LFE = 2 + USAC_ID_BIT, (**< LFE Channel Element. *) + ID_USAC_EXT = 3 + USAC_ID_BIT, (**< Extension Element. *) + ID_USAC_END = 4 + USAC_ID_BIT, (**< Arnie (End Element = Terminator). *) + ID_LAST + ); + + (* usacConfigExtType q.v. ISO/IEC DIS 23008-3 Table 52 and ISO/IEC FDIS + * 23003-3:2011(E) Table 74*) + CONFIG_EXT_ID = ( + (* USAC and RSVD60 3DA *) + ID_CONFIG_EXT_FILL = 0, + (* RSVD60 3DA *) + ID_CONFIG_EXT_DOWNMIX = 1, + ID_CONFIG_EXT_LOUDNESS_INFO = 2, + ID_CONFIG_EXT_AUDIOSCENE_INFO = 3, + ID_CONFIG_EXT_HOA_MATRIX = 4, + ID_CONFIG_EXT_SIG_GROUP_INFO = 6 + (* 5-127 => reserved for ISO use *) + (* > 128 => reserved for use outside of ISO scope *) + ); + + //IS_CHANNEL_ELEMENT(elementId) \ + // ((elementId) == ID_SCE || (elementId) == ID_CPE || (elementId) == ID_LFE || \ + // (elementId) == ID_USAC_SCE || (elementId) == ID_USAC_CPE || \ + // (elementId) == ID_USAC_LFE) +function IS_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; + + //IS_MP4_CHANNEL_ELEMENT(elementId) \ + // ((elementId) == ID_SCE || (elementId) == ID_CPE || (elementId) == ID_LFE) +function IS_MP4_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; + +const + EXT_ID_BITS = 4; (**< Size in bits of extension payload type tags. *) + +type + (** Extension payload types. *) + EXT_PAYLOAD_TYPE = ( + EXT_FIL = $00, + EXT_FILL_DATA = $01, + EXT_DATA_ELEMENT = $02, + EXT_DATA_LENGTH = $03, + EXT_UNI_DRC = $04, + EXT_LDSAC_DATA = $09, + EXT_SAOC_DATA = $0a, + EXT_DYNAMIC_RANGE = $0b, + EXT_SAC_DATA = $0c, + EXT_SBR_DATA = $0d, + EXT_SBR_DATA_CRC = $0e + ); + + //IS_USAC_CHANNEL_ELEMENT(elementId) \ + // ((elementId) == ID_USAC_SCE || (elementId) == ID_USAC_CPE || \ + // (elementId) == ID_USAC_LFE) +function IS_USAC_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; + +type + (** MPEG-D USAC & RSVD60 3D audio Extension Element Types. *) + USAC_EXT_ELEMENT_TYPE = ( + (* usac *) + ID_EXT_ELE_FILL = $00, + ID_EXT_ELE_MPEGS = $01, + ID_EXT_ELE_SAOC = $02, + ID_EXT_ELE_AUDIOPREROLL = $03, + ID_EXT_ELE_UNI_DRC = $04, + (* rsv603da *) + ID_EXT_ELE_OBJ_METADATA = $05, + ID_EXT_ELE_SAOC_3D = $06, + ID_EXT_ELE_HOA = $07, + ID_EXT_ELE_FMT_CNVRTR = $08, + ID_EXT_ELE_MCT = $09, + ID_EXT_ELE_ENHANCED_OBJ_METADATA = $0d, + (* reserved for use outside of ISO scope *) + ID_EXT_ELE_VR_METADATA = $81, + ID_EXT_ELE_UNKNOWN = $FF + ); + + (** + * Proprietary raw packet file configuration data type identifier. + *) + TP_CONFIG_TYPE = ( + TC_NOTHING = 0, (* No configuration available -> in-band configuration. *) + TC_RAW_ADTS = 2, (* Transfer type is ADTS. *) + TC_RAW_LATM_MCP1 = 6, (* Transfer type is LATM with SMC present. *) + TC_RAW_SDC = 21 (* Configuration data field is Drm SDC. *) + + ); + +const + (* AAC capability flags *) + CAPF_AAC_LC = $00000001; (**< Support flag for AAC Low Complexity. *) + CAPF_ER_AAC_LD = $00000002; (**< Support flag for AAC Low Delay with Error Resilience tools. + *) + CAPF_ER_AAC_SCAL = $00000004; (**< Support flag for AAC Scalable. *) + CAPF_ER_AAC_LC = $00000008; (**< Support flag for AAC Low Complexity with Error Resilience + tools. *) + CAPF_AAC_480 = $00000010; (**< Support flag for AAC with 480 framelength. *) + CAPF_AAC_512 = $00000020; (**< Support flag for AAC with 512 framelength. *) + CAPF_AAC_960 = $00000040; (**< Support flag for AAC with 960 framelength. *) + CAPF_AAC_1024 = $00000080; (**< Support flag for AAC with 1024 framelength. *) + CAPF_AAC_HCR = $00000100; (**< Support flag for AAC with Huffman Codeword Reordering. *) + CAPF_AAC_VCB11 = $00000200; (**< Support flag for AAC Virtual Codebook 11. *) + CAPF_AAC_RVLC = $00000400; (**< Support flag for AAC Reversible Variable Length Coding. *) + CAPF_AAC_MPEG4 = $00000800; (**< Support flag for MPEG file format. *) + CAPF_AAC_DRC = $00001000; (**< Support flag for AAC Dynamic Range Control. *) + CAPF_AAC_CONCEALMENT = $00002000; (**< Support flag for AAC concealment. *) + CAPF_AAC_DRM_BSFORMAT = $00004000; (**< Support flag for AAC DRM bistream format. *) + CAPF_ER_AAC_ELD = $00008000; (**< Support flag for AAC Enhanced Low Delay with Error + Resilience tools. *) + CAPF_ER_AAC_BSAC = $00010000; (**< Support flag for AAC BSAC. *) + CAPF_AAC_ELD_DOWNSCALE = $00040000; (**< Support flag for AAC-ELD Downscaling *) + CAPF_AAC_USAC_LP = $00100000; (**< Support flag for USAC low power mode. *) + CAPF_AAC_USAC = $00200000; (**< Support flag for Unified Speech and Audio Coding (USAC). *) + CAPF_ER_AAC_ELDV2 = $00800000; (**< Support flag for AAC Enhanced Low Delay with MPS 212. *) + CAPF_AAC_UNIDRC = $01000000; (**< Support flag for MPEG-D Dynamic Range Control (uniDrc). *) + + (* Transport capability flags *) + CAPF_ADTS = $00000001; (**< Support flag for ADTS transport format. *) + CAPF_ADIF = $00000002; (**< Support flag for ADIF transport format. *) + CAPF_LATM = $00000004; (**< Support flag for LATM transport format. *) + CAPF_LOAS = $00000008; (**< Support flag for LOAS transport format. *) + CAPF_RAWPACKETS = $00000010; (**< Support flag for RAW PACKETS transport format. *) + CAPF_DRM = $00000020; (**< Support flag for DRM/DRM+ transport format. *) + CAPF_RSVD50 = $00000040; (**< Support flag for RSVD50 transport format *) + + (* SBR capability flags *) + CAPF_SBR_LP = $00000001; (**< Support flag for SBR Low Power mode. *) + CAPF_SBR_HQ = $00000002; (**< Support flag for SBR High Quality mode. *) + CAPF_SBR_DRM_BS = $00000004; (**< Support flag for *) + CAPF_SBR_CONCEALMENT = $00000008; (**< Support flag for SBR concealment. *) + CAPF_SBR_DRC = $00000010; (**< Support flag for SBR Dynamic Range Control. *) + CAPF_SBR_PS_MPEG = $00000020; (**< Support flag for MPEG Parametric Stereo. *) + CAPF_SBR_PS_DRM = $00000040; (**< Support flag for DRM Parametric Stereo. *) + CAPF_SBR_ELD_DOWNSCALE = $00000080; (**< Support flag for ELD reduced delay mode *) + CAPF_SBR_HBEHQ = $00000100; (**< Support flag for HQ HBE *) + + (* PCM utils capability flags *) + CAPF_DMX_BLIND = $00000001; (**< Support flag for blind downmixing. *) + CAPF_DMX_PCE = $00000002; (**< Support flag for guided downmix with data from MPEG-2/4 + Program Config Elements (PCE). *) + CAPF_DMX_ARIB = $00000004; (**< Support flag for PCE guided downmix with slightly different + equations and levels to fulfill ARIB standard. *) + CAPF_DMX_DVB = $00000008; (**< Support flag for guided downmix with data from DVB ancillary + data fields. *) + CAPF_DMX_CH_EXP = $00000010; (**< Support flag for simple upmixing by dublicating channels or + adding zero channels. *) + CAPF_DMX_6_CH = $00000020; (**< Support flag for 5.1 channel configuration (input and + output). *) + CAPF_DMX_8_CH = $00000040; (**< Support flag for 6 and 7.1 channel configurations (input and + output). *) + CAPF_DMX_24_CH = $00000080; (**< Support flag for 22.2 channel configuration (input and + output). *) + CAPF_LIMITER = $00002000; (**< Support flag for signal level limiting. + *) + + (* MPEG Surround capability flags *) + CAPF_MPS_STD = $00000001; (**< Support flag for MPEG Surround. *) + CAPF_MPS_LD = $00000002; (**< Support flag for Low Delay MPEG Surround. + *) + CAPF_MPS_USAC = $00000004; (**< Support flag for USAC MPEG Surround. *) + CAPF_MPS_HQ = $00000010; (**< Support flag indicating if high quality processing is + supported *) + CAPF_MPS_LP = $00000020; (**< Support flag indicating if partially complex (low power) + processing is supported *) + CAPF_MPS_BLIND = $00000040; (**< Support flag indicating if blind processing is supported *) + CAPF_MPS_BINAURAL = $00000080; (**< Support flag indicating if binaural output is possible *) + CAPF_MPS_2CH_OUT = $00000100; (**< Support flag indicating if 2ch output is possible *) + CAPF_MPS_6CH_OUT = $00000200; (**< Support flag indicating if 6ch output is possible *) + CAPF_MPS_8CH_OUT = $00000400; (**< Support flag indicating if 8ch output is possible *) + CAPF_MPS_1CH_IN = $00001000; (**< Support flag indicating if 1ch dmx input is possible *) + CAPF_MPS_2CH_IN = $00002000; (**< Support flag indicating if 2ch dmx input is possible *) + CAPF_MPS_6CH_IN = $00004000; (**< Support flag indicating if 5ch dmx input is possible *) + + (* \endcond *) + + + (* + * ############################################################################################## + * Library versioning + * ############################################################################################## + *) + + (** + * Convert each member of version numbers to one single numeric version + * representation. + * \param lev0 1st level of version number. + * \param lev1 2nd level of version number. + * \param lev2 3rd level of version number. + *) + //LIB_VERSION(lev0, lev1, lev2) \ + // ((lev0 << 24 & = $ff000000) | (lev1 << 16 & = $00ff0000) | \ + // (lev2 << 8 & = $0000ff00)) + +function LIB_VERSION(lev0: byte; lev1: byte; lev2: byte): integer; + + (** + * Build text string of version. + *) + //LIB_VERSION_STRING(info) \ + // FDKsprintf((info)->versionStr, "%d.%d.%d", (((info)->version >> 24) & = $ff), \ + // (((info)->version >> 16) & = $ff), \ + // (((info)->version >> 8) & = $ff)) +function LIB_VERSION_STRING(info: LIB_INFO): string; + + + (** Initialize library info. *) + //static FDK_AUDIO_INLINE void FDKinitLibInfo(LIB_INFO* info) { + // int i; + + // for (i = 0; i < FDK_MODULE_LAST; i++) { + // info[i].module_id = FDK_NONE; + // } + //} +procedure FDKinitLibInfo(var info: array of LIB_INFO); + + + (** Aquire supported features of library. *) + //static FDK_AUDIO_INLINE UINT + //FDKlibInfo_getCapabilities(const LIB_INFO* info, FDK_MODULE_ID module_id) { + // int i; + + // for (i = 0; i < FDK_MODULE_LAST; i++) { + // if (info[i].module_id == module_id) { + // return info[i].flags; + // } + // } + // return 0; + //} +function FDKlibInfo_getCapabilities(const info: array of LIB_INFO; module_id: FDK_MODULE_ID): cardinal; + + + (** Search for next free tab. *) + //static FDK_AUDIO_INLINE INT FDKlibInfo_lookup(const LIB_INFO* info, + // FDK_MODULE_ID module_id) { + // int i = -1; + + // for (i = 0; i < FDK_MODULE_LAST; i++) { + // if (info[i].module_id == module_id) return -1; + // if (info[i].module_id == FDK_NONE) break; + // } + // if (i == FDK_MODULE_LAST) return -1; + + // return i; + //} +function FDKlibInfo_lookup(const info: array of LIB_INFO; module_id: FDK_MODULE_ID): integer; + +type + (* + * ############################################################################################## + * Buffer description + * ############################################################################################## + *) + + (** + * I/O buffer descriptor. + *) + FDK_bufDescr = record + ppBase: Pointer; (*!< Pointer to an array containing buffer base addresses. + Set to NULL for buffer requirement info. *) + pBufSize: PCardinal; (*!< Pointer to an array containing the number of elements + that can be placed in the specific buffer. *) + pEleSize: PCardinal; (*!< Pointer to an array containing the element size for each + buffer in bytes. That is mostly the number returned by the + sizeof() operator for the data type used for the specific + buffer. *) + pBufType: PCardinal; (*!< Pointer to an array of bit fields containing a description + for each buffer. See XXX below for more details. *) + numBufs: cardinal; (*!< Total number of buffers. *) + end; + +(** + * Buffer type description field. + *) +const + FDK_BUF_TYPE_MASK_IO = (cardinal($03) shl 30); + FDK_BUF_TYPE_MASK_DESCR = (cardinal($3F) shl 16); + FDK_BUF_TYPE_MASK_ID = cardinal($FF); + + FDK_BUF_TYPE_INPUT = (cardinal($1) shl 30); + FDK_BUF_TYPE_OUTPUT = (cardinal($2) shl 30); + + FDK_BUF_TYPE_PCM_DATA = (cardinal($1) shl 16); + FDK_BUF_TYPE_ANC_DATA = (cardinal($2) shl 16); + FDK_BUF_TYPE_BS_DATA = (cardinal($4) shl 16); + +const + AACDECODER_LIB_VL0 = 3; + AACDECODER_LIB_VL1 = 2; + AACDECODER_LIB_VL2 = 0; + + +(** + * \brief AAC decoder error codes. + *) +type + AAC_DECODER_ERROR = ( + AAC_DEC_OK = + $0000, (*!< No error occurred. Output buffer is valid and error free. *) + AAC_DEC_OUT_OF_MEMORY = + $0002, (*!< Heap returned NULL pointer. Output buffer is invalid. *) + AAC_DEC_UNKNOWN = + $0005, (*!< Error condition is of unknown reason, or from a another + module. Output buffer is invalid. *) + + (* Synchronization errors. Output buffer is invalid. *) + aac_dec_sync_error_start = $1000, + AAC_DEC_TRANSPORT_SYNC_ERROR = $1001, (*!< The transport decoder had + synchronization problems. Do not + exit decoding. Just feed new + bitstream data. *) + AAC_DEC_NOT_ENOUGH_BITS = $1002, (*!< The input buffer ran out of bits. *) + aac_dec_sync_error_end = $1FFF, + + (* Initialization errors. Output buffer is invalid. *) + aac_dec_init_error_start = $2000, + AAC_DEC_INVALID_HANDLE = + $2001, (*!< The handle passed to the function call was invalid (NULL). *) + AAC_DEC_UNSUPPORTED_AOT = + $2002, (*!< The AOT found in the configuration is not supported. *) + AAC_DEC_UNSUPPORTED_FORMAT = + $2003, (*!< The bitstream format is not supported. *) + AAC_DEC_UNSUPPORTED_ER_FORMAT = + $2004, (*!< The error resilience tool format is not supported. *) + AAC_DEC_UNSUPPORTED_EPCONFIG = + $2005, (*!< The error protection format is not supported. *) + AAC_DEC_UNSUPPORTED_MULTILAYER = + $2006, (*!< More than one layer for AAC scalable is not supported. *) + AAC_DEC_UNSUPPORTED_CHANNELCONFIG = + $2007, (*!< The channel configuration (either number or arrangement) is + not supported. *) + AAC_DEC_UNSUPPORTED_SAMPLINGRATE = $2008, (*!< The sample rate specified in + the configuration is not + supported. *) + AAC_DEC_INVALID_SBR_CONFIG = + $2009, (*!< The SBR configuration is not supported. *) + AAC_DEC_SET_PARAM_FAIL = $200A, (*!< The parameter could not be set. Either + the value was out of range or the + parameter does not exist. *) + AAC_DEC_NEED_TO_RESTART = $200B, (*!< The decoder needs to be restarted, + since the required configuration change + cannot be performed. *) + AAC_DEC_OUTPUT_BUFFER_TOO_SMALL = + $200C, (*!< The provided output buffer is too small. *) + aac_dec_init_error_end = $2FFF, + + (* Decode errors. Output buffer is valid but concealed. *) + aac_dec_decode_error_start = $4000, + AAC_DEC_TRANSPORT_ERROR = + $4001, (*!< The transport decoder encountered an unexpected error. *) + AAC_DEC_PARSE_ERROR = $4002, (*!< Error while parsing the bitstream. Most + probably it is corrupted, or the system + crashed. *) + AAC_DEC_UNSUPPORTED_EXTENSION_PAYLOAD = + $4003, (*!< Error while parsing the extension payload of the bitstream. + The extension payload type found is not supported. *) + AAC_DEC_DECODE_FRAME_ERROR = $4004, (*!< The parsed bitstream value is out of + range. Most probably the bitstream is + corrupt, or the system crashed. *) + AAC_DEC_CRC_ERROR = $4005, (*!< The embedded CRC did not match. *) + AAC_DEC_INVALID_CODE_BOOK = $4006, (*!< An invalid codebook was signaled. + Most probably the bitstream is corrupt, + or the system crashed. *) + AAC_DEC_UNSUPPORTED_PREDICTION = + $4007, (*!< Predictor found, but not supported in the AAC Low Complexity + profile. Most probably the bitstream is corrupt, or has a wrong + format. *) + AAC_DEC_UNSUPPORTED_CCE = $4008, (*!< A CCE element was found which is not + supported. Most probably the bitstream is + corrupt, or has a wrong format. *) + AAC_DEC_UNSUPPORTED_LFE = $4009, (*!< A LFE element was found which is not + supported. Most probably the bitstream is + corrupt, or has a wrong format. *) + AAC_DEC_UNSUPPORTED_GAIN_CONTROL_DATA = + $400A, (*!< Gain control data found but not supported. Most probably the + bitstream is corrupt, or has a wrong format. *) + AAC_DEC_UNSUPPORTED_SBA = + $400B, (*!< SBA found, but currently not supported in the BSAC profile. + *) + AAC_DEC_TNS_READ_ERROR = $400C, (*!< Error while reading TNS data. Most + probably the bitstream is corrupt or the + system crashed. *) + AAC_DEC_RVLC_ERROR = + $400D, (*!< Error while decoding error resilient data. *) + aac_dec_decode_error_end = $4FFF, + (* Ancillary data errors. Output buffer is valid. *) + aac_dec_anc_data_error_start = $8000, + AAC_DEC_ANC_DATA_ERROR = + $8001, (*!< Non severe error concerning the ancillary data handling. *) + AAC_DEC_TOO_SMALL_ANC_BUFFER = $8002, (*!< The registered ancillary data + buffer is too small to receive the + parsed data. *) + AAC_DEC_TOO_MANY_ANC_ELEMENTS = $8003, (*!< More than the allowed number of + ancillary data elements should be + written to buffer. *) + aac_dec_anc_data_error_end = $8FFF + + ); + + (** Macro to identify initialization errors. Output buffer is invalid. *) + //#define IS_INIT_ERROR(err) \ + // ((((err) >= aac_dec_init_error_start) && ((err) <= aac_dec_init_error_end)) \ + // ? 1 \ + // : 0) + (** Macro to identify decode errors. Output buffer is valid but concealed. *) + //#define IS_DECODE_ERROR(err) \ + // ((((err) >= aac_dec_decode_error_start) && \ + // ((err) <= aac_dec_decode_error_end)) \ + // ? 1 \ + // : 0) +(** + * Macro to identify if the audio output buffer contains valid samples after + * calling aacDecoder_DecodeFrame(). Output buffer is valid but can be + * concealed. + *) + //#define IS_OUTPUT_VALID(err) (((err) == AAC_DEC_OK) || IS_DECODE_ERROR(err)) + +(*! \enum AAC_MD_PROFILE + * \brief The available metadata profiles which are mostly related to downmixing. The values define the arguments + * for the use with parameter ::AAC_METADATA_PROFILE. + *) + AAC_MD_PROFILE = ( + AAC_MD_PROFILE_MPEG_STANDARD = + 0, (*!< The standard profile creates a mixdown signal based on the + advanced downmix metadata (from a DSE). The equations and default + values are defined in ISO/IEC 14496:3 Ammendment 4. Any other + (legacy) downmix metadata will be ignored. No other parameter will + be modified. *) + AAC_MD_PROFILE_MPEG_LEGACY = + 1, (*!< This profile behaves identical to the standard profile if advanced + downmix metadata (from a DSE) is available. If not, the + matrix_mixdown information embedded in the program configuration + element (PCE) will be applied. If neither is the case, the module + creates a mixdown using the default coefficients as defined in + ISO/IEC 14496:3 AMD 4. The profile can be used to support legacy + digital TV (e.g. DVB) streams. *) + AAC_MD_PROFILE_MPEG_LEGACY_PRIO = + 2, (*!< Similar to the ::AAC_MD_PROFILE_MPEG_LEGACY profile but if both + the advanced (ISO/IEC 14496:3 AMD 4) and the legacy (PCE) MPEG + downmix metadata are available the latter will be applied. + *) + AAC_MD_PROFILE_ARIB_JAPAN = + 3 (*!< Downmix creation as described in ABNT NBR 15602-2. But if advanced + downmix metadata (ISO/IEC 14496:3 AMD 4) is available it will be + preferred because of the higher resolutions. In addition the + metadata expiry time will be set to the value defined in the ARIB + standard (see ::AAC_METADATA_EXPIRY_TIME). + *) + ); + +(*! \enum AAC_DRC_DEFAULT_PRESENTATION_MODE_OPTIONS + * \brief Options for handling of DRC parameters, if presentation mode is not indicated in bitstream + *) + AAC_DRC_DEFAULT_PRESENTATION_MODE_OPTIONS = ( + AAC_DRC_PARAMETER_HANDLING_DISABLED = -1, (*!< DRC parameter handling + disabled, all parameters are + applied as requested. *) + AAC_DRC_PARAMETER_HANDLING_ENABLED = + 0, (*!< Apply changes to requested DRC parameters to prevent clipping. *) + AAC_DRC_PRESENTATION_MODE_1_DEFAULT = + 1, (*!< Use DRC presentation mode 1 as default (e.g. for Nordig) *) + AAC_DRC_PRESENTATION_MODE_2_DEFAULT = + 2 (*!< Use DRC presentation mode 2 as default (e.g. for DTG DBook) *) + ); + +(** + * \brief AAC decoder setting parameters + *) + AACDEC_PARAM = ( + AAC_PCM_DUAL_CHANNEL_OUTPUT_MODE = + $0002, (*!< Defines how the decoder processes two channel signals: \n + 0: Leave both signals as they are (default). \n + 1: Create a dual mono output signal from channel 1. \n + 2: Create a dual mono output signal from channel 2. \n + 3: Create a dual mono output signal by mixing both channels + (L' = R' = 0.5*Ch1 + 0.5*Ch2). *) + AAC_PCM_OUTPUT_CHANNEL_MAPPING = + $0003, (*!< Output buffer channel ordering. 0: MPEG PCE style order, 1: + WAV file channel order (default). *) + AAC_PCM_LIMITER_ENABLE = + $0004, (*!< Enable signal level limiting. \n + -1: Auto-config. Enable limiter for all + non-lowdelay configurations by default. \n + 0: Disable limiter in general. \n + 1: Enable limiter always. + It is recommended to call the decoder + with a AACDEC_CLRHIST flag to reset all + states when the limiter switch is changed + explicitly. *) + AAC_PCM_LIMITER_ATTACK_TIME = $0005, (*!< Signal level limiting attack time + in ms. Default configuration is 15 + ms. Adjustable range from 1 ms to 15 + ms. *) + AAC_PCM_LIMITER_RELEAS_TIME = $0006, (*!< Signal level limiting release time + in ms. Default configuration is 50 + ms. Adjustable time must be larger + than 0 ms. *) + AAC_PCM_MIN_OUTPUT_CHANNELS = + $0011, (*!< Minimum number of PCM output channels. If higher than the + number of encoded audio channels, a simple channel extension is + applied (see note 4 for exceptions). \n -1, 0: Disable channel + extension feature. The decoder output contains the same number + of channels as the encoded bitstream. \n 1: This value is + currently needed only together with the mix-down feature. See + ::AAC_PCM_MAX_OUTPUT_CHANNELS and note 2 below. \n + 2: Encoded mono signals will be duplicated to achieve a + 2/0/0.0 channel output configuration. \n 6: The decoder + tries to reorder encoded signals with less than six channels to + achieve a 3/0/2.1 channel output signal. Missing channels will + be filled with a zero signal. If reordering is not possible the + empty channels will simply be appended. Only available if + instance is configured to support multichannel output. \n 8: + The decoder tries to reorder encoded signals with less than + eight channels to achieve a 3/0/4.1 channel output signal. + Missing channels will be filled with a zero signal. If + reordering is not possible the empty channels will simply be + appended. Only available if instance is configured to + support multichannel output.\n NOTE: \n + 1. The channel signaling (CStreamInfo::pChannelType and + CStreamInfo::pChannelIndices) will not be modified. Added empty + channels will be signaled with channel type + AUDIO_CHANNEL_TYPE::ACT_NONE. \n + 2. If the parameter value is greater than that of + ::AAC_PCM_MAX_OUTPUT_CHANNELS both will be set to the same + value. \n + 3. This parameter will be ignored if the number of encoded + audio channels is greater than 8. *) + AAC_PCM_MAX_OUTPUT_CHANNELS = + $0012, (*!< Maximum number of PCM output channels. If lower than the + number of encoded audio channels, downmixing is applied + accordingly (see note 5 for exceptions). If dedicated metadata + is available in the stream it will be used to achieve better + mixing results. \n -1, 0: Disable downmixing feature. The + decoder output contains the same number of channels as the + encoded bitstream. \n 1: All encoded audio configurations + with more than one channel will be mixed down to one mono + output signal. \n 2: The decoder performs a stereo mix-down + if the number encoded audio channels is greater than two. \n 6: + If the number of encoded audio channels is greater than six the + decoder performs a mix-down to meet the target output + configuration of 3/0/2.1 channels. Only available if instance + is configured to support multichannel output. \n 8: This + value is currently needed only together with the channel + extension feature. See ::AAC_PCM_MIN_OUTPUT_CHANNELS and note 2 + below. Only available if instance is configured to support + multichannel output. \n NOTE: \n + 1. Down-mixing of any seven or eight channel configuration + not defined in ISO/IEC 14496-3 PDAM 4 is not supported by this + software version. \n + 2. If the parameter value is greater than zero but smaller + than ::AAC_PCM_MIN_OUTPUT_CHANNELS both will be set to same + value. \n + 3. This parameter will be ignored if the number of encoded + audio channels is greater than 8. *) + AAC_METADATA_PROFILE = + $0020, (*!< See ::AAC_MD_PROFILE for all available values. *) + AAC_METADATA_EXPIRY_TIME = $0021, (*!< Defines the time in ms after which all + the bitstream associated meta-data (DRC, + downmix coefficients, ...) will be reset + to default if no update has been + received. Negative values disable the + feature. *) + + AAC_CONCEAL_METHOD = $0100, (*!< Error concealment: Processing method. \n + 0: Spectral muting. \n + 1: Noise substitution (see ::CONCEAL_NOISE). + \n 2: Energy interpolation (adds additional + signal delay of one frame, see + ::CONCEAL_INTER. only some AOTs are + supported). \n *) + AAC_DRC_BOOST_FACTOR = + $0200, (*!< MPEG-4 / MPEG-D Dynamic Range Control (DRC): Scaling factor + for boosting gain values. Defines how the boosting DRC factors + (conveyed in the bitstream) will be applied to the decoded + signal. The valid values range from 0 (don't apply boost + factors) to 127 (fully apply boost factors). Default value is 0 + for MPEG-4 DRC and 127 for MPEG-D DRC. *) + AAC_DRC_ATTENUATION_FACTOR = $0201, (*!< MPEG-4 / MPEG-D DRC: Scaling factor + for attenuating gain values. Same as + ::AAC_DRC_BOOST_FACTOR but for + attenuating DRC factors. *) + AAC_DRC_REFERENCE_LEVEL = + $0202, (*!< MPEG-4 / MPEG-D DRC: Target reference level / decoder target + loudness.\n Defines the level below full-scale (quantized in + steps of 0.25dB) to which the output audio signal will be + normalized to by the DRC module.\n The parameter controls + loudness normalization for both MPEG-4 DRC and MPEG-D DRC. The + valid values range from 40 (-10 dBFS) to 127 (-31.75 dBFS).\n + Example values:\n + 124 (-31 dBFS) for audio/video receivers (AVR) or other + devices allowing audio playback with high dynamic range,\n 96 + (-24 dBFS) for TV sets or equivalent devices (default),\n 64 + (-16 dBFS) for mobile devices where the dynamic range of audio + playback is restricted.\n Any value smaller than 0 switches off + loudness normalization and MPEG-4 DRC. *) + AAC_DRC_HEAVY_COMPRESSION = + $0203, (*!< MPEG-4 DRC: En-/Disable DVB specific heavy compression (aka + RF mode). If set to 1, the decoder will apply the compression + values from the DVB specific ancillary data field. At the same + time the MPEG-4 Dynamic Range Control tool will be disabled. By + default, heavy compression is disabled. *) + AAC_DRC_DEFAULT_PRESENTATION_MODE = + $0204, (*!< MPEG-4 DRC: Default presentation mode (DRC parameter + handling). \n Defines the handling of the DRC parameters boost + factor, attenuation factor and heavy compression, if no + presentation mode is indicated in the bitstream.\n For options, + see ::AAC_DRC_DEFAULT_PRESENTATION_MODE_OPTIONS.\n Default: + ::AAC_DRC_PARAMETER_HANDLING_DISABLED *) + AAC_DRC_ENC_TARGET_LEVEL = + $0205, (*!< MPEG-4 DRC: Encoder target level for light (i.e. not heavy) + compression.\n If known, this declares the target reference + level that was assumed at the encoder for calculation of + limiting gains. The valid values range from 0 (full-scale) to + 127 (31.75 dB below full-scale). This parameter is used only + with ::AAC_DRC_PARAMETER_HANDLING_ENABLED and ignored + otherwise.\n Default: 127 (worst-case assumption).\n *) + AAC_UNIDRC_SET_EFFECT = $0206, (*!< MPEG-D DRC: Request a DRC effect type for + selection of a DRC set.\n Supported indices + are:\n -1: DRC off. Completely disables + MPEG-D DRC.\n 0: None (default). Disables + MPEG-D DRC, but automatically enables DRC + if necessary to prevent clipping.\n 1: Late + night\n 2: Noisy environment\n 3: Limited + playback range\n 4: Low playback level\n 5: + Dialog enhancement\n 6: General + compression. Used for generally enabling + MPEG-D DRC without particular request.\n *) + AAC_UNIDRC_ALBUM_MODE = + $0207, (*!< MPEG-D DRC: Enable album mode. 0: Disabled (default), 1: + Enabled.\n Disabled album mode leads to application of gain + sequences for fading in and out, if provided in the + bitstream.\n Enabled album mode makes use of dedicated album + loudness information, if provided in the bitstream.\n *) + AAC_QMF_LOWPOWER = + $0300, (*!< Quadrature Mirror Filter (QMF) Bank processing mode. \n + -1: Use internal default. \n + 0: Use complex QMF data mode. \n + 1: Use real (low power) QMF data mode. \n *) + AAC_TPDEC_CLEAR_BUFFER = + $0603 (*!< Clear internal bit stream buffer of transport layers. The + decoder will start decoding at new data passed after this event + and any previous data is discarded. *) + + ); + +(** + * \brief This structure gives information about the currently decoded audio + * data. All fields are read-only. + *) + PCStreamInfo = ^TCStreamInfo; + + TCStreamInfo = record + (* These five members are the only really relevant ones for the user. *) + sampleRate: integer; (*!< The sample rate in Hz of the decoded PCM audio signal. *) + frameSize: integer; (*!< The frame size of the decoded PCM audio signal. \n + Typically this is: \n + 1024 or 960 for AAC-LC \n + 2048 or 1920 for HE-AAC (v2) \n + 512 or 480 for AAC-LD and AAC-ELD \n + 768, 1024, 2048 or 4096 for USAC *) + numChannels: integer; (*!< The number of output audio channels before the rendering + module, i.e. the original channel configuration. *) + pChannelType: array of AUDIO_CHANNEL_TYPE; (*!< Audio channel type of each output audio channel. *) + pChannelIndices: array of byte; (*!< Audio channel index for each output audio + channel. See ISO/IEC 13818-7:2005(E), 8.5.3.2 + Explicit channel mapping using a + program_config_element() *) + (* Decoder internal members. *) + aacSampleRate: integer; (*!< Sampling rate in Hz without SBR (from configuration + info) divided by a (ELD) downscale factor if present. *) + profile: integer; (*!< MPEG-2 profile (from file header) (-1: not applicable (e. g. + MPEG-4)). *) + aot: AUDIO_OBJECT_TYPE; (*!< Audio Object Type (from ASC): is set to the appropriate value + for MPEG-2 bitstreams (e. g. 2 for AAC-LC). *) + channelConfig: integer; (*!< Channel configuration (0: PCE defined, 1: mono, 2: + stereo, ... *) + bitRate: integer; (*!< Instantaneous bit rate. *) + aacSamplesPerFrame: integer; (*!< Samples per frame for the AAC core (from ASC) + divided by a (ELD) downscale factor if present. \n + Typically this is (with a downscale factor of 1): + \n 1024 or 960 for AAC-LC \n 512 or 480 for + AAC-LD and AAC-ELD *) + aacNumChannels: integer; (*!< The number of audio channels after AAC core + processing (before PS or MPS processing). CAUTION: This + are not the final number of output channels! *) + extAot: AUDIO_OBJECT_TYPE; (*!< Extension Audio Object Type (from ASC) *) + extSamplingRate: integer; (*!< Extension sampling rate in Hz (from ASC) divided by + a (ELD) downscale factor if present. *) + + outputDelay: cardinal; (*!< The number of samples the output is additionally + delayed by.the decoder. *) + flags: cardinal; (*!< Copy of internal flags. Only to be written by the decoder, + and only to be read externally. *) + + epConfig: shortint; (*!< epConfig level (from ASC): only level 0 supported, -1 + means no ER (e. g. AOT=2, MPEG-2 AAC, etc.) *) + (* Statistics *) + numLostAccessUnits: integer; (*!< This integer will reflect the estimated amount of + lost access units in case aacDecoder_DecodeFrame() + returns AAC_DEC_TRANSPORT_SYNC_ERROR. It will be + < 0 if the estimation failed. *) + + numTotalBytes: int64; (*!< This is the number of total bytes that have passed + through the decoder. *) + numBadBytes: int64; (*!< This is the number of total bytes that were considered + with errors from numTotalBytes. *) + numTotalAccessUnits: int64; (*!< This is the number of total access units that + have passed through the decoder. *) + numBadAccessUnits: int64; (*!< This is the number of total access units that + were considered with errors from numTotalBytes. *) + + (* Metadata *) + drcProgRefLev: shortint; (*!< DRC program reference level. Defines the reference + level below full-scale. It is quantized in steps of + 0.25dB. The valid values range from 0 (0 dBFS) to 127 + (-31.75 dBFS). It is used to reflect the average + loudness of the audio in LKFS according to ITU-R BS + 1770. If no level has been found in the bitstream the + value is -1. *) + drcPresMode: shortint; (*!< DRC presentation mode. According to ETSI TS 101 154, + this field indicates whether light (MPEG-4 Dynamic Range + Control tool) or heavy compression (DVB heavy + compression) dynamic range control shall take priority + on the outputs. For details, see ETSI TS 101 154, table + C.33. Possible values are: \n -1: No corresponding + metadata found in the bitstream \n 0: DRC presentation + mode not indicated \n 1: DRC presentation mode 1 \n 2: + DRC presentation mode 2 \n 3: Reserved *) + outputLoudness: integer; (*!< Audio output loudness in steps of -0.25 dB. Range: 0 + (0 dBFS) to 231 (-57.75 dBFS).\n A value of -1 + indicates that no loudness metadata is present.\n If + loudness normalization is active, the value corresponds + to the target loudness value set with + ::AAC_DRC_REFERENCE_LEVEL.\n If loudness normalization + is not active, the output loudness value corresponds to + the loudness metadata given in the bitstream.\n + Loudness metadata can originate from MPEG-4 DRC or + MPEG-D DRC. *) + + end; + + HANDLE_AACDECODER = ^AAC_DECODER_INSTANCE; + + AAC_DECODER_INSTANCE = record + HANDLE_AACDECODER: Pointer; (*!< Pointer to a AAC decoder instance. *) + end; + + (** + * \brief Initialize ancillary data buffer. + * + * \param self AAC decoder handle. + * \param buffer Pointer to (external) ancillary data buffer. + * \param size Size of the buffer pointed to by buffer. + * \return Error code. + *) +var + + aacDecoder_AncDataInit: function(self: HANDLE_AACDECODER; buffer: PByte; size: integer): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Get one ancillary data element. + * + * \param self AAC decoder handle. + * \param index Index of the ancillary data element to get. + * \param ptr Pointer to a buffer receiving a pointer to the requested + * ancillary data element. + * \param size Pointer to a buffer receiving the length of the requested + * ancillary data element. + * \return Error code. + *) + aacDecoder_AncDataGet: function(self: HANDLE_AACDECODER; index: integer; var ptr: PByte; var size: integer): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Set one single decoder parameter. + * + * \param self AAC decoder handle. + * \param param Parameter to be set. + * \param value Parameter value. + * \return Error code. + *) + aacDecoder_SetParam: function(const self: HANDLE_AACDECODER; const param: AACDEC_PARAM; const Value: integer): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Get free bytes inside decoder internal buffer. + * \param self Handle of AAC decoder instance. + * \param pFreeBytes Pointer to variable receiving amount of free bytes inside + * decoder internal buffer. + * \return Error code. + *) + aacDecoder_GetFreeBytes: function(const self: HANDLE_AACDECODER; var pFreeBytes: cardinal): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Open an AAC decoder instance. + * \param transportFmt The transport type to be used. + * \param nrOfLayers Number of transport layers. + * \return AAC decoder handle. + *) + aacDecoder_Open: function(transportFmt: TRANSPORT_TYPE; nrOfLayers: cardinal): HANDLE_AACDECODER; + cdecl; + +(** + * \brief Explicitly configure the decoder by passing a raw AudioSpecificConfig + * (ASC) or a StreamMuxConfig (SMC), contained in a binary buffer. This is + * required for MPEG-4 and Raw Packets file format bitstreams as well as for + * LATM bitstreams with no in-band SMC. If the transport format is LATM with or + * without LOAS, configuration is assumed to be an SMC, for all other file + * formats an ASC. + * + * \param self AAC decoder handle. + * \param conf Pointer to an unsigned char buffer containing the binary + * configuration buffer (either ASC or SMC). + * \param length Length of the configuration buffer in bytes. + * \return Error code. + *) + aacDecoder_ConfigRaw: function(self: HANDLE_AACDECODER; conf: Pointer; const length: PCardinal): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Submit raw ISO base media file format boxes to decoder for parsing + * (only some box types are recognized). + * + * \param self AAC decoder handle. + * \param buffer Pointer to an unsigned char buffer containing the binary box + * data (including size and type, can be a sequence of multiple boxes). + * \param length Length of the data in bytes. + * \return Error code. + *) + aacDecoder_RawISOBMFFData: function(self: HANDLE_AACDECODER; buffer: PByte; length: cardinal): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief Fill AAC decoder's internal input buffer with bitstream data from the + * external input buffer. The function only copies such data as long as the + * decoder-internal input buffer is not full. So it grabs whatever it can from + * pBuffer and returns information (bytesValid) so that at a subsequent call of + * %aacDecoder_Fill(), the right position in pBuffer can be determined to grab + * the next data. + * + * \param self AAC decoder handle. + * \param pBuffer Pointer to external input buffer. + * \param bufferSize Size of external input buffer. This argument is required + * because decoder-internally we need the information to calculate the offset to + * pBuffer, where the next available data is, which is then + * fed into the decoder-internal buffer (as much as + * possible). Our example framework implementation fills the + * buffer at pBuffer again, once it contains no available valid bytes anymore + * (meaning bytesValid equal 0). + * \param bytesValid Number of bitstream bytes in the external bitstream buffer + * that have not yet been copied into the decoder's internal bitstream buffer by + * calling this function. The value is updated according to + * the amount of newly copied bytes. + * \return Error code. + *) + aacDecoder_Fill: function(self: HANDLE_AACDECODER; pBuffer: PByte; var bufferSize: cardinal; + var bytesValid: cardinal): AAC_DECODER_ERROR; + cdecl; + +const + (** Flag for aacDecoder_DecodeFrame(): Trigger the built-in error concealment + * module to generate a substitute signal for one lost frame. New input data + * will not be considered. + *) + AACDEC_CONCEAL = 1; + (** Flag for aacDecoder_DecodeFrame(): Flush all filterbanks to get all delayed + * audio without having new input data. Thus new input data will not be + * considered. + *) + AACDEC_FLUSH = 2; + (** Flag for aacDecoder_DecodeFrame(): Signal an input bit stream data + * discontinuity. Resync any internals as necessary. + *) + AACDEC_INTR = 4; + (** Flag for aacDecoder_DecodeFrame(): Clear all signal delay lines and history + * buffers. CAUTION: This can cause discontinuities in the output signal. + *) + AACDEC_CLRHIST = 8; + +(** + * \brief Decode one audio frame + * + * \param self AAC decoder handle. + * \param pTimeData Pointer to external output buffer where the decoded PCM + * samples will be stored into. + * \param timeDataSize Size of external output buffer. + * \param flags Bit field with flags for the decoder: \n + * (flags & AACDEC_CONCEAL) == 1: Do concealment. \n + * (flags & AACDEC_FLUSH) == 2: Discard input data. Flush + * filter banks (output delayed audio). \n (flags & AACDEC_INTR) == 4: Input + * data is discontinuous. Resynchronize any internals as + * necessary. \n (flags & AACDEC_CLRHIST) == 8: Clear all signal delay lines and + * history buffers. + * \return Error code. + *) +var + + aacDecoder_DecodeFrame: function(self: HANDLE_AACDECODER; pTimeData: PSmallInt; const timeDataSize: integer; + const flags: cardinal): AAC_DECODER_ERROR; + cdecl; + +(** + * \brief De-allocate all resources of an AAC decoder instance. + * + * \param self AAC decoder handle. + * \return void. + *) + aacDecoder_Close: procedure(self: HANDLE_AACDECODER); + cdecl; + +(** + * \brief Get CStreamInfo handle from decoder. + * + * \param self AAC decoder handle. + * \return Reference to requested CStreamInfo. + *) + aacDecoder_GetStreamInfo: function(self: HANDLE_AACDECODER): PCStreamInfo; + cdecl; + +(** + * \brief Get decoder library info. + * + * \param info Pointer to an allocated LIB_INFO structure. + * \return 0 on success. + *) + aacDecoder_GetLibInfo: function(var info: array of LIB_INFO): integer; + cdecl; + +var + ad_Handle: TLibHandle = dynlibs.NilHandle; + {$if defined(cpu32) and defined(windows)} // try load dependency if not in /windows/system32/ + gc_Handle :TLibHandle=dynlibs.NilHandle; + {$endif} + +var + ReferenceCounter: cardinal = 0; + +function ad_IsLoaded: Boolean; inline; + +function ad_Load(const libfilename: string): Boolean; + +procedure ad_Unload(); + + +implementation + +function ad_IsLoaded: Boolean; +begin + Result := (ad_Handle <> dynlibs.NilHandle); +end; + +procedure ad_Unload; +begin + // < Reference counting + if ReferenceCounter > 0 then + Dec(ReferenceCounter); + if ReferenceCounter > 0 then + Exit; + // > + if ad_IsLoaded then + begin + DynLibs.UnloadLibrary(ad_Handle); + ad_Handle := DynLibs.NilHandle; + {$if defined(cpu32) and defined(windows)} + if gc_Handle <> DynLibs.NilHandle then begin + DynLibs.UnloadLibrary(gc_Handle); + gc_Handle:=DynLibs.NilHandle; + end; + {$endif} + end; +end; + +function ad_Load(const libfilename: string): Boolean; +var + thelib, thelibgcc: string; +begin + Result := False; + if ad_Handle <> 0 then + begin + Inc(ReferenceCounter); + Result := True; {is it already there ?} + end + else + begin + {$if defined(cpu32) and defined(windows)} + if Length(libfilename) = 0 then thelibgcc := 'libgcc_s_dw2-1.dll' else + thelibgcc := IncludeTrailingBackslash(ExtractFilePath(libfilename)) + 'libgcc_s_dw2-1.dll'; + gc_Handle:= DynLibs.SafeLoadLibrary(thelibgcc); + {$endif} + {go & load the library} + if Length(libfilename) = 0 then + thelib := libfdk_aac + else + thelib := libfilename; + ad_Handle := DynLibs.SafeLoadLibrary(thelib); // obtain the handle we want + if ad_Handle <> DynLibs.NilHandle then + begin {now we tie the functions to the VARs from above} + + Pointer(aacDecoder_Fill) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_Fill')); + Pointer(aacDecoder_DecodeFrame) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_DecodeFrame')); + Pointer(aacDecoder_GetStreamInfo) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_GetStreamInfo')); + Pointer(aacDecoder_Open) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_Open')); + Pointer(aacDecoder_SetParam) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_SetParam')); + Pointer(aacDecoder_Close) := DynLibs.GetProcedureAddress(ad_Handle, PChar('aacDecoder_Close')); + + end; + Result := ad_IsLoaded; + ReferenceCounter := 1; + end; + +end; + +function TT_IS_PACKET(x: TRANSPORT_TYPE): Boolean; +begin + Result := ((x = TRANSPORT_TYPE.TT_MP4_RAW) or (x = TRANSPORT_TYPE.TT_DRM) or (x = TRANSPORT_TYPE.TT_MP4_LATM_MCP0) or (x = TRANSPORT_TYPE.TT_MP4_LATM_MCP1)); +end; + +function CAN_DO_PS(aot: AUDIO_OBJECT_TYPE): Boolean; +begin + Result := ((aot = AUDIO_OBJECT_TYPE.AOT_AAC_LC) or (aot = AUDIO_OBJECT_TYPE.AOT_SBR) or (aot = AUDIO_OBJECT_TYPE.AOT_PS) or (aot = AUDIO_OBJECT_TYPE.AOT_ER_BSAC) or (aot = AUDIO_OBJECT_TYPE.AOT_DRM_AAC)); +end; + +function IS_USAC(aot: AUDIO_OBJECT_TYPE): Boolean; +begin + Result := aot = AUDIO_OBJECT_TYPE.AOT_USAC; +end; + +function IS_LOWDELAY(aot: AUDIO_OBJECT_TYPE): Boolean; +begin + Result := (aot = AUDIO_OBJECT_TYPE.AOT_ER_AAC_LD) or (aot = AUDIO_OBJECT_TYPE.AOT_ER_AAC_ELD); +end; + +function IS_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; +begin + Result := (elementId = MP4_ELEMENT_ID.ID_SCE) or (elementId = MP4_ELEMENT_ID.ID_CPE) or (elementId = MP4_ELEMENT_ID.ID_LFE) or (elementId = MP4_ELEMENT_ID.ID_USAC_SCE) or + (elementId = MP4_ELEMENT_ID.ID_USAC_CPE) or (elementId = MP4_ELEMENT_ID.ID_USAC_LFE); +end; + +function IS_MP4_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; +begin + Result := (elementId = MP4_ELEMENT_ID.ID_SCE) or (elementId = MP4_ELEMENT_ID.ID_CPE) or (elementId = MP4_ELEMENT_ID.ID_LFE); +end; + +function IS_USAC_CHANNEL_ELEMENT(elementId: MP4_ELEMENT_ID): Boolean; +begin + Result := (elementId = MP4_ELEMENT_ID.ID_USAC_SCE) or (elementId = MP4_ELEMENT_ID.ID_USAC_CPE) or (elementId = MP4_ELEMENT_ID.ID_USAC_LFE); +end; + +function LIB_VERSION(lev0: byte; lev1: byte; lev2: byte): integer; +begin + Result := (lev0 shl 24) or (lev1 shl 16) or (lev2 shl 8); +end; + +function LIB_VERSION_STRING(info: LIB_INFO): string; +begin + Result := string(info.versionStr); + if info.versionStr = '' then + Result := Format('%d.%d.%d', [(info.versionStr), ((info.version shr 24) and $ff), ((info.version shr 16) and $ff), ((info.version shr 8) and $ff)]); +end; + +(** Initialize library info. *) +procedure FDKinitLibInfo(var info: array of LIB_INFO); +var + i: integer; +begin + for i := 0 to integer(FDK_MODULE_ID.FDK_MODULE_LAST) - 1 do + info[i].module_id := FDK_MODULE_ID.FDK_NONE; +end; + +(** Aquire supported features of library. *) +function FDKlibInfo_getCapabilities(const info: array of LIB_INFO; module_id: FDK_MODULE_ID): cardinal; +var + i: integer; +begin + Result := 0; + for i := 0 to integer(FDK_MODULE_ID.FDK_MODULE_LAST) - 1 do + if Info[i].module_id = module_id then + begin + Result := Info[i].flags; + break; + end; +end; + + +function FDKlibInfo_lookup(const info: array of LIB_INFO; module_id: FDK_MODULE_ID): integer; +var + i: integer; +begin + Result := -1; + for i := 0 to integer(FDK_MODULE_ID.FDK_MODULE_LAST) - 1 do + if Info[i].module_id = module_id then + begin + Result := -1; + Exit; + end + else if Info[i].module_id = FDK_MODULE_ID.FDK_NONE then + begin + Result := i; + Exit; + end + else if i = integer(FDK_MODULE_ID.FDK_MODULE_LAST) then + begin + Result := -1; + Exit; + end; +end; + + +end. + diff --git a/UOS/src/uos_flat.pas b/UOS/src/uos_flat.pas new file mode 100644 index 0000000..d69872e --- /dev/null +++ b/UOS/src/uos_flat.pas @@ -0,0 +1,2547 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{ License : modified LGPL. + Fred van Stappen fiens@hotmail.com } + +// This is the "Flat Layer" of uos => for universal methods. + +unit uos_flat; + +{$mode objfpc}{$H+}{$inline on} +{$PACKRECORDS C} + +// For custom configuration of directive to compiler ---> uos_define.inc +{$I uos_define.inc} + +interface + +uses + + {$IF DEFINED(Java)} + uos_jni, + {$endif} + + {$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + fpg_base, + {$ENDIF} + + ctypes, classes, math, SysUtils, uos; + + {$IF DEFINED(bs2b)} + const + BS2B_HIGH_CLEVEL = (CInt32(700)) or ((CInt32(30)) shl 16); + BS2B_MIDDLE_CLEVEL = (CInt32(500)) or ((CInt32(45)) shl 16); + BS2B_LOW_CLEVEL = (CInt32(360)) or ((CInt32(60)) shl 16); + { Easy crossfeed levels (Obsolete) } + BS2B_HIGH_ECLEVEL = (CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_MIDDLE_ECLEVEL = (CInt32(500)) or ((CInt32(72)) shl 16); + BS2B_LOW_ECLEVEL = (CInt32(360)) or ((CInt32(84)) shl 16); + BS2B_DEFAULT_CLEVEL = (CInt32(700)) or ((CInt32(45)) shl 16); + BS2B_CMOY_CLEVEL =(CInt32(700)) or ((CInt32(60)) shl 16); + BS2B_JMEIER_CLEVEL = (CInt32(650)) or ((CInt32(95)) shl 16); + {$endif} + +{$IF DEFINED(synthesizer)} +const +// musical note ==> frequency in hertz +// Latin: Do, Ré, Mi, Fa, Sol, La, Si +// Dièse = _d example la0_d +la0 = 55.0; +la0_d = 58.3; +si0 = 61.7; +do0 = 65.4; +do0_d = 69.3; +re0 = 73.4; +re0_d =77.8; +mi0 =82.4; +fa0 = 87.3; +fa0_d = 92.5; +sol0 = 98.0; +sol0_d = 103.8; +la1 = 110.0; +la1_d = 116.5; +si1 = 123.5; +do1 = 130.8; +do1_d = 138.6; +re1 = 146.8; +re1_d =155.6; +mi1 =164.8; +fa1 = 174.6; +fa1_d = 185.0; +sol1 = 196.0; +sol1_d = 207.7; +la2 = 220.0; +la2_d = 233.1; +si2 = 2246.9; +do2 = 261.6; +do2_d = 277.2; +re2 = 293.7; +re2_d =311.1; +mi2 =329.6; +fa2 = 349.2; +fa2_d = 370.0; +sol2 = 392.0; +sol2_d = 415.3; +la3 = 440.0; +la3_d = 466.2; +si3 = 493.9; +do3 = 523.3; +do3_d = 554.4; +re3 = 587.3; +re3_d = 622.3; +mi3 = 659.3; +fa3 = 698.5; +fa3_d = 740.0; +sol3 = 784.0; +sol3_d = 830.6; +la4 = 880.0; +la4_d = 932.4; +si4 = 987.8; +do4 = 1046.6; +do4_d = 1108.8; +re4 = 1174.6; +re4_d = 1244.6; +mi4 = 1318.6; +fa4 = 1397.0; +fa4_d = 1480.0; +sol4 = 1568.0; +sol4_d = 1661.2; +la5 = 1760.0; + +// English musique note +// A, B, C, D, E, F, G +a0 = 55.0; +a0_s = 58.3; +b0 = 61.7; +c0 = 65.4; +c0_s = 69.3; +d0 = 73.4; +d0_s =77.8; +e0 =82.4; +f0 = 87.3; +f0_s = 92.5; +g0 = 98.0; +g0_s = 103.8; +a1 = 110.0; +a1_s = 116.5; +b1 = 123.5; +c1 = 130.8; +c1_s = 138.6; +d1 = 146.8; +d1_s =155.6; +e1 =164.8; +f1 = 174.6; +f1_s = 185.0; +g1 = 196.0; +g1_s = 207.7; +a2 = 220.0; +a2_s = 233.1; +b2 = 2246.9; +c2 = 261.6; +c2_s = 277.2; +d2 = 293.7; +d2_s =311.1; +e2 =329.6; +f2 = 349.2; +f2_s = 370.0; +g2 = 392.0; +g2_s = 415.3; +a3 = 440.0; +a3_s = 466.2; +b3 = 493.9; +c3 = 523.3; +c3_s = 554.4; +d3 = 587.3; +d3_s = 622.3; +e3 = 659.3; +f3 = 698.5; +f3_s = 740.0; +g3 = 784.0; +g3_s = 830.6; +a4 = 880.0; +a4_s = 932.4; +b4 = 987.8; +c4 = 1046.6; +c4_s = 1108.8; +d4 = 1174.6; +d4_s = 1244.6; +e4 = 1318.6; +f4 = 1397.0; +f4_s = 1480.0; +g4 = 1568.0; +g4_s = 1661.2; +a5 = 1760.0; +{$endif} + + type + TDArFloat = array of cfloat; + + TDArShort = array of cInt16; + TDArLong = array of cInt32; + + TDArPARFloat = array of TDArFloat; + TDArIARFloat = array of TDArPARFloat; + + PDArFloat = ^TDArFloat; + PDArShort = ^TDArShort; + PDArLong = ^TDArLong; + + type + + {$if DEFINED(java)} + TProc = JMethodID ; + {$else} + TProc = procedure of object; + {$endif} + + type + {$if not defined(fs32bit)} + Tcount_t = cint64; { used for file sizes } + {$else} + Tcount_t = cint; + {$endif} + PMemoryStream = ^TmemoryStream; + + type + TuosF_Data = Tuos_Data; + TuosF_FFT = Tuos_FFT ; + TuosF_BufferInfos = Tuos_BufferInfos; + +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} + const + MSG_CUSTOM1 = FPGM_USER + 1; + {$ENDIF} + +// General public procedure/function (accessible for library uos too) + +function uos_GetInfoLibraries() : PChar ; + +function uos_Int16ToFloat32(Inbuf: TDArFloat): TDArFloat; +// convert buffer int16 into float32. + +{$IF DEFINED(portaudio)} +procedure uos_GetInfoDevice(); + +procedure uos_UpdateDevice(); + +function uos_GetInfoDeviceStr() : PChar ; +{$endif} + +function uos_TestLoadLibrary(Filename: Pchar): boolean; +// test a library to check if it can be loaded; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName, fdkaacFilename : PChar) : cint32; +// load libraries... if libraryfilename = nil => do not load it... You may load what and when you want... +// PortAudio => needed for dealing with audio-device input/output +// SndFile => needed for dealing with ogg, vorbis, flac and wav audio-files +// Mpg123 => needed for dealing with mp* audio-files +// Mp4ff and Faad => needed for dealing with acc, m4a audio-files +// opusfile => needed for dealing with opus audio-files +// XMPFileName => needed for dealing with mod files +// fdkaacFilename => needed for dealing with webstreamm aac files. + +// If you want to load libraries from system, replace it by "'system'" +// If some libraries are not needed, replace it by "nil", + +// for example : uos_loadlib('system', SndFileFileName, 'system', nil, nil, nil, OpusFileFileName, nil, nil) + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName : PChar) : cint32; +// The same but without fdkaac. (for compatibility with previous version) + +function uos_LoadLib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName: PChar) : cint32; +// The same but without fdkaac and libxmp. (for compatibility with previous version) + +procedure uos_unloadlib(); +// Unload all libraries... +procedure uos_free(); +// Free uos; +// To use when program terminate. Do not forget to call it before close application... + +procedure uos_unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: boolean); +// Custom Unload libraries... if true, then unload the library. You may unload what and when you want... + +function uos_loadPlugin(PluginName, PluginFilename: PChar) : cint32; +// load plugin... + +{$IF DEFINED(shout)} +function uos_LoadServerLib(ShoutFileName, OpusFileName : PChar) : cint32; +// Shout => needed for dealing with IceCast server +// Opus => needed for dealing with encoding opus stream + +procedure uos_unloadServerLib(); +// Unload server libraries... Do not forget to call it before close application... +{$endif} + +procedure uos_UnloadPlugin(PluginName: PChar); + +// PlayerIndex : from 0 to what your computer can do ! (depends of ram, cpu, soundcard, ...) +// If PlayerIndex already exists, it will be overwriten... +{$IF (FPC_FULLVERSION < 20701) and DEFINED(fpgui)} +function uos_CreatePlayer(PlayerIndex: cint32; AParent: TObject) : boolean; +{$else} +function uos_CreatePlayer(PlayerIndex: cint32): boolean; +{$endif} + +{$IF DEFINED(portaudio)} +function uos_AddIntoDevOut(PlayerIndex: cint32): cint32; + +// Add a Output into Device Output with custom parameters + function uos_AddIntoDevOut(PlayerIndex: cint32; Device: cint32; Latency: CDouble; + SampleRate: CDouble; Channels: cint32; SampleFormat: cint32 ; + FramesCount: cint32 ; ChunkCount: cint32): cint32; +// 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 (= 65536) +// ChunkCount : default : -1 (= 512) +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoDevOut(-1,-1,-1,-1,0,-1,-1); + {$endif} + +function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a input from audio file with default parameters + +function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32): cint32; +// Add a input from audio file with custom parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of audio file +// 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 (65536) +// result : Input Index in array -1 = error +// example : InputIndex1 := uos_AddFromFile(0, edit5.Text,-1,0); + +function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat) : cint32; +// Add a Output into memory buffer +// outmemory : pointer of buffer to use to store memory. +// example : OutputIndex1 := uos_AddIntoMemoryBuffer(0, pointer(bufmemory)); + +function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat; SampleRate: CDouble; SampleFormat: LongInt; + Channels: LongInt; FramesCount: LongInt): LongInt; +// Add a Output into memory buffer with custom parameters +// outmemory : pointer of buffer to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (0:float32) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 1024 * 2) + +function uos_AddIntoMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; + SampleRate: CDouble; SampleFormat: LongInt ; Channels: LongInt; FramesCount: LongInt; Audioformat: cint32): LongInt; +// Add a Output into TMemoryStream +// MemoryStream : the TMemoryStream to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 4096) +// AudioFormat : default : -1 (wav) (0:wav, 1:ogg); + +function uos_AddFromMemoryBuffer(PlayerIndex: cint32; MemoryBuffer: TDArFloat; Bufferinfos: Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// Add a input from memory buffer with custom parameters +// MemoryBuffer : the buffer +// Bufferinfos : infos of the buffer +// 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 ';')// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)// SampleRate : delault : -1 (44100)// FramesCount : default : -1 (4096) +// FramesCount : default : -1 (65536 div Channels) +// result : Input Index in array -1 = error +// example : InputIndex1 := AddFromMemoryBuffer(mybuffer, buffinfos,-1,1024); + +function uos_AddFromMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; + TypeAudio: cint32; OutputIndex: cint32; SampleFormat: cint32 ; FramesCount: cint32): cint32; +// 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 := AddFromMemoryStream(0, mymemorystream,-1,-1,0,1024); + +function uos_AddFromMemoryStreamDec(PlayerIndex: cint32; var MemoryStream: TMemoryStream; var Bufferinfos: Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// MemoryStream : Memory-stream of decoded audio (like created by AddIntoMemoryStream) +// Bufferinfos : infos of the Memory-stream +// 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 ';') +// FramesCount : default : -1 (4096) +// result : Input Index in array -1 = error + +function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a input from audio file with default parameters + +function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ; numbuf : cint): cint32; +// Add a input from audio file and store it into memory with custom parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of audio file +// 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 (65536) +// numbuf : number of buffer to add to outmemory (default : -1 = all, otherwise number max of buffers) +// result : Input Index in array -1 = error +// example : InputIndex1 := uos_AddFromFile(0, edit5.Text,-1,0,-1); + + {$IF DEFINED(shout)} +function uos_AddIntoIceServer(PlayerIndex: cint32; SampleRate : CDouble; Channels: cint; SampleFormat: cint; + EncodeType: cint; Port: cint; Host: pchar; User: pchar; Password: pchar; MountFile :pchar): cint32; +// Add a Output into a IceCast server for audio-web-streaming +// SampleRate : delault : -1 (48100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// EncodeType : default : -1 (0:Music) (0: Music, 1:Voice) +// SampleFormat : -1 default : float32 : (0:float32, 1:Int16) +// Port : default : -1 (= 8000) +// Host : default : 'def' (= '127.0.0.1') +// User : default : 'def' (= 'source') +// Password : default : 'def' (= 'hackme') +// MountFile : default : 'def' (= '/example.opus') +// result : Output Index in array -1 = error + {$endif} + +{$IF DEFINED(webstream)} +function uos_AddFromURL(PlayerIndex: cint32; URL: PChar): cint32; +// Add a Input from Audio URL with default parameters + +function uos_AddFromURL(PlayerIndex: cint32; URL: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32; AudioFormat: cint32 ; ICYon : boolean): cint32; +// Add a Input from Audio URL with custom parameters +// URL : URL of audio file +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output +// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : default : -1 (4096) +// AudioFormat : default : -1 (mp3) (0: mp3, 1: opus) +// example : InputIndex := AddFromURL(0,'http://someserver/somesound.mp3',-1,-1,-1,-1); +{$ENDIF} + +function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; + Channels: cint32; SampleFormat: cint32 ; FramesCount: cint32 ; FileFormat: cint32): cint32; +// Add a Output into audio wav file with custom parameters from TFileStream +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : default : -1 (2:Int16) (1:Int32, 2:Int16) +// FramesCount : default : -1 (= 65536) +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg); +// result :Output Index in array -1 = error +// example : OutputIndex1 := uos_AddIntoFile(0,edit5.Text,-1,-1, 0, 1); + +function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a Output into audio wav file with Default parameters from TFileStream +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file + +function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; + Channels: LongInt; SampleFormat: LongInt ; FramesCount: LongInt; FileFormat: cint32): LongInt; + // Add a Output into audio wav file with Custom parameters from TMemoryStream +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : -1 default : Int16 : (1:Int32, 2:Int16) +// FramesCount : -1 default : 65536 div channels +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom); +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoFileFromMem(0, edit5.Text,-1,-1,0, -1); + +function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a Output into audio wav file with Default parameters from TMemoryStream +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file + +{$IF DEFINED(portaudio)} +function uos_AddFromDevIn(PlayerIndex: cint32; Device: cint32; Latency: CDouble; + SampleRate: CDouble; OutputIndex: cint32; + SampleFormat: cint32; FramesCount : cint32; ChunkCount: cint32): cint32; +// Add a Input from Device Input with custom parameters +// PlayerIndex : Index of a existing Player +// Device ( -1 is default Input device ) +// Latency ( -1 is latency suggested ) +// SampleRate : delault : -1 (44100) +// 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) +// ChunkCount : default : -1 (= 512) +// result : Output Index in array +// example : OutputIndex1 := uos_AddFromDevIn(0,-1,-1,-1,-1,-1,-1); + +function uos_AddFromDevIn(PlayerIndex: cint32): cint32; +// Add a Input from Device Input with default parameters +// PlayerIndex : Index of a existing Player +{$endif} + +function uos_AddFromEndlessMuted(PlayerIndex: cint32; Channels : cint32; FramesCount: cint32): cint32; +// Add a input from Endless Muted dummy sine wav +// FramesCount = FramesCount of input-to-follow +// Channels = Channels of input-to-follow. + +{$IF DEFINED(synthesizer)} +function uos_AddFromSynth(PlayerIndex: cint32; Channels: integer; WaveTypeL, WaveTypeR: shortint; + FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; + duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32; + OutputIndex: cint32; SampleFormat: cint32 ; SampleRate: CDouble ; 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, 2= triangle, 3=sawtooth used for mono and stereo) +// WaveTypeR: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth 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 + +procedure uos_InputSetSynth(PlayerIndex: cint32; InputIndex: cint32; WaveTypeL, WaveTypeR: shortint; + FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; duration: cint32; + NbHarmonic: cint32; EvenHarmonics: cint32; Enable: boolean); +// InputIndex: one existing input index +// WaveTypeL: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth used for mono and stereo) +// WaveTypeR: default: -1 (0) (00 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth 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 ; +{$endif} + +procedure uos_BeginProc(PlayerIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute at begining, before loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_EndProc(PlayerIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute at end, after loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_EndProcOnly(PlayerIndex: cint32; Proc: TProconly); +// Assign the procedure (not of object) to execute at end, after loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_LoopBeginProc(PlayerIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute at begin of loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_LoopEndProc(PlayerIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute at end of loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_LoopProcIn(PlayerIndex: cint32; InIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute inside the loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input + +procedure uos_LoopProcOut(PlayerIndex: cint32; OutIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute inside the loop +// PlayerIndex : Index of a existing Player +// OutIndex : Index of a existing Output + +{$IF DEFINED(noiseremoval)} +procedure uos_InputAddDSPNoiseRemoval(PlayerIndex: cint32; InputIndex: cint32); + +procedure uos_InputSetDSPNoiseRemoval(PlayerIndex: cint32; InputIndex: cint32; Enable: boolean); + +procedure uos_OutputAddDSPNoiseRemoval(PlayerIndex: cint32; OutputIndex: cint32); + +procedure uos_OutputSetDSPNoiseRemoval(PlayerIndex: cint32; OutputIndex: cint32; Enable: boolean); +{$endif} + +function uos_InputAddDSP1ChanTo2Chan(PlayerIndex: cint32; InputIndex: cint32): cint32; +// Convert mono 1 channel input to stereo 2 channels input. +// Works only if the input is mono 1 channel othewise stereo 2 chan is keeped. +// InputIndex : InputIndex of a existing Input +// result : index of DSPIn in array +// example DSPIndex1 := InputAddDSP1ChanTo2Chan(InputIndex1); + +function uos_InputAddDSPVolume(PlayerIndex: cint32; InputIndex: cint32; VolLeft: double; + VolRight: double) : cint32 ; +// DSP Volume changer +// PlayerIndex : Index of a existing Player +// InputIndex : InputIndex of a existing Input +// VolLeft : Left volume +// VolRight : Right volume + // result : index of DSPIn in array +// example uos_InputAddDSPVolume(0,InputIndex1,1,1); + +procedure uos_OutputAddDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; VolLeft: double; + VolRight: double) ; +// DSP Volume changer +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// VolLeft : Left volume +// VolRight : Right volume +// result : -1 nothing created, otherwise index of DSPIn in array +// example DSPIndex1 := uos_OutputAddDSPVolume(0,oututIndex1,1,1); + +procedure uos_InputSetDSPVolume(PlayerIndex: cint32; InputIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); +// InputIndex : InputIndex of a existing Input +// PlayerIndex : Index of a existing Player +// VolLeft : Left volume +// VolRight : Right volume +// Enable : Enabled +// example uos_InputSetDSPVolume(0,InputIndex1,DSPIndex1,1,0.8,True); + +procedure uos_OutputSetDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); +// OutputIndex : OutputIndex of a existing Output +// PlayerIndex : Index of a existing Player +// VolLeft : Left volume +// VolRight : Right volume +// Enable : Enabled +// example uos_OutputSetDSPVolume(0,outputIndex1,DSPIndex1,1,0.8,True); + +function uos_InputAddDSP(PlayerIndex: cint32; InputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; Proc: TProc): cint32; +// add a DSP procedure for input +// PlayerIndex : Index of a existing Player +// InputIndex : Input Index of a existing input +// BeforeFunc : Function to do before the buffer is filled +// AfterFunc : Function to do after the buffer is filled +// EndedFunc : Function to do at end of thread +// LoopProc : external procedure of object to synchronize after DSP done +// result : -1 nothing created, otherwise index of DSPin in array (DSPinIndex) +// example : DSPinIndex1 := uos_InputAddDSP(0,InputIndex1,@beforereverse,@afterreverse,nil); + +procedure uos_InputSetDSP(PlayerIndex: cint32; InputIndex: cint32; DSPinIndex: cint32; Enable: boolean); +// PlayerIndex : Index of a existing Player +// InputIndex : Input Index of a existing input +// DSPIndexIn : DSP Index of a existing DSP In +// Enable : DSP enabled +// example : uos_InputSetDSP(0,InputIndex1,DSPinIndex1,True); + +function uos_OutputAddDSP(PlayerIndex: cint32; OutputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; Proc: TProc): cint32; +// usefull if multi output +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// BeforeFunc : Function to do before the buffer is filled +// AfterFunc : Function to do after the buffer is filled just before to give to output +// EndedFunc : Function to do at end of thread +// LoopProc : external procedure of object to synchronize after DSP done +// result : index of DSPout in array +// example :DSPoutIndex1 := uos_OutputAddDSP(0,OutputIndex1,nil,@volumeproc,nil,nil); + +procedure uos_OutputSetDSP(PlayerIndex: cint32; OutputIndex: cint32; DSPoutIndex: cint32; Enable: boolean); +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// DSPoutIndex : DSPoutIndex of existing DSPout +// Enable : DSP enabled +// example : uos_OutputSetDSP(0,OutputIndex1,DSPoutIndex1,True); + +function uos_InputAddFilter(PlayerIndex: cint32; InputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// 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 ) +// LoopProc : external procedure of object to synchronize after DSP done +// result : index of DSPIn in array + +function uos_InputGetBuffer(PlayerIndex: cint32; InputIndex: cint32): TDArFloat; +// Get current buffer + +procedure uos_InputSetFilter(PlayerIndex: cint32; InputIndex: cint32; FilterIndex: cint32; TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// 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 + +function uos_OutputAddFilter(PlayerIndex: cint32; OutputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// Output : InputIndex of a existing Output +// 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 +// result : index of DSPIn in array + +procedure uos_OutputSetFilter(PlayerIndex: cint32; OutputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// OuputIndex : InputIndex of a existing Output +// 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 + +function uos_AddPlugin(PlayerIndex: cint32; PlugName: PChar; SampleRate: CDouble; + Channels: cint32): cint32 ; +// Add a plugin , result is PluginIndex +// PlayerIndex : Index of a existing Player +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// 'soundtouch' and 'bs2b' PlugName is registred. + +{$IF DEFINED(soundtouch)} +procedure uos_SetPluginSoundTouch(PlayerIndex: cint32; PluginIndex: cint32; Tempo: cfloat; + Pitch: cfloat; Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +// PlayerIndex : Index of a existing Player + +procedure uos_SetPluginGetBPM(PlayerIndex: cint32; PluginIndex: cint32; numofframes: integer; loop : boolean; + Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +// numofframes: number of frames to analyse (-1 = 512 x frames) +// loop: do new detection after previous. +{$endif} + +{$IF DEFINED(bs2b)} +procedure uos_SetPluginBs2b(PlayerIndex: cint32; PluginIndex: cint32; + level: CInt32; fcut: CInt32; feed: CInt32; Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +{$endif} + +function uos_GetStatus(PlayerIndex: cint32) : cint32 ; +// Get the status of the player : -1 => error, 0 => has stopped, 1 => is running, 2 => is paused. + +procedure uos_InputSeek(PlayerIndex: cint32; InputIndex: cint32; pos: Tcount_t); +// change position in sample + +procedure uos_InputSeekSeconds(PlayerIndex: cint32; InputIndex: cint32; pos: cfloat); +// change position in seconds + +procedure uos_InputSeekTime(PlayerIndex: cint32; InputIndex: cint32; pos: TTime); +// change position in time format + +procedure uos_InputSetEnable(PlayerIndex: cint32; InputIndex: cint32; enabled: boolean); +// set enable true or false (usefull for multi input) + +procedure uos_OutputSetEnable(PlayerIndex: cint32; OutputIndex: cint32; enabled: boolean); +// set enable true or false (usefull for multi outputput) + +function uos_InputLength(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : Length of Input in samples + +function uos_InputLengthSeconds(PlayerIndex: cint32; InputIndex: cint32): cfloat; +// InputIndex : InputIndex of existing input +// result : Length of Input in seconds + +function uos_InputLengthTime(PlayerIndex: cint32; InputIndex: cint32): TTime; +// InputIndex : InputIndex of existing input +// result : Length of Input in time format + +function uos_InputPosition(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : current postion in sample + +procedure uos_InputSetFrameCount(PlayerIndex: cint32; InputIndex: cint32 ; framecount : cint32); +// set number of frames to be done. (usefull for recording and level precision) + +procedure uos_InputSetLevelEnable(PlayerIndex: cint32; InputIndex: cint32 ; enable : cint32); +// set level calculation (default is 0) +// InputIndex : InputIndex of existing input +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. +// 3 => calcul before and after all DSP procedures. + +procedure uos_InputSetPositionEnable(PlayerIndex: cint32; InputIndex: cint32 ; enable : cint32); +// set position calculation (default is 1) +// InputIndex : InputIndex of existing input +// 0 => no calcul +// 1 => calcul position. + +procedure uos_InputSetLevelArrayEnable(PlayerIndex: cint32; InputIndex: cint32 ; levelcalc : cint32); +// set add level calculation in level-array (default is 0) +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. + +function uos_InputGetLevelArray(PlayerIndex: cint32; InputIndex: cint32) : TDArFloat; + +function uos_InputGetLevelLeft(PlayerIndex: cint32; InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : left level(volume) from 0 to 1 + +function uos_InputGetLevelRight(PlayerIndex: cint32; InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : right level(volume) from 0 to 1 + +function uos_InputFiltersGetLevelString(PlayerIndex: cint32; InputIndex: cint32): string; +// InputIndex : InputIndex of existing input +// result : list of left|right levels separed by $ character + +function uos_InputFiltersGetLevelArray(PlayerIndex: cint32; InputIndex: cint32): TDArFloat; +// InputIndex : InputIndex of existing input +// result : array of float of each filter. + //in format levelfilter0left,levelfilter0right,levelfilter1left,levelfilter2right,... + +{$IF DEFINED(soundtouch)} +function uos_InputGetBPM(PlayerIndex: cint32; InputIndex: cint32): CDouble; +// InputIndex : InputIndex of existing input +// result : Beats per minuts +{$endif} + +function uos_InputPositionSeconds(PlayerIndex: cint32; InputIndex: cint32): float; +// InputIndex : InputIndex of existing input +// result : current postion of Input in seconds + +function uos_InputPositionTime(PlayerIndex: cint32; InputIndex: cint32): TTime; +// InputIndex : InputIndex of existing input +// result : current postion of Input in time format + +function uos_InputUpdateTag(PlayerIndex: cint32;InputIndex: cint32): boolean; +// for mp3 and opus files only + +{$IF DEFINED(webstream) and DEFINED(mpg123)} +function uos_InputUpdateICY(PlayerIndex: cint32; InputIndex: cint32; var icy_data : pchar): integer; +// for mp3 only +{$endif} + +function uos_InputGetTagTitle(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagArtist(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagAlbum(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagDate(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagComment(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagTag(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagTrack(PlayerIndex: cint32; InputIndex: cint32): pchar; +function uos_InputGetTagGenre(PlayerIndex: cint32; InputIndex: cint32): pchar; +// Tag infos + +function uos_InputGetSampleRate(PlayerIndex: cint32; InputIndex: cint32): CDouble; +// InputIndex : InputIndex of existing input +// result : default sample rate + +function uos_InputGetChannels(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : default channels + +procedure uos_PlayEx(PlayerIndex: cint32; no_free: Boolean; nloop: Integer; paused: boolean= false); +// Start playing with free at end as parameter and assign loop + +procedure uos_Play(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing + +Procedure uos_PlayPaused(PlayerIndex: cint32; nloop: Integer = 0) ;// Start play paused with loop + +Procedure uos_PlayNoFree(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing but do not free the player after stop + +Procedure uos_PlayNoFreePaused(PlayerIndex: cint32; nloop: Integer = 0) ;// Start play paused with loop but not free player at end + +Procedure uos_FreePlayer(PlayerIndex: cint32) ;// Works only when PlayNoFree() was used: free the player + +procedure uos_RePlay(PlayerIndex: cint32);// Resume playing after pause + +procedure uos_Stop(PlayerIndex: cint32);// Stop playing and free thread + +procedure uos_Pause(PlayerIndex: cint32);// Pause playing + +function uos_GetVersion() : cint32 ;// version of uos + +function uos_SetGlobalEvent(PlayerIndex: cint32; isenabled : boolean) : boolean; +// Set the RTL Events Global (will pause/start/replay all the players synchro with same rtl event)) +// result : true if set ok. + + {$IF DEFINED(soundtouch)} +function uos_GetBPM(TheBuffer: TDArFloat; Channels: cint32; SampleRate: CDouble) : CDouble; +// From SoundTouch plugin +{$endif} + +function uos_File2Buffer(Filename: Pchar; SampleFormat: cint32 ; var bufferinfos: Tuos_BufferInfos ; frompos : cint; numbuf : cint ): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max of frames) +// result : The memory buffer +// example : buffmem := uos_File2buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + +function uos_Stream2Buffer(AudioFile: TMemoryStream; SampleFormat: int32 ; var outmemory: TDArFloat; var bufferinfos: Tuos_BufferInfos ; frompos : cint; numbuf : cint): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max frames of buffers) +// result : The memory buffer +// example : buffmem := uos_Stream2Buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + +procedure uos_File2File(FilenameIN: Pchar; FilenameOUT: Pchar; SampleFormat: cint32 ; typeout: cint32 ); +// Create a audio file from a audio file. +// FileNameIN : filename of audio file IN (ogg, flac, wav, mp3, opus, aac,...) +// FileNameOUT : filename of audio file OUT (wav, pcm, custom) +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// typeout : Type of out file (-1:default=wav, 0:wav, 1:pcm, 2:custom) +// example : InputIndex1 := uos_File2File(edit5.Text,0,buffmem); + +procedure uos_MemStream2Wavfile(FileName: UTF8String; Data: TMemoryStream; BitsPerSample, chan : integer; + samplerate: CDouble); +// Create a audio wav file from a TMemoryStream. +// FileName : filename of wav saved file +// data : the memorystream +// BitsPerSample : 16 or 32 (bit) +// chan : number of channels +// samplerate : sample rate + +procedure uos_CustBufferInfos(var bufferinfos: Tuos_BufferInfos; SampleRate: CDouble; SampleFormat : cint32; Channels: cint32 ; Length: cint32); +// to initialize a custom bufferinfos: needed for AddFromMemoryBuffer() if no bufferinfos was created. +// all infos refer to the buffer used ---> length = length of the buffer div channels. + +var + uosDeviceInfos: array of Tuos_DeviceInfos; + uosLoadResult: Tuos_LoadResult; + uosDeviceCount: cint32; + uosDefaultDeviceIn: cint32; + uosDefaultDeviceOut: cint32; + //firstload : boolean = true; + +implementation + +function PlayersNotFree: Boolean; +Var + i: Integer; +begin + if uosPlayersStat <> nil then + for i:= 0 to Length(uosPlayersStat)-1 do + if uosPlayersStat[i] <> -1 then + begin + Result:= True; + Exit; + end; + Result:= False; +end; + +function PlayerNotFree(indexplayer : integer): Boolean; +begin + if uosPlayersStat <> nil then + if uosPlayersStat[indexplayer] <> -1 then + begin + Result:= True; + Exit; + end; + Result:= False; +end; + +{$IF DEFINED(noiseremoval)} +procedure uos_InputAddDSPNoiseRemoval(PlayerIndex: cint32; InputIndex: cint32); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].StreamIn[InputIndex].data.DSPNoiseIndex := + uosPlayers[PlayerIndex].InputAddDSPNoiseRemoval(InputIndex); +end; + +procedure uos_InputSetDSPNoiseRemoval(PlayerIndex: cint32; InputIndex: cint32; Enable: boolean); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].InputSetDSPNoiseRemoval(InputIndex, Enable); +end; + +procedure uos_OutputAddDSPNoiseRemoval(PlayerIndex: cint32; OutputIndex: cint32); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].StreamOut[OutputIndex].data.DSPNoiseIndex := + uosPlayers[PlayerIndex].OutputAddDSPNoiseRemoval(OutputIndex); +end; + +procedure uos_OutputSetDSPNoiseRemoval(PlayerIndex: cint32; OutputIndex: cint32; Enable: boolean); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].OutputSetDSPNoiseRemoval(OutputIndex, Enable); +end; +{$endif} + +function uos_SetGlobalEvent(PlayerIndex: cint32; isenabled : boolean) : boolean; +// Set the RTL Events Global (will pause/start/replay all the players synchro with same rtl event)) +// result : true if set ok. +begin +result := false; +if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].SetGlobalEvent(isenabled); +end; + +function uos_InputAddDSPVolume(PlayerIndex: cint32; InputIndex: cint32; VolLeft: double; + VolRight: double) : cint32; +begin +result:= -1; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + begin + uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.DSPVolumeIndex := uosPlayers[PlayerIndex].InputAddDSPVolume(InputIndex, VolLeft, VolRight); + result := uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.DSPVolumeIndex; + end; +end; +// DSP Volume changer +// PlayerIndex : Index of a existing Player +// InputIndex : InputIndex of a existing Input +// VolLeft : Left volume +// VolRight : Right volume +// result : -1 nothing created, otherwise index of DSPIn in array +// example DSPIndex1 := uos_InputAddDSPVolume(0,InputIndex1,1,1); + +procedure uos_OutputAddDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; VolLeft: double; + VolRight: double); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].StreamOut[OutputIndex].Data.DSPVolumeIndex := uosPlayers[PlayerIndex].OutputAddDSPVolume(OutputIndex, VolLeft, VolRight); +end; +// DSP Volume changer +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// VolLeft : Left volume +// VolRight : Right volume +// result : -1 nothing created, otherwise index of DSPIn in array +// example DSPIndex1 := uos_OutputAddDSPVolume(0,InputIndex1,1,1); + +procedure uos_InputSetDSPVolume(PlayerIndex: cint32; InputIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].InputSetDSPVolume(InputIndex, uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.DSPVolumeIndex, VolLeft, VolRight, Enable); +end; +// InputIndex : InputIndex of a existing Input +// PlayerIndex : Index of a existing Player +// VolLeft : Left volume +// VolRight : Right volume +// Enable : Enabled +// example uos_InputSetDSPVolume(0,InputIndex1,1,0.8,True); + +procedure uos_OutputSetDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; + VolLeft: double; VolRight: double; Enable: boolean); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].OutputSetDSPVolume(OutputIndex, uosPlayers[PlayerIndex].StreamOut[OutputIndex].Data.DSPVolumeIndex, VolLeft, VolRight, Enable); +end; +// OutputIndex : OutputIndex of a existing Output +// PlayerIndex : Index of a existing Player +// VolLeft : Left volume +// VolRight : Right volume +// Enable : Enabled +// example uos_OutputSetDSPVolume(0,InputIndex1,1,0.8,True); + +{$IF DEFINED(webstream) and DEFINED(mpg123)} +function uos_InputUpdateICY(PlayerIndex: cint32; InputIndex: cint32; var icy_data : pchar): integer; +// for mp3 only +begin + Result := -1; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputUpdateICY(InputIndex, icy_data) ; + end; +{$endif} + +function uos_InputUpdateTag(PlayerIndex: cint32;InputIndex: cint32): boolean; +// for mp3 and opus files only + begin + Result := false; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputUpdateTag(InputIndex) ; + end; + +function uos_InputGetTagTitle(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagTitle(InputIndex) ; + end; + +function uos_InputGetTagArtist(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result :=nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagArtist(InputIndex) ; + end; + +function uos_InputGetTagAlbum(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagAlbum(InputIndex) ; + end; + +function uos_InputGetTagComment(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagComment(InputIndex) ; + end; + +function uos_InputGetTagTag(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagTag(InputIndex) ; + end; + +function uos_InputGetTagTrack(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagTrack(InputIndex) ; + end; + +function uos_InputGetTagGenre(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagGenre(InputIndex) ; + end; + +function uos_InputGetTagDate(PlayerIndex: cint32; InputIndex: cint32): pchar; + begin + Result := nil; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputGetTagDate(InputIndex) ; + end; + +function uos_InputAddDSP(PlayerIndex: cint32; InputIndex: cint32; BeforeFunc : TFunc; + AfterFunc: TFunc; EndedFunc: TFunc; Proc: TProc): cint32; +// add a DSP procedure for input +// PlayerIndex : Index of a existing Player +// InputIndex : Input Index of a existing input +// BeforeFunc : Function to do before the buffer is filled +// AfterFunc : Function to do after the buffer is filled +// EndedFunc : Function to do at end of thread +// LoopProc : external procedure to do after the buffer is filled +// result : index of DSPin in array (DSPinIndex) +// example : DSPinIndex1 := uos_InputAddDSP(0,InputIndex1,@beforereverse,@afterreverse,nil); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputAddDSP(InputIndex, BeforeFunc, AfterFunc, EndedFunc, Proc) ; +end; + +procedure uos_InputSetDSP(PlayerIndex: cint32; InputIndex: cint32; DSPinIndex: cint32; Enable: boolean); +// PlayerIndex : Index of a existing Player +// InputIndex : Input Index of a existing input +// DSPIndexIn : DSP Index of a existing DSP In +// Enable : DSP enabled +// example : uos_InputSetDSP(0,InputIndex1,DSPinIndex1,True); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].InputSetDSP(InputIndex, DSPinIndex, Enable) ; +end; + +function uos_OutputAddDSP(PlayerIndex: cint32; OutputIndex: cint32; BeforeFunc: TFunc; + AfterFunc: TFunc; EndedFunc : TFunc; Proc: TProc): cint32;// usefull if multi output +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// BeforeFunc : Function to do before the buffer is filled +// AfterFunc : Function to do after the buffer is filled just before to give to output +// EndedFunc : Function to do at end of thread +// LoopProc : external procedure to do after the buffer is filled +// result :index of DSPout in array +// example :DSPoutIndex1 := uos_OutputAddDSP(0,OutputIndex1,@volumeproc,nil,nil); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].OutputAddDSP(OutputIndex, BeforeFunc, AfterFunc, EndedFunc, Proc) ; +end; + +procedure uos_OutputSetDSP(PlayerIndex: cint32; OutputIndex: cint32; DSPoutIndex: cint32; Enable: boolean); +// PlayerIndex : Index of a existing Player +// OutputIndex : OutputIndex of a existing Output +// DSPoutIndex : DSPoutIndex of existing DSPout +// Enable : DSP enabled +// example : uos_OutputSetDSP(0,OutputIndex1,DSPoutIndex1,True); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].OutputSetDSP(OutputIndex, DSPoutIndex, Enable) ; +end; + +function uos_InputAddFilter(PlayerIndex: cint32; InputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// 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 +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +result := uosPlayers[PlayerIndex].InputAddFilter(InputIndex, + TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, AlsoBuf, LoopProc) ; +end; + +procedure uos_InputSetFilter(PlayerIndex: cint32; InputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// 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 + +begin +if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetFilter(InputIndex, FilterIndex, + TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, + AlsoBuf, LoopProc, Enable); +end; + +function uos_OutputAddFilter(PlayerIndex: cint32; OutputIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc): cint32; +// Output : InputIndex of a existing Output +// 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 +// result : index of DSPIn in array +begin + result := -1 ; +if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + +result := uosPlayers[PlayerIndex].OutputAddFilter(OutputIndex, + TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, AlsoBuf, LoopProc) ; + +end; + +procedure uos_OutputSetFilter(PlayerIndex: cint32; OutputIndex: cint32; FilterIndex: cint32; + TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; + TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; + AlsoBuf: boolean; LoopProc: TProc; Enable: boolean); +// OuputIndex : InputIndex of a existing Output +// 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 +begin +if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].OutputSetFilter(OutputIndex, FilterIndex, + TypeFilterL, LowFrequencyL, HighFrequencyL, GainL, + TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, + AlsoBuf, LoopProc, Enable); +end; + +{$IF DEFINED(portaudio)} +function uos_AddFromDevIn(PlayerIndex: cint32; Device: cint32; Latency: CDouble; + SampleRate: CDouble; OutputIndex: cint32; + SampleFormat: cint32; FramesCount : cint32; ChunkCount: cint32): cint32; +// Add a Input from Device Input with custom parameters +// PlayerIndex : Index of a existing Player +// Device ( -1 is default Input device ) +// Latency ( -1 is latency suggested ) ) +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// 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 (65536) +// ChunkCount : default : -1 (= 512) +// result : Output Index in array , -1 is error +// example : OutputIndex1 := uos_AddFromDevIn(0,-1,-1,-1,-1,-1,-1); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromDevIn(Device, Latency, SampleRate, OutputIndex, + SampleFormat, FramesCount, ChunkCount) ; +end; + +function uos_AddFromDevIn(PlayerIndex: cint32): cint32; +// Add a Input from Device Input with custom parameters +// PlayerIndex : Index of a existing Player +begin +result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromDevIn(-1, -1, -1, -1, -1, -1, -1) ; +end; +{$endif} + +function uos_AddFromEndlessMuted(PlayerIndex: cint32; Channels : cint32; FramesCount: cint32): cint32; +// Add a input from Endless Muted dummy sine wav +// FramesCount = FramesCount of input-to-follow +// Channels = Channels of input-to-follow. + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromEndlessMuted(Channels, FramesCount) ; +end; + +{$IF DEFINED(synthesizer)} +function uos_AddFromSynth(PlayerIndex: cint32; Channels: integer; WaveTypeL, WaveTypeR: shortint; + FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; + duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32; + OutputIndex: cint32; SampleFormat: cint32 ; SampleRate: CDouble ; 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, 2= triangle, 3=sawtooth used for mono and stereo) +// WaveTypeR: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth 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 + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromSynth(Channels,WaveTypeL, WaveTypeR, FrequencyL, + FrequencyR, VolumeL, VolumeR, Duration, NbHarmonics, EvenHarmonics, OutputIndex, + SampleFormat, SampleRate, FramesCount) ; +end; + +procedure uos_InputSetSynth(PlayerIndex: cint32; InputIndex: cint32; WaveTypeL, WaveTypeR: shortint; + 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, 2= triangle, 3=sawtooth used for mono and stereo) +// WaveTypeR: do not change: -1 (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth 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; + + begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetSynth(InputIndex, WaveTypeL, WaveTypeR , + FrequencyL, FrequencyR, VolumeL, VolumeR, Duration, NbHarmonic, EvenHarmonics, Enable) ; +end; +{$endif} + +function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; + Channels: cint32; SampleFormat: cint32 ; FramesCount: cint32 ; FileFormat: cint32): cint32; +// Add a Output into audio wav file with custom parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : default : -1 (2:Int16) (1:Int32, 2:Int16) +// FramesCount : default : -1 (= 65536) +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg); +// result :Output Index in array -1 = error +// example : OutputIndex1 := uos_AddIntoFile(0,edit5.Text,-1,-1, 0, 1); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoFile(Filename, SampleRate, Channels, SampleFormat, FramesCount, FileFormat); +end; + +function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a Output into audio wav file with Default parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoFile(Filename, -1, -1, -1, -1, -1); +end; + +function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; + Channels: LongInt; SampleFormat: LongInt ; FramesCount: LongInt; FileFormat: cint32): LongInt; +// Add a Output into audio wav file with Custom parameters +// FileName : filename of saved audio wav file +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// SampleFormat : -1 default : Int16 : (1:Int32, 2:Int16) +// FramesCount : -1 default : 65536 div channels +// FileFormat : default : -1 (wav) (0:wav, 1:pcm, 2:custom); +// result : Output Index in array -1 = error +// example : OutputIndex1 := AddIntoFileFromMem(edit5.Text,-1,-1,0, -1,-1); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoFileFromMem(Filename, SampleRate, Channels, SampleFormat, FramesCount, FileFormat); +end; + +function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a Output into audio wav file with Default parameters from TMemoryStream +// PlayerIndex : Index of a existing Player +// FileName : filename of saved audio wav file + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoFileFromMem(Filename, -1, -1, -1, -1, -1); +end; + + {$IF DEFINED(shout)} +function uos_AddIntoIceServer(PlayerIndex: cint32; SampleRate : CDouble; Channels: cint; SampleFormat: cint; + EncodeType: cint; Port: cint; Host: pchar; User: pchar; Password: pchar; MountFile :pchar): cint32; +// Add a Output into a IceCast server for audio-web-streaming// SampleRate : delault : -1 (48100) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// EncodeType : default : -1 (0:Music) (0: Music, 1:Voice) +// SampleFormat : -1 default : float32 : (0:float32, 1:Int16) +// Port : default : -1 (= 8000) +// Host : default : 'def' (= '127.0.0.1') +// User : default : 'def' (= 'source') +// Password : default : 'def' (= 'hackme') +// MountFile : default : 'def' (= '/example.opus') +// result : Output Index in array -1 = error + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoIceServer(SampleRate, Channels, SampleFormat, EncodeType, Port, + Host, User, Password, MountFile ); +end; + {$endif} + +{$IF DEFINED(portaudio)} + function uos_AddIntoDevOut(PlayerIndex: cint32; Device: cint32; Latency: CDouble; + SampleRate: CDouble; Channels: cint32; SampleFormat: cint32 ; + FramesCount: cint32 ; ChunkCount: cint32): cint32; +// Add a Output into Device Output with custom parameters +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoDevOut(Device, Latency, SampleRate, Channels, SampleFormat , FramesCount, ChunkCount); +end; + +function uos_AddIntoDevOut(PlayerIndex: cint32): cint32; +// Add a Output into Device Output with default parameters +begin + Result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoDevOut(-1, -1, -1, -1, -1 ,-1, -1); +end; +{$endif} + +function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32): cint32; +// Add a input from audio file with custom parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of audio file +// 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 (65536) +// result : Input Index in array -1 = error +// example : InputIndex1 := AddFromFile(0, edit5.Text,-1,-1); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromFile(Filename, OutputIndex, SampleFormat, FramesCount); +end; + +function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a input from audio file with default parameters +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromFile(Filename, -1, -1, -1); +end; + +function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat) : cint32; +// Add a Output into memory buffer +// outmemory : pointer of buffer to use to store memory. +// example : OutputIndex1 := uos_AddIntoMemoryBuffer(0, pointer(bufmemory)); + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoMemoryBuffer(outmemory); +end; + +function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat; SampleRate: CDouble; SampleFormat: LongInt; + Channels: LongInt; FramesCount: LongInt): LongInt; +// Add a Output into memory buffer +// outmemory : pointer of buffer to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (0:float32) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 1024 * 2) + begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoMemoryBuffer(outmemory, SampleRate,SampleFormat,Channels,FramesCount); +end; + +function uos_AddIntoMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; +SampleRate: CDouble; SampleFormat: LongInt ; Channels: LongInt; FramesCount: LongInt; Audioformat: cint32): LongInt; +// Add a Output into TMemoryStream +// MemoryStream : the TMemoryStream to use to store memory. +// SampleRate : delault : -1 (44100) +// SampleFormat : default : -1 (2:Int16) ( 1:Int32, 2:Int16) +// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...) +// FramesCount : default : -1 (= 4096) +// AudioFormat : default : -1 (wav) (0:wav, 1:ogg); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddIntoMemoryStream(MemoryStream, + SampleRate,SampleFormat,Channels,FramesCount, AudioFormat); +end; + +function uos_AddFromMemoryBuffer(PlayerIndex: cint32; MemoryBuffer: TDArFloat; Bufferinfos: Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// Add a input from memory buffer with custom parameters +// MemoryBuffer : the buffer +// Bufferinfos : infos of the buffer +// 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 ';')// Channels : delault : -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)// SampleRate : delault : -1 (44100)// FramesCount : default : -1 (4096) +// FramesCount : default : -1 (65536 div Channels) +// result : Input Index in array -1 = error +// example : InputIndex1 := AddFromMemoryBuffer(mybuffer, buffinfos,-1,1024); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromMemoryBuffer(MemoryBuffer, Bufferinfos, OutputIndex, FramesCount); +end; + +function uos_AddFromMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; + TypeAudio: cint32; OutputIndex: cint32; SampleFormat: cint32 ; FramesCount: cint32): cint32; +// 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 := AddFromMemoryStream(0, mymemorystream,-1,-1,0,1024); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromMemoryStream(MemoryStream, TypeAudio, OutputIndex, SampleFormat, FramesCount); +end; + +function uos_AddFromMemoryStreamDec(PlayerIndex: cint32; var MemoryStream: TMemoryStream; var Bufferinfos: Tuos_bufferinfos; + OutputIndex: cint32; FramesCount: cint32): cint32; +// MemoryStream : Memory-stream of decoded audio (like created by AddIntoMemoryStream) +// Bufferinfos : infos of the Memory-stream +// 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 ';') +// FramesCount : default : -1 (4096) +// result : Input Index in array -1 = error +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromMemoryStreamDec(MemoryStream, Bufferinfos, OutputIndex, FramesCount); +end; + +function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32 ; numbuf : cint): cint32; +// Add a input from audio file and store it into memory with custom parameters +// PlayerIndex : Index of a existing Player +// FileName : filename of audio file +// 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 (65536) +// result : Input Index in array -1 = error +// example : InputIndex1 := uos_AddFromFileIntoMemory(0, edit5.Text, -1, 0, -1); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromFileIntoMemory(Filename, OutputIndex, SampleFormat, FramesCount, numbuf); +end; + +function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar): cint32; +// Add a input from audio file and store it into memory with default parameters +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromFileIntoMemory(Filename, -1, -1, -1, -1); +end; + +{$IF DEFINED(webstream)} +function uos_AddFromURL(PlayerIndex: cint32; URL: PChar; OutputIndex: cint32; + SampleFormat: cint32 ; FramesCount: cint32; AudioFormat: cint32 ; ICYon : boolean): cint32; +// Add a Input from Audio URL +// URL : URL of audio file +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output +// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : default : -1 (4096) +// AudioFormat : default : -1 (mp3) (0: mp3, 1: opus) +// ICYon : ICY data on/off +// Add a Input from Audio URL +// URL : URL of audio file (like 'http://someserver/somesound.mp3') +// OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output +// SampleFormat : -1 default : Int16 (0: Float32, 1:Int32, 2:Int16) +// FramesCount : default : -1 (65536) +// AudioFormat : default : -1 (mp3) (0: mp3, 1: opus) +// example : InputIndex := uos_AddFromURL('http://someserver/somesound.mp3',-1,-1,-1,-1, false); +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromURL(URL, OutputIndex, SampleFormat, FramesCount, AudioFormat , ICYon); +end; + +function uos_AddFromURL(PlayerIndex: cint32; URL: PChar): cint32; +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddFromURL(URL, -1, -1, -1, -1, false); +end; +{$ENDIF} + +function uos_AddPlugin(PlayerIndex: cint32; PlugName: PChar; SampleRate: CDouble; + Channels: cint32): cint32; +// Add a plugin , result is PluginIndex +// PlayerIndex : Index of a existing Player +// SampleRate : delault : -1 (44100) +// Channels : delault : -1 (2:stereo) (1:mono, 2:stereo, ...) +// 'soundtouch' and 'bs2b' PlugName are registred. +begin + result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + Result := uosPlayers[PlayerIndex].AddPlugin(PlugName, SampleRate, Channels); +end; + +{$IF DEFINED(soundtouch)} +procedure uos_SetPluginSoundTouch(PlayerIndex: cint32; PluginIndex: cint32; Tempo: cfloat; + Pitch: cfloat; Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +// PlayerIndex : Index of a existing Player +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].SetPluginSoundTouch(PluginIndex, Tempo, Pitch, Enable); +end; + +procedure uos_SetPluginGetBPM(PlayerIndex: cint32; PluginIndex: cint32; numofframes: integer; loop : boolean; + Enable: boolean); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].SetPluginGetBPM(PluginIndex, numofframes, loop, Enable); +end; + +{$endif} + +{$IF DEFINED(bs2b)} + procedure uos_SetPluginBs2b(PlayerIndex: cint32; PluginIndex: cint32; level: CInt32; fcut: CInt32; + feed: CInt32; Enable: boolean); +// PluginIndex : PluginIndex Index of a existing Plugin. +// PlayerIndex : Index of a existing Player +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].SetPluginBs2b(PluginIndex, level, fcut, feed, Enable); +end; +{$endif} + +procedure uos_InputSeek(PlayerIndex: cint32; InputIndex: cint32; pos: Tcount_t); +// change position in sample +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSeek(InputIndex, pos); +end; + +function uos_GetStatus(PlayerIndex: cint32) : cint32 ; +// Get the status of the player : -1 => error, 0 => has stopped, 1 => is running, 2 => is paused. +begin +result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if assigned(uosPlayers[PlayerIndex]) then + begin + if uosPlayersStat[PlayerIndex] = 1 then + result := uosPlayers[PlayerIndex].Status else result := -1 ; + end else result := -1 ; +end; + +procedure uos_InputSeekSeconds(PlayerIndex: cint32; InputIndex: cint32; pos: cfloat); +// change position in seconds +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSeekSeconds(InputIndex, pos); +end; + +procedure uos_InputSeekTime(PlayerIndex: cint32; InputIndex: cint32; pos: TTime); +// change position in time format +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSeekTime(InputIndex, pos); +end; + +function uos_InputGetBuffer(PlayerIndex: cint32; InputIndex: cint32): TDArFloat; +// Get current buffer +begin +//{ + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputGetBuffer(InputIndex) ; +// } +end; + +function uos_InputLength(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : Length of Input in samples +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputLength(InputIndex) ; +end; + +function uos_InputLengthSeconds(PlayerIndex: cint32; InputIndex: cint32): cfloat; +// InputIndex : InputIndex of existing input +// result : Length of Input in seconds +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputLengthSeconds(InputIndex) ; +end; + +function uos_InputLengthTime(PlayerIndex: cint32; InputIndex: cint32): TTime; +// InputIndex : InputIndex of existing input +// result : Length of Input in time format +begin +Result := sysutils.EncodeTime(0, 0, 0, 0); + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputLengthTime(InputIndex) ; +end; + +function uos_InputPosition(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : current postion in sample +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputPosition(InputIndex) ; +end; + +procedure uos_InputSetFrameCount(PlayerIndex: cint32; InputIndex: cint32 ; framecount : cint32); +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetFrameCount(InputIndex, framecount) ; +end; + +procedure uos_InputSetLevelEnable(PlayerIndex: cint32; InputIndex: cint32 ; enable : cint32); +// set level calculation (default is 0) +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. +// 3 => calcul before and after all DSP procedures. + +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetLevelEnable(InputIndex, enable) ; +end; + +procedure uos_InputSetEnable(PlayerIndex: cint32; InputIndex: cint32; enabled: boolean); +// set enable true or false +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetEnable(InputIndex, enabled) ; +end; + +procedure uos_OutputSetEnable(PlayerIndex: cint32; OutputIndex: cint32; enabled: boolean); +// set enable true or false (usefull for multi outputput) +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].OutputSetEnable(OutputIndex, enabled) ; +end; + +procedure uos_InputSetPositionEnable(PlayerIndex: cint32; InputIndex: cint32 ; enable : cint32); +// set position calculation (default is 0) +// 0 => no calcul +// 1 => calcul position. +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetPositionEnable(InputIndex, enable) ; +end; + +procedure uos_InputSetLevelArrayEnable(PlayerIndex: cint32; InputIndex: cint32 ; levelcalc : cint32); +// set add level calculation in level-array (default is 0) +// 0 => no calcul +// 1 => calcul before all DSP procedures. +// 2 => calcul after all DSP procedures. +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].InputSetLevelArrayEnable(InputIndex, levelcalc) ; +end; + +function uos_InputGetLevelArray(PlayerIndex: cint32; InputIndex: cint32) : TDArFloat; +begin + result := uosLevelArray[PlayerIndex][InputIndex] ; +end; + +function uos_InputGetLevelLeft(PlayerIndex: cint32; InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : left level(volume) from 0 to 1 +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputGetLevelLeft(InputIndex) ; +end; + +function uos_InputFiltersGetLevelString(PlayerIndex: cint32 ; InputIndex: cint32): string; +// InputIndex : InputIndex of existing input +// filterIndex : Filterindex of existing filter +// result : list of left|right levels separed by $ character +begin + result := ''; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputFiltersGetLevelString(InputIndex) ; +end; + +function uos_InputFiltersGetLevelArray(PlayerIndex: cint32; InputIndex: cint32): TDArFloat; +// InputIndex : InputIndex of existing input +// result : array of float of each filter. + //in format levelfilter0left,levelfilter0right,levelfilter1left,levelfilter2right,.. +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputFiltersGetLevelArray(InputIndex) ; +end; + +function uos_InputGetSampleRate(PlayerIndex: cint32; InputIndex: cint32): CDouble; +// InputIndex : InputIndex of existing input +// result : default sample rate +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) and + (length(uosPlayers[PlayerIndex].StreamIn) > 0) and (InputIndex +1 <= length(uosPlayers[PlayerIndex].StreamIn)) + then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.SamplerateRoot; +end; + +function uos_InputGetChannels(PlayerIndex: cint32; InputIndex: cint32): cint32; +// InputIndex : InputIndex of existing input +// result : default channels +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) and + (length(uosPlayers[PlayerIndex].StreamIn) > 0) and (InputIndex +1 <= length(uosPlayers[PlayerIndex].StreamIn)) + then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.Channels; +end; + +function uos_InputGetLevelRight(PlayerIndex: cint32; InputIndex: cint32): double; +// InputIndex : InputIndex of existing input +// result : right level(volume) from 0 to 1 +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputGetLevelRight(InputIndex) ; +end; + +{$IF DEFINED(soundtouch)} +function uos_InputGetBPM(PlayerIndex: cint32; InputIndex: cint32): CDouble; +// InputIndex : InputIndex of existing input +// result : Beats per minuts +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputGetBPM(InputIndex) ; +end; +{$endif} + +function uos_InputPositionSeconds(PlayerIndex: cint32; InputIndex: cint32): float; +// InputIndex : InputIndex of existing input +// result : current postion of Input in seconds +begin + result := 0; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputPositionSeconds(InputIndex) ; +end; + +function uos_InputPositionTime(PlayerIndex: cint32; InputIndex: cint32): TTime; +// InputIndex : InputIndex of existing input +// result : current postion of Input in time format +begin +Result := sysutils.EncodeTime(0, 0, 0, 0); + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputPositionTime(InputIndex) ; +end; + +function uos_InputAddDSP1ChanTo2Chan(PlayerIndex: cint32; InputIndex: cint32): cint32; +// Convert mono 1 channel input to stereo 2 channels input. +// Works only if the input is mono 1 channel othewise stereo 2 chan is keeped. +// InputIndex : InputIndex of a existing Input +// result : index of DSPIn in array +// example DSPIndex1 := InputAddDSP1ChanTo2Chan(InputIndex1); +begin +Result := -1 ; + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + result := uosPlayers[PlayerIndex].InputAddDSP1ChanTo2Chan(InputIndex) ; +end; + +Procedure uos_PlayEx(PlayerIndex: cint32; + no_free: Boolean; nloop: Integer; paused: boolean= false);// Start playing with free at end as parameter and assign loop + +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].PlayEx(no_free,nloop, paused ) ; +end; + +Procedure uos_Play(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uos_PlayEx(PlayerIndex, False,nloop); +end; + +Procedure uos_PlayPaused(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing paused +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uos_PlayEx(PlayerIndex, False,nloop,true); +end; + +Procedure uos_PlayNoFree(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing but do not free the player after stop +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uos_PlayEx(PlayerIndex, True,nloop); +end; + +Procedure uos_PlayNoFreePaused(PlayerIndex: cint32; nloop: Integer = 0) ;// Start playing paused but do not free the player after stop +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uos_PlayEx(PlayerIndex, True,nloop, true); +end; + +Procedure uos_FreePlayer(PlayerIndex: cint32) ; +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].FreePlayer() ; +end; + +procedure uos_RePlay(PlayerIndex: cint32);// Resume playing after pause +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].RePlay() ; +end; + +procedure uos_Stop(PlayerIndex: cint32);// Stop playing and if uos_Play() was used: free the player +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + begin +uosPlayers[PlayerIndex].Stop(); +{$IF DEFINED(mse)} + freeandnil(uosPlayers[PlayerIndex]); + uosPlayersStat[PlayerIndex] := -1 ; +{$endif} +end; +end; + +procedure uos_Pause(PlayerIndex: cint32);// Pause playing +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then +uosPlayers[PlayerIndex].Pause() ; +end; + +procedure uos_BeginProc(PlayerIndex: cint32; Proc: TProc ); +// Assign the procedure of object to execute at begin, before loop +// PlayerIndex : Index of a existing Player +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].BeginProc := Proc; +end; + +procedure uos_EndProc(PlayerIndex: cint32; Proc: TProc ); +// Assign the procedure of object to execute at end, after loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].EndProc := Proc; +end; + +procedure uos_EndProcOnly(PlayerIndex: cint32; Proc: TProconly ); +// Assign the procedure (not of object) to execute at end, after loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].EndProcOnly := Proc; +end; + +procedure uos_LoopBeginProc(PlayerIndex: cint32; Proc: TProc ); +// Assign the procedure of object to execute at begin, before loop +// PlayerIndex : Index of a existing Player +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].LoopBeginProc := Proc; +end; + +procedure uos_LoopEndProc(PlayerIndex: cint32; Proc: TProc ); +// Assign the procedure of object to execute at end, after loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].LoopEndProc := Proc; +end; + +procedure uos_LoopProcIn(PlayerIndex: cint32; InIndex: cint32; Proc: TProc ); +// Assign the procedure of object to execute inside the loop +// PlayerIndex : Index of a existing Player +// InIndex : Index of a existing Input +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].StreamIn[InIndex].LoopProc := Proc; +end; + +procedure uos_LoopProcOut(PlayerIndex: cint32; OutIndex: cint32; Proc: TProc); +// Assign the procedure of object to execute inside the loop +// PlayerIndex : Index of a existing Player +// OutIndex : Index of a existing Output +begin + if (length(uosPlayers) > 0) and (PlayerIndex +1 <= length(uosPlayers)) then + if uosPlayersStat[PlayerIndex] = 1 then + if assigned(uosPlayers[PlayerIndex]) then + uosPlayers[PlayerIndex].StreamOut[OutIndex].LoopProc := Proc; +end; + +function uos_File2Buffer(Filename: Pchar; SampleFormat: cint32 ; var bufferinfos: Tuos_BufferInfos ; frompos : cint; numbuf : cint ): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max of frames) +// result : The memory buffer +// example : buffmem := uos_File2buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + begin +result := uos.uos_File2Buffer(Filename, SampleFormat, bufferinfos, frompos, numbuf ) ; + end; + +function uos_Stream2Buffer(AudioFile: TMemoryStream; SampleFormat: int32 ; var outmemory: TDArFloat; var bufferinfos: Tuos_BufferInfos ; frompos : cint; numbuf : cint): TDArFloat; +// Create a memory buffer of a audio file. +// FileName : filename of audio file +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// Outmemory : the buffer to store data. +// bufferinfos : the infos of the buffer. +// frompos : from position (default : -1 = from begining, otherwise position in song) +// numbuf : number of frames to add to outmemory (default : -1 = all, otherwise number max frames of buffers) +// result : The memory buffer +// example : buffmem := uos_Stream2Buffer(edit5.Text,0,buffmem, buffinfos, -1, -1); + begin +result := uos.uos_Stream2Buffer(AudioFile, SampleFormat, outmemory, bufferinfos, frompos, numbuf ) ; + end; + +{$IF DEFINED(soundtouch)} +function uos_GetBPM(TheBuffer: TDArFloat; Channels: cint32; SampleRate: CDouble) : CDouble; +// From SoundTouch plugin +begin + result := uos.uos_GetBPM(TheBuffer, Channels, SampleRate); + end; +{$endif} + +procedure uos_CustBufferInfos(var bufferinfos: Tuos_BufferInfos; SampleRate: CDouble; SampleFormat : cint32; Channels: cint32 ; Length: cint32); +// to initialize a custom bufferinfos: needed for AddFromMemoryBuffer() if no bufferinfos was created. +// all infos refer to the buffer used ---> length = length of the buffer div channels. +begin + uos.uos_CustBufferInfos(bufferinfos, SampleRate, SampleFormat, Channels, Length); + end; + +procedure uos_File2File(FilenameIN: Pchar; FilenameOUT: Pchar; SampleFormat: cint32 ; typeout: cint32 ); +// Create a audio file from a audio file. +// FileNameIN : filename of audio file IN (ogg, flac, wav, mp3, opus, aac,...) +// FileNameOUT : filename of audio file OUT (wav, pcm, custom) +// SampleFormat : default : -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16) +// typeout : Type of out file (-1:default=wav, 0:wav, 1:pcm, 2:custom)// example : InputIndex1 := uos_File2File(edit5.Text,0,buffmem); + begin + uos.uos_File2File(FilenameIN, FilenameOUT, SampleFormat, typeout); + end; + +procedure uos_MemStream2Wavfile(FileName: UTF8String; Data: TMemoryStream; BitsPerSample, + chan: integer; samplerate : CDouble); +// Create a audio wav file from a TMemoryStream. +// FileName : filename of wav saved file +// data : the memorystream +// BitsPerSample : 16 or 32 (bit) +// chan : number of channels +// samplerate : sample rate + begin + uos.uos_MemStream2Wavfile(FileName,Data,BitsPerSample, chan, samplerate); + end; + +function uos_TestLoadLibrary(Filename: Pchar): boolean; +// test a library to check if it can be loaded; +begin +result := uos.uos_TestLoadLibrary(FileName); +end; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName, fdkaacFilename : PChar) : cint32; + begin +result := uos.uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, + FaadFileName, opusfileFileName, XMPFileName, fdkaacFilename) ; + end; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName: PChar) : cint32; + begin +result := uos.uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName, nil, nil) ; + end; + +function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName + , opusfileFileName, XMPFileName : PChar) : cint32; + begin +result := uos.uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName, XMPFileName, nil) ; + end; + + +function uos_loadPlugin(PluginName, PluginFilename: PChar) : cint32; +// load plugin... +begin +result := uos.uos_loadPlugin(PluginName, PluginFilename) ; +end; + +function uos_Int16ToFloat32(Inbuf: TDArFloat): TDArFloat; +// convert buffer int16 into float32. +begin +result := uos.CvInt16ToFloat32(Inbuf); +end; + +{$IF DEFINED(shout)} +function uos_LoadServerLib(ShoutFileName, OpusFileName : PChar) : cint32; +// Shout => needed for dealing with IceCast server +// Opus => needed for dealing with encoding opus stream +begin +result := uos.uos_LoadServerLib(ShoutFileName, OpusFileName) ; + end; + +procedure uos_unloadServerLib(); +// Unload server libraries... Do not forget to call it before close application... + begin + uos.uos_unloadServerLib() ; + end; +{$endif} + +function uos_GetVersion() : cint32 ; +begin +result := uos.uos_GetVersion() ; +end; + +procedure uos_unloadlib() ; + var + x: cint32; + nt : integer = 300; + begin + if assigned(uosPlayers) then + begin + if (length(uosPlayers) > 0) then + for x := 0 to high(uosPlayers) do + if uosPlayersStat[x] = 1 then + begin + if uosPlayers[x].Status > 0 then + begin + uosPlayers[x].nofree := false; + uosPlayers[x].Stop(); + end; + end; + + while (PlayersNotFree = true) and (nt > 0) do + begin + Sleep(10); + Dec(nt); + end; + + setlength(uosPlayers, 0) ; + setlength(uosPlayersStat, 0) ; + end; + + uos.uos_unloadlib() ; +end; + +procedure uos_unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac : boolean); +// Custom Unload libraries... if true, then delete the library. You may unload what and when you want... +begin +uos.uos_unloadlibcust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac) ; +uosLoadResult:= uos.uosLoadResult; +end; + +procedure uos_UnloadPlugin(PluginName: PChar); +begin +uos.uos_UnloadPlugin(PluginName) ; +uosLoadResult:= uos.uosLoadResult; +end; + +function uos_GetInfoLibraries() : PChar ; +begin +result := uos.uos_GetInfoLibraries(); +end; + +{$IF DEFINED(portaudio)} +procedure uos_GetInfoDevice(); +begin +uos.uos_GetInfoDevice(); +setlength(uosDeviceInfos,length(uos.uosDeviceInfos)); + +uosDeviceInfos := uos.uosDeviceInfos; + +uosDeviceCount:= uos.uosDeviceCount; +uosDefaultDeviceIn:= uos.uosDefaultDeviceIn; +uosDefaultDeviceOut:= uos.uosDefaultDeviceOut; +end; + +procedure uos_UpdateDevice(); +begin +uos.uos_UpdateDevice(); +uosDeviceCount:= uos.uosDeviceCount; +uosDefaultDeviceIn:= uos.uosDefaultDeviceIn; +uosDefaultDeviceOut:= uos.uosDefaultDeviceOut; +end; + +function uos_GetInfoDeviceStr() : PChar ; +begin +result := uos.uos_GetInfoDeviceStr(); +uosDeviceCount:= uos.uosDeviceCount; +uosDefaultDeviceIn:= uos.uosDefaultDeviceIn; +uosDefaultDeviceOut:= uos.uosDefaultDeviceOut; +end; +{$endif} + +function uos_CreatePlayer(PlayerIndex : cint32): boolean; +// Create the player , PlayerIndex1 : from 0 to what your computer can do ! +// If PlayerIndex exists already, it will be overwriten... + var +x : cint32; +nt : integer = 200; +begin +result := false; + +uos_stop(PlayerIndex); // cannot hurt ! + +if PlayerIndex >= 0 then +begin +if PlayerIndex + 1 > length(uosPlayers) then +begin + setlength(uosPlayers,PlayerIndex + 1) ; + uosPlayers[PlayerIndex] := nil; + setlength(uosPlayersStat,PlayerIndex + 1) ; + setlength(uosLevelArray,PlayerIndex + 1) ; +end; + + {$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('before uosPlayers[PlayerIndex] <> nil '); + {$endif} + + if (uosPlayers[PlayerIndex] <> nil) then + begin + uosPlayers[PlayerIndex].FreePlayer; + Sleep(20); + while (PlayerNotFree(PlayerIndex) = true) and (nt > 0) do + begin + Sleep(10); + Dec(nt); + end; + + end; + +{$IF DEFINED(uos_debug) and DEFINED(unix)} + writeln('after uosPlayers[PlayerIndex] <> nil '); +{$endif} + + uosPlayers[PlayerIndex] := Tuos_Player.Create(); + + result:= True; + + uosPlayers[PlayerIndex].Index := PlayerIndex; +//notice player is created + uosPlayersStat[PlayerIndex] := 1 ; + + for x := 0 to length(uosPlayersStat) -1 do + if uosPlayersStat[x] <> 1 then + begin + uosPlayersStat[x] := -1 ; + uosPlayers[x] := nil ; + end; + + end; +end; + +procedure uos_Free(); +var +x : integer; +nt : shortint = 100; +begin + +// needed for MSE and if some players are still playing +if length(uosPlayers) > 0 then + for x := 0 to length(uosPlayers) -1 do + if assigned(uosPlayers[x]) then + begin + uosPlayers[x].nofree := false; + uos_playpaused(x); + uos_stop(x); + end; + +while (PlayersNotFree = true) and (nt > 0) do + begin + Sleep(10); + Dec(nt); + end; + sleep(100); + uos.uos_free(); +end; + +end. diff --git a/UOS/src/uos_httpgetthread.pas b/UOS/src/uos_httpgetthread.pas new file mode 100644 index 0000000..ece9b09 --- /dev/null +++ b/UOS/src/uos_httpgetthread.pas @@ -0,0 +1,158 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{ This is HTTP Thread Getter + created by Andrew Haines -> andrewd207@aol.com + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com} + +unit uos_httpgetthread; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + Pipes; + +type + + { TThreadHttpGetter } + + TThreadHttpGetter = class(TThread) + private + FOutStream: TOutputPipeStream; + FWantedURL: string; + FIcyMetaInt: int64; + FOnIcyMetaInt: TNotifyEvent; + property OnIcyMetaInt: TNotifyEvent read FOnIcyMetaInt write FOnIcyMetaInt; + procedure DoIcyMetaInt; + function GetRedirectURL(AResponseStrings: TStrings): string; + procedure Headers(Sender: TObject); + protected + procedure Execute; override; + public + FIsRunning: Boolean; + ICYenabled: Boolean; + property IcyMetaInt: int64 read FIcyMetaInt; + property IsRunning: Boolean read FIsRunning; + constructor Create(AWantedURL: string; AOutputStream: TOutputPipeStream); + end; + +implementation + +uses + fphttpclient, + openssl, { This implements the procedure InitSSLInterface } + opensslsockets; + + { TThreadHttpGetter } + +function TThreadHttpGetter.GetRedirectURL(AResponseStrings: TStrings): string; +var + S: string; + F: integer; + Search: string = 'location:'; +begin + Result := ''; + for S in AResponseStrings do + begin + // WriteLn(S); + F := Pos(Search, Lowercase(s)); + + if F > 0 then + begin + Inc(F, Length(Search)); + Exit(Trim(Copy(S, F, Length(S) - F + 1))); + end; + end; +end; + +procedure TThreadHttpGetter.DoIcyMetaInt; +begin + if Assigned(FOnIcyMetaInt) then + FOnIcyMetaInt(Self); +end; + +procedure TThreadHttpGetter.Headers(Sender: TObject); +begin + FIcyMetaInt := StrToInt64Def(TFPHTTPClient(Sender).GetHeader(TFPHTTPClient(Sender).ResponseHeaders, 'icy-metaint'), 0); + if (FIcyMetaInt > 0) and (FOnIcyMetaInt <> nil) then + Synchronize(@DoIcyMetaInt); +end; + +procedure TThreadHttpGetter.Execute; +var + Http: TFPHTTPClient; + URL: string; + err: shortint = 0; +begin + URL := FWantedURL; + if pos(' ', URL) > 0 then + FIsRunning := False + else + begin + InitSSLInterface; + Http := TFPHTTPClient.Create(nil); + http.AllowRedirect := True; + http.IOTimeout := 2000; + repeat + try + Http.RequestHeaders.Clear; + if ICYenabled = True then + Http.OnHeaders := @Headers; + // writeln(' avant http.get'); + Http.Get(URL, FOutStream); + // writeln(' apres http.get'); + except + on e: EHTTPClient do + begin + // writeln(' Http.ResponseStatusCode ' +inttostr(Http.ResponseStatusCode)); + if (Http.ResponseStatusCode > 399) or (Http.ResponseStatusCode < 1) then // not accessible + begin + FIsRunning := False; + break; + end; + if Http.ResponseStatusCode = 302 then + begin + URL := GetRedirectURL(Http.ResponseHeaders); + if URL <> '' then + Continue; + end + else + Break; + // raise E; + end; + on e: Exception do + begin + // WriteLn(e.Message); + end + else + // Raise; + Break; + end; + Break; + until (False); + try + //FOutStream.Free; + Http.Free; + finally + // make sure this is set to false when done + FIsRunning := False; + end; + end; +end; + +constructor TThreadHttpGetter.Create(AWantedURL: string; AOutputStream: TOutputPipeStream); +begin + inherited Create(True); + ICYenabled := False; + FIsRunning := True; + FWantedURL := AWantedURL; + FOutStream := AOutputStream; + // Start; +end; + +end. + diff --git a/UOS/src/uos_jni.pas b/UOS/src/uos_jni.pas new file mode 100644 index 0000000..d05385d --- /dev/null +++ b/UOS/src/uos_jni.pas @@ -0,0 +1,573 @@ +unit uos_jni; + +{$ifdef fpc} +{$mode delphi} + {$packrecords c} +{$endif} + +{$macro on} +{$ifdef mswindows} +{$define jnicall:=stdcall} +{$else} +{$define jnicall:=cdecl} +{$endif} + +interface + +(* + * Manifest constants. + *) +const JNI_FALSE=0; + JNI_TRUE=1; + + JNI_VERSION_1_1=$00010001; + JNI_VERSION_1_2=$00010002; + JNI_VERSION_1_4=$00010004; + JNI_VERSION_1_6=$00010006; + + JNI_OK=0; // no error + JNI_ERR=-1; // generic error + JNI_EDETACHED=-2; // thread detached from the VM + JNI_EVERSION=-3; // JNI version error + + JNI_COMMIT=1; // copy content, do not free buffer + JNI_ABORT=2; // free buffer w/o copying back + +(* + * Type definitions. + *) +type va_list=pointer; + + jboolean=byte; // unsigned 8 bits + jbyte=shortint; // signed 8 bits + jchar=word; // unsigned 16 bits + jshort=smallint; // signed 16 bits + jint=longint; // signed 32 bits + jlong=int64; // signed 64 bits + jfloat=single; // 32-bit IEEE 754 + jdouble=double; // 64-bit IEEE 754 + + jsize=jint; // "cardinal indices and sizes" + + Pjboolean=^jboolean; + Pjbyte=^jbyte; + Pjchar=^jchar; + Pjshort=^jshort; + Pjint=^jint; + Pjlong=^jlong; + Pjfloat=^jfloat; + Pjdouble=^jdouble; + + Pjsize=^jsize; + + // Reference type + jobject=pointer; + jclass=jobject; + jstring=jobject; + jarray=jobject; + jobjectArray=jarray; + jbooleanArray=jarray; + jbyteArray=jarray; + jcharArray=jarray; + jshortArray=jarray; + jintArray=jarray; + jlongArray=jarray; + jfloatArray=jarray; + jdoubleArray=jarray; + jthrowable=jobject; + jweak=jobject; + jref=jobject; + + PPointer=^pointer; + Pjobject=^jobject; + Pjclass=^jclass; + Pjstring=^jstring; + Pjarray=^jarray; + PjobjectArray=^jobjectArray; + PjbooleanArray=^jbooleanArray; + PjbyteArray=^jbyteArray; + PjcharArray=^jcharArray; + PjshortArray=^jshortArray; + PjintArray=^jintArray; + PjlongArray=^jlongArray; + PjfloatArray=^jfloatArray; + PjdoubleArray=^jdoubleArray; + Pjthrowable=^jthrowable; + Pjweak=^jweak; + Pjref=^jref; + + _jfieldID=record // opaque structure + end; + jfieldID=^_jfieldID;// field IDs + PjfieldID=^jfieldID; + + _jmethodID=record // opaque structure + end; + jmethodID=^_jmethodID;// method IDs + PjmethodID=^jmethodID; + + PJNIInvokeInterface=^JNIInvokeInterface; + + Pjvalue=^jvalue; + jvalue={$ifdef packedrecords}packed{$endif} record + case integer of + 0:(z:jboolean); + 1:(b:jbyte); + 2:(c:jchar); + 3:(s:jshort); + 4:(i:jint); + 5:(j:jlong); + 6:(f:jfloat); + 7:(d:jdouble); + 8:(l:jobject); + end; + + jobjectRefType=( + JNIInvalidRefType=0, + JNILocalRefType=1, + JNIGlobalRefType=2, + JNIWeakGlobalRefType=3); + + PJNINativeMethod=^JNINativeMethod; + JNINativeMethod={$ifdef packedrecords}packed{$endif} record + name:pchar; + signature:pchar; + fnPtr:pointer; + end; + + PJNINativeInterface=^JNINativeInterface; + + _JNIEnv={$ifdef packedrecords}packed{$endif} record + functions:PJNINativeInterface; + end; + + _JavaVM={$ifdef packedrecords}packed{$endif} record + functions:PJNIInvokeInterface; + end; + + C_JNIEnv=^JNINativeInterface; + JNIEnv=^JNINativeInterface; + JavaVM=^JNIInvokeInterface; + + PPJNIEnv=^PJNIEnv; + PJNIEnv=^JNIEnv; + + PPJavaVM=^PJavaVM; + PJavaVM=^JavaVM; + + JNINativeInterface={$ifdef packedrecords}packed{$endif} record + reserved0:pointer; + reserved1:pointer; + reserved2:pointer; + reserved3:pointer; + + GetVersion:function(Env:PJNIEnv):JInt; jnicall; + DefineClass:function(Env:PJNIEnv;const Name:pchar;Loader:JObject;const Buf:PJByte;Len:JSize):JClass; jnicall; + FindClass:function(Env:PJNIEnv;const Name:pchar):JClass; jnicall; + + // Reflection Support + FromReflectedMethod:function(Env:PJNIEnv;Method:JObject):JMethodID; jnicall; + FromReflectedField:function(Env:PJNIEnv;Field:JObject):JFieldID; jnicall; + ToReflectedMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;IsStatic:JBoolean):JObject; jnicall; + + GetSuperclass:function(Env:PJNIEnv;Sub:JClass):JClass; jnicall; + IsAssignableFrom:function(Env:PJNIEnv;Sub:JClass;Sup:JClass):JBoolean; jnicall; + + // Reflection Support + ToReflectedField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;IsStatic:JBoolean):JObject; jnicall; + + Throw:function(Env:PJNIEnv;Obj:JThrowable):JInt; jnicall; + ThrowNew:function(Env:PJNIEnv;AClass:JClass;const Msg:pchar):JInt; jnicall; + ExceptionOccurred:function(Env:PJNIEnv):JThrowable; jnicall; + ExceptionDescribe:procedure(Env:PJNIEnv); jnicall; + ExceptionClear:procedure(Env:PJNIEnv); jnicall; + FatalError:procedure(Env:PJNIEnv;const Msg:pchar); jnicall; + + // Local Reference Management + PushLocalFrame:function(Env:PJNIEnv;Capacity:JInt):JInt; jnicall; + PopLocalFrame:function(Env:PJNIEnv;Result:JObject):JObject; jnicall; + + NewGlobalRef:function(Env:PJNIEnv;LObj:JObject):JObject; jnicall; + DeleteGlobalRef:procedure(Env:PJNIEnv;GRef:JObject); jnicall; + DeleteLocalRef:procedure(Env:PJNIEnv;Obj:JObject); jnicall; + IsSameObject:function(Env:PJNIEnv;Obj1:JObject;Obj2:JObject):JBoolean; jnicall; + + // Local Reference Management + NewLocalRef:function(Env:PJNIEnv;Ref:JObject):JObject; jnicall; + EnsureLocalCapacity:function(Env:PJNIEnv;Capacity:JInt):JObject; jnicall; + + AllocObject:function(Env:PJNIEnv;AClass:JClass):JObject; jnicall; + NewObject:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JObject; jnicall; + NewObjectV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject; jnicall; + NewObjectA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject; jnicall; + + GetObjectClass:function(Env:PJNIEnv;Obj:JObject):JClass; jnicall; + IsInstanceOf:function(Env:PJNIEnv;Obj:JObject;AClass:JClass):JBoolean; jnicall; + + GetMethodID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JMethodID; jnicall; + + CallObjectMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JObject; jnicall; + CallObjectMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JObject; jnicall; + CallObjectMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JObject; jnicall; + + CallBooleanMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JBoolean; jnicall; + CallBooleanMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JBoolean; jnicall; + CallBooleanMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JBoolean; jnicall; + + CallByteMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JByte; jnicall; + CallByteMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JByte; jnicall; + CallByteMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JByte; jnicall; + + CallCharMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JChar; jnicall; + CallCharMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JChar; jnicall; + CallCharMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JChar; jnicall; + + CallShortMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JShort; jnicall; + CallShortMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JShort; jnicall; + CallShortMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JShort; jnicall; + + CallIntMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JInt; jnicall; + CallIntMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JInt; jnicall; + CallIntMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JInt; jnicall; + + CallLongMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JLong; jnicall; + CallLongMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JLong; jnicall; + CallLongMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JLong; jnicall; + + CallFloatMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JFloat; jnicall; + CallFloatMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JFloat; jnicall; + CallFloatMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JFloat; jnicall; + + CallDoubleMethod:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID):JDouble; jnicall; + CallDoubleMethodV:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list):JDouble; jnicall; + CallDoubleMethodA:function(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue):JDouble; jnicall; + + CallVoidMethod:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID); jnicall; + CallVoidMethodV:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:va_list); jnicall; + CallVoidMethodA:procedure(Env:PJNIEnv;Obj:JObject;MethodID:JMethodID;Args:PJValue); jnicall; + + CallNonvirtualObjectMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JObject; jnicall; + CallNonvirtualObjectMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject; jnicall; + CallNonvirtualObjectMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject; jnicall; + + CallNonvirtualBooleanMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JBoolean; jnicall; + CallNonvirtualBooleanMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JBoolean; jnicall; + CallNonvirtualBooleanMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JBoolean; jnicall; + + CallNonvirtualByteMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JByte; jnicall; + CallNonvirtualByteMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JByte; jnicall; + CallNonvirtualByteMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JByte; jnicall; + + CallNonvirtualCharMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JChar; jnicall; + CallNonvirtualCharMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JChar; jnicall; + CallNonvirtualCharMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JChar; jnicall; + + CallNonvirtualShortMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JShort; jnicall; + CallNonvirtualShortMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JShort; jnicall; + CallNonvirtualShortMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JShort; jnicall; + + CallNonvirtualIntMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JInt; jnicall; + CallNonvirtualIntMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JInt; jnicall; + CallNonvirtualIntMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JInt; jnicall; + + CallNonvirtualLongMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JLong; jnicall; + CallNonvirtualLongMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JLong; jnicall; + CallNonvirtualLongMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JLong; jnicall; + + CallNonvirtualFloatMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JFloat; jnicall; + CallNonvirtualFloatMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JFloat; jnicall; + CallNonvirtualFloatMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JFloat; jnicall; + + CallNonvirtualDoubleMethod:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID):JDouble; jnicall; + CallNonvirtualDoubleMethodV:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list):JDouble; jnicall; + CallNonvirtualDoubleMethodA:function(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue):JDouble; jnicall; + + CallNonvirtualVoidMethod:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID); jnicall; + CallNonvirtualVoidMethodV:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:va_list); jnicall; + CallNonvirtualVoidMethodA:procedure(Env:PJNIEnv;Obj:JObject;AClass:JClass;MethodID:JMethodID;Args:PJValue); jnicall; + + GetFieldID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JFieldID; jnicall; + + GetObjectField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JObject; jnicall; + GetBooleanField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JBoolean; jnicall; + GetByteField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JByte; jnicall; + GetCharField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JChar; jnicall; + GetShortField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JShort; jnicall; + GetIntField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JInt; jnicall; + GetLongField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JLong; jnicall; + GetFloatField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JFloat; jnicall; + GetDoubleField:function(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID):JDouble; jnicall; + + SetObjectField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JObject); jnicall; + SetBooleanField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JBoolean); jnicall; + SetByteField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JByte); jnicall; + SetCharField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JChar); jnicall; + SetShortField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JShort); jnicall; + SetIntField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JInt); jnicall; + SetLongField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JLong); jnicall; + SetFloatField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JFloat); jnicall; + SetDoubleField:procedure(Env:PJNIEnv;Obj:JObject;FieldID:JFieldID;Val:JDouble); jnicall; + + GetStaticMethodID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JMethodID; jnicall; + + CallStaticObjectMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JObject; jnicall; + CallStaticObjectMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JObject; jnicall; + CallStaticObjectMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JObject; jnicall; + + CallStaticBooleanMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JBoolean; jnicall; + CallStaticBooleanMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JBoolean; jnicall; + CallStaticBooleanMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JBoolean; jnicall; + + CallStaticByteMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JByte; jnicall; + CallStaticByteMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JByte; jnicall; + CallStaticByteMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JByte; jnicall; + + CallStaticCharMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JChar; jnicall; + CallStaticCharMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JChar; jnicall; + CallStaticCharMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JChar; jnicall; + + CallStaticShortMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JShort; jnicall; + CallStaticShortMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JShort; jnicall; + CallStaticShortMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JShort; jnicall; + + CallStaticIntMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JInt; jnicall; + CallStaticIntMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JInt; jnicall; + CallStaticIntMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JInt; jnicall; + + CallStaticLongMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JLong; jnicall; + CallStaticLongMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JLong; jnicall; + CallStaticLongMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JLong; jnicall; + + CallStaticFloatMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JFloat; jnicall; + CallStaticFloatMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JFloat; jnicall; + CallStaticFloatMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JFloat; jnicall; + + CallStaticDoubleMethod:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID):JDouble; jnicall; + CallStaticDoubleMethodV:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list):JDouble; jnicall; + CallStaticDoubleMethodA:function(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue):JDouble; jnicall; + + CallStaticVoidMethod:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID); jnicall; + CallStaticVoidMethodV:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:va_list); jnicall; + CallStaticVoidMethodA:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue); jnicall; + + GetStaticFieldID:function(Env:PJNIEnv;AClass:JClass;const Name:pchar;const Sig:pchar):JFieldID; jnicall; + GetStaticObjectField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JObject; jnicall; + GetStaticBooleanField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JBoolean; jnicall; + GetStaticByteField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JByte; jnicall; + GetStaticCharField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JChar; jnicall; + GetStaticShortField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JShort; jnicall; + GetStaticIntField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JInt; jnicall; + GetStaticLongField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JLong; jnicall; + GetStaticFloatField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JFloat; jnicall; + GetStaticDoubleField:function(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID):JDouble; jnicall; + + SetStaticObjectField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JObject); jnicall; + SetStaticBooleanField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JBoolean); jnicall; + SetStaticByteField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JByte); jnicall; + SetStaticCharField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JChar); jnicall; + SetStaticShortField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JShort); jnicall; + SetStaticIntField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JInt); jnicall; + SetStaticLongField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JLong); jnicall; + SetStaticFloatField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JFloat); jnicall; + SetStaticDoubleField:procedure(Env:PJNIEnv;AClass:JClass;FieldID:JFieldID;Val:JDouble); jnicall; + + NewString:function(Env:PJNIEnv;const Unicode:PJChar;Len:JSize):JString; jnicall; + GetStringLength:function(Env:PJNIEnv;Str:JString):JSize; jnicall; + GetStringChars:function(Env:PJNIEnv;Str:JString;IsCopy:PJBoolean):PJChar; jnicall; + ReleaseStringChars:procedure(Env:PJNIEnv;Str:JString;const Chars:PJChar); jnicall; + + NewStringUTF:function(Env:PJNIEnv;const UTF:pchar):JString; jnicall; + GetStringUTFLength:function(Env:PJNIEnv;Str:JString):JSize; jnicall; + GetStringUTFChars:function(Env:PJNIEnv;Str:JString;IsCopy:PJBoolean):pchar; jnicall; + ReleaseStringUTFChars:procedure(Env:PJNIEnv;Str:JString;const Chars:pchar); jnicall; + + GetArrayLength:function(Env:PJNIEnv;AArray:JArray):JSize; jnicall; + + NewObjectArray:function(Env:PJNIEnv;Len:JSize;AClass:JClass;Init:JObject):JObjectArray; jnicall; + GetObjectArrayElement:function(Env:PJNIEnv;AArray:JObjectArray;Index:JSize):JObject; jnicall; + SetObjectArrayElement:procedure(Env:PJNIEnv;AArray:JObjectArray;Index:JSize;Val:JObject); jnicall; + + NewBooleanArray:function(Env:PJNIEnv;Len:JSize):JBooleanArray; jnicall; + NewByteArray:function(Env:PJNIEnv;Len:JSize):JByteArray; jnicall; + NewCharArray:function(Env:PJNIEnv;Len:JSize):JCharArray; jnicall; + NewShortArray:function(Env:PJNIEnv;Len:JSize):JShortArray; jnicall; + NewIntArray:function(Env:PJNIEnv;Len:JSize):JIntArray; jnicall; + NewLongArray:function(Env:PJNIEnv;Len:JSize):JLongArray; jnicall; + NewFloatArray:function(Env:PJNIEnv;Len:JSize):JFloatArray; jnicall; + NewDoubleArray:function(Env:PJNIEnv;Len:JSize):JDoubleArray; jnicall; + + GetBooleanArrayElements:function(Env:PJNIEnv;AArray:JBooleanArray;IsCopy:PJBoolean):PJBoolean; jnicall; + GetByteArrayElements:function(Env:PJNIEnv;AArray:JByteArray;IsCopy:PJBoolean):PJByte; jnicall; + GetCharArrayElements:function(Env:PJNIEnv;AArray:JCharArray;IsCopy:PJBoolean):PJChar; jnicall; + GetShortArrayElements:function(Env:PJNIEnv;AArray:JShortArray;IsCopy:PJBoolean):PJShort; jnicall; + GetIntArrayElements:function(Env:PJNIEnv;AArray:JIntArray;IsCopy:PJBoolean):PJInt; jnicall; + GetLongArrayElements:function(Env:PJNIEnv;AArray:JLongArray;IsCopy:PJBoolean):PJLong; jnicall; + GetFloatArrayElements:function(Env:PJNIEnv;AArray:JFloatArray;IsCopy:PJBoolean):PJFloat; jnicall; + GetDoubleArrayElements:function(Env:PJNIEnv;AArray:JDoubleArray;IsCopy:PJBoolean):PJDouble; jnicall; + + ReleaseBooleanArrayElements:procedure(Env:PJNIEnv;AArray:JBooleanArray;Elems:PJBoolean;Mode:JInt); jnicall; + ReleaseByteArrayElements:procedure(Env:PJNIEnv;AArray:JByteArray;Elems:PJByte;Mode:JInt); jnicall; + ReleaseCharArrayElements:procedure(Env:PJNIEnv;AArray:JCharArray;Elems:PJChar;Mode:JInt); jnicall; + ReleaseShortArrayElements:procedure(Env:PJNIEnv;AArray:JShortArray;Elems:PJShort;Mode:JInt); jnicall; + ReleaseIntArrayElements:procedure(Env:PJNIEnv;AArray:JIntArray;Elems:PJInt;Mode:JInt); jnicall; + ReleaseLongArrayElements:procedure(Env:PJNIEnv;AArray:JLongArray;Elems:PJLong;Mode:JInt); jnicall; + ReleaseFloatArrayElements:procedure(Env:PJNIEnv;AArray:JFloatArray;Elems:PJFloat;Mode:JInt); jnicall; + ReleaseDoubleArrayElements:procedure(Env:PJNIEnv;AArray:JDoubleArray;Elems:PJDouble;Mode:JInt); jnicall; + + GetBooleanArrayRegion:procedure(Env:PJNIEnv;AArray:JBooleanArray;Start:JSize;Len:JSize;Buf:PJBoolean); jnicall; + GetByteArrayRegion:procedure(Env:PJNIEnv;AArray:JByteArray;Start:JSize;Len:JSize;Buf:PJByte); jnicall; + GetCharArrayRegion:procedure(Env:PJNIEnv;AArray:JCharArray;Start:JSize;Len:JSize;Buf:PJChar); jnicall; + GetShortArrayRegion:procedure(Env:PJNIEnv;AArray:JShortArray;Start:JSize;Len:JSize;Buf:PJShort); jnicall; + GetIntArrayRegion:procedure(Env:PJNIEnv;AArray:JIntArray;Start:JSize;Len:JSize;Buf:PJInt); jnicall; + GetLongArrayRegion:procedure(Env:PJNIEnv;AArray:JLongArray;Start:JSize;Len:JSize;Buf:PJLong); jnicall; + GetFloatArrayRegion:procedure(Env:PJNIEnv;AArray:JFloatArray;Start:JSize;Len:JSize;Buf:PJFloat); jnicall; + GetDoubleArrayRegion:procedure(Env:PJNIEnv;AArray:JDoubleArray;Start:JSize;Len:JSize;Buf:PJDouble); jnicall; + + SetBooleanArrayRegion:procedure(Env:PJNIEnv;AArray:JBooleanArray;Start:JSize;Len:JSize;Buf:PJBoolean); jnicall; + SetByteArrayRegion:procedure(Env:PJNIEnv;AArray:JByteArray;Start:JSize;Len:JSize;Buf:PJByte); jnicall; + SetCharArrayRegion:procedure(Env:PJNIEnv;AArray:JCharArray;Start:JSize;Len:JSize;Buf:PJChar); jnicall; + SetShortArrayRegion:procedure(Env:PJNIEnv;AArray:JShortArray;Start:JSize;Len:JSize;Buf:PJShort); jnicall; + SetIntArrayRegion:procedure(Env:PJNIEnv;AArray:JIntArray;Start:JSize;Len:JSize;Buf:PJInt); jnicall; + SetLongArrayRegion:procedure(Env:PJNIEnv;AArray:JLongArray;Start:JSize;Len:JSize;Buf:PJLong); jnicall; + SetFloatArrayRegion:procedure(Env:PJNIEnv;AArray:JFloatArray;Start:JSize;Len:JSize;Buf:PJFloat); jnicall; + SetDoubleArrayRegion:procedure(Env:PJNIEnv;AArray:JDoubleArray;Start:JSize;Len:JSize;Buf:PJDouble); jnicall; + + RegisterNatives:function(Env:PJNIEnv;AClass:JClass;const Methods:PJNINativeMethod;NMethods:JInt):JInt; jnicall; + UnregisterNatives:function(Env:PJNIEnv;AClass:JClass):JInt; jnicall; + + MonitorEnter:function(Env:PJNIEnv;Obj:JObject):JInt; jnicall; + MonitorExit:function(Env:PJNIEnv;Obj:JObject):JInt; jnicall; + + GetJavaVM:function(Env:PJNIEnv;VM:PJavaVM):JInt; jnicall; + + // String Operations + GetStringRegion:procedure(Env:PJNIEnv;Str:JString;Start:JSize;Len:JSize;Buf:PJChar); jnicall; + GetStringUTFRegion:procedure(Env:PJNIEnv;Str:JString;Start:JSize;Len:JSize;Buf:pchar); jnicall; + + // Array Operations + GetPrimitiveArrayCritical:function(Env:PJNIEnv;AArray:JArray;IsCopy:PJBoolean):pointer; jnicall; + ReleasePrimitiveArrayCritical:procedure(Env:PJNIEnv;AArray:JArray;CArray:pointer;Mode:JInt); jnicall; + + // String Operations + GetStringCritical:function(Env:PJNIEnv;Str:JString;IsCopy:PJBoolean):PJChar; jnicall; + ReleaseStringCritical:procedure(Env:PJNIEnv;Str:JString;CString:PJChar); jnicall; + + // Weak Global References + NewWeakGlobalRef:function(Env:PJNIEnv;Obj:JObject):JWeak; jnicall; + DeleteWeakGlobalRef:procedure(Env:PJNIEnv;Ref:JWeak); jnicall; + + // Exceptions + ExceptionCheck:function(Env:PJNIEnv):JBoolean; jnicall; + + // J2SDK1_4 + NewDirectByteBuffer:function(Env:PJNIEnv;Address:pointer;Capacity:JLong):JObject; jnicall; + GetDirectBufferAddress:function(Env:PJNIEnv;Buf:JObject):pointer; jnicall; + GetDirectBufferCapacity:function(Env:PJNIEnv;Buf:JObject):JLong; jnicall; + + // added in JNI 1.6 + GetObjectRefType:function(Env:PJNIEnv;AObject:JObject):jobjectRefType; jnicall; + end; + + JNIInvokeInterface={$ifdef packedrecords}packed{$endif} record + reserved0:pointer; + reserved1:pointer; + reserved2:pointer; + + DestroyJavaVM:function(PVM:PJavaVM):JInt; jnicall; + AttachCurrentThread:function(PVM:PJavaVM;PEnv:PPJNIEnv;Args:pointer):JInt; jnicall; + DetachCurrentThread:function(PVM:PJavaVM):JInt; jnicall; + GetEnv:function(PVM:PJavaVM;PEnv:Ppointer;Version:JInt):JInt; jnicall; + AttachCurrentThreadAsDaemon:function(PVM:PJavaVM;PEnv:PPJNIEnv;Args:pointer):JInt; jnicall; + end; + + JavaVMAttachArgs={$ifdef packedrecords}packed{$endif} record + version:jint; // must be >= JNI_VERSION_1_2 + name:pchar; // NULL or name of thread as modified UTF-8 str + group:jobject; // global ref of a ThreadGroup object, or NULL + end; + +(** + * JNI 1.2+ initialization. (As of 1.6, the pre-1.2 structures are no + * longer supported.) + *) + + PJavaVMOption=^JavaVMOption; + JavaVMOption={$ifdef packedrecords}packed{$endif} record + optionString:pchar; + extraInfo:pointer; + end; + + JavaVMInitArgs={$ifdef packedrecords}packed{$endif} record + version:jint; // use JNI_VERSION_1_2 or later + nOptions:jint; + options:PJavaVMOption; + ignoreUnrecognized:Pjboolean; + end; + +(* + * VM initialization functions. + * + * Note these are the only symbols exported for JNI by the VM. + *) +{$ifdef jniexternals} +function JNI_GetDefaultJavaVMInitArgs(p:pointer):jint; jnicall;external 'jni' name 'JNI_GetDefaultJavaVMInitArgs'; +function JNI_CreateJavaVM(vm:PPJavaVM;AEnv:PPJNIEnv;p:pointer):jint; jnicall;external 'jni' name 'JNI_CreateJavaVM'; +function JNI_GetCreatedJavaVMs(vm:PPJavaVM;ASize:jsize;p:Pjsize):jint; jnicall;external 'jni' name 'JNI_GetCreatedJavaVMs'; +{$endif} + +(* + * Prototypes for functions exported by loadable shared libs. These are + * called by JNI, not provided by JNI. + *) + +const curVM:PJavaVM=nil; + curEnv:PJNIEnv=nil; + +(* +function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint; jnicall; +procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer); jnicall; +*) + +(* Helper Routines *) +function JNI_JStringToString( PEnv : PJNIEnv; JStr : JString ) : string; +function JNI_StringToJString( PEnv : PJNIEnv; const AString : PAnsiChar ) : JString; + +implementation + +function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint; jnicall; +begin + curVM:=vm; + result:=JNI_VERSION_1_6; +end; + +procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer); jnicall; +begin +end; + +function JNI_JStringToString( PEnv : PJNIEnv; JStr : JString ) : string; +var + IsCopy: PJBoolean; + Chars: PAnsiChar; +begin + if JStr = nil then + begin + Result := ''; + Exit; + end; + + Chars := PEnv^.GetStringUTFChars(PEnv, JStr, IsCopy); + if Chars = nil then + Result := '' + else + begin + Result := string(Chars); + PEnv^.ReleaseStringUTFChars(PEnv, JStr, Chars); + end; +end; + +function JNI_StringToJString( PEnv : PJNIEnv; const AString : PAnsiChar ) : JString; +begin + Result := PEnv^.NewStringUTF( PEnv, PAnsiChar( AString ) ); +end; + +end. diff --git a/UOS/src/uos_libsndfile.pas b/UOS/src/uos_libsndfile.pas new file mode 100644 index 0000000..5f1eba4 --- /dev/null +++ b/UOS/src/uos_libsndfile.pas @@ -0,0 +1,785 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading version with reference counting of LibSndFile.pas. + Load the library with sf_load() and release with sf_unload(). + Thanks to Phoenix for sf_open_virtual (TMemoryStream as input) + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com } + +unit uos_libsndfile; + +{$IFDEF FPC} + {$mode objfpc}{$H+} + {$PACKENUM 4}(* use 4-byte enums *) + {$PACKRECORDS C}(* C/C++-compatible record packing *) + {$MACRO ON}//don't know whatfor ! +{$ELSE} + {$MINENUMSIZE 4}(* use 4-byte enums *) +{** MINENUMSIZE is equivalent to Z+} +{$ENDIF} + +{$LONGSTRINGS ON} +{** LONGSTRINGS is equivalent to H+} + +interface + +uses + dynlibs, classes, + ctypes; + +const +libsf= + {$IFDEF unix} + {$IFDEF darwin} + 'libsndfile.1.dylib'; + {$ELSE} + 'libsndfile.so.1'; + {$ENDIF} + {$ELSE} + 'sndfile.dll'; + {$ENDIF} + +type + PMemoryStream = ^TMemoryStream; + +type + {$IF Defined(MSWINDOWS)} + off_t = int64; + {$ELSE} + off_t = clonglong; + size_t = culong; + {$ENDIF} + +const + //* Major formats. *// + SF_FORMAT_WAV = $010000; // Microsoft WAV format (little endian default). + SF_FORMAT_AIFF = $020000; // Apple/SGI AIFF format (big endian). + SF_FORMAT_AU = $030000; // Sun/NeXT AU format (big endian). + SF_FORMAT_RAW = $040000; // RAW PCM data. + SF_FORMAT_PAF = $050000; // Ensoniq PARIS file format. + SF_FORMAT_SVX = $060000; // Amiga IFF / SVX8 / SV16 format. + SF_FORMAT_NIST = $070000; // Sphere NIST format. + SF_FORMAT_VOC = $080000; // VOC files. + SF_FORMAT_IRCAM = $0A0000; // Berkeley/IRCAM/CARL + SF_FORMAT_W64 = $0B0000; // Sonic Foundry's 64 bit RIFF/WAV + SF_FORMAT_MAT4 = $0C0000; // Matlab (tm) V4.2 / GNU Octave 2.0 + SF_FORMAT_MAT5 = $0D0000; // Matlab (tm) V5.0 / GNU Octave 2.1 + SF_FORMAT_PVF = $0E0000; // Portable Voice Format + SF_FORMAT_XI = $0F0000; // Fasttracker 2 Extended Instrument + SF_FORMAT_HTK = $100000; // HMM Tool Kit format + SF_FORMAT_SDS = $110000; // Midi Sample Dump Standard + SF_FORMAT_AVR = $120000; // Audio Visual Research + SF_FORMAT_WAVEX = $130000; // MS WAVE with WAVEFORMATEX + SF_FORMAT_SD2 = $160000; // Sound Designer 2 + SF_FORMAT_FLAC = $170000; // FLAC lossless file format + SF_FORMAT_CAF = $180000; // Core Audio File format + SF_FORMAT_OGG = $200000; // Xiph OGG container + + +const + //Subtypes from here on. + SF_FORMAT_PCM_S8 = $0001; // Signed 8 bit data + SF_FORMAT_PCM_16 = $0002; // Signed 16 bit data + SF_FORMAT_PCM_24 = $0003; // Signed 24 bit data + SF_FORMAT_PCM_32 = $0004; // Signed 32 bit data + + SF_FORMAT_PCM_U8 = $0005; // Unsigned 8 bit data (WAV and RAW only) + + SF_FORMAT_FLOAT = $0006; // 32 bit float data + SF_FORMAT_DOUBLE = $0007; // 64 bit float data + + SF_FORMAT_ULAW = $0010; // U-Law encoded. + SF_FORMAT_ALAW = $0011; // A-Law encoded. + SF_FORMAT_IMA_ADPCM = $0012; // IMA ADPCM. + SF_FORMAT_MS_ADPCM = $0013; // Microsoft ADPCM. + + SF_FORMAT_GSM610 = $0020; // GSM 6.10 encoding. + SF_FORMAT_VOX_ADPCM = $0021; // OKI / Dialogix ADPCM + + SF_FORMAT_G721_32 = $0030; // 32kbs G721 ADPCM encoding. + SF_FORMAT_G723_24 = $0031; // 24kbs G723 ADPCM encoding. + SF_FORMAT_G723_40 = $0032; // 40kbs G723 ADPCM encoding. + + SF_FORMAT_DWVW_12 = $0040; // 12 bit Delta Width Variable Word encoding. + SF_FORMAT_DWVW_16 = $0041; // 16 bit Delta Width Variable Word encoding. + SF_FORMAT_DWVW_24 = $0042; // 24 bit Delta Width Variable Word encoding. + SF_FORMAT_DWVW_N = $0043; // N bit Delta Width Variable Word encoding. + + SF_FORMAT_DPCM_8 = $0050; // 8 bit differential PCM (XI only) + SF_FORMAT_DPCM_16 = $0051; // 16 bit differential PCM (XI only) + + SF_FORMAT_VORBIS = $0060; // Xiph Vorbis encoding. + + +const + //* Endian-ness options. *// + SF_ENDIAN_FILE = $00000000; // Default file endian-ness. + SF_ENDIAN_LITTLE = $10000000; // Force little endian-ness. + SF_ENDIAN_BIG = $20000000; // Force big endian-ness. + SF_ENDIAN_CPU = $30000000; // Force CPU endian-ness. + + SF_FORMAT_SUBMASK = $0000FFFF; + SF_FORMAT_TYPEMASK = $0FFF0000; + SF_FORMAT_ENDMASK = $30000000; + +{ +** The following are the valid command numbers for the sf_command() +** interface. The use of these commands is documented in the file +** command.html in the doc directory of the source code distribution. +} +const + SFC_GET_LIB_VERSION = $1000; + SFC_GET_LOG_INFO = $1001; + + SFC_GET_NORM_DOUBLE = $1010; + SFC_GET_NORM_FLOAT = $1011; + SFC_SET_NORM_DOUBLE = $1012; + SFC_SET_NORM_FLOAT = $1013; + SFC_SET_SCALE_FLOAT_INT_READ = $1014; + + SFC_GET_SIMPLE_FORMAT_COUNT = $1020; + SFC_GET_SIMPLE_FORMAT = $1021; + + SFC_GET_FORMAT_INFO = $1028; + + SFC_GET_FORMAT_MAJOR_COUNT = $1030; + SFC_GET_FORMAT_MAJOR = $1031; + SFC_GET_FORMAT_SUBTYPE_COUNT = $1032; + SFC_GET_FORMAT_SUBTYPE = $1033; + + SFC_CALC_SIGNAL_MAX = $1040; + SFC_CALC_NORM_SIGNAL_MAX = $1041; + SFC_CALC_MAX_ALL_CHANNELS = $1042; + SFC_CALC_NORM_MAX_ALL_CHANNELS = $1043; + SFC_GET_SIGNAL_MAX = $1044; + SFC_GET_MAX_ALL_CHANNELS = $1045; + + SFC_SET_ADD_PEAK_CHUNK = $1050; + + SFC_UPDATE_HEADER_NOW = $1060; + SFC_SET_UPDATE_HEADER_AUTO = $1061; + + SFC_FILE_TRUNCATE = $1080; + + SFC_SET_RAW_START_OFFSET = $1090; + + SFC_SET_DITHER_ON_WRITE = $10A0; + SFC_SET_DITHER_ON_READ = $10A1; + + SFC_GET_DITHER_INFO_COUNT = $10A2; + SFC_GET_DITHER_INFO = $10A3; + + SFC_GET_EMBED_FILE_INFO = $10B0; + + SFC_SET_CLIPPING = $10C0; + SFC_GET_CLIPPING = $10C1; + + SFC_GET_INSTRUMENT = $10D0; + SFC_SET_INSTRUMENT = $10D1; + + SFC_GET_LOOP_INFO = $10E0; + + SFC_GET_BROADCAST_INFO = $10F0; + SFC_SET_BROADCAST_INFO = $10F1; + + // Following commands for testing only. + SFC_TEST_IEEE_FLOAT_REPLACE = $6001; + + { + ** SFC_SET_ADD_* values are deprecated and will disappear at some + ** time in the future. They are guaranteed to be here up to and + ** including version 1.0.8 to avoid breakage of existing software. + ** They currently do nothing and will continue to do nothing. + } + SFC_SET_ADD_DITHER_ON_WRITE = $1070; + SFC_SET_ADD_DITHER_ON_READ = $1071; + +{ +** String types that can be set and read from files. Not all file types +** support this and even the file types which support one, may not support +** all string types. +} +const + SF_STR_TITLE = $01; + SF_STR_COPYRIGHT = $02; + SF_STR_SOFTWARE = $03; + SF_STR_ARTIST = $04; + SF_STR_COMMENT = $05; + SF_STR_DATE = $06; + SF_STR_ALBUM = $07; + SF_STR_LICENSE = $08; + SF_STR_TRACKNUMBER = $09; + SF_STR_GENRE = $10; + +{ +** Use the following as the start and end index when doing metadata +** transcoding. +} + SF_STR_FIRST = SF_STR_TITLE; + SF_STR_LAST = SF_STR_GENRE; + +const + // True and false + SF_FALSE = 0; + SF_TRUE = 1; + +const + // Modes for opening files. + SFM_READ = $10; + SFM_WRITE = $20; + SFM_RDWR = $30; + +{ +** Public error values. These are guaranteed to remain unchanged +** for the duration of the library major version number. +** There are also a large number of private error numbers which are +** internal to the library which can change at any time. +} +const + SF_ERR_NO_ERROR = 0; + SF_ERR_UNRECOGNISED_FORMAT = 1; + SF_ERR_SYSTEM = 2; + SF_ERR_MALFORMED_FILE = 3; + SF_ERR_UNSUPPORTED_ENCODING = 4; + +//A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. + +type + TSNDFILE_HANDLE = pointer; // this is not a usual pointer, more like a THandle .. +// so NOT called "PSndFile_handle" +// => we never access members of the internal +// structure where the pointer points to ! +// Everything is managed by the DLL internally !!! +//PSNDFILE_tag = PSNDFILE; + + { +** The following typedef is system specific and is defined when libsndfile is. +** compiled. uos_count_t can be one of loff_t (Linux), off_t (*BSD), +** off64_t (Solaris), __int64_t (Win32) etc. +} +type + Puos_count_t = ^Tuos_count_t; + Tuos_count_t = off_t; + +const + SF_COUNT_MAX = ctypes.clonglong($7FFFFFFFFFFFFFFF); + +{ +** A pointer to a SF_INFO structure is passed to sf_open_read () and filled in. +** On write, the SF_INFO structure is filled in by the user and passed into +** sf_open_write (). +} + +type + PSF_INFO = ^TSF_INFO; + + TSF_INFO = record + frames: Tuos_count_t; + // Used to be called samples. Changed to avoid confusion. + samplerate: ctypes.cint; + channels: ctypes.cint; + format: ctypes.cint; + sections: ctypes.cint; + seekable: ctypes.cint; + end; + +{ +** The SF_FORMAT_INFO struct is used to retrieve information about the sound +** file formats libsndfile supports using the sf_command () interface. +** +** Using this interface will allow applications to support new file formats +** and encoding types when libsndfile is upgraded, without requiring +** re-compilation of the application. +** +** Please consult the libsndfile documentation (particularly the information +** on the sf_command () interface) for examples of its use. +} + +type + PSF_FORMAT_INFO = ^TSF_FORMAT_INFO; + + TSF_FORMAT_INFO = record + format: ctypes.cint; + Name: ctypes.pcchar; + extention: ctypes.pcchar; + end; + +{ +** Enums and typedefs for adding dither on read and write. +** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE +** and SFC_SET_DITHER_ON_READ. +} +const + SFD_DEFAULT_LEVEL = 0; + SFD_CUSTOM_LEVEL = $40000000; + + SFD_NO_DITHER = 500; + SFD_WHITE = 501; + SFD_TRIANGULAR_PDF = 502; + +type + PSF_DITHER_INFO = ^TSF_DITHER_INFO; + + TSF_DITHER_INFO = record + type_: ctypes.cint; + level: ctypes.cdouble; + Name: ctypes.pcchar; + end; + +{ +** Struct used to retrieve information about a file embedded within a +** larger file. See SFC_GET_EMBED_FILE_INFO. +} +type + PSF_EMBED_FILE_INFO = ^TSF_EMBED_FILE_INFO; + + TSF_EMBED_FILE_INFO = record + offset: Tuos_count_t; + length: Tuos_count_t; + end; + +// Structs used to retrieve music sample information from a file. + +const + // The loop mode field in SF_INSTRUMENT will be one of the following. + SF_LOOP_NONE = 800; + SF_LOOP_FORWARD = 801; + SF_LOOP_BACKWARD = 802; + SF_LOOP_ALTERNATING = 803; + +type + PSF_INSTRUMENT = ^TSF_INSTRUMENT; + + TSF_INSTRUMENT = record + gain: ctypes.cint; + basenote, + detune: ctypes.cchar; + velocity_lo, + velocity_hi: ctypes.cchar; + loop_count: ctypes.cint; + loops: array[0..15] of record + mode: ctypes.cint; + start: ctypes.cuint; + end_: ctypes.cuint; + Count: ctypes.cuint; + end; + end; + +// Struct used to retrieve loop information from a file. +type + PSF_LOOP_INFO = ^TSF_LOOP_INFO; + + TSF_LOOP_INFO = record + time_sig_num: ctypes.cushort; + // any positive integer > 0 + time_sig_den: ctypes.cushort; + // any positive power of 2 > 0 + loop_mode: ctypes.cint; // see SF_LOOP enum + + num_beats: ctypes.cint; + // this is NOT the amount of quarter notes !!! + // a full bar of 4/4 is 4 beats + // a full bar of 7/8 is 7 beats + + bpm: ctypes.cfloat; + // suggestion, as it can be calculated using other fields: + // file's lenght, file's sampleRate and our time_sig_den + // -> bpms are always the amount of _quarter notes_ per minute + + root_key: ctypes.cint; + // MIDI note, or -1 for None + future: array[0..5] of ctypes.cint; + end; + + +{ +** Struct used to retrieve broadcast (EBU) information from a file. +** Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE. +} +type + PSF_BROADCAST_INFO = ^TSF_BROADCAST_INFO; + + TSF_BROADCAST_INFO = record + description: array[0..255] of char;//ctypes.cchar; + originator: array[0..31] of char;//ctypes.cchar; + originator_reference: array[0..31] of char;//ctypes.cchar; + origination_date: array[0..9] of char;//ctypes.cchar; + origination_time: array[0..7] of char;//ctypes.cchar; + time_reference_low: ctypes.cuint;//ctypes.cint; + time_reference_high: ctypes.cuint;//ctypes.cint; + version: ctypes.cshort; + umid: array[0..63] of char;//ctypes.cchar; + reserved: array[0..189] of char;//ctypes.cchar; + coding_history_size: ctypes.cuint; + coding_history: array[0..255] of char;//ctypes.cchar; + end; + + // Thanks to Phoenix + type + //pm_get_filelen = ^tm_get_filelen; + tm_get_filelen = + function (pms: PMemoryStream): Tuos_count_t; cdecl; + //pm_seek = ^tm_seek; + tm_seek = + function (offset: Tuos_count_t; whence: cint32; pms: PMemoryStream): Tuos_count_t; cdecl; + //pm_read = ^tm_read; + tm_read = + function (const buf: Pointer; count: Tuos_count_t; pms: PMemoryStream): Tuos_count_t; cdecl; + //pm_write = ^tm_write; + tm_write = + function (const buf: Pointer; count: Tuos_count_t; pms: PMemoryStream): Tuos_count_t; cdecl; + //pm_tell = ^tm_tell; + tm_tell = + function (pms: PMemoryStream): Tuos_count_t; cdecl; + + TSF_VIRTUAL = packed record + sf_vio_get_filelen : tm_get_filelen; + seek : tm_seek; + read : tm_read; + write : tm_write; + tell : tm_tell; + end; + + PSF_VIRTUAL = ^TSF_VIRTUAL; + +{ +** Open the specified file for read, write or both. On error, this will +** return a NULL pointer. To find the error number, pass a NULL SNDFILE +** to sf_perror () or sf_error_str (). +** All calls to sf_open() should be matched with a call to sf_close(). +} +//////////////////////////////////////////////////////////////////////////////////////// + +function sf_open(path: string; mode: ctypes.cint; + var sfinfo: TSF_INFO): TSNDFILE_HANDLE; + +////// Dynamic load : Vars that will hold our dynamically loaded functions.. +var + sf_open_native: function(path: PChar; + mode: ctypes.cint; sfinfo: PSF_INFO): TSNDFILE_HANDLE; cdecl; + +var +sf_version_string: function(): PChar; cdecl; + +var + sf_open_fd: function(fd: ctypes.cint; mode: ctypes.cint; sfinfo: PSF_INFO; + close_desc: ctypes.cint): TSNDFILE_HANDLE; cdecl; + +var + sf_open_virtual: function(sfvirtual: PSF_VIRTUAL; mode: ctypes.cint; + sfinfo: PSF_INFO; user_data: Pointer): TSNDFILE_HANDLE; cdecl; + +var + sf_error: function(sndfile: TSNDFILE_HANDLE): ctypes.cint; cdecl; + +var + sf_strerror: function(sndfile: TSNDFILE_HANDLE): PChar; cdecl; + +var + sf_error_number: function(errnum: ctypes.cint): PChar; cdecl; + +var + sf_perror: function(sndfile: TSNDFILE_HANDLE): ctypes.cint; cdecl; + +var + sf_error_str: function(sndfile: TSNDFILE_HANDLE; + str: ctypes.pcchar; len: size_t): ctypes.cint; cdecl; + +{ + In libsndfile there are 4 functions with the same name (sf_command), 3 of them use the parameter "overload". + In dynamic loading (because of var) we use 4 different names for the 4 functions sf_command : + sf_command_pointer, sf_command_double, sf_command_array, sf_command_tsf. All that 4 functions gonna point + to sf_command in libsndfile library. +} + +var + sf_command_pointer: function(sndfile: TSNDFILE_HANDLE; command: ctypes.cint; + Data: Pointer; datasize: ctypes.cint): ctypes.cint; cdecl; + +var + sf_command_double: function(sndfile: TSNDFILE_HANDLE; command: ctypes.cint; + var Data: double; datasize: ctypes.cint): ctypes.cint; cdecl; + +var + sf_command_array: function(sndfile: TSNDFILE_HANDLE; command: ctypes.cint; + var Data: array of char; datasize: ctypes.cint): ctypes.cint; cdecl; + +var + sf_command_tsf: function(sndfile: TSNDFILE_HANDLE; command: ctypes.cint; + var Data: TSF_BROADCAST_INFO; datasize: ctypes.cint): ctypes.cint; cdecl; + +var + sf_format_check: function(var info: TSF_INFO): ctypes.cint; cdecl; + +{ +** Seek within the waveform data chunk of the SNDFILE. sf_seek () uses +** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as +** stdio.h function fseek (). +** An offset of zero with whence set to SEEK_SET will position the +** read / write pointer to the first data sample. +** On success sf_seek returns the current position in (multi-channel) +** samples from the start of the file. +** Please see the libsndfile documentation for moving the read pointer +** separately from the write pointer on files open in mode SFM_RDWR. +** On error all of these functions return -1. +} + +//the following CONST values originally are NOT in libsndfile.pas: +const + SEEK_SET = 0; //* seek relative to beginning of file */ + +const + SEEK_CUR = 1; //* seek relative to current file position */ + +const + SEEK_END = 2; //* seek relative to end of file */ + +const + SEEK_DATA = 3; //* seek to the next data */ + +const + SEEK_HOLE = 4; //* seek to the next hole */ + +const + SEEK_MAX = SEEK_HOLE; + +var + sf_seek: function(sndfile: TSNDFILE_HANDLE; frame: Tuos_count_t; + whence: ctypes.cint): Tuos_count_t; cdecl; + +{ +** Functions for retrieving and setting string data within sound files. +** Not all file types support this features; AIFF and WAV do. For both +** functions, the str_type parameter must be one of the SF_STR_* values +** defined above. +** On error, sf_set_string() returns non-zero while sf_get_string() +** returns NULL. +} +var + sf_set_string: function(sndfile: TSNDFILE_HANDLE; str_type: ctypes.cint; + str: ctypes.pcchar): ctypes.cint; cdecl; + +var + sf_get_string: function(sndfile: TSNDFILE_HANDLE; + str_type: ctypes.cint): PChar; cdecl; + +var + sf_read_raw: function(sndfile: TSNDFILE_HANDLE; ptr: Pointer; + bytes: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_write_raw: function(sndfile: TSNDFILE_HANDLE; ptr: Pointer; + bytes: Tuos_count_t): Tuos_count_t; cdecl; + +{ +** Functions for reading and writing the data chunk in terms of frames. +** The number of items actually read/written = frames * number of channels. +** sf_xxxx_raw read/writes the raw data bytes from/to the file +** sf_xxxx_short passes data in the native short format +** sf_xxxx_int passes data in the native int format +** sf_xxxx_float passes data in the native float format +** sf_xxxx_double passes data in the native double format +** All of these read/write function return number of frames read/written. +} +var + sf_readf_short: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcshort; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_writef_short: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcshort; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_readf_int: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcint; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_writef_int: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcint; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_readf_float: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcfloat; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_writef_float: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcfloat; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_readf_double: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcdouble; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_writef_double: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcdouble; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +{ +** Functions for reading and writing the data chunk in terms of items. +** Otherwise similar to above. +** All of these read/write function return number of items read/written. +} +var + sf_read_short: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcshort; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_write_short: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcshort; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_read_int: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcint; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_write_int: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcint; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_read_float: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcfloat; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_write_float: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcfloat; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_read_double: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcdouble; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +var + sf_write_double: function(sndfile: TSNDFILE_HANDLE; ptr: ctypes.pcdouble; + frames: Tuos_count_t): Tuos_count_t; cdecl; + +{ +** Close the SNDFILE and clean up all memory allocations associated +** with this file. +** Returns 0 on success, or an error number. +} +var + sf_close: function(sndfile: TSNDFILE_HANDLE): ctypes.cint; cdecl; + +{ +** If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file +** to force the writing of data to disk. If the file is opened SFM_READ +** no action is taken. +} +var + sf_write_sync: function(sndfile: TSNDFILE_HANDLE): ctypes.cint; cdecl; + +{Special function for dynamic loading of lib ...} + +var + sf_Handle: TLibHandle; +// this will hold our handle for the lib; it functions nicely as a mutli-lib prevention unit as well... + +function sf_Load(const libfilename: string): boolean; // load the lib + +procedure sf_Unload(); +// unload and frees the lib from memory : do not forget to call it before close application. + +function sf_IsLoaded: boolean; + +implementation + +var + ReferenceCounter: cardinal = 0; // Reference counter + +function sf_Load(const libfilename: string): boolean; +var +thelib: string; +begin + Result := False; + if sf_Handle <> 0 then + begin + Result := True {is it already there ?}; + //Reference counting + Inc(ReferenceCounter); + end + else + begin {go & load the library} + if Length(libfilename) = 0 then thelib := libsf else thelib := libfilename; + sf_Handle := DynLibs.SafeLoadLibrary(thelib); // obtain the handle we want + if sf_Handle <> DynLibs.NilHandle then + begin {now we tie the functions to the VARs from above} + + Pointer(sf_version_string) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_version_string')); + Pointer(sf_open_native) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_open')); + Pointer(sf_open_fd) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_open_fd')); + Pointer(sf_open_virtual) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_open_virtual')); + Pointer(sf_error) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_error')); + Pointer(sf_strerror) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_strerror')); + Pointer(sf_error_number) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_error_number')); + Pointer(sf_perror) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_perror')); + Pointer(sf_error_str) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_error_str')); + Pointer(sf_command_pointer) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_command')); + Pointer(sf_command_array) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_command')); + Pointer(sf_command_double) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_command')); + Pointer(sf_command_tsf) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_command')); + Pointer(sf_format_check) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_format_check')); + Pointer(sf_seek) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_seek')); + Pointer(sf_set_string) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_set_string')); + Pointer(sf_get_string) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_get_string')); + Pointer(sf_read_raw) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_read_raw')); + Pointer(sf_write_raw) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_write_raw')); + Pointer(sf_readf_short) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_readf_short')); + Pointer(sf_writef_short) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_writef_short')); + Pointer(sf_readf_int) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_readf_int')); + Pointer(sf_writef_int) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_writef_int')); + Pointer(sf_readf_float) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_readf_float')); + Pointer(sf_writef_float) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_writef_float')); + Pointer(sf_readf_double) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_readf_double')); + Pointer(sf_writef_double) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_writef_double')); + Pointer(sf_read_short) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_read_short')); + Pointer(sf_write_short) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_write_short')); + Pointer(sf_read_int) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_read_int')); + Pointer(sf_write_int) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_write_int')); + Pointer(sf_read_float) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_read_float')); + Pointer(sf_write_float) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_write_float')); + Pointer(sf_read_double) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_read_double')); + Pointer(sf_write_double) := DynLibs.GetProcedureAddress( + sf_Handle, PChar('sf_write_double')); + Pointer(sf_close) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_close')); + Pointer(sf_write_sync) := DynLibs.GetProcedureAddress(sf_Handle, PChar('sf_write_sync')); + + end; + Result := sf_IsLoaded; + ReferenceCounter := 1; + end; + +end; + +procedure sf_Unload; +begin + // < Reference counting + if ReferenceCounter > 0 then + Dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if sf_IsLoaded then + begin + DynLibs.UnloadLibrary(sf_Handle); + sf_Handle := DynLibs.NilHandle; + end; + +end; + +function sf_open(path: string; mode: ctypes.cint; + var sfinfo: TSF_INFO): TSNDFILE_HANDLE; +begin + Result := sf_open_native(PChar(path), mode, @sfinfo); +end; + +function sf_IsLoaded: boolean; +begin + Result := (sf_Handle <> dynlibs.NilHandle); +end; + +end. diff --git a/UOS/src/uos_libxmp.pas b/UOS/src/uos_libxmp.pas new file mode 100644 index 0000000..9754bab --- /dev/null +++ b/UOS/src/uos_libxmp.pas @@ -0,0 +1,428 @@ +unit uos_libxmp; +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Pascal Wrapper + Dynamic loading of libxmp library. + Load library with xmp_load() and release with xmp_unload(). + License : modified LGPL. + by Fred vS | fiens@hotmail.com | 2024} + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + dynlibs, + sysutils, + CTypes; + +const + XMP_VERSION = '4.6.0'; + XMP_VERCODE = $040600; + XMP_VER_MAJOR = 4; + XMP_VER_MINOR = 6; + XMP_VER_RELEASE = 0; + +const +{$IFDEF windows} + XMP_LIB_NAME = 'libxmp.dll'; +{$ENDIF} + +{$IFDEF unix} + {$IFDEF darwin} + XMP_LIB_NAME = 'libxmp.dylib'; + {$ELSE} + XMP_LIB_NAME = 'libxmp.so.4.6.0'; + {$ENDIF} +{$ENDIF} + +const + XMP_NAME_SIZE = 64; + + // Note event constants + XMP_KEY_OFF = $81; + XMP_KEY_CUT = $82; + XMP_KEY_FADE = $83; + + // Sample format flags + XMP_FORMAT_8BIT = 1 shl 0; + XMP_FORMAT_UNSIGNED = 1 shl 1; + XMP_FORMAT_MONO = 1 shl 2; + + // Player parameters + XMP_PLAYER_AMP = 0; + XMP_PLAYER_MIX = 1; + XMP_PLAYER_INTERP = 2; + XMP_PLAYER_DSP = 3; + XMP_PLAYER_FLAGS = 4; + XMP_PLAYER_CFLAGS = 5; + XMP_PLAYER_SMPCTL = 6; + XMP_PLAYER_VOLUME = 7; + XMP_PLAYER_STATE = 8; + XMP_PLAYER_SMIX_VOLUME = 9; + XMP_PLAYER_DEFPAN = 10; + XMP_PLAYER_MODE = 11; + XMP_PLAYER_MIXER_TYPE = 12; + XMP_PLAYER_VOICES = 13; + + // Interpolation types + XMP_INTERP_NEAREST = 0; + XMP_INTERP_LINEAR = 1; + XMP_INTERP_SPLINE = 2; + + // DSP effect types + XMP_DSP_LOWPASS = 1 shl 0; + XMP_DSP_ALL = XMP_DSP_LOWPASS; + + // Player state + XMP_STATE_UNLOADED = 0; + XMP_STATE_LOADED = 1; + XMP_STATE_PLAYING = 2; + + // Player flags + XMP_FLAGS_VBLANK = 1 shl 0; + XMP_FLAGS_FX9BUG = 1 shl 1; + XMP_FLAGS_FIXLOOP = 1 shl 2; + XMP_FLAGS_A500 = 1 shl 3; + + // Player modes + XMP_MODE_AUTO = 0; + XMP_MODE_MOD = 1; + XMP_MODE_NOISETRACKER = 2; + XMP_MODE_PROTRACKER = 3; + XMP_MODE_S3M = 4; + XMP_MODE_ST3 = 5; + XMP_MODE_ST3GUS = 6; + XMP_MODE_XM = 7; + XMP_MODE_FT2 = 8; + XMP_MODE_IT = 9; + XMP_MODE_ITSMP = 10; + + // Mixer types + XMP_MIXER_STANDARD = 0; + XMP_MIXER_A500 = 1; + XMP_MIXER_A500F = 2; + + // Sample flags + XMP_SMPCTL_SKIP = 1 shl 0; + + // Limits + XMP_MAX_KEYS = 121; + XMP_MAX_ENV_POINTS = 32; + XMP_MAX_MOD_LENGTH = 256; + XMP_MAX_CHANNELS = 64; + XMP_MAX_SRATE = 49170; + XMP_MIN_SRATE = 4000; + XMP_MIN_BPM = 20; + XMP_MAX_FRAMESIZE = 5 * XMP_MAX_SRATE * 2 div XMP_MIN_BPM; + + // Error codes + XMP_END = 1; + XMP_ERROR_INTERNAL = 2; + XMP_ERROR_FORMAT = 3; + XMP_ERROR_LOAD = 4; + XMP_ERROR_DEPACK = 5; + XMP_ERROR_SYSTEM = 6; + XMP_ERROR_INVALID = 7; + XMP_ERROR_STATE = 8; + +type + xmp_context = PChar; + +type + xmp_channel = record + pan: integer; // Pan de canal (0x80 centrum) + vol: integer; // Volume of canal + flg: integer; // Flags of canal + end; + + xmp_pattern = record + rows: integer; + index: array[1..1] of integer; + end; + + xmp_event = record + note: byte; + ins: byte; + vol: byte; + fxt: byte; + fxp: byte; + f2t: byte; + f2p: byte; + _flag: byte; + end; + + xmp_track = record + rows: integer; + event: array[1..1] of xmp_event; + end; + + xmp_envelope = record + flg: integer; + npt: integer; + scl: integer; + sus: integer; + sue: integer; + lps: integer; + lpe: integer; + Data: array[1..XMP_MAX_ENV_POINTS * 2] of smallint; + end; + + xmp_subinstrument = record + vol: integer; + gvl: integer; + pan: integer; + xpo: integer; + fin: integer; + vwf: integer; + vde: integer; + vra: integer; + vsw: integer; + rvv: integer; + sid: integer; + nna: integer; + dct: integer; + dca: integer; + ifc: integer; + ifr: integer; + end; + + xmp_instrument = record + Name: array[0..31] of char; + vol: integer; + nsm: integer; + rls: integer; + aei: xmp_envelope; + pei: xmp_envelope; + fei: xmp_envelope; + map: array[0..XMP_MAX_KEYS] of record + ins: byte; + xpo: shortint; + end; + sub: ^xmp_subinstrument; + extra: Pointer; + end; + + xmp_sample = record + Name: array[0..31] of char; + len: integer; + lps: integer; + lpe: integer; + flg: integer; + Data: PByte; + end; + + xmp_sequence = record + entry_point: integer; + duration: integer; + end; + + xmp_module = record + Name: array[0..XMP_NAME_SIZE - 1] of char; + typ: array[0..XMP_NAME_SIZE - 1] of char; + pat: integer; + trk: integer; + chn: integer; + ins: integer; + smp: integer; + spd: integer; + bpm: integer; + len: integer; + rst: integer; + gvl: integer; + xxp: ^xmp_pattern; + xxt: ^xmp_track; + xxi: ^xmp_instrument; + xxs: ^xmp_sample; + xxc: array[0..XMP_MAX_CHANNELS - 1] of xmp_channel; + xxo: array[0..XMP_MAX_MOD_LENGTH] of byte; + end; + + xmp_test_info = record + Name: array[0..XMP_NAME_SIZE - 1] of char; + type_: array[0..XMP_NAME_SIZE - 1] of char; + end; + + xmp_module_info = record + md5: array[0..15] of byte; + vol_base: integer; + module: ^xmp_module; + comment: PChar; + num_sequences: integer; + seq_data: ^xmp_sequence; + end; + + xmp_channel_info = record + period: longword; + position: longword; + pitchbend: smallint; + note: byte; + instrument: byte; + sample: byte; + volume: byte; + pan: byte; + reserved: byte; + event: xmp_event; + end; + + xmp_frame_info = record + pos: integer; + pattern: integer; + row: integer; + num_rows: integer; + frame: integer; + speed: integer; + bpm: integer; + time: integer; + total_time: integer; + frame_time: integer; + buffer: Pointer; + buffer_size: integer; + total_size: integer; + volume: integer; + loop_count: integer; + virt_channels: integer; + virt_used: integer; + sequence: integer; + channel_info: array[0..XMP_MAX_CHANNELS - 1] of xmp_channel_info; + end; + + xmp_callbacks = record + read_func: function(dest: Pointer; len, nmemb: longword; priv: Pointer): longword; + seek_func: function(priv: Pointer; offset: longint; whence: integer): integer; + tell_func: function(priv: Pointer): longint; + close_func: function(priv: Pointer): integer; + end; + + { Dynamic load : Vars that will hold our dynamically loaded functions... + + *************************** functions ******************************* } + +var + xmp_create_context: function: pointer; cdecl; + xmp_free_context: procedure(ctx: Pointer); cdecl; + xmp_load_module: function(ctx: Pointer; const filename: PChar): Integer; cdecl; + xmp_load_module_from_memory: function(ctx: xmp_context; const Data: Pointer; size: longint): integer; cdecl; + xmp_load_module_from_file: function(ctx: xmp_context; file_: Pointer; size: longint): integer; cdecl; + xmp_load_module_from_callbacks: function(ctx: xmp_context; file_: Pointer; callbacks: xmp_callbacks): integer; cdecl; + xmp_test_module: function(const filename: PChar; info: xmp_test_info): Integer; cdecl; + xmp_release_module: procedure(ctx: xmp_context); cdecl; + xmp_start_player: function(ctx: xmp_context; rate: Integer; flags: Integer): Integer; cdecl; + xmp_play_buffer: function(ctx: xmp_context; buffer: Pointer; size: Integer; loop: Integer): Integer; cdecl; + xmp_get_frame_info: procedure(ctx: xmp_context; var info: xmp_frame_info); cdecl; + xmp_end_player: procedure(ctx: xmp_context); cdecl; + xmp_get_module_info: procedure(ctx: xmp_context; var info: xmp_module_info); cdecl; + xmp_get_format_list: function(): PAnsiChar; cdecl; + xmp_stop_module: procedure(ctx: xmp_context); cdecl; + xmp_restart_module: procedure(ctx: xmp_context); cdecl; + xmp_channel_vol: function(ctx: xmp_context; channel: Integer; volume: Integer): Integer; cdecl; + xmp_set_player: function(ctx: xmp_context; param: Integer; value: Integer): Integer; cdecl; + +// Not used yet... +//function xmp_test_module_from_memory(const data: Pointer; size: LongInt; info: xmp_test_info): Integer; cdecl; external 'xmp'; +//function xmp_test_module_from_file(file_: Pointer; info: xmp_test_info): Integer; cdecl; external 'xmp'; +//function xmp_test_module_from_callbacks(file_: Pointer; callbacks: xmp_callbacks; info: xmp_test_info): Integer; cdecl; external 'xmp'; +//procedure xmp_scan_module(ctx: xmp_context); cdecl; external 'xmp'; +//function xmp_play_frame(ctx: xmp_context): Integer; cdecl; external 'xmp'; +//procedure xmp_inject_event(ctx: xmp_context; channel: Integer; var event: xmp_event); cdecl; external 'xmp';//function xmp_next_position(ctx: xmp_context): Integer; cdecl; external 'xmp'; +//function xmp_prev_position(ctx: xmp_context): Integer; cdecl; external 'xmp'; +//function xmp_set_position(ctx: xmp_context; pos: Integer): Integer; cdecl; external 'xmp'; +//function xmp_set_row(ctx: xmp_context; row: Integer): Integer; cdecl; external 'xmp'; +//function xmp_set_tempo_factor(ctx: xmp_context; factor: Double): Integer; cdecl; external 'xmp';//function xmp_seek_time(ctx: xmp_context; time: Integer): Integer; cdecl; external 'xmp'; +//function xmp_channel_mute(ctx: xmp_context; channel: Integer; mute: Integer): Integer; cdecl; external 'xmp';//function xmp_get_player(ctx: xmp_context; param: Integer): Integer; cdecl; external 'xmp'; +//function xmp_set_instrument_path(ctx: xmp_context; const path: PChar): Integer; cdecl; external 'xmp'; + + +{Special function for dynamic loading of lib ...} + +var + xmp_Handle: TLibHandle = dynlibs.NilHandle; + {$if defined(cpu32) and defined(windows)} // try load dependency if not in /windows/system32/ + gc_Handle :TLibHandle=dynlibs.NilHandle; + {$endif} +var + ReferenceCounter: cardinal = 0; // Reference counter + +function xmp_IsLoaded: Boolean; inline; + +function xmp_Load(const libfilename: string): Boolean; // load the lib + +procedure xmp_Unload(); // unload and frees the lib from memory : do not forget to call it before close application. + +implementation + +function xmp_IsLoaded: boolean; +begin + Result := (xmp_Handle <> dynlibs.NilHandle); +end; + +Function xmp_Load(const libfilename:string) :boolean; +var +thelib, thelibgcc: string; +begin + Result := False; + if xmp_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin + {$if defined(cpu32) and defined(windows)} + if Length(libfilename) = 0 then thelibgcc := 'libgcc_s_dw2-1.dll' else + thelibgcc := IncludeTrailingBackslash(ExtractFilePath(libfilename)) + 'libgcc_s_dw2-1.dll'; + gc_Handle:= DynLibs.SafeLoadLibrary(thelibgcc); + {$endif} + +{go & load the library} + if Length(libfilename) = 0 then thelib := XMP_LIB_NAME else thelib := libfilename; + xmp_Handle:=DynLibs.LoadLibrary(thelib); // obtain the handle we want + if xmp_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} + +Pointer(xmp_create_context):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_create_context')); +Pointer(xmp_free_context):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_free_context')); +Pointer(xmp_load_module):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_load_module')); +Pointer(xmp_load_module_from_memory):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_load_module_from_memory')); +Pointer(xmp_load_module_from_file):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_load_module_from_file')); +Pointer(xmp_load_module_from_callbacks):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_load_module_from_callbacks')); +Pointer(xmp_test_module):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_test_module')); +Pointer(xmp_release_module):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_release_module')); +Pointer(xmp_start_player):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_start_player')); +Pointer(xmp_play_buffer):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_play_buffer')); +Pointer(xmp_get_frame_info):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_get_frame_info')); +Pointer(xmp_end_player):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_end_player')); +Pointer(xmp_get_module_info):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_get_module_info')); +Pointer(xmp_get_format_list):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_get_format_list')); +Pointer(xmp_stop_module):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_stop_module')); +Pointer(xmp_restart_module):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_restart_module')); +Pointer(xmp_channel_vol):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_channel_vol')); +Pointer(xmp_set_player):=DynLibs.GetProcedureAddress(xmp_Handle,PChar('xmp_set_player')); +end; + Result := xmp_IsLoaded; + ReferenceCounter:=1; +end; + +end; + +Procedure xmp_Unload; +begin + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + if xmp_IsLoaded then + begin + DynLibs.UnloadLibrary(xmp_Handle); + xmp_Handle:=DynLibs.NilHandle; + {$if defined(cpu32) and defined(windows)} + if gc_Handle <> DynLibs.NilHandle then begin + DynLibs.UnloadLibrary(gc_Handle); + gc_Handle:=DynLibs.NilHandle; + end; + {$endif} + end; +end; + + +end. + diff --git a/UOS/src/uos_mpg123.pas b/UOS/src/uos_mpg123.pas new file mode 100644 index 0000000..0334dae --- /dev/null +++ b/UOS/src/uos_mpg123.pas @@ -0,0 +1,1117 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{ This is the dynamical loader for mpg123 library with reference counting. + Load the library with mp_load() and release with mp_unload(). + License : modified LGPL. + Fred van Stappen fiens@hotmail.com } + +unit uos_mpg123; + +interface + +{$DEFINE newversion} // uncomment for mpg123 new version +{$mode objfpc}{$H+} + +uses + ctypes, + classes, dynlibs; + +const +libmp= + {$IFDEF unix} + {$IFDEF darwin} + 'libmpg123.0.dylib'; + {$ELSE} + 'libmpg123.so.0'; + {$ENDIF} + {$ELSE} + 'mpg123.dll'; + {$ENDIF} + +const + SEEK_SET = 0; //* seek relative to beginning of file */ + SEEK_CUR = 1; //* seek relative to current file position */ + SEEK_END = 2; //* seek relative to end of file */ + SEEK_DATA = 3; //* seek to the next data */ + SEEK_HOLE = 4; //* seek to the next hole */ + SEEK_MAX = SEEK_HOLE; + + +type + {$IF Defined(MSWINDOWS)} + off_t = int64; + {$ELSE} + off_t = clonglong; + {$ENDIF} + + Puos_count_t = ^Tuos_count_t; + Tuos_count_t = off_t; + + PMemoryStream = ^TMemoryStream; + + Tmpg123_handle = Pointer; + Tmpg123_init = function(): integer; cdecl; + Tmpg123_exit = procedure; cdecl; + Tmpg123_new = function(const decoder: PChar; + var error: integer): Tmpg123_handle; cdecl; + Tmpg123_delete = procedure(mh: Tmpg123_handle); cdecl; + +const + MPG123_VERBOSE = 0; // set verbosity value for enabling messages + // to stderr, >= 0 makes sense (integer) + MPG123_FLAGS = 1; + // set all flags, p.ex val = MPG123_GAPLESS|MPG123_MONO_MIX (integer) + MPG123_ADD_FLAGS = 2; // add some flags (integer) + MPG123_FORCE_RATE = 3; + // when value > 0, force output rate to that value (integer) + MPG123_DOWN_SAMPLE = 4; // 0=native rate, 1=half rate, 2=quarter rate (integer) + MPG123_RVA = 5; // one of the RVA choices above (integer) + MPG123_DOWNSPEED = 6; // play a frame N times (integer) + MPG123_UPSPEED = 7; // play every Nth frame (integer) + MPG123_START_FRAME = 8; // start with this frame (skip frames before that, integer) + MPG123_DECODE_FRAMES = 9; // decode only this number of frames (integer) + MPG123_ICY_INTERVAL = 10; + // stream contains ICY metadata with this interval (integer) + MPG123_OUTSCALE = 11; // the scale for output samples (amplitude - integer + // or float according to mpg123 output format, normally integer) + MPG123_TIMEOUT = 12; // timeout for reading from a stream (not supported + // on win32, integer) + MPG123_REMOVE_FLAGS = 13; // remove some flags (inverse of MPG123_ADD_FLAGS, integer) + MPG123_RESYNC_LIMIT = 14; // Try resync on frame parsing for that many bytes + // or until end of stream (<0 ... integer). + MPG123_INDEX_SIZE = 15; // Set the frame index size (if supported). + // Values <0 mean that the index is allowed to grow + // dynamically in these steps (in positive direction, + // of course) -- Use this when you really want a + // full index with every individual frame. + MPG123_PREFRAMES = 16; + +{** mpg123_param_flags - Flag bits for MPG123_FLAGS, use the usual binary or to combine. **} + MPG123_FORCE_MONO = $7; // 0111 Force some mono mode: This is a test bitmask + // for seeing if any mono forcing is active. + MPG123_MONO_LEFT = $1; // 0001 Force playback of left channel only. + MPG123_MONO_RIGHT = $2; // 0010 Force playback of right channel only. + MPG123_MONO_MIX = $4; // 0100 Force playback of mixed mono. + MPG123_FORCE_STEREO = $8; // 1000 Force stereo output. + MPG123_FORCE_8BIT = $10; // 00010000 Force 8bit formats. + MPG123_QUIET = $20; + // 00100000 Suppress any printouts (overrules verbose). *) + MPG123_GAPLESS = $40; // 01000000 Enable gapless decoding (default on + // if libmpg123 has support). + MPG123_NO_RESYNC = $80; + // 10000000 Disable resync stream after error. *) + MPG123_SEEKBUFFER = $100; // 000100000000 Enable small buffer on non-seekable + // streams to allow some peek-ahead (for better MPEG sync). + MPG123_FUZZY = $200; // 001000000000 Enable fuzzy seeks (guessing byte + // offsets or using approximate seek points from Xing TOC) + (* 1.72 *) + MPG123_FORCE_FLOAT = $400; // 010000000000 Force floating point output + // (32 or 64 bits depends on mpg123 internal precision). + MPG123_PLAIN_ID3TEXT = $800; + MPG123_IGNORE_STREAMLENGTH = $1000; + + {$IF DEFINED(newversion)} + MPG123_IGNORE_INFOFRAME = $4000; + MPG123_AUTO_RESAMPLE = $8000; + MPG123_PICTURE = $10000; + MPG123_NO_PEEK_END = $20000; + MPG123_SKIP_ID3V2 = $2000; + MPG123_FORCE_SEEKABLE = $40000; + {$endif} + +{** mpg123_param_rva - Choices for MPG123_RVA **} + MPG123_RVA_OFF = 0; // RVA disabled (default). + MPG123_RVA_MIX = 1; // Use mix/track/radio gain. + MPG123_RVA_ALBUM = 2; // Use album/audiophile gain + MPG123_RVA_MAX = MPG123_RVA_ALBUM; // The maximum RVA code, may increase in future. + +type + Tmpg123_param = function(mh: Tmpg123_handle; mpg123_parms_type: integer; + Value: longint; fvalue: double): integer; cdecl; + Tmpg123_getparam = function(mh: Tmpg123_handle; mpg123_parms_type: integer; + var val: longint; var fval: double): integer; cdecl; + +{** mpg123_feature_set - ??? **} +const + MPG123_FEATURE_ABI_UTF8OPEN = 0; + MPG123_FEATURE_OUTPUT_8BIT = 1; + MPG123_FEATURE_OUTPUT_16BIT = 2; + MPG123_FEATURE_OUTPUT_32BIT = 3; + MPG123_FEATURE_INDEX = 4; + MPG123_FEATURE_PARSE_ID3V2 = 5; + MPG123_FEATURE_DECODE_LAYER1 = 6; + MPG123_FEATURE_DECODE_LAYER2 = 7; + MPG123_FEATURE_DECODE_LAYER3 = 8; + MPG123_FEATURE_DECODE_ACCURATE = 9; + MPG123_FEATURE_DECODE_DOWNSAMPLE = 10; + MPG123_FEATURE_DECODE_NTOM = 11; + MPG123_FEATURE_PARSE_ICY = 12; + MPG123_FEATURE_TIMEOUT_READ = 13; + +type + Tmpg123_feature = function(const feature_key: shortint): cardinal; cdecl; + +const + MPG123_DONE = -12; // Message: Track ended. + MPG123_NEW_FORMAT = -11; + // Message: Output format will be different on next call. + MPG123_NEED_MORE = -10; // Message: For feed reader: "Feed me more!" + MPG123_ERR = -1; // <Generic Error> + MPG123_OK = 0; // <Success> + MPG123_BAD_OUTFORMAT = 1; // Unable to set up output format! + MPG123_BAD_CHANNEL = 2; // Invalid channel number specified. + MPG123_BAD_RATE = 3; // Invalid sample rate specified. + MPG123_ERR_16TO8TABLE = 4; + // Unable to allocate memory for 16 to 8 converter table! + MPG123_BAD_PARAM = 5; // Bad parameter id! + MPG123_BAD_BUFFER = 6; + // Bad buffer given -- invalid pointer or too small size. + MPG123_OUT_OF_MEM = 7; // Out of memory -- some malloc() failed. + MPG123_NOT_INITIALIZED = 8; // You didn't initialize the library! + MPG123_BAD_DECODER = 9; // Invalid decoder choice. + MPG123_BAD_HANDLE = 10; // Invalid mpg123 handle. + MPG123_NO_BUFFERS = 11; // Unable to initialize frame buffers (out of memory?). + MPG123_BAD_RVA = 12; // Invalid RVA mode. + MPG123_NO_GAPLESS = 13; // This build doesn't support gapless decoding. + MPG123_NO_SPACE = 14; // Not enough buffer space. + MPG123_BAD_TYPES = 15; // Incompatible numeric data types. + MPG123_BAD_BAND = 16; // Bad equalizer band. + MPG123_ERR_NULL = 17; + // Null pointer given where valid storage address needed. + MPG123_ERR_READER = 18; // Error reading the stream. + MPG123_NO_SEEK_FROM_END = 19; // Cannot seek from end (end is not known). + MPG123_BAD_WHENCE = 20; // Invalid 'whence' for seek function. + MPG123_NO_TIMEOUT = 21; // Build does not support stream timeouts. + MPG123_BAD_FILE = 22; // File access error. + MPG123_NO_SEEK = 23; // Seek not supported by stream. + MPG123_NO_READER = 24; // No stream opened. + MPG123_BAD_PARS = 25; // Bad parameter handle. + MPG123_BAD_INDEX_PAR = 26; // Bad parameters to mpg123_index() + MPG123_OUT_OF_SYNC = 27; // Lost track in bytestream and did not try to resync. + MPG123_RESYNC_FAIL = 28; // Resync failed to find valid MPEG data. + MPG123_NO_8BIT = 29; // No 8bit encoding possible. + MPG123_BAD_ALIGN = 30; // Stack aligmnent error + MPG123_NULL_BUFFER = 31; // NULL input buffer with non-zero size... + MPG123_NO_RELSEEK = 32; // Relative seek not possible (screwed up file offset) + MPG123_NULL_POINTER = 33; + // You gave a null pointer somewhere where you shouldn't have. + MPG123_BAD_KEY = 34; // Bad key value given. + MPG123_NO_INDEX = 35; // No frame index in this build. + MPG123_INDEX_FAIL = 36; // Something with frame index went wrong. + (* 1.72 *) + MPG123_BAD_DECODER_SETUP = 37; // Something prevents a proper decoder setup + MPG123_MISSING_FEATURE = 38; // This feature has not been built into libmpg123. + MPG123_BAD_VALUE = 39; + MPG123_LSEEK_FAILED = 40; + MPG123_BAD_CUSTOM_IO = 41; + MPG123_LFS_OVERFLOW = 42; + +type + Tmpg123_plain_strerror = function(errcode: integer): PChar; cdecl; + Tmpg123_strerror = function(mh: Tmpg123_handle): PChar; cdecl; + Tmpg123_errcode = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_decoders = function(): PPChar; cdecl; + Tmpg123_supported_decoders = function(): PPchar; cdecl; + Tmpg123_decoder = function(mh: Tmpg123_handle; + var decoder_name: PChar): integer; cdecl; + Tmpg123_current_decoder = function(mh: Tmpg123_handle): PChar; cdecl; + +const // mpg123_enc_enum + MPG123_ENC_8 = $00f; (**< 0000 0000 1111 Some 8 bit integer encoding. *) + MPG123_ENC_16 = $040; (**< 0000 0100 0000 Some 16 bit integer encoding. *) + MPG123_ENC_32 = $100; (**< 0001 0000 0000 Some 32 bit integer encoding. *) + MPG123_ENC_SIGNED = $080; (**< 0000 1000 0000 Some signed integer encoding. *) + MPG123_ENC_FLOAT = $800; (**< 1110 0000 0000 Some float encoding. *) + MPG123_ENC_SIGNED_16 = (MPG123_ENC_16 or MPG123_ENC_SIGNED or $10); + (**< 0000 1101 0000 signed 16 bit *) + MPG123_ENC_UNSIGNED_16 = (MPG123_ENC_16 or $20); + (**< 0000 0110 0000 unsigned 16 bit*) + MPG123_ENC_UNSIGNED_8 = $01; + (**< 0000 0000 0001 unsigned 8 bit*) + MPG123_ENC_SIGNED_8 = (MPG123_ENC_SIGNED or $02); + (**< 0000 1000 0010 signed 8 bit*) + MPG123_ENC_ULAW_8 = $04; + (**< 0000 0000 0100 ulaw 8 bit*) + MPG123_ENC_ALAW_8 = $08; + (**< 0000 0000 1000 alaw 8 bit *) + MPG123_ENC_SIGNED_32 = MPG123_ENC_32 or MPG123_ENC_SIGNED or $1000; + (**< 0001 1001 0000 signed 32 bit *) + MPG123_ENC_UNSIGNED_32 = MPG123_ENC_32 or $2000; + (**< 0001 0010 0000 unsigned 32 bit *) + MPG123_ENC_FLOAT_32 = $200; + (**< 0010 0000 0000 32bit float *) + MPG123_ENC_FLOAT_64 = $400; + (**< 0100 0000 0000 64bit float *) + MPG123_ENC_ANY = MPG123_ENC_SIGNED_16 or MPG123_ENC_UNSIGNED_16 or + MPG123_ENC_UNSIGNED_8 or MPG123_ENC_SIGNED_8 or + MPG123_ENC_ULAW_8 or MPG123_ENC_ALAW_8 or + MPG123_ENC_SIGNED_32 or MPG123_ENC_UNSIGNED_32 or + MPG123_ENC_FLOAT_32 or MPG123_ENC_FLOAT_64; (**< any encoding *) + + MPG123_LEFT = $1; + MPG123_RIGHT = $2; + MPG123_LR = $3; + +type +{$if defined(cpu64)} + cuint64 = qword; + size_t = cuint64; +{$else} + cuint32 = longword; + size_t = cuint32; +{$endif} + + psize_t = ^size_t; + coff_t = size_t; //Int64; + PLong = Pointer; + pplong = array of PLong; + PInteger = Pointer; + PPInteger = array of PInteger; + + Tmpg123_rates = procedure(var list: pplong; var number: size_t); cdecl; + Tmpg123_encodings = procedure(var list: ppinteger; var number: size_t); cdecl; + Tmpg123_encsize = function(encoding: integer): integer; cdecl; + Tmpg123_format_none = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_format_all = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_format = function(mh: Tmpg123_handle; rate: cardinal; + channels: integer; encodings: integer): integer; cdecl; + Tmpg123_format_support = function(mh: Tmpg123_handle; rate: cardinal; + encoding: integer): integer; cdecl; + Tmpg123_getformat = function(mh: Tmpg123_handle; var rate: cardinal; + var channels, encoding: integer): integer; cdecl; + Tmpg123_open = function(mh: Tmpg123_handle; path: PChar): integer; cdecl; + Tmpg123_open_fd = function(mh: Tmpg123_handle; fd: integer): integer; cdecl; + +{$IF DEFINED(newversion)} + Tmpg123_open_handle = function(mh: Tmpg123_handle; pha: pointer): integer; cdecl; + {* Use an opaque handle as bitstream input. This works only with the + * replaced I/O from mpg123_replace_reader_handle()! + * mpg123_close() will call the cleanup callback for your handle (if you gave one). + * \return MPG123_OK on success + } + Tmpg123_replace_reader_handle = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer ; cleanup : pointer): integer; cdecl; + {* Replace I/O functions with your own ones operating on some kind of handle instead of integer descriptors. + * The handle is a void pointer, so you can pass any data you want... + * mpg123_open_handle() is the call you make to use the I/O defined here. + * There is no fallback to internal read/seek here. + * Note: As it would be troublesome to mess with this while having a file open, + * this mpg123_close() is implied here. + * \param r_read The callback for reading (behaviour like posix read). + * \param r_lseek The callback for seeking (like posix lseek). + * \param cleanup A callback to clean up an I/O handle on mpg123_close, can be NULL for none (you take care of cleaning your handles). } + + Tmpg123_replace_reader = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer): integer; cdecl; + Tmpg123_getformat2 = function(mh: Tmpg123_handle; var rate: cardinal; + var channels, encoding: integer; var clear_flag: integer): integer; cdecl; + Tmpg123_framelength = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_framepos = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_spf = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_meta_free = procedure(mh: Tmpg123_handle); cdecl; + Tmpg123_set_index = function(mh: Tmpg123_handle; var offsets: PPInteger; + step: coff_t; fill: size_t): integer; + +{$if not(defined(cpu64) and defined(unix))} + Tmpg123_open_32 = function(mh: Tmpg123_handle; path: PChar): integer; cdecl; + Tmpg123_open_fd_32 = function(mh: Tmpg123_handle; fd: integer): integer; cdecl; + Tmpg123_open_handle_32 = function(mh: Tmpg123_handle; pha: pointer): integer; cdecl; + Tmpg123_decode_frame_32 = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + Tmpg123_framebyframe_decode_32 = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + Tmpg123_framepos_32 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tell_32 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tellframe_32 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_seek_32 = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer): integer; cdecl; + Tmpg123_feedseek_32 = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer; var input_offset: coff_t): coff_t; cdecl; + Tmpg123_seek_frame_32 = function(mh: Tmpg123_handle; frameoff: coff_t; + whence: integer): coff_t; cdecl; + Tmpg123_timeframe_32 = function(mh: Tmpg123_handle; sec: double): coff_t; cdecl; + Tmpg123_index_32 = function(mh: Tmpg123_handle; var offsets: PPInteger; + var step: coff_t; var fill: size_t): integer; + Tmpg123_set_index_32 = function(mh: Tmpg123_handle; var offsets: PPInteger; + step: coff_t; fill: size_t): integer; + Tmpg123_position_32 = function(mh: Tmpg123_handle; frame_offset: coff_t; + buffered_bytes: coff_t; + var current_frame: coff_t; var frames_left: coff_t; + var current_seconds: double; + var seconds_left: double): integer; cdecl; + Tmpg123_framelength_32 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_length_32 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_set_filesize_32 = function(mh: Tmpg123_handle; size: coff_t): integer; cdecl; + Tmpg123_replace_reader_32 = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer): integer; cdecl; + Tmpg123_replace_reader_handle_32 = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer ; cleanup : pointer): integer; cdecl; +{$endif} + + + Tmpg123_open_64 = function(mh: Tmpg123_handle; path: PChar): integer; cdecl; + Tmpg123_open_fd_64 = function(mh: Tmpg123_handle; fd: integer): integer; cdecl; + Tmpg123_open_handle_64 = function(mh: Tmpg123_handle; pha: pointer): integer; cdecl; + Tmpg123_decode_frame_64 = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + Tmpg123_framebyframe_decode_64 = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + Tmpg123_framepos_64 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tell_64 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tellframe_64 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_seek_64 = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer): integer; cdecl; + Tmpg123_feedseek_64 = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer; var input_offset: coff_t): coff_t; cdecl; + Tmpg123_seek_frame_64 = function(mh: Tmpg123_handle; frameoff: coff_t; + whence: integer): coff_t; cdecl; + Tmpg123_timeframe_64 = function(mh: Tmpg123_handle; sec: double): coff_t; cdecl; + Tmpg123_index_64 = function(mh: Tmpg123_handle; var offsets: PPInteger; + var step: coff_t; var fill: size_t): integer; + Tmpg123_set_index_64 = function(mh: Tmpg123_handle; var offsets: PPInteger; + step: coff_t; fill: size_t): integer; + Tmpg123_position_64 = function(mh: Tmpg123_handle; frame_offset: coff_t; + buffered_bytes: coff_t; + var current_frame: coff_t; var frames_left: coff_t; + var current_seconds: double; + var seconds_left: double): integer; cdecl; + Tmpg123_framelength_64 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_length_64 = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_set_filesize_64 = function(mh: Tmpg123_handle; size: coff_t): integer; cdecl; + Tmpg123_replace_reader_64 = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer): integer; cdecl; + Tmpg123_replace_reader_handle_64 = function(mh : Tmpg123_handle; r_read : pointer; + r_lseek : pointer ; cleanup : pointer): integer; cdecl; +{$endif} + + Tmpg123_open_feed = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_close = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_read = function(mh: Tmpg123_handle; outmemory: pcfloat; + outmemsize: size_t; var done: size_t): integer; cdecl; + Tmpg123_feed = function(mh: Tmpg123_handle; inbuf: Pointer; + size: size_t): integer; cdecl; + Tmpg123_decode = function(mh: Tmpg123_handle; inmemory: Pointer; + inmemsize: size_t; outmemory: Pointer; + outmemsize: size_t; var done: size_t): integer; cdecl; + Tmpg123_decode_frame = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + +{$IF DEFINED(newversion)} + Tmpg123_framebyframe_decode = function(mh: Tmpg123_handle; var num: coff_t; + audio: PPChar; var bytes: size_t): integer; cdecl; + Tmpg123_framebyframe_next = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_framedata = function(mh: Tmpg123_handle; var header: longint; + bodydata: PPChar; var bodybytes: size_t): integer; cdecl; +{$endif} + + Tmpg123_tell = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tellframe = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_tell_stream = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_seek = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer): integer; cdecl; + Tmpg123_feedseek = function(mh: Tmpg123_handle; sampleoff: coff_t; + whence: integer; var input_offset: coff_t): coff_t; + cdecl; + Tmpg123_seek_frame = function(mh: Tmpg123_handle; frameoff: coff_t; + whence: integer): coff_t; cdecl; + Tmpg123_timeframe = function(mh: Tmpg123_handle; sec: double): coff_t; cdecl; + Tmpg123_index = function(mh: Tmpg123_handle; var offsets: PPInteger; + var step: coff_t; var fill: size_t): integer; + Tmpg123_position = function(mh: Tmpg123_handle; frame_offset: coff_t; + buffered_bytes: coff_t; + var current_frame: coff_t; var frames_left: coff_t; + var current_seconds: double; + var seconds_left: double): integer; cdecl; + Tmpg123_eq = function(mh: Tmpg123_handle; mpg123_channels_channel: integer; + band: integer; val: double): integer; cdecl; + Tmpg123_geteq = function(mh: Tmpg123_handle; mpg123_channels_channel: integer; + band: integer): double; cdecl; + Tmpg123_reset_eq = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_volume = function(mh: Tmpg123_handle; vol: double): integer; cdecl; + Tmpg123_volume_change = function(mh: Tmpg123_handle; change: double): integer; cdecl; + Tmpg123_getvolume = function(mh: Tmpg123_handle; var base: double; + var really: double; var rva_db: double): integer; + cdecl; + +const + MPG123_CBR = 0; (**< Constant Bitrate Mode (default) *) + MPG123_VBR = 1; (**< Variable Bitrate Mode *) + MPG123_ABR = 2; (**< Average Bitrate Mode *) + +(** enum mpg123_version - Enumeration of the MPEG Versions *) + MPG123_1_0 = 0; (**< MPEG Version 1.0 *) + MPG123_2_0 = 1; (**< MPEG Version 2.0 *) + MPG123_2_5 = 2; (**< MPEG Version 2.5 *) + +(** enum mpg123_mode - Enumeration of the MPEG Audio mode. + * Only the mono mode has 1 channel, the others have 2 channels. *) + MPG123_M_STEREO = 0; (**< Standard Stereo. *) + MPG123_M_JOINT = 1; (**< Joint Stereo. *) + MPG123_M_DUAL = 2; (**< Dual Channel. *) + MPG123_M_MONO = 3; (**< Single Channel. *) + + (** enum mpg123_flags - Enumeration of the MPEG Audio flag bits *) + MPG123_CRC = $1; (**< The bitstream is error protected using 16-bit CRC. *) + MPG123_COPYRIGHT = $2; (**< The bitstream is copyrighted. *) + MPG123_PRIVATE = $4; (**< The private bit has been set. *) + MPG123_ORIGINAL = $8; (**< The bitstream is an original, not a copy. *) + +(** Data structure for storing information about a frame of MPEG Audio *) +type + pmpg123_frameinfo = ^Tmpg123_frameinfo; + Tmpg123_frameinfo = record + mpg123_version_version: longword; (**< The MPEG version (1.0/2.0/2.5). *) + layer: integer; (**< The MPEG Audio Layer (MP1/MP2/MP3). *) + rate: longword; (**< The sampling rate in Hz. *) + mpg123_mode_mode: longint; + (**< The audio mode (Mono, Stereo, Joint-stero, Dual Channel). *) + mode_ext: integer; (**< The mode extension bit flag. *) + framesize: integer; (**< The size of the frame (in bytes). *) + mpg123_flags_flags: longword; (**< MPEG Audio flag bits. *) + emphasis: integer; (**< The emphasis type. *) + bitrate: integer; (**< Bitrate of the frame (kbps). *) + abr_rate: integer; (**< The target average bitrate. *) + mpg123_vbr_vbr: longword; (**< The VBR mode. *) + end; + + Tmpg123_info = function(mh: Tmpg123_handle; + var mi: Tmpg123_frameinfo): integer; cdecl; + Tmpg123_safe_buffer = function(): size_t; cdecl; + Tmpg123_scan = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_length = function(mh: Tmpg123_handle): coff_t; cdecl; + Tmpg123_set_filesize = function(mh: Tmpg123_handle; size: coff_t): integer; cdecl; + Tmpg123_tpf = function(mh: Tmpg123_handle): double; cdecl; + Tmpg123_clip = function(mh: Tmpg123_handle): longint; cdecl; + +const + MPG123_ACCURATE = 1; +(**< Query if positons are currently accurate (integer value, 0 if false, 1 if true) *) + +type + Tmpg123_getstate = function(mh: Tmpg123_handle; mpg123_state_key: integer; + var val: longint; var fval: double): integer; cdecl; + Pmpg123_string = ^Tmpg123_string; + + Tmpg123_string = record + p: PChar; (**< pointer to the string data *) + size: size_t; (**< raw number of bytes allocated *) + fill: size_t; + (**< number of used bytes (including closing zero byte) *) + end; + + Tmpg123_init_string = procedure(psb: Pmpg123_string); cdecl; + Tmpg123_free_string = procedure(psb: Pmpg123_string); cdecl; + Tmpg123_resize_string = function(psb: Pmpg123_string; news: size_t): integer; cdecl; + Tmpg123_grow_string = function(psb: Pmpg123_string; news: size_t): integer; cdecl; + Tmpg123_copy_string = function(strfrom, strto: Pmpg123_string): integer; cdecl; + Tmpg123_add_string = function(psb: Pmpg123_string; stuff: PChar): integer; cdecl; + Tmpg123_add_substring = function(psb: Pmpg123_string; stuff: PChar; + strfrom, Count: size_t): integer; cdecl; + Tmpg123_set_string = function(psb: Pmpg123_string; stuff: PChar): integer; cdecl; + Tmpg123_set_substring = function(psb: Pmpg123_string; stuff: PChar; + strfrom, Count: size_t): integer; cdecl; + Tmpg123_strlen = function(psb: Pmpg123_string; utf8: integer): size_t; + +{$IF DEFINED(newversion)} + Tmpg123_chomp_string = function(psb: Pmpg123_string): integer; +{$endif} + +const + mpg123_text_unknown = 0; + mpg123_text_utf8 = 1; + mpg123_text_latin1 = 2; + mpg123_text_icy = 3; + mpg123_text_cp1252 = 4; + mpg123_text_utf16 = 5; + mpg123_text_utf16bom = 6; + mpg123_text_utf16be = 7; + mpg123_text_max = 7; + mpg123_id3_latin1 = 0; + mpg123_id3_utf16bom = 1; + mpg123_id3_utf16be = 2; + mpg123_id3_utf8 = 3; + mpg123_id3_enc_max = 3; + + type + Tmpg123_enc_from_id3 = function(id3_enc_byte: byte): integer; cdecl; + Tmpg123_store_utf8 = function(psb: Pmpg123_string; mpg123_text_encoding: integer; + var Source: byte; + source_size: size_t): integer; cdecl; + Pmpg123_text = ^Tmpg123_text; + + Tmpg123_text = record + lang: array[0..2] of char; + (**< Three-letter language code (not terminated). *) + id: array[0..3] of char; + (**< The ID3v2 text field id, like TALB, TPE2, ... (4 characters, no string termination). *) + description: Tmpg123_string; (**< Empty for the generic comment... *) + Text: Tmpg123_string; (**< ... *) + end; + +{$IF DEFINED(newversion)} + {* The picture type values from ID3v2. } + mpg123_id3_pic_type = Longint; + const + mpg123_id3_pic_other = 0; + mpg123_id3_pic_icon = 1; + mpg123_id3_pic_other_icon = 2; + mpg123_id3_pic_front_cover = 3; + mpg123_id3_pic_back_cover = 4; + mpg123_id3_pic_leaflet = 5; + mpg123_id3_pic_media = 6; + mpg123_id3_pic_lead = 7; + mpg123_id3_pic_artist = 8; + mpg123_id3_pic_conductor = 9; + mpg123_id3_pic_orchestra = 10; + mpg123_id3_pic_composer = 11; + mpg123_id3_pic_lyricist = 12; + mpg123_id3_pic_location = 13; + mpg123_id3_pic_recording = 14; + mpg123_id3_pic_performance = 15; + mpg123_id3_pic_video = 16; + mpg123_id3_pic_fish = 17; + mpg123_id3_pic_illustration = 18; + mpg123_id3_pic_artist_logo = 19; + mpg123_id3_pic_publisher_logo = 20; + + {* Sub data structure for ID3v2, for storing picture data including comment. + * This is for the ID3v2 APIC field. You should consult the ID3v2 specification + * for the use of the APIC field ("frames" in ID3v2 documentation, I use "fields" + * here to separate from MPEG frames). } + + type + PPmpg123_picture = ^Pmpg123_picture; + Pmpg123_picture = ^Tmpg123_picture; + + Tmpg123_picture = record + pictype : char; + description : Tmpg123_string; + mime_type : Tmpg123_string; + size : size_t; + data : Pbyte; + end; + +{$endif} + +type + PPmpg123_id3v2 = ^Pmpg123_id3v2; + Pmpg123_id3v2 = ^Tmpg123_id3v2; + + Tmpg123_id3v2 = record + Version: byte; (**< 3 or 4 for ID3v2.3 or ID3v2.4. *) + Title: Pmpg123_string; + (**< Title string (pointer into text_list). *) + Artist: Pmpg123_string; + (**< Artist string (pointer into text_list). *) + Album: Pmpg123_string; + (**< Album string (pointer into text_list). *) + Year: Pmpg123_string; + (**< The year as a string (pointer into text_list). *) + Genre: Pmpg123_string; (**< Genre String (pointer into text_list). The genre string(s) + may very well need postprocessing, esp. for ID3v2.3. *) + Comment: Pmpg123_string; + (**< Pointer to last encountered comment text with empty description. *) + (* Encountered ID3v2 fields are appended to these lists. + There can be multiple occurences, the pointers above always point + to the last encountered data. *) + Comment_list: Pmpg123_text; (**< Array of comments. *) + NumComments: size_t; (**< Number of comments. *) + Text: Pmpg123_text; (**< Array of ID3v2 text fields *) + NumTexts: size_t; (**< Numer of text fields. *) + Extra: Pmpg123_text; + (**< The array of extra (TXXX) fields. *) + NumExtras: size_t; + (**< Number of extra text (TXXX) fields. *) + + {$IF DEFINED(newversion)} + picture : Pmpg123_picture; + pictures : size_t; + {$endif} + end; + + PPmpg123_id3v1 = ^Pmpg123_id3v1; + Pmpg123_id3v1 = ^Tmpg123_id3v1; + Tmpg123_id3v1 = record + tag: array[0..2] of char; + (**< Always the string "TAG", the classic intro. *) + title: array[0..29] of char; (**< Title string. *) + artist: array[0..29] of char; (**< Artist string. *) + album: array[0..29] of char; (**< Album string. *) + year: array[0..3] of char; (**< Year string. *) + comment: array[0..29] of char; (**< Comment string. *) + genre: byte; (**< Genre index. *) + end; + +const + MPG123_ID3_ = $03; + (**< 0011 There is some ID3 info. Also matches 0010 or NEW_ID3. *) + MPG123_NEW_ID3_ = $01; + (**< 0001 There is ID3 info that changed since last call to mpg123_id3. *) + MPG123_ICY_ = $0C; + (**< 1100 There is some ICY info. Also matches 0100 or NEW_ICY.*) + MPG123_NEW_ICY_ = $04; +(**< 0100 There is ICY info that changed since last call to mpg123_icy. *) + +type + Tmpg123_meta_check = function(mh: Tmpg123_handle): integer; cdecl; + Tmpg123_id3 = function(mh: Tmpg123_handle; v1: PPmpg123_id3v1; + v2: PPmpg123_id3v2): integer; cdecl; + Tmpg123_icy = function(mh: Tmpg123_handle; var icy_meta: PChar): integer; cdecl; + // Tmpg123_icy = function(mh: Tmpg123_handle; icy_meta: PPChar): integer; cdecl; + Tmpg123_icy2utf8 = function(icy_text: PChar): PChar; cdecl; + +const + _NUM_CHANNELS = 2; + _MPG123_RATES = 9; + _MPG123_ENCODINGS = 10; + +type + Pmpg123_pars = ^Tmpg123_pars; + + Tmpg123_pars = record + verbose: integer; (* verbose level *) + flags: longword; (* combination of above *) + force_rate: longword; + down_sample: integer; + rva: integer; (* (which) rva to do: + 0: nothing, + 1: radio/mix/track + 2: album/audiophile *) + halfspeed: longword; + doublespeed: longword; + {$IFNDEF WINDOWS} + timeout: longword; + {$ENDIF} + audio_caps: array[0.._NUM_CHANNELS - 1, 0.._MPG123_RATES, + 0.._MPG123_ENCODINGS - 1] of char; + (* long start_frame; *)(* frame offset to begin with *) + (* long frame_number;*)(* number of frames to decode *) + icy_interval: longword; + outscale: double; // longword ? + resync_limit: longword; + index_size: longint; + (* Long, because: negative values have a meaning. *) + dummy: array[0..64] of byte; // dummy + end; + + Tmpg123_parnew = function(mp: Pmpg123_pars; decoder: PChar; + var error: integer): Tmpg123_handle; cdecl; + Tmpg123_new_pars = function(var error: integer): Pmpg123_pars; cdecl; + Tmpg123_delete_pars = procedure(mp: Pmpg123_pars); cdecl; + Tmpg123_fmt_none = function(mp: Pmpg123_pars): integer; cdecl; + Tmpg123_fmt_all = function(mp: Pmpg123_pars): integer; cdecl; + Tmpg123_fmt = function(mh: Pmpg123_pars; rate: longword; + channels, encodings: integer): integer; cdecl; + Tmpg123_fmt_support = function(mh: Pmpg123_pars; rate: longword; + encoding: integer): integer; cdecl; + Tmpg123_par = function(mp: Pmpg123_pars; mpg123_parms_type: integer; + Value: longword; fvalue: double): integer; + cdecl; + Tmpg123_getpar = function(mp: Pmpg123_pars; mpg123_parms_type: integer; + var val: longword; var fval: double) + : integer; cdecl; + Tmpg123_replace_buffer = function(mh: Tmpg123_handle; Data: Pointer; + size: size_t): integer; cdecl; + + Tmpg123_outblock = function(mh: Tmpg123_handle): size_t; cdecl; + +{ *** the mpg123 library functions : ***************************************** } +var + mpg123_init: Tmpg123_init; + mpg123_exit: Tmpg123_exit; + mpg123_new: Tmpg123_new; + mpg123_delete: Tmpg123_delete; + + mpg123_param: Tmpg123_param; + mpg123_getparam: Tmpg123_getparam; + mpg123_feature: Tmpg123_feature; + + mpg123_plain_strerror: Tmpg123_plain_strerror; + mpg123_strerror: Tmpg123_strerror; + mpg123_errcode: Tmpg123_errcode; + mpg123_decoders: Tmpg123_decoders; + mpg123_supported_decoders: Tmpg123_supported_decoders; + mpg123_decoder: Tmpg123_decoder; + mpg123_current_decoder: Tmpg123_current_decoder; + + mpg123_rates: Tmpg123_rates; + mpg123_encodings: Tmpg123_encodings; + mpg123_encsize: Tmpg123_encsize; + mpg123_format_none: Tmpg123_format_none; + mpg123_format_all: Tmpg123_format_all; + mpg123_format: Tmpg123_format; + mpg123_format_support: Tmpg123_format_support; + mpg123_getformat: Tmpg123_getformat; + mpg123_getformat2: Tmpg123_getformat2; + +(** \defgroup mpg123_input mpg123 file input and decoding + * Functions for input bitstream and decoding operations. *) + + mpg123_open: Tmpg123_open; + mpg123_open_fd: Tmpg123_open_fd; + +{$IF DEFINED(newversion)} +{$if not(defined(cpu64) and defined(unix))} + mpg123_open_32: Tmpg123_open_32; + mpg123_open_fd_32: Tmpg123_open_fd_32; + mpg123_open_handle_32 : Tmpg123_open_handle_32; +{$ifend} + mpg123_open_64: Tmpg123_open_64; + mpg123_open_fd_64: Tmpg123_open_fd_64; + mpg123_open_handle: Tmpg123_open_handle; + mpg123_open_handle_64: Tmpg123_open_handle_64; + mpg123_replace_reader: Tmpg123_replace_reader; + mpg123_replace_reader_handle: Tmpg123_replace_reader_handle; + mpg123_set_index: Tmpg123_set_index; + {$endif} + + mpg123_open_feed: Tmpg123_open_feed; + mpg123_close: Tmpg123_close; + mpg123_read: Tmpg123_read; + mpg123_feed: Tmpg123_feed; + mpg123_decode: Tmpg123_decode; + mpg123_decode_frame: Tmpg123_decode_frame; + mpg123_framepos: Tmpg123_framepos; + +{$IF DEFINED(newversion)} + {$if not(defined(cpu64) and defined(unix))} + mpg123_decode_frame_32: Tmpg123_decode_frame_32; + mpg123_framebyframe_decode_32: Tmpg123_framebyframe_decode_32; + mpg123_tell_32: Tmpg123_tell_32; + mpg123_framepos_32: Tmpg123_framepos_32; + mpg123_tellframe_32: Tmpg123_tellframe_32; + mpg123_seek_32: Tmpg123_seek_32; + mpg123_seek_frame_32: Tmpg123_seek_frame_32; + mpg123_timeframe_32: Tmpg123_timeframe_32; + mpg123_index_32: Tmpg123_index_32; + mpg123_set_index_32: Tmpg123_set_index_32; + mpg123_position_32: Tmpg123_position_32; + mpg123_framelength_32: Tmpg123_framelength_32; + mpg123_length_32: Tmpg123_length_32; + mpg123_set_filesize_32: Tmpg123_set_filesize_32; + mpg123_replace_reader_32: Tmpg123_replace_reader_32; + mpg123_replace_reader_handle_32: Tmpg123_replace_reader_handle_32; + {$ifend} + mpg123_framebyframe_decode: Tmpg123_framebyframe_decode; + mpg123_framebyframe_next: Tmpg123_framebyframe_next; + mpg123_framedata: Tmpg123_framedata; + mpg123_decode_frame_64: Tmpg123_decode_frame_64; + mpg123_framebyframe_decode_64: Tmpg123_framebyframe_decode_64; + mpg123_tell_64: Tmpg123_tell_64; + mpg123_framepos_64: Tmpg123_framepos_64; + mpg123_tellframe_64: Tmpg123_tellframe_64; + mpg123_seek_64: Tmpg123_seek_64; + mpg123_seek_frame_64: Tmpg123_seek_frame_64; + mpg123_timeframe_64: Tmpg123_timeframe_64; + mpg123_index_64: Tmpg123_index_64; + mpg123_set_index_64: Tmpg123_set_index_64; + mpg123_position_64: Tmpg123_position_64; + mpg123_framelength_64: Tmpg123_framelength_64; + mpg123_length_64: Tmpg123_length_64; + mpg123_set_filesize_64: Tmpg123_set_filesize_64; + mpg123_replace_reader_64: Tmpg123_replace_reader_64; + mpg123_replace_reader_handle_64: Tmpg123_replace_reader_handle_64; +{$endif} + + mpg123_tell: Tmpg123_tell; + mpg123_tellframe: Tmpg123_tellframe; + mpg123_tell_stream: Tmpg123_tell_stream; + mpg123_seek: Tmpg123_seek; + mpg123_feedseek: Tmpg123_feedseek; + mpg123_seek_frame: Tmpg123_seek_frame; + mpg123_timeframe: Tmpg123_timeframe; + mpg123_index: Tmpg123_index; + mpg123_position: Tmpg123_position; + +(** \defgroup mpg123_voleq mpg123 volume and equalizer **) + mpg123_eq: Tmpg123_eq; + mpg123_geteq: Tmpg123_geteq; + mpg123_reset_eq: Tmpg123_reset_eq; + mpg123_volume: Tmpg123_volume; + mpg123_volume_change: Tmpg123_volume_change; + mpg123_getvolume: Tmpg123_getvolume; + +(** \defgroup mpg123_status mpg123 status and information **) + mpg123_info: Tmpg123_info; + mpg123_safe_buffer: Tmpg123_safe_buffer; + mpg123_scan: Tmpg123_scan; + mpg123_length: Tmpg123_length; + mpg123_framelength: Tmpg123_framelength; + mpg123_set_filesize: Tmpg123_set_filesize; + mpg123_tpf: Tmpg123_tpf; + mpg123_spf: Tmpg123_spf; + mpg123_clip: Tmpg123_clip; + mpg123_getstate: Tmpg123_getstate; + +(** \defgroup mpg123_metadata mpg123 metadata handling *) + mpg123_init_string: Tmpg123_init_string; + mpg123_free_string: Tmpg123_free_string; + mpg123_resize_string: Tmpg123_resize_string; + mpg123_grow_string: Tmpg123_grow_string; + mpg123_copy_string: Tmpg123_copy_string; + mpg123_add_string: Tmpg123_add_string; + mpg123_add_substring: Tmpg123_add_substring; + mpg123_set_string: Tmpg123_set_string; + mpg123_set_substring: Tmpg123_set_substring; + mpg123_strlen: Tmpg123_strlen; + mpg123_chomp_string :Tmpg123_chomp_string; + + mpg123_enc_from_id3: Tmpg123_enc_from_id3; + mpg123_store_utf8: Tmpg123_store_utf8; + + mpg123_meta_check: Tmpg123_meta_check; + mpg123_meta_free: Tmpg123_meta_free; + mpg123_id3: Tmpg123_id3; + mpg123_icy: Tmpg123_icy; + mpg123_icy2utf8: Tmpg123_icy2utf8; + +(** \defgroup mpg123_advpar mpg123 advanced parameter API *) + mpg123_parnew: Tmpg123_parnew; + mpg123_new_pars: Tmpg123_new_pars; + mpg123_delete_pars: Tmpg123_delete_pars; + mpg123_fmt_none: Tmpg123_fmt_none; + mpg123_fmt_all: Tmpg123_fmt_all; + mpg123_fmt: Tmpg123_fmt; + mpg123_fmt_support: Tmpg123_fmt_support; + mpg123_par: Tmpg123_par; + mpg123_getpar: Tmpg123_getpar; + mpg123_replace_buffer: Tmpg123_replace_buffer; + mpg123_outblock: Tmpg123_outblock; + +{Special function for dynamic loading of lib ...} + +var + Mp_Handle: TLibHandle; + // this will hold our handle for the lib; it functions nicely as a mutli-lib prevention unit as well... + ReferenceCounter: cardinal = 0; // Reference counter + +function mp_IsLoaded: boolean; inline; +function mp_load(const libfilename: string): boolean; // load the lib + +function mp_unload(): boolean; +// unload and frees the lib from memory : do not forget to call it before close application. + +implementation + +function mp_IsLoaded: boolean; +begin + Result := (Mp_Handle <> dynlibs.NilHandle); +end; + +function mp_unload(): boolean; +begin +result := false; + // < Reference counting + if ReferenceCounter > 0 then + Dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if mp_IsLoaded then + begin + mpg123_exit ; + DynLibs.UnloadLibrary(mp_Handle); + mp_Handle := DynLibs.NilHandle; + result := true; + end; +end; + +function Mp_Load(const libfilename: string): boolean; +var +thelib: string; +begin + Result := False; + if Mp_Handle <> 0 then + begin + Result := True; {is it already there ?} + Inc(ReferenceCounter); + end + else + begin {go & load the library} + if Length(libfilename) = 0 then thelib := libmp else thelib := libfilename; + Mp_Handle := DynLibs.SafeLoadLibrary(thelib); // obtain the handle we want + if Mp_Handle <> DynLibs.NilHandle then + + begin + mpg123_init := Tmpg123_init(GetProcAddress(Mp_Handle, 'mpg123_init')); + mpg123_exit := Tmpg123_exit(GetProcAddress(Mp_Handle, 'mpg123_exit')); + mpg123_new := Tmpg123_new(GetProcAddress(Mp_Handle, 'mpg123_new')); + mpg123_delete := Tmpg123_delete(GetProcAddress(Mp_Handle, 'mpg123_delete')); + mpg123_param := Tmpg123_param(GetProcAddress(Mp_Handle, 'mpg123_param')); + mpg123_getparam := Tmpg123_getparam( + GetProcAddress(Mp_Handle, 'mpg123_getparam')); + mpg123_plain_strerror := Tmpg123_plain_strerror( + GetProcAddress(Mp_Handle, 'mpg123_plain_strerror')); + mpg123_strerror := Tmpg123_strerror( + GetProcAddress(Mp_Handle, 'mpg123_strerror')); + mpg123_errcode := Tmpg123_errcode(GetProcAddress(Mp_Handle, 'mpg123_errcode')); + mpg123_decoders := Tmpg123_decoders( + GetProcAddress(Mp_Handle, 'mpg123_decoders')); + mpg123_supported_decoders := + Tmpg123_supported_decoders(GetProcAddress(Mp_Handle, 'mpg123_supported_decoders')); + mpg123_decoder := Tmpg123_decoder(GetProcAddress(Mp_Handle, 'mpg123_decoder')); + mpg123_rates := Tmpg123_rates(GetProcAddress(Mp_Handle, 'mpg123_rates')); + mpg123_encodings := Tmpg123_encodings( + GetProcAddress(Mp_Handle, 'mpg123_encodings')); + mpg123_format_none := Tmpg123_format_none( + GetProcAddress(Mp_Handle, 'mpg123_format_none')); + mpg123_format_all := Tmpg123_format_all( + GetProcAddress(Mp_Handle, 'mpg123_format_all')); + mpg123_format := Tmpg123_format(GetProcAddress(Mp_Handle, 'mpg123_format')); + mpg123_format_support := Tmpg123_format_support( + GetProcAddress(Mp_Handle, 'mpg123_format_support')); + mpg123_getformat := Tmpg123_getformat( + GetProcAddress(Mp_Handle, 'mpg123_getformat')); + mpg123_open := Tmpg123_open(GetProcAddress(Mp_Handle, 'mpg123_open')); + mpg123_open_fd := Tmpg123_open_fd(GetProcAddress(Mp_Handle, 'mpg123_open_fd')); + + {$IF DEFINED(newversion)} + mpg123_open_handle := Tmpg123_open_handle(GetProcAddress(Mp_Handle, 'mpg123_open_handle')); + mpg123_replace_reader := Tmpg123_replace_reader(GetProcAddress(Mp_Handle, + 'mpg123_replace_reader')); + mpg123_replace_reader_handle := Tmpg123_replace_reader_handle(GetProcAddress(Mp_Handle, + 'mpg123_replace_reader_handle')); + mpg123_framebyframe_decode := Tmpg123_framebyframe_decode( + GetProcAddress(Mp_Handle, 'mpg123_framebyframe_decode')); + mpg123_framebyframe_next := Tmpg123_framebyframe_next( + GetProcAddress(Mp_Handle, 'mpg123_framebyframe_next')); + mpg123_framedata := Tmpg123_framedata( + GetProcAddress(Mp_Handle, 'mpg123_framedata')); + mpg123_meta_free := Tmpg123_meta_free( + GetProcAddress(Mp_Handle, 'mpg123_meta_free')); + mpg123_strlen := Tmpg123_strlen( + GetProcAddress(Mp_Handle, 'mpg123_strlen')); + mpg123_chomp_string := Tmpg123_chomp_string( + GetProcAddress(Mp_Handle, 'mpg123_chomp_string')); + mpg123_getformat2 := Tmpg123_getformat2( + GetProcAddress(Mp_Handle, 'mpg123_getformat2')); + mpg123_framepos := Tmpg123_framepos(GetProcAddress(Mp_Handle, 'mpg123_framepos')); + mpg123_framelength := Tmpg123_framelength(GetProcAddress(Mp_Handle, 'mpg123_framelength')); + mpg123_encsize := Tmpg123_encsize(GetProcAddress(Mp_Handle, 'mpg123_encsize')); + mpg123_set_index := Tmpg123_set_index(GetProcAddress(Mp_Handle, 'mpg123_set_index')); + + {$if not(defined(cpu64) and defined(unix))} + mpg123_open_32 := Tmpg123_open_32(GetProcAddress(Mp_Handle, 'mpg123_open_32')); + mpg123_open_fd_32 := Tmpg123_open_fd_32(GetProcAddress(Mp_Handle, 'mpg123_open_fd_32')); + mpg123_open_handle_32 := Tmpg123_open_handle_32(GetProcAddress(Mp_Handle, 'mpg123_open_handle_32')); + mpg123_decode_frame_32 := Tmpg123_decode_frame_32(GetProcAddress(Mp_Handle, 'mpg123_decode_frame_32')); + mpg123_framebyframe_decode_32 := Tmpg123_framebyframe_decode_32(GetProcAddress(Mp_Handle, 'mpg123_framebyframe_decode_32')); + mpg123_tell_32 := Tmpg123_tell_32(GetProcAddress(Mp_Handle, 'mpg123_tell_32')); + mpg123_framepos_32 := Tmpg123_framepos_32(GetProcAddress(Mp_Handle, 'mpg123_framepos_32')); + mpg123_tellframe_32 := Tmpg123_tellframe_32(GetProcAddress(Mp_Handle, 'mpg123_tellframe_32')); + mpg123_seek_32 := Tmpg123_seek_32(GetProcAddress(Mp_Handle, 'mpg123_seek_32')); + mpg123_seek_frame_32 := Tmpg123_seek_frame_32(GetProcAddress(Mp_Handle, 'mpg123_seek_frame_32')); + mpg123_timeframe_32 := Tmpg123_timeframe_32(GetProcAddress(Mp_Handle, 'mpg123_timeframe_32')); + mpg123_index_32 := Tmpg123_index_32(GetProcAddress(Mp_Handle, 'mpg123_index_32')); + mpg123_set_index_32 := Tmpg123_set_index_32(GetProcAddress(Mp_Handle, 'mpg123_set_index_32')); + mpg123_position_32 := Tmpg123_position_32(GetProcAddress(Mp_Handle, 'mpg123_position_32')); + mpg123_framelength_32 := Tmpg123_framelength_32(GetProcAddress(Mp_Handle, 'mpg123_framelength_32')); + mpg123_length_32 := Tmpg123_length_32(GetProcAddress(Mp_Handle, 'mpg123_length_32')); + mpg123_set_filesize_32 := Tmpg123_set_filesize_32(GetProcAddress(Mp_Handle, 'mpg123_set_filesize_32')); + mpg123_replace_reader_32 := Tmpg123_replace_reader_32(GetProcAddress(Mp_Handle, 'mpg123_replace_reader_32')); + mpg123_replace_reader_handle_32 := Tmpg123_replace_reader_handle_32(GetProcAddress(Mp_Handle, 'mpg123_replace_reader_handle_32')); + {$endif} + + mpg123_open_64 := Tmpg123_open_64(GetProcAddress(Mp_Handle, 'mpg123_open_64')); + mpg123_open_fd_64 := Tmpg123_open_fd_64(GetProcAddress(Mp_Handle, 'mpg123_open_fd_64')); + mpg123_open_handle_64 := Tmpg123_open_handle_64(GetProcAddress(Mp_Handle, 'mpg123_open_handle_64')); + mpg123_decode_frame_64 := Tmpg123_decode_frame_64(GetProcAddress(Mp_Handle, 'mpg123_decode_frame_64')); + mpg123_framebyframe_decode_64 := Tmpg123_framebyframe_decode_64(GetProcAddress(Mp_Handle, 'mpg123_framebyframe_decode_64')); + mpg123_tell_64 := Tmpg123_tell_64(GetProcAddress(Mp_Handle, 'mpg123_tell_64')); + mpg123_framepos_64 := Tmpg123_framepos_64(GetProcAddress(Mp_Handle, 'mpg123_framepos_64')); + mpg123_tellframe_64 := Tmpg123_tellframe_64(GetProcAddress(Mp_Handle, 'mpg123_tellframe_64')); + mpg123_seek_64 := Tmpg123_seek_64(GetProcAddress(Mp_Handle, 'mpg123_seek_64')); + mpg123_seek_frame_64 := Tmpg123_seek_frame_64(GetProcAddress(Mp_Handle, 'mpg123_seek_frame_64')); + mpg123_timeframe_64 := Tmpg123_timeframe_64(GetProcAddress(Mp_Handle, 'mpg123_timeframe_64')); + mpg123_index_64 := Tmpg123_index_64(GetProcAddress(Mp_Handle, 'mpg123_index_64')); + mpg123_set_index_64 := Tmpg123_set_index_64(GetProcAddress(Mp_Handle, 'mpg123_set_index_64')); + mpg123_position_64 := Tmpg123_position_64(GetProcAddress(Mp_Handle, 'mpg123_position_64')); + mpg123_framelength_64 := Tmpg123_framelength_64(GetProcAddress(Mp_Handle, 'mpg123_framelength_64')); + mpg123_length_64 := Tmpg123_length_64(GetProcAddress(Mp_Handle, 'mpg123_length_64')); + mpg123_set_filesize_64 := Tmpg123_set_filesize_64(GetProcAddress(Mp_Handle, 'mpg123_set_filesize_64')); + mpg123_replace_reader_64 := Tmpg123_replace_reader_64(GetProcAddress(Mp_Handle, 'mpg123_replace_reader_64')); + mpg123_replace_reader_handle_64 := Tmpg123_replace_reader_handle_64(GetProcAddress(Mp_Handle, 'mpg123_replace_reader_handle_64')); + + {$endif} + + mpg123_open_feed := Tmpg123_open_feed( + GetProcAddress(Mp_Handle, 'mpg123_open_feed')); + mpg123_close := Tmpg123_close(GetProcAddress(Mp_Handle, 'mpg123_close')); + mpg123_read := Tmpg123_read(GetProcAddress(Mp_Handle, 'mpg123_read')); + mpg123_decode := Tmpg123_decode(GetProcAddress(Mp_Handle, 'mpg123_decode')); + mpg123_decode_frame := Tmpg123_decode_frame( + GetProcAddress(Mp_Handle, 'mpg123_decode_frame')); + mpg123_tell := Tmpg123_tell(GetProcAddress(Mp_Handle, 'mpg123_tell')); + mpg123_tellframe := Tmpg123_tellframe( + GetProcAddress(Mp_Handle, 'mpg123_tellframe')); + mpg123_seek := Tmpg123_seek(GetProcAddress(Mp_Handle, 'mpg123_seek')); + mpg123_feedseek := Tmpg123_feedseek( + GetProcAddress(Mp_Handle, 'mpg123_feedseek')); + mpg123_seek_frame := Tmpg123_seek_frame( + GetProcAddress(Mp_Handle, 'mpg123_seek_frame')); + mpg123_timeframe := Tmpg123_timeframe( + GetProcAddress(Mp_Handle, 'mpg123_timeframe')); + mpg123_index := Tmpg123_index(GetProcAddress(Mp_Handle, 'mpg123_index')); + mpg123_position := Tmpg123_position( + GetProcAddress(Mp_Handle, 'mpg123_position')); + mpg123_eq := Tmpg123_eq(GetProcAddress(Mp_Handle, 'mpg123_eq')); + mpg123_reset_eq := Tmpg123_reset_eq( + GetProcAddress(Mp_Handle, 'mpg123_reset_eq')); + mpg123_volume := Tmpg123_volume(GetProcAddress(Mp_Handle, 'mpg123_volume')); + mpg123_volume_change := Tmpg123_volume_change( + GetProcAddress(Mp_Handle, 'mpg123_volume_change')); + mpg123_getvolume := Tmpg123_getvolume( + GetProcAddress(Mp_Handle, 'mpg123_getvolume')); + mpg123_info := Tmpg123_info(GetProcAddress(Mp_Handle, 'mpg123_info')); + mpg123_safe_buffer := Tmpg123_safe_buffer( + GetProcAddress(Mp_Handle, 'mpg123_safe_buffer')); + mpg123_scan := Tmpg123_scan(GetProcAddress(Mp_Handle, 'mpg123_scan')); + mpg123_length := Tmpg123_length(GetProcAddress(Mp_Handle, 'mpg123_length')); + mpg123_tpf := Tmpg123_tpf(GetProcAddress(Mp_Handle, 'mpg123_tpf')); + mpg123_spf := Tmpg123_spf(GetProcAddress(Mp_Handle, 'mpg123_spf')); + mpg123_clip := Tmpg123_clip(GetProcAddress(Mp_Handle, 'mpg123_clip')); + mpg123_init_string := Tmpg123_init_string( + GetProcAddress(Mp_Handle, 'mpg123_init_string')); + mpg123_free_string := Tmpg123_free_string( + GetProcAddress(Mp_Handle, 'mpg123_free_string')); + mpg123_resize_string := Tmpg123_resize_string( + GetProcAddress(Mp_Handle, 'mpg123_resize_string')); + mpg123_copy_string := Tmpg123_copy_string( + GetProcAddress(Mp_Handle, 'mpg123_copy_string')); + mpg123_add_string := Tmpg123_add_string( + GetProcAddress(Mp_Handle, 'mpg123_add_string')); + mpg123_add_substring := Tmpg123_add_substring( + GetProcAddress(Mp_Handle, 'mpg123_add_substring')); + mpg123_set_string := Tmpg123_set_string( + GetProcAddress(Mp_Handle, 'mpg123_set_string')); + mpg123_set_substring := Tmpg123_set_substring( + GetProcAddress(Mp_Handle, 'mpg123_set_substring')); + mpg123_meta_check := Tmpg123_meta_check( + GetProcAddress(Mp_Handle, 'mpg123_meta_check')); + mpg123_id3 := Tmpg123_id3(GetProcAddress(Mp_Handle, 'mpg123_id3')); + mpg123_icy := Tmpg123_icy(GetProcAddress(Mp_Handle, 'mpg123_icy')); + mpg123_parnew := Tmpg123_parnew(GetProcAddress(Mp_Handle, 'mpg123_parnew')); + mpg123_new_pars := Tmpg123_new_pars( + GetProcAddress(Mp_Handle, 'mpg123_new_pars')); + mpg123_delete_pars := Tmpg123_delete_pars( + GetProcAddress(Mp_Handle, 'mpg123_delete_pars')); + mpg123_fmt_none := Tmpg123_fmt_none( + GetProcAddress(Mp_Handle, 'mpg123_fmt_none')); + mpg123_fmt_all := Tmpg123_fmt_all(GetProcAddress(Mp_Handle, 'mpg123_fmt_all')); + mpg123_fmt := Tmpg123_fmt(GetProcAddress(Mp_Handle, 'mpg123_fmt')); + mpg123_fmt_support := Tmpg123_fmt_support( + GetProcAddress(Mp_Handle, 'mpg123_fmt_support')); + mpg123_par := Tmpg123_par(GetProcAddress(Mp_Handle, 'mpg123_par')); + mpg123_getpar := Tmpg123_getpar(GetProcAddress(Mp_Handle, 'mpg123_getpar')); + mpg123_replace_buffer := Tmpg123_replace_buffer( + GetProcAddress(Mp_Handle, 'mpg123_replace_buffer')); + mpg123_outblock := Tmpg123_outblock( + GetProcAddress(Mp_Handle, 'mpg123_outblock')); + end; + Result := mp_IsLoaded; + ReferenceCounter := 1; + + end; +end; + +end. diff --git a/UOS/src/uos_opus.pas b/UOS/src/uos_opus.pas new file mode 100644 index 0000000..9b0c2a7 --- /dev/null +++ b/UOS/src/uos_opus.pas @@ -0,0 +1,693 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Pascal Wrapper + Dynamic loading of Opus library. + Load library with op_load() and release with op_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com} + +unit uos_opus; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + dynlibs, CTypes, SysUtils; + +const + OPUS_OK = 0; + OPUS_BAD_ARG = -1; + OPUS_BUFFER_TOO_SMALL = -2; + OPUS_INTERNAL_ERROR = -3; + OPUS_INVALID_PACKET = -4; + OPUS_UNIMPLEMENTED = -5; + OPUS_INVALID_STATE = -6; + OPUS_ALLOC_FAIL = -7; + + OPUS_APPLICATION_VOIP = 2048; + OPUS_APPLICATION_AUDIO = 2049; + OPUS_APPLICATION_RESTRICTED_LOWDELAY = 2051; + + OPUS_SIGNAL_VOICE = 3001; // Signal being encoded is voice + OPUS_SIGNAL_MUSIC = 3002; // Signal being encoded is music + + OPUS_BANDWIDTH_NARROWBAND = 1101; // 4 kHz bandpass @hideinitializer + OPUS_BANDWIDTH_MEDIUMBAND = 1102; // 6 kHz bandpass @hideinitializer + OPUS_BANDWIDTH_WIDEBAND = 1103; // 8 kHz bandpass @hideinitializer + OPUS_BANDWIDTH_SUPERWIDEBAND = 1104; // 12 kHz bandpass @hideinitializer + OPUS_BANDWIDTH_FULLBAND = 1105; // 20 kHz bandpass @hideinitializer + + OPUS_FRAMESIZE_ARG = 5000; // Select frame size from the argument (default) + OPUS_FRAMESIZE_2_5_MS = 5001; // Use 2.5 ms frames + OPUS_FRAMESIZE_5_MS = 5002; // Use 5 ms frames + OPUS_FRAMESIZE_10_MS = 5003; // Use 10 ms frames + OPUS_FRAMESIZE_20_MS = 5004; // Use 20 ms frames + OPUS_FRAMESIZE_40_MS = 5005; // Use 40 ms frames + OPUS_FRAMESIZE_60_MS = 5006; // Use 60 ms frames + +const + OPUS_SET_APPLICATION_REQUEST = 4000; + OPUS_GET_APPLICATION_REQUEST = 4001; + OPUS_SET_BITRATE_REQUEST = 4002; + OPUS_GET_BITRATE_REQUEST = 4003; + OPUS_SET_MAX_BANDWIDTH_REQUEST = 4004; + OPUS_GET_MAX_BANDWIDTH_REQUEST = 4005; + OPUS_SET_VBR_REQUEST = 4006; + OPUS_GET_VBR_REQUEST = 4007; + OPUS_SET_BANDWIDTH_REQUEST = 4008; + OPUS_GET_BANDWIDTH_REQUEST = 4009; + OPUS_SET_COMPLEXITY_REQUEST = 4010; + OPUS_GET_COMPLEXITY_REQUEST = 4011; + OPUS_SET_INBAND_FEC_REQUEST = 4012; + OPUS_GET_INBAND_FEC_REQUEST = 4013; + OPUS_SET_PACKET_LOSS_PERC_REQUEST = 4014; + OPUS_GET_PACKET_LOSS_PERC_REQUEST = 4015; + OPUS_SET_DTX_REQUEST = 4016; + OPUS_GET_DTX_REQUEST = 4017; + OPUS_SET_VBR_CONSTRAINT_REQUEST = 4020; + OPUS_GET_VBR_CONSTRAINT_REQUEST = 4021; + OPUS_SET_FORCE_CHANNELS_REQUEST = 4022; + OPUS_GET_FORCE_CHANNELS_REQUEST = 4023; + OPUS_SET_SIGNAL_REQUEST = 4024; + OPUS_GET_SIGNAL_REQUEST = 4025; + OPUS_GET_LOOKAHEAD_REQUEST = 4027; + OPUS_RESET_STATE_REQUEST = 4028; + OPUS_GET_SAMPLE_RATE_REQUEST = 4029; + OPUS_GET_FINAL_RANGE_REQUEST = 4031; + OPUS_GET_PITCH_REQUEST = 4033; + OPUS_SET_GAIN_REQUEST = 4034; + OPUS_GET_GAIN_REQUEST = 4045; + OPUS_SET_LSB_DEPTH_REQUEST = 4036; + OPUS_GET_LSB_DEPTH_REQUEST = 4037; + OPUS_GET_LAST_PACKET_DURATION_REQUEST = 4039; + OPUS_SET_EXPERT_FRAME_DURATION_REQUEST = 4040; + OPUS_GET_EXPERT_FRAME_DURATION_REQUEST = 4041; + OPUS_SET_PREDICTION_DISABLED_REQUEST = 4042; + OPUS_GET_PREDICTION_DISABLED_REQUEST = 4043; + OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST = 5120; + OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST = 5122; + +type + TOpusEncoder = Pointer; + TOpusDecoder = Pointer; + TOpusRepacketizer = Pointer; + TOpusMSDecoder = pointer; + TOpusMSEncoder = pointer; + + TOpusFrames = array [0..47] of Pointer; + TOpusFrameSizes = array [0..47] of cint; + +type + TRequestValueType = (orPointer, orInteger, orXY, orNoValue); + TOpusCTLRequestRecord = record + Request: Word; + case ReqType: TRequestValueType of + orPointer: (PtrValue: Pointer); + orInteger: (IntValue: cint); + orXY: (XValue: cint; YValue: pointer); + end; + + var + opus_get_version_string: function(): PAnsiChar; cdecl; opus_strerror: function(error: cint): PAnsiChar; cdecl; + opus_encode: function(st: TOpusEncoder; pcm : pcfloat; frame_size: cint; + var data; max_data_bytes: cint): cint; cdecl; + opus_encode_float: function(st: TOpusEncoder; pcm : pcfloat; frame_size: cint; var data; max_data_bytes: cint): cint; cdecl; + opus_encoder_create: function(Fs: cint; channels, application: cint; out error: cint): TOpusEncoder; cdecl; + + opus_encoder_ctli: function(st: TOpusEncoder; const reqrequest: word ; reqval : cint ): cint; cdecl; + opus_encoder_ctlp: function(st: TOpusEncoder; const reqrequest: word ; reqval : pointer ): cint; cdecl; + opus_encoder_ctlxy: function(st: TOpusEncoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl; + opus_encoder_ctln: function(st: TOpusEncoder; const reqrequest: word): cint; cdecl; + + opus_encoder_destroy: procedure(st: TOpusEncoder); cdecl; + opus_encoder_get_size: function(channels: cint): cint; cdecl; + opus_encoder_init: function(st: TOpusEncoder; Fs: cint; channels, application: cint): cint; cdecl; + + opus_decode: function(st: TOpusDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl; + opus_decode_float: function(st: TOpusDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl; + opus_decoder_create: function(fs: cint; channels: cint; out error: cint): TOpusDecoder; cdecl; + + opus_decoder_ctli: function(st: TOpusDecoder; const reqrequest: word ; reqval : cint ): cint; cdecl; + opus_decoder_ctlp: function(st: TOpusDecoder; const reqrequest: word ; reqval : pointer ): cint; cdecl; + opus_decoder_ctlxy: function(st: TOpusDecoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl; + opus_decoder_ctln: function(st: TOpusDecoder; const reqrequest: word): cint; cdecl; + + opus_decoder_destroy: procedure(st: TOpusDecoder); cdecl; + opus_decoder_get_nb_samples: function(st: TOpusDecoder; const packet; len: cint): cint; cdecl; + opus_decoder_get_size: function(channels: cint): cint; cdecl; + opus_decoder_init: function(st: TOpusDecoder; Fs: cint; channels: cint): cint; cdecl; + opus_packet_get_bandwidth: function(const packet): cint; cdecl; + opus_packet_get_nb_channels: function(const packet): cint; cdecl; + opus_packet_get_nb_frames: function(const packet; len: cint): cint; cdecl; + opus_packet_get_nb_samples: function(const packet; len, fs: cint): cint; cdecl; + opus_packet_get_samples_per_frame: function(const packet; fs: cint): cint; cdecl; + opus_packet_parse: function(const packet; var out_toc: Pointer; var frames: TOpusFrames; var size: TOpusFrameSizes; var payload_offset: cint): cint; cdecl; + opus_pcm_soft_clip: procedure(pcm : pcfloat; frame_size, channels: cint; var softclip_mem: Double); cdecl; + + opus_multistream_packet_pad: function(var data; len, new_len, nb_streams: cint): cint; cdecl; + opus_multistream_packet_unpad: function(var data; len, nb_streams: cint): cint; cdecl; + opus_packet_pad: function(var data; len, new_len: cint): cint; cdecl; + opus_packet_unpad: function(var data; len: cint): cint; cdecl; + opus_repacketizer_cat: function(rp: TOpusRepacketizer; const data; len: cint): cint; cdecl; + opus_repacketizer_create: function: TOpusRepacketizer; cdecl; + opus_repacketizer_destroy: procedure(rp: TOpusRepacketizer); cdecl; + opus_repacketizer_get_nb_frames: function(rp: TOpusRepacketizer): cint; cdecl; + opus_repacketizer_get_size: function: cint; cdecl; + opus_repacketizer_init: function(rp: TOpusRepacketizer): TOpusRepacketizer; cdecl; + opus_repacketizer_out: function(rp: TOpusRepacketizer; var data; maxlen: cint): cint; cdecl; + opus_repacketizer_out_range: function(rp: TOpusRepacketizer; var data; maxlen: cint): cint; cdecl; + + opus_multistream_decode: function(st: TOpusMSDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl; + opus_multistream_decode_float: function(st: TOpusMSDecoder; const data; len: cint; pcm : pcfloat; frame_size, decode_fec: cint): cint; cdecl; + opus_multistream_decoder_create: function(fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte; out error: cint): TOpusMSDecoder; cdecl; + + opus_multistream_decoder_ctli: function(st: TOpusMSDecoder; const reqrequest: word ; reqval : cint ): cint; cdecl; + opus_multistream_decoder_ctlp: function(st: TOpusMSDecoder; const reqrequest: word ; reqval : pointer ): cint; cdecl; + opus_multistream_decoder_ctlxy: function(st: TOpusMSDecoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl; + opus_multistream_decoder_ctln: function(st: TOpusMSDecoder; const reqrequest: word): cint; cdecl; + + opus_multistream_decoder_destroy: procedure(st: TOpusMSDecoder); cdecl; + opus_multistream_decoder_get_size: function(streams, coupled_streams: cint): cint; cdecl; + opus_multistream_decoder_init: function(st: TOpusMSDecoder; fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte): cint; cdecl; + + opus_multistream_encode: function(st: TOpusMSEncoder; pcm : pcfloat; frame_size: cint; var data; max_data_bytes: cint): cint; cdecl; + opus_multistream_encode_float: function(st: TOpusMSEncoder; pcm : pcfloat; frame_size: cint; var data; max_data_bytes: cint): cint; cdecl; + opus_multistream_encoder_create: function(Fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte; application: cint; out error: cint): TOpusMSEncoder; cdecl; + + opus_multistream_encoder_ctli: function(st: TOpusMSEncoder; const reqrequest: word ; reqval : cint ): cint; cdecl; + opus_multistream_encoder_ctlp: function(st: TOpusMSEncoder; const reqrequest: word ; reqval : pointer ): cint; cdecl; + opus_multistream_encoder_ctlxy: function(st: TOpusMSEncoder; const reqrequest: word ; reqx : cint ; reqy : pointer ): cint; cdecl; + opus_multistream_encoder_ctln: function(st: TOpusMSEncoder; const reqrequest: word ): cint; cdecl; + + opus_multistream_encoder_destroy: procedure(st: TOpusMSEncoder); cdecl; + opus_multistream_encoder_get_size: function(streams, coupled_streams: cint): cint; cdecl; + opus_multistream_encoder_init: function(st: TOpusMSEncoder; fs: cint; channels, streams, coupled_streams: cint; const mapping: array of Byte; application: cint): cint; cdecl; + + opus_multistream_surround_encoder_create: function(Fs: cint; channels, mapping_family, streams, coupled_streams: cint; const mapping: array of Byte; application: cint; out error: cint): TOpusMSEncoder; cdecl; + opus_multistream_surround_encoder_get_size: function(channels, mapping_family: cint): cint; cdecl; + opus_multistream_surround_encoder_init: function(st: TOpusMSEncoder; fs: cint; channels, mapping_family, streams, coupled_streams: cint; const mapping: array of Byte; application: cint): cint; cdecl; + +function opus_encoder_ctl(st: TOpusEncoder; const req: TOpusCTLRequestRecord): Integer; inline; +function opus_decoder_ctl(st: TOpusdecoder; const req: TOpusCTLRequestRecord): Integer; inline; + +function opus_multistream_encoder_ctl(st: TOpusMSEncoder; const req: TOpusCTLRequestRecord): cint; inline; +function opus_multistream_decoder_ctl(st: TOpusMSdecoder; const req: TOpusCTLRequestRecord): cint; inline; + +// Macros for opus_encode_ctl. +function OPUS_GET_APPLICATION(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_BITRATE(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_COMPLEXITY(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_DTX(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_EXPERT_FRAME_DURATION(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_FORCE_CHANNELS(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_LOOKAHEAD(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_LSB_DEPTH(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_MAX_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_PACKET_LOSS_PERC(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_PREDICTION_DISABLED(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_SIGNAL(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_VBR(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_VBR_CONSTRAINT(var x: cint): TOpusCTLRequestRecord; inline; + +function OPUS_SET_APPLICATION(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_BITRATE(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_COMPLEXITY(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_DTX(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_EXPERT_FRAME_DURATION(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_FORCE_CHANNELS(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_INBAND_FEC(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_LSB_DEPTH(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_MAX_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_PACKET_LOSS_PERC(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_PREDICTION_DISABLED(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_SIGNAL(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_VBR(x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_VBR_CONSTRAINT(x: cint): TOpusCTLRequestRecord; inline; + +// For opus_decoder_ctl and opus_encoder_ctl. +function OPUS_GET_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_FINAL_RANGE(var x: Cardinal): TOpusCTLRequestRecord; inline; +function OPUS_GET_SAMPLE_RATE(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_RESET_STATE: TOpusCTLRequestRecord; inline; + +// For the opus_decode_ctl. +function OPUS_GET_GAIN(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_LAST_PACKET_DURATION(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_GET_PITCH(var x: cint): TOpusCTLRequestRecord; inline; +function OPUS_SET_GAIN(x: cint): TOpusCTLRequestRecord; inline; + +function OPUS_MULTISTREAM_GET_DECODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline; +function OPUS_MULTISTREAM_GET_ENCODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline; + + var op_Handle:TLibHandle=dynlibs.NilHandle; + + var ReferenceCounter : cardinal = 0; + +function op_IsLoaded : boolean; inline; + +Function op_Load(const libfilename:string) :boolean; + +Procedure op_Unload; + +implementation + +function op_IsLoaded: boolean; +begin + Result := (op_Handle <> dynlibs.NilHandle); +end; + +Procedure op_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if op_IsLoaded then + begin + DynLibs.UnloadLibrary(op_Handle); + op_Handle:=DynLibs.NilHandle; + end; +end; + +Function op_Load (const libfilename:string) :boolean; +begin + Result := False; + if op_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin {go & load the library} + if Length(libfilename) = 0 then exit; + op_Handle:=DynLibs.SafeLoadLibrary(libfilename); // obtain the handle we want + if op_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} +Pointer(opus_get_version_string):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_get_version_string')); +Pointer(opus_strerror):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_strerror')); +Pointer(opus_encode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encode')); +Pointer(opus_encode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encode_float')); +Pointer(opus_encoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_create')); + +Pointer(opus_encoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl')); +Pointer(opus_encoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl')); +Pointer(opus_encoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl')); +Pointer(opus_encoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_ctl')); + +Pointer(opus_encoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_destroy')); +Pointer(opus_encoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_get_size')); +Pointer(opus_encoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_encoder_init')); +Pointer(opus_decode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decode')); +Pointer(opus_decode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decode_float')); +Pointer(opus_decoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_create')); + +Pointer(opus_decoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl')); +Pointer(opus_decoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl')); +Pointer(opus_decoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl')); +Pointer(opus_decoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_ctl')); + +Pointer(opus_decoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_destroy')); +Pointer(opus_decoder_get_nb_samples):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_get_nb_samples')); +Pointer(opus_decoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_get_size')); +Pointer(opus_decoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_decoder_init')); +Pointer(opus_packet_get_bandwidth):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_bandwidth')); +Pointer(opus_packet_get_nb_channels):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_nb_channels')); +Pointer(opus_packet_get_nb_frames):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_nb_frames')); +Pointer(opus_packet_get_nb_samples):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_nb_samples')); +Pointer(opus_packet_get_samples_per_frame):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_get_samples_per_frame')); +Pointer( opus_packet_parse):=DynLibs.GetProcedureAddress(OP_Handle,PChar(' opus_packet_parse')); +Pointer(opus_pcm_soft_clip):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_pcm_soft_clip')); +Pointer(opus_multistream_packet_pad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_packet_pad')); +Pointer(opus_multistream_packet_unpad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_packet_unpad')); +Pointer(opus_packet_pad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_pad')); +Pointer(opus_packet_unpad):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_packet_unpad')); +Pointer(opus_repacketizer_cat):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_cat')); +Pointer(opus_repacketizer_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_create')); +Pointer(opus_repacketizer_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('oopus_repacketizer_destroy')); +Pointer(opus_repacketizer_get_nb_frames):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_get_nb_frames')); +Pointer(opus_repacketizer_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_get_size')); +Pointer(opus_repacketizer_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_init')); +Pointer(opus_repacketizer_out):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_out')); +Pointer(opus_repacketizer_out_range):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_repacketizer_out_range')); +Pointer(opus_multistream_decode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decode')); +Pointer(opus_multistream_decode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decode_float')); +Pointer(opus_multistream_decoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_create')); + +Pointer(opus_multistream_decoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl')); +Pointer(opus_multistream_decoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl')); +Pointer(opus_multistream_decoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl')); +Pointer(opus_multistream_decoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_ctl')); + +Pointer(opus_multistream_decoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_destroy')); +Pointer(opus_multistream_decoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_get_size')); +Pointer(opus_multistream_decoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_decoder_init')); +Pointer(opus_multistream_encode):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encode')); +Pointer(opus_multistream_encode_float):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encode_float')); +Pointer(opus_multistream_encoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_create')); + +Pointer(opus_multistream_encoder_ctli):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl')); +Pointer(opus_multistream_encoder_ctlp):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl')); +Pointer(opus_multistream_encoder_ctlxy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl')); +Pointer(opus_multistream_encoder_ctln):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_ctl')); + +Pointer(opus_multistream_encoder_destroy):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_destroy')); +Pointer(opus_multistream_encoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_get_size')); +Pointer(opus_multistream_encoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_encoder_init')); +Pointer(opus_multistream_surround_encoder_create):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_surround_encoder_create')); +Pointer(opus_multistream_surround_encoder_get_size):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_surround_encoder_get_size')); +Pointer(opus_multistream_surround_encoder_init):=DynLibs.GetProcedureAddress(OP_Handle,PChar('opus_multistream_surround_encoder_init')); + +end; + Result := op_IsLoaded; + ReferenceCounter:=1; +end; + +end; + + +function OPUS_GET_APPLICATION(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_APPLICATION_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_BITRATE(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_BITRATE_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_COMPLEXITY(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_COMPLEXITY_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_DTX(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_DTX_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_EXPERT_FRAME_DURATION(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_EXPERT_FRAME_DURATION_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_FORCE_CHANNELS(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_FORCE_CHANNELS_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_LOOKAHEAD(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_LOOKAHEAD_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_LSB_DEPTH(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_LSB_DEPTH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_MAX_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_MAX_BANDWIDTH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_PACKET_LOSS_PERC(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_PACKET_LOSS_PERC_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_PREDICTION_DISABLED(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_PREDICTION_DISABLED_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_SIGNAL(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_SIGNAL_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_VBR(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_VBR_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_VBR_CONSTRAINT(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_VBR_CONSTRAINT_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_SET_APPLICATION(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_APPLICATION_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_BANDWIDTH_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_BITRATE(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_BITRATE_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_COMPLEXITY(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_COMPLEXITY_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_DTX(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_DTX_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_EXPERT_FRAME_DURATION(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_EXPERT_FRAME_DURATION_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_FORCE_CHANNELS(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_FORCE_CHANNELS_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_INBAND_FEC(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_INBAND_FEC_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_LSB_DEPTH(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_LSB_DEPTH_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_MAX_BANDWIDTH(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_MAX_BANDWIDTH_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_PACKET_LOSS_PERC(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_PACKET_LOSS_PERC_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_PREDICTION_DISABLED(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_PREDICTION_DISABLED_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_SIGNAL(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_SIGNAL_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_VBR(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_VBR_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_SET_VBR_CONSTRAINT(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_VBR_CONSTRAINT_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_GET_BANDWIDTH(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_BANDWIDTH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_FINAL_RANGE(var x: Cardinal): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_BANDWIDTH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_SAMPLE_RATE(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_BANDWIDTH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_RESET_STATE: TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_RESET_STATE_REQUEST; + Result.ReqType := orNoValue; +end; + +function OPUS_GET_GAIN(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_GAIN_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_LAST_PACKET_DURATION(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_LAST_PACKET_DURATION_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_GET_PITCH(var x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_GET_PITCH_REQUEST; + Result.ReqType := orPointer; + Result.PtrValue := @x; +end; + +function OPUS_SET_GAIN(x: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_SET_GAIN_REQUEST; + Result.ReqType := orInteger; + Result.IntValue := x; +end; + +function OPUS_MULTISTREAM_GET_DECODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST; + Result.ReqType := orXY; + Result.XValue := x; + Result.YValue := @y; +end; + +function OPUS_MULTISTREAM_GET_ENCODER_STATE(x: cint; var y: cint): TOpusCTLRequestRecord; inline; +begin + Result.Request := OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST; + Result.ReqType := orXY; + Result.XValue := x; + Result.YValue := @y; +end; + +function opus_encoder_ctl(st: TOpusEncoder; const req: TOpusCTLRequestRecord): Integer; inline; +begin + case req.ReqType of + orPointer: Result := opus_encoder_ctlp(st, req.Request, req.PtrValue); + orInteger: Result := opus_encoder_ctli(st, req.Request, req.IntValue); + orXY: Result := opus_encoder_ctlxy(st, req.Request, req.XValue, req.YValue); + orNoValue: Result := opus_encoder_ctln(st, req.Request); + else + Result := OPUS_BAD_ARG; + end; +end; + +function opus_decoder_ctl(st: TOpusDecoder; const req: TOpusCTLRequestRecord): Integer; inline; +begin + case req.ReqType of + orPointer: Result := opus_decoder_ctlp(st, req.Request, req.PtrValue); + orInteger: Result := opus_decoder_ctli(st, req.Request, req.IntValue); + orXY: Result := opus_decoder_ctlxy(st, req.Request, req.XValue, req.YValue); + orNoValue: Result := opus_decoder_ctln(st, req.Request); + else + Result := OPUS_BAD_ARG; + end; +end; + +function opus_multistream_encoder_ctl(st: TOpusMSEncoder; const req: TOpusCTLRequestRecord): Integer; inline; +begin + case req.ReqType of + orPointer: Result := opus_multistream_encoder_ctlp(st, req.Request, req.PtrValue); + orInteger: Result := opus_multistream_encoder_ctli(st, req.Request, req.IntValue); + orXY: Result := opus_multistream_encoder_ctlxy(st, req.Request, req.XValue, req.YValue); + orNoValue: Result := opus_multistream_encoder_ctln(st, req.Request); + else + Result := OPUS_BAD_ARG; + end; +end; + +function opus_multistream_decoder_ctl(st: TOpusMSDecoder; const req: TOpusCTLRequestRecord): Integer; inline; +begin + case req.ReqType of + orPointer: Result := opus_multistream_decoder_ctlp(st, req.Request, req.PtrValue); + orInteger: Result := opus_multistream_decoder_ctli(st, req.Request, req.IntValue); + orXY: Result := opus_multistream_decoder_ctlxy(st, req.Request, req.XValue, req.YValue); + orNoValue: Result := opus_multistream_decoder_ctln(st, req.Request); + else + Result := OPUS_BAD_ARG; + end; +end; + +end. diff --git a/UOS/src/uos_opusfile.pas b/UOS/src/uos_opusfile.pas new file mode 100644 index 0000000..9266b57 --- /dev/null +++ b/UOS/src/uos_opusfile.pas @@ -0,0 +1,471 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Pascal Wrapper + Dynamic loading of OpusFile library. + Load library with of_load() and release with of_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com} + +unit uos_OpusFile; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + ctypes, dynlibs, classes, pipes, SysUtils; + +type + TOpusFile = ^OpusFile; + OpusFile = record + end; + +const +libop= + {$IFDEF unix} +{$IFDEF darwin} + 'libopusfile.0.dylib'; + {$ELSE} +'libopusfile.so.0'; + {$ENDIF} + {$ELSE} + 'opusfile.dll'; + {$ENDIF} + +// Error Codes +const + OP_FALSE = -1; + OP_HOLE = -3; + OP_EREAD = -128; + OP_EFAULT = -129; + OP_EIMPL = -130; + OP_EINVAL = -131; + OP_ENOTVORBIS = -132; + OP_EBADHEADER = -133; + OP_EVERSION = -134; + OP_ENOTAUDIO = -135; + OP_EBADPACKET = -136; + OP_EBADLINK = -137; + OP_ENOSEEK = -138; + OP_EBADTIMESTAMP = -139; + +{ +/**A request did not succeed.*/ +#define OP_FALSE (-1) +/*Currently not used externally.*/ +#define OP_EOF (-2) +/**There was a hole in the page sequence numbers (e.g., a page was corrupt or + missing).*/ +#define OP_HOLE (-3) +/**An underlying read, seek, or tell operation failed when it should have + succeeded.*/ +#define OP_EREAD (-128) +/**A <code>NULL</code> pointer was passed where one was unexpected, or an + internal memory allocation failed, or an internal library error was + encountered.*/ +#define OP_EFAULT (-129) +/**The stream used a feature that is not implemented, such as an unsupported + channel family.*/ +#define OP_EIMPL (-130) +/**One or more parameters to a function were invalid.*/ +#define OP_EINVAL (-131) +/**A purported Ogg Opus stream did not begin with an Ogg page, a purported + header packet did not start with one of the required strings, "OpusHead" or + "OpusTags", or a link in a chained file was encountered that did not + contain any logical Opus streams.*/ +#define OP_ENOTFORMAT (-132) +/**A required header packet was not properly formatted, contained illegal + values, or was missing altogether.*/ +#define OP_EBADHEADER (-133) +/**The ID header contained an unrecognized version number.*/ +#define OP_EVERSION (-134) +/*Currently not used at all.*/ +#define OP_ENOTAUDIO (-135) +/**An audio packet failed to decode properly. + This is usually caused by a multistream Ogg packet where the durations of + the individual Opus packets contained in it are not all the same.*/ +#define OP_EBADPACKET (-136) +/**We failed to find data we had seen before, or the bitstream structure was + sufficiently malformed that seeking to the target destination was + impossible.*/ +#define OP_EBADLINK (-137) +/**An operation that requires seeking was requested on an unseekable stream.*/ +#define OP_ENOSEEK (-138) +/**The first or last granule position of a link failed basic validity checks.*/ +#define OP_EBADTIMESTAMP (-139) +} + +type + TOP_PIC_FORMAT = (OP_PIC_FORMAT_UNKNOWN = -1, OP_PIC_FORMAT_URL, OP_PIC_FORMAT_JPEG, + OP_PIC_FORMAT_PNG, OP_PIC_FORMAT_GIF); +type + TOpusHead = THandle; + TOpusStream = THandle; + + op_read_func = function (stream: Pointer; var buffer; nbytes: cint): cint; cdecl; + op_seek_func = function (stream: Pointer; offset: Int64; whence: cint): cint; cdecl; + op_tell_func = function (stream: Pointer): Int64; cdecl; + op_close_func = function (stream: Pointer): cint; cdecl; + + TOpusFileCallbacks = record + read: op_read_func; + seek: op_seek_func; + tell: op_tell_func; + close: op_close_func; + end; + +function OpusReadCB(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +function OpusReadCBuosURL(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +function OpusReadCBuosMS(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +function OpusSeekCB(stream: Pointer; offset: Int64; whence: cint): cint; cdecl; +function OpusTellCB(stream: Pointer): Int64; cdecl; +function OpusCloseCB(stream: Pointer): cint; cdecl; +function OpusSeekCBMS(stream: Pointer; offset: Int64; whence: cint): cint; cdecl; +function OpusTellCBMS(stream: Pointer): Int64; cdecl; + +const + op_callbacks: TOpusFileCallbacks = (read: @OpusReadCB; + seek: @OpusSeekCB; + tell: @OpusTellCB; + close: nil); + + uos_callbacks: TOpusFileCallbacks = (read: @OpusReadCBuosURL; + seek: @OpusSeekCB; + tell: @OpusTellCB; + close: nil); + + uos_callbacksms: TOpusFileCallbacks = (read: @OpusReadCBuosms; + seek: @OpusSeekCBms; + tell: @OpusTellCBms; + close: nil); + + +type + TOpusMSDecoder = Pointer; + op_decode_cb_func = function(ctx: Pointer; decoder: TOpusMSDecoder; pcm : pcfloat; op: Pointer; + nsamples, nchannels, format, li: pcint): cint; cdecl; + TOpusTags = record + user_comments: PPAnsiChar; // The array of comment string vectors + comment_lengths: Pcint; // An array of the corresponding length of each vector, in bytes + comments: cint; // The total number of comment streams + vendor: PAnsiChar; // The null-terminated vendor string. This identifies the software used to encode the stream. + end; + POpusTags = ^TOpusTags; + + TOpusPictureTag = record + Pic_Type: cint; { The picture type according to the ID3v2 APIC frame: + <ol start="0"> + <li>Other</li> + <li>32x32 pixels 'file icon' (PNG only)</li> + <li>Other file icon</li> + <li>Cover (front)</li> + <li>Cover (back)</li> + <li>Leaflet page</li> + <li>Media (e.g. label side of CD)</li> + <li>Lead artist/lead performer/soloist</li> + <li>Artist/performer</li> + <li>Conductor</li> + <li>Band/Orchestra</li> + <li>Composer</li> + <li>Lyricist/text writer</li> + <li>Recording Location</li> + <li>During recording</li> + <li>During performance</li> + <li>Movie/video screen capture</li> + <li>A bright colored fish</li> + <li>Illustration</li> + <li>Band/artist logotype</li> + <li>Publisher/Studio logotype</li> + </ol> } + mime_type: PAnsiChar; // The MIME type of the picture, in printable ASCII characters 0x20-0x7E. + description: PAnsiChar; // The description of the picture, in UTF-8 + width: Cardinal; + height: Cardinal; + depth: Cardinal; // The color depth of the picture in bits-per-pixel + colors: Cardinal; // For indexed-color pictures (e.g., GIF), the number of colors used, or 0 + data_length: Cardinal; + data: Pointer; + format: TOP_PIC_FORMAT; // The format of the picture data, if known. OP_PIC_FORMAT_UNKNOWN..OP_PIC_FORMAT_GIF + end; + +var + + op_fopen: function(out cb: TOpusFileCallbacks; path: PAnsiChar; mode: PAnsiChar): TOpusStream; cdecl; + + op_freopen: function(out cb: TOpusFileCallbacks; path: PAnsiChar; mode: PAnsiChar; stream: TOpusStream): TOpusStream;cdecl; + op_mem_stream_create: function(out cb: TOpusFileCallbacks; const data; size: cuint): TOpusStream; cdecl; + + opus_head_parse: function(head: TOpusHead; const data; len: cuint): cint;cdecl; + opus_granule_sample: function(head: TOpusHead; gp: Int64): Int64;cdecl; + opus_tags_parse: function(out tags: TOpusTags; const data; len: cuint): cint;cdecl; + opus_tags_copy: function(var dst: TOpusTags; const src: TOpusTags): cint;cdecl; + opus_tags_init: procedure(var tags: TOpusTags);cdecl; + opus_tags_add: function(var dst: TOpusTags; tag, value: PAnsiChar): cint;cdecl; + opus_tags_add_comment: function(var dst: TOpusTags; comment: PAnsiChar): cint;cdecl; + opus_tags_set_binary_suffix: function(var tags: TOpusTags; const data; len: cint): cint;cdecl; + opus_tags_query: function(const tags: TOpusTags; tag: PAnsiChar; count: cint): cint;cdecl; + opus_tags_query_count: function(const tags: TOpusTags; tag: PAnsiChar): cint;cdecl; + opus_tags_get_binary_suffix: function(const tags: TOpusTags; out len: cint): cint;cdecl; + opus_tags_get_album_gain: function(const tags: TOpusTags; out gain_q8: cint): cint;cdecl; + opus_tags_get_track_gain: function(const tags: TOpusTags; out gain_q8: cint): cint;cdecl; + opus_tags_clear: procedure(var tags: TOpusTags);cdecl; + opus_tagcompare: function(tag_name, comment: PAnsiChar): cint;cdecl; + opus_tagncompare: function(tag_name: PAnsiChar; tag_len: cint; comment: PAnsiChar): cint;cdecl; + opus_picture_tag_parse: function(out pic: TOpusPictureTag; tag: PAnsiChar): cint;cdecl; + opus_picture_tag_init: procedure(var pic: TOpusPictureTag);cdecl; + opus_picture_tag_clear: procedure(var pic: TOpusPictureTag);cdecl; + + op_test: function(head: TOpusHead; const initial_data; initial_bytes: cuint): cint;cdecl; + op_open_file: function(path: PAnsiChar; out error: cint): TOpusFile;cdecl; + op_open_memory: function(const data; const _size: cuint; out error: cint): TOpusFile;cdecl; + op_open_callbacks: function(const source; const cb: TOpusFileCallbacks; + const initial_data; initial_bytes: cuint; out error: cint): TOpusFile; {$IFDEF windows} cdecl;{$ENDIF} // with cdecl ---> crash in linux, strange ??? + op_test_file: function(path: PAnsiChar; out error: cint): TOpusFile;cdecl; + // op_test_url: function(path: PAnsiChar; out error: cint): TOpusFile; + op_test_memory: function(const data; const size: cuint; out error: cint): TOpusFile;cdecl; + op_test_callbacks: function(const source; const cb: TOpusFileCallbacks; const initial_data; initial_bytes: cuint; + out error: cint): TOpusFile; {$IFDEF windows} cdecl;{$ENDIF} // with cdecl ---> crash in linux, strange ??? + op_test_open: function(OpusFile: TOpusFile): cint; cdecl; + op_free: function(OpusFile: TOpusFile): cint; cdecl; + + op_seekable: function(OpusFile: TOpusFile): cint;cdecl; + op_link_count: function(OpusFile: TOpusFile): cint;cdecl; + op_serialno: function(OpusFile: TOpusFile; li: pcint): Cardinal;cdecl; + op_channel_count: function(OpusFile: TOpusFile; li: pcint): cint;cdecl; + op_raw_total: function(OpusFile: TOpusFile; li: pcint): Int64;cdecl; + op_pcm_total: function(OpusFile: TOpusFile; li: pcint): Int64;cdecl; + op_head: function(OpusFile: TOpusFile; li: pcint): TOpusHead;cdecl; + op_tags: function(OpusFile: TOpusFile; li: pcint): POpusTags;cdecl; + op_current_link: function(OpusFile: TOpusFile): cint;cdecl; + op_bitrate: function(OpusFile: TOpusFile; li: pcint): cint;cdecl; + op_bitrate_instant: function(OpusFile: TOpusFile): cint;cdecl; + op_raw_tell: function(OpusFile: TOpusFile): Int64;cdecl; + op_pcm_tell: function(OpusFile: TOpusFile): Int64;cdecl; + + op_raw_seek: function(OpusFile: TOpusFile; byte_offset: cInt64): cint;cdecl; + op_pcm_seek: function(OpusFile: TOpusFile; pcm_offset: cInt64): cint;cdecl; + + op_set_gain_offset: function(OpusFile: TOpusFile; gain_type: cint; gain_offset_q8: cint): cint;cdecl; + op_set_dither_enabled: procedure(OpusFile: TOpusFile; enabled: cint);cdecl; + + op_read: function(OpusFile: TOpusFile; pcm : pcint; SampleCount: cint; li: pcint): cint;cdecl; + op_read_float: function(OpusFile: TOpusFile; pcm : pcfloat; SampleCount: cint; li: pcint): cint;cdecl; + op_read_stereo: function(OpusFile: TOpusFile; pcm : pcint; SampleCount: cint): cint;cdecl; + op_read_float_stereo: function(OpusFile: TOpusFile; pcm : pcfloat; SampleCount: cint): cint;cdecl; + + of_Handle:TLibHandle=dynlibs.NilHandle; + + op_Handle:TLibHandle=dynlibs.NilHandle; + + {$IFDEF windows} + lc_Handle:TLibHandle=dynlibs.NilHandle; + wt_Handle:TLibHandle=dynlibs.NilHandle; + og_Handle:TLibHandle=dynlibs.NilHandle; + {$endif} + + ReferenceCounter : cardinal = 0; + + function of_IsLoaded : boolean; inline; + + Function of_Load(const libfilename:string) :boolean; // load the lib + + Procedure of_Unload; + +implementation + + function of_IsLoaded: boolean; +begin + Result := (of_Handle <> dynlibs.NilHandle); +end; + +Procedure of_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if of_IsLoaded then + begin + DynLibs.UnloadLibrary(of_Handle); + of_Handle:=DynLibs.NilHandle; + DynLibs.UnloadLibrary(op_Handle); + op_Handle:=DynLibs.NilHandle; + {$IFDEF windows} + DynLibs.UnloadLibrary(lc_Handle); + lc_Handle:=DynLibs.NilHandle; + DynLibs.UnloadLibrary(wt_Handle); + wt_Handle:=DynLibs.NilHandle; + DynLibs.UnloadLibrary(og_Handle); + og_Handle:=DynLibs.NilHandle; + {$endif} + + end; +end; + +Function of_Load (const libfilename:string) :boolean; +begin + Result := False; + if of_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin {go & load the library} + if Length(libfilename) = 0 then + begin + {$IFDEF windows} + wt_Handle:= DynLibs.SafeLoadLibrary('libwinpthread-1.dll'); + lc_Handle:= DynLibs.SafeLoadLibrary('libgcc_s_sjlj-1.dll'); + og_Handle:= DynLibs.SafeLoadLibrary('libogg-0.dll'); + op_Handle:= DynLibs.SafeLoadLibrary('libopus-0.dll'); + {$else} + op_Handle:= DynLibs.SafeLoadLibrary('libopus.so'); + {$endif} + of_Handle:=DynLibs.SafeLoadLibrary(libop); + end + else + begin + {$IFDEF windows} + wt_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libwinpthread-1.dll'); + lc_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libgcc_s_sjlj-1.dll'); + og_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libogg-0.dll'); + op_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libopus-0.dll'); + {$else} + op_Handle:= DynLibs.SafeLoadLibrary(ExtractFilePath(libfilename)+'libopus.so'); + {$endif} + of_Handle:=DynLibs.SafeLoadLibrary(libfilename); + end; + + + if of_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} +Pointer(op_fopen):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_fopen')); +Pointer(op_freopen):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_freopen')); +Pointer(op_mem_stream_create):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_mem_stream_create')); +Pointer(opus_head_parse):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_head_parse')); +Pointer(opus_granule_sample):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_granule_sample')); +Pointer(opus_tags_parse):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_parse')); +Pointer(opus_tags_copy):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_copy')); +Pointer(opus_tags_init):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_init')); +Pointer(opus_tags_add):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_add')); +Pointer(opus_tags_add_comment):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_add_comment')); +Pointer(opus_tags_set_binary_suffix):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_set_binary_suffix')); +Pointer(opus_tags_query):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_query')); +Pointer(opus_tags_query_count):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_query_count')); +Pointer(opus_tags_get_binary_suffix):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_get_binary_suffix')); +Pointer(opus_tags_get_album_gain):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_get_album_gain')); +Pointer(opus_tags_get_track_gain):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_get_track_gain')); +Pointer(opus_tags_clear):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tags_clear')); +Pointer(opus_tagcompare):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tagcompare')); +Pointer(opus_tagncompare):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_tagncompare')); +Pointer(opus_picture_tag_parse):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_picture_tag_parse')); +Pointer(opus_picture_tag_init):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_picture_tag_init')); +Pointer(opus_picture_tag_clear):=DynLibs.GetProcedureAddress(OF_Handle,PChar('opus_picture_tag_clear')); +Pointer(op_test):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test')); +Pointer(op_free):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_free')); +Pointer(op_open_file):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_open_file')); +Pointer(op_open_memory):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_open_memory')); +Pointer(op_open_callbacks):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_open_callbacks')); +Pointer(op_test_file):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test_file')); +//Pointer(op_test_url):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test_url')); +Pointer(op_test_memory):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test_memory')); +Pointer(op_test_callbacks):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test_callbacks')); +Pointer(op_test_open):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_test_open')); +Pointer(op_seekable):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_seekable')); +Pointer(op_link_count):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_link_count')); +Pointer(op_serialno):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_serialno')); +Pointer(op_channel_count):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_channel_count')); +Pointer(op_raw_total):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_raw_total')); +Pointer(op_pcm_total):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_pcm_total')); +Pointer(op_head):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_head')); +Pointer(op_tags):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_tags')); +Pointer(op_current_link):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_current_link')); +Pointer(op_bitrate):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_bitrate')); +Pointer(op_bitrate_instant):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_bitrate_instant')); +Pointer(op_raw_tell):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_raw_tell')); +Pointer(op_raw_seek):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_raw_seek')); +Pointer(op_pcm_seek):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_pcm_seek')); +Pointer(op_set_gain_offset):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_set_gain_offset')); +Pointer(op_set_dither_enabled):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_set_dither_enabled')); +Pointer(op_read):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_read')); +Pointer(op_read_float):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_read_float')); +Pointer(op_read_stereo):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_read_stereo')); +Pointer(op_read_float_stereo):=DynLibs.GetProcedureAddress(OF_Handle,PChar('op_read_float_stereo')); + +end; + Result := of_IsLoaded; + ReferenceCounter:=1; +end; + +end; + +function OpusReadCB(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +begin + if nbytes<>0 + then + result := FileRead(THandle(stream^), Buffer, nbytes) + else + result := 0; +end; + +function OpusReadCBuosURL(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +begin + if nbytes<>0 + then + result := TInputPipeStream(stream^).read(Buffer, nbytes) + else + result := 0; +end; + +function OpusReadCBuosMS(stream: Pointer; var buffer; nbytes: cint): cint; cdecl; +begin + if nbytes<>0 + then + result := TMemoryStream(stream^).read(Buffer, nbytes) + else + result := 0; +end; + +function OpusSeekCB(stream: Pointer; offset: Int64; whence: cint): cint; cdecl; +var + Seek_Result: Int64; +begin + Seek_Result := FileSeek(THandle(stream^), offset, whence); + if Seek_Result=-1 + then + Result := -1 + else + Result := 0; +end; + +function OpusTellCB(stream: Pointer): Int64; cdecl; +begin + Result := FileSeek(THandle(stream^), 0, 1); +end; + +function OpusSeekCBms(stream: Pointer; offset: Int64; whence: cint): cint; cdecl; +var + Seek_Result: Int64; +begin + Seek_Result := TMemoryStream(stream^).seek(offset, whence); + if Seek_Result=-1 + then + Result := -1 + else + Result := 0; +end; + +function OpusTellCBms(stream: Pointer): Int64; cdecl; +begin +Result := TMemoryStream(stream^).seek(0, 1); + end; + +function OpusCloseCB(stream: Pointer): cint; cdecl; +begin + FileClose(THandle(stream^)); + Result := 0; +end; + +end. diff --git a/UOS/src/uos_opusurl.pas b/UOS/src/uos_opusurl.pas new file mode 100644 index 0000000..86b4d92 --- /dev/null +++ b/UOS/src/uos_opusurl.pas @@ -0,0 +1,93 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Pascal Wrapper + Dynamic loading of OpusURL library. + Load library with ou_load() and release with ou_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com} + +unit uos_Opusurl; + +{$mode objfpc}{$H+} + +interface + +uses + ctypes, uos_Opusfile, dynlibs, SysUtils; + +// Error Codes +const + OP_FALSE = -1; + OP_HOLE = -3; + OP_EREAD = -128; + OP_EFAULT = -129; + OP_EIMPL = -130; + OP_EINVAL = -131; + OP_ENOTVORBIS = -132; + OP_EBADHEADER = -133; + OP_EVERSION = -134; + OP_ENOTAUDIO = -135; + OP_EBADPACKET = -136; + OP_EBADLINK = -137; + OP_ENOSEEK = -138; + OP_EBADTIMESTAMP = -139; + +var + + op_open_url: function(path: PAnsiChar; out error: Integer): TOpusFile; + op_test_url: function(path: PAnsiChar; out error: Integer): TOpusFile; + + ou_Handle:TLibHandle=dynlibs.NilHandle; + + ReferenceCounter : cardinal = 0; // Reference counter + + function ou_IsLoaded : boolean; inline; + + Function ou_Load(const libfilename:string) :boolean; // load the lib + + Procedure ou_Unload; + +implementation + + function ou_IsLoaded: boolean; +begin + Result := (ou_Handle <> dynlibs.NilHandle); +end; + +Procedure ou_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if ou_IsLoaded then + begin + DynLibs.UnloadLibrary(ou_Handle); + ou_Handle:=DynLibs.NilHandle; + end; +end; + +Function ou_Load (const libfilename:string) :boolean; +begin + Result := False; + if ou_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin {go & load the library} + if Length(libfilename) = 0 then exit; + ou_Handle:=DynLibs.SafeLoadLibrary(libfilename); // obtain the handle we want + if ou_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} +Pointer(op_open_url):=DynLibs.GetProcedureAddress(OU_Handle,PChar('op_open_url')); +Pointer(op_test_url):=DynLibs.GetProcedureAddress(OU_Handle,PChar('op_test_url')); +end; + Result := ou_IsLoaded; + ReferenceCounter:=1; +end; + +end; + +end. diff --git a/UOS/src/uos_portaudio.pas b/UOS/src/uos_portaudio.pas new file mode 100644 index 0000000..8e73cbc --- /dev/null +++ b/UOS/src/uos_portaudio.pas @@ -0,0 +1,389 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading version of PortAudio Pascal Wrapper. + Load library with pa_load() and release with pa_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com + Reference counting added by Max Karpushin / homeplaner@yandex.ru} + +unit uos_portaudio; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + dynlibs, CTypes; + +const +libpa= + {$IFDEF unix} +{$IFDEF darwin} + 'libportaudio.2.dylib'; + {$ELSE} + 'libportaudio.so.2'; + {$ENDIF} + {$ELSE} + 'portaudio.dll'; + {$ENDIF} + +type + PaError = CInt32; + PaErrorCode =( + paNotInitialized := -10000, + paUnanticipatedHostError, + paInvalidChannelCount, + paInvalidSampleRate, + paInvalidDevice, + paInvalidFlag, + paSampleFormatNotSupported, + paBadIODeviceCombination, + paInsufficientMemory, + paBufferTooBig, + paBufferTooSmall, + paNullCallback, + paBadStreamPtr, + paTimedOut, + paInternalError, + paDeviceUnavailable, + paIncompatibleHostApiSpecificStreamInfo, + paStreamIsStopped, + paStreamIsNotStopped, + paInputOverflowed, + paOutputUnderflowed, + paHostApiNotFound, + paInvalidHostApi, + paCanNotReadFromACallbackStream, + paCanNotWriteToACallbackStream, + paCanNotReadFromAnOutputOnlyStream, + paCanNotWriteToAnInputOnlyStream, + paIncompatibleStreamHostApi, + paBadBufferPtr, + paNoError := 0 + ); + + PaDeviceIndex = CInt32; + + PaHostApiIndex = CInt32; + + PaHostApiTypeId =(paInDevelopment := 0, + paDirectSound := 1, + paMME := 2, + paASIO := 3, + paSoundManager := 4, + paCoreAudio := 5, + paOSS := 7, + paALSA := 8, + paAL := 9, + paBeOS := 10, + paWDMKS := 11, + paJACK := 12, + paWASAPI := 13, + paAudioScienceHPI := 14 + ); + + PaHostApiInfo = record + structVersion : CInt32; + _type : PaHostApiTypeId ; + _name : Pchar; + deviceCount : CInt32; + defaultInputDevice : PaDeviceIndex; + defaultOutputDevice : PaDeviceIndex; + end; + PPaHostApiInfo = ^PaHostApiInfo; + + PaHostErrorInfo = record + hostApiType : PaHostApiTypeId; + errorCode : CLong; + errorText : PChar; + end; + PPaHostErrorInfo = ^PaHostErrorInfo; + + PaTime = CDouble; + + PaSampleFormat = pCULongLong; + + PaDeviceInfo = record + structVersion : CInt32; + _name : PChar; + hostApi : PaHostApiIndex; + maxInputChannels : CInt32; + maxOutputChannels : CInt32; + defaultLowInputLatency : PaTime; + defaultLowOutputLatency : PaTime; + defaultHighInputLatency : PaTime; + defaultHighOutputLatency : PaTime; + defaultSampleRate : CDouble; + end; + PPaDeviceInfo = ^PaDeviceInfo; + + PaStreamParameters = record + device : PaDeviceIndex; + channelCount : CInt32; + sampleFormat : PaSampleFormat; + suggestedLatency : PaTime; + hostApiSpecificStreamInfo : Pointer; + end; + PPaStreamParameters = ^PaStreamParameters; + + // ************************* Streaming types ************************* + + PaStream = Pointer; + PPaStream = ^PaStream; + PPPaStream = ^PPaStream; + + PaStreamFlags = CULong; + + PaStreamCallbackTimeInfo = record + inputBufferAdcTime : PaTime; + currentTime : PaTime; + outputBufferDacTime : PaTime; + end; + PPaStreamCallbackTimeInfo = ^PaStreamCallbackTimeInfo; + + PaStreamCallbackFlags = CULong; + + PaStreamCallbackResult =( + paContinue := 0, + paComplete := 1, + paAbort := 2); + + PaStreamCallback = function( + input : Pointer; + output : Pointer; + frameCount : CULong; + timeInfo : PPaStreamCallbackTimeInfo; + statusFlags : PaStreamCallbackFlags; + userData : Pointer) : CInt32; + PPaStreamCallback = ^PaStreamCallback; + + PaStreamFinishedCallback = procedure(userData : Pointer); + PPaStreamFinishedCallback = ^PaStreamFinishedCallback; + + PaStreamInfo = record + structVersion : CInt32; + inputLatency : PaTime; + outputLatency : PaTime; + sampleRate : CDouble; + end; + PPaStreamInfo = ^PaStreamInfo; + + const + paFormatIsSupported = 0; + paFramesPerBufferUnspecified = 0; + paNoDevice = PaDeviceIndex(-1); + paUseHostApiSpecificDeviceSpecification = PaDeviceIndex(-2); + paFloat32 = PaSampleFormat($00000001); + paInt32 = PaSampleFormat($00000002); + paInt24 = PaSampleFormat($00000004); + paInt16 = PaSampleFormat($00000008); + paInt8 = PaSampleFormat($00000010); + paUInt8 = PaSampleFormat($00000020); + paCustomFormat = PaSampleFormat($00010000); + paNonInterleaved = PaSampleFormat($80000000); + paNoFlag = PaStreamFlags(0); + paClipOff = PaStreamFlags($00000001); + paDitherOff = PaStreamFlags($00000002); + paNeverDropInput = PaStreamFlags($00000004); + paPrimeOutputBuffersUsingStreamCallback = PaStreamFlags($00000008); + paPlatformSpecificFlags = PaStreamFlags($FFFF0000); + paInputUnderflow = PaStreamCallbackFlags($00000001); + paInputOverflow = PaStreamCallbackFlags($00000002); + paOutputUnderflow = PaStreamCallbackFlags($00000004); + paOutputOverflow = PaStreamCallbackFlags($00000008); + paPrimingOutput = PaStreamCallbackFlags($00000010); + + ////// Dynamic load : Vars that will hold our dynamically loaded functions... + +// *************************** functions ******************************* + + var Pa_GetVersion: function():CInt32 ; cdecl; + + var Pa_GetVersionText: function():PChar ; cdecl; + + var Pa_GetErrorText: function(errorCode : PaError):PChar ; cdecl; + + var Pa_Initialize: function():PaError ; cdecl; + + var Pa_Terminate: function():PaError ; cdecl; + + var Pa_GetHostApiCount: function():PaHostApiIndex ; cdecl; + + var Pa_GetDefaultHostApi: function():PaHostApiIndex ; cdecl; + + var Pa_GetHostApiInfo: function(hostApi : PaHostApiIndex):PPaHostApiInfo ; cdecl; + + var Pa_HostApiTypeIdToHostApiIndex: function(_type : PaHostApiTypeId):PaHostApiIndex ; cdecl; + + var Pa_HostApiDeviceIndexToDeviceIndex: function(hostApi : PaHostApiIndex;hostApiDeviceIndex : CInt32):PaDeviceIndex ; cdecl; + + var Pa_GetLastHostErrorInfo: function():PPaHostErrorInfo ; cdecl; + +// ************** Device enumeration and capabilities ****************** + + var Pa_GetDeviceCount: function:PaDeviceIndex ; cdecl; + + var Pa_GetDefaultInputDevice: function:PaDeviceIndex ; cdecl; + + var Pa_GetDefaultOutputDevice: function:PaDeviceIndex ; cdecl; + + var Pa_GetDeviceInfo: function(device : PaDeviceIndex):PPaDeviceInfo ; cdecl; + + var Pa_IsFormatSupported: function(inputParameters,outputParameters : PPaStreamParameters; sampleRate : CDouble):PaError ; cdecl; + +// *********************** Stream function ***************************** + + var Pa_OpenStream: function(stream : PPPaStream; + inputParameters : PPaStreamParameters; + outputParameters : PPaStreamParameters; + sampleRate : CDouble; + framesPerBuffer : CULong; + streamFlags : PaStreamFlags; + streamCallback : PPaStreamCallback; + userData : Pointer):PaError ; cdecl; + + var Pa_OpenDefaultStream: function(stream : PPPaStream; + numInputChannels : CInt32; + numOutputChannels : CInt32; + sampleFormat : PaSampleFormat; + sampleRate : CDouble; + framesPerBuffer : CULong; + streamCallback : PPaStreamCallback; + userData : Pointer):PaError ; cdecl; + + var Pa_CloseStream: function(stream : PPaStream):PaError ; cdecl; + + var Pa_SetStreamFinishedCallback: function(stream : PPaStream; + streamFinishedCallback : PPaStreamFinishedCallback):PaError ; cdecl; + + var Pa_StartStream: function(stream : PPaStream):PaError ; cdecl; + + var Pa_StopStream: function(stream : PPaStream):PaError ; cdecl; + + var Pa_AbortStream: function(stream : PPaStream):PaError ; cdecl; + + var Pa_IsStreamStopped: function(stream : PPaStream):PaError ; cdecl; + + var Pa_IsStreamActive: function(stream : PPaStream):PaError ; cdecl; + + var Pa_GetStreamInfo: function(stream : PPaStream):PPaStreamInfo ; cdecl; + + var Pa_GetStreamTime: function(stream : PPaStream):Patime ; cdecl; + + var Pa_GetStreamCpuLoad: function(stream : PPaStream):CDouble ; cdecl; + + var Pa_ReadStream: function(stream : PPaStream; buffer : pcfloat ;frames : CULong):PaError ; cdecl; + + var Pa_WriteStream: function(stream : PPaStream; buffer : pcfloat ;frames : CULong):PaError ; cdecl; + + var Pa_GetStreamReadAvailable: function(stream : PPaStream):CSLong ; cdecl; + + var Pa_GetStreamWriteAvailable: function(stream : PPaStream):CSLong ; cdecl; + +// ****************** Miscellaneous utilities ************************** + + var Pa_GetSampleSize: function(format : PaSampleFormat):PaError ; cdecl; + + var Pa_Sleep: function(msec : CLong) : integer; cdecl; + + /////////////////////////////////////////////// + + {Special function for dynamic loading of lib ...} + + var Pa_Handle:TLibHandle=dynlibs.NilHandle; // this will hold our handle for the lib; it functions nicely as a mutli-lib prevention unit as well... + + var ReferenceCounter : cardinal = 0; // Reference counter + + function Pa_IsLoaded : boolean; inline; + + Function Pa_Load(const libfilename:string) :boolean; // load the lib + + Procedure Pa_Unload(); // unload and frees the lib from memory : do not forget to call it before close application. + + ///////////////////////////////////////////////////////////////////////////////////////////////// + +implementation + +function Pa_IsLoaded: boolean; +begin + Result := (Pa_Handle <> dynlibs.NilHandle); +end; + +Function Pa_Load (const libfilename:string) :boolean; +var +thelib: string; +begin + Result := False; + if Pa_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin {go & load the library} + if Length(libfilename) = 0 then thelib := libpa else thelib := libfilename; + Pa_Handle:=DynLibs.SafeLoadLibrary(thelib); // obtain the handle we want + if Pa_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} + +Pointer(Pa_GetVersion):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetVersion')); +Pointer(Pa_GetVersionText):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetVersionText')); +Pointer(Pa_GetErrorText):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetErrorText')); +Pointer(Pa_Initialize):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_Initialize')); +Pointer(Pa_Terminate):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_Terminate')); +Pointer(Pa_GetHostApiCount):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetHostApiCount')); +Pointer(Pa_GetDefaultHostApi):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetDefaultHostApi')); +Pointer(Pa_GetHostApiInfo):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetHostApiInfo')); +Pointer(Pa_HostApiTypeIdToHostApiIndex):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_HostApiTypeIdToHostApiIndex')); +Pointer(Pa_HostApiDeviceIndexToDeviceIndex):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_HostApiDeviceIndexToDeviceIndex')); +Pointer(Pa_GetLastHostErrorInfo):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetLastHostErrorInfo')); +////////////////// +Pointer(Pa_GetDeviceCount):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetDeviceCount')); +Pointer(Pa_GetDefaultInputDevice):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetDefaultInputDevice')); +Pointer(Pa_GetDefaultOutputDevice):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetDefaultOutputDevice')); +Pointer(Pa_GetDeviceInfo):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetDeviceInfo')); +Pointer(Pa_IsFormatSupported):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_IsFormatSupported')); +////////////////////// +Pointer(Pa_OpenStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_OpenStream')); +Pointer(Pa_OpenDefaultStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_OpenDefaultStream')); +Pointer(Pa_CloseStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_CloseStream')); +Pointer(Pa_SetStreamFinishedCallback):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_SetStreamFinishedCallback')); +Pointer(Pa_StartStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_StartStream')); +Pointer(Pa_StopStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_StopStream')); +Pointer(Pa_AbortStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_AbortStream')); +Pointer(Pa_IsStreamStopped):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_IsStreamStopped')); +Pointer(Pa_IsStreamActive):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_IsStreamActive')); +Pointer(Pa_GetStreamInfo):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetStreamInfo')); +Pointer(Pa_GetStreamTime):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetStreamTime')); +Pointer(Pa_GetStreamCpuLoad):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetStreamCpuLoad')); +Pointer(Pa_ReadStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_ReadStream')); +Pointer(Pa_WriteStream):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_WriteStream')); +Pointer(Pa_GetStreamReadAvailable):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetStreamReadAvailable')); +Pointer(Pa_GetStreamWriteAvailable):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetStreamWriteAvailable')); +Pointer(Pa_GetSampleSize):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_GetSampleSize')); +Pointer(Pa_Sleep):=DynLibs.GetProcedureAddress(PA_Handle,PChar('Pa_Sleep')); +end; + Result := Pa_IsLoaded; + ReferenceCounter:=1; +end; + +end; + +Procedure Pa_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if Pa_IsLoaded then + begin + Pa_Terminate(); + DynLibs.UnloadLibrary(Pa_Handle); + Pa_Handle:=DynLibs.NilHandle; + end; +end; + +end. + diff --git a/UOS/src/uos_shout.pas b/UOS/src/uos_shout.pas new file mode 100644 index 0000000..254a10b --- /dev/null +++ b/UOS/src/uos_shout.pas @@ -0,0 +1,264 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading version of IceCast_Shout Pascal Wrapper. + Load library with sha_load() and release with sh_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com } + +unit uos_shout; + +{$mode objfpc}{$H+} +{$PACKRECORDS C} + +interface + +uses + dynlibs, CTypes, sysutils; + + const + SHOUT_THREADSAFE = 1; + SHOUT_TLS = 1; + SHOUTERR_SUCCESS = 0; + SHOUTERR_INSANE = -1; + SHOUTERR_NOCONNECT = -2; + SHOUTERR_NOLOGIN = -3; + SHOUTERR_SOCKET = -4; + SHOUTERR_MALLOC = -5; + SHOUTERR_METADATA = -6; + SHOUTERR_CONNECTED = -7; + SHOUTERR_UNCONNECTED = -8; + SHOUTERR_UNSUPPORTED = -9; + SHOUTERR_BUSY = -10; + SHOUTERR_NOTLS = -11; + SHOUTERR_TLSBADCERT = -12; + SHOUTERR_RETRY = -13; + SHOUT_FORMAT_OGG = 0; + SHOUT_FORMAT_MP3 = 1; + SHOUT_FORMAT_WEBM = 2; + SHOUT_FORMAT_WEBMAUDIO = 3; + SHOUT_FORMAT_VORBIS = SHOUT_FORMAT_OGG; + SHOUT_PROTOCOL_HTTP = 0; + SHOUT_PROTOCOL_XAUDIOCAST = 1; + SHOUT_PROTOCOL_ICY = 2; + SHOUT_PROTOCOL_ROARAUDIO = 3; + SHOUT_TLS_DISABLED = 0; + SHOUT_TLS_AUTO = 1; + SHOUT_TLS_AUTO_NO_PLAIN = 2; + SHOUT_TLS_RFC2818 = 11; + SHOUT_TLS_RFC2817 = 12; + SHOUT_AI_BITRATE = 'bitrate'; + SHOUT_AI_SAMPLERATE = 'samplerate'; + SHOUT_AI_CHANNELS = 'channels'; + SHOUT_AI_QUALITY = 'quality'; + SHOUT_META_NAME = 'name'; + SHOUT_META_URL = 'url'; + SHOUT_META_GENRE = 'genre'; + SHOUT_META_DESCRIPTION = 'description'; + SHOUT_META_IRC = 'irc'; + SHOUT_META_AIM = 'aim'; + SHOUT_META_ICQ = 'icq'; + + type + shout_t = pointer; + Pshout_t = ^shout_t; + {$if defined(cpu64)} + cuint64 = qword; + size_t = cuint64; +{$else} + cuint32 = longword; + size_t = cuint32; +{$endif} + + psize_t = ^size_t; + + shout_metadata_t = pointer; + Pshout_metadata_t = ^shout_metadata_t; + +// methods +var + + shout_init: procedure();cdecl; + shout_shutdown: procedure();cdecl; + shout_version: function(var major:cint; var minor:cint; var patch:cint):pchar;cdecl; + shout_new: function(): Pshout_t;cdecl; + shout_free: procedure(shhandle :Pshout_t);cdecl; + shout_get_error: function(shhandle :Pshout_t):pchar;cdecl; + shout_get_errno: function(shhandle :Pshout_t):cint;cdecl; + shout_get_connected: function(shhandle :Pshout_t):cint;cdecl; + shout_set_host: function(shhandle :Pshout_t; host: pchar):cint;cdecl; + shout_get_host: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_port: function(shhandle :Pshout_t; port:cushort):cint;cdecl; + shout_get_port: function(shhandle :Pshout_t):cushort;cdecl; + shout_set_agent: function(shhandle :Pshout_t; agent:pchar):cint;cdecl; + shout_get_agent: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_tls: function(shhandle :Pshout_t; mode:cint):cint;cdecl; + shout_get_tls: function(shhandle :Pshout_t):cint;cdecl; + shout_set_ca_directory: function(shhandle :Pshout_t; directory:pchar):cint;cdecl; + shout_get_ca_directory: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_ca_file: function(shhandle :Pshout_t; thefile:pchar):cint;cdecl; + shout_get_ca_file: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_allowed_ciphers: function(shhandle :Pshout_t; ciphers:pchar):cint;cdecl; + shout_get_allowed_ciphers: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_user: function(shhandle :Pshout_t; username:pchar):cint;cdecl; + shout_get_user: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_password: function(shhandle :Pshout_t; password:pchar):cint;cdecl; + shout_get_password: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_client_certificate: function(shhandle :Pshout_t; certificate:pchar):cint;cdecl; + shout_get_client_certificate: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_mount: function(shhandle :Pshout_t; mount:pchar):cint;cdecl; + shout_get_mount: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_name: function(shhandle :Pshout_t; name:pchar):cint;cdecl; + shout_get_name: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_url: function(shhandle :Pshout_t; url:pchar):cint;cdecl; + shout_get_url: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_genre: function(shhandle :Pshout_t; genre:pchar):cint;cdecl; + shout_get_genre: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_description: function(shhandle :Pshout_t; description:pchar):cint;cdecl; + shout_get_description: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_dumpfile: function(shhandle :Pshout_t; dumpfile:pchar):cint;cdecl; + shout_get_dumpfile: function(shhandle :Pshout_t):pchar;cdecl; + shout_set_audio_info: function(shhandle :Pshout_t; name:pchar; value:pchar):cint;cdecl; + shout_get_audio_info: function(shhandle :Pshout_t; name:pchar):pchar;cdecl; + shout_set_meta: function(shhandle :Pshout_t; name:pchar; value:pchar):cint;cdecl; + shout_get_meta: function(shhandle :Pshout_t; name:pchar):pchar;cdecl; + shout_set_public: function(shhandle :Pshout_t; make_public:cuint):cint;cdecl; + shout_get_public: function(shhandle :Pshout_t):cuint;cdecl; + shout_set_format: function(shhandle :Pshout_t; format:cuint):cint;cdecl; + shout_get_format: function(shhandle :Pshout_t):cuint;cdecl; + shout_set_protocol: function(shhandle :Pshout_t; protocol:cuint):cint;cdecl; + shout_get_protocol: function(shhandle :Pshout_t):cuint;cdecl; + shout_set_nonblocking: function(shhandle :Pshout_t; nonblocking:cuint):cint;cdecl; + shout_get_nonblocking: function(shhandle :Pshout_t):cuint;cdecl; + shout_open: function(shhandle :Pshout_t):cint;cdecl; + shout_close: function(shhandle :Pshout_t):cint;cdecl; + //shout_send: function(shhandle :Pshout_t; data:pcuchar; len:size_t):cint;cdecl; + shout_send: function(shhandle :Pshout_t; data:pbyte; len:size_t):cint;cdecl; + shout_send_raw: function(shhandle :Pshout_t; data:pcuchar; len:size_t):size_t;cdecl; + shout_queuelen: function(shhandle :Pshout_t):size_t;cdecl; + shout_sync: procedure(shhandle :Pshout_t);cdecl; + shout_delay: function(shhandle :Pshout_t):cint;cdecl; + shout_set_metadata: function(shhandle :Pshout_t; var metadata:shout_metadata_t):cint;cdecl; + shout_metadata_new: function():Pshout_metadata_t;cdecl; + shout_metadata_free: procedure(var shhandle:shout_metadata_t);cdecl; + shout_metadata_add: function(var shhandle:shout_metadata_t; name:pchar; value:pchar):cint;cdecl; + + sh_Handle:TLibHandle=dynlibs.NilHandle; // this will hold our handle for the lib; it functions nicely as a mutli-lib prevention unit as well... + + ReferenceCounter : cardinal = 0; // Reference counter + + function sh_IsLoaded : boolean; inline; + + Function sh_Load(const libfilename:string) :boolean; // load the lib + + Procedure sh_Unload(); // unload and frees the lib from memory : do not forget to call it before close application. + + +implementation + +function sh_IsLoaded: boolean; +begin + Result := (sh_Handle <> dynlibs.NilHandle); +end; + +Function sh_Load (const libfilename:string) :boolean; +begin + Result := False; + if sh_Handle<>0 then +begin + Inc(ReferenceCounter); + result:=true {is it already there ?} +end else +begin {go & load the library} + if Length(libfilename) = 0 then exit; + sh_Handle:=DynLibs.SafeLoadLibrary(libfilename); // obtain the handle we want + if sh_Handle <> DynLibs.NilHandle then +begin {now we tie the functions to the VARs from above} + +Pointer(shout_init):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_init')); +Pointer(shout_shutdown):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_shutdown')); +Pointer(shout_version):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_version')); +Pointer(shout_new):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_new')); +Pointer(shout_free):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_free')); +Pointer(shout_get_error):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_error')); +Pointer(shout_get_errno):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_errno')); +Pointer(shout_get_connected):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_connected')); +Pointer(shout_set_host):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_host')); +Pointer(shout_get_host):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_host')); +Pointer(shout_set_port):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_port')); +Pointer(shout_get_port):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_port')); +Pointer(shout_set_agent):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_agent')); +Pointer(shout_get_agent):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_agent')); +Pointer(shout_set_tls):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_tls')); +Pointer(shout_get_tls):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_tls')); +Pointer(shout_set_ca_directory):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_ca_directory')); +Pointer(shout_get_ca_directory):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_ca_directory')); +Pointer(shout_set_ca_file):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_ca_file')); +Pointer(shout_get_ca_file):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_ca_file')); +Pointer(shout_set_allowed_ciphers):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_allowed_ciphers')); +Pointer(shout_get_allowed_ciphers):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_allowed_ciphers')); +Pointer(shout_set_user):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_user')); +Pointer(shout_get_user):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_user')); +Pointer(shout_set_password):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_password')); +Pointer(shout_get_password):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_password')); +Pointer(shout_set_client_certificate):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_client_certificate')); +Pointer(shout_get_client_certificate):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_client_certificate')); +Pointer(shout_set_mount):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_mount')); +Pointer(shout_get_mount):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_mount')); +Pointer(shout_set_name):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_name')); +Pointer(shout_get_name):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_name')); +Pointer(shout_set_url):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_url')); +Pointer(shout_get_url):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_url')); +Pointer(shout_set_genre):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_genre')); +Pointer(shout_get_genre):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_genre')); +Pointer(shout_set_description):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_description')); +Pointer(shout_get_description):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_description')); +Pointer(shout_set_dumpfile):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_dumpfile')); +Pointer(shout_get_dumpfile):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_dumpfile')); +Pointer(shout_set_audio_info):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_audio_info')); +Pointer(shout_get_audio_info):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_audio_info')); +Pointer(shout_set_meta):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_meta')); +Pointer(shout_get_meta):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_meta')); +Pointer(shout_set_public):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_public')); +Pointer(shout_get_public):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_public')); +Pointer(shout_set_format):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_format')); +Pointer(shout_get_format):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_format')); +Pointer(shout_set_protocol):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_protocol')); +Pointer(shout_get_protocol):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_protocol')); +Pointer(shout_set_nonblocking):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_nonblocking')); +Pointer(shout_get_nonblocking):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_get_nonblocking')); +Pointer(shout_open):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_open')); +Pointer(shout_close):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_close')); +Pointer(shout_send):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_send')); +Pointer(shout_send_raw):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_send_raw')); +Pointer(shout_queuelen):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_queuelen')); +Pointer(shout_sync):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_sync')); +Pointer(shout_delay):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_delay')); +Pointer(shout_set_metadata):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_set_metadata')); +Pointer(shout_metadata_new):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_metadata_new')); +Pointer(shout_metadata_free):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_metadata_free')); +Pointer(shout_metadata_add):=DynLibs.GetProcedureAddress(sh_Handle,PChar('shout_metadata_add')); + +end; + Result := sh_IsLoaded; + ReferenceCounter:=1; +end; + +end; + +Procedure sh_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + if sh_IsLoaded then + begin + shout_shutdown(); + DynLibs.UnloadLibrary(sh_Handle); + sh_Handle:=DynLibs.NilHandle; + end; +end; + +end. diff --git a/UOS/src/uos_soundtouch.pas b/UOS/src/uos_soundtouch.pas new file mode 100644 index 0000000..4b178be --- /dev/null +++ b/UOS/src/uos_soundtouch.pas @@ -0,0 +1,216 @@ +{This unit is part of United Openlibraries of Sound (uos)} + +{This is the Dynamic loading + Unix compatible version of SoundTouch Pascal Wrapper + from Sandro Cumerlato <sandro.cumerlato@gmail.com>. + of the original C version of Olli Parviainen <oparviai@iki.fi>. + + Added BPMdetect method too. + Load library with St_load() and release with St_unload(). + License : modified LGPL. + Fred van Stappen / fiens@hotmail.com} + +unit uos_soundtouch; + +{$mode objfpc}{$H+} + +{$PACKRECORDS C} + +interface + +uses + ctypes, DynLibs; + +const +libst= + +{$IFDEF darwin} + 'libSoundTouchDLL.dylib'; + {$ELSE} + {$IFDEF unix} + 'libSoundTouch.so.1'; + {$ELSE} + {$if defined(cpu64)} + 'SoundTouch_x64.dll'; + {$else} + 'SoundTouch.dll'; + {$endif} + {$ENDIF} + {$ENDIF} + +{$IF not DEFINED(windows)} +type + THandle = pointer; +{$endif} + +type + Tt_bs2bdp = ^Tt_bs2bd; + Tt_bs2bd = packed record + level : CInt32; + srate : CInt32; + a0_lo : CDouble; + b1_lo : CDouble; + a0_hi : CDouble; + a1_hi : CDouble; + b1_hi : CDouble; + gain : CDouble; + lfs : packed record + asis : array[0..1] of cdouble; + lo : array[0..1] of cdouble; + hi : array[0..1] of cdouble; + end; + end; + +var + bpm_createInstance: function(chan: CInt32; sampleRate : CInt32): THandle; cdecl; + bpm_destroyInstance: procedure(h: THandle); cdecl; + bpm_getBpm: function(h: THandle): cfloat; cdecl; + bpm_putSamples: procedure(h: THandle; const samples: pcfloat; + numSamples: cardinal); cdecl; + + soundtouch_clear: procedure(h: THandle); cdecl; + soundtouch_createInstance: function(): THandle; cdecl; + soundtouch_flush: procedure(h: THandle); cdecl; + soundtouch_getSetting: function(h: THandle; settingId: integer): integer; cdecl; + soundtouch_getVersionId: function(): cardinal; cdecl; + soundtouch_getVersionString2: procedure(VersionString: PAnsiChar; + bufferSize: integer); cdecl; + soundtouch_getVersionString: function(): PAnsiChar; cdecl; + soundtouch_isEmpty: function(h: THandle): integer; cdecl; + soundtouch_numSamples: function(h: THandle): cardinal; cdecl; + soundtouch_numUnprocessedSamples: function(h: THandle): cardinal; cdecl; + soundtouch_putSamples: procedure(h: THandle; const samples: pcfloat; + numSamples: cardinal); cdecl; + soundtouch_receiveSamples: function(h: THandle; outBuffer: pcfloat; + maxSamples: cardinal): cardinal; cdecl; + soundtouch_setChannels: procedure(h: THandle; numChannels: cardinal); cdecl; + soundtouch_setPitch: procedure(h: THandle; newPitch: single); cdecl; + soundtouch_setPitchOctaves: procedure(h: THandle; newPitch: single); cdecl; + soundtouch_setPitchSemiTones: procedure(h: THandle; newPitch: single); cdecl; + soundtouch_setRate: procedure(h: THandle; newRate: single); cdecl; + soundtouch_setRateChange: procedure(h: THandle; newRate: single); cdecl; + soundtouch_setSampleRate: procedure(h: THandle; srate: cardinal); cdecl; + soundtouch_destroyInstance: procedure(h: THandle); cdecl; + soundtouch_setSetting: function(h: THandle; settingId: integer; Value: integer): boolean; cdecl; + soundtouch_setTempo: procedure(h: THandle; newTempo: single); cdecl; + soundtouch_setTempoChange: procedure(h: THandle; newTempo: single); cdecl; + + LibHandle:TLibHandle=dynlibs.NilHandle; // this will hold our handle for the lib + ReferenceCounter : cardinal = 0; // Reference counter + +function ST_IsLoaded : boolean; inline; +function ST_Load(const libfilename: string): boolean; // load the lib +procedure ST_Unload(); // unload and frees the lib from memory : do not forget to call it before close application. + +implementation + +function ST_IsLoaded: boolean; +begin + Result := (LibHandle <> dynlibs.NilHandle); +end; + +function ST_Load(const libfilename: string): boolean; +var +thelib: string; +begin + Result := False; + if LibHandle<>0 then +begin + Inc(ReferenceCounter); +result:=true +end else begin + if Length(libfilename) = 0 then thelib := libst else thelib := libfilename; + LibHandle:=DynLibs.SafeLoadLibrary(thelib); // obtain the handle we want. + if LibHandle <> DynLibs.NilHandle then + begin + try + Pointer(soundtouch_createInstance) := + GetProcAddress(LibHandle, 'soundtouch_createInstance'); + if Pointer(soundtouch_createInstance) = nil then // not the SoundTouchDLL library. + begin + ST_Unload; + result := false end + else + begin + Pointer(soundtouch_clear) := + GetProcAddress(LibHandle, 'soundtouch_clear'); + Pointer(soundtouch_destroyInstance) := + GetProcAddress(LibHandle, 'soundtouch_destroyInstance'); + Pointer(soundtouch_flush) := + GetProcAddress(LibHandle, 'soundtouch_flush'); + Pointer(soundtouch_getSetting) := + GetProcAddress(LibHandle, 'soundtouch_getSetting'); + Pointer(soundtouch_getVersionId) := + GetProcAddress(LibHandle, 'soundtouch_getVersionId'); + Pointer(soundtouch_getVersionString2) := + GetProcAddress(LibHandle, 'soundtouch_getVersionString2'); + Pointer(soundtouch_getVersionString) := + GetProcAddress(LibHandle, 'soundtouch_getVersionString'); + Pointer(soundtouch_isEmpty) := + GetProcAddress(LibHandle, 'soundtouch_isEmpty'); + Pointer(soundtouch_numSamples) := + GetProcAddress(LibHandle, 'soundtouch_numSamples'); + Pointer(soundtouch_numUnprocessedSamples) := + GetProcAddress(LibHandle, 'soundtouch_numUnprocessedSamples'); + Pointer(soundtouch_putSamples) := + GetProcAddress(LibHandle, 'soundtouch_putSamples'); + Pointer(soundtouch_receiveSamples) := + GetProcAddress(LibHandle, 'soundtouch_receiveSamples'); + Pointer(soundtouch_setChannels) := + GetProcAddress(LibHandle, 'soundtouch_setChannels'); + Pointer(soundtouch_setPitch) := + GetProcAddress(LibHandle, 'soundtouch_setPitch'); + Pointer(soundtouch_setPitchOctaves) := + GetProcAddress(LibHandle, 'soundtouch_setPitchOctaves'); + Pointer(soundtouch_setPitchSemiTones) := + GetProcAddress(LibHandle, 'soundtouch_setPitchSemiTones'); + Pointer(soundtouch_setRate) := + GetProcAddress(LibHandle, 'soundtouch_setRate'); + Pointer(soundtouch_setRateChange) := + GetProcAddress(LibHandle, 'soundtouch_setRateChange'); + Pointer(soundtouch_setSampleRate) := + GetProcAddress(LibHandle, 'soundtouch_setSampleRate'); + Pointer(soundtouch_setSetting) := + GetProcAddress(LibHandle, 'soundtouch_setSetting'); + Pointer(soundtouch_setTempo) := + GetProcAddress(LibHandle, 'soundtouch_setTempo'); + Pointer(soundtouch_setTempoChange) := + GetProcAddress(LibHandle, 'soundtouch_setTempoChange'); + + Pointer(bpm_createInstance) := + GetProcAddress(LibHandle, 'bpm_createInstance'); + Pointer(bpm_destroyInstance) := + GetProcAddress(LibHandle, 'bpm_destroyInstance'); + Pointer(bpm_getBpm) := + GetProcAddress(LibHandle, 'bpm_getBpm'); + Pointer(bpm_putSamples) := + GetProcAddress(LibHandle, 'bpm_putSamples'); + + Result := St_IsLoaded; + ReferenceCounter:=1; + + end; + + except + ST_Unload; + end; + end; +end; +end; + +procedure ST_Unload; +begin +// < Reference counting + if ReferenceCounter > 0 then + dec(ReferenceCounter); + if ReferenceCounter > 0 then + exit; + // > + + if LibHandle <> DynLibs.NilHandle then + begin + DynLibs.UnloadLibrary(LibHandle); + LibHandle := DynLibs.NilHandle; + end; +end; + +end. diff --git a/UOS/uos.bmp b/UOS/uos.bmp new file mode 100644 index 0000000..1f3352e Binary files /dev/null and b/UOS/uos.bmp differ diff --git a/UOS/uos.jpg b/UOS/uos.jpg new file mode 100644 index 0000000..e575156 Binary files /dev/null and b/UOS/uos.jpg differ diff --git a/UOS/uos.png b/UOS/uos.png new file mode 100644 index 0000000..5aa78bc Binary files /dev/null and b/UOS/uos.png differ diff --git a/UOS/uos.svg b/UOS/uos.svg new file mode 100644 index 0000000..c804499 --- /dev/null +++ b/UOS/uos.svg @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg width="100%" height="100%" viewBox="0 0 2481 3508" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;"> + <g transform="matrix(1,0,0,1,-0.309319,-58)"> + <path d="M964.394,1191.59C933.113,1149.01 911.069,1099.59 900.671,1047.76C880.203,945.743 905.275,835.43 969.481,752.533C1031.66,672.251 1128.99,619.936 1231.82,614.936C1237.93,614.639 1244.07,614.512 1250.15,614.521C1333.92,614.929 1416.5,646.015 1479.95,701.14C1553.73,765.235 1599.52,860.334 1604.08,958.249C1604.35,963.949 1604.47,969.656 1604.48,975.351L1604.01,985.011C1602.72,993.497 1602.71,995.716 1600.15,1003.94C1588.66,1040.76 1553.3,1068.8 1513.99,1070.85C1488.19,1072.2 1462.06,1062.56 1443.33,1044.81C1426.95,1029.29 1416.35,1007.84 1414.03,985.308C1413.14,976.712 1413.58,968.071 1412.8,959.458C1409.03,917.656 1389.53,877.486 1358.82,848.986C1323.66,816.351 1273.84,800.119 1225.68,807.169C1162.67,816.392 1108.05,865.942 1090.71,928.963C1077.52,976.922 1085.69,1030.41 1113.62,1072.05C1127.4,1092.62 1145.74,1109.96 1166.95,1122.62C1198.9,1117.61 1231.65,1115 1265,1115C1447.52,1115 1611.95,1193.03 1726.74,1317.52C1736.83,1287.88 1748.78,1258.89 1762.67,1230.78C1818.66,1117.47 1905.86,1020.15 2006.35,944.661L2014.37,939.251C2017.21,937.727 2019.98,936.058 2022.89,934.68C2028.73,931.92 2034.83,929.76 2041.11,928.232C2049.48,926.193 2051.69,926.328 2060.24,925.582C2063.47,925.629 2066.69,925.675 2069.91,925.722C2073.12,926.094 2076.34,926.305 2079.52,926.839C2117.39,933.201 2150.08,964.222 2157.49,1003.13C2163.53,1034.79 2152.31,1069.13 2128.48,1091.14C2119.68,1099.27 2109.75,1105.86 2100.43,1113.34C2032.57,1167.85 1974.37,1234.63 1935.31,1312.49C1892.33,1398.17 1874.28,1495.26 1874.5,1591.22C1886.59,1639.83 1893,1690.67 1893,1743C1893,2089.6 1611.6,2371 1265,2371C918.397,2371 637,2089.6 637,1743C637,1694.3 642.556,1646.88 653.068,1601.36C653.083,1597.14 653.218,1592.93 653.221,1588.71C653.304,1491.38 634.217,1393.75 589.954,1307.68C547.122,1224.4 481.437,1153.53 406.648,1097.34L399.22,1091.14C396.965,1088.84 394.591,1086.64 392.456,1084.23C369.041,1057.73 361.98,1017.96 375.725,984.613C389.2,951.923 421.8,928.067 457.793,925.722C464.227,925.303 470.675,925.863 477.099,926.423C485.53,928.029 487.748,928.12 495.869,930.995C501.955,933.15 507.807,935.917 513.335,939.253C520.339,943.48 526.56,948.556 532.922,953.477C630.349,1028.83 712.411,1123.2 766.316,1233.39C779.95,1261.26 791.68,1289.99 801.595,1319.34C848.273,1268.31 903.256,1225.02 964.394,1191.59Z" style="fill:url(#_Linear1);stroke:black;stroke-width:25px;"/> + </g> + <g transform="matrix(1,0,0,1,-31.5345,116)"> + <g transform="matrix(300,0,0,300,332.749,2567.66)"> + <path d="M0.065,-0.257C0.065,-0.11 0.144,0.015 0.342,0.015C0.541,0.015 0.62,-0.11 0.62,-0.257L0.62,-0.714L0.552,-0.714L0.552,-0.272C0.553,-0.106 0.474,-0.043 0.342,-0.043C0.211,-0.043 0.132,-0.106 0.133,-0.272L0.133,-0.714L0.065,-0.714L0.065,-0.257Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,538.249,2567.66)"> + <path d="M0.059,0L0.122,0L0.122,-0.301C0.124,-0.402 0.184,-0.478 0.284,-0.478C0.386,-0.478 0.415,-0.411 0.415,-0.322L0.415,0L0.478,0L0.478,-0.332C0.478,-0.455 0.434,-0.531 0.289,-0.531C0.216,-0.531 0.147,-0.489 0.124,-0.427L0.122,-0.427L0.122,-0.516L0.059,-0.516L0.059,0Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,699.349,2567.66)"> + <path d="M0.061,0L0.124,0L0.124,-0.516L0.061,-0.516L0.061,0ZM0.061,-0.613L0.124,-0.613L0.124,-0.714L0.061,-0.714L0.061,-0.613Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,754.849,2567.66)"> + <path d="M0.16,-0.671L0.097,-0.671L0.097,-0.516L0.007,-0.516L0.007,-0.463L0.097,-0.463L0.097,-0.11C0.096,-0.022 0.125,0.006 0.209,0.006C0.228,0.006 0.246,0.004 0.265,0.004L0.265,-0.05C0.247,-0.048 0.229,-0.047 0.211,-0.047C0.166,-0.05 0.16,-0.074 0.16,-0.115L0.16,-0.463L0.265,-0.463L0.265,-0.516L0.16,-0.516L0.16,-0.671Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,843.649,2567.66)"> + <path d="M0.494,-0.241C0.499,-0.386 0.433,-0.531 0.267,-0.531C0.103,-0.531 0.034,-0.394 0.034,-0.258C0.034,-0.111 0.103,0.015 0.267,0.015C0.397,0.015 0.465,-0.053 0.492,-0.17L0.429,-0.17C0.409,-0.092 0.359,-0.038 0.267,-0.038C0.146,-0.038 0.098,-0.149 0.097,-0.241L0.494,-0.241ZM0.097,-0.294C0.107,-0.388 0.164,-0.478 0.267,-0.478C0.369,-0.478 0.428,-0.389 0.431,-0.294L0.097,-0.294Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,999.349,2567.66)"> + <path d="M0.101,-0.258C0.101,-0.365 0.15,-0.478 0.27,-0.478C0.404,-0.478 0.451,-0.365 0.451,-0.258C0.451,-0.151 0.404,-0.038 0.27,-0.038C0.15,-0.038 0.101,-0.151 0.101,-0.258ZM0.514,-0.714L0.451,-0.714L0.451,-0.418L0.449,-0.418C0.422,-0.492 0.347,-0.531 0.27,-0.531C0.113,-0.531 0.038,-0.404 0.038,-0.258C0.038,-0.112 0.113,0.015 0.27,0.015C0.345,0.015 0.427,-0.031 0.454,-0.098L0.456,-0.098L0.456,0L0.514,0L0.514,-0.714Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,1254.95,2567.66)"> + <path d="M0.034,-0.357C0.034,-0.162 0.146,0.015 0.371,0.015C0.595,0.015 0.707,-0.162 0.707,-0.357C0.707,-0.552 0.595,-0.729 0.371,-0.729C0.146,-0.729 0.034,-0.552 0.034,-0.357ZM0.102,-0.357C0.102,-0.513 0.182,-0.671 0.371,-0.671C0.559,-0.671 0.639,-0.513 0.639,-0.357C0.639,-0.201 0.559,-0.043 0.371,-0.043C0.182,-0.043 0.102,-0.201 0.102,-0.357Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,1477.25,2567.66)"> + <path d="M0.473,-0.258C0.473,-0.151 0.424,-0.038 0.304,-0.038C0.17,-0.038 0.123,-0.151 0.123,-0.258C0.123,-0.375 0.165,-0.478 0.304,-0.478C0.424,-0.478 0.473,-0.365 0.473,-0.258ZM0.06,0.191L0.123,0.191L0.123,-0.098L0.125,-0.098C0.152,-0.024 0.227,0.015 0.304,0.015C0.461,0.015 0.536,-0.112 0.536,-0.258C0.536,-0.404 0.461,-0.531 0.304,-0.531C0.221,-0.531 0.149,-0.488 0.12,-0.418L0.118,-0.418L0.118,-0.516L0.06,-0.516L0.06,0.191Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,1649.45,2567.66)"> + <path d="M0.494,-0.241C0.499,-0.386 0.433,-0.531 0.267,-0.531C0.103,-0.531 0.034,-0.394 0.034,-0.258C0.034,-0.111 0.103,0.015 0.267,0.015C0.397,0.015 0.465,-0.053 0.492,-0.17L0.429,-0.17C0.409,-0.092 0.359,-0.038 0.267,-0.038C0.146,-0.038 0.098,-0.149 0.097,-0.241L0.494,-0.241ZM0.097,-0.294C0.107,-0.388 0.164,-0.478 0.267,-0.478C0.369,-0.478 0.428,-0.389 0.431,-0.294L0.097,-0.294Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,1805.15,2567.66)"> + <path d="M0.059,0L0.122,0L0.122,-0.301C0.124,-0.402 0.184,-0.478 0.284,-0.478C0.386,-0.478 0.415,-0.411 0.415,-0.322L0.415,0L0.478,0L0.478,-0.332C0.478,-0.455 0.434,-0.531 0.289,-0.531C0.216,-0.531 0.147,-0.489 0.124,-0.427L0.122,-0.427L0.122,-0.516L0.059,-0.516L0.059,0Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,1966.25,2567.66)"> + <rect x="0.061" y="-0.714" width="0.063" height="0.714" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,2021.75,2567.66)"> + <path d="M0.061,0L0.124,0L0.124,-0.516L0.061,-0.516L0.061,0ZM0.061,-0.613L0.124,-0.613L0.124,-0.714L0.061,-0.714L0.061,-0.613Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,2077.25,2567.66)"> + <path d="M0.473,-0.258C0.473,-0.151 0.424,-0.038 0.304,-0.038C0.17,-0.038 0.123,-0.151 0.123,-0.258C0.123,-0.365 0.17,-0.478 0.304,-0.478C0.424,-0.478 0.473,-0.365 0.473,-0.258ZM0.06,0L0.118,0L0.118,-0.098L0.12,-0.098C0.149,-0.028 0.221,0.015 0.304,0.015C0.461,0.015 0.536,-0.112 0.536,-0.258C0.536,-0.404 0.461,-0.531 0.304,-0.531C0.227,-0.531 0.152,-0.492 0.125,-0.418L0.123,-0.418L0.123,-0.714L0.06,-0.714L0.06,0Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,702.049,2927.66)"> + <path d="M0.278,-0.531C0.12,-0.531 0.034,-0.406 0.034,-0.258C0.034,-0.11 0.12,0.015 0.278,0.015C0.436,0.015 0.522,-0.11 0.522,-0.258C0.522,-0.406 0.436,-0.531 0.278,-0.531ZM0.278,-0.478C0.399,-0.478 0.459,-0.368 0.459,-0.258C0.459,-0.148 0.399,-0.038 0.278,-0.038C0.157,-0.038 0.097,-0.148 0.097,-0.258C0.097,-0.368 0.157,-0.478 0.278,-0.478Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,868.849,2927.66)"> + <path d="M0.259,-0.516L0.157,-0.516L0.157,-0.561C0.158,-0.617 0.156,-0.661 0.226,-0.661C0.241,-0.661 0.255,-0.659 0.272,-0.656L0.272,-0.71C0.252,-0.713 0.237,-0.714 0.219,-0.714C0.118,-0.714 0.093,-0.652 0.094,-0.563L0.094,-0.516L0.006,-0.516L0.006,-0.463L0.094,-0.463L0.094,0L0.157,0L0.157,-0.463L0.259,-0.463L0.259,-0.516Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,1029.95,2927.66)"> + <path d="M0.036,-0.235C0.028,-0.061 0.152,0.015 0.321,0.015C0.574,0.015 0.594,-0.14 0.594,-0.189C0.594,-0.306 0.51,-0.35 0.409,-0.377L0.235,-0.42C0.177,-0.434 0.127,-0.462 0.127,-0.529C0.127,-0.635 0.213,-0.671 0.306,-0.671C0.407,-0.671 0.497,-0.616 0.501,-0.507L0.569,-0.507C0.57,-0.653 0.446,-0.729 0.305,-0.729C0.104,-0.729 0.059,-0.598 0.059,-0.528C0.059,-0.417 0.136,-0.377 0.22,-0.356L0.379,-0.317C0.445,-0.301 0.526,-0.269 0.526,-0.188C0.526,-0.084 0.412,-0.043 0.337,-0.043C0.207,-0.043 0.101,-0.088 0.104,-0.235L0.036,-0.235Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,1218.95,2927.66)"> + <path d="M0.278,-0.531C0.12,-0.531 0.034,-0.406 0.034,-0.258C0.034,-0.11 0.12,0.015 0.278,0.015C0.436,0.015 0.522,-0.11 0.522,-0.258C0.522,-0.406 0.436,-0.531 0.278,-0.531ZM0.278,-0.478C0.399,-0.478 0.459,-0.368 0.459,-0.258C0.459,-0.148 0.399,-0.038 0.278,-0.038C0.157,-0.038 0.097,-0.148 0.097,-0.258C0.097,-0.368 0.157,-0.478 0.278,-0.478Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,1385.75,2927.66)"> + <path d="M0.478,-0.516L0.415,-0.516L0.415,-0.245C0.415,-0.14 0.368,-0.038 0.26,-0.038C0.16,-0.038 0.125,-0.087 0.122,-0.18L0.122,-0.516L0.059,-0.516L0.059,-0.181C0.059,-0.061 0.11,0.015 0.24,0.015C0.317,0.015 0.385,-0.024 0.418,-0.093L0.42,-0.093L0.42,0L0.478,0L0.478,-0.516Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,1546.85,2927.66)"> + <path d="M0.059,0L0.122,0L0.122,-0.301C0.124,-0.402 0.184,-0.478 0.284,-0.478C0.386,-0.478 0.415,-0.411 0.415,-0.322L0.415,0L0.478,0L0.478,-0.332C0.478,-0.455 0.434,-0.531 0.289,-0.531C0.216,-0.531 0.147,-0.489 0.124,-0.427L0.122,-0.427L0.122,-0.516L0.059,-0.516L0.059,0Z" style="fill-rule:nonzero;"/> + </g> + <g transform="matrix(300,0,0,300,1707.95,2927.66)"> + <path d="M0.101,-0.258C0.101,-0.365 0.15,-0.478 0.27,-0.478C0.404,-0.478 0.451,-0.365 0.451,-0.258C0.451,-0.151 0.404,-0.038 0.27,-0.038C0.15,-0.038 0.101,-0.151 0.101,-0.258ZM0.514,-0.714L0.451,-0.714L0.451,-0.418L0.449,-0.418C0.422,-0.492 0.347,-0.531 0.27,-0.531C0.113,-0.531 0.038,-0.404 0.038,-0.258C0.038,-0.112 0.113,0.015 0.27,0.015C0.345,0.015 0.427,-0.031 0.454,-0.098L0.456,-0.098L0.456,0L0.514,0L0.514,-0.714Z" style="fill-rule:nonzero;"/> + </g> + </g> + <g transform="matrix(1.07466,0,0,1.07466,-69.134,-132.835)"> + <path d="M1003.63,1308.64C1067.37,1268.21 1149.53,1271.67 1209.64,1317.32C1209.64,1317.32 1209.64,1317.32 1209.64,1317.32C1251.28,1348.93 1293.13,1381.58 1326.7,1421.78C1346.21,1445.13 1363.42,1472.1 1371.19,1502.05C1384.53,1553.4 1367.17,1609.48 1330.61,1646.34C1301.51,1675.68 1260.54,1692.72 1219.21,1692.72C1179.1,1692.72 1139.94,1676.95 1111.18,1649.63C1080.52,1620.51 1062.79,1578.47 1062.73,1537C1062.33,1529.48 1062.52,1527.54 1060.99,1520.15C1059.26,1511.84 1056.27,1503.8 1052.14,1496.39C1035.34,1466.24 999.685,1449.22 966.204,1454.4C932.095,1459.69 903.755,1487.22 896.988,1520.41C896.424,1523.18 896.141,1526 895.718,1528.8L895.302,1537.27C895.331,1555.41 896.826,1573.45 899.851,1591.27C915.359,1682.62 971.841,1764.9 1050.5,1812.87C1110.96,1849.74 1183.79,1865.86 1254.23,1858.27C1322.5,1850.92 1387.85,1821.22 1438.3,1774.99C1500.16,1718.3 1538.45,1637.06 1542.7,1553.7C1546.27,1483.65 1524.79,1415.26 1487.02,1357.3C1468.67,1329.15 1447.06,1303.54 1423.43,1279.74C1576.02,1349.42 1682.16,1503.41 1682.16,1682C1682.16,1925.95 1484.1,2124 1240.16,2124C996.211,2124 798.157,1925.95 798.157,1682C798.157,1525.03 880.16,1387.06 1003.63,1308.64Z" style="fill:none;stroke:white;stroke-width:23.26px;"/> + </g> + <defs> + <linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(3.92378,-1756.48,1756.48,3.92378,1240,2371)"><stop offset="0" style="stop-color:rgb(68,139,63);stop-opacity:1"/><stop offset="1" style="stop-color:white;stop-opacity:1"/></linearGradient> + </defs> +</svg> diff --git a/backup/main.lfm b/backup/main.lfm index dec2576..9086ef6 100644 --- a/backup/main.lfm +++ b/backup/main.lfm @@ -8,6 +8,7 @@ object Form1: TForm1 ClientWidth = 704 ShowInTaskBar = stAlways SnapOptions.SnapToMonitor = True + LCLVersion = '4.0.0.4' OnCreate = FormCreate object TabControl1: TTabControl AnchorSideRight.Side = asrBottom diff --git a/backup/main.pas b/backup/main.pas index e59837d..610ce05 100644 --- a/backup/main.pas +++ b/backup/main.pas @@ -1,13 +1,14 @@ unit main; {$mode objfpc}{$H+} +{$R music.res} interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, ComCtrls, ExtendedTabControls, fphttpclient, opensslsockets, fpjson, - jsonparser, ThreadUnit; + jsonparser, ThreadUnit, uos, uos_portaudio, uos_flat, uos_libxmp, Windows; type @@ -41,17 +42,40 @@ var jData: TJSONData; packageData: TJSONObject; test1: ThreadClass; + ResStream: TResourceStream; implementation {$R *.lfm} { TForm1 } +function ExtractResourceToTempFile(const ResName: string): string; +var + ResStream: TResourceStream; + TempPath, TempFileName: string; +begin + TempPath := GetTempDir; + TempFileName := TempPath + '5f64126c-1f61-4e65-8250-4a7835d2f155'; + ResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA); + try + ResStream.SaveToFile(TempFileName); + finally + ResStream.Free; + end; + + Result := TempFileName; +end; procedure TForm1.FormCreate(Sender: TObject); begin BtnSearch.Enabled := False; + //loonie_mifue.xm + uos_LoadLib( pchar('LibPortaudio-64.dll'), nil, nil, nil, nil, nil, pchar('libxmp-64.dll')); + uos_CreatePlayer( 0 ); + uos_AddIntoDevOut( 0 ); + uos_AddFromFile( 0, PChar(ExtractResourceToTempFile('LOONIEMUSIC'))); + uos_Play(0); end; procedure TForm1.BtnSearchClick(Sender: TObject); @@ -63,6 +87,7 @@ begin Response := Client.Get(Concat('https://registry.npmjs.org/', PackageName)); jData := GetJSON(Response); packageData := jData as TJSONObject; + memoTest.Lines.Text := jData.FormatJSON; finally Client.Free; @@ -81,5 +106,5 @@ begin else BtnSearch.Enabled := False; end; - end. +uos_free; diff --git a/backup/package_zerch.lpi b/backup/package_zerch.lpi index 15773ba..73f8fe2 100644 --- a/backup/package_zerch.lpi +++ b/backup/package_zerch.lpi @@ -47,6 +47,11 @@ <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> </Unit> + <Unit> + <Filename Value="threadunit.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="ThreadUnit"/> + </Unit> </Units> </ProjectOptions> <CompilerOptions> diff --git a/backup/package_zerch.lps b/backup/package_zerch.lps index e91614f..c70a006 100644 --- a/backup/package_zerch.lps +++ b/backup/package_zerch.lps @@ -12,7 +12,7 @@ <WindowIndex Value="-1"/> <TopLine Value="-1"/> <CursorPos X="-1" Y="-1"/> - <UsageCount Value="24"/> + <UsageCount Value="26"/> </Unit> <Unit> <Filename Value="main.pas"/> @@ -20,85 +20,47 @@ <ComponentName Value="Form1"/> <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> - <TopLine Value="39"/> - <CursorPos X="10" Y="43"/> - <UsageCount Value="24"/> + <IsVisibleTab Value="True"/> + <TopLine Value="49"/> + <CursorPos X="67" Y="58"/> + <UsageCount Value="26"/> <Loaded Value="True"/> <LoadedDesigner Value="True"/> </Unit> - <Unit> - <Filename Value="C:\lazarus\lcl\include\control.inc"/> - <EditorIndex Value="2"/> - <TopLine Value="4000"/> - <CursorPos Y="4010"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit> <Unit> <Filename Value="threadunit.pas"/> <IsPartOfProject Value="True"/> <UnitName Value="ThreadUnit"/> - <IsVisibleTab Value="True"/> - <EditorIndex Value="1"/> + <EditorIndex Value="3"/> <TopLine Value="11"/> <CursorPos X="40" Y="26"/> - <UsageCount Value="21"/> + <UsageCount Value="23"/> + <Loaded Value="True"/> + </Unit> + <Unit> + <Filename Value="C:\lazarus\lcl\include\control.inc"/> + <EditorIndex Value="4"/> + <TopLine Value="4000"/> + <CursorPos Y="4010"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit> + <Unit> + <Filename Value="UOS\src\uos_libxmp.pas"/> + <EditorIndex Value="2"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit> + <Unit> + <Filename Value="..\..\..\..\AppData\Local\lazarus\onlinepackagemanager\packages\UOS\src\uos_flat.pas"/> + <EditorIndex Value="1"/> + <TopLine Value="243"/> + <CursorPos X="39" Y="249"/> + <UsageCount Value="10"/> <Loaded Value="True"/> </Unit> </Units> <JumpHistory HistoryIndex="29"> - <Position> - <Filename Value="main.pas"/> - <Caret Line="9" Column="41"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="4" Column="11"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="52" Column="84" TopLine="42"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="55" Column="30" TopLine="42"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="51" Column="57" TopLine="36"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="48" TopLine="44"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="54" TopLine="44"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="61" Column="37" TopLine="46"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="55" Column="38" TopLine="44"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="57" Column="38" TopLine="46"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="66" TopLine="57"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="65" TopLine="55"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="60" Column="15"/> - </Position> <Position> <Filename Value="main.pas"/> <Caret Line="57" TopLine="47"/> @@ -143,10 +105,6 @@ <Filename Value="threadunit.pas"/> <Caret Line="23" Column="3" TopLine="8"/> </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="46" Column="35" TopLine="60"/> - </Position> <Position> <Filename Value="main.pas"/> <Caret Line="47" Column="29" TopLine="33"/> @@ -167,6 +125,62 @@ <Filename Value="threadunit.pas"/> <Caret Line="12" Column="19" TopLine="2"/> </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="10" Column="37"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="7" Column="33"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="10" Column="30"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="56" Column="78" TopLine="46"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="54" Column="4" TopLine="44"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="50" Column="37" TopLine="46"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="10" Column="56"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="56" Column="43" TopLine="46"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="91" Column="12" TopLine="73"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="102" Column="5" TopLine="83"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="94" Column="59" TopLine="84"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="61" Column="30" TopLine="56"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="105" Column="21" TopLine="93"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="31" Column="5" TopLine="22"/> + </Position> </JumpHistory> <RunParams> <FormatVersion Value="2"/> diff --git a/id_rsa b/id_rsa new file mode 100644 index 0000000..c345147 --- /dev/null +++ b/id_rsa @@ -0,0 +1,38 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn +NhAAAAAwEAAQAAAYEA2JiTt5c2eqKRFJYkx53MF1dZxAcdB33l9QhVTYp3poL11IAoW40i ++sohuijciJF5NIQEIDHZIVBL3I/NmEcDNQKCO6P4TWvNmYigMKWE98mR/bsUpJ8ABj1Sk7 +bP9lU9JMvy9ND4zh0SEAkpW/6dSpt63vPQwE5RS+Q/VEDEZtRT3kR3YmzGuGLwHz1sbJO1 +TCRkJJVzBuSj090K6ZAbyWtnjBiR2Ey+IwF4efwf9Y7yj82BU5AqdZ6q+O3n8eRR25mNcx +CP+9w4D6/wNNiiHiTNvXUpMfgK7t1tmDm8e/w2clPo5R12Db23WNqJIBrwTfrYLFpLwAjr +XJQ+qyLxiIggbRBrNzEZ6G/of/NiRdy3Hm82p0Ohu0Gv73ormORHLIjiMkvn2l8uD6+Hak +qKbvGj/rPyaB6ZVkVy6AwWulnf/njWhK/3W+VMoaMjHSuAVNsQVGUIoBgb9BEzqPUUw2Ty +P9aaAx/hnmrihMVAIsWoBMbeI4m6bSTAH2VNzdX1AAAFiI1f8tmNX/LZAAAAB3NzaC1yc2 +EAAAGBANiYk7eXNnqikRSWJMedzBdXWcQHHQd95fUIVU2Kd6aC9dSAKFuNIvrKIboo3IiR +eTSEBCAx2SFQS9yPzZhHAzUCgjuj+E1rzZmIoDClhPfJkf27FKSfAAY9UpO2z/ZVPSTL8v +TQ+M4dEhAJKVv+nUqbet7z0MBOUUvkP1RAxGbUU95Ed2Jsxrhi8B89bGyTtUwkZCSVcwbk +o9PdCumQG8lrZ4wYkdhMviMBeHn8H/WO8o/NgVOQKnWeqvjt5/HkUduZjXMQj/vcOA+v8D +TYoh4kzb11KTH4Cu7dbZg5vHv8NnJT6OUddg29t1jaiSAa8E362CxaS8AI61yUPqsi8YiI +IG0QazcxGehv6H/zYkXctx5vNqdDobtBr+96K5jkRyyI4jJL59pfLg+vh2pKim7xo/6z8m +gemVZFcugMFrpZ3/541oSv91vlTKGjIx0rgFTbEFRlCKAYG/QRM6j1FMNk8j/WmgMf4Z5q +4oTFQCLFqATG3iOJum0kwB9lTc3V9QAAAAMBAAEAAAGAfIe85mFaQUgWge+RVfOz0/e09K +/iUNxhym/wG5TxFhtVm8fTbE/JPMfafF3h7eM1/Kuqc5g1bqHr+/PyEQtDHMdEeWXc7SZ+ +HzgeYdnIiW6rMWbOh5ejO/Ml9ye0ibyYWv+nwHolktvD9tRNo0bQyIR8MJOeAfMFaszgXG +Cgiz6oubJDsaM43eqEhHGcVRDXu99wdFg4uk3ao4UDMSZZ04SdFD9MG0CEUTwXOIttFJIL +hAJzyMeqodWIF3cxVDIgj4umOCUnQ5vZRdDB1tRe5pIbu761gmPxSKfcDtdjmB80AWD0/K +anSopvMHOQyjboX58RGq96UshERIr1Ogclx2Re/78pKzItftapQ1veN+5n/WOB0pZlrjhb +z/A4rS3Vkky59W7Bn4nLxsdSOBXzhyhTAGP+gDDGjQabEOEgVeuiP2rQsqAHZL1P40wo2d +cMDFwW9QxgF1QPHYCLuliK3MMO/urd7wq5tBSyzGDDK+qYuUvcS3dcbmK24C0XbpQBAAAA +wE68l6fdzL6GKQqT2sRy4qvGHY5QoBCQhCE4h4kVUrL6pcuyy2ju0+leFklrqnRIB61Wr9 +Bb7GMEI/ijf0XYrnwv/lkgFvU5sG52vbhWozqL30cqmCdLnLZ/UEdnVvaDbBO5c6wemlxU +nnw+JppPPoMfPlXhsKr1cFkWn6IN8g0okwOXdJS3ivwucMtWwn0Ds0AG3uqTG9g1PEq+eR +lA7S2+yYFHKGaTFncp6sd3PHIWvafrHLUzqq6KY40bsJPiKQAAAMEA6+p7fRL7HyJLd6s7 +TGN2qF/u1vgi5MRpUryqupVjr91422fI+jrukevLTTF/y9qFyQ5UAnyXgcGlDHl2JUVudK +c7kreHMpvzVoHzUswwt9Nqvx9BG9S4nEIobM1xQy+kBoHNjZVz8uWHSsmAE7Ro8p+JibSH +saoKur7p8H7ZyktmFHetcu2bSj/2hEDGyIdnrVdodkjUgNutKI9+BOKDYxB9AjcdV45QM4 +9shosueMzRZUm+S58ciYBorzhbn4NxAAAAwQDrCQnkFe92afBHSo1JtNT3HvitkJU9s41O +H9wKMAQem6s25vjoobbe8neoSQqmDdnJ5qQqTAFojAl1uMYY97YR9igc/u5iGbYpi2qCc5 +o2Ocf/ku093u3fa0viQNWHVuo9mduPBW7qVSiPEY7lsf0ypaDdogwAmNGVrL6B9XpO3+Uh +dsdAmyhm1qguzcmJzGLEl4a0dBxmMTFB43sxQEwYYaPcl1sDV+Ug1xDj5WQVtrbaz3wVhv +1LBq8I4QSwsMUAAAARaW5kcmFqaXRoQGxhcDEwODcBAg== +-----END OPENSSH PRIVATE KEY----- diff --git a/lib/x86_64-win64/main.lfm b/lib/x86_64-win64/main.lfm index dec2576..9086ef6 100644 --- a/lib/x86_64-win64/main.lfm +++ b/lib/x86_64-win64/main.lfm @@ -8,6 +8,7 @@ object Form1: TForm1 ClientWidth = 704 ShowInTaskBar = stAlways SnapOptions.SnapToMonitor = True + LCLVersion = '4.0.0.4' OnCreate = FormCreate object TabControl1: TTabControl AnchorSideRight.Side = asrBottom diff --git a/lib/x86_64-win64/main.ppu b/lib/x86_64-win64/main.ppu index d120424..ab1bb98 100644 Binary files a/lib/x86_64-win64/main.ppu and b/lib/x86_64-win64/main.ppu differ diff --git a/lib/x86_64-win64/music.res b/lib/x86_64-win64/music.res new file mode 100644 index 0000000..7e28144 Binary files /dev/null and b/lib/x86_64-win64/music.res differ diff --git a/lib/x86_64-win64/package_zerch.compiled b/lib/x86_64-win64/package_zerch.compiled index 476719e..e2d8271 100644 --- a/lib/x86_64-win64/package_zerch.compiled +++ b/lib/x86_64-win64/package_zerch.compiled @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <CONFIG> <Compiler Value="C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe" Date="1520657216"/> - <Params Value="-MObjFPC -Scghi -O1 -gw3 -gl -WG -l -vewnhibq -FiC:\Users\indrajith\Documents\projects\package-search\package-zerch\lib\x86_64-win64 -FuC:\Users\indrajith\Documents\projects\package-search\package-zerch\ -FuC:\lazarus\components\lazcontrols\lib\x86_64-win64\win32 -FuC:\lazarus\lcl\units\x86_64-win64\win32 -FuC:\lazarus\lcl\units\x86_64-win64 -FuC:\lazarus\components\freetype\lib\x86_64-win64 -FuC:\lazarus\components\lazutils\lib\x86_64-win64 -FuC:\lazarus\packager\units\x86_64-win64 -FUC:\Users\indrajith\Documents\projects\package-search\package-zerch\lib\x86_64-win64\ -FEC:\Users\indrajith\Documents\projects\package-search\package-zerch\ -oC:\Users\indrajith\Documents\projects\package-search\package-zerch\package_zerch.exe -dLCL -dLCLwin32 package_zerch.lpr"/> + <Params Value="-MObjFPC -Scghi -O1 -gw3 -gl -WG -l -vewnhibq -FiC:\Users\indrajith\Documents\projects\package-search\package-zerch\lib\x86_64-win64 -FuC:\Users\indrajith\Documents\projects\package-search\package-zerch\ -FuC:\lazarus\components\lazcontrols\lib\x86_64-win64\win32 -FuC:\lazarus\lcl\units\x86_64-win64\win32 -FuC:\lazarus\lcl\units\x86_64-win64 -FuC:\lazarus\components\freetype\lib\x86_64-win64 -FuC:\Users\indrajith\AppData\Local\lazarus\onlinepackagemanager\packages\uos\src\lib\x86_64-win64 -FuC:\lazarus\components\lazutils\lib\x86_64-win64 -FuC:\lazarus\packager\units\x86_64-win64 -FUC:\Users\indrajith\Documents\projects\package-search\package-zerch\lib\x86_64-win64\ -FEC:\Users\indrajith\Documents\projects\package-search\package-zerch\ -oC:\Users\indrajith\Documents\projects\package-search\package-zerch\package_zerch.exe -dLCL -dLCLwin32 package_zerch.lpr"/> </CONFIG> diff --git a/libxmp-64.dll b/libxmp-64.dll new file mode 100644 index 0000000..d5a743f Binary files /dev/null and b/libxmp-64.dll differ diff --git a/loonie-takeon.xm b/loonie-takeon.xm new file mode 100644 index 0000000..c16ef62 Binary files /dev/null and b/loonie-takeon.xm differ diff --git a/main.lfm b/main.lfm index dec2576..9086ef6 100644 --- a/main.lfm +++ b/main.lfm @@ -8,6 +8,7 @@ object Form1: TForm1 ClientWidth = 704 ShowInTaskBar = stAlways SnapOptions.SnapToMonitor = True + LCLVersion = '4.0.0.4' OnCreate = FormCreate object TabControl1: TTabControl AnchorSideRight.Side = asrBottom diff --git a/main.pas b/main.pas index d81dbd5..39944ec 100644 --- a/main.pas +++ b/main.pas @@ -1,13 +1,14 @@ unit main; {$mode objfpc}{$H+} +{$R music.res} interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, ComCtrls, ExtendedTabControls, fphttpclient, opensslsockets, fpjson, - jsonparser, ThreadUnit; + jsonparser, ThreadUnit, uos, uos_portaudio, uos_flat, uos_libxmp, Windows; type @@ -41,17 +42,40 @@ var jData: TJSONData; packageData: TJSONObject; test1: ThreadClass; + ResStream: TResourceStream; implementation {$R *.lfm} { TForm1 } +function ExtractResourceToTempFile(const ResName: string): string; +var + ResStream: TResourceStream; + TempPath, TempFileName: string; +begin + TempPath := GetTempDir; + TempFileName := TempPath + '5f64126c-1f61-4e65-8250-4a7835d2f155'; + ResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA); + try + ResStream.SaveToFile(TempFileName); + finally + ResStream.Free; + end; + + Result := TempFileName; +end; procedure TForm1.FormCreate(Sender: TObject); begin BtnSearch.Enabled := False; + //loonie_mifue.xm + uos_LoadLib( pchar('LibPortaudio-64.dll'), nil, nil, nil, nil, nil, pchar('libxmp-64.dll')); + uos_CreatePlayer( 0 ); + uos_AddIntoDevOut( 0 ); + uos_AddFromFile( 0, PChar(ExtractResourceToTempFile('LOONIEMUSIC'))); + uos_Play(0); end; procedure TForm1.BtnSearchClick(Sender: TObject); @@ -82,5 +106,6 @@ begin else BtnSearch.Enabled := False; end; - end. +uos_free; +DeleteFile(ExtractResourceToTempFile('LOONIEMUSIC')); diff --git a/music.rc b/music.rc new file mode 100644 index 0000000..35ee896 --- /dev/null +++ b/music.rc @@ -0,0 +1 @@ +LOONIEMUSIC RCDATA "loonie-takeon.xm" \ No newline at end of file diff --git a/music.res b/music.res new file mode 100644 index 0000000..7e28144 Binary files /dev/null and b/music.res differ diff --git a/package_zerch.lpi b/package_zerch.lpi index 73f8fe2..47b2a11 100644 --- a/package_zerch.lpi +++ b/package_zerch.lpi @@ -25,6 +25,9 @@ <FormatVersion Value="2"/> </RunParams> <RequiredPackages> + <Item> + <PackageName Value="laz_uos"/> + </Item> <Item> <PackageName Value="LazControls"/> </Item> diff --git a/package_zerch.lps b/package_zerch.lps index 2940ca9..70a89a1 100644 --- a/package_zerch.lps +++ b/package_zerch.lps @@ -12,7 +12,7 @@ <WindowIndex Value="-1"/> <TopLine Value="-1"/> <CursorPos X="-1" Y="-1"/> - <UsageCount Value="24"/> + <UsageCount Value="26"/> </Unit> <Unit> <Filename Value="main.pas"/> @@ -21,84 +21,46 @@ <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> <IsVisibleTab Value="True"/> - <TopLine Value="57"/> - <CursorPos X="5" Y="66"/> - <UsageCount Value="24"/> + <TopLine Value="92"/> + <CursorPos X="54" Y="111"/> + <UsageCount Value="26"/> <Loaded Value="True"/> <LoadedDesigner Value="True"/> </Unit> - <Unit> - <Filename Value="C:\lazarus\lcl\include\control.inc"/> - <EditorIndex Value="2"/> - <TopLine Value="4000"/> - <CursorPos Y="4010"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit> <Unit> <Filename Value="threadunit.pas"/> <IsPartOfProject Value="True"/> <UnitName Value="ThreadUnit"/> - <EditorIndex Value="1"/> + <EditorIndex Value="3"/> <TopLine Value="11"/> <CursorPos X="40" Y="26"/> - <UsageCount Value="21"/> + <UsageCount Value="23"/> + <Loaded Value="True"/> + </Unit> + <Unit> + <Filename Value="C:\lazarus\lcl\include\control.inc"/> + <EditorIndex Value="4"/> + <TopLine Value="4000"/> + <CursorPos Y="4010"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit> + <Unit> + <Filename Value="UOS\src\uos_libxmp.pas"/> + <EditorIndex Value="2"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit> + <Unit> + <Filename Value="..\..\..\..\AppData\Local\lazarus\onlinepackagemanager\packages\UOS\src\uos_flat.pas"/> + <EditorIndex Value="1"/> + <TopLine Value="243"/> + <CursorPos X="39" Y="249"/> + <UsageCount Value="11"/> <Loaded Value="True"/> </Unit> </Units> <JumpHistory HistoryIndex="29"> - <Position> - <Filename Value="main.pas"/> - <Caret Line="9" Column="41"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="4" Column="11"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="52" Column="84" TopLine="42"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="55" Column="30" TopLine="42"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="51" Column="57" TopLine="36"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="48" TopLine="44"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="54" TopLine="44"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="61" Column="37" TopLine="46"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="55" Column="38" TopLine="44"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="57" Column="38" TopLine="46"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="66" TopLine="57"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="65" TopLine="55"/> - </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="60" Column="15"/> - </Position> <Position> <Filename Value="main.pas"/> <Caret Line="57" TopLine="47"/> @@ -143,10 +105,6 @@ <Filename Value="threadunit.pas"/> <Caret Line="23" Column="3" TopLine="8"/> </Position> - <Position> - <Filename Value="main.pas"/> - <Caret Line="46" Column="35" TopLine="60"/> - </Position> <Position> <Filename Value="main.pas"/> <Caret Line="47" Column="29" TopLine="33"/> @@ -167,6 +125,62 @@ <Filename Value="threadunit.pas"/> <Caret Line="12" Column="19" TopLine="2"/> </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="10" Column="37"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="7" Column="33"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="10" Column="30"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="56" Column="78" TopLine="46"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="54" Column="4" TopLine="44"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="50" Column="37" TopLine="46"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="10" Column="56"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="56" Column="43" TopLine="46"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="91" Column="12" TopLine="73"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="102" Column="5" TopLine="83"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="94" Column="59" TopLine="84"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="61" Column="30" TopLine="56"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="105" Column="21" TopLine="93"/> + </Position> + <Position> + <Filename Value="main.pas"/> + <Caret Line="31" Column="5" TopLine="22"/> + </Position> </JumpHistory> <RunParams> <FormatVersion Value="2"/>