Some #include cleanups
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
#ifndef AUTOMATABLE_MODEL_H
|
||||
#define AUTOMATABLE_MODEL_H
|
||||
|
||||
#include "lmms_math.h"
|
||||
#include <QtCore/QMutex>
|
||||
|
||||
#include "JournallingObject.h"
|
||||
@@ -174,7 +173,7 @@ public:
|
||||
{
|
||||
return castValue<T>( m_step );
|
||||
}
|
||||
|
||||
|
||||
//! @brief Returns value scaled with the scale type and min/max values of this model
|
||||
float scaledValue( float value ) const;
|
||||
//! @brief Returns value applied with the inverse of this model's scale type
|
||||
@@ -265,22 +264,22 @@ public:
|
||||
}
|
||||
|
||||
float globalAutomationValueAt( const MidiTime& time );
|
||||
|
||||
|
||||
bool hasStrictStepSize() const
|
||||
{
|
||||
return m_hasStrictStepSize;
|
||||
}
|
||||
|
||||
|
||||
void setStrictStepSize( const bool b )
|
||||
{
|
||||
m_hasStrictStepSize = b;
|
||||
}
|
||||
|
||||
|
||||
static void incrementPeriodCounter()
|
||||
{
|
||||
++s_periodCounter;
|
||||
}
|
||||
|
||||
|
||||
static void resetPeriodCounter()
|
||||
{
|
||||
s_periodCounter = 0;
|
||||
@@ -333,13 +332,13 @@ private:
|
||||
float m_step;
|
||||
float m_range;
|
||||
float m_centerValue;
|
||||
|
||||
|
||||
bool m_valueChanged;
|
||||
|
||||
// currently unused?
|
||||
float m_oldValue;
|
||||
int m_setValueDepth;
|
||||
|
||||
|
||||
// used to determine if step size should be applied strictly (ie. always)
|
||||
// or only when value set from gui (default)
|
||||
bool m_hasStrictStepSize;
|
||||
@@ -357,9 +356,9 @@ private:
|
||||
ValueBuffer m_valueBuffer;
|
||||
long m_lastUpdatedPeriod;
|
||||
static long s_periodCounter;
|
||||
|
||||
|
||||
bool m_hasSampleExactData;
|
||||
|
||||
|
||||
// prevent several threads from attempting to write the same vb at the same time
|
||||
QMutex m_valueBufferMutex;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#define BB_TRACK_CONTAINER_H
|
||||
|
||||
#include "TrackContainer.h"
|
||||
#include "ComboBox.h"
|
||||
#include "ComboBoxModel.h"
|
||||
|
||||
|
||||
class EXPORT BBTrackContainer : public TrackContainer
|
||||
|
||||
@@ -26,11 +26,9 @@
|
||||
#ifndef BANDLIMITEDWAVE_H
|
||||
#define BANDLIMITEDWAVE_H
|
||||
|
||||
#include <QString>
|
||||
#include <QDataStream>
|
||||
#include <QFile>
|
||||
class QDataStream;
|
||||
class QString;
|
||||
|
||||
#include "ConfigManager.h"
|
||||
#include "export.h"
|
||||
#include "interpolation.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
@@ -22,17 +22,14 @@
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BUFFER_MANAGER_H
|
||||
#define BUFFER_MANAGER_H
|
||||
|
||||
#include "MemoryManager.h"
|
||||
#include "export.h"
|
||||
#include "lmms_basics.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include <QtCore/QAtomicInt>
|
||||
#include <QtCore/QReadWriteLock>
|
||||
|
||||
class QAtomicInt;
|
||||
|
||||
const int BM_INITIAL_BUFFERS = 512;
|
||||
//const int BM_INCREMENT = 64;
|
||||
@@ -45,11 +42,11 @@ public:
|
||||
static void release( sampleFrame * buf );
|
||||
static void refresh();
|
||||
// static void extend( int c );
|
||||
|
||||
|
||||
private:
|
||||
static sampleFrame ** s_available;
|
||||
static QAtomicInt s_availableIndex;
|
||||
|
||||
|
||||
static sampleFrame ** s_released;
|
||||
static QAtomicInt s_releasedIndex;
|
||||
// static QReadWriteLock s_mutex;
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <QtCore/QPair>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
#include "templates.h"
|
||||
|
||||
class PixmapLoader;
|
||||
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
#define DATA_FILE_H
|
||||
|
||||
#include <QDomDocument>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "export.h"
|
||||
#include "lmms_basics.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
class QTextStream;
|
||||
|
||||
class EXPORT DataFile : public QDomDocument
|
||||
{
|
||||
MM_OPERATORS
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 1998-2000 Paul Kellett (mda-vst.com)
|
||||
* Copyright (c) 2007 Paul Giblock <drfaygo/at/gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -42,11 +42,11 @@ class DrumSynth {
|
||||
void GetEnv(int env, const char *sec, const char *key, const char *ini);
|
||||
|
||||
float waveform(float ph, int form);
|
||||
|
||||
|
||||
int GetPrivateProfileString(const char *sec, const char *key, const char *def, char *buffer, int size, const char *file);
|
||||
int GetPrivateProfileInt(const char *sec, const char *key, int def, const char *file);
|
||||
float GetPrivateProfileFloat(const char *sec, const char *key, float def, const char *file);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -26,28 +26,17 @@
|
||||
#ifndef ENGINE_H
|
||||
#define ENGINE_H
|
||||
|
||||
#include "lmmsconfig.h"
|
||||
#include "MemoryManager.h"
|
||||
|
||||
#include <QtCore/QMap>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
class AutomationEditorWindow;
|
||||
class BBEditor;
|
||||
class BBTrackContainer;
|
||||
class DummyTrackContainer;
|
||||
class FxMixer;
|
||||
class FxMixerView;
|
||||
class ProjectJournal;
|
||||
class MainWindow;
|
||||
class Mixer;
|
||||
class PianoRollWindow;
|
||||
class ProjectNotes;
|
||||
class Song;
|
||||
class SongEditorWindow;
|
||||
class Ladspa2LMMS;
|
||||
class ControllerRackView;
|
||||
|
||||
|
||||
class EXPORT Engine
|
||||
|
||||
@@ -26,17 +26,18 @@
|
||||
#ifndef INSTRUMENT_H
|
||||
#define INSTRUMENT_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
#include "export.h"
|
||||
#include "lmms_basics.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "MidiTime.h"
|
||||
#include "Plugin.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
|
||||
// forward-declarations
|
||||
class InstrumentTrack;
|
||||
class InstrumentView;
|
||||
class MidiEvent;
|
||||
class MidiTime;
|
||||
class NotePlayHandle;
|
||||
class Track;
|
||||
|
||||
|
||||
@@ -28,11 +28,12 @@
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QMutex>
|
||||
#include <QtCore/QReadWriteLock>
|
||||
#include <QtCore/QHash>
|
||||
#include "MemoryHelper.h"
|
||||
#include "export.h"
|
||||
|
||||
class QReadWriteLock;
|
||||
|
||||
const int MM_CHUNK_SIZE = 64; // granularity of managed memory
|
||||
const int MM_INITIAL_CHUNKS = 1024 * 1024; // how many chunks to allocate at startup - TODO: make configurable
|
||||
const int MM_INCREMENT_CHUNKS = 16 * 1024; // min. amount of chunks to increment at a time
|
||||
|
||||
@@ -28,15 +28,9 @@
|
||||
#include <QtCore/QAtomicPointer>
|
||||
#include <QtCore/QThread>
|
||||
|
||||
#include "ThreadableJob.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
#ifdef __SSE__
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
#ifdef __SSE3__
|
||||
#include <pmmintrin.h>
|
||||
#endif
|
||||
class QWaitCondition;
|
||||
class Mixer;
|
||||
class ThreadableJob;
|
||||
|
||||
class MixerWorkerThread : public QThread
|
||||
{
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#ifndef MODEL_H
|
||||
#define MODEL_H
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
#include "export.h"
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#ifndef MODEL_VIEW_H
|
||||
#define MODEL_VIEW_H
|
||||
|
||||
#include <QtCore/QPointer>
|
||||
#include "Model.h"
|
||||
|
||||
|
||||
|
||||
@@ -26,14 +26,13 @@
|
||||
#ifndef NOTE_PLAY_HANDLE_H
|
||||
#define NOTE_PLAY_HANDLE_H
|
||||
|
||||
#include "lmmsconfig.h"
|
||||
#include "Note.h"
|
||||
#include "PlayHandle.h"
|
||||
#include "Track.h"
|
||||
#include "MemoryManager.h"
|
||||
#include <QtCore/QAtomicInt>
|
||||
#include <QtCore/QReadWriteLock>
|
||||
|
||||
class QAtomicInt;
|
||||
class QReadWriteLock;
|
||||
class InstrumentTrack;
|
||||
class NotePlayHandle;
|
||||
|
||||
@@ -59,7 +58,7 @@ public:
|
||||
OriginCount
|
||||
};
|
||||
typedef Origins Origin;
|
||||
|
||||
|
||||
NotePlayHandle( InstrumentTrack* instrumentTrack,
|
||||
const f_cnt_t offset,
|
||||
const f_cnt_t frames,
|
||||
@@ -83,9 +82,9 @@ public:
|
||||
{
|
||||
return m_midiChannel;
|
||||
}
|
||||
|
||||
|
||||
/*! convenience function that returns offset for the first period and zero otherwise,
|
||||
used by instruments to handle the offset: instruments have to check this property and
|
||||
used by instruments to handle the offset: instruments have to check this property and
|
||||
add the correct number of empty frames in the beginning of the period */
|
||||
f_cnt_t noteOffset() const
|
||||
{
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
#include "SampleBuffer.h"
|
||||
#include "lmms_constants.h"
|
||||
|
||||
|
||||
class SampleBuffer;
|
||||
class IntModel;
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#ifndef FFT_HELPERS_H
|
||||
#define FFT_HELPERS_H
|
||||
|
||||
#include "lmmsconfig.h"
|
||||
#include "export.h"
|
||||
|
||||
#include <fftw3.h>
|
||||
|
||||
@@ -22,9 +22,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <QDomElement>
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
|
||||
#include "AutomationPattern.h"
|
||||
#include "ControllerConnection.h"
|
||||
#include "lmms_math.h"
|
||||
@@ -75,7 +74,7 @@ AutomatableModel::~AutomatableModel()
|
||||
{
|
||||
delete m_controllerConnection;
|
||||
}
|
||||
|
||||
|
||||
m_valueBuffer.clear();
|
||||
|
||||
emit destroyed( id() );
|
||||
@@ -171,7 +170,7 @@ void AutomatableModel::loadSettings( const QDomElement& element, const QString&
|
||||
//m_controllerConnection->setTargetName( displayName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// models can be stored as elements (port00) or attributes (port10):
|
||||
// <ladspacontrols port10="4.41">
|
||||
// <port00 value="4.41" id="4249278"/>
|
||||
@@ -566,7 +565,7 @@ ValueBuffer * AutomatableModel::valueBuffer()
|
||||
}
|
||||
}
|
||||
AutomatableModel* lm = NULL;
|
||||
if( m_hasLinkedModels )
|
||||
if( m_hasLinkedModels )
|
||||
{
|
||||
lm = m_linkedModels.first();
|
||||
}
|
||||
@@ -583,7 +582,7 @@ ValueBuffer * AutomatableModel::valueBuffer()
|
||||
m_hasSampleExactData = true;
|
||||
return &m_valueBuffer;
|
||||
}
|
||||
|
||||
|
||||
if( m_oldValue != val )
|
||||
{
|
||||
m_valueBuffer.interpolate( m_oldValue, val );
|
||||
@@ -592,7 +591,7 @@ ValueBuffer * AutomatableModel::valueBuffer()
|
||||
m_hasSampleExactData = true;
|
||||
return &m_valueBuffer;
|
||||
}
|
||||
|
||||
|
||||
// if we have no sample-exact source for a ValueBuffer, return NULL to signify that no data is available at the moment
|
||||
// in which case the recipient knows to use the static value() instead
|
||||
m_lastUpdatedPeriod = s_periodCounter;
|
||||
@@ -667,11 +666,11 @@ float AutomatableModel::globalAutomationValueAt( const MidiTime& time )
|
||||
{
|
||||
int s = ( *it )->startPosition();
|
||||
int e = ( *it )->endPosition();
|
||||
if( s <= time && e >= time ) { patternsInRange += ( *it ); }
|
||||
if( s <= time && e >= time ) { patternsInRange += ( *it ); }
|
||||
}
|
||||
|
||||
|
||||
AutomationPattern * latestPattern = NULL;
|
||||
|
||||
|
||||
if( ! patternsInRange.isEmpty() )
|
||||
{
|
||||
// if there are more than one overlapping patterns, just use the first one because
|
||||
@@ -682,7 +681,7 @@ float AutomatableModel::globalAutomationValueAt( const MidiTime& time )
|
||||
// if we find no patterns at the exact miditime, we need to search for the last pattern before time and use that
|
||||
{
|
||||
int latestPosition = 0;
|
||||
|
||||
|
||||
for( QVector<AutomationPattern *>::ConstIterator it = patterns.begin(); it != patterns.end(); it++ )
|
||||
{
|
||||
int e = ( *it )->endPosition();
|
||||
@@ -693,7 +692,7 @@ float AutomatableModel::globalAutomationValueAt( const MidiTime& time )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( latestPattern )
|
||||
{
|
||||
// scale/fit the value appropriately and return it
|
||||
@@ -701,7 +700,7 @@ float AutomatableModel::globalAutomationValueAt( const MidiTime& time )
|
||||
const float scaled_value = scaledValue( value );
|
||||
return fittedValue( scaled_value );
|
||||
}
|
||||
// if we still find no pattern, the value at that time is undefined so
|
||||
// if we still find no pattern, the value at that time is undefined so
|
||||
// just return current value as the best we can do
|
||||
else return m_value;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <QDomElement>
|
||||
|
||||
#include "AutomationPattern.h"
|
||||
|
||||
#include "AutomationPatternView.h"
|
||||
#include "AutomationTrack.h"
|
||||
#include "ProjectJournal.h"
|
||||
@@ -192,7 +191,7 @@ const AutomatableModel * AutomationPattern::firstObject() const
|
||||
MidiTime AutomationPattern::length() const
|
||||
{
|
||||
if( m_timeMap.isEmpty() ) return 0;
|
||||
timeMap::const_iterator it = m_timeMap.end();
|
||||
timeMap::const_iterator it = m_timeMap.end();
|
||||
return MidiTime( qMax( MidiTime( (it-1).key() ).getTact() + 1, 1 ), 0 );
|
||||
}
|
||||
|
||||
@@ -412,7 +411,7 @@ void AutomationPattern::flipY( int min, int max )
|
||||
{
|
||||
numPoints++;
|
||||
}
|
||||
|
||||
|
||||
for( int i = 0; i <= numPoints; i++ )
|
||||
{
|
||||
|
||||
@@ -501,7 +500,7 @@ void AutomationPattern::flipX( int length )
|
||||
tempMap[newTime] = tempValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_timeMap.clear();
|
||||
|
||||
m_timeMap = tempMap;
|
||||
@@ -617,7 +616,7 @@ void AutomationPattern::processMidiTime( const MidiTime & time )
|
||||
( *it )->setAutomatedValue( val );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -625,7 +624,7 @@ void AutomationPattern::processMidiTime( const MidiTime & time )
|
||||
if( time >= 0 && ! m_objects.isEmpty() )
|
||||
{
|
||||
const float value = static_cast<float>( firstObject()->value<float>() );
|
||||
if( value != m_lastRecordedValue )
|
||||
if( value != m_lastRecordedValue )
|
||||
{
|
||||
putValue( time, value, true );
|
||||
m_lastRecordedValue = value;
|
||||
@@ -692,7 +691,7 @@ QVector<AutomationPattern *> AutomationPattern::patternsForModel( const Automata
|
||||
l += Engine::getSong()->tracks();
|
||||
l += Engine::getBBTrackContainer()->tracks();
|
||||
l += Engine::getSong()->globalAutomationTrack();
|
||||
|
||||
|
||||
// go through all tracks...
|
||||
for( TrackContainer::TrackList::ConstIterator it = l.begin(); it != l.end(); ++it )
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* BBTrackContainer.cpp - model-component of BB-Editor
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "BBTrackContainer.h"
|
||||
#include "BBTrack.h"
|
||||
#include "ComboBox.h"
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
#include "Song.h"
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "BandLimitedWave.h"
|
||||
|
||||
#include "ConfigManager.h"
|
||||
|
||||
WaveMipMap BandLimitedWave::s_waveforms[4] = { };
|
||||
bool BandLimitedWave::s_wavesGenerated = false;
|
||||
@@ -62,7 +63,7 @@ void BandLimitedWave::generateWaves()
|
||||
{
|
||||
// don't generate if they already exist
|
||||
if( s_wavesGenerated ) return;
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
// set wavetable directory
|
||||
@@ -90,7 +91,7 @@ void BandLimitedWave::generateWaves()
|
||||
const int len = TLENS[i];
|
||||
//const double om = 1.0 / len;
|
||||
double max = 0.0;
|
||||
|
||||
|
||||
for( int ph = 0; ph < len; ph++ )
|
||||
{
|
||||
int harm = 1;
|
||||
@@ -115,7 +116,7 @@ void BandLimitedWave::generateWaves()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// square wave - BLSquare
|
||||
// check for file and use it if exists
|
||||
if( sqr_file.exists() )
|
||||
@@ -132,7 +133,7 @@ void BandLimitedWave::generateWaves()
|
||||
const int len = TLENS[i];
|
||||
//const double om = 1.0 / len;
|
||||
double max = 0.0;
|
||||
|
||||
|
||||
for( int ph = 0; ph < len; ph++ )
|
||||
{
|
||||
int harm = 1;
|
||||
@@ -173,7 +174,7 @@ void BandLimitedWave::generateWaves()
|
||||
const int len = TLENS[i];
|
||||
//const double om = 1.0 / len;
|
||||
double max = 0.0;
|
||||
|
||||
|
||||
for( int ph = 0; ph < len; ph++ )
|
||||
{
|
||||
int harm = 1;
|
||||
@@ -184,7 +185,7 @@ void BandLimitedWave::generateWaves()
|
||||
hlen = static_cast<double>( len ) / static_cast<double>( harm );
|
||||
const double amp = 1.0 / static_cast<double>( harm * harm );
|
||||
//const double a2 = cos( om * harm * F_2PI );
|
||||
s += amp * /*a2 **/ sin( ( static_cast<double>( ph * harm ) / static_cast<double>( len ) +
|
||||
s += amp * /*a2 **/ sin( ( static_cast<double>( ph * harm ) / static_cast<double>( len ) +
|
||||
( ( harm + 1 ) % 4 == 0 ? 0.5 : 0.0 ) ) * F_2PI );
|
||||
harm += 2;
|
||||
} while( hlen > 2.0 );
|
||||
@@ -199,7 +200,7 @@ void BandLimitedWave::generateWaves()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// moog saw wave - BLMoog
|
||||
// basically, just add in triangle + 270-phase saw
|
||||
if( moog_file.exists() )
|
||||
@@ -214,7 +215,7 @@ void BandLimitedWave::generateWaves()
|
||||
for( i = 0; i <= MAXTBL; i++ )
|
||||
{
|
||||
const int len = TLENS[i];
|
||||
|
||||
|
||||
for( int ph = 0; ph < len; ph++ )
|
||||
{
|
||||
const int sawph = ( ph + static_cast<int>( len * 0.75 ) ) % len;
|
||||
@@ -224,7 +225,7 @@ void BandLimitedWave::generateWaves()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set the generated flag so we don't load/generate them again needlessly
|
||||
s_wavesGenerated = true;
|
||||
|
||||
@@ -232,14 +233,14 @@ void BandLimitedWave::generateWaves()
|
||||
// generate files, serialize mipmaps as QDataStreams and save them on disk
|
||||
//
|
||||
// normally these are now provided with LMMS as pre-generated so we don't have to do this,
|
||||
// but I'm leaving the code here in case it's needed in the future
|
||||
// but I'm leaving the code here in case it's needed in the future
|
||||
// (maybe we add more waveforms or change the generation code or mipmap format, etc.)
|
||||
|
||||
/*
|
||||
|
||||
// if you want to generate the files, you need to set the filenames and paths here -
|
||||
// if you want to generate the files, you need to set the filenames and paths here -
|
||||
// can't use the usual wavetable directory here as it can require permissions on
|
||||
// some systems...
|
||||
// some systems...
|
||||
|
||||
QFile sawfile( "path-to-wavetables/saw.bin" );
|
||||
QFile sqrfile( "path-to-wavetables/sqr.bin" );
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
|
||||
#include "BufferManager.h"
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
#include <QtCore/QAtomicInt>
|
||||
|
||||
#include "MemoryManager.h"
|
||||
|
||||
sampleFrame ** BufferManager::s_available;
|
||||
QAtomicInt BufferManager::s_availableIndex = 0;
|
||||
@@ -41,7 +45,7 @@ void BufferManager::init( fpp_t framesPerPeriod )
|
||||
|
||||
int c = framesPerPeriod * BM_INITIAL_BUFFERS;
|
||||
sampleFrame * b = MM_ALLOC( sampleFrame, c );
|
||||
|
||||
|
||||
for( int i = 0; i < BM_INITIAL_BUFFERS; ++i )
|
||||
{
|
||||
s_available[ i ] = b;
|
||||
@@ -58,10 +62,10 @@ sampleFrame * BufferManager::acquire()
|
||||
{
|
||||
qFatal( "BufferManager: out of buffers" );
|
||||
}
|
||||
|
||||
|
||||
int i = s_availableIndex.fetchAndAddOrdered( -1 );
|
||||
sampleFrame * b = s_available[ i ];
|
||||
|
||||
|
||||
//qDebug( "acquired buffer: %p - index %d", b, i );
|
||||
return b;
|
||||
}
|
||||
@@ -79,7 +83,7 @@ void BufferManager::refresh() // non-threadsafe, hence it's called periodically
|
||||
{
|
||||
if( s_releasedIndex == 0 ) return;
|
||||
//qDebug( "refresh: %d buffers", int( s_releasedIndex ) );
|
||||
|
||||
|
||||
int j = s_availableIndex;
|
||||
for( int i = 0; i < s_releasedIndex; ++i )
|
||||
{
|
||||
@@ -101,7 +105,7 @@ void BufferManager::extend( int c )
|
||||
|
||||
int cc = c * Engine::mixer()->framesPerPeriod();
|
||||
sampleFrame * b = MM_ALLOC( sampleFrame, cc );
|
||||
|
||||
|
||||
for( int i = 0; i < c; ++i )
|
||||
{
|
||||
s_available[ s_availableIndex.fetchAndAddOrdered( 1 ) + 1 ] = b;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* ControllerConnection.cpp - implementation of class controller connection
|
||||
* ControllerConnection.cpp - implementation of class controller connection
|
||||
* which handles the link between AutomatableModels and controllers
|
||||
*
|
||||
* Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
|
||||
@@ -26,12 +26,10 @@
|
||||
|
||||
#include <QDomElement>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
|
||||
#include "Song.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "ControllerConnection.h"
|
||||
|
||||
|
||||
@@ -123,7 +121,7 @@ void ControllerConnection::setController( Controller * _controller )
|
||||
this, SIGNAL( valueChanged() ) );
|
||||
}
|
||||
|
||||
m_ownsController =
|
||||
m_ownsController =
|
||||
( _controller->type() == Controller::MidiController );
|
||||
|
||||
// If we don't own the controller, allow deletion of controller
|
||||
@@ -150,8 +148,8 @@ inline void ControllerConnection::setTargetName( const QString & _name )
|
||||
/*
|
||||
* A connection may not be finalized. This means, the connection should exist,
|
||||
* but the controller does not yet exist. This happens when loading. Even
|
||||
* loading connections last won't help, since there can be connections BETWEEN
|
||||
* controllers. So, we remember the controller-ID and use a dummyController
|
||||
* loading connections last won't help, since there can be connections BETWEEN
|
||||
* controllers. So, we remember the controller-ID and use a dummyController
|
||||
* instead. Once the song is loaded, finalizeConnections() connects to the proper controllers
|
||||
*/
|
||||
void ControllerConnection::finalizeConnections()
|
||||
|
||||
@@ -42,9 +42,6 @@
|
||||
#include "lmmsversion.h"
|
||||
#include "base64.h"
|
||||
|
||||
// bbTCO::defaultColor()
|
||||
#include "BBTrack.h"
|
||||
|
||||
|
||||
|
||||
DataFile::typeDescStruct
|
||||
@@ -628,7 +625,7 @@ void DataFile::upgrade()
|
||||
el.setAttribute( "lp1pos",
|
||||
el.attribute( "lp1pos" ).toInt()*3 );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if( version < "0.4.0-20080607" )
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 1998-2000 Paul Kellett (mda-vst.com)
|
||||
* Copyright (c) 2007 Paul Giblock <drfaygo/at/gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
|
||||
#include "DrumSynth.h"
|
||||
#include "lmmsconfig.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
@@ -71,13 +70,13 @@ float mem_t=1.0f, mem_o=1.0f, mem_n=1.0f, mem_b=1.0f, mem_tune=1.0f, mem_time=1.
|
||||
int DrumSynth::LongestEnv(void)
|
||||
{
|
||||
long e, eon, p;
|
||||
float l=0.f;
|
||||
|
||||
float l=0.f;
|
||||
|
||||
for(e=1; e<7; e++) //3
|
||||
{
|
||||
eon = e - 1; if(eon>2) eon=eon-1;
|
||||
p = 0;
|
||||
while (envpts[e][0][p + 1] >= 0.f) p++;
|
||||
while (envpts[e][0][p + 1] >= 0.f) p++;
|
||||
envData[e][MAX] = envpts[e][0][p] * timestretch;
|
||||
if(chkOn[eon]==1) if(envData[e][MAX]>l) l=envData[e][MAX];
|
||||
}
|
||||
@@ -88,7 +87,7 @@ int DrumSynth::LongestEnv(void)
|
||||
|
||||
|
||||
float DrumSynth::LoudestEnv(void)
|
||||
{
|
||||
{
|
||||
float loudest=0.f;
|
||||
int i=0;
|
||||
|
||||
@@ -102,9 +101,9 @@ float DrumSynth::LoudestEnv(void)
|
||||
|
||||
|
||||
void DrumSynth::UpdateEnv(int e, long t)
|
||||
{
|
||||
{
|
||||
float endEnv, dT;
|
||||
//0.2's added
|
||||
//0.2's added
|
||||
envData[e][NEXTT] = envpts[e][0][(long)(envData[e][PNT] + 1.f)] * timestretch; //get next point
|
||||
if(envData[e][NEXTT] < 0) envData[e][NEXTT] = 442000 * timestretch; //if end point, hold
|
||||
envData[e][ENV] = envpts[e][1][(long)(envData[e][PNT] + 0.f)] * 0.01f; //this level
|
||||
@@ -122,14 +121,14 @@ void DrumSynth::GetEnv(int env, const char *sec, const char *key, const char *in
|
||||
int i=0, o=0, ep=0;
|
||||
GetPrivateProfileString(sec, key, "0,0 100,0", en, sizeof(en), ini);
|
||||
en[255]=0; //be safe!
|
||||
|
||||
|
||||
while(en[i]!=0)
|
||||
{
|
||||
if(en[i] == ',')
|
||||
if(en[i] == ',')
|
||||
{
|
||||
if(sscanf(s, "%f", &envpts[env][0][ep])==0) envpts[env][0][ep] = 0.f;
|
||||
o=0;
|
||||
}
|
||||
}
|
||||
else if(en[i] == ' ')
|
||||
{
|
||||
if(sscanf(s, "%f", &envpts[env][1][ep])==0) envpts[env][1][ep] = 0.f;
|
||||
@@ -148,7 +147,7 @@ void DrumSynth::GetEnv(int env, const char *sec, const char *key, const char *in
|
||||
float DrumSynth::waveform(float ph, int form)
|
||||
{
|
||||
float w;
|
||||
|
||||
|
||||
switch (form)
|
||||
{
|
||||
case 0: w = (float)sin(fmod(ph,TwoPi)); break; //sine
|
||||
@@ -157,15 +156,15 @@ float DrumSynth::waveform(float ph, int form)
|
||||
w = 0.6366197f * (float)fmod(ph,TwoPi) - 1.f; //tri
|
||||
if(w>1.f) w=2.f-w; break;
|
||||
case 3: w = ph - TwoPi * (float)(int)(ph / TwoPi); //saw
|
||||
w = (0.3183098f * w) - 1.f; break;
|
||||
w = (0.3183098f * w) - 1.f; break;
|
||||
default: w = (sin(fmod(ph,TwoPi))>0.0)? 1.f: -1.f; break; //square
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
|
||||
int DrumSynth::GetPrivateProfileString(const char *sec, const char *key, const char *def, char *buffer, int size, const char *file)
|
||||
int DrumSynth::GetPrivateProfileString(const char *sec, const char *key, const char *def, char *buffer, int size, const char *file)
|
||||
{
|
||||
ifstream is;
|
||||
bool inSection = false;
|
||||
@@ -190,12 +189,12 @@ int DrumSynth::GetPrivateProfileString(const char *sec, const char *key, const c
|
||||
}
|
||||
else if (!is.eof()) {
|
||||
is.getline(line, 200);
|
||||
if (line[0] == '[')
|
||||
if (line[0] == '[')
|
||||
break;
|
||||
|
||||
k = strtok(line, " \t=");
|
||||
b = strtok(NULL, "\n\r\0");
|
||||
|
||||
|
||||
if (k != 0 && strcasecmp(k, key)==0) {
|
||||
if (b==0) {
|
||||
len = 0;
|
||||
@@ -203,7 +202,7 @@ int DrumSynth::GetPrivateProfileString(const char *sec, const char *key, const c
|
||||
}
|
||||
else {
|
||||
k = (char *)(b + strlen(b)-1);
|
||||
while ( (k>=b) && (*k==' ' || *k=='\t') )
|
||||
while ( (k>=b) && (*k==' ' || *k=='\t') )
|
||||
--k;
|
||||
*(k+1) = '\0';
|
||||
|
||||
@@ -233,9 +232,9 @@ int DrumSynth::GetPrivateProfileInt(const char *sec, const char *key, int def, c
|
||||
int i=0;
|
||||
|
||||
GetPrivateProfileString(sec, key, "", tmp, sizeof(tmp), file);
|
||||
sscanf(tmp, "%d", &i); if(tmp[0]==0) i=def;
|
||||
|
||||
return i;
|
||||
sscanf(tmp, "%d", &i); if(tmp[0]==0) i=def;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
float DrumSynth::GetPrivateProfileFloat(const char *sec, const char *key, float def, const char *file)
|
||||
@@ -244,9 +243,9 @@ float DrumSynth::GetPrivateProfileFloat(const char *sec, const char *key, float
|
||||
float f=0.f;
|
||||
|
||||
GetPrivateProfileString(sec, key, "", tmp, sizeof(tmp), file);
|
||||
sscanf(tmp, "%f", &f); if(tmp[0]==0) f=def;
|
||||
sscanf(tmp, "%f", &f); if(tmp[0]==0) f=def;
|
||||
|
||||
return f;
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +258,7 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
{
|
||||
//input file
|
||||
char sec[32];
|
||||
char ver[32];
|
||||
char ver[32];
|
||||
char comment[256];
|
||||
int commentLen=0;
|
||||
|
||||
@@ -268,11 +267,11 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
float x[3] = {0.f, 0.f, 0.f};
|
||||
float MasterTune, randmax, randmax2;
|
||||
int MainFilter, HighPass;
|
||||
|
||||
|
||||
long NON, NT, TON, DiON, TDroop=0, DStep;
|
||||
float a, b=0.f, c=0.f, d=0.f, g, TT=0.f, TL, NL, F1, F2;
|
||||
float TphiStart=0.f, Tphi, TDroopRate, ddF, DAtten, DGain;
|
||||
|
||||
|
||||
long BON, BON2, BFStep, BFStep2, botmp;
|
||||
float BdF=0.f, BdF2=0.f, BPhi, BPhi2, BF, BF2, BQ, BQ2, BL, BL2;
|
||||
|
||||
@@ -282,7 +281,7 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
float Oc0=0.0f, Oc1=0.0f, Oc2=0.0f;
|
||||
|
||||
float MFfb, MFtmp, MFres, MFin=0.f, MFout=0.f;
|
||||
float DownAve;
|
||||
float DownAve;
|
||||
long DownStart, DownEnd, jj;
|
||||
|
||||
|
||||
@@ -297,22 +296,22 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
}
|
||||
|
||||
//try to read version from input file
|
||||
strcpy(sec, "General");
|
||||
strcpy(sec, "General");
|
||||
GetPrivateProfileString(sec,"Version","",ver,sizeof(ver),dsfile);
|
||||
ver[9]=0;
|
||||
ver[9]=0;
|
||||
if(strcasecmp(ver, "DrumSynth") != 0) {return 0;} //input fail
|
||||
if(ver[11] != '1' && ver[11] != '2') {return 0;} //version fail
|
||||
|
||||
|
||||
|
||||
//read master parameters
|
||||
GetPrivateProfileString(sec,"Comment","",comment,sizeof(comment),dsfile);
|
||||
while((comment[commentLen]!=0) && (commentLen<254)) commentLen++;
|
||||
if(commentLen==0) { comment[0]=32; comment[1]=0; commentLen=1;}
|
||||
comment[commentLen+1]=0; commentLen++;
|
||||
if((commentLen % 2)==1) commentLen++;
|
||||
|
||||
if((commentLen % 2)==1) commentLen++;
|
||||
|
||||
timestretch = .01f * mem_time * GetPrivateProfileFloat(sec,"Stretch",100.0,dsfile);
|
||||
if(timestretch<0.2f) timestretch=0.2f;
|
||||
if(timestretch<0.2f) timestretch=0.2f;
|
||||
if(timestretch>10.f) timestretch=10.f;
|
||||
|
||||
DGain = 1.0f; //leave this here!
|
||||
@@ -320,35 +319,35 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
|
||||
MasterTune = GetPrivateProfileFloat(sec,"Tuning",0.0,dsfile);
|
||||
MasterTune = (float)powf(1.0594631f, MasterTune + mem_tune);
|
||||
MainFilter = 2 * GetPrivateProfileInt(sec,"Filter",0,dsfile);
|
||||
MainFilter = 2 * GetPrivateProfileInt(sec,"Filter",0,dsfile);
|
||||
MFres = 0.0101f * GetPrivateProfileFloat(sec,"Resonance",0.0,dsfile);
|
||||
MFres = (float)powf(MFres, 0.5f);
|
||||
|
||||
|
||||
HighPass = GetPrivateProfileInt(sec,"HighPass",0,dsfile);
|
||||
GetEnv(7, sec, "FilterEnv", dsfile);
|
||||
|
||||
|
||||
|
||||
//read noise parameters
|
||||
strcpy(sec, "Noise");
|
||||
chkOn[1] = GetPrivateProfileInt(sec,"On",0,dsfile);
|
||||
sliLev[1] = GetPrivateProfileInt(sec,"Level",0,dsfile);
|
||||
NT = GetPrivateProfileInt(sec,"Slope",0,dsfile);
|
||||
sliLev[1] = GetPrivateProfileInt(sec,"Level",0,dsfile);
|
||||
NT = GetPrivateProfileInt(sec,"Slope",0,dsfile);
|
||||
GetEnv(2, sec, "Envelope", dsfile);
|
||||
NON = chkOn[1];
|
||||
NON = chkOn[1];
|
||||
NL = (float)(sliLev[1] * sliLev[1]) * mem_n;
|
||||
if(NT<0)
|
||||
{ a = 1.f + (NT / 105.f); d = -NT / 105.f;
|
||||
g = (1.f + 0.0005f * NT * NT) * NL; }
|
||||
else
|
||||
{ a = 1.f; b = -NT / 50.f; c = (float)fabs((float)NT) / 100.f; g = NL; }
|
||||
|
||||
//if(GetPrivateProfileInt(sec,"FixedSeq",0,dsfile)!=0)
|
||||
|
||||
//if(GetPrivateProfileInt(sec,"FixedSeq",0,dsfile)!=0)
|
||||
//srand(1); //fixed random sequence
|
||||
|
||||
|
||||
//read tone parameters
|
||||
strcpy(sec, "Tone");
|
||||
chkOn[0] = GetPrivateProfileInt(sec,"On",0,dsfile); TON = chkOn[0];
|
||||
sliLev[0] = GetPrivateProfileInt(sec,"Level",128,dsfile);
|
||||
sliLev[0] = GetPrivateProfileInt(sec,"Level",128,dsfile);
|
||||
TL = (float)(sliLev[0] * sliLev[0]) * mem_t;
|
||||
GetEnv(1, sec, "Envelope", dsfile);
|
||||
F1 = MasterTune * TwoPi * GetPrivateProfileFloat(sec,"F1",200.0,dsfile) / Fs;
|
||||
@@ -364,13 +363,13 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
ddF = F1 - F2;
|
||||
}
|
||||
else ddF = F2-F1;
|
||||
|
||||
|
||||
Tphi = GetPrivateProfileFloat(sec,"Phase",90.f,dsfile) / 57.29578f; //degrees>radians
|
||||
|
||||
//read overtone parameters
|
||||
strcpy(sec, "Overtones");
|
||||
chkOn[2] = GetPrivateProfileInt(sec,"On",0,dsfile); OON = chkOn[2];
|
||||
sliLev[2] = GetPrivateProfileInt(sec,"Level",128,dsfile);
|
||||
sliLev[2] = GetPrivateProfileInt(sec,"Level",128,dsfile);
|
||||
OL = (float)(sliLev[2] * sliLev[2]) * mem_o;
|
||||
GetEnv(3, sec, "Envelope1", dsfile);
|
||||
GetEnv(4, sec, "Envelope2", dsfile);
|
||||
@@ -381,11 +380,11 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
OW2 = GetPrivateProfileInt(sec,"Wave2",0,dsfile);
|
||||
OBal2 = (float)GetPrivateProfileInt(sec,"Param",50,dsfile);
|
||||
ODrive = (float)powf(OBal2, 3.0f) / (float)powf(50.0f, 3.0f);
|
||||
OBal2 *= 0.01f;
|
||||
OBal2 *= 0.01f;
|
||||
OBal1 = 1.f - OBal2;
|
||||
Ophi1 = Tphi;
|
||||
Ophi1 = Tphi;
|
||||
Ophi2 = Tphi;
|
||||
if(MainFilter==0)
|
||||
if(MainFilter==0)
|
||||
MainFilter = GetPrivateProfileInt(sec,"Filter",0,dsfile);
|
||||
if((GetPrivateProfileInt(sec,"Track1",0,dsfile)==1) && (TON==1))
|
||||
{ OF1Sync = 1; OF1 = OF1 / F1; }
|
||||
@@ -403,28 +402,28 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
//read noise band parameters
|
||||
strcpy(sec, "NoiseBand");
|
||||
chkOn[3] = GetPrivateProfileInt(sec,"On",0,dsfile); BON = chkOn[3];
|
||||
sliLev[3] = GetPrivateProfileInt(sec,"Level",128,dsfile);
|
||||
sliLev[3] = GetPrivateProfileInt(sec,"Level",128,dsfile);
|
||||
BL = (float)(sliLev[3] * sliLev[3]) * mem_b;
|
||||
BF = MasterTune * TwoPi * GetPrivateProfileFloat(sec,"F",1000.0,dsfile) / Fs;
|
||||
BPhi = TwoPi / 8.f;
|
||||
GetEnv(5, sec, "Envelope", dsfile);
|
||||
BFStep = GetPrivateProfileInt(sec,"dF",50,dsfile);
|
||||
BQ = (float)BFStep;
|
||||
BFStep = GetPrivateProfileInt(sec,"dF",50,dsfile);
|
||||
BQ = (float)BFStep;
|
||||
BQ = BQ * BQ / (10000.f-6600.f*((float)sqrt(BF)-0.19f));
|
||||
BFStep = 1 + (int)((40.f - (BFStep / 2.5f)) / (BQ + 1.f + (1.f * BF)));
|
||||
|
||||
strcpy(sec, "NoiseBand2");
|
||||
chkOn[4] = GetPrivateProfileInt(sec,"On",0,dsfile); BON2 = chkOn[4];
|
||||
sliLev[4] = GetPrivateProfileInt(sec,"Level",128,dsfile);
|
||||
sliLev[4] = GetPrivateProfileInt(sec,"Level",128,dsfile);
|
||||
BL2 = (float)(sliLev[4] * sliLev[4]) * mem_b;
|
||||
BF2 = MasterTune * TwoPi * GetPrivateProfileFloat(sec,"F",1000.0,dsfile) / Fs;
|
||||
BPhi2 = TwoPi / 8.f;
|
||||
GetEnv(6, sec, "Envelope", dsfile);
|
||||
BFStep2 = GetPrivateProfileInt(sec,"dF",50,dsfile);
|
||||
BFStep2 = GetPrivateProfileInt(sec,"dF",50,dsfile);
|
||||
BQ2 = (float)BFStep2;
|
||||
BQ2 = BQ2 * BQ2 / (10000.f-6600.f*((float)sqrt(BF2)-0.19f));
|
||||
BFStep2 = 1 + (int)((40 - (BFStep2 / 2.5)) / (BQ2 + 1 + (1 * BF2)));
|
||||
|
||||
|
||||
//read distortion parameters
|
||||
strcpy(sec, "Distortion");
|
||||
chkOn[5] = GetPrivateProfileInt(sec,"On",0,dsfile); DiON = chkOn[5];
|
||||
@@ -434,14 +433,14 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
clippoint = 32700;
|
||||
DAtten = 1.0f;
|
||||
|
||||
if(DiON==1)
|
||||
if(DiON==1)
|
||||
{
|
||||
DAtten = DGain * (short)LoudestEnv();
|
||||
if(DAtten>32700) clippoint=32700; else clippoint=(short)DAtten;
|
||||
DAtten = DGain * (short)LoudestEnv();
|
||||
if(DAtten>32700) clippoint=32700; else clippoint=(short)DAtten;
|
||||
DAtten = (float)powf(2.0, 2.0 * GetPrivateProfileInt(sec,"Bits",0,dsfile));
|
||||
DGain = DAtten * DGain * (float)powf(10.0, 0.05 * GetPrivateProfileInt(sec,"Clipping",0,dsfile));
|
||||
}
|
||||
|
||||
|
||||
//prepare envelopes
|
||||
randmax = 1.f / RAND_MAX; randmax2 = 2.f * randmax;
|
||||
for (i=1;i<8;i++) { envData[i][NEXTT]=0; envData[i][PNT]=0; }
|
||||
@@ -473,7 +472,7 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
|
||||
//write WAV header
|
||||
WH.riff = 0x46464952;
|
||||
WH.riffLength = 36 + (2 * Length) + 44 + commentLen;
|
||||
WH.riffLength = 36 + (2 * Length) + 44 + commentLen;
|
||||
WH.wave = 0x45564157;
|
||||
WH.fmt = 0x20746D66;
|
||||
WH.waveLength = 16;
|
||||
@@ -503,7 +502,7 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
else UpdateEnv(2, t);
|
||||
x[2] = x[1];
|
||||
x[1] = x[0];
|
||||
x[0] = (randmax2 * (float)rand()) - 1.f;
|
||||
x[0] = (randmax2 * (float)rand()) - 1.f;
|
||||
TT = a * x[0] + b * x[1] + c * x[2] + d * TT;
|
||||
DF[t - tpos] = TT * g * envData[2][ENV];
|
||||
}
|
||||
@@ -512,7 +511,7 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
else {
|
||||
for(j=0; j<1200; j++) DF[j]=0.f;
|
||||
}
|
||||
|
||||
|
||||
if(TON==1) //tone
|
||||
{
|
||||
TphiStart = Tphi;
|
||||
@@ -520,16 +519,16 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
{
|
||||
for(t=tpos; t<=tplus; t++)
|
||||
phi[t - tpos] = F2 + (ddF * (float)exp(t * TDroopRate));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(t=tpos; t<=tplus; t++)
|
||||
phi[t - tpos] = F1 + (t / envData[1][MAX]) * ddF;
|
||||
}
|
||||
}
|
||||
for(t=tpos; t<=tplus; t++)
|
||||
{
|
||||
totmp = t - tpos;
|
||||
if(t < envData[1][NEXTT])
|
||||
if(t < envData[1][NEXTT])
|
||||
envData[1][ENV] = envData[1][ENV] + envData[1][dENV];
|
||||
else UpdateEnv(1, t);
|
||||
Tphi = Tphi + phi[totmp];
|
||||
@@ -538,7 +537,7 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
if(t>=envData[1][MAX]) TON=0;
|
||||
}
|
||||
else for(j=0; j<1200; j++) phi[j]=F2; //for overtone sync
|
||||
|
||||
|
||||
if(BON==1) //noise band 1
|
||||
{
|
||||
for(t=tpos; t<=tplus; t++)
|
||||
@@ -580,8 +579,8 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
{
|
||||
if(t>=envData[3][MAX]) //wait for OT2
|
||||
{
|
||||
envData[3][ENV] = 0;
|
||||
envData[3][dENV] = 0;
|
||||
envData[3][ENV] = 0;
|
||||
envData[3][dENV] = 0;
|
||||
envData[3][NEXTT] = 999999;
|
||||
}
|
||||
else UpdateEnv(3, t);
|
||||
@@ -610,12 +609,12 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
Ot = OBal1 * envData[3][ENV] * waveform(Ophi1, OW1);
|
||||
Ot = OL * (Ot + OBal2 * envData[4][ENV] * waveform(Ophi2, OW2));
|
||||
break;
|
||||
|
||||
|
||||
case 1: //FM
|
||||
Ot = ODrive * envData[4][ENV] * waveform(Ophi2, OW2);
|
||||
Ot = OL * envData[3][ENV] * waveform(Ophi1 + Ot, OW1);
|
||||
break;
|
||||
|
||||
|
||||
case 2: //RM
|
||||
Ot = (1 - ODrive / 8) + (((ODrive / 8) * envData[4][ENV]) * waveform(Ophi2, OW2));
|
||||
Ot = OL * envData[3][ENV] * waveform(Ophi1, OW1) * Ot;
|
||||
@@ -625,10 +624,10 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
for(j=0; j<6; j++)
|
||||
{
|
||||
Oc[j][0] += 1.0f;
|
||||
|
||||
|
||||
if(Oc[j][0]>Oc[j][1])
|
||||
{
|
||||
Oc[j][0] -= Oc[j][1];
|
||||
{
|
||||
Oc[j][0] -= Oc[j][1];
|
||||
Ot = OL * envData[3][ENV];
|
||||
}
|
||||
}
|
||||
@@ -639,8 +638,8 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
Ot = Oc1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(MainFilter==1) //filter overtones
|
||||
{
|
||||
if(t<envData[7][NEXTT])
|
||||
@@ -651,9 +650,9 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
if(MFtmp >0.2f)
|
||||
MFfb = 1.001f - (float)powf(10.0f, MFtmp - 1);
|
||||
else
|
||||
MFfb = 0.999f - 0.7824f * MFtmp;
|
||||
|
||||
MFtmp = Ot + MFres * (1.f + (1.f/MFfb)) * (MFin - MFout);
|
||||
MFfb = 0.999f - 0.7824f * MFtmp;
|
||||
|
||||
MFtmp = Ot + MFres * (1.f + (1.f/MFfb)) * (MFin - MFout);
|
||||
MFin = MFfb * (MFin - MFtmp) + MFtmp;
|
||||
MFout = MFfb * (MFout - MFin) + MFin;
|
||||
|
||||
@@ -669,48 +668,48 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
|
||||
if(MFtmp >0.2f)
|
||||
MFfb = 1.001f - (float)powf(10.0f, MFtmp - 1);
|
||||
else
|
||||
MFfb = 0.999f - 0.7824f * MFtmp;
|
||||
|
||||
MFtmp = DF[t - tpos] + Ot + MFres * (1.f + (1.f/MFfb)) * (MFin - MFout);
|
||||
MFfb = 0.999f - 0.7824f * MFtmp;
|
||||
|
||||
MFtmp = DF[t - tpos] + Ot + MFres * (1.f + (1.f/MFfb)) * (MFin - MFout);
|
||||
MFin = MFfb * (MFin - MFtmp) + MFtmp;
|
||||
MFout = MFfb * (MFout - MFin) + MFin;
|
||||
|
||||
|
||||
DF[t - tpos] = MFout - (HighPass * (DF[t - tpos] + Ot));
|
||||
}
|
||||
// PG: Ot is uninitialized
|
||||
else DF[t - tpos] = DF[t - tpos] + Ot; //no filter
|
||||
}
|
||||
|
||||
|
||||
if(DiON==1) //bit resolution
|
||||
{
|
||||
for(j=0; j<1200; j++)
|
||||
DF[j] = DGain * (int)(DF[j] / DAtten);
|
||||
|
||||
|
||||
for(j=0; j<1200; j+=DStep) //downsampling
|
||||
{
|
||||
DownAve = 0;
|
||||
DownStart = j;
|
||||
DownEnd = j + DStep - 1;
|
||||
for(jj = DownStart; jj<=DownEnd; jj++)
|
||||
for(jj = DownStart; jj<=DownEnd; jj++)
|
||||
DownAve = DownAve + DF[jj];
|
||||
DownAve = DownAve / DStep;
|
||||
for(jj = DownStart; jj<=DownEnd; jj++)
|
||||
for(jj = DownStart; jj<=DownEnd; jj++)
|
||||
DF[jj] = DownAve;
|
||||
}
|
||||
}
|
||||
}
|
||||
else for(j=0; j<1200; j++) DF[j] *= DGain;
|
||||
|
||||
|
||||
for(j = 0; j<1200; j++) //clipping + output
|
||||
{
|
||||
if(DF[j] > clippoint)
|
||||
wave[wavewords++] = clippoint;
|
||||
else if(DF[j] < -clippoint)
|
||||
else if(DF[j] < -clippoint)
|
||||
wave[wavewords++] = -clippoint;
|
||||
else
|
||||
else
|
||||
wave[wavewords++] = (short)DF[j];
|
||||
|
||||
for (int c = 1; c < channels; c++) {
|
||||
wave[wavewords] = wave[wavewords-1];
|
||||
wave[wavewords] = wave[wavewords-1];
|
||||
wavewords++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "EffectChain.h"
|
||||
#include "Effect.h"
|
||||
#include "Engine.h"
|
||||
#include "debug.h"
|
||||
#include "DummyEffect.h"
|
||||
#include "MixHelpers.h"
|
||||
#include "Song.h"
|
||||
@@ -148,7 +147,7 @@ void EffectChain::moveDown( Effect * _effect )
|
||||
if( _effect != m_effects.last() )
|
||||
{
|
||||
int i = 0;
|
||||
for( EffectList::Iterator it = m_effects.begin();
|
||||
for( EffectList::Iterator it = m_effects.begin();
|
||||
it != m_effects.end(); it++, i++ )
|
||||
{
|
||||
if( *it == _effect )
|
||||
@@ -156,10 +155,10 @@ void EffectChain::moveDown( Effect * _effect )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Effect * temp = m_effects[i + 1];
|
||||
m_effects[i + 1] = _effect;
|
||||
m_effects[i] = temp;
|
||||
m_effects[i] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +170,7 @@ void EffectChain::moveUp( Effect * _effect )
|
||||
if( _effect != m_effects.first() )
|
||||
{
|
||||
int i = 0;
|
||||
for( EffectList::Iterator it = m_effects.begin();
|
||||
for( EffectList::Iterator it = m_effects.begin();
|
||||
it != m_effects.end(); it++, i++ )
|
||||
{
|
||||
if( *it == _effect )
|
||||
@@ -179,10 +178,10 @@ void EffectChain::moveUp( Effect * _effect )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Effect * temp = m_effects[i - 1];
|
||||
m_effects[i - 1] = _effect;
|
||||
m_effects[i] = temp;
|
||||
m_effects[i] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,8 +239,8 @@ void EffectChain::startRunning()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for( EffectList::Iterator it = m_effects.begin();
|
||||
|
||||
for( EffectList::Iterator it = m_effects.begin();
|
||||
it != m_effects.end(); it++ )
|
||||
{
|
||||
( *it )->startRunning();
|
||||
|
||||
@@ -27,13 +27,10 @@
|
||||
#include "BBTrackContainer.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "FxMixer.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "Ladspa2LMMS.h"
|
||||
#include "Mixer.h"
|
||||
#include "Pattern.h"
|
||||
#include "PresetPreviewPlayHandle.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "ProjectNotes.h"
|
||||
#include "Plugin.h"
|
||||
#include "Song.h"
|
||||
#include "BandLimitedWave.h"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <QDomElement>
|
||||
|
||||
#include "EnvelopeAndLfoParameters.h"
|
||||
#include "debug.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "Oscillator.h"
|
||||
@@ -379,7 +378,7 @@ void EnvelopeAndLfoParameters::loadSettings( const QDomElement & _this )
|
||||
with 4.15 file format*/
|
||||
|
||||
if( _this.hasAttribute( "sus" ) )
|
||||
{
|
||||
{
|
||||
m_sustainModel.loadSettings( _this, "sus" );
|
||||
m_sustainModel.setValue( 1.0 - m_sustainModel.value() );
|
||||
}
|
||||
@@ -392,7 +391,7 @@ void EnvelopeAndLfoParameters::loadSettings( const QDomElement & _this )
|
||||
( TempoSyncKnob::TtempoSyncMode ) _this.attribute(
|
||||
"lfosyncmode" ).toInt() );
|
||||
}*/
|
||||
|
||||
|
||||
m_userWave.setAudioFile( _this.attribute( "userwavefile" ) );
|
||||
|
||||
updateSampleVars();
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "FxMixer.h"
|
||||
#include "MixerWorkerThread.h"
|
||||
#include "MixHelpers.h"
|
||||
#include "Effect.h"
|
||||
#include "Song.h"
|
||||
|
||||
#include "InstrumentTrack.h"
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "InstrumentTrack.h"
|
||||
#include "DummyInstrument.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "JournallingObject.h"
|
||||
#include "AutomatableModel.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "base64.h"
|
||||
#include "Engine.h"
|
||||
|
||||
|
||||
@@ -70,7 +69,7 @@ void JournallingObject::addJournalCheckPoint()
|
||||
QDomElement JournallingObject::saveState( QDomDocument & _doc,
|
||||
QDomElement & _parent )
|
||||
{
|
||||
if( isJournalling() )
|
||||
if( isJournalling() )
|
||||
{
|
||||
QDomElement _this = SerializingObject::saveState( _doc, _parent );
|
||||
|
||||
|
||||
@@ -23,17 +23,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <QDomElement>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
|
||||
#include "Song.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "LfoController.h"
|
||||
#include "ControllerDialog.h"
|
||||
#include "lmms_math.h"
|
||||
|
||||
|
||||
@@ -47,7 +44,7 @@ LfoController::LfoController( Model * _parent ) :
|
||||
this, tr( "Oscillator waveform" ) ),
|
||||
m_multiplierModel( 0, 0, 2, this, tr( "Frequency Multiplier" ) ),
|
||||
m_duration( 1000 ),
|
||||
m_phaseOffset( 0 ),
|
||||
m_phaseOffset( 0 ),
|
||||
m_currentPhase( 0 ),
|
||||
m_sampleFunction( &Oscillator::sinSample ),
|
||||
m_userDefSampleBuffer( new SampleBuffer )
|
||||
@@ -55,19 +52,19 @@ LfoController::LfoController( Model * _parent ) :
|
||||
setSampleExact( true );
|
||||
connect( &m_waveModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateSampleFunction() ) );
|
||||
|
||||
|
||||
connect( &m_speedModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateDuration() ) );
|
||||
connect( &m_multiplierModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateDuration() ) );
|
||||
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ),
|
||||
connect( Engine::mixer(), SIGNAL( sampleRateChanged() ),
|
||||
this, SLOT( updateDuration() ) );
|
||||
|
||||
|
||||
connect( Engine::getSong(), SIGNAL( playbackStateChanged() ),
|
||||
this, SLOT( updatePhase() ) );
|
||||
connect( Engine::getSong(), SIGNAL( playbackPositionChanged() ),
|
||||
this, SLOT( updatePhase() ) );
|
||||
|
||||
|
||||
updateDuration();
|
||||
}
|
||||
|
||||
@@ -88,12 +85,12 @@ LfoController::~LfoController()
|
||||
|
||||
void LfoController::updateValueBuffer()
|
||||
{
|
||||
m_phaseOffset = m_phaseModel.value() / 360.0;
|
||||
float * values = m_valueBuffer.values();
|
||||
m_phaseOffset = m_phaseModel.value() / 360.0;
|
||||
float * values = m_valueBuffer.values();
|
||||
float phase = m_currentPhase + m_phaseOffset;
|
||||
|
||||
// roll phase up until we're in sync with period counter
|
||||
m_bufferLastUpdated++;
|
||||
m_bufferLastUpdated++;
|
||||
if( m_bufferLastUpdated < s_periods )
|
||||
{
|
||||
int diff = s_periods - m_bufferLastUpdated;
|
||||
@@ -103,16 +100,16 @@ void LfoController::updateValueBuffer()
|
||||
|
||||
|
||||
for( int i = 0; i < m_valueBuffer.length(); i++ )
|
||||
{
|
||||
const float currentSample = m_sampleFunction != NULL
|
||||
{
|
||||
const float currentSample = m_sampleFunction != NULL
|
||||
? m_sampleFunction( phase )
|
||||
: m_userDefSampleBuffer->userWaveSample( phase );
|
||||
|
||||
|
||||
values[i] = qBound( 0.0f, m_baseModel.value() + ( m_amountModel.value() * currentSample / 2.0f ), 1.0f );
|
||||
|
||||
phase += 1.0 / m_duration;
|
||||
}
|
||||
|
||||
|
||||
m_currentPhase = absFraction( phase - m_phaseOffset );
|
||||
}
|
||||
|
||||
@@ -141,7 +138,7 @@ void LfoController::updateDuration()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
m_duration = newDurationF;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "MemoryManager.h"
|
||||
#include <QtGlobal>
|
||||
#include <QReadWriteLock>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lmms_math.h"
|
||||
#include "MixHelpers.h"
|
||||
#include "lmms_math.h"
|
||||
#include "ValueBuffer.h"
|
||||
|
||||
|
||||
|
||||
@@ -22,18 +22,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "Mixer.h"
|
||||
|
||||
#include "AudioPort.h"
|
||||
#include "FxMixer.h"
|
||||
#include "MixHelpers.h"
|
||||
#include "MixerWorkerThread.h"
|
||||
#include "Song.h"
|
||||
#include "templates.h"
|
||||
#include "EnvelopeAndLfoParameters.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "debug.h"
|
||||
#include "Engine.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "SamplePlayHandle.h"
|
||||
@@ -292,7 +288,7 @@ void Mixer::pushInputFrames( sampleFrame * _ab, const f_cnt_t _frames )
|
||||
f_cnt_t frames = m_inputBufferFrames[ m_inputBufferWrite ];
|
||||
int size = m_inputBufferSize[ m_inputBufferWrite ];
|
||||
sampleFrame * buf = m_inputBuffer[ m_inputBufferWrite ];
|
||||
|
||||
|
||||
if( frames + _frames > size )
|
||||
{
|
||||
size = qMax( size * 2, frames + _frames );
|
||||
@@ -305,10 +301,10 @@ void Mixer::pushInputFrames( sampleFrame * _ab, const f_cnt_t _frames )
|
||||
|
||||
buf = ab;
|
||||
}
|
||||
|
||||
|
||||
memcpy( &buf[ frames ], _ab, _frames * sizeof( sampleFrame ) );
|
||||
m_inputBufferFrames[ m_inputBufferWrite ] += _frames;
|
||||
|
||||
|
||||
unlockInputFrames();
|
||||
}
|
||||
|
||||
@@ -359,7 +355,7 @@ const surroundSampleFrame * Mixer::renderNextBuffer()
|
||||
if( it != m_playHandles.end() )
|
||||
{
|
||||
( *it )->audioPort()->removePlayHandle( ( *it ) );
|
||||
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
|
||||
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
|
||||
{
|
||||
NotePlayHandleManager::release( (NotePlayHandle*) *it );
|
||||
}
|
||||
@@ -415,7 +411,7 @@ const surroundSampleFrame * Mixer::renderNextBuffer()
|
||||
if( ( *it )->isFinished() )
|
||||
{
|
||||
( *it )->audioPort()->removePlayHandle( ( *it ) );
|
||||
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
|
||||
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
|
||||
{
|
||||
NotePlayHandleManager::release( (NotePlayHandle*) *it );
|
||||
}
|
||||
@@ -446,7 +442,7 @@ const surroundSampleFrame * Mixer::renderNextBuffer()
|
||||
EnvelopeAndLfoParameters::instances()->trigger();
|
||||
Controller::triggerFrameCounter();
|
||||
AutomatableModel::incrementPeriodCounter();
|
||||
|
||||
|
||||
// refresh buffer pool
|
||||
BufferManager::refresh();
|
||||
|
||||
@@ -639,7 +635,7 @@ bool Mixer::addPlayHandle( PlayHandle* handle )
|
||||
return true;
|
||||
}
|
||||
|
||||
if( handle->type() == PlayHandle::TypeNotePlayHandle )
|
||||
if( handle->type() == PlayHandle::TypeNotePlayHandle )
|
||||
{
|
||||
NotePlayHandleManager::release( (NotePlayHandle*)handle );
|
||||
}
|
||||
@@ -664,7 +660,7 @@ void Mixer::removePlayHandle( PlayHandle * _ph )
|
||||
if( it != m_playHandles.end() )
|
||||
{
|
||||
m_playHandles.erase( it );
|
||||
if( _ph->type() == PlayHandle::TypeNotePlayHandle )
|
||||
if( _ph->type() == PlayHandle::TypeNotePlayHandle )
|
||||
{
|
||||
NotePlayHandleManager::release( (NotePlayHandle*) _ph );
|
||||
}
|
||||
@@ -690,7 +686,7 @@ void Mixer::removePlayHandles( Track * _track, bool removeIPHs )
|
||||
if( ( *it )->isFromTrack( _track ) && ( removeIPHs || ( *it )->type() != PlayHandle::TypeInstrumentPlayHandle ) )
|
||||
{
|
||||
( *it )->audioPort()->removePlayHandle( ( *it ) );
|
||||
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
|
||||
if( ( *it )->type() == PlayHandle::TypeNotePlayHandle )
|
||||
{
|
||||
NotePlayHandleManager::release( (NotePlayHandle*) *it );
|
||||
}
|
||||
@@ -942,8 +938,8 @@ void Mixer::fifoWriter::run()
|
||||
#ifdef __SSE__
|
||||
/* FTZ flag */
|
||||
_MM_SET_FLUSH_ZERO_MODE( _MM_FLUSH_ZERO_ON );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifdef LMMS_BUILD_LINUX
|
||||
#ifdef LMMS_HAVE_SCHED_H
|
||||
|
||||
@@ -23,8 +23,18 @@
|
||||
*/
|
||||
|
||||
#include "MixerWorkerThread.h"
|
||||
#include "Engine.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include "ThreadableJob.h"
|
||||
#include "Mixer.h"
|
||||
|
||||
#ifdef __SSE__
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
#ifdef __SSE3__
|
||||
#include <pmmintrin.h>
|
||||
#endif
|
||||
|
||||
MixerWorkerThread::JobQueue MixerWorkerThread::globalJobQueue;
|
||||
QWaitCondition * MixerWorkerThread::queueReadyWaitCond = NULL;
|
||||
@@ -157,7 +167,7 @@ void MixerWorkerThread::run()
|
||||
#ifdef __SSE__
|
||||
/* FTZ flag */
|
||||
_MM_SET_FLUSH_ZERO_MODE( _MM_FLUSH_ZERO_ON );
|
||||
#endif
|
||||
#endif
|
||||
QMutex m;
|
||||
while( m_quit == false )
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* note.cpp - implementation of class note
|
||||
*
|
||||
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -29,8 +29,6 @@
|
||||
|
||||
#include "Note.h"
|
||||
#include "DetuningHelper.h"
|
||||
#include "templates.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +66,7 @@ Note::Note( const Note & _note ) :
|
||||
m_selected( _note.m_selected ),
|
||||
m_oldKey( _note.m_oldKey ),
|
||||
m_oldPos( _note.m_oldPos ),
|
||||
m_oldLength( _note.m_oldLength ),
|
||||
m_oldLength( _note.m_oldLength ),
|
||||
m_isPlaying( _note.m_isPlaying ),
|
||||
m_key( _note.m_key),
|
||||
m_volume( _note.m_volume ),
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "NotePlayHandle.h"
|
||||
#include "BasicFilters.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "DetuningHelper.h"
|
||||
#include "InstrumentSoundShaping.h"
|
||||
#include "InstrumentTrack.h"
|
||||
@@ -93,14 +92,14 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
|
||||
parent->m_hadChildren = true;
|
||||
|
||||
m_bbTrack = parent->m_bbTrack;
|
||||
|
||||
|
||||
parent->setUsesBuffer( false );
|
||||
}
|
||||
|
||||
updateFrequency();
|
||||
|
||||
setFrames( _frames );
|
||||
|
||||
|
||||
// inform attached components about new MIDI note (used for recording in Piano Roll)
|
||||
if( m_origin == OriginMidiInput )
|
||||
{
|
||||
@@ -114,7 +113,7 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
|
||||
// send MidiNoteOn event
|
||||
m_instrumentTrack->processOutEvent(
|
||||
MidiEvent( MidiNoteOn, midiChannel(), midiKey(), midiVelocity( baseVelocity ) ),
|
||||
MidiTime::fromFrames( offset(), Engine::framesPerTick() ),
|
||||
MidiTime::fromFrames( offset(), Engine::framesPerTick() ),
|
||||
offset() );
|
||||
}
|
||||
|
||||
@@ -122,9 +121,9 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
|
||||
{
|
||||
setUsesBuffer( false );
|
||||
}
|
||||
|
||||
|
||||
setAudioPort( instrumentTrack->audioPort() );
|
||||
|
||||
|
||||
unlock();
|
||||
}
|
||||
|
||||
@@ -133,7 +132,7 @@ void NotePlayHandle::done()
|
||||
{
|
||||
lock();
|
||||
noteOff( 0 );
|
||||
|
||||
|
||||
if( hasParent() == false )
|
||||
{
|
||||
delete m_baseDetuning;
|
||||
@@ -157,7 +156,7 @@ void NotePlayHandle::done()
|
||||
m_subNotes.clear();
|
||||
|
||||
delete m_filter;
|
||||
|
||||
|
||||
if( buffer() ) releaseBuffer();
|
||||
|
||||
unlock();
|
||||
@@ -212,7 +211,7 @@ void NotePlayHandle::play( sampleFrame * _working_buffer )
|
||||
setOffset( offset() - Engine::mixer()->framesPerPeriod() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
lock();
|
||||
if( m_frequencyNeedsUpdate )
|
||||
{
|
||||
@@ -220,7 +219,7 @@ void NotePlayHandle::play( sampleFrame * _working_buffer )
|
||||
}
|
||||
|
||||
// number of frames that can be played this period
|
||||
f_cnt_t framesThisPeriod = m_totalFramesPlayed == 0
|
||||
f_cnt_t framesThisPeriod = m_totalFramesPlayed == 0
|
||||
? Engine::mixer()->framesPerPeriod() - offset()
|
||||
: Engine::mixer()->framesPerPeriod();
|
||||
|
||||
@@ -386,7 +385,7 @@ void NotePlayHandle::noteOff( const f_cnt_t _s )
|
||||
// send MidiNoteOff event
|
||||
m_instrumentTrack->processOutEvent(
|
||||
MidiEvent( MidiNoteOff, midiChannel(), midiKey(), 0 ),
|
||||
MidiTime::fromFrames( _s, Engine::framesPerTick() ),
|
||||
MidiTime::fromFrames( _s, Engine::framesPerTick() ),
|
||||
_s );
|
||||
}
|
||||
|
||||
@@ -597,7 +596,7 @@ NotePlayHandle * NotePlayHandleManager::acquire( InstrumentTrack* instrumentTrac
|
||||
s_mutex.lockForRead();
|
||||
NotePlayHandle * nph = s_available[ s_availableIndex.fetchAndAddOrdered( -1 ) ];
|
||||
s_mutex.unlock();
|
||||
|
||||
|
||||
new( (void*)nph ) NotePlayHandle( instrumentTrack, offset, frames, noteToPlay, parent, midiEventChannel, origin );
|
||||
return nph;
|
||||
}
|
||||
@@ -618,7 +617,7 @@ void NotePlayHandleManager::extend( int c )
|
||||
NotePlayHandle ** tmp = MM_ALLOC( NotePlayHandle*, s_size );
|
||||
MM_FREE( s_available );
|
||||
s_available = tmp;
|
||||
|
||||
|
||||
NotePlayHandle * n = MM_ALLOC( NotePlayHandle, c );
|
||||
|
||||
for( int i=0; i < c; ++i )
|
||||
|
||||
@@ -23,24 +23,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "PeakController.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <QDomElement>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
#include "Song.h"
|
||||
#include "Engine.h"
|
||||
#include "Mixer.h"
|
||||
#include "PeakController.h"
|
||||
#include "EffectChain.h"
|
||||
#include "ControllerDialog.h"
|
||||
#include "plugins/peak_controller_effect/peak_controller_effect.h"
|
||||
#include "PresetPreviewPlayHandle.h"
|
||||
#include "lmms_math.h"
|
||||
#include "interpolation.h"
|
||||
|
||||
class ControllerDialog;
|
||||
|
||||
PeakControllerEffectVector PeakController::s_effects;
|
||||
int PeakController::m_getCount;
|
||||
@@ -48,7 +44,7 @@ int PeakController::m_loadCount;
|
||||
bool PeakController::m_buggedFile;
|
||||
|
||||
|
||||
PeakController::PeakController( Model * _parent,
|
||||
PeakController::PeakController( Model * _parent,
|
||||
PeakControllerEffect * _peak_effect ) :
|
||||
Controller( Controller::PeakController, _parent, tr( "Peak Controller" ) ),
|
||||
m_peakEffect( _peak_effect ),
|
||||
@@ -99,7 +95,7 @@ void PeakController::updateValueBuffer()
|
||||
{
|
||||
const f_cnt_t frames = Engine::mixer()->framesPerPeriod();
|
||||
float * values = m_valueBuffer.values();
|
||||
|
||||
|
||||
for( f_cnt_t f = 0; f < frames; ++f )
|
||||
{
|
||||
const float diff = ( targetSample - m_currentSample );
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* to/from base64
|
||||
*
|
||||
* Copyright (c) 2006-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
|
||||
#include "base64.h"
|
||||
#include "lmms_basics.h"
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QVariant>
|
||||
@@ -34,7 +33,7 @@
|
||||
namespace base64
|
||||
{
|
||||
|
||||
|
||||
|
||||
QString encode( const QVariant & _data )
|
||||
{
|
||||
QBuffer buf;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* fft_helpers.cpp - some functions around FFT analysis
|
||||
*
|
||||
* Copyright (c) 2008-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
*
|
||||
* This file is part of LMMS - http://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
#include "fft_helpers.h"
|
||||
|
||||
#include "lmms_math.h"
|
||||
|
||||
#include <cmath>
|
||||
#include "lmms_constants.h"
|
||||
|
||||
/* returns biggest value from abs_spectrum[spec_size] array
|
||||
|
||||
@@ -36,10 +36,10 @@ float maximum(float *abs_spectrum, unsigned int spec_size)
|
||||
{
|
||||
float maxi=0;
|
||||
unsigned int i;
|
||||
|
||||
|
||||
if ( abs_spectrum==NULL )
|
||||
return -1;
|
||||
|
||||
|
||||
if (spec_size<=0)
|
||||
return -1;
|
||||
|
||||
@@ -48,7 +48,7 @@ float maximum(float *abs_spectrum, unsigned int spec_size)
|
||||
if ( abs_spectrum[i]>maxi )
|
||||
maxi=abs_spectrum[i];
|
||||
}
|
||||
|
||||
|
||||
return maxi;
|
||||
}
|
||||
|
||||
@@ -60,21 +60,21 @@ int hanming(float *timebuffer, int length, WINDOWS type)
|
||||
{
|
||||
int i;
|
||||
float alpha;
|
||||
|
||||
|
||||
if ( (timebuffer==NULL)||(length<=0) )
|
||||
return -1;
|
||||
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case HAMMING: alpha=0.54; break;
|
||||
case HANNING:
|
||||
case HANNING:
|
||||
default: alpha=0.5; break;
|
||||
}
|
||||
|
||||
|
||||
for ( i=0; i<length; i++ )
|
||||
{
|
||||
timebuffer[i]=timebuffer[i]*(alpha+(1-alpha)*cos(2*F_PI*i/((float)length-1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ int hanming(float *timebuffer, int length, WINDOWS type)
|
||||
int absspec(fftwf_complex *complex_buffer, float *absspec_buffer, int compl_length)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if ( (complex_buffer==NULL)||(absspec_buffer==NULL) )
|
||||
return -1;
|
||||
if ( compl_length<=0 )
|
||||
@@ -98,7 +98,7 @@ int absspec(fftwf_complex *complex_buffer, float *absspec_buffer, int compl_leng
|
||||
{
|
||||
absspec_buffer[i]=(float )sqrt(complex_buffer[i][0]*complex_buffer[i][0] + complex_buffer[i][1]*complex_buffer[i][1]);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ int absspec(fftwf_complex *complex_buffer, float *absspec_buffer, int compl_leng
|
||||
/* build fewer subbands from many absolute spectrum values
|
||||
take care that - compressedbands[] array num_new elements long
|
||||
- num_old > num_new
|
||||
|
||||
|
||||
returns 0 on success, else -1 */
|
||||
int compressbands(float *absspec_buffer, float *compressedband, int num_old, int num_new, int bottom, int top)
|
||||
{
|
||||
@@ -114,13 +114,13 @@ int compressbands(float *absspec_buffer, float *compressedband, int num_old, int
|
||||
int i, usefromold;
|
||||
float j;
|
||||
float j_min, j_max;
|
||||
|
||||
|
||||
if ( (absspec_buffer==NULL)||(compressedband==NULL) )
|
||||
return -1;
|
||||
|
||||
|
||||
if ( num_old<num_new )
|
||||
return -1;
|
||||
|
||||
|
||||
if ( (num_old<=0)||(num_new<=0) )
|
||||
return -1;
|
||||
|
||||
@@ -138,15 +138,15 @@ int compressbands(float *absspec_buffer, float *compressedband, int num_old, int
|
||||
for ( i=0; i<num_new; i++ )
|
||||
{
|
||||
compressedband[i]=0;
|
||||
|
||||
|
||||
j_min=(i*ratio)+bottom;
|
||||
|
||||
if ( j_min<0 )
|
||||
j_min=bottom;
|
||||
|
||||
|
||||
j_max=j_min+ratio;
|
||||
|
||||
for ( j=(int)j_min; j<=j_max; j++ )
|
||||
for ( j=(int)j_min; j<=j_max; j++ )
|
||||
{
|
||||
compressedband[i]+=absspec_buffer[(int)j];
|
||||
}
|
||||
@@ -188,16 +188,16 @@ static const int onethirdoctavecenterfr[] = {20, 25, 31, 40, 50, 63, 80, 100, 12
|
||||
for ( i=0; i<31; i++ )
|
||||
{
|
||||
subbands[i]=0;
|
||||
|
||||
|
||||
// calculate bandwith for subband
|
||||
frequency=onethirdoctavecenterfr[i];
|
||||
|
||||
bandwith=(pow(2, 1.0/3.0)-1)*frequency;
|
||||
|
||||
|
||||
f_min=frequency-bandwith/2.0;
|
||||
f_max=frequency+bandwith/2.0;
|
||||
|
||||
j_min=(int)(f_min/max_frequency*(float)num_spec);
|
||||
j_min=(int)(f_min/max_frequency*(float)num_spec);
|
||||
|
||||
j_max=(int)(f_max/max_frequency*(float)num_spec);
|
||||
|
||||
@@ -215,7 +215,7 @@ static const int onethirdoctavecenterfr[] = {20, 25, 31, 40, 50, 63, 80, 100, 12
|
||||
}
|
||||
|
||||
} //for
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -231,13 +231,13 @@ float signalpower(float *timesignal, int num_values)
|
||||
|
||||
if( timesignal==NULL )
|
||||
return -1;
|
||||
|
||||
|
||||
float power=0;
|
||||
for ( int i=0; i<num_values; i++ )
|
||||
for ( int i=0; i<num_values; i++ )
|
||||
{
|
||||
power+=timesignal[i]*timesignal[i];
|
||||
}
|
||||
|
||||
return power;
|
||||
|
||||
return power;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,18 +35,13 @@
|
||||
#include <pmmintrin.h>
|
||||
#endif
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QLocale>
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
#include <QApplication>
|
||||
#include <QBitmap>
|
||||
#include <QDesktopWidget>
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
#include <QSplashScreen>
|
||||
#include <QTextStream>
|
||||
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
#include <windows.h>
|
||||
@@ -71,16 +66,13 @@
|
||||
#include "MemoryManager.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "NotePlayHandle.h"
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "LmmsStyle.h"
|
||||
#include "ImportFilter.h"
|
||||
#include "MainWindow.h"
|
||||
#include "ProjectRenderer.h"
|
||||
#include "DataFile.h"
|
||||
#include "Song.h"
|
||||
#include "LmmsPalette.h"
|
||||
|
||||
static inline QString baseName( const QString & _file )
|
||||
{
|
||||
|
||||
@@ -22,13 +22,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "BBEditor.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QKeyEvent>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QMdiArea>
|
||||
|
||||
#include "BBEditor.h"
|
||||
#include "ComboBox.h"
|
||||
#include "BBTrackContainer.h"
|
||||
#include "embed.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
Reference in New Issue
Block a user