Skip to content

Commit

Permalink
Added mp3 audio files decoding and analysing. Added library mpg123 fo…
Browse files Browse the repository at this point in the history
…r each OS. (3)
  • Loading branch information
fredvs committed Feb 19, 2021
1 parent b045d8c commit 07d0c7e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 101 deletions.
18 changes: 9 additions & 9 deletions src/ini/stat.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ value=1
[mainfo.average]
value=0
[mainfo.viewfile]
value=1
value=0
[mainfo.viewinput]
value=0
[mainfo.viewwave]
value=0
[mainfo.viewnoise]
value=0
value=1
[mainfo.viewpiano]
value=0
[mainfo.tenvelopeedit1]
Expand Down Expand Up @@ -81,12 +81,12 @@ value=0.17808219178082
[mainfo.linkfilechan]
value=1
[mainfo.sliderfileR]
value=0.75308641975309
value=0.28395061728395
[mainfo.sliderfile]
value=0.75308641975309
value=0.28395061728395
[mainfo.tfilenameeditx1]
filenames=1
/home/fred/Music/mp3/11 inch/Grace Jones - Slave to The Rhythm Remix (12in).mp3
sound/test.ogg
filenamescust=0
filecolwidth=174
x=0
Expand All @@ -103,12 +103,12 @@ colextwidth=45
coldatewidth=119
splitterplaces=242
splitterlateral=126
lastdir=/home/fred/Music/mp3/11 inch/
lastdir=sound/
filehistory=5
/home/fred/Music/mp3/11 inch/Grace Jones - Slave to The Rhythm Remix (12in).mp3
/home/fred/WavvieW/src/sound/Sine_wave_440_stereo.ogg
/home/fred/WavvieW/src/sound/Sine_wave_440_mono.ogg
/home/fred/WavvieW/src/sound/test.ogg
/home/fred/WavvieW/src/sound/Sine_wave_440_mono.ogg
/home/fred/WavvieW/src/sound/Sine_wave_440_stereo.ogg
/home/fred/Music/mp3/11 inch/Grace Jones - Slave to The Rhythm Remix (12in).mp3
/home/fred/Music/mp3/11 inch/Anita Ward - ring my bell (disco version).mp3
filefilterindex=0
filefilter="*.wav" "*.ogg" "*.flac" "*.mp3" "*.WAV" "*.OGG" "*.FLAC" "*.MP3"
Expand Down
11 changes: 4 additions & 7 deletions src/main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,8 @@ procedure tmainfo.oncreated(const Sender: TObject);
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';

