Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
int MicrophoneRecorder::
writeBuffer(const void *inputBuffer,
void */*outputBuffer*/,
unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo */*timeInfo*/,
PaStreamCallbackFlags /*statusFlags*/)
{
BOOST_ASSERT( inputBuffer );
const float **in = (const float **)inputBuffer;
const float *buffer = in[0];
pBuffer b( new Buffer() );
b->waveform_data.reset( new GpuCpuData<float>( 0, make_cudaExtent( framesPerBuffer, 1, 1) ) );
memcpy ( b->waveform_data->getCpuMemory(), buffer, framesPerBuffer*sizeof(float) );
_cache.push_back( b );
if (_callback)
_callback->recievedData( this );
return paContinue;
}
void DisplayWidget::recievedData( Signal::MicrophoneRecorder* r )
{
float newl = r->length();
static float prevl = newl;
if (_qx == prevl )
_qx = newl;
_invalidRange.push( std::pair<float, float>(prevl, newl));
prevl = newl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.