PortAudio for PB

Share your advanced PureBasic knowledge/code with the community.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: PortAudio for PB

Post by Joris »

Hi Chris,

I get an Error on line 885 :
Invalid memory acces (read error at address 4208344608)

The line is showing :
DisableDebugger

So I don't think the problem lies there, but ... I'm a beginner in PB.
(Win XP 32 bit SP3)
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

Try commenting that line out (you can turn off the debugger manually).

Let me know if you still have problems (works for me under Windows 7).
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: PortAudio for PB

Post by Joris »

I disabled the debugger manually, but now I get the Error :
PureBasic_Compiler4.exe in the MS-error message window which does popup if a programm crashes.
(I tried to add the image of that window I made but don't know how to do this on this forum.)
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

I suggest familiarizing yourself with the debugger and set breakpoints to see where the crash occurs. For that you will need to have the debugger enabled.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: PortAudio for PB

Post by Joris »

I hope this is what you need, otherwise ask some more experienced PB user.
I'm really a PB beginner and still busy on learning the graphics part, so...

[22:05:55] Waiting for executable to start...
[22:05:55] Executable type: Windows - x86 (32bit)
[22:05:55] Executable started.
[22:05:56] [ERROR] Pa Ringbuffer Demo with PortAudio.Pb (Line: 885)
[22:05:56] [ERROR] Invalid memory access. (read error at address 4208344608)
[22:06:01] The Program was killed.
[22:06:28] Waiting for executable to start...
[22:06:28] Executable type: Windows - x86 (32bit)
[22:06:28] Executable started.
[22:06:28] [ERROR] Pa Ringbuffer Demo with PortAudio.Pb (Line: 885)
[22:06:28] [ERROR] Invalid memory access. (read error at address 4208344608)
[22:06:53] The Program was killed.

(It is just because this PortAudio topic is 'hot', and I'm interested in that too, I also try things out, written here.)
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

First we have to isolate the code that is giving the error. Did you turn the debugger back on?

Try commenting out this code using CTRL-B (select the lines with your mouse or keyboard first):

Code: Select all

    DisableDebugger

    If OSVersion() < 1000 ;WINDOWS
      slash$ = "\"
      NO_DRAG_Y = -22
    Else
      slash$ = "/" ;MAC AND LINUX
      NO_DRAG_Y = 68
    EndIf
CTRL-B will put a semicolon before each line. ALT-B will remove them. After that block of code enter:

At line 901 put this code:

Code: Select all

slash$ = "\"
NO_DRAG_Y = 0
h: Delay(10): goto h
This creates an infinite loop with a 10 ms delay. Does it still fail? Move this line forward step by step until you have found the offending code.

How much memory does your machine have? Do you have other applications open which could be using too much memory?
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: PortAudio for PB

Post by Joris »

I had set the Debugger back on.
Also tested with the source at your latest link with which I get this errors :

[08:38:21] Waiting for executable to start...
[08:38:21] Executable type: Windows - x86 (32bit)
[08:38:21] Executable started.
[08:38:21] [ERROR] PortAudio device enumeration program.pb (Line: 23)
[08:38:21] [ERROR] Invalid memory access. (read error at address 4208344608)
[08:38:33] The Program was killed.

The program stop with a 'Dos box' titled 'C:\Documents and Settings\Default User\...\PureBasic_Compiler0.exe' whatever that may mean ???
I placed those :
slash$ = "\"
NO_DRAG_Y = 0
h: Delay(10): goto h

at line 901, no better result (to me it looks exactly the same as before.)
I hope some more experienced PB user (on Win XP 32) will help us.

Chris I think there is something missing in those sources :
the portaudio_x86.DLL is nowhere mentioned and so how would it be called then ?
Or should it be placed in the system or system32 map ?

A bit late I saw the rest :
3 GB memory and I had some other prog's open too... (text editor, PDF reader, html-help)
Busy with other things, so I'll probabbly have to restart all these test's without 'anything' running ?

"This creates an infinite loop with a 10 ms delay."
Realy, it doesn't seem to do anything ? Everything runs exactly like in the test's before.
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

"This creates an infinite loop with a 10 ms delay."
Realy, it doesn't seem to do anything ?
Joris, first you have to understand what I said: it creates an infinite loop with a 10 ms delay. It is not SUPPOSED to do anything more than this.
Chris I think there is something missing in those sources :
the portaudio_x86.DLL is nowhere mentioned and so how would it be called then ?
Or should it be placed in the system or system32 map ?
There it is right there on line 369 of portaudio.pb

Code: Select all

ImportC "portaudio_x86.lib"
I can't debug your program for you. All I can tell you is that it all works for me.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: PortAudio for PB

Post by Joris »

chris319 wrote:There it is right there on line 369 of portaudio.pb

Code: Select all

ImportC "portaudio_x86.lib"
Hi Chris,
I checked that line and filled in the right path to that file portaudio_x86.lib.
It should be loaded now but the error is "Native types can't be used with pointers" on this *name.b in :
Structure PaHostApiInfo
structVersion.l
type.l
*name.b
deviceCount.l
defaultInputDevice.l
defaultOutputDevice.l
EndStructure
I'm sorry but I don't know what is going on there.
(I better spend some time later on this, as being busy with other things and can't concentrate very well.)
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: PortAudio for PB

Post by yrreti »

Joris, do a forum search for pointers, and it will tell you what you need to do.
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: PortAudio for PB

Post by luis »

Joris wrote: It should be loaded now but the error is "Native types can't be used with pointers" on this *name.b in :
just change *name.b to *name

http://www.purebasic.fr/english/viewtop ... 11#p398511

a colorful discussions about this -> http://www.purebasic.fr/english/viewtopic.php?p=401157
"Have you tried turning it off and on again ?"
A little PureBasic review
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: PortAudio for PB

Post by Joris »

luis wrote:just change *name.b to *name
Did that just for a quick test but ... no change guys.

But still it's all in a rush :
Joris wrote:(I better spend some time later on this, as being busy with other things and can't concentrate very well.)
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

PortAudio.pb has been updated due to recent changes to PureBasic. The updated version can be found here:

http://www.purebasic.fr/english/viewtop ... 15#p319515

Joris, if you're still following this thread, please replace your copy of PortAudio.pb with the updated version linked to above. It should get rid of the "Native types can't be used with pointers" errors you were having.

Also, Joris, is the PortAudio.pb file in the same folder as your source .pb file? I don't *think* you should have to add the path to PortAudio.pb if it is.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: PortAudio for PB

Post by Joris »

I have subscribed to this topic chris319, so I do follow and read it, but still busy with other things which must be finished before I pick up again with portaudio.

Thanks.
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
Post Reply