Gil Hadas | 1 Apr 2007 16:42
Picon

Re: configure the in/out channels

Thanks 
The channelselector worked great.

Gil
 
On 3/29/07, Cristian Marletta <cristian.marletta <at> gmail.com> wrote:
Gil Hadas wrote:
> But I couldn't compile it , I don't have the declaration of
> PaAsioStreamInfo

first of all you need pa_asio.h for PaAsioStreamInfo

> any Idea if it the channel selector can help me and how?

In my experience with asio under portaudio i found channelselector quite
helpful:
here's the way i use them:

PaStreamParameters  InputParameters;
PaStreamParameters  OutputParameters;
PaAsioStreamInfo    AsioInputInfo;
PaAsioStreamInfo    AsioOutputInfo;
int                 iNumDevices;
int                 iMaxAsioInputChannels;
int                 iMaxAsioOutputChannels;
int                 iNumOfInputChannels;
int                 iNumOfOutputChannels;
int                 *piOutputChannelSelector;
int                 *piInputChannelSelector;
const PaDeviceInfo  *DeviceInfo;

iNumDevices = Pa_GetDeviceCount();


for(int i = 0; i < iNumDevices ; i++) // it is not useful for you, but
with that you can check if compiled everything in the right way
{
DeviceInfo = Pa_GetDeviceInfo(i);
iMaxAsioInputChannels = DeviceInfo->maxInputChannels;
iMaxAsioOutputChannels = DeviceInfo->maxOutputChannels;
}

piOutputChannelSelector = new int[iMaxAsioOutputChannels];
piInputChannelSelector = new int[iMaxAsioInputChannels];

//here's the important part:

piOutputChannelSelector[0] = 4; // that maps asio virtual channel to 0,
also if yours is 5
piOutputChannelSelector[1] = 5; // that maps asio virtual channel to 1,
also if yours is 6

piInputChannelSelector[0] = 2;
piInputChannelSelector[1] = 3;

// if you want to use a direct selection, you need to maps
piOutputChannelSelector & piInputChannelSelector like that:
// for (int i = 0; i < iMaxAsioInputChannels ; i++)
//  piInputChannelSelector[i] = i;
//
// for (int i = 0; i < iMaxAsioOutputChannels ; i++)
//  piOutputChannelSelector [i] = i;
//
// Then in the callback you'll have to route in the right way all your
channels, also the one you are actually not using
// Hence i prefer to map just the channel i use at the beginning of the
channelSelector array


//Input
AsioInputInfo.size                = sizeof(PaAsioStreamInfo);
AsioInputInfo.hostApiType         = paASIO;
AsioInputInfo.flags               = paAsioUseChannelSelectors;
AsioInputInfo.version             = 1;
AsioInputInfo.channelSelectors    = piInputChannelSelector;
InputParameters.channelCount      = iNumOfInputChannels; //for you it's 2
InputParameters.device            = Pa_GetDefaultOutputDevice();
InputParameters.sampleFormat      = paFloat32;
InputParameters.suggestedLatency   = Pa_GetDeviceInfo(
InputParameters.device )->defaultLowInputLatency;
InputParameters.hostApiSpecificStreamInfo = &AsioInputInfo;
//Output
AsioOutputInfo.size                = sizeof(PaAsioStreamInfo);
AsioOutputInfo.hostApiType         = paASIO;
AsioOutputInfo.flags               = paAsioUseChannelSelectors;
AsioOutputInfo.version             = 1;
AsioOutputInfo.channelSelectors    = piOutputChannelSelector;
OutputParameters.channelCount      = iNumOfOutputChannels;
OutputParameters.device            = Pa_GetDefaultOutputDevice();
OutputParameters.sampleFormat      = paFloat32;
OutputParameters.suggestedLatency  =
Pa_GetDeviceInfo(OutputParameters.device)->defaultLowOutputLatency;
OutputParameters.hostApiSpecificStreamInfo = &AsioOutputInfo;

--

