Skip to content
Merged

h #18

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4d9e5e3
Sampletrack activity indicator
serdnab Nov 5, 2019
caaeb62
Moved the activity indicator mute code to parent class
serdnab Nov 7, 2019
e056ecb
Added to sampletrackview the code needed for the activity indicator m…
serdnab Nov 8, 2019
229de18
Fixed triggering of stop animation when not playing
serdnab Nov 18, 2019
df3e388
Fix triggering of stop animation when playing no samples after stoppi…
serdnab Nov 19, 2019
2aea19f
Add "Open containing folder" (#5453)
michaelgregorius Apr 14, 2020
b85aef2
Code review changes
michaelgregorius Apr 19, 2020
c37fdd0
Code review changes (comment added)
michaelgregorius Apr 21, 2020
abcfee1
disable drag after drawing line (#5315)
tecknixia Apr 22, 2020
31996fe
Merge pull request #5454 from michaelgregorius/5453-OpenContainingFolder
michaelgregorius Apr 23, 2020
aec0dd3
If AutomationPattern has a single tick at 0, set it's length to 1 bar.
Veratil Apr 26, 2020
a4f6773
Add comments and reduce unnecessary code
Veratil Apr 26, 2020
9efb6f9
Merge pull request #5469 from Veratil/issue-5254
Spekular Apr 26, 2020
e199f72
Fix crash on drawing line on the end of a graph (#5471)
PhysSong Apr 28, 2020
7c2c77c
Mergefix
Spekular Apr 29, 2020
b46ea0e
refactor
Spekular Apr 29, 2020
5821466
Fix indicator in BB editor
Spekular Apr 29, 2020
c755b56
Piano roll vertical zoom (#5442)
akimaze Apr 30, 2020
ae2af96
Use nullptr instead of NULL
Spekular Apr 30, 2020
aaf94ef
Formatting chananges
Spekular Apr 30, 2020
0c180b8
Nicer spacing in activity indicator's setGeometry call
Spekular May 1, 2020
9ed5f80
Refactor palette update on un/mute
Spekular May 1, 2020
e643f83
Merge branch 'SampleIndicator' of https://github.com/Spekular/lmms in…
Spekular May 1, 2020
c18edd4
Use local cursor instead of global one in PianoRoll (#5200)
PhysSong May 3, 2020
6095bbc
Merge pull request #5477 from Spekular/SampleIndicator
Spekular May 4, 2020
1a6f4c1
Add option to move SideBar to right side of window (#5114)
Veratil May 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor
  • Loading branch information
Spekular committed Apr 29, 2020
commit b46ea0e9af5755c5305398adf763d7c2ae2688cc
2 changes: 1 addition & 1 deletion include/FadeButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class FadeButton : public QAbstractButton

public slots:
void activate();
void activateOnce();
void noteEnd();
void notPlaying();


protected:
Expand Down
16 changes: 8 additions & 8 deletions include/SampleTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,19 @@ class SampleTrack : public Track
return "sampletrack";
}

bool wasPlaying()
bool isPlaying()
{
return m_wasPlaying;
return m_isPlaying;
}

void setWasPlaying(bool wasPlaying)
void setPlaying(bool playing)
{
m_wasPlaying = wasPlaying;
if (m_isPlaying != playing) { emit playingChanged(); }
m_isPlaying = playing;
}

signals:
void playing();
void notPlaying();
void playingChanged();

public slots:
void updateTcos();
Expand All @@ -186,7 +186,7 @@ public slots:
FloatModel m_panningModel;
IntModel m_effectChannelModel;
AudioPort m_audioPort;
bool m_wasPlaying;
bool m_isPlaying;



Expand Down Expand Up @@ -225,7 +225,7 @@ class SampleTrackView : public TrackView

public slots:
void showEffects();
void stopPlaying();
void updateIndicator();


protected:
Expand Down
27 changes: 9 additions & 18 deletions src/gui/widgets/FadeButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ void FadeButton::activate()



void FadeButton::activateOnce()
{
if (activeNotes == 0) { activate(); }
}




void FadeButton::noteEnd()
{
if (activeNotes <= 0)
Expand All @@ -92,29 +100,12 @@ void FadeButton::noteEnd()
m_releaseTimer.restart();
}

signalUpdate();
}




void FadeButton::notPlaying()
{
activeNotes = 0;
m_releaseTimer.restart();
signalUpdate();
}




void FadeButton::customEvent(QEvent *)
{
update();
}




void FadeButton::paintEvent(QPaintEvent * _pe)
{
QColor col = m_normalColor;
Expand Down
59 changes: 19 additions & 40 deletions src/tracks/SampleTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ SampleTrack::SampleTrack( TrackContainer* tc ) :
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_wasPlaying(false)
m_isPlaying(false)
{
setName( tr( "Sample track" ) );
m_panningModel.setCenterValue( DefaultPanning );
Expand All @@ -618,27 +618,26 @@ 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;
bool nowPlaying = false;

tcoVector tcos;
::BBTrack * bb_track = NULL;
if( _tco_num >= 0 )
{
if (m_wasPlaying && _start > getTCO(_tco_num)->length())
if (_start > getTCO(_tco_num)->length())
{
m_wasPlaying = false;
emit notPlaying();
nowPlaying = false;
}
if( _start != 0 )
{
nowPlaying = false;
return false;
}
tcos.push_back( getTCO( _tco_num ) );
if (trackContainer() == (TrackContainer*)Engine::getBBTrackContainer())
{
bb_track = BBTrack::findBBTrack( _tco_num );
m_wasPlaying = true;
emit playing();
nowPlaying = true;
}
}
else
Expand All @@ -650,10 +649,6 @@ 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 ());
Expand All @@ -670,28 +665,18 @@ bool SampleTrack::play( const MidiTime & _start, const fpp_t _frames,
sTco->setSamplePlayLength( samplePlayLength );
tcos.push_back( sTco );
sTco->setIsPlaying( true );
is_playing = true;
nowPlaying = true;
}
}
}
else
{
sTco->setIsPlaying( false );
}
nowPlaying = nowPlaying || sTco->isPlaying();
}

if (is_playing && !m_wasPlaying)
{
m_wasPlaying = true;
emit playing();
}
else if (!is_playing && m_wasPlaying)
{
m_wasPlaying = false;
emit notPlaying();
}

}
setPlaying(nowPlaying);

for( tcoVector::Iterator it = tcos.begin(); it != tcos.end(); ++it )
{
Expand Down Expand Up @@ -861,10 +846,7 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) :
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(_t, SIGNAL(playingChanged()), this, SLOT(updateIndicator()));
connect(Engine::getSong(), SIGNAL(stopped()),
this, SLOT(stopPlaying()));

Expand All @@ -877,6 +859,15 @@ SampleTrackView::SampleTrackView( SampleTrack * _t, TrackContainerView* tcv ) :



void SampleTrackView::updateIndicator()
{
if (model()->isPlaying()) m_activityIndicator->activateOnce();
else { m_activityIndicator->noteEnd(); }
}




SampleTrackView::~SampleTrackView()
{
if(m_window != NULL)
Expand Down Expand Up @@ -982,18 +973,6 @@ 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(),
Expand Down