void SynthController::onParamUpdate(Hardware::Parameters &parameters)
{
  envelope_.Trigger();
  anaPitchControl_.Trigger();  
  digiPitchControl_.Trigger();  
  updatePitch();
  updateCutoff();
  parameters = hwParameters_;
}
Пример #2
0
KeyControl::PitchTempoRatio KeyControl::getPitchTempoRatio() {
    // TODO(XXX) remove code duplication by adding this
    // "Update pending" atomic flag to the ControlObject API
    if (m_updatePitchRequest.fetchAndStoreAcquire(0)) {
        updatePitch();
    }
    if (m_updatePitchAdjustRequest.fetchAndStoreAcquire(0)) {
        updatePitchAdjust();
    }
    if (m_updateRateRequest.fetchAndStoreAcquire(0)) {
        updateRate();
    }
    return m_pitchRateInfo;
}
Пример #3
0
// #### IT:
InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
	Track( Track::InstrumentTrack, tc ),
	MidiEventProcessor(),
	m_midiPort( tr( "unnamed_track" ), Engine::mixer()->midiClient(),
								this, this ),
	m_notes(),
	m_sustainPedalPressed( false ),
	m_silentBuffersProcessed( false ),
	m_previewMode( false ),
	m_baseNoteModel( 0, 0, KeysPerOctave * NumOctaves - 1, this,
							tr( "Base note" ) ),
	m_volumeModel( DefaultVolume, MinVolume, MaxVolume, 0.1f, this, tr( "Volume" ) ),
	m_panningModel( DefaultPanning, PanningLeft, PanningRight, 0.1f, this, tr( "Panning" ) ),
	m_audioPort( tr( "unnamed_track" ), true, &m_volumeModel, &m_panningModel, &m_mutedModel ),
	m_pitchModel( 0, MinPitchDefault, MaxPitchDefault, 1, this, tr( "Pitch" ) ),
	m_pitchRangeModel( 1, 1, 60, this, tr( "Pitch range" ) ),
	m_effectChannelModel( 0, 0, 0, this, tr( "FX channel" ) ),
	m_useMasterPitchModel( true, this, tr( "Master Pitch") ),
	m_instrument( NULL ),
	m_soundShaping( this ),
	m_arpeggio( this ),
	m_noteStacking( this ),
	m_piano( this )
{
	m_pitchModel.setCenterValue( 0 );
	m_panningModel.setCenterValue( DefaultPanning );
	m_baseNoteModel.setInitValue( DefaultKey );

	m_effectChannelModel.setRange( 0, Engine::fxMixer()->numChannels()-1, 1);

	for( int i = 0; i < NumKeys; ++i )
	{
		m_notes[i] = NULL;
		m_runningMidiNotes[i] = 0;
	}


	setName( tr( "Default preset" ) );

	connect( &m_baseNoteModel, SIGNAL( dataChanged() ), this, SLOT( updateBaseNote() ) );
	connect( &m_pitchModel, SIGNAL( dataChanged() ), this, SLOT( updatePitch() ) );
	connect( &m_pitchRangeModel, SIGNAL( dataChanged() ), this, SLOT( updatePitchRange() ) );
	connect( &m_effectChannelModel, SIGNAL( dataChanged() ), this, SLOT( updateEffectChannel() ) );
}
Пример #4
0
NesObject::NesObject( NesInstrument * nes, const sample_rate_t samplerate, NotePlayHandle * nph, fpp_t frames ) :
	m_parent( nes ),
	m_samplerate( samplerate ),
	m_nph( nph ),
	m_fpp( frames )
{
	m_pitchUpdateCounter = 0;
	m_pitchUpdateFreq = wavelength( 60.0f );	
	
	m_LFSR = LFSR_INIT;
	
	m_ch1Counter = 0;
	m_ch2Counter = 0;
	m_ch3Counter = 0;
	m_ch4Counter = 0;
	
	m_ch1EnvCounter = 0;
	m_ch2EnvCounter = 0;
	m_ch4EnvCounter = 0;
	
	m_ch1EnvValue = 15;
	m_ch2EnvValue = 15;
	m_ch4EnvValue = 15;
	
	m_ch1SweepCounter = 0;
	m_ch2SweepCounter = 0;
	m_ch4SweepCounter = 0;
	
	m_12Last = 0.0f;
	m_34Last = 0.0f;
	
	m_maxWlen = wavelength( MIN_FREQ );
	
	m_nsf = NES_SIMPLE_FILTER * ( m_samplerate / 44100.0 );
	
	m_lastNoteFreq = 0;
	m_lastNoiseFreq = -1.0f; // value that is always different than noisefreq so it gets updated at start
	
	m_vibratoPhase = 0;
	
	updatePitch();
}
Пример #5
0
// #### IT:
InstrumentTrack::InstrumentTrack( trackContainer * _tc ) :
	track( track::InstrumentTrack, _tc ),
	MidiEventProcessor(),
	m_audioPort( tr( "unnamed_track" ) ),
	m_midiPort( tr( "unnamed_track" ), engine::getMixer()->midiClient(),
								this, this ),
	m_notes(),
        m_volumeModel( DefaultVolume, MinVolume, MaxVolume, 0.1f, this,
							tr( "Volume" ) ),
        m_panningModel( DefaultPanning, PanningLeft, PanningRight, 0.1f,
							this, tr( "Panning" ) ),
	m_pitchModel( 0, -100, 100, 1, this, tr( "Pitch" ) ),
	m_pitchRangeModel( 1, 1, 24, this, tr( "Pitch range" ) ),
	m_effectChannelModel( 0, 0, 0, this, tr( "FX channel" ) ), // change this so it's a combo box, all the channels and then new.
	m_instrument( NULL ),
	m_soundShaping( this ),
	m_arpeggiator( this ),
	m_chordCreator( this ),
	m_piano( this )
{
	m_effectChannelModel.setRange( 0, engine::fxMixer()->numChannels()-1, 1);
	connect( baseNoteModel(), SIGNAL( dataChanged() ),
			this, SLOT( updateBaseNote() ) );
	connect( &m_pitchModel, SIGNAL( dataChanged() ),
			this, SLOT( updatePitch() ) );
	connect( &m_pitchRangeModel, SIGNAL( dataChanged() ),
			this, SLOT( updatePitchRange() ) );


	for( int i = 0; i < NumKeys; ++i )
	{
		m_notes[i] = NULL;
		m_runningMidiNotes[i] = 0;
	}


	setName( tr( "Default preset" ) );

}
Пример #6
0
void PlayerWidget::_setupSource()
{
	setUpdatesEnabled( false );

	const bool hasAudioSource = audioSource_ != 0;

	setEnabled( hasAudioSource );

	// inititialized-invariant values
	ui_.labelFileName->setText( hasAudioSource ? QFileInfo( playerInfo_->filePath ).fileName() : QString() );
	ui_.buttonDestroy->setEnabled( hasAudioSource );

	_updateStateLabels();

	updateLoop();
	updateGain();
	updatePitch();

	// initialized-depended values
	_updateSourceInitialization();

	setUpdatesEnabled( true );
}
Пример #7
0
void NesObject::renderOutput( sampleFrame * buf, fpp_t frames )
{
	////////////////////////////////
	//	                          //
	//  variables for processing  //
	//                            //
	////////////////////////////////
	
	bool ch1Enabled = m_parent->m_ch1Enabled.value();
	bool ch2Enabled = m_parent->m_ch2Enabled.value();
	bool ch3Enabled = m_parent->m_ch3Enabled.value();
	bool ch4Enabled = m_parent->m_ch4Enabled.value();
	
	float ch1DutyCycle = DUTY_CYCLE[ m_parent->m_ch1DutyCycle.value() ];
	int ch1EnvLen = wavelength( floorf( 240.0 / ( m_parent->m_ch1EnvLen.value() + 1 ) ) );
	bool ch1EnvLoop = m_parent->m_ch1EnvLooped.value();
	
	float ch2DutyCycle = DUTY_CYCLE[ m_parent->m_ch2DutyCycle.value() ];
	int ch2EnvLen = wavelength( floorf( 240.0 / ( m_parent->m_ch2EnvLen.value() + 1 ) ) );
	bool ch2EnvLoop = m_parent->m_ch2EnvLooped.value();
	
	int ch4EnvLen = wavelength( floorf( 240.0 / ( m_parent->m_ch4EnvLen.value() + 1 ) ) );
	bool ch4EnvLoop = m_parent->m_ch4EnvLooped.value();
	
	// processing variables for operators
	int ch1;
	int ch2;
	int ch3;
	int ch4;
	
	// levels for generators (used for dc offset compensation)
	int ch1Level;
	int ch2Level;
	int ch3Level;
	int ch4Level;
	
	int ch1SweepRate = wavelength( floorf( 120.0 / ( m_parent->m_ch1SweepRate.value() + 1 ) ) );
	int ch2SweepRate = wavelength( floorf( 120.0 / ( m_parent->m_ch2SweepRate.value() + 1 ) ) );
	int ch4SweepRate = wavelength( floorf( 60.0f / ( 8.0f - qAbs( m_parent->m_ch4Sweep.value() ) ) ) );

	int ch1Sweep = static_cast<int>( m_parent->m_ch1SweepAmt.value() * -1.0 );
	int ch2Sweep = static_cast<int>( m_parent->m_ch2SweepAmt.value() * -1.0 );

	int ch4Sweep = 0;
	if( m_parent->m_ch4Sweep.value() != 0.0f )
	{
		ch4Sweep = m_parent->m_ch4Sweep.value() > 0.0f
			? -1
			: 1;
	}

	// the amounts are inverted so we correct them here
	if( ch1Sweep > 0 )
	{
		ch1Sweep = 8 - ch1Sweep;
	}
	if( ch1Sweep < 0 )
	{
		ch1Sweep = -8 - ch1Sweep;
	}

	if( ch2Sweep > 0 )
	{
		ch2Sweep = 8 - ch2Sweep;
	}
	if( ch2Sweep < 0 )
	{
		ch2Sweep = -8 - ch2Sweep;
	}
	
		
	// start framebuffer loop
		
	for( f_cnt_t f = 0; f < frames; f++ )
	{
		////////////////////////////////
		//	                          //
		//        pitch update        //
		//                            //
		////////////////////////////////
		
		m_pitchUpdateCounter++;
		if( m_pitchUpdateCounter >= m_pitchUpdateFreq )
		{
			updatePitch();
			m_pitchUpdateCounter = 0;
		}


		////////////////////////////////
		//	                          //
		//        channel 1           //
		//                            //
		////////////////////////////////

		// render pulse wave
		if( m_wlen1 <= m_maxWlen && m_wlen1 >= MIN_WLEN && ch1Enabled )
		{
			ch1Level = m_parent->m_ch1EnvEnabled.value()
				? static_cast<int>( ( m_parent->m_ch1Volume.value() * m_ch1EnvValue ) / 15.0 )
				: static_cast<int>( m_parent->m_ch1Volume.value() );
			ch1 = m_ch1Counter > m_wlen1 * ch1DutyCycle 
				? 0
				: ch1Level;
		}
		else ch1 = ch1Level = 0;
		
		// update sweep
		m_ch1SweepCounter++;
		if( m_ch1SweepCounter >= ch1SweepRate )
		{
			m_ch1SweepCounter = 0;
			if( m_parent->m_ch1SweepEnabled.value() && m_wlen1 <= m_maxWlen && m_wlen1 >= MIN_WLEN )
			{
				// check if the sweep goes up or down
				if( ch1Sweep > 0 )
				{
					m_wlen1 += m_wlen1 >> qAbs( ch1Sweep );
				}
				if( ch1Sweep < 0 )
				{
					m_wlen1 -= m_wlen1 >> qAbs( ch1Sweep );
					m_wlen1--;  // additional minus 1 for ch1 only
				}
			}
 void setType(EImageType type) { mType=type; updatePitch(); }
 void setFormat(EImageFormat format) { mFormat = format; updatePitch(); }
Пример #10
0
void KeyControl::slotPitchChanged(double pitch) {
    Q_UNUSED(pitch)
    m_updatePitchRequest = 1;
    updatePitch();
}