Re: configure the in/out channels
2007-04-01 14:42:59 GMT
Gil
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
RSS Feed