Merge branch 'stable-1.2'
# Conflicts: # include/MixerWorkerThread.h # src/core/MixerWorkerThread.cpp
This commit is contained in:
@@ -124,6 +124,8 @@ public:
|
||||
return m_writablePorts;
|
||||
}
|
||||
|
||||
void invalidateCilent();
|
||||
|
||||
MidiPortMenu* m_readablePortsMenu;
|
||||
MidiPortMenu* m_writablePortsMenu;
|
||||
|
||||
|
||||
@@ -47,10 +47,10 @@ public:
|
||||
Dynamic // jobs can be added while processing queue
|
||||
} ;
|
||||
|
||||
#define JOB_QUEUE_SIZE 1024
|
||||
#define JOB_QUEUE_SIZE 8192
|
||||
JobQueue() :
|
||||
m_items(),
|
||||
m_queueSize( 0 ),
|
||||
m_writeIndex( 0 ),
|
||||
m_itemsDone( 0 ),
|
||||
m_opMode( Static )
|
||||
{
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
|
||||
private:
|
||||
std::atomic<ThreadableJob*> m_items[JOB_QUEUE_SIZE];
|
||||
std::atomic_int m_queueSize;
|
||||
std::atomic_int m_writeIndex;
|
||||
std::atomic_int m_itemsDone;
|
||||
OperationMode m_opMode;
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ FlangerControls::FlangerControls( FlangerEffect *effect ) :
|
||||
|
||||
{
|
||||
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changedSampleRate() ) );
|
||||
connect( Engine::getSong(), SIGNAL( playbackStateChanged() ), this, SLOT( changedPlaybackState() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -81,3 +82,9 @@ void FlangerControls::changedSampleRate()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FlangerControls::changedPlaybackState()
|
||||
{
|
||||
m_effect->restartLFO();
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void changedSampleRate();
|
||||
void changedPlaybackState();
|
||||
|
||||
private:
|
||||
FlangerEffect* m_effect;
|
||||
|
||||
@@ -68,7 +68,7 @@ FlangerEffect::~FlangerEffect()
|
||||
{
|
||||
delete m_rDelay;
|
||||
}
|
||||
if(m_lfo )
|
||||
if( m_lfo )
|
||||
{
|
||||
delete m_lfo;
|
||||
}
|
||||
@@ -139,6 +139,15 @@ void FlangerEffect::changeSampleRate()
|
||||
|
||||
|
||||
|
||||
|
||||
void FlangerEffect::restartLFO()
|
||||
{
|
||||
m_lfo->restart();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
return &m_flangerControls;
|
||||
}
|
||||
void changeSampleRate();
|
||||
void restartLFO();
|
||||
|
||||
private:
|
||||
FlangerControls m_flangerControls;
|
||||
|
||||
@@ -53,6 +53,14 @@ public:
|
||||
|
||||
|
||||
|
||||
inline void restart()
|
||||
{
|
||||
m_phase = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline void setSampleRate ( int samplerate )
|
||||
{
|
||||
m_samplerate = samplerate;
|
||||
|
||||
@@ -292,9 +292,7 @@ void ConfigManager::setDefaultSoundfont( const QString & _sf )
|
||||
|
||||
void ConfigManager::setBackgroundArtwork( const QString & _ba )
|
||||
{
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
m_backgroundArtwork = _ba;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ConfigManager::setGIGDir(const QString &gd)
|
||||
|
||||
@@ -344,7 +344,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
|
||||
if( _n->origin() == NotePlayHandle::OriginArpeggio ||
|
||||
_n->origin() == NotePlayHandle::OriginNoteStacking ||
|
||||
!m_arpEnabledModel.value() ||
|
||||
( _n->isReleased() && _n->releaseFramesDone() >= _n->actualReleaseFramesToDo() ) )
|
||||
_n->isReleased() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -412,7 +412,6 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
|
||||
// Skip notes randomly
|
||||
if( m_arpSkipModel.value() )
|
||||
{
|
||||
|
||||
if( 100 * ( (float) rand() / (float)( RAND_MAX + 1.0f ) ) < m_arpSkipModel.value() )
|
||||
{
|
||||
// Set master note to prevent the note to extend over skipped notes
|
||||
@@ -501,12 +500,6 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
|
||||
continue;
|
||||
}
|
||||
|
||||
float vol_level = 1.0f;
|
||||
if( _n->isReleased() )
|
||||
{
|
||||
vol_level = _n->volumeLevel( cur_frame + gated_frames );
|
||||
}
|
||||
|
||||
// create new arp-note
|
||||
|
||||
// create sub-note-play-handle, only ptr to note is different
|
||||
@@ -515,7 +508,7 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
|
||||
NotePlayHandleManager::acquire( _n->instrumentTrack(),
|
||||
frames_processed,
|
||||
gated_frames,
|
||||
Note( MidiTime( 0 ), MidiTime( 0 ), sub_note_key, (volume_t) qRound( _n->getVolume() * vol_level ),
|
||||
Note( MidiTime( 0 ), MidiTime( 0 ), sub_note_key, _n->getVolume(),
|
||||
_n->getPanning(), _n->detuning() ),
|
||||
_n, -1, NotePlayHandle::OriginArpeggio )
|
||||
);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "MixerWorkerThread.h"
|
||||
|
||||
#include <xmmintrin.h>
|
||||
#include <QDebug>
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
|
||||
@@ -39,7 +40,7 @@ QList<MixerWorkerThread *> MixerWorkerThread::workerThreads;
|
||||
// implementation of internal JobQueue
|
||||
void MixerWorkerThread::JobQueue::reset( OperationMode _opMode )
|
||||
{
|
||||
m_queueSize = 0;
|
||||
m_writeIndex = 0;
|
||||
m_itemsDone = 0;
|
||||
m_opMode = _opMode;
|
||||
}
|
||||
@@ -54,7 +55,13 @@ void MixerWorkerThread::JobQueue::addJob( ThreadableJob * _job )
|
||||
// update job state
|
||||
_job->queue();
|
||||
// actually queue the job via atomic operations
|
||||
m_items[m_queueSize++] = _job;
|
||||
auto index = m_writeIndex++;
|
||||
if (index < JOB_QUEUE_SIZE) {
|
||||
m_items[index] = _job;
|
||||
} else {
|
||||
qWarning() << "Job queue is full!";
|
||||
++m_itemsDone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,10 +70,10 @@ void MixerWorkerThread::JobQueue::addJob( ThreadableJob * _job )
|
||||
void MixerWorkerThread::JobQueue::run()
|
||||
{
|
||||
bool processedJob = true;
|
||||
while (processedJob && m_itemsDone < m_queueSize)
|
||||
while (processedJob && m_itemsDone < m_writeIndex)
|
||||
{
|
||||
processedJob = false;
|
||||
for( int i = 0; i < m_queueSize; ++i )
|
||||
for( int i = 0; i < m_writeIndex && i < JOB_QUEUE_SIZE; ++i )
|
||||
{
|
||||
ThreadableJob * job = m_items[i].exchange(nullptr);
|
||||
if( job )
|
||||
@@ -86,7 +93,7 @@ void MixerWorkerThread::JobQueue::run()
|
||||
|
||||
void MixerWorkerThread::JobQueue::wait()
|
||||
{
|
||||
while (m_itemsDone < m_queueSize)
|
||||
while (m_itemsDone < m_writeIndex)
|
||||
{
|
||||
#if defined(LMMS_HOST_X86) || defined(LMMS_HOST_X86_64)
|
||||
_mm_pause();
|
||||
|
||||
@@ -143,7 +143,9 @@ void TrackContentObject::movePosition( const MidiTime & pos )
|
||||
{
|
||||
if( m_startPosition != pos )
|
||||
{
|
||||
Engine::mixer()->requestChangeInModel();
|
||||
m_startPosition = pos;
|
||||
Engine::mixer()->doneChangeInModel();
|
||||
Engine::getSong()->updateLength();
|
||||
emit positionChanged();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,10 @@ MidiClient::MidiClient()
|
||||
MidiClient::~MidiClient()
|
||||
{
|
||||
//TODO: noteOffAll(); / clear all ports
|
||||
for (MidiPort* port : m_midiPorts)
|
||||
{
|
||||
port->invalidateCilent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,9 +27,12 @@
|
||||
|
||||
#include "MidiPort.h"
|
||||
#include "MidiClient.h"
|
||||
#include "MidiDummy.h"
|
||||
#include "Note.h"
|
||||
#include "Song.h"
|
||||
|
||||
static MidiDummy s_dummyClient;
|
||||
|
||||
|
||||
|
||||
MidiPort::MidiPort( const QString& name,
|
||||
@@ -410,4 +413,7 @@ void MidiPort::updateOutputProgram()
|
||||
|
||||
|
||||
|
||||
|
||||
void MidiPort::invalidateCilent()
|
||||
{
|
||||
m_midiClient = &s_dummyClient;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RowTableView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>RowTableView.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
||||
@@ -1525,9 +1525,7 @@ void SetupDialog::setDefaultSoundfont( const QString & _sf )
|
||||
|
||||
void SetupDialog::setBackgroundArtwork( const QString & _ba )
|
||||
{
|
||||
#ifdef LMMS_HAVE_FLUIDSYNTH
|
||||
m_backgroundArtwork = _ba;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user