Cristian Marletta

_______________________________________________
Portaudio mailing list
Portaudio <at> techweb.rfa.org
http://techweb.rfa.org/mailman/listinfo/portaudio
Gil Hadas | 1 Apr 2007 17:07
Picon

Channel name in Mac OSX

Hi,
I am creating an interface in my application in which the user can choose the I/O channels of the sound device.
In windows, using ASIO only, I am looping over all the available input channels of a device and call PaAsio_GetInputChannelName() that  retrieves the name of the selected channel.
When trying to implement the Mac OSX equivalent logic, using core audio, I did not find any call that retrieves the channels name.
Is this supported in PortAudio?
I found that when using Core Audio, it appears that the following call should be done: AudioDeviceGetProperty(... , kAudioDevicePropertyChannelName,...)
However, I did not find such a call in PortAudio sources.
How is it recommended to proceed from here?
 
Thanks,
Gil
_______________________________________________
Portaudio mailing list
Portaudio <at> techweb.rfa.org
http://techweb.rfa.org/mailman/listinfo/portaudio
Bjorn Roche | 1 Apr 2007 17:55
Favicon
Gravatar

Re: Channel name in Mac OSX

Hello Gil,

	I'm afraid there is no PortAudio interface to retrieve this  
information, nor is there an interface for selecting specific  
channels, although there have been discussions of the latter. If you  
wanted to submit a patch to add this functionality, I would gladly  
look it over and apply it if it looks good.

	bjorn

On Apr 1, 2007, at 11:07 AM, Gil Hadas wrote:

> Hi,
> I am creating an interface in my application in which the user can  
> choose the I/O channels of the sound device.
> In windows, using ASIO only, I am looping over all the available  
> input channels of a device and call PaAsio_GetInputChannelName()  
> that  retrieves the name of the selected channel.
> When trying to implement the Mac OSX equivalent logic, using core  
> audio, I did not find any call that retrieves the channels name.
> Is this supported in PortAudio?
> I found that when using Core Audio, it appears that the following  
> call should be done: AudioDeviceGetProperty(... ,  
> kAudioDevicePropertyChannelName,...)
> However, I did not find such a call in PortAudio sources.
> How is it recommended to proceed from here?
>
> Thanks,
> Gil
> _______________________________________________
> Portaudio mailing list
> Portaudio <at> techweb.rfa.org
> http://techweb.rfa.org/mailman/listinfo/portaudio

-----------------------------
Bjorn Roche
XO Wave
Digital Audio Production and Post-Production Software
http://www.xowave.com
http://blog.bjornroche.com
http://myspace.com/xowave
Gil Hadas | 1 Apr 2007 18:23
Picon

Re: Channel name in Mac OSX

Thanks for the info.
 
Are you aware of any Mac core audio call that can retrieve channel I/O names (this is what I am looking for as a workaround the missing PA call..)
 
Thanks.
Gil.

 
On 4/1/07, Bjorn Roche <bjorn <at> xowave.com> wrote:
Hello Gil,

       I'm afraid there is no PortAudio interface to retrieve this
information, nor is there an interface for selecting specific
channels, although there have been discussions of the latter. If you
wanted to submit a patch to add this functionality, I would gladly
look it over and apply it if it looks good.

       bjorn

On Apr 1, 2007, at 11:07 AM, Gil Hadas wrote:

> Hi,
> I am creating an interface in my application in which the user can
> choose the I/O channels of the sound device.
> In windows, using ASIO only, I am looping over all the available
> input channels of a device and call PaAsio_GetInputChannelName()
> that  retrieves the name of the selected channel.
> When trying to implement the Mac OSX equivalent logic, using core
> audio, I did not find any call that retrieves the channels name.
> Is this supported in PortAudio?
> I found that when using Core Audio, it appears that the following
> call should be done: AudioDeviceGetProperty(... ,
> kAudioDevicePropertyChannelName,...)
> However, I did not find such a call in PortAudio sources.
> How is it recommended to proceed from here?
>
> Thanks,
> Gil
> _______________________________________________
> Portaudio mailing list
> Portaudio <at> techweb.rfa.org
> http://techweb.rfa.org/mailman/listinfo/portaudio

