Beispiel #1
0
void VstEffect::openPlugin( const QString & _plugin )
{
	TextFloat * tf = TextFloat::displayMessage(
		VstPlugin::tr( "Loading plugin" ),
		VstPlugin::tr( "Please wait while loading VST plugin..." ),
			PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 );
	m_pluginMutex.lock();
	m_plugin = new VstPlugin( _plugin );
	if( m_plugin->failed() )
	{
		m_pluginMutex.unlock();
		closePlugin();
		delete tf;
		collectErrorForUI( VstPlugin::tr( "The VST plugin %1 could not be loaded." ).arg( _plugin ) );
		return;
	}

	VstPlugin::connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ), m_plugin, SLOT( setTempo( bpm_t ) ) );
	m_plugin->setTempo( Engine::getSong()->getTempo() );

	m_pluginMutex.unlock();

	delete tf;

	m_key.attributes["file"] = _plugin;
}
Beispiel #2
0
void VstEffect::openPlugin( const QString & _plugin )
{
	textFloat * tf = textFloat::displayMessage(
		VstPlugin::tr( "Loading plugin" ),
		VstPlugin::tr( "Please wait while loading VST plugin..." ),
			PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 );
	m_pluginMutex.lock();
	m_plugin = new VstPlugin( _plugin );
	if( m_plugin->failed() )
	{
		m_pluginMutex.unlock();
		closePlugin();
		delete tf;
		QMessageBox::information( NULL,
			VstPlugin::tr( "Failed loading VST plugin" ),
			VstPlugin::tr( "The VST plugin %1 could not be loaded for some reason." ).arg( _plugin ),
			QMessageBox::Ok );
		return;
	}

	VstPlugin::connect( engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ), m_plugin, SLOT( setTempo( bpm_t ) ) );
	m_plugin->setTempo( engine::getSong()->getTempo() );

	m_pluginMutex.unlock();

	delete tf;

	m_key.attributes["file"] = _plugin;
}
Beispiel #3
0
SampleTCO::SampleTCO( Track * _track ) :
	TrackContentObject( _track ),
	m_sampleBuffer( new SampleBuffer )
{
	saveJournallingState( false );
	setSampleFile( "" );
	restoreJournallingState();

	// we need to receive bpm-change-events, because then we have to
	// change length of this TCO
	connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ),
					this, SLOT( updateLength( bpm_t ) ) );
	switch( getTrack()->trackContainer()->type() )
	{
		case TrackContainer::BBContainer:
			setAutoResize( true );
			break;

		case TrackContainer::SongContainer:
			// move down
		default:
			setAutoResize( false );
			break;
	}
}
Beispiel #4
0
void TempoEdit::newValue(double val)
{
	if (val != curVal)
	{
		curVal = val;
		emit tempoChanged(curVal);
	}
}
Beispiel #5
0
void MidiSequencer::setTempoFactor(unsigned int value)
{
    float tempoFactor = (value*value + 100.0*value + 20000.0) / 40000.0;
    drumstick::QueueTempo queueTempo = m_queue->getTempo();
    queueTempo.setTempoFactor(tempoFactor);
    m_queue->setTempo(queueTempo);
    m_client->drainOutput();
    emit tempoChanged(queueTempo.getRealBPM());
}
Beispiel #6
0
//this is only called internally so it simply emits the value
void MasterView::setTempoDouble(double tempo){
	if(mRecursing)
		return;
	mRecursing = true;

	emit(tempoChanged(tempo));

	mRecursing = false;
}
Beispiel #7
0
void MidiSequencer::openFile(const QString &fileName)
{
    m_tick = 0;
    if (m_song) delete m_song;
    m_song = new Song();
    m_eventSchedulingMode = FROM_ENGINE;
    m_smfReader->readFromFile(fileName);
    emit tempoChanged(6.0e7f / m_song->initialTempo());
    m_song->sort();
    m_midiSequencerOutputThread->setSong(m_song);
}
Beispiel #8
0
sampleTCO::sampleTCO( track * _track ) :
	trackContentObject( _track ),
	m_sampleBuffer( new sampleBuffer )
{
	saveJournallingState( false );
	setSampleFile( "" );
	restoreJournallingState();

	// we need to receive bpm-change-events, because then we have to
	// change length of this TCO
	connect( engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ),
					this, SLOT( updateLength( bpm_t ) ) );
}
Beispiel #9
0
TempoSyncKnobModel::TempoSyncKnobModel( const float _val, const float _min,
				const float _max, const float _step,
				const float _scale, Model * _parent,
				const QString & _display_name ) :
	FloatModel( _val, _min, _max, _step, _parent, _display_name ),
	m_tempoSyncMode( SyncNone ),
	m_tempoLastSyncMode( SyncNone ),
	m_scale( _scale ),
	m_custom( _parent )
{
	connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ),
			this, SLOT( calculateTempoSyncTime( bpm_t ) ) );
}
Beispiel #10
0
SampleTCO::SampleTCO( Track * _track ) :
	TrackContentObject( _track ),
	m_sampleBuffer( new SampleBuffer ),
	m_isPlaying( false )
{
	saveJournallingState( false );
	setSampleFile( "" );
	restoreJournallingState();

	// we need to receive bpm-change-events, because then we have to
	// change length of this TCO
	connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ),
					this, SLOT( updateLength() ), Qt::DirectConnection );
	connect( Engine::getSong(), SIGNAL( timeSignatureChanged( int,int ) ),
					this, SLOT( updateLength() ) );

	//care about positionmarker
	TimeLineWidget * timeLine = Engine::getSong()->getPlayPos( Engine::getSong()->Mode_PlaySong ).m_timeLine;
	if( timeLine )
	{
		connect( timeLine, SIGNAL( positionMarkerMoved() ), this, SLOT( playbackPositionChanged() ) );
	}
	//playbutton clicked or space key / on Export Song set isPlaying to false
	connect( Engine::getSong(), SIGNAL( playbackStateChanged() ),
			this, SLOT( playbackPositionChanged() ), Qt::DirectConnection );
	//care about loops
	connect( Engine::getSong(), SIGNAL( updateSampleTracks() ),
			this, SLOT( playbackPositionChanged() ), Qt::DirectConnection );
	//care about mute TCOs
	connect( this, SIGNAL( dataChanged() ), this, SLOT( playbackPositionChanged() ) );
	//care about mute track
	connect( getTrack()->getMutedModel(), SIGNAL( dataChanged() ),
			this, SLOT( playbackPositionChanged() ), Qt::DirectConnection );
	//care about TCO position
	connect( this, SIGNAL( positionChanged() ), this, SLOT( updateTrackTcos() ) );

	switch( getTrack()->trackContainer()->type() )
	{
		case TrackContainer::BBContainer:
			setAutoResize( true );
			break;

		case TrackContainer::SongContainer:
			// move down
		default:
			setAutoResize( false );
			break;
	}
	updateTrackTcos();
}
Beispiel #11
0
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() ) );
}
Beispiel #12
0
MidiAlsaSeq::MidiAlsaSeq() :
	MidiClient(),
	m_seqMutex(),
	m_seqHandle( NULL ),
	m_queueID( -1 ),
	m_quit( false ),
	m_portListUpdateTimer( this )
{
	int err;
	if( ( err = snd_seq_open( &m_seqHandle,
					probeDevice().toLatin1().constData(),
						SND_SEQ_OPEN_DUPLEX, 0 ) ) < 0 )
	{
		fprintf( stderr, "cannot open sequencer: %s\n",
							snd_strerror( err ) );
		return;
	}
	snd_seq_set_client_name( m_seqHandle, "LMMS" );


	m_queueID = snd_seq_alloc_queue( m_seqHandle );
	snd_seq_queue_tempo_t * tempo;
	snd_seq_queue_tempo_malloc( &tempo );
	snd_seq_queue_tempo_set_tempo( tempo, 6000000 /
					Engine::getSong()->getTempo() );
	snd_seq_queue_tempo_set_ppq( tempo, 16 );
	snd_seq_set_queue_tempo( m_seqHandle, m_queueID, tempo );
	snd_seq_queue_tempo_free( tempo );

	snd_seq_start_queue( m_seqHandle, m_queueID, NULL );
	changeQueueTempo( Engine::getSong()->getTempo() );
	connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ),
			this, SLOT( changeQueueTempo( bpm_t ) ) );

	// initial list-update
	updatePortList();

	connect( &m_portListUpdateTimer, SIGNAL( timeout() ),
					this, SLOT( updatePortList() ) );
	// we check for port-changes every second
	m_portListUpdateTimer.start( 1000 );

	// use a pipe to detect shutdown
	if( pipe( m_pipe ) == -1 )
	{
		perror( __FILE__ ": pipe" );
	}

	start( QThread::IdlePriority );
}
Beispiel #13
0
Seq::Seq()
      {
      running         = false;
      playlistChanged = false;
      cs              = 0;
      cv              = 0;
      tackRest        = 0;
      tickRest        = 0;

      endTick  = 0;
      state    = TRANSPORT_STOP;
      oggInit  = false;
      _driver  = 0;
      playPos  = events.cbegin();

      playTime  = 0;
      metronomeVolume = 0.3;

      inCountIn         = false;
      countInPlayPos    = countInEvents.cbegin();
      countInPlayTime   = 0;

      meterValue[0]     = 0.0;
      meterValue[1]     = 0.0;
      meterPeakValue[0] = 0.0;
      meterPeakValue[1] = 0.0;
      peakTimer[0]       = 0;
      peakTimer[1]       = 0;

      heartBeatTimer = new QTimer(this);
      connect(heartBeatTimer, SIGNAL(timeout()), this, SLOT(heartBeatTimeout()));

      noteTimer = new QTimer(this);
      noteTimer->setSingleShot(true);
      connect(noteTimer, SIGNAL(timeout()), this, SLOT(stopNotes()));
      noteTimer->stop();

      connect(this, SIGNAL(toGui(int)), this, SLOT(seqMessage(int)), Qt::QueuedConnection);

      prevTimeSig.setNumerator(0);
      prevTempo = 0;
      connect(this, SIGNAL(timeSigChanged()),this,SLOT(handleTimeSigTempoChanged()));
      connect(this, SIGNAL(tempoChanged()),this,SLOT(handleTimeSigTempoChanged()));
      }
Beispiel #14
0
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() ) );
}
Beispiel #15
0
void song::setTempo()
{
	const bpm_t tempo = (bpm_t) m_tempoModel.value();
	engine::mixer()->lock();
	PlayHandleList & playHandles = engine::mixer()->playHandles();
	for( PlayHandleList::Iterator it = playHandles.begin();
						it != playHandles.end(); ++it )
	{
		NotePlayHandle * nph = dynamic_cast<NotePlayHandle *>( *it );
		if( nph && !nph->isReleased() )
		{
			nph->resize( tempo );
		}
	}
	engine::mixer()->unlock();

	engine::updateFramesPerTick();

	m_vstSyncController.setTempo( tempo );

	emit tempoChanged( tempo );
}
Beispiel #16
0
void TScale::leaveEvent(QEvent*)
{
	emit tempoChanged(-1);
}
Beispiel #17
0
void TScale::viewMouseMoveEvent(QMouseEvent* event)
{
	emit tempoChanged(280000 - event->y());
}