Hey, Do anyone no how to use PortAudio on Mac OS X

Mac OSX specific forum
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Hey, Do anyone no how to use PortAudio on Mac OS X

Post by dman10001 »

Im using a demo for PortAudio and libportaudio.2.0.0.dylib with Purebasic version 5.44 Beta.

The problem or the error is : Bad parameter type, number expected instead of string.
and the code in ProcedureReturn PeekS(*info\name)


The code is :

Code: Select all

Procedure.s Pa_PaHostApiIndexToString(Ind)
  *info.PaHostApiInfo = Pa_GetHostApiInfo(Ind)
   ProcedureReturn PeekS(*info\name)
EndProcedure

Procedure.s DeviceString(*dev.PaDeviceInfo)
  ProcedureReturn PeekS(*dev\name) + " " + Pa_PaHostApiIndexToString(*dev\hostApi)
EndProcedure
Is there anyone who know how to use PortAudio and show a simple demo to play mp3 files ?

Thank You.
Last edited by dman10001 on Wed Nov 23, 2016 7:44 am, edited 1 time in total.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Hey, Do anyone no how to use PortAudio on Mac OS X

Post by wilbert »

I did use PortAudio in the past but not the specific function you are having problems with.
In general it's not that different from using PortAudio on Windows or Linux.

Maybe a silly question but is there any reason you want to use PortAudio.
The same things can usually be done much easier with platform specific code.
Windows (x64)
Raspberry Pi OS (Arm64)
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Re: Hey, Do anyone no how to use PortAudio on Mac OS X

Post by dman10001 »

I just need to get the data to do visuals.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Hey, Do anyone no how to use PortAudio on Mac OS X

Post by wilbert »

As far as I understand PortAudio doesn't have a MP3 decoder and is only for working with audio samples. :?
I don't know how you want to use it to play MP3 files.

Are you creating something cross platform or MacOS only ?
Windows (x64)
Raspberry Pi OS (Arm64)
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Re: Hey, Do anyone no how to use PortAudio on Mac OS X

Post by dman10001 »

Hi, the mixxx dj program I assumed they used port audio dll for mp3. http://www.mixxx.org

and check the website : http://www.portaudio.com

i need to decode mp3 files, is there a way I can do it myself using the mp3 format info ?
or I can just use a third party sdk dll ?

I know about the bass.dll, I do not want to use this.

is there an easier way to decode and play mp3 files on the mac using purebasic ?
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Hey, Do anyone no how to use PortAudio on Mac OS X

Post by wilbert »

OSX has a built in mp3 decoder.

The best approach depends on a few things.
- What's the minimum OSX version your application needs to work on.
- Do you need to decode the mp3 while streaming it or in advance.
- Do you need all sample data or is it enough to only have a volume meter while playing.
Windows (x64)
Raspberry Pi OS (Arm64)
WilliamL
Addict
Addict
Posts: 1215
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: Hey, Do anyone no how to use PortAudio on Mac OS X

Post by WilliamL »

is there an easier way to decode and play mp3 files on the mac using purebasic ?

Code: Select all

Result = LoadMovie(#Movie, Filename$)
doesn't get any easier that that..
MacBook Pro-M1 (2021), Sonoma 14.3.1 (CLT 15.3), PB 6.10b7 M1
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Re: Hey, Do anyone no how to use PortAudio on Mac OS X

Post by dman10001 »

yeah thats easy, but I need to get the data values.
I found out that I can use the libmpeg123 DLL or DYLIB Windows and MAC respectively.
thanks for the help.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Hey, Do anyone no how to use PortAudio on Mac OS X

Post by wilbert »

dman10001 wrote:yeah thats easy, but I need to get the data values.
I found out that I can use the libmpeg123 DLL or DYLIB Windows and MAC respectively.
If you don't want to use external libs, you can use the AudioToolbox framework on OSX.
How easy it would be to use AudioToolbox depends on your needs. Decoding of MP3 with constant bitrate in the original sample format is relatively easy.
Supporting VBR or converting all mp3 input files to the same sample rate (for example 44100 Hz stereo) would be a bit more difficult.
Windows (x64)
Raspberry Pi OS (Arm64)
Post Reply