Merge branch 'stable-1.2'
This commit is contained in:
@@ -30,9 +30,6 @@
|
||||
#include "export.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
const int BM_INITIAL_BUFFERS = 512;
|
||||
//const int BM_INCREMENT = 64;
|
||||
|
||||
class EXPORT BufferManager
|
||||
{
|
||||
public:
|
||||
@@ -46,17 +43,6 @@ public:
|
||||
const f_cnt_t offset = 0 );
|
||||
#endif
|
||||
static void release( sampleFrame * buf );
|
||||
static void refresh();
|
||||
// static void extend( int c );
|
||||
|
||||
private:
|
||||
static sampleFrame ** s_available;
|
||||
static AtomicInt s_availableIndex;
|
||||
|
||||
static sampleFrame ** s_released;
|
||||
static AtomicInt s_releasedIndex;
|
||||
// static QReadWriteLock s_mutex;
|
||||
static int s_size;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,7 +39,9 @@ public:
|
||||
virtual ~ExportFilter() {}
|
||||
|
||||
|
||||
virtual bool tryExport( const TrackContainer::TrackList &tracks, int tempo, const QString &filename ) = 0;
|
||||
virtual bool tryExport(const TrackContainer::TrackList &tracks,
|
||||
const TrackContainer::TrackList &tracksBB,
|
||||
int tempo, int masterPitch, const QString &filename ) = 0;
|
||||
protected:
|
||||
|
||||
virtual void saveSettings( QDomDocument &, QDomElement & )
|
||||
|
||||
@@ -237,6 +237,7 @@ private:
|
||||
MidiPort m_midiPort;
|
||||
|
||||
NotePlayHandle* m_notes[NumKeys];
|
||||
NotePlayHandleList m_sustainedNotes;
|
||||
|
||||
int m_runningMidiNotes[NumKeys];
|
||||
QMutex m_midiNotesMutex;
|
||||
|
||||
@@ -25,13 +25,22 @@
|
||||
#ifndef MAINAPPLICATION_H
|
||||
#define MAINAPPLICATION_H
|
||||
|
||||
#include "lmmsconfig.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
class MainApplication : public QApplication
|
||||
{
|
||||
public:
|
||||
MainApplication(int& argc, char** argv);
|
||||
bool event(QEvent* event);
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
bool winEventFilter(MSG* msg, long* result);
|
||||
#endif
|
||||
inline QString& queuedFile()
|
||||
{
|
||||
return m_queuedFile;
|
||||
|
||||
@@ -249,11 +249,4 @@ signals:
|
||||
|
||||
} ;
|
||||
|
||||
class AutoSaveThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
void run();
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
class MemoryHelper {
|
||||
public:
|
||||
|
||||
static void* alignedMalloc( int );
|
||||
static void* alignedMalloc( size_t );
|
||||
|
||||
static void alignedFree( void* );
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ struct MemoryPool
|
||||
{
|
||||
void * m_pool;
|
||||
char * m_free;
|
||||
int m_chunks;
|
||||
size_t m_chunks;
|
||||
QMutex m_mutex;
|
||||
|
||||
MemoryPool() :
|
||||
@@ -51,10 +51,10 @@ struct MemoryPool
|
||||
m_chunks( 0 )
|
||||
{}
|
||||
|
||||
MemoryPool( int chunks ) :
|
||||
MemoryPool( size_t chunks ) :
|
||||
m_chunks( chunks )
|
||||
{
|
||||
m_free = (char*) MemoryHelper::alignedMalloc( chunks );
|
||||
m_free = reinterpret_cast<char*>( MemoryHelper::alignedMalloc( chunks ) );
|
||||
memset( m_free, 1, chunks );
|
||||
}
|
||||
|
||||
@@ -103,6 +103,25 @@ private:
|
||||
static QMutex s_pointerMutex;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct MmAllocator
|
||||
{
|
||||
typedef T value_type;
|
||||
template<class U> struct rebind { typedef MmAllocator<U> other; };
|
||||
|
||||
T* allocate( std::size_t n )
|
||||
{
|
||||
return reinterpret_cast<T*>( MemoryManager::alloc( sizeof(T) * n ) );
|
||||
}
|
||||
|
||||
void deallocate( T* p, std::size_t )
|
||||
{
|
||||
MemoryManager::free( p );
|
||||
}
|
||||
|
||||
typedef std::vector<T, MmAllocator<T> > vector;
|
||||
};
|
||||
|
||||
|
||||
#define MM_OPERATORS \
|
||||
public: \
|
||||
@@ -124,7 +143,7 @@ static void operator delete[] ( void * ptr ) \
|
||||
}
|
||||
|
||||
// for use in cases where overriding new/delete isn't a possibility
|
||||
#define MM_ALLOC( type, count ) (type*) MemoryManager::alloc( sizeof( type ) * count )
|
||||
#define MM_ALLOC( type, count ) reinterpret_cast<type*>( MemoryManager::alloc( sizeof( type ) * count ) )
|
||||
// and just for symmetry...
|
||||
#define MM_FREE( ptr ) MemoryManager::free( ptr )
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMutex>
|
||||
|
||||
#include "MemoryManager.h"
|
||||
|
||||
#include "ThreadableJob.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
@@ -142,20 +144,17 @@ public:
|
||||
|
||||
void releaseBuffer();
|
||||
|
||||
sampleFrame * buffer()
|
||||
{
|
||||
return m_playHandleBuffer;
|
||||
}
|
||||
sampleFrame * buffer();
|
||||
|
||||
private:
|
||||
Type m_type;
|
||||
f_cnt_t m_offset;
|
||||
QThread* m_affinity;
|
||||
QMutex m_processingLock;
|
||||
sampleFrame * m_playHandleBuffer;
|
||||
sampleFrame* m_playHandleBuffer;
|
||||
bool m_bufferReleased;
|
||||
bool m_usesBuffer;
|
||||
AudioPort * m_audioPort;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -621,6 +621,11 @@ public:
|
||||
fetchAndProcessNextMessage();
|
||||
}
|
||||
}
|
||||
|
||||
static bool isMainThreadWaiting()
|
||||
{
|
||||
return waitDepthCounter() > 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual bool processMessage( const message & _m ) = 0;
|
||||
@@ -657,6 +662,14 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
#ifndef BUILD_REMOTE_PLUGIN_CLIENT
|
||||
static int & waitDepthCounter()
|
||||
{
|
||||
static int waitDepth = 0;
|
||||
return waitDepth;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SYNC_WITH_SHM_FIFO
|
||||
shmFifo * m_in;
|
||||
shmFifo * m_out;
|
||||
@@ -1089,6 +1102,26 @@ RemotePluginBase::message RemotePluginBase::waitForMessage(
|
||||
_busy_waiting = QThread::currentThread() ==
|
||||
QCoreApplication::instance()->thread();
|
||||
}
|
||||
|
||||
struct WaitDepthCounter
|
||||
{
|
||||
WaitDepthCounter( int & depth, bool busy ) :
|
||||
m_depth( depth ),
|
||||
m_busy( busy )
|
||||
{
|
||||
if( m_busy ) { ++m_depth; }
|
||||
}
|
||||
|
||||
~WaitDepthCounter()
|
||||
{
|
||||
if( m_busy ) { --m_depth; }
|
||||
}
|
||||
|
||||
int & m_depth;
|
||||
bool m_busy;
|
||||
};
|
||||
|
||||
WaitDepthCounter wdc( waitDepthCounter(), _busy_waiting );
|
||||
#endif
|
||||
while( !isInvalid() )
|
||||
{
|
||||
|
||||
@@ -101,6 +101,7 @@ const int effEditOpen = 14;
|
||||
const int effEditClose = 15;
|
||||
const int effEditIdle = 19;
|
||||
const int effEditTop = 20;
|
||||
const int effSetChunk = 24;
|
||||
const int effProcessEvents = 25;
|
||||
const int effGetEffectName = 45;
|
||||
const int effGetVendorString = 47;
|
||||
|
||||
Reference in New Issue
Block a user