예제 #1
0
파일: patman.cpp 프로젝트: Orpheon/lmms
void patmanInstrument::playNote( notePlayHandle * _n,
						sampleFrame * _working_buffer )
{
	if( m_patchFile.isEmpty() )
	{
		return;
	}

	const fpp_t frames = _n->framesLeftForCurrentPeriod();

	if( !_n->m_pluginData )
	{
		selectSample( _n );
	}
	handle_data * hdata = (handle_data *)_n->m_pluginData;

	float play_freq = hdata->tuned ? _n->frequency() :
						hdata->sample->frequency();

	if( hdata->sample->play( _working_buffer, hdata->state, frames,
					play_freq, m_loopedModel.value() ) )
	{
		applyRelease( _working_buffer, _n );
		instrumentTrack()->processAudioBuffer( _working_buffer,
								frames, _n );
	}
}
예제 #2
0
void pdsp::Sampler::process_audio( const float* pitchModBuffer, const float* triggerBuffer, const float* &selectBuffer, int &selectState, const float* &startBuffer, int& startState, int bufferSize)noexcept{

        float* outputBuffer = getOutputBufferToFill(output);

        if(pitchModAR){
                //
                vect_calculateIncrement(outputBuffer, pitchModBuffer, incBase * sample->fileSampleRate, bufferSize);
                //in this way is always correct even with oversample
        }

        for(int n=0; n<bufferSize; ++n){

                if(triggerAR){
                        if(checkTrigger(triggerBuffer[n])){
                                selectSample(selectBuffer, selectState,  startBuffer, startState, n, bufferSize);
                        }
                }

                if(pitchModAR){
                        inc = outputBuffer[n];  //we have the calculated pitchs inside outputbuffer
                }

                int readIndex_int = static_cast<int>(readIndex);
                if(readIndex_int>=0 && readIndex_int < sample->length){
                        outputBuffer[n] = interpolatorShell.interpolator->interpolate(sample->buffer[sample->mono], readIndex, sample->length);
                }else{
                        outputBuffer[n] = 0.0f;
                }
                
                readIndex += inc*direction;
                 
        }
        
        positionMeter.store(readIndex*positionDivider);
}
예제 #3
0
void GTUtilsWorkflowDesigner::addSample(HI::GUITestOpStatus &os, const QString &sampName) {
    expandTabs(os);
    QTabWidget *tabs = qobject_cast<QTabWidget *>(GTWidget::findWidget(os, "tabs"));
    GT_CHECK(tabs != NULL, "tabs widget not found");

    GTTabWidget::setCurrentIndex(os, tabs, 1);

    QTreeWidgetItem *samp = findTreeItem(os, sampName, samples);
    GTGlobals::sleep(100);
    GT_CHECK(samp != NULL,"sample is NULL");

    selectSample(os, samp);
    GTGlobals::sleep(500);
}