Example #1
0
bool AnalyzerWaveform::initialize(TrackPointer tio, int sampleRate, int totalSamples) {
    m_skipProcessing = false;

    m_timer.start();

    if (totalSamples == 0) {
        qWarning() << "AnalyzerWaveform::initialize - no waveform/waveform summary";
        return false;
    }

    // If we don't need to calculate the waveform/wavesummary, skip.
    if (isDisabledOrLoadStoredSuccess(tio)) {
        m_skipProcessing = true;
    } else {
        // Now actually initialize the AnalyzerWaveform:
        destroyFilters();
        createFilters(sampleRate);

        //TODO (vrince) Do we want to expose this as settings or whatever ?
        const int mainWaveformSampleRate = 441;
        // two visual sample per pixel in full width overview in full hd
        const int summaryWaveformSamples = 2 * 1920;

        m_waveform = WaveformPointer(new Waveform(
                sampleRate, totalSamples, mainWaveformSampleRate, -1));
        m_waveformSummary = WaveformPointer(new Waveform(
                sampleRate, totalSamples, mainWaveformSampleRate,
                summaryWaveformSamples));

        // Now, that the Waveform memory is initialized, we can set set them to
        // the TIO. Be aware that other threads of Mixxx can touch them from
        // now.
        tio->setWaveform(m_waveform);
        tio->setWaveformSummary(m_waveformSummary);

        m_waveformData = m_waveform->data();
        m_waveformSummaryData = m_waveformSummary->data();

        m_stride = WaveformStride(m_waveform->getAudioVisualRatio(),
                                  m_waveformSummary->getAudioVisualRatio());

        m_currentStride = 0;
        m_currentSummaryStride = 0;

        //debug
        //m_waveform->dump();
        //m_waveformSummary->dump();

    #ifdef TEST_HEAT_MAP
        test_heatMap = new QImage(256,256,QImage::Format_RGB32);
        test_heatMap->fill(0xFFFFFFFF);
    #endif
    }
    return !m_skipProcessing;
}
FeatureSet_ptr SeedSearcherMain::FeatureSetManager::removeRedundancies (
	const FeatureSet& features, const CmdLineParameters& params)
{
	//
	// creates a new empty container with only the redundancy removing filters
	SeedSearcher::FeatureFilter_ptr bestFeatures = 
		createFilters (params, false);

	int maxElements = params.parser ().__seed_n;
	FeatureSet::CIterator feature_it = features.getIterator();
	for (; ((*bestFeatures)->size () < maxElements) && (feature_it.hasNext()) ; feature_it.next())
		bestFeatures->add(*feature_it );

	return bestFeatures->getArray();
}