Recent

Author Topic: PortAudio for Lazarus ?  (Read 21995 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3619
    • StrumPract is the musicians best friend
PortAudio for Lazarus ?
« on: July 10, 2012, 12:56:38 am »
Hello everybody.
I try to use the PortAudio library with Lazarus but... i can not do it working  :-[
PortAudio : http://www.portaudio.com/
is a audio multi-platform audio library used by the famous and excellent Audacity software.

I find also a Delphi-Pascal wraper with Windows exe examples , you can download it here :
https://sites.google.com/site/fiensprototyping/delphi_portaudio.tar.gz.

Somebody had more luck than me with PortAudio for Lazarus ?

Thanks

I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3619
    • StrumPract is the musicians best friend
Re: PortAudio for Lazarus ?
« Reply #1 on: July 10, 2012, 01:30:35 am »
Re-hello everybody.

I have find a demo-Lazarus test of PortAudio but, also no luck, after compilation, the progs crash when running ...  :'(

https://sites.google.com/site/fiensprototyping/PortMediaTest_11.zip
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Leledumbo

  • Hero Member
  • *****
  • Posts: 8817
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: PortAudio for Lazarus ?
« Reply #2 on: July 10, 2012, 09:28:05 am »

Fred vS

  • Hero Member
  • *****
  • Posts: 3619
    • StrumPract is the musicians best friend
Re: PortAudio for Lazarus ?
« Reply #3 on: July 10, 2012, 02:41:24 pm »
@ Leledumbo : many thanks for the answer and the link  :P

But... I try to compile it and get, with FPC 2.4.2, Lazarus 0.9.30 on Ubuntu 11.10 :

Quote
fred@fred-AO533:~/portaudio$ fpcmake
Processing Makefile.fpc
Error: Target "linux", package "rtl" not found.

and with FPC 2.4.2, Lazarus 0.9.30 on Windows 7 :

Quote
C:\portaudio>fpcmake
Processing Makefile.fpc
Error: Target "win64", package "rtl" not found.

 :'(

I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Leledumbo

  • Hero Member
  • *****
  • Posts: 8817
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: PortAudio for Lazarus ?
« Reply #4 on: July 10, 2012, 04:28:01 pm »
See the bottom of this page

mica

  • Full Member
  • ***
  • Posts: 196
Re: PortAudio for Lazarus ?
« Reply #5 on: July 10, 2012, 06:18:19 pm »

Fred vS

  • Hero Member
  • *****
  • Posts: 3619
    • StrumPract is the musicians best friend
Re: PortAudio for Lazarus ?
« Reply #6 on: July 10, 2012, 06:27:39 pm »
@ Leledumbo :

Quote
If you regenerate makefiles outside the fpc/ SVN tree, (e.g. for lazarus in projects), and fpcmake complains it can't find package.fpc for the RTL package, try setting the environment variable FPCDIR to the fpc source directory fpc/:

(bash/sh) export FPCDIR=/location/to/fpc

(dos/windows/OS/2) set FPCDIR=c:\location\to\fpc

Perdona senhor, no comprendo, me not understand  :-[

@ Mica, thanks for the link but i already have try all of the examples and all compile but also all crash when running (see first topic).  :'(
« Last Edit: July 10, 2012, 06:30:43 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: PortAudio for Lazarus ?
« Reply #7 on: July 10, 2012, 06:49:15 pm »
Fred, geef 's wat voorbeelden van die code die faalt dan. Hoe "crasht" die code dan?
Alleen maar zeggen dat het niet werkt helpt niet veel.
Zie
http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F
Als je het nog niet gedaan hebt, vermeld ook svp je besturingssysteem en versie, versie van Lazarus, FPC...

Leledumbo probeert uit te leggen hoe je fpcmake moet gebruiken. Als je het niet snapt... moet je zeggen wat je precies niet snapt, anders schieten we weinig op.
Weet je wat een environment variabele is? Die moet je instellen zodat hij naar de directory wijst waar FPC zit, bijv in Windows SET FPCDIR=C:\development\fpc op de command line.
Maar geen idee of je fpcmake moet gebruiken - heb verder niet in die links of de source van die portaudio units gekeken.

Groeten,
BigChimp

Edit: Dutch post that basically asks for more details about what is going wrong with Fred's code and what he doesn't understand exactly.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Fred vS

  • Hero Member
  • *****
  • Posts: 3619
    • StrumPract is the musicians best friend
Re: PortAudio for Lazarus ?
« Reply #8 on: July 10, 2012, 07:34:13 pm »
@ BigChimp :

Quote
SET FPCDIR=C:\development\fpc op de command line.


OK, i see, begrepen, compris, comprendo, 私が理解し, verstand, komprenis, megértettem, Κατάλαβα, entendi, Я понял, capito, 我的理解, .

My complain was not against Leledumbo but against the explanation in the Lazarus-help doc (i do not find it very clear.)  :-[

The crash is difficult to explain, even with debugger no explanation, only a error message...

By the way, how do you set environment variable with Linux ?

PS: My systems :

Ubuntu 11.10 : with FPC 2.4.2, Lazarus 0.9.30.

Windows 7 : with FPC 2.4.2, Lazarus 0.9.30.

Mac osX Snow Leopard : with FPC 2.4.2, Lazarus 0.9.30.

Thanks


« Last Edit: July 10, 2012, 07:57:55 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: PortAudio for Lazarus ?
« Reply #9 on: July 10, 2012, 08:35:45 pm »
The crash is difficult to explain, even with debugger no explanation, only a error message...
I was going to ask: and where does that error message occur? In what line of code?... but never mind... as I'm assuming you're trying to use Leledumbo's link...

By the way, how do you set environment variable with Linux ?
Have a look at the wiki page Leledumbo linked to; I formatted it a bit and I hope it's now clearer:
http://wiki.freepascal.org/Fpcmake

PS: My systems :

Ubuntu 11.10 : with FPC 2.4.2, Lazarus 0.9.30.

Windows 7 : with FPC 2.4.2, Lazarus 0.9.30.

Mac osX Snow Leopard : with FPC 2.4.2, Lazarus 0.9.30.
Thanks!
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Fred vS

  • Hero Member
  • *****
  • Posts: 3619
    • StrumPract is the musicians best friend
Re: PortAudio for Lazarus ?
« Reply #10 on: July 10, 2012, 08:58:00 pm »
Hello folks.

Ok, i nearly get it...

1) Setting environment variable : (under linux) :

Quote
fred@fred-AO533:/usr/lib/fpc/2.4.2$ export FPCDIR=/usr/lib/fpc/2.4.2
.

OK, done  ::).

2) Next compiling portaudio :
In readme.txt of portaudio :
Quote
Compilation & Installation:
To compile and run the main unit and some simple tests, just do

$ fpcmake
$ make clean all
$ ./testpasine

So i begin with :

Quote
fred@fred-AO533:~/portaudio$ fpcmake


OK, done but a warning at the begin  %) :

