Mergefix
This commit is contained in:
@@ -47,6 +47,7 @@ public:
|
||||
public slots:
|
||||
void activate();
|
||||
void noteEnd();
|
||||
void notPlaying();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@@ -333,7 +333,6 @@ private slots:
|
||||
void midiInSelected();
|
||||
void midiOutSelected();
|
||||
void midiConfigChanged();
|
||||
void muteChanged();
|
||||
|
||||
void assignFxLine( int channelIndex );
|
||||
void createFxLine();
|
||||
@@ -357,6 +356,10 @@ private:
|
||||
|
||||
QPoint m_lastPos;
|
||||
|
||||
FadeButton * getActivityIndicator()
|
||||
{
|
||||
return m_activityIndicator;
|
||||
}
|
||||
|
||||
friend class InstrumentTrackWindow;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QLayout>
|
||||
|
||||
#include "AudioPort.h"
|
||||
#include "FadeButton.h"
|
||||
#include "FxMixer.h"
|
||||
#include "FxLineLcdSpinBox.h"
|
||||
#include "Track.h"
|
||||
@@ -161,6 +162,20 @@ public:
|
||||
return "sampletrack";
|
||||
}
|
||||
|
||||
bool wasPlaying()
|
||||
{
|
||||
return m_wasPlaying;
|
||||
}
|
||||
|
||||
void setWasPlaying(bool wasPlaying)
|
||||
{
|
||||
m_wasPlaying = wasPlaying;
|
||||
}
|
||||
|
||||
signals:
|
||||
void playing();
|
||||
void notPlaying();
|
||||
|
||||
public slots:
|
||||
void updateTcos();
|
||||
void setPlayingTcos( bool isPlaying );
|
||||
@@ -171,6 +186,7 @@ private:
|
||||
FloatModel m_panningModel;
|
||||
IntModel m_effectChannelModel;
|
||||
AudioPort m_audioPort;
|
||||
bool m_wasPlaying;
|
||||
|
||||
|
||||
|
||||
@@ -209,6 +225,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void showEffects();
|
||||
void stopPlaying();
|
||||
|
||||
|
||||
protected:
|
||||
@@ -230,9 +247,14 @@ private:
|
||||
SampleTrackWindow * m_window;
|
||||
Knob * m_volumeKnob;
|
||||
Knob * m_panningKnob;
|
||||
FadeButton * m_activityIndicator;
|
||||
|
||||
TrackLabelButton * m_tlb;
|
||||
|
||||
FadeButton * getActivityIndicator()
|
||||
{
|
||||
return m_activityIndicator;
|
||||
}
|
||||
|
||||
friend class SampleTrackWindow;
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "AutomatableModel.h"
|
||||
#include "ModelView.h"
|
||||
#include "DataFile.h"
|
||||
#include "FadeButton.h"
|
||||
|
||||
|
||||
class QMenu;
|
||||
@@ -739,12 +740,17 @@ private:
|
||||
|
||||
Actions m_action;
|
||||
|
||||
virtual FadeButton * getActivityIndicator()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
friend class TrackLabelButton;
|
||||
|
||||
|
||||
private slots:
|
||||
void createTCOView( TrackContentObject * tco );
|
||||
void muteChanged ();
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -2719,6 +2719,9 @@ TrackView::TrackView( Track * track, TrackContainerView * tcv ) :
|
||||
connect( &m_track->m_mutedModel, SIGNAL( dataChanged() ),
|
||||
&m_trackContentWidget, SLOT( update() ) );
|
||||
|
||||
connect(&m_track->m_mutedModel, SIGNAL(dataChanged()),
|
||||
this, SLOT(muteChanged()));
|
||||
|
||||
connect( &m_track->m_soloModel, SIGNAL( dataChanged() ),
|
||||
m_track, SLOT( toggleSolo() ), Qt::DirectConnection );
|
||||
// create views for already existing TCOs
|
||||
@@ -3051,3 +3054,25 @@ void TrackView::createTCOView( TrackContentObject * tco )
|
||||
}
|
||||
tco->selectViewOnCreate( false );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TrackView::muteChanged()
|
||||
{
|
||||
FadeButton * actind = getActivityIndicator();
|
||||
if (actind)
|
||||
{
|
||||
if (m_track->m_mutedModel.value())
|
||||
{
|
||||
actind->setActiveColor(QApplication::palette().color(
|
||||
QPalette::Active,
|
||||
QPalette::Highlight));
|
||||
} else
|
||||
{
|
||||
actind->setActiveColor(QApplication::palette().color(
|
||||
QPalette::Active,
|
||||
QPalette::BrightText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* FadeButton.cpp - implementation of fade-button
|
||||
*
|
||||
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -21,7 +21,7 @@
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <QTimer>
|
||||
#include <QPainter>
|
||||
@@ -92,6 +92,24 @@ void FadeButton::noteEnd()
|
||||
m_releaseTimer.restart();
|
||||
}
|
||||
|
||||
signalUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FadeButton::notPlaying()
|
||||
{
|
||||
activeNotes = 0;
|
||||
m_releaseTimer.restart();
|
||||
signalUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FadeButton::customEvent(QEvent *)
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -145,7 +163,7 @@ QColor FadeButton::fadeToColor(QColor startCol, QColor endCol, QTime timer, floa
|
||||
QColor col;
|
||||
|
||||
const float state = 1 - timer.elapsed() / duration;
|
||||
const int r = (int)(endCol.red() * (1.0f - state)
|
||||
const int r = (int)(endCol.red() * (1.0f - state)
|
||||
+ startCol.red() * state);
|
||||
const int g = (int)(endCol.green() * (1.0f - state)
|
||||
+ startCol.green() * state);
|
||||
|
||||
@@ -996,7 +996,6 @@ InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerV
|
||||
m_activityIndicator, SLOT( activate() ) );
|
||||
connect( _it, SIGNAL( endNote() ),
|
||||
m_activityIndicator, SLOT( noteEnd() ) );
|
||||
connect( &_it->m_mutedModel, SIGNAL( dataChanged() ), this, SLOT( muteChanged() ) );
|
||||
|
||||
setModel( _it );
|
||||
}
|
||||
@@ -1225,22 +1224,6 @@ void InstrumentTrackView::midiConfigChanged()
|
||||
|
||||
|
||||
|
||||
void InstrumentTrackView::muteChanged()
|
||||
{
|
||||
if(model()->m_mutedModel.value() )
|
||||
{
|
||||
m_activityIndicator->setActiveColor( QApplication::palette().color( QPalette::Active,
|
||||
QPalette::Highlight ) );
|
||||
} else
|
||||
{
|
||||
m_activityIndicator->setActiveColor( QApplication::palette().color( QPalette::Active,
|
||||
QPalette::BrightText ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//FIXME: This is identical to SampleTrackView::createFxMenu
|
||||
QMenu * InstrumentTrackView::createFxMenu(QString title, QString newFxLabel)
|
||||
{
|
||||
|
||||
@@ -592,7 +592,8 @@ SampleTrack::SampleTrack( TrackContainer* tc ) :
|
||||
m_panningModel( DefaultPanning, PanningLeft, PanningRight, 0.1f,
|
||||
this, tr( "Panning" ) ),
|
||||
m_effectChannelModel( 0, 0, 0, this, tr( "FX channel" ) ),
|
||||
m_audioPort( tr( "Sample track" ), true, &m_volumeModel, &m_panningModel, &m_mutedModel )
|
||||
m_audioPort( tr( "Sample track" ), true, &m_volumeModel, &m_panningModel, &m_mutedModel ),
|
||||
m_wasPlaying(false)
|
||||
{
|
||||
setName( tr( "Sample track" ) );
|
||||
m_panningModel.setCenterValue( DefaultPanning );
|
||||
@@ -617,11 +618,17 @@ bool SampleTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
{
|
||||
m_audioPort.effects()->startRunning();
|
||||
bool played_a_note = false; // will be return variable
|
||||
bool is_playing = false;
|
||||
|
||||
tcoVector tcos;
|
||||
::BBTrack * bb_track = NULL;
|
||||
if( _tco_num >= 0 )
|
||||
{
|
||||
if (m_wasPlaying && _start > getTCO(_tco_num)->length())
|
||||
{
|
||||
m_wasPlaying = false;
|
||||
emit notPlaying();
|
||||
}
|
||||
if( _start != 0 )
|
||||
{
|
||||
return false;
|
||||
@@ -630,6 +637,8 @@ bool SampleTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
if (trackContainer() == (TrackContainer*)Engine::getBBTrackContainer())
|
||||
{
|
||||
bb_track = BBTrack::findBBTrack( _tco_num );
|
||||
m_wasPlaying = true;
|
||||
emit playing();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -641,6 +650,10 @@ bool SampleTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
|
||||
if( _start >= sTco->startPosition() && _start < sTco->endPosition() )
|
||||
{
|
||||
if (sTco->isPlaying())
|
||||
{
|
||||
is_playing = true;
|
||||
}
|
||||
if( sTco->isPlaying() == false && _start > sTco->startPosition() + sTco->startTimeOffset() )
|
||||
{
|
||||
auto bufferFramesPerTick = Engine::framesPerTick (sTco->sampleBuffer ()->sampleRate ());
|
||||
@@ -657,6 +670,7 @@ bool SampleTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
sTco->setSamplePlayLength( samplePlayLength );
|
||||
tcos.push_back( sTco );
|
||||
sTco->setIsPlaying( true );
|
||||
is_playing = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -665,6 +679,18 @@ bool SampleTrack::play( const MidiTime & _start, const fpp_t _frames,
|
||||
sTco->setIsPlaying( false );
|
||||
}
|
||||
}
|
||||
|
||||
if (is_playing && !m_wasPlaying)
|
||||
{
|
||||
m_wasPlaying = true;
|
||||
emit playing();
|
||||
}
|
||||
else if (!is_playing && m_wasPlaying)
|
||||
{
|
||||
m_wasPlaying = false;
|
||||
emit notPlaying();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for( tcoVector::Iterator it = tcos.begin(); it != tcos.end(); ++it )
|
||||
@@ -826,6 +852,22 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) :
|
||||
m_panningKnob->setLabel( tr( "PAN" ) );
|
||||
m_panningKnob->show();
|
||||
|
||||
m_activityIndicator = new FadeButton(QApplication::palette().color(QPalette::Active,
|
||||
QPalette::Background),
|
||||
QApplication::palette().color(QPalette::Active,
|
||||
QPalette::BrightText),
|
||||
QApplication::palette().color(QPalette::Active,
|
||||
QPalette::BrightText).darker(),
|
||||
getTrackSettingsWidget());
|
||||
m_activityIndicator->setGeometry(settingsWidgetWidth-2*24-11, 2, 8, 28);
|
||||
m_activityIndicator->show();
|
||||
connect(_t, SIGNAL(playing()),
|
||||
m_activityIndicator, SLOT(activate()));
|
||||
connect(_t, SIGNAL(notPlaying()),
|
||||
m_activityIndicator, SLOT(notPlaying()));
|
||||
connect(Engine::getSong(), SIGNAL(stopped()),
|
||||
this, SLOT(stopPlaying()));
|
||||
|
||||
setModel( _t );
|
||||
|
||||
m_window = new SampleTrackWindow(this);
|
||||
@@ -940,6 +982,18 @@ void SampleTrackView::dropEvent(QDropEvent *de)
|
||||
|
||||
|
||||
|
||||
void SampleTrackView::stopPlaying()
|
||||
{
|
||||
SampleTrack * smpltrck = dynamic_cast<SampleTrack*>(getTrack());
|
||||
if (smpltrck->wasPlaying())
|
||||
{
|
||||
m_activityIndicator->notPlaying();
|
||||
smpltrck->setWasPlaying(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
|
||||
QWidget(),
|
||||
|
||||
Reference in New Issue
Block a user