-----------------------------
Bjorn Roche
XO Wave
Digital Audio Production and Post-Production Software
http://www.xowave.com
http://blog.bjornroche.com
http://myspace.com/xowave



_______________________________________________
Portaudio mailing list
Portaudio <at> techweb.rfa.org
http://techweb.rfa.org/mailman/listinfo/portaudio
Bjorn Roche | 1 Apr 2007 18:39
Favicon
Gravatar

Re: Channel name in Mac OSX


On Apr 1, 2007, at 12:23 PM, Gil Hadas wrote:

> Thanks for the info.
>
> Are you aware of any Mac core audio call that can retrieve channel  
> I/O names (this is what I am looking for as a workaround the  
> missing PA call..)
>

You mentioned kAudioDevicePropertyChannelName in your previous  
thread, so I figured you may already know how to access the data you  
want. You may have to read this thread:

http://lists.apple.com/archives/coreaudio-api/2006/Nov/msg00162.html

to figure out whether that is the right property or if instead you  
have to use kAudioDevicePropertyChannelNameCFString. I only skimmed  
the thread, but it looks to me like you might have to try both for  
best compatibility.

	bjorn

-----------------------------
Bjorn Roche
XO Wave
Digital Audio Production and Post-Production Software
http://www.xowave.com
http://blog.bjornroche.com
http://myspace.com/xowave
Alastair Smith | 2 Apr 2007 10:51
Picon
Gravatar

C++ Bindings Universal Binary

Hello there

I'm trying to build the C++ bindings as an OS X Universal Binary, but I'm not having much success.  The Darwin Makefile works like a dream for building PortAudio itself, but using that Makefile stops some required files for the C++ bindings being created (specifically the libportaudio.la file), and so the build of the bindings fails. 

I've been trying the suggested techniques for building Universal Binaries ( http://developer.apple.com/technotes/tn2005/tn2137.html), but neither work because of this missing file issue.  Has anyone managed to build the C++ bindings as a Universal Binary?

All thoughts and suggestions are greatly appreciated. 

Kind regards

Alastair Smith

_______________________________________________
Portaudio mailing list
Portaudio <at> techweb.rfa.org
http://techweb.rfa.org/mailman/listinfo/portaudio
Olivier Tristan | 2 Apr 2007 11:04

Re: Channel name in Mac OSX

Bjorn Roche wrote:
>
> On Apr 1, 2007, at 12:23 PM, Gil Hadas wrote:
>
>> Thanks for the info.
>>
>> Are you aware of any Mac core audio call that can retrieve channel 
>> I/O names (this is what I am looking for as a workaround the missing 
>> PA call..)
>>
>
> You mentioned kAudioDevicePropertyChannelName in your previous thread, 
> so I figured you may already know how to access the data you want. You 
> may have to read this thread:
>
> http://lists.apple.com/archives/coreaudio-api/2006/Nov/msg00162.html
>
> to figure out whether that is the right property or if instead you 
> have to use kAudioDevicePropertyChannelNameCFString. I only skimmed 
> the thread, but it looks to me like you might have to try both for 
> best compatibility.
Hi,

I use this in my code.

  struct PaUtilHostApiRepresentation *hostApi;
  PaError err;
  err = PaUtil_GetHostApiRepresentation( &hostApi, 
(PaHostApiTypeId)m_APIId);
  assert(err == paNoError);

  PaMacCoreHostApiRepresentation *macCoreHostApi = 
(PaMacCoreHostApiRepresentation*)hostApi;
  AudioDeviceID hostApiDevice = macCoreHostApi->devIds[m_Id];

  char channelName[256];
  UInt32 dataSize = sizeof(channelName);
  OSStatus error = AudioDeviceGetProperty( hostApiDevice, index + 1, 
false, kAudioDevicePropertyChannelName, &dataSize, &channelName );
  if (error == noErr)
  {
     return String(channelName);
  }

