Re: [Osalp-dev] aflibConverter question
Status: Abandoned
Brought to you by:
daservis
|
From: Darrick S. <da...@dc...> - 2002-03-06 05:31:37
|
This is what you want to do. We'll eventually support the double type. =
Is=20
double the type you're using for mixing?
aflibConfig in_config, out_config;
aflibStatus status =3D AFLIB_SUCCESS;
string in_file, out_file;
string in_format, out_format;
aflibAudioFile* input;
aflibAudioFile* output;
in_format =3D "DEVICE";
in_config.setSampleSize(AFLIB_DATA_16S);
in_config.setSamplesPerSecond(44100);
in_config.setChannels(2);
in_file =3D "/dev/dsp";
/* get input aflibAudioFile object=20
* this call will fill in_config with the appropriate values if
* the filetype supports that
*/
input =3D new aflibAudioFile(in_format,in_file,&in_config,&status);
if(status !=3D AFLIB_SUCCESS)
{
aflib_fatal("Error opening input file %s", in_file.c_str());
}
double factor =3D 0.5
=A0
output =3D aflibAudioSampleRateCvt (*input, factor, FALSE, FALSE, FALSE)
aflibData* out_data;
/* process it */
do
{
num_samples =3D BufferSize;
out_data =3D output->process(status, -1, num_samples);
for(int ch =3D 0 ; ch < out_data.getConfig().getChannels() ; ch++)
for(int i =3D 0 ; i < out_data.getConfig().getChannels() ; i++)
my_array[ch][i] =3D (double)out_data.getSample(i,ch);
}
while(status =3D=3D AFLIB_SUCCESS ||=20
some other condition you want to set to stop recording);
delete output;
delete input;
On Tuesday 05 March 2002 04:23 pm, Akos Maroy wrote:
> What I want to do is: I have raw audio read from the soundcard
> (interleaved), and I need to resample it. The ultimate output will be a=
n
> array of samples for each channel (of type double), but of course
> interleaved raw data is good enough (in a short array).
>
> It's all part of a project called darkice, http://darkice.sourceforge.n=
et/
>
> >>>- in inArray, should I supply a 2 channel input with channels
> >
> > If you have more then one channel the data should be consectutive. i=
.e.
> > all the data for the first channel then all the data for the second.
>
> I see. So maybe it's better split an interleaved input to two channels,
> and resample them seperately?
>
>
> Thanks for all the info,
>
>
> Akos
|