Quote
Processing Makefile.fpc
 x86_64-linux requires: rtl
 Writing Makefile

3) Make clean all :

Quote
fred@fred-AO533:~/portaudio2$ make clean all

OK, perfect, done  ::)

4) And finally running the compiled test program :

Quote
fred@fred-AO533:~/portaudio2$ ./testpasine

And here, bad news, i get that message :

Quote
PortAudio Test: Output Sine wave. SR = 44100, Buffer size = 64
An unhandled exception occurred at $000000000040AF10 :
EAccessViolation : Access violation
  $000000000040AF10

 :'(  :'(  :'(

« Last Edit: July 10, 2012, 09:01:18 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Leledumbo

  • Hero Member
  • *****
  • Posts: 8817
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: PortAudio for Lazarus ?
« Reply #11 on: July 11, 2012, 06:47:06 am »
Quote
OK, done but a warning at the begin
That's not a warning, but output of fpcmake saying the target requires rtl package.
Quote
And here, bad news, i get that message :
try:

make clean all OPT='-gl'

and re-run the program, post the output here.

BlueIcaro

  • Hero Member
  • *****
  • Posts: 820
    • Blog personal
Re: PortAudio for Lazarus ?
« Reply #12 on: July 11, 2012, 08:01:09 am »
Quote
And here, bad news, i get that message :

Quote

    PortAudio Test: Output Sine wave. SR = 44100, Buffer size = 64
    An unhandled exception occurred at $000000000040AF10 :
    EAccessViolation : Access violation
      $000000000040AF10

Try to execute your program step by step, using F8 for example, and find in with line is the error.

/BlueIcaro

Fred vS

  • Hero Member
  • *****
  • Posts: 3619
    • StrumPract is the musicians best friend
Re: PortAudio for Lazarus ?
« Reply #13 on: July 11, 2012, 11:57:52 am »
@ Leledumbo : thanks  :P

After make clean all OPT='-gl'
and re-run the program :

Quote
fred@fred-AO533:~/portaudio3$ ./testpasine
PortAudio Test: Output Sine wave. SR = 44100, Buffer size = 64
An unhandled exception occurred at $000000000040B6A0 :
EAccessViolation : Access violation
  $000000000040B6A0 line 182 of testpasine.pas

and in testpasine.pas line 182 is :

Code: [Select]
OutputParameters.SuggestedLatency :=
    (Pa_GetDeviceInfo(OutputParameters.device)^.defaultHighOutputLatency)*1;         

 :-[

Other think : if i do ./configure in the original portaudio source at the end i get that message :

Quote
Configuration summary:

  Target ...................... x86_64-unknown-linux-gnu
  C++ bindings ................ no
  Debug output ................ no

  ALSA ........................ no
  ASIHPI ...................... no

  OSS ......................... yes
  JACK ........................ no

But i do not use OSS, i use ALSA !

Is that normal ?
« Last Edit: July 11, 2012, 12:03:07 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Leledumbo

  • Hero Member
  • *****
  • Posts: 8817
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: PortAudio for Lazarus ?
« Reply #14 on: July 11, 2012, 12:52:18 pm »
Quote
OutputParameters.SuggestedLatency :=
    (Pa_GetDeviceInfo(OutputParameters.device)^.defaultHighOutputLatency)*1;         
The chances are:
  • OutputParameters is nil
  • Pa_GetDeviceInfo returns nil
My guess is the 2nd one. Try outputting the result of Pa_GetDeviceCount first, it should be > 0 if OK, or < 0 if there's a problem. In case of errors, pass the return value to Pa_GetErrorText and output the text.
Quote
But i do not use OSS, i use ALSA !

Is that normal ?
Yes, perhaps you only have development libraries for OSS, the others (including ALSA that you use) only runtime libraries. Try installing libasound-dev.
« Last Edit: July 11, 2012, 12:56:48 pm by Leledumbo »

 

TinyPortal © 2005-2018