Where index is the channel id (zero based) and APIId the API id (only 1 
on mac)

HTH

--

-- 
Olivier Tristan
Ultimate Sound Bank
Mikael Magnusson | 2 Apr 2007 12:42
Picon

Re: C++ Bindings Universal Binary

Alastair Smith wrote:
> Hello there
> 
> I'm trying to build the C++ bindings as an OS X Universal Binary, but I'm
> not having much success.  The Darwin Makefile works like a dream for
> building PortAudio itself, but using that Makefile stops some required 
> files
> for the C++ bindings being created (specifically the libportaudio.la file),
> and so the build of the bindings fails.
> 
> I've been trying the suggested techniques for building Universal Binaries (
> http://developer.apple.com/technotes/tn2005/tn2137.html), but neither work
> because of this missing file issue.  Has anyone managed to build the C++
> bindings as a Universal Binary?
> 
> All thoughts and suggestions are greatly appreciated.
> 
> Kind regards
> 
> Alastair Smith
> 

Hi,

try the following patch posted to the mailing list:

"Subject: [Portaudio] [patch] pkg-config in pacpp configure (was 
portaudio cpp bindings - compilation question)

I have made a patch which use pkg-config to detect compilation and
linking parameters instead of linking directly to libportaudio.la."

http://techweb.rfa.org/pipermail/portaudio/2006-November/006237.html

Mikael
Alastair Smith | 2 Apr 2007 19:44
Picon
Gravatar

Re: C++ Bindings Universal Binary

On 02/04/07, Mikael Magnusson <mikma264 <at> gmail.com> wrote:

Hi,

try the following patch posted to the mailing list:

"Subject: [Portaudio] [patch] pkg-config in pacpp configure (was
portaudio cpp bindings - compilation question)

I have made a patch which use pkg-config to detect compilation and
linking parameters instead of linking directly to libportaudio.la."

http://techweb.rfa.org/pipermail/portaudio/2006-November/006237.html

Mikael

Many thanks; the patch was applied successfully and after I re-ran autoconf everything seemed as though it would be ok.  However, when building the bindings, I now get a syntax error in the new configure script at line 19005:

"./configure: line 19005: syntax error near unexpected token `PORTAUDIO,portaudio-2.0'
./configure: line 19005: `PKG_CHECK_MODULES(PORTAUDIO,portaudio-2.0)'"

Thanks again

Alastair
_______________________________________________
Portaudio mailing list
Portaudio <at> techweb.rfa.org
http://techweb.rfa.org/mailman/listinfo/portaudio
Mikael Magnusson | 2 Apr 2007 19:52
Picon

Re: C++ Bindings Universal Binary

Alastair Smith wrote:
> On 02/04/07, Mikael Magnusson <mikma264 <at> gmail.com> wrote:
>>
>> Hi,
>>
>> try the following patch posted to the mailing list:
>>
>> "Subject: [Portaudio] [patch] pkg-config in pacpp configure (was
>> portaudio cpp bindings - compilation question)
>>
>> I have made a patch which use pkg-config to detect compilation and
>> linking parameters instead of linking directly to libportaudio.la."
>>
>> http://techweb.rfa.org/pipermail/portaudio/2006-November/006237.html
>>
>> Mikael
> 
> 
> Many thanks; the patch was applied successfully and after I re-ran autoconf
> everything seemed as though it would be ok.  However, when building the
> bindings, I now get a syntax error in the new configure script at line
> 19005:
> 
> "./configure: line 19005: syntax error near unexpected token `PORTAUDIO,
> portaudio-2.0'
> ./configure: line 19005: `PKG_CHECK_MODULES(PORTAUDIO,portaudio-2.0)'"
> 
> Thanks again
> 
> Alastair
> 

I think you need to run aclocal before autoconf.

Mikael

Gmane