PortAudio for PB

Share your advanced PureBasic knowledge/code with the community.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PortAudio for PB

Post by Fred »

There is no more Misc2 library, the user lib you try to use is too old.
User avatar
Blue Steel
Enthusiast
Enthusiast
Posts: 132
Joined: Wed Aug 31, 2005 4:49 pm
Contact:

Re: PortAudio for PB

Post by Blue Steel »

Thanks.. i've now found the newer release of his library
Currently using PureBasic 4.51(x86)

Image http://www.codingmonkeys.com
Covers many languages including PureBasic
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

I wrote a lightweight recording program using PortAudio which I haven't touched since May 2008. It writes the audio data directly to a RAM buffer which the user then saves to disk. I can dust off the cobwebs and make it available if there is one scintilla of interest in it.

I tried to compile PortAudio to a DLL as freak did but I am no expert on C compilers so I never had any success with it, and the people on the PortAudio mailing list were NOT helpful AT ALL! I'm glad to see it has been updated.
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Re: PortAudio for PB

Post by KarLKoX »

Here you can find my x86/x64 dll (vc2008 compiled) ready to be used with PB (included with my modified PB include with ASIO support).
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

KarLKoX wrote:Here you can find my x86/x64 dll (vc2008 compiled) ready to be used with PB (included with my modified PB include with ASIO support).
Very nice job of ASIO support. Any plans to implement WASAPI?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: PortAudio for PB

Post by Trond »

KarLKoX wrote:Here you can find my x86/x64 dll (vc2008 compiled) ready to be used with PB (included with my modified PB include with ASIO support).
How did you manage to get it so small?
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

Trond wrote:
KarLKoX wrote:Here you can find my x86/x64 dll (vc2008 compiled) ready to be used with PB (included with my modified PB include with ASIO support).
How did you manage to get it so small?
How did you manage to get portaudio to compile at all under Visual C++ 2008 Express Edition? It is a jumble of files and I can't get anything to compile without dozens of error messages.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: PortAudio for PB

Post by Trond »

chris319 wrote:
Trond wrote:
KarLKoX wrote:Here you can find my x86/x64 dll (vc2008 compiled) ready to be used with PB (included with my modified PB include with ASIO support).
How did you manage to get it so small?
How did you manage to get portaudio to compile at all under Visual C++ 2008 Express Edition? It is a jumble of files and I can't get anything to compile without dozens of error messages.
1. Extract portaudio_snapshot.tgz into a new directory.
2. Get the ASIO sdk from Steinberg and copy the entire ASIOSDK2 folder into portaudio\src\hostapi\asio\. Rename it from ASIOSDK2 to simply ASIOSDK
3. Open the file build\msvc\portaudio.sln with VC++ Express
4. Click "Finish" in the wizard.
5. Open Project -> Portaudio properties, select "configuration properties" in the treeview and then "all configurations" in the combobox above.
6. Set a few options:
C/C++ -> Optimizations -> Omit frame pointers = Yes
C/C++ -> Code Generations -> Struct member alignment = 1
C/C++ -> Code Generations -> Runtime library = /MT
C/C++ -> Code Generations -> Floating point model = fast
Click "Ok".
7. Select "Release" (instead of "Debug") in the main toolbar.
8. Build -> Build solution
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

Trond wrote:1. Extract portaudio_snapshot.tgz into a new directory.
2. Get the ASIO sdk from Steinberg and copy the entire ASIOSDK2 folder into portaudio\src\hostapi\asio\. Rename it from ASIOSDK2 to simply ASIOSDK
3. Open the file build\msvc\portaudio.sln with VC++ Express
4. Click "Finish" in the wizard.
5. Open Project -> Portaudio properties, select "configuration properties" in the treeview and then "all configurations" in the combobox above.
6. Set a few options:
C/C++ -> Optimizations -> Omit frame pointers = Yes
C/C++ -> Code Generations -> Struct member alignment = 1
C/C++ -> Code Generations -> Runtime library = /MT
C/C++ -> Code Generations -> Floating point model = fast
Click "Ok".
7. Select "Release" (instead of "Debug") in the main toolbar.
8. Build -> Build solution
Thank you very much for that. I also had to download the DirectX SDK to get dsound.h and dsconf.h which go in portaudio\include and dsound.lib which goes in C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

Still no joy with WASAPI:

Code: Select all

XIncludeFile "PortAudio.pb"

Pa_Initialize()

#NUM_API = 15
Dim api$(#NUM_API)

*my_api.PaHostApiInfo ;SET UP A STRUCTURE

For ct = 0 To #NUM_API - 1
  *my_api = Pa_GetHostApiInfo(ct)
  If *my_api > 0
    api$(ct) = PeekS(*my_api\name)
  EndIf

  If api$(ct) = "": api$(ct) = "Not supported": EndIf
  Debug(api$(ct) + "  " + Str(ct))
Next

Pa_Terminate()
Must be a PortAudio thing?

PortAudio.pb should be updated, adding a 14th API. Also note that MME is now 0, ASIO is now 2 and "skeleton implementation" is now 3.

Code: Select all

Enumeration ; PaHostApiTypeId
  #paMME=0
  #paWindowsDirectSound=1
  #paASIO=2
  #paSkeletonImplementation=3 ; /* use while developing support for a new host API */
  #paSoundManager=4
  #paCoreAudio=5
  #paOSS=7
  #paALSA=8
  #paAL=9
  #paBeOS=10
  #paWDMKS=11
  #paJACK=12
  #paWASAPI=13
  #paAudioScienceHPI=14
EndEnumeration
User avatar
oryaaaaa
Addict
Addict
Posts: 825
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Re: PortAudio for PB

Post by oryaaaaa »

I tried wasapi. but I can use Waveout and directSound only.
ASIO2 is sucesss setup, however it didn't sound.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

ASIO works fine here.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

There is now a version of PortAudio which supports WASAPI and works with PureBasic thanks to Dmitry Kostjuchenko, who works extensively with PortAudio. Send me a private message if you want the pertinent files.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: PortAudio for PB

Post by chris319 »

Update:

I have been working with Dmitry and he advises me that when compiling the dll and the lib, the following setting:

Code: Select all

C/C++ -> Code Generation -> Struct member alignment = 1
should be 4 bytes instead of 1.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: PortAudio for PB

Post by Trond »

chris319 wrote:Update:

I have been working with Dmitry and he advises me that when compiling the dll and the lib, the following setting:

Code: Select all

C/C++ -> Code Generation -> Struct member alignment = 1
should be 4 bytes instead of 1.
That will make the structs in the PB include file not work... I set it to 1 for a reason. You need to change the include file if you use 4.
Post Reply