fftw_init(ordir + 'lib\Windows\64bit\');

{$else}
{$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';
Expand All @@ -385,22 +383,21 @@ procedure tmainfo.oncreated(const Sender: TObject);
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';

fftw_init(ordir + 'lib/Linux/32bit/');
{$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';
fftw_init(ordir + 'lib/Linux/aarch64_raspberrypi/');
fftw_init(ordir + 'lib/Linux/aarch64_raspberrypi/');
{$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';
fftw_init(ordir + 'lib/Linux/arm_raspberrypi/');
fftw_init(ordir + 'lib/Linux/arm_raspberrypi/');
{$ENDIF}

{$IFDEF freebsd}
Expand Down Expand Up @@ -516,7 +513,7 @@ procedure tmainfo.onnoiseactivate(const Sender: TObject; var avalue: Boolean; va

procedure tmainfo.onpianoactivate(const Sender: TObject; var avalue: Boolean; var accept: Boolean);
begin
//application.processmessages;
//application.processmessages;
if hasinit then
if avalue then
begin
Expand Down
16 changes: 8 additions & 8 deletions src/uos_msesigaudio.pas
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ procedure convert2432swap(var info: convertinfoty);

function tsigaudioout.threadproc(Sender: tmsethread): integer;
var
int1, i, encoding: integer;
int1, i, encoding, mpchan: integer;
datasize1, blocksize1, bufferlength1, valuehigh1: integer;
controller1: tsigcontroller;
mpsamplefrequ: longword;
Expand Down Expand Up @@ -388,13 +388,13 @@ function tsigaudioout.threadproc(Sender: tmsethread): integer;
else
begin
HandleMP := mpg123_new(nil, Err);
writeln('err mp3 ' + IntToStr(err));
//writeln('err mp3 ' + IntToStr(err));
if Err = 0 then
begin
mpg123_format_none(HandleMP);
mpg123_format(HandleMP, 44100, 2, MPG123_ENC_FLOAT_32);
mpg123_open(HandleMP, PChar(controller1.SoundFilename));
// mpg123_getformat(HandleMP, mpsamplefrequ, controller1.channels, encoding);
//mpg123_getformat(HandleMP, mpsamplefrequ, mpchan, encoding);

controller1.channels := 2;
controller1.samplefrequ := 44100;
Expand Down Expand Up @@ -618,17 +618,17 @@ function tsigaudioout.threadproc(Sender: tmsethread): integer;
info.dest := Pointer(fbuffer);
convert(info);

if controller1.initbuf < 16 then
// {
if controller1.initbuf < 2 then
if (controller1.inputtype = 0) then
for i := 0 to length(fbuffer) - 1 do
fbuffer[i] := 0
//round(fbuffer[i] * controller1.initbuf / 20)
else
for i := 0 to length(fbuffer2) - 1 do
fbuffer2[i] := 0.0// fbuffer2[i] * controller1.initbuf / 20 ;
;
fbuffer2[i] := 0.0;
// }

if controller1.initbuf < 20 then
if controller1.initbuf < 2 then
Inc(controller1.initbuf);

finally
Expand Down
107 changes: 30 additions & 77 deletions src/wavview.prj
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,9 @@ settingsstorage=0
settingsprojecttree=0
settingsautoload=0
settingsautosave=0
modulenames=1
MAINFO
moduletypes=1
TMAINFO
modulefiles=1
/home/fred/WavvieW/src/main.mfm
modulenames=0
moduletypes=0
modulefiles=0
befcommandon=0
makeoptionson=6
4095
Expand Down Expand Up @@ -832,8 +829,9 @@ envvarons=0
[edit]
hintwidth=0
hintheight=0
finddtext=mpg123_
finddtext=created
findhistory=20
created
mpg123_
mpg123_init
addfromfile
Expand All @@ -853,21 +851,17 @@ findhistory=20
PInteger
pinteger
dest
inputtype
findoptions=1
editpos=12
editpos=9
0,-1073741823
0,628
0,-1073741823
0,-1073741823
0,-1073741823
4,5
0,-1073741823
0,-1073741823
0,-1073741823
0,13
0,584
0,-1073741823
0,-1073741823
0,-1073741823
0,9
bookmarks0=0
bookmarks1=0
bookmarks2=0
Expand All @@ -877,10 +871,7 @@ bookmarks5=0
bookmarks6=0
bookmarks7=0
bookmarks8=0
bookmarks9=0
bookmarks10=0
bookmarks11=0
sourcefiles=12
sourcefiles=9
${PROJECTDIR}/uos_mseaudio.pas
${PROJECTDIR}/uos_msesigaudio.pas
${PROJECTDIR}/msesignal.pas
Expand All @@ -890,10 +881,7 @@ sourcefiles=12
/home/fred/uos.pas
${PROJECTDIR}/uos_mpg123.pas
${PROJECTDIR}/uos_libsndfile.pas
${PROJECTDIR}/main.pas
/home/fred/uos/examples/simpleplayer_fpGUI.pas
/home/fred/WavvieW_14 (copie 1)/src/uos_msesigaudio.pas
relpaths=12
relpaths=9
uos_mseaudio.pas
uos_msesigaudio.pas
msesignal.pas
Expand All @@ -903,13 +891,7 @@ relpaths=12
uos.pas
uos_mpg123.pas
uos_libsndfile.pas
main.pas
uos/examples/simpleplayer_fpGUI.pas
WavvieW_14 (copie 1)/src/uos_msesigaudio.pas
ismoduletexts=12
0
0
0
ismoduletexts=9
0
0
0
Expand All @@ -919,16 +901,12 @@ ismoduletexts=12
0
0
0
modules=1
/home/fred/WavvieW/src/main.mfm
moduleoptions=1
0
visiblemodules=1
-1
nomenumodules=1
0
modules=0
moduleoptions=0
visiblemodules=0
nomenumodules=0
[sourcefo.files_tab]
order=12
order=9
0
1
2
Expand All @@ -938,13 +916,10 @@ order=12
6
7
8
10
11
9
firsttab=0
index=3
firsttab=1
index=8
[layout]
windowlayout=597
windowlayout=575
[mainfo.basedock]
splitdir=2
useroptions=268450944
Expand Down Expand Up @@ -996,13 +971,13 @@ windowlayout=597
ncy=0
x=444
y=431
cx=418
cx=907
cy=126
rcx=0
rcy=0
wsize=0
active=0
visible=0
visible=1
[memoryfo]
splitdir=0
useroptions=268451963
Expand Down Expand Up @@ -1102,13 +1077,13 @@ windowlayout=597
ncy=0
x=423
y=321
cx=344
cx=712
cy=155
rcx=0
rcy=0
wsize=0
active=0
visible=0
visible=1
[watchpointsfo]
splitdir=0
useroptions=268451945
Expand Down Expand Up @@ -1425,8 +1400,10 @@ windowlayout=597
[debuggerfo.edit_compiler]
value=Pascal
[debuggerfo.file_history]
value=/home/fred/WavvieW/src/main.pas
value=/home/fred/uos/examples/simpleplayer_fpGUI.pas
history=20
/home/fred/WavvieW/src/main.pas
/home/fred/WavvieW/src/uos_portaudio.pas
/home/fred/WavvieW/src/uos_libsndfile.pas
/home/fred/uos.pas
/home/fred/uos/examples/simpleplayer_fpGUI.pas
Expand All @@ -1437,9 +1414,7 @@ windowlayout=597
/home/fred/uossawtooth/src/uos.pas
/home/fred/uossawtooth/src/uos_cdrom.pas
/home/fred/WavvieW_14 (copie 1)/src/uos_msesigaudio.pas
/home/fred/WavvieW/src/uos_portaudio.pas
/home/fred/WavvieW/src/msesigfftgui.pas
/home/fred/WavvieW/src/main.pas
/home/fred/WavvieW/src/about.pas
/home/fred/WavvieW/src/msefftw.pas
/home/fred/WavvieW/src/uos_msefftw.pas
Expand Down Expand Up @@ -1468,7 +1443,7 @@ windowlayout=597
rcx=0
rcy=0
[sourcefo.files_tab]
order=12
order=9
0
1
2
Expand All @@ -1478,11 +1453,8 @@ windowlayout=597
6
7
8
10
11
9
firsttab=0
index=3
firsttab=1
index=8
[confideufo.fontname]
value=stf_default
[confideufo.usedefaulteditoroptions]
Expand Down Expand Up @@ -1523,25 +1495,6 @@ windowlayout=597
cy=517
rcx=0
rcy=0
[_mse_mainfo_mse_]
splitdir=0
useroptions=268451963
stackedunder=mainfo
parent=
mdistate=3
nx=0
ny=0
ncx=0
ncy=0
x=160
y=76
cx=1034
cy=600
rcx=0
rcy=0
wsize=0
active=0
visible=1
[targetconsole]
finddtext=
findhistory=0
Expand Down

0 comments on commit 07d0c7e

Please sign in to comment.