manuel 66
22-01-2013, 14:24
salve, ho in mente di creare una chat vocale (o meglio ci voglio provare) e per ora ho un unico problema, reperire un flusso audio dal microfono (magari con qualche libreria amr) googlando ho trovato qualcosa, ma nn propio ciņ che cerco.
chi sa aiutarmi ?
manuel 66
27-01-2013, 15:20
sto provando con portaudio, ma ho alcuni problemi:
double srate = 44100;
PaStream *stream;
unsigned long framesPerBuffer = 256;
PaStreamParameters outputParameters;
PaStreamParameters inputParameters;
char *sampleBlock;
err = Pa_Initialize();
if( err != paNoError ) MessageBox(NULL, "errore inizializzazione", "Info", MB_ICONINFORMATION | MB_OK);;
/* -- setup input and output -- */
inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
inputParameters.channelCount = 2;
inputParameters.sampleFormat = srate;
inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency ;
inputParameters.hostApiSpecificStreamInfo = NULL;
outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
outputParameters.channelCount = 1;
outputParameters.sampleFormat = srate;
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency;
outputParameters.hostApiSpecificStreamInfo = NULL;
/* -- setup stream -- */
err = Pa_OpenStream(&stream,&inputParameters,&outputParameters,srate,framesPerBuffer,paClipOff,NULL,NULL);
if( err != paNoError ){
sprintf(tmp,"errore: %d",err);
MessageBox(NULL, tmp, "Info", MB_ICONINFORMATION | MB_OK);
}
/* -- start stream -- */
err = Pa_StartStream( stream );
if( err != paNoError ) MessageBox(NULL, "errore startStream", "Info", MB_ICONINFORMATION | MB_OK);
/* -- Here's the loop where we pass data from input to output -- */
for( i=0; i<(60*srate)/framesPerBuffer; ++i )
{
err = Pa_WriteStream( stream, sampleBlock, framesPerBuffer);
if( err ) MessageBox(NULL, "boooo", "Info", MB_ICONINFORMATION | MB_OK);
err = Pa_ReadStream( stream, sampleBlock, framesPerBuffer);
if( err ) MessageBox(NULL, "boooo1", "Info", MB_ICONINFORMATION | MB_OK);
}
/* -- Now we stop the stream -- */
err = Pa_StopStream( stream );
if( err != paNoError ) MessageBox(NULL, "pre last error", "Info", MB_ICONINFORMATION | MB_OK);;
/* -- don't forget to cleanup! -- */
err = Pa_CloseStream( stream );
if( err != paNoError ) MessageBox(NULL, "last error", "Info", MB_ICONINFORMATION | MB_OK);;
Pa_Terminate();
return 0;
mi da errore quando apro lo stream, mi dice (variabile) err=-9994 cercando ho trovato che il samplerate (srate=44100) nn e supportato...
sono andato nel driver audio per verificare tali parametri e vanno bene.. ho abbassato il bit depth a 16-bit dai 24 che era.. ma nnt..
naturalmente ho incluso portaudio.h
qualcuno sa aiutarmi ??
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.