void QcWaveform::doLoad( SNDFILE *new_sf, const SF_INFO &new_info, sf_count_t beg, sf_count_t dur ) { // set up soundfile to scale data in range [-1,1] to int range // when reading floating point data as int sf_command( new_sf, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE ); // check beginning and duration validity if( beg < 0 || dur < 1 || beg + dur > new_info.frames ) { qcErrorMsg("Invalid beginning and/or duration."); sf_close( new_sf ); return; } // cleanup previous state // NOTE we have to delete SoundCacheStream before closing the soundfile, as it might be still // loading it // TODO: should SoundCacheStream open the soundfile on its own? delete _cache; if( sf ) sf_close( sf ); sf = new_sf; sfInfo = new_info; _beg = _rangeBeg = beg; _dur = _rangeDur = dur; _rangeEnd = _rangeBeg + _rangeDur; updateFPP(); _cache = new SoundCacheStream(); connect( _cache, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int)) ); connect( _cache, SIGNAL(loadProgress(int)), this, SLOT(update()) ); connect( _cache, SIGNAL(loadingDone()), this, SIGNAL(loadingDone()) ); connect( _cache, SIGNAL(loadingDone()), this, SLOT(redraw()) ); _cache->load( sf, sfInfo, beg, dur, kMaxFramesPerCacheUnit, kMaxRawFrames ); redraw(); }
void QcWaveform::load( const QVector<double> & data, int offset, int ch, int sr ) { qcDebugMsg( 1, "QcWaveform::load( data, offset, channels )" ); if( ch < 1 ) { qcWarningMsg( "QSoundFileView: invalid number of channels!" ); return; } int ns = data.count(); int nf = ns / ch; if( nf * ch != ns ) { qcWarningMsg( "QSoundFileView: size of data not a multiple of channel count!" ); return; } if( offset < 0 || nf - offset < 1 ) { qcWarningMsg( "QSoundFileView: invalid range of data!" ); return; } delete _cache; if( sf ) sf_close( sf ); sf = 0; SF_INFO new_info; memset( &new_info, 0, sizeof(SF_INFO) ); new_info.channels = ch; new_info.samplerate = sr; sfInfo = new_info; _beg = _rangeBeg = 0; _dur = _rangeDur = _rangeEnd = nf - offset; updateFPP(); _cache = new SoundCacheStream(); connect( _cache, SIGNAL(loadingDone()), this, SIGNAL(loadingDone()) ); connect( _cache, SIGNAL(loadingDone()), this, SLOT(redraw()) ); _cache->load( data, _rangeDur, offset, ch ); }
void DocumentSourceSort::populate() { if (_mergingPresorted) { typedef DocumentSourceMergeCursors DSCursors; if (DSCursors* castedSource = dynamic_cast<DSCursors*>(pSource)) { populateFromCursors(castedSource->getCursors()); } else { msgasserted(17196, "can only mergePresorted from MergeCursors"); } } else { while (boost::optional<Document> next = pSource->getNext()) { loadDocument(std::move(*next)); } loadingDone(); } }
void SeafileModel::init() { QVariant token ( configValue("token:blowfish") ); QVariant baseUrl ( configValue("address") ); if(!baseUrl.type() != QVariant::String){ qWarning() << "INVALID URL" << baseUrl; emit error(QString("Seafile: invalid address of type ") + token.typeName()); } if(!token.type() != QVariant::String){ qWarning() << "INVALID TOKEN" << token; emit error(QString("Seafile: invalid token of type ") + token.typeName()); } this->m_server = new SeafileServer(baseUrl.toByteArray(), token.toByteArray()); this->m_server->ping(true); connect(this->m_server, SIGNAL(loadingDone()), this , SLOT(onLoadFinished()) ); connect( this->m_server, SIGNAL(file(QSharedPointer<SeafileFile>)), this , SLOT (onFile(QSharedPointer<SeafileFile>)) ); }
void FontLoader::didLayout() { loadingDone(); }