bool Raspicam::LiveThreadRun() { if ( !mLink->isConnected() ) { mLink->Connect(); if ( mLink->isConnected() ) { gDebug() << "Raspicam connected !\n"; mLink->setBlocking( false ); IL::Camera::SetState( IL::Component::StateExecuting ); mEncoder->SetState( IL::Component::StateExecuting ); mLiveFrameCounter = 0; } return true; } else if ( mRecording and Board::GetTicks() - mLedTick >= 1000 * 500 ) { GPIO::Write( 32, ( mLedState = !mLedState ) ); mLedTick = Board::GetTicks(); } uint8_t data[65536] = { 0 }; uint32_t datalen = mEncoder->getOutputData( data ); if ( (int32_t)datalen > 0 ) { mLiveFrameCounter++; LiveSend( (char*)data, datalen ); if ( mRecording ) { RecordWrite( (char*)data, datalen ); } } return true; }
void RecordWriteWordBE(RecordWriter* writer, FILE* stream, uword_t val) { val = htobe_word(val); RecordWrite(writer, stream, &val, sizeof val); }
void SndBuffer::Write( const StereoOut32& Sample ) { // Log final output to wavefile. WaveDump::WriteCore( 1, CoreSrc_External, Sample.DownSample() ); if( WavRecordEnabled ) RecordWrite( Sample.DownSample() ); if(mods[OutputModule] == &NullOut) // null output doesn't need buffering or stretching! :p return; sndTempBuffer[sndTempProgress++] = Sample; // If we haven't accumulated a full packet yet, do nothing more: if(sndTempProgress < SndOutPacketSize) return; sndTempProgress = 0; //Don't play anything directly after loading a savestate, avoids static killing your speakers. if ( ssFreeze > 0 ) { ssFreeze--; memset( sndTempBuffer, 0, sizeof(StereoOut32) * SndOutPacketSize ); // Play silence } #ifndef __POSIX__ if( dspPluginEnabled ) { // Convert in, send to winamp DSP, and convert out. int ei= m_dsp_progress; for( int i=0; i<SndOutPacketSize; ++i, ++ei ) { sndTempBuffer16[ei] = sndTempBuffer[i].DownSample(); } m_dsp_progress += DspProcess( (s16*)sndTempBuffer16 + m_dsp_progress, SndOutPacketSize ); // Some ugly code to ensure full packet handling: ei = 0; while( m_dsp_progress >= SndOutPacketSize ) { for( int i=0; i<SndOutPacketSize; ++i, ++ei ) { sndTempBuffer[i] = sndTempBuffer16[ei].UpSample(); } if( SynchMode == 0 ) // TimeStrech on timeStretchWrite(); else _WriteSamples(sndTempBuffer, SndOutPacketSize); m_dsp_progress -= SndOutPacketSize; } // copy any leftovers to the front of the dsp buffer. if( m_dsp_progress > 0 ) { memcpy( sndTempBuffer16, &sndTempBuffer16[ei], sizeof(sndTempBuffer16[0]) * m_dsp_progress ); } } #endif else { if( SynchMode == 0 ) // TimeStrech on timeStretchWrite(); else _WriteSamples(sndTempBuffer, SndOutPacketSize); } }
void RecordWriteByte(RecordWriter* writer, FILE* stream, byte_t val) { RecordWrite(writer, stream, &val, sizeof val); }