LadspaEffect::LadspaEffect( Model * _parent, const Descriptor::SubPluginFeatures::Key * _key ) : Effect( &ladspaeffect_plugin_descriptor, _parent, _key ), m_controls( NULL ), m_maxSampleRate( 0 ), m_key( LadspaSubPluginFeatures::subPluginKeyToLadspaKey( _key ) ) { ladspa2LMMS * manager = engine::getLADSPAManager(); if( manager->getDescription( m_key ) == NULL ) { if( !engine::suppressMessages() ) { QMessageBox::warning( 0, tr( "Effect" ), tr( "Unknown LADSPA plugin %1 requested." ). arg( m_key.second ), QMessageBox::Ok, QMessageBox::NoButton ); } setOkay( false ); return; } setDisplayName( manager->getShortName( m_key ) ); pluginInstantiation(); connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ) ); }
void SynthSettings::setSampleRate(float sampleRate) { if (m_sampleRate != sampleRate) { m_sampleRate = sampleRate; emit sampleRateChanged(); } }
void Mixer::setAudioDevice( AudioDevice * _dev, const struct qualitySettings & _qs, bool _needs_fifo ) { // don't delete the audio-device stopProcessing(); m_qualitySettings = _qs; m_oldAudioDev = m_audioDev; if( _dev == NULL ) { printf( "param _dev == NULL in Mixer::setAudioDevice(...). " "Trying any working audio-device\n" ); m_audioDev = tryAudioDevices(); } else { m_audioDev = _dev; } emit qualitySettingsChanged(); emit sampleRateChanged(); startProcessing( _needs_fifo ); }
void GenericTimeDataParams::setSampleRate(qreal SR) { if (SR > TIMEDATA_DEFAULT_MAX_SR ) return; if ( (SR!=m_SR) && (SR >0) ) { m_SR=SR; emit (sampleRateChanged(SR)); } }
LfoController::LfoController( Model * _parent ) : Controller( Controller::LfoController, _parent, tr( "LFO Controller" ) ), m_baseModel( 0.5, 0.0, 1.0, 0.001, this, tr( "Base value" ) ), m_speedModel( 2.0, 0.01, 20.0, 0.0001, 20000.0, this, tr( "Oscillator speed" ) ), m_amountModel( 1.0, -1.0, 1.0, 0.005, this, tr( "Oscillator amount" ) ), m_phaseModel( 0.0, 0.0, 360.0, 4.0, this, tr( "Oscillator phase" ) ), m_waveModel( Oscillator::SineWave, 0, Oscillator::NumWaveShapes, this, tr( "Oscillator waveform" ) ), m_multiplierModel( 0, 0, 2, this, tr( "Frequency Multiplier" ) ), m_duration( 1000 ), m_phaseOffset( 0 ), m_currentPhase( 0 ), m_sampleFunction( &Oscillator::sinSample ), m_userDefSampleBuffer( new SampleBuffer ) { setSampleExact( true ); connect( &m_waveModel, SIGNAL( dataChanged() ), this, SLOT( updateSampleFunction() ) ); connect( &m_speedModel, SIGNAL( dataChanged() ), this, SLOT( updateDuration() ) ); connect( &m_multiplierModel, SIGNAL( dataChanged() ), this, SLOT( updateDuration() ) ); connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateDuration() ) ); connect( engine::getSong(), SIGNAL( playbackStateChanged() ), this, SLOT( updatePhase() ) ); connect( engine::getSong(), SIGNAL( playbackPositionChanged() ), this, SLOT( updatePhase() ) ); updateDuration(); }
ZynAddSubFxInstrument::ZynAddSubFxInstrument( InstrumentTrack * _instrumentTrack ) : Instrument( _instrumentTrack, &zynaddsubfx_plugin_descriptor ), m_hasGUI( false ), m_plugin( NULL ), m_remotePlugin( NULL ), m_portamentoModel( 0, 0, 127, 1, this, tr( "Portamento" ) ), m_filterFreqModel( 64, 0, 127, 1, this, tr( "Filter Frequency" ) ), m_filterQModel( 64, 0, 127, 1, this, tr( "Filter Resonance" ) ), m_bandwidthModel( 64, 0, 127, 1, this, tr( "Bandwidth" ) ), m_fmGainModel( 127, 0, 127, 1, this, tr( "FM Gain" ) ), m_resCenterFreqModel( 64, 0, 127, 1, this, tr( "Resonance Center Frequency" ) ), m_resBandwidthModel( 64, 0, 127, 1, this, tr( "Resonance Bandwidth" ) ), m_forwardMidiCcModel( true, this, tr( "Forward MIDI Control Change Events" ) ) { initPlugin(); connect( &m_portamentoModel, SIGNAL( dataChanged() ), this, SLOT( updatePortamento() ) ); connect( &m_filterFreqModel, SIGNAL( dataChanged() ), this, SLOT( updateFilterFreq() ) ); connect( &m_filterQModel, SIGNAL( dataChanged() ), this, SLOT( updateFilterQ() ) ); connect( &m_bandwidthModel, SIGNAL( dataChanged() ), this, SLOT( updateBandwidth() ) ); connect( &m_fmGainModel, SIGNAL( dataChanged() ), this, SLOT( updateFmGain() ) ); connect( &m_resCenterFreqModel, SIGNAL( dataChanged() ), this, SLOT( updateResCenterFreq() ) ); connect( &m_resBandwidthModel, SIGNAL( dataChanged() ), this, SLOT( updateResBandwidth() ) ); // now we need a play-handle which cares for calling play() InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrumentTrack ); Engine::mixer()->addPlayHandle( iph ); connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( reloadPlugin() ) ); connect( instrumentTrack()->pitchRangeModel(), SIGNAL( dataChanged() ), this, SLOT( updatePitchRange() ) ); }
CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const Descriptor* const descriptor, const bool isPatchbay) : Instrument(instrumentTrack, descriptor), kIsPatchbay(isPatchbay), fHandle(NULL), fDescriptor(isPatchbay ? carla_get_native_patchbay_plugin() : carla_get_native_rack_plugin()), fMidiEventCount(0) { fHost.handle = this; fHost.uiName = NULL; fHost.uiParentId = 0; // figure out prefix from dll filename QString dllName(carla_get_library_filename()); #if defined(CARLA_OS_LINUX) fHost.resourceDir = strdup(QString(dllName.split("/lib/carla")[0] + "/share/carla/resources/").toUtf8().constData()); #else fHost.resourceDir = NULL; #endif fHost.get_buffer_size = host_get_buffer_size; fHost.get_sample_rate = host_get_sample_rate; fHost.is_offline = host_is_offline; fHost.get_time_info = host_get_time_info; fHost.write_midi_event = host_write_midi_event; fHost.ui_parameter_changed = host_ui_parameter_changed; fHost.ui_custom_data_changed = host_ui_custom_data_changed; fHost.ui_closed = host_ui_closed; fHost.ui_open_file = host_ui_open_file; fHost.ui_save_file = host_ui_save_file; fHost.dispatcher = host_dispatcher; std::memset(&fTimeInfo, 0, sizeof(NativeTimeInfo)); fTimeInfo.bbt.valid = true; // always valid fHandle = fDescriptor->instantiate(&fHost); Q_ASSERT(fHandle != NULL); if (fHandle != NULL && fDescriptor->activate != NULL) fDescriptor->activate(fHandle); // we need a play-handle which cares for calling play() InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, instrumentTrack ); Engine::mixer()->addPlayHandle( iph ); connect(Engine::mixer(), SIGNAL(sampleRateChanged()), this, SLOT(sampleRateChanged())); }
void ZephyrXtreme::SetSampleRate(int rate) { if(rate!=zep_sample_rate) { zep_sample_rate=rate; zep_pending_sample_rate=0; emit sampleRateChanged(rate); } }
BassBoosterControls::BassBoosterControls( BassBoosterEffect* effect ) : EffectControls( effect ), m_effect( effect ), m_freqModel( 100.0f, 50.0f, 200.0f, 1.0f, this, tr( "Frequency" ) ), m_gainModel( 1.0f, 0.1f, 5.0f, 0.05f, this, tr( "Gain" ) ), m_ratioModel( 2.0f, 0.1f, 10.0f, 0.1f, this, tr( "Ratio" ) ) { connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeFrequency() ) ); }
DelayControls::DelayControls( DelayEffect* effect ): EffectControls( effect ), m_effect ( effect ), m_delayTimeModel( 0.5, 0.01, 20.0, 0.0001, 20000.0, this, tr( "Delay Samples" )) , m_feedbackModel(0.0f,0.0f,1.0f,0.01f,this,tr( "Feedback" ) ), m_lfoTimeModel(2.0, 0.01, 20.0, 0.0001, 20000.0, this, tr( "Lfo Frequency" ) ), m_lfoAmountModel(0.0, 0.0, 2.0, 0.0001, 2000.0, this, tr ( "Lfo Amount" ) ) { connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ) ); }
void Settings::setSampleRate(int sampleRate) { if (d->sampleRate != sampleRate) { d->sampleRate = sampleRate; emit sampleRateChanged(sampleRate); emit settingsChanged(); } }
MultitapEchoControls::MultitapEchoControls( MultitapEchoEffect * eff ) : EffectControls( eff ), m_effect( eff ), m_steps( 16, 4, 32, this, "Steps" ), m_stepLength( 100.0f, 1.0f, 500.0f, 0.1f, 500.0f, this, "Step length" ), m_dryGain( 0.0f, -80.0f, 20.0f, 0.1f, this, "Dry gain" ), m_swapInputs( false, this, "Swap inputs" ), m_stages( 1.0f, 1.0f, 4.0f, 1.0f, this, "Lowpass stages" ), m_ampGraph( -60.0f, 0.0f, 16, this ), m_lpGraph( 0.0f, 3.0f, 16, this ) { m_stages.setStrictStepSize( true ); connect( &m_ampGraph, SIGNAL( samplesChanged( int, int ) ), this, SLOT( ampSamplesChanged( int, int ) ) ); connect( &m_lpGraph, SIGNAL( samplesChanged( int, int ) ), this, SLOT( lpSamplesChanged( int, int ) ) ); connect( &m_steps, SIGNAL( dataChanged() ), this, SLOT( lengthChanged() ) ); connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) ); setDefaultAmpShape(); setDefaultLpShape(); }
void Mixer::setAudioOutputContext( AudioOutputContext * context ) { stopProcessing(); m_audioOutputContext = context; //m_audioDev->applyQualitySettings(); emit sampleRateChanged(); startProcessing(); }
TripleOscillator::TripleOscillator( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &tripleoscillator_plugin_descriptor ) { for( int i = 0; i < NUM_OF_OSCILLATORS; ++i ) { m_osc[i] = new OscillatorObject( this, i ); } connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateAllDetuning() ) ); }
DelayControls::DelayControls( DelayEffect* effect ): EffectControls( effect ), m_effect ( effect ), m_delayTimeModel( 0.5, 0.01, 5.0, 0.0001, 5000.0, this, tr( "Delay samples" )) , m_feedbackModel(0.0f,0.0f,1.0f,0.01f,this,tr( "Feedback" ) ), m_lfoTimeModel(2.0, 0.01, 5.0, 0.0001, 20000.0, this, tr( "LFO frequency" ) ), m_lfoAmountModel(0.0, 0.0, 0.5, 0.0001, 2000.0, this, tr ( "LFO amount" ) ), m_outGainModel( 0.0, -60.0, 20.0, 0.01, this, tr( "Output gain" ) ) { connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ) ); m_outPeakL = 0.0; m_outPeakR = 0.0; }
void SessionSampleData::setSampleRate(synthclone::SampleRate sampleRate) { CONFIRM((sampleRate == synthclone::SAMPLE_RATE_NOT_SET) || ((sampleRate >= synthclone::SAMPLE_RATE_MINIMUM) && (sampleRate <= synthclone::SAMPLE_RATE_MAXIMUM)), tr("'%1': invalid sample rate").arg(sampleRate)); if (this->sampleRate != sampleRate) { this->sampleRate = sampleRate; emit sampleRateChanged(sampleRate); } }
void Mixer::changeQuality( const struct qualitySettings & _qs ) { // don't delete the audio-device stopProcessing(); m_qualitySettings = _qs; m_audioDev->applyQualitySettings(); emit sampleRateChanged(); emit qualitySettingsChanged(); startProcessing(); }
FlangerControls::FlangerControls( FlangerEffect *effect ) : EffectControls ( effect ), m_effect ( effect ), m_delayTimeModel(0.001, 0.0001, 0.050, 0.0001, this, tr( "Delay Samples" ) ) , m_lfoFrequencyModel( 0.25, 0.01, 5, 0.0001, 20000.0 ,this, tr( "Lfo Frequency" ) ), m_lfoAmountModel( 0.0, 0.0, 0.0025 , 0.0001 , this , tr( "Seconds" ) ), m_feedbackModel( 0.0 , 0.0 , 1.0 , 0.0001, this, tr( "Regen" ) ), m_whiteNoiseAmountModel( 0.0 , 0.0 , 0.05 , 0.0001, this, tr( "Noise" ) ), m_invertFeedbackModel ( false , this, tr( "Invert" ) ) { connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changedSampleRate() ) ); }
Song::Song() : TrackContainer(), m_globalAutomationTrack( dynamic_cast<AutomationTrack *>( Track::create( Track::HiddenAutomationTrack, this ) ) ), m_tempoModel( DefaultTempo, MinTempo, MaxTempo, this, tr( "Tempo" ) ), m_timeSigModel( this ), m_oldTicksPerTact( DefaultTicksPerTact ), m_masterVolumeModel( 100, 0, 200, this, tr( "Master volume" ) ), m_masterPitchModel( 0, -12, 12, this, tr( "Master pitch" ) ), m_fileName(), m_oldFileName(), m_modified( false ), m_loadOnLaunch( true ), m_recording( false ), m_exporting( false ), m_exportLoop( false ), m_renderBetweenMarkers( false ), m_playing( false ), m_paused( false ), m_loadingProject( false ), m_isCancelled( false ), m_playMode( Mode_None ), m_length( 0 ), m_patternToPlay( NULL ), m_loopPattern( false ), m_elapsedTicks( 0 ), m_elapsedTacts( 0 ), m_loopRenderCount(1), m_loopRenderRemaining(1) { for(int i = 0; i < Mode_Count; ++i) m_elapsedMilliSeconds[i] = 0; connect( &m_tempoModel, SIGNAL( dataChanged() ), this, SLOT( setTempo() ), Qt::DirectConnection ); connect( &m_tempoModel, SIGNAL( dataUnchanged() ), this, SLOT( setTempo() ), Qt::DirectConnection ); connect( &m_timeSigModel, SIGNAL( dataChanged() ), this, SLOT( setTimeSignature() ), Qt::DirectConnection ); connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateFramesPerTick() ) ); connect( &m_masterVolumeModel, SIGNAL( dataChanged() ), this, SLOT( masterVolumeChanged() ), Qt::DirectConnection ); /* connect( &m_masterPitchModel, SIGNAL( dataChanged() ), this, SLOT( masterPitchChanged() ) );*/ qRegisterMetaType<Note>( "Note" ); setType( SongContainer ); }
VstPlugin::VstPlugin( const QString & _plugin ) : m_plugin( _plugin ), m_pluginWindowID( 0 ), m_embedMethod( gui ? ConfigManager::inst()->vstEmbedMethod() : "headless" ), m_version( 0 ), m_currentProgram() { if( QDir::isRelativePath( m_plugin ) ) { m_plugin = ConfigManager::inst()->vstDir() + m_plugin; } setSplittedChannels( true ); PE::MachineType machineType; try { PE::FileInfo peInfo(m_plugin); machineType = peInfo.machineType(); } catch (std::runtime_error& e) { qCritical() << "Error while determining PE file's machine type: " << e.what(); machineType = PE::MachineType::unknown; } switch(machineType) { case PE::MachineType::amd64: tryLoad( REMOTE_VST_PLUGIN_FILEPATH_64 ); // Default: RemoteVstPlugin64 break; case PE::MachineType::i386: tryLoad( REMOTE_VST_PLUGIN_FILEPATH_32 ); // Default: 32/RemoteVstPlugin32 break; default: m_failed = true; return; } setTempo( Engine::getSong()->getTempo() ); connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ), this, SLOT( setTempo( bpm_t ) ) ); connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) ); // update once per second m_idleTimer.start( 1000 ); connect( &m_idleTimer, SIGNAL( timeout() ), this, SLOT( idleUpdate() ) ); }
SampleBuffer::SampleBuffer( const QString & _audio_file, bool _is_base64_data ) : m_audioFile( ( _is_base64_data == true ) ? "" : _audio_file ), m_origData( NULL ), m_origFrames( 0 ), m_data( NULL ), m_frames( 0 ), m_startFrame( 0 ), m_endFrame( 0 ), m_loopStartFrame( 0 ), m_loopEndFrame( 0 ), m_amplification( 1.0f ), m_reversed( false ), m_frequency( BaseFreq ), m_sampleRate( engine::mixer()->baseSampleRate() ) { if( _is_base64_data == true ) { loadFromBase64( _audio_file ); } connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) ); update(); }
void Mixer::restoreAudioDevice() { if( m_oldAudioDev != NULL ) { stopProcessing(); delete m_audioDev; m_audioDev = m_oldAudioDev; emit sampleRateChanged(); m_oldAudioDev = NULL; startProcessing(); } }
SampleBuffer::SampleBuffer( const sampleFrame * _data, const f_cnt_t _frames ) : m_audioFile( "" ), m_origData( NULL ), m_origFrames( 0 ), m_data( NULL ), m_frames( 0 ), m_startFrame( 0 ), m_endFrame( 0 ), m_loopStartFrame( 0 ), m_loopEndFrame( 0 ), m_amplification( 1.0f ), m_reversed( false ), m_frequency( BaseFreq ), m_sampleRate( engine::mixer()->baseSampleRate() ) { if( _frames > 0 ) { m_origData = MM_ALLOC( sampleFrame, _frames ); memcpy( m_origData, _data, _frames * BYTES_PER_FRAME ); m_origFrames = _frames; } connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( sampleRateChanged() ) ); update(); }
void TimePlotWidget::connectSignals() { TimePlotParams *_params=dynamic_cast< TimePlotParams*> (getDataParameters()); Q_ASSERT(_params!=NULL); //Keep consitent duration and sample rate Q_ASSERT(connect(_params,SIGNAL(maxDurationChanged(qreal)),this,SLOT(setAllCurvesMaxDuration(qreal)))); Q_ASSERT(connect(_params,SIGNAL(sampleRateChanged(qreal)),this,SLOT(setAllCurvesSampleRate(qreal)))); //Signal arriving only from UI (show/hide all) TimePlotWidgetUI *_ui=dynamic_cast< TimePlotWidgetUI*> (getControlWidget()); Q_ASSERT(_ui!=NULL); Q_ASSERT(connect(_ui,SIGNAL(showAllCurvesToggled()),this,SLOT(showAllCurves()))); Q_ASSERT(connect(_ui,SIGNAL(hideAllCurvesToggled()),this,SLOT(hideAllCurves()))); Q_ASSERT(connect(this,SIGNAL(curveListChanged()),this,SLOT(recalcAndUpdatePlot()))); }
PeakController::PeakController( Model * _parent, PeakControllerEffect * _peak_effect ) : Controller( Controller::PeakController, _parent, tr( "Peak Controller" ) ), m_peakEffect( _peak_effect ), m_currentSample( 0.0f ) { setSampleExact( true ); if( m_peakEffect ) { connect( m_peakEffect, SIGNAL( destroyed( ) ), this, SLOT( handleDestroyedEffect( ) ) ); } connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateCoeffs() ) ); connect( m_peakEffect->attackModel(), SIGNAL( dataChanged() ), this, SLOT( updateCoeffs() ) ); connect( m_peakEffect->decayModel(), SIGNAL( dataChanged() ), this, SLOT( updateCoeffs() ) ); m_coeffNeedsUpdate = true; }
song::song() : TrackContainer(), m_globalAutomationTrack( dynamic_cast<AutomationTrack *>( track::create( track::HiddenAutomationTrack, this ) ) ), m_tempoModel( DefaultTempo, MinTempo, MaxTempo, this, tr( "Tempo" ) ), m_timeSigModel( this ), m_oldTicksPerTact( DefaultTicksPerTact ), m_masterVolumeModel( 100, 0, 200, this, tr( "Master volume" ) ), m_masterPitchModel( 0, -12, 12, this, tr( "Master pitch" ) ), m_fileName(), m_oldFileName(), m_modified( false ), m_recording( false ), m_exporting( false ), m_exportLoop( false ), m_playing( false ), m_paused( false ), m_loadingProject( false ), m_playMode( Mode_None ), m_length( 0 ), m_trackToPlay( NULL ), m_patternToPlay( NULL ), m_loopPattern( false ), m_elapsedMilliSeconds( 0 ), m_elapsedTicks( 0 ), m_elapsedTacts( 0 ) { connect( &m_tempoModel, SIGNAL( dataChanged() ), this, SLOT( setTempo() ) ); connect( &m_tempoModel, SIGNAL( dataUnchanged() ), this, SLOT( setTempo() ) ); connect( &m_timeSigModel, SIGNAL( dataChanged() ), this, SLOT( setTimeSignature() ) ); connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateFramesPerTick() ) ); connect( &m_masterVolumeModel, SIGNAL( dataChanged() ), this, SLOT( masterVolumeChanged() ) ); /* connect( &m_masterPitchModel, SIGNAL( dataChanged() ), this, SLOT( masterPitchChanged() ) );*/ qRegisterMetaType<note>( "note" ); }
void UGen::setSampleRate(float newSampleRate) { if ( mSampleRate != newSampleRate) { mSampleRate = newSampleRate; sampleRateChanged(); } UGenInput* in = mInputs; while( in ) { UGenInput & input = *in; if ( input.isPatched() ) { input.setSampleRate(newSampleRate); } in = in->next(); } }
void Mixer::setAudioDevice( AudioDevice * _dev ) { stopProcessing(); m_oldAudioDev = m_audioDev; if( _dev == NULL ) { printf( "param _dev == NULL in Mixer::setAudioDevice(...). " "Trying any working audio-device\n" ); m_audioDev = tryAudioDevices(); } else { m_audioDev = _dev; } emit sampleRateChanged(); startProcessing(); }
VstPlugin::VstPlugin( const QString & _plugin ) : RemotePlugin(), JournallingObject(), m_plugin( _plugin ), m_pluginWidget( NULL ), m_pluginWindowID( 0 ), m_badDllFormat( false ), m_name(), m_version( 0 ), m_vendorString(), m_productString(), m_currentProgramName(), m_allProgramNames(), p_name(), m_currentProgram(), m_idleTimer() { setSplittedChannels( true ); tryLoad( REMOTE_VST_PLUGIN_FILEPATH ); #ifdef LMMS_BUILD_WIN64 if( m_badDllFormat ) { m_badDllFormat = false; tryLoad( "32/RemoteVstPlugin32" ); } #endif setTempo( Engine::getSong()->getTempo() ); connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ), this, SLOT( setTempo( bpm_t ) ) ); connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( updateSampleRate() ) ); // update once per second m_idleTimer.start( 1000 ); connect( &m_idleTimer, SIGNAL( timeout() ), this, SLOT( idleUpdate() ) ); }
void AUD_BaseIIRFilterReader::read(int& length, bool& eos, sample_t* buffer) { AUD_Specs specs = m_reader->getSpecs(); if(specs.channels != m_specs.channels) { m_specs.channels = specs.channels; delete[] m_x; delete[] m_y; m_x = new sample_t[m_xlen * m_specs.channels]; m_y = new sample_t[m_ylen * m_specs.channels]; memset(m_x, 0, sizeof(sample_t) * m_xlen * m_specs.channels); memset(m_y, 0, sizeof(sample_t) * m_ylen * m_specs.channels); } if(specs.rate != m_specs.rate) { m_specs = specs; sampleRateChanged(m_specs.rate); } m_reader->read(length, eos, buffer); for(m_channel = 0; m_channel < m_specs.channels; m_channel++) { for(int i = 0; i < length; i++) { m_x[m_xpos * CC] = buffer[i * CC]; m_y[m_ypos * CC] = buffer[i * CC] = filter(); m_xpos = (m_xpos + 1) % m_xlen; m_ypos = (m_ypos + 1) % m_ylen; } } }