Merge remote-tracking branch 'origin/stable-0.4-test' into stable-0.4

Conflicts:
	include/song.h
	src/core/song.cpp
This commit is contained in:
Tobias Doerffel
2014-01-07 22:59:40 +01:00
186 changed files with 14877 additions and 1164 deletions

View File

@@ -37,7 +37,7 @@ class AudioPort
{
public:
AudioPort( const QString & _name, bool _has_effect_chain = true );
~AudioPort();
virtual ~AudioPort();
inline sampleFrame * firstBuffer()
{

View File

@@ -1,7 +1,7 @@
/*
* AutomatableModelView.h - class AutomatableModelView
*
* Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -56,15 +56,6 @@ public:
return( modelUntyped() ? modelUntyped()->value<T>() : 0 );
}
inline void setValue( const float _value )
{
if( modelUntyped() )
{
modelUntyped()->setValue( _value );
}
}
inline void setDescription( const QString & _desc )
{
m_description = _desc;
@@ -101,6 +92,7 @@ public slots:
void execConnectionDialog();
void removeConnection();
void editSongGlobalAutomation();
void removeSongGlobalAutomation();
protected:

View File

@@ -2,7 +2,7 @@
* AutomationPattern.h - declaration of class AutomationPattern, which contains
* all information about an automation pattern
*
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -71,7 +71,7 @@ public:
inline bool hasAutomation() const
{
return m_hasAutomation;
return m_timeMap.isEmpty() == false;
}
float valueAt( const midiTime & _time ) const;
@@ -109,6 +109,8 @@ public slots:
private:
void cleanObjects();
AutomationTrack * m_autoTrack;
QVector<jo_id_t> m_idsToResolve;
objectVector m_objects;

View File

@@ -55,6 +55,7 @@ private:
lcdSpinBox * m_outputChannelSpinBox;
lcdSpinBox * m_fixedOutputVelocitySpinBox;
lcdSpinBox * m_outputProgramSpinBox;
lcdSpinBox * m_fixedOutputNoteSpinBox;
QToolButton * m_wpBtn;
} ;

View File

@@ -2,7 +2,7 @@
* InstrumentTrack.h - declaration of class InstrumentTrack, a track + window
* which holds an instrument-plugin
*
* Copyright (c) 2004-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -80,6 +80,11 @@ public:
// silence all running notes played by this track
void silenceAllNotes();
bool isSustainPedalPressed() const
{
return m_sustainPedalPressed;
}
f_cnt_t beatLen( notePlayHandle * _n ) const;
@@ -215,6 +220,7 @@ private:
notePlayHandle * m_notes[NumKeys];
int m_runningMidiNotes[NumKeys];
bool m_sustainPedalPressed;
IntModel m_baseNoteModel;

87
include/LcdWidget.h Normal file
View File

@@ -0,0 +1,87 @@
/*
* LcdWidget.h - a widget for displaying numbers in LCD style
*
* Copyright (c) 2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _LCD_WIDGET_H
#define _LCD_WIDGET_H
#include <QtCore/QMap>
#include <QtGui/QWidget>
#include "export.h"
class EXPORT LcdWidget : public QWidget
{
Q_OBJECT
public:
LcdWidget( int numDigits, QWidget* parent, const QString& name = QString::null );
LcdWidget( int numDigits, const QString& style, QWidget* parent, const QString& name = QString::null );
virtual ~LcdWidget();
void setValue( int value );
void setLabel( const QString& label );
void addTextForValue( int value, const QString& text )
{
m_textForValue[value] = text;
update();
}
public slots:
virtual void setMarginWidth( int _width );
protected:
virtual void paintEvent( QPaintEvent * _me );
virtual void updateSize();
int cellHeight() const
{
return m_cellHeight;
}
private:
static const int charsPerPixmap = 12;
QMap<int, QString> m_textForValue;
QString m_display;
QString m_label;
QPixmap* m_lcdPixmap;
int m_cellWidth;
int m_cellHeight;
int m_numDigits;
int m_marginWidth;
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* main_window.h - declaration of class MainWindow, the main window of LMMS
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -106,7 +106,7 @@ public slots:
void aboutLMMS( void );
void help( void );
void toggleAutomationEditorWin( void );
void toggleBBEditorWin( void );
void toggleBBEditorWin( bool forceShow = false );
void toggleSongEditorWin( void );
void toggleProjectNotesWin( void );
void toggleFxMixerWin( void );
@@ -132,7 +132,7 @@ private:
void finalize( void );
void toggleWindow( QWidget * _w );
void toggleWindow( QWidget *window, bool forceShow = false );
QMdiArea * m_workspace;

View File

@@ -1,7 +1,7 @@
/*
* MidiAlsaSeq.h - ALSA-sequencer-client
*
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -31,6 +31,7 @@
#include <alsa/asoundlib.h>
#endif
#include <QtCore/QMutex>
#include <QtCore/QThread>
#include <QtCore/QTimer>
@@ -130,6 +131,7 @@ private:
virtual void run();
#ifdef LMMS_HAVE_ALSA
QMutex m_seqMutex;
snd_seq_t * m_seqHandle;
struct Ports
{

View File

@@ -56,6 +56,8 @@ class MidiPort : public Model, public SerializingObject
m_fixedInputVelocityModel);
mapPropertyFromModel(int,fixedOutputVelocity,setFixedOutputVelocity,
m_fixedOutputVelocityModel);
mapPropertyFromModel(int,fixedOutputNote,setFixedOutputNote,
m_fixedOutputNoteModel);
mapPropertyFromModel(int,outputProgram,setOutputProgram,
m_outputProgramModel);
mapPropertyFromModel(bool,isReadable,setReadable,m_readableModel);
@@ -155,6 +157,7 @@ private:
IntModel m_outputControllerModel;
IntModel m_fixedInputVelocityModel;
IntModel m_fixedOutputVelocityModel;
IntModel m_fixedOutputNoteModel;
IntModel m_outputProgramModel;
BoolModel m_readableModel;
BoolModel m_writableModel;

View File

@@ -1,7 +1,7 @@
/*
* RemotePlugin.h - base class providing RPC like mechanisms
*
* Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -27,6 +27,7 @@
#include "export.h"
#include "midi.h"
#include "VST_sync_shm.h"
#include <vector>
#include <cstdio>
@@ -115,7 +116,7 @@ typedef int32_t key_t;
// sometimes we need to exchange bigger messages (e.g. for VST parameter dumps)
// so set a usable value here
const int SHM_FIFO_SIZE = 64000;
const int SHM_FIFO_SIZE = 512*1024;
// implements a FIFO inside a shared memory segment
@@ -284,7 +285,7 @@ public:
// recursive lock
inline void lock()
{
if( !isInvalid() && ++m_lockDepth == 1 )
if( !isInvalid() && __sync_add_and_fetch( &m_lockDepth, 1 ) == 1 )
{
#ifdef USE_QT_SEMAPHORES
m_dataSem.acquire();
@@ -297,16 +298,13 @@ public:
// recursive unlock
inline void unlock()
{
if( m_lockDepth > 0 )
if( __sync_sub_and_fetch( &m_lockDepth, 1) <= 0 )
{
if( --m_lockDepth == 0 )
{
#ifdef USE_QT_SEMAPHORES
m_dataSem.release();
m_dataSem.release();
#else
sem_post( m_dataSem );
sem_post( m_dataSem );
#endif
}
}
}
@@ -418,7 +416,8 @@ private:
return;
}
lock();
while( _len > m_data->endPtr - m_data->startPtr )
while( isInvalid() == false &&
_len > m_data->endPtr - m_data->startPtr )
{
unlock();
#ifndef LMMS_BUILD_WIN32
@@ -439,7 +438,7 @@ private:
void write( const void * _buf, int _len )
{
if( isInvalid() )
if( isInvalid() || _len > SHM_FIFO_SIZE )
{
return;
}
@@ -484,7 +483,7 @@ private:
sem_t * m_dataSem;
sem_t * m_messageSem;
#endif
int m_lockDepth;
volatile int m_lockDepth;
} ;
@@ -509,12 +508,8 @@ enum RemoteMessageIDs
IdSaveSettingsToFile,
IdLoadSettingsFromString,
IdLoadSettingsFromFile,
IdLoadChunkFromPresetFile,
IdRotateProgram,
IdLoadPrograms,
IdSavePreset,
IdSetParameter,
IdLoadPresetFromFile,
IdSavePresetFile,
IdLoadPresetFile,
IdDebugMessage,
IdUserBase = 64
} ;
@@ -552,8 +547,7 @@ public:
message & addInt( int _i )
{
char buf[128];
buf[0] = 0;
char buf[32];
sprintf( buf, "%d", _i );
data.push_back( std::string( buf ) );
return *this;
@@ -561,8 +555,7 @@ public:
message & addFloat( float _f )
{
char buf[128];
buf[0] = 0;
char buf[32];
sprintf( buf, "%f", _f );
data.push_back( std::string( buf ) );
return *this;
@@ -615,7 +608,7 @@ public:
m_out = out;
}
void sendMessage( const message & _m );
int sendMessage( const message & _m );
message receiveMessage();
inline bool isInvalid() const
@@ -819,7 +812,9 @@ class RemotePluginClient : public RemotePluginBase
public:
RemotePluginClient( key_t _shm_in, key_t _shm_out );
virtual ~RemotePluginClient();
#ifdef USE_QT_SHMEM
sncVST * getQtVSTshm();
#endif
virtual bool processMessage( const message & _m );
virtual void process( const sampleFrame * _in_buf,
@@ -887,7 +882,9 @@ private:
#ifdef USE_QT_SHMEM
QSharedMemory m_shmObj;
QSharedMemory m_shmQtID;
#endif
sncVST * m_SncVSTplug;
float * m_shm;
int m_inputCount;
@@ -934,19 +931,21 @@ RemotePluginBase::~RemotePluginBase()
void RemotePluginBase::sendMessage( const message & _m )
int RemotePluginBase::sendMessage( const message & _m )
{
m_out->lock();
m_out->writeInt( _m.id );
m_out->writeInt( _m.data.size() );
int j = 0;
int j = 8;
for( unsigned int i = 0; i < _m.data.size(); ++i )
{
m_out->writeString( _m.data[i] );
j += _m.data[i].size();
j += 4 + _m.data[i].size();
}
m_out->unlock();
m_out->messageSent();
return j;
}
@@ -1013,13 +1012,60 @@ RemotePluginClient::RemotePluginClient( key_t _shm_in, key_t _shm_out ) :
RemotePluginBase( new shmFifo( _shm_in ), new shmFifo( _shm_out ) ),
#ifdef USE_QT_SHMEM
m_shmObj(),
m_shmQtID( "/usr/bin/lmms" ),
#endif
m_SncVSTplug( NULL ),
m_shm( NULL ),
m_inputCount( 0 ),
m_outputCount( 0 ),
m_sampleRate( 44100 ),
m_bufferSize( 0 )
{
#ifdef USE_QT_SHMEM
if( m_shmQtID.attach( QSharedMemory::ReadOnly ) )
{
m_SncVSTplug = (sncVST *) m_shmQtID.data();
m_bufferSize = m_SncVSTplug->m_bufferSize;
m_sampleRate = m_SncVSTplug->m_sampleRate;
return;
}
#else
key_t key;
int m_shmID;
if( ( key = ftok( VST_SNC_SHM_KEY_FILE, 'R' ) ) == -1 )
{
perror( "RemotePluginClient::ftok" );
}
else
{ // connect to shared memory segment
if( ( m_shmID = shmget( key, 0, 0 ) ) == -1 )
{
perror( "RemotePluginClient::shmget" );
}
else
{ // attach segment
m_SncVSTplug = (sncVST *)shmat(m_shmID, 0, 0);
if( m_SncVSTplug == (sncVST *)( -1 ) )
{
perror( "RemotePluginClient::shmat" );
}
else
{
m_bufferSize = m_SncVSTplug->m_bufferSize;
m_sampleRate = m_SncVSTplug->m_sampleRate;
// detach segment
if( shmdt(m_SncVSTplug) == -1 )
{
perror("RemotePluginClient::shmdt");
}
return;
}
}
}
#endif
// if attaching shared memory fails
sendMessage( IdSampleRateInformation );
sendMessage( IdBufferSizeInformation );
}
@@ -1029,6 +1075,9 @@ RemotePluginClient::RemotePluginClient( key_t _shm_in, key_t _shm_out ) :
RemotePluginClient::~RemotePluginClient()
{
#ifdef USE_QT_SHMEM
m_shmQtID.detach();
#endif
sendMessage( IdQuit );
#ifndef USE_QT_SHMEM
@@ -1038,6 +1087,14 @@ RemotePluginClient::~RemotePluginClient()
#ifdef USE_QT_SHMEM
sncVST * RemotePluginClient::getQtVSTshm()
{
return m_SncVSTplug;
}
#endif
bool RemotePluginClient::processMessage( const message & _m )
{
@@ -1107,13 +1164,15 @@ void RemotePluginClient::setShmKey( key_t _key, int _size )
{
#ifdef USE_QT_SHMEM
m_shmObj.setKey( QString::number( _key ) );
if( m_shmObj.attach() )
if( m_shmObj.attach() || m_shmObj.error() == QSharedMemory::NoError )
{
m_shm = (float *) m_shmObj.data();
}
else
{
debugMessage( "failed getting shared memory\n" );
char buf[64];
sprintf( buf, "failed getting shared memory: %d\n", m_shmObj.error() );
debugMessage( buf );
}
#else
if( m_shm != NULL )

View File

@@ -0,0 +1,70 @@
/*
* TimeDisplayWidget.h - widget for displaying current playback time
*
* Copyright (c) 2014 Ruben Ibarra
* Copyright (c) 2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _TIME_DISPLAY_WIDGET
#define _TIME_DISPLAY_WIDGET
#include <QtGui/QWidget>
#include <QtGui/QHBoxLayout>
#include "LcdWidget.h"
class TimeDisplayWidget : public QWidget
{
Q_OBJECT
public:
TimeDisplayWidget();
virtual ~TimeDisplayWidget();
protected:
virtual void mousePressEvent( QMouseEvent* mouseEvent );
private slots:
void updateTime();
private:
enum DisplayModes
{
MinutesSeconds,
BarsTicks,
DisplayModeCount
};
typedef DisplayModes DisplayMode;
void setDisplayMode( DisplayMode displayMode );
DisplayMode m_displayMode;
QHBoxLayout m_spinBoxesLayout;
LcdWidget m_majorLCD;
LcdWidget m_minorLCD;
LcdWidget m_milliSecondsLCD;
} ;
#endif

58
include/VST_sync_shm.h Normal file
View File

@@ -0,0 +1,58 @@
/*
* VST_sync_shm.h - type declarations needed for VST to lmms host sync
*
* Copyright (c) 2004-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _VST_SYNC_SHM_H
#define _VST_SYNC_SHM_H
// VST sync frequency (in ms), how often will be VST plugin synced
// keep it power of two if possible (not used by now)
//#define VST_SNC_TIMER 1
// When defined, latency should be subtracted from song PPQ position
//#define VST_SNC_LATENCY
// define file for ftok as shared memory shmget key
#define VST_SNC_SHM_KEY_FILE "/dev/null"
//#define VST_SNC_SHM_RND_KEY 3561653564469
struct sncVST
{
bool isPlayin;
float ppqPos;
int timeSigNumer;
int timeSigDenom;
bool isCycle;
bool hasSHM;
float cycleStart;
float cycleEnd;
int m_bufferSize;
int m_sampleRate;
int m_bpm;
#ifdef VST_SNC_LATENCY
float m_latency;
#endif
} ;
#endif

View File

@@ -114,8 +114,14 @@ const int kEffectMagic = CCONST( 'V', 's', 't', 'P' );
const int kVstLangEnglish = 1;
const int kVstMidiType = 1;
const int kVstParameterUsesFloatStep = 1 << 2;
const int kVstPpqPosValid = 1 << 9;
const int kVstTempoValid = 1 << 10;
const int kVstBarsValid = 1 << 11;
const int kVstCyclePosValid = 1 << 12;
const int kVstTimeSigValid = 1 << 13;
const int kVstTransportPlaying = 1 << 1;
const int kVstTransportCycleActive = 1 << 2;
const int kVstTransportChanged = 1;
class RemoteVstPlugin;
@@ -267,12 +273,18 @@ public:
double samplePos;
// 08
double sampleRate;
// unconfirmed 10 18
char empty1[8 + 8];
// unconfirmed 10
char empty1[8];
// 18
double ppqPos;
// 20?
double tempo;
// unconfirmed 28 30 38
char empty2[8 + 8 + 8];
// 28
double barStartPos;
// 30?
double cycleStartPos;
// 38?
double cycleEndPos;
// 40?
int timeSigNumerator;
// 44?

View File

@@ -2,7 +2,7 @@
* export_project_dialog.h - declaration of class exportProjectDialog which is
* responsible for exporting project
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -28,17 +28,17 @@
#define _EXPORT_PROJECT_DIALOG_H
#include <QtGui/QDialog>
#include <vector>
#include "ui_export_project.h"
class ProjectRenderer;
#include "ProjectRenderer.h"
class exportProjectDialog : public QDialog, public Ui::ExportProjectDialog
{
Q_OBJECT
public:
exportProjectDialog( const QString & _file_name, QWidget * _parent );
exportProjectDialog( const QString & _file_name, QWidget * _parent, bool multi_export );
virtual ~exportProjectDialog();
@@ -50,12 +50,25 @@ protected:
private slots:
void startBtnClicked( void );
void updateTitleBar( int );
void render(ProjectRenderer* renderer);
void multiRender();
ProjectRenderer* prepRender();
void popRender();
void accept();
private:
QString m_fileName;
ProjectRenderer * m_renderer;
QString m_dirName;
QString m_fileExtension;
typedef QVector<ProjectRenderer*> RenderVector;
RenderVector m_renderers;
bool m_multiExport;
typedef QVector<track*> TrackVector;
TrackVector m_unmuted;
TrackVector m_unmutedBB;
ProjectRenderer::ExportFileFormats m_ft;
TrackVector m_tracksToRender;
} ;
#endif

View File

@@ -1,7 +1,7 @@
/*
* fader.h - fader-widget used in FX-mixer - partly taken from Hydrogen
*
* Copyright (c) 2008-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -74,23 +74,25 @@ public:
private:
virtual void contextMenuEvent( QContextMenuEvent * _me );
virtual void mousePressEvent( QMouseEvent *ev );
virtual void mouseDoubleClickEvent( QMouseEvent* mouseEvent );
virtual void mouseMoveEvent( QMouseEvent *ev );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void wheelEvent( QWheelEvent *ev );
virtual void paintEvent( QPaintEvent *ev );
inline uint knob_y() const
int knobPosY() const
{
float fRange = m_model->maxValue() - m_model->minValue();
float realVal = m_model->value() - m_model->minValue();
// uint knob_y = (uint)( 116.0 - ( 86.0 * ( m_model->value() / fRange ) ) );
return (uint)( 116.0 - ( 86.0 * ( realVal / fRange ) ) );
return height() - ( ( height() - m_knob.height() ) * ( realVal / fRange ) );
}
FloatModel * m_model;
void setPeak( float fPeak, float &targetPeak, float &persistentPeak, QTime &lastPeakTime );
int calculateDisplayPeak( float fPeak );
float m_fPeakValue_L;
float m_fPeakValue_R;
float m_persistentPeak_L;
@@ -105,6 +107,9 @@ private:
QPixmap m_leds;
QPixmap m_knob;
int m_moveStartPoint;
float m_startValue;
static textFloat * s_textFloat;
void updateTextFloat();

View File

@@ -1,7 +1,7 @@
/*
* fft_helpers.h - some functions around FFT analysis
*
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -29,8 +29,6 @@
#include "lmmsconfig.h"
#include "export.h"
#ifdef LMMS_HAVE_FFTW3F
#include <fftw3.h>
const int FFT_BUFFER_SIZE = 2048;
@@ -85,5 +83,3 @@ int EXPORT calc13octaveband31( float * _absspec_buffer, float * _subbands,
float EXPORT signalpower(float *timesignal, int num_values);
#endif
#endif

View File

@@ -112,6 +112,8 @@ protected:
virtual void paintEvent( QPaintEvent * _me );
virtual void wheelEvent( QWheelEvent * _me );
virtual float getValue( const QPoint & _p );
private slots:
virtual void enterValue();
void displayHelp();
@@ -128,7 +130,6 @@ private:
void drawKnob( QPainter * _p );
void setPosition( const QPoint & _p );
float getValue( const QPoint & _p );
bool updateAngle();
inline float pageSize() const

View File

@@ -1,8 +1,8 @@
/*
* lcd_spinbox.h - class lcdSpinBox, an improved QLCDNumber
*
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
@@ -26,32 +26,20 @@
#ifndef _LCD_SPINBOX_H
#define _LCD_SPINBOX_H
#include <QtCore/QMap>
#include <QtGui/QWidget>
#include "LcdWidget.h"
#include "AutomatableModelView.h"
class EXPORT lcdSpinBox : public QWidget, public IntModelView
class EXPORT lcdSpinBox : public LcdWidget, public IntModelView
{
Q_OBJECT
public:
lcdSpinBox( int _num_digits, QWidget * _parent, const QString & _name =
QString::null );
lcdSpinBox( int numDigits, QWidget* parent, const QString& name = QString::null );
lcdSpinBox( int _num_digits, const QString & _lcd_style,
QWidget * _parent, const QString & _name = QString::null );
lcdSpinBox( int numDigits, const QString& style, QWidget* parent, const QString& name = QString::null );
virtual ~lcdSpinBox();
void setLabel( const QString & _txt );
inline void addTextForValue( int _val, const QString & _text )
{
m_textForValue[_val] = _text;
update();
}
virtual void modelChanged()
{
ModelView::modelChanged();
@@ -60,8 +48,6 @@ public:
public slots:
virtual void setEnabled( bool _on );
virtual void setMarginWidth( int _width );
virtual void update();
@@ -71,26 +57,8 @@ protected:
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
virtual void wheelEvent( QWheelEvent * _we );
virtual void paintEvent( QPaintEvent * _me );
virtual void updateSize();
private:
static const int charsPerPixmap = 12;
QMap<int, QString> m_textForValue;
QString m_display;
QString m_label;
QPixmap * m_lcdPixmap;
int m_cellWidth;
int m_cellHeight;
int m_numDigits;
int m_marginWidth;
QPoint m_origMousePos;

View File

@@ -1,7 +1,7 @@
/*
* midi.h - constants, structs etc. concerning MIDI
*
* Copyright (c) 2005-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2013 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -81,10 +81,41 @@ enum MidiMetaEvents
} ;
enum MidiStandardControllers
{
MidiControllerBankSelect = 0,
MidiControllerModulationWheel = 1,
MidiControllerBreathController = 2,
MidiControllerFootController = 4,
MidiControllerPortamentoTime = 5,
MidiControllerMainVolume = 7,
MidiControllerBalance = 8,
MidiControllerPan = 10,
MidiControllerEffectControl1 = 12,
MidiControllerEffectControl2 = 13,
MidiControllerSustain = 64,
MidiControllerPortamento = 65,
MidiControllerSostenuto = 66,
MidiControllerSoftPedal = 67,
MidiControllerLegatoFootswitch = 68,
// Channel Mode Messages are controllers too...
MidiControllerAllSoundOff = 120,
MidiControllerResetAllControllers = 121,
MidiControllerLocalControl = 122,
MidiControllerAllNotesOff = 123,
MidiControllerOmniOn = 124,
MidiControllerOmniOff = 125,
MidiControllerMonoOn = 126,
MidiControllerPolyOn = 127,
};
const int MidiChannelCount = 16;
const int MidiControllerCount = 128;
const int MidiProgramCount = 128;
const int MidiMaxVelocity = 127;
const int MidiMaxControllerValue = 127;
const int MidiMaxNote = 127;
const int MidiMaxPanning = 127;
const int MidiMinPanning = -128;
@@ -101,7 +132,8 @@ struct midiEvent
m_metaEvent( MidiMetaInvalid ),
m_channel( _channel ),
m_sysExData( NULL ),
m_sourcePort( _sourcePort )
m_sourcePort( _sourcePort ),
m_fromMidiPort( false )
{
m_data.m_param[0] = _param1;
m_data.m_param[1] = _param2;
@@ -113,7 +145,8 @@ struct midiEvent
m_metaEvent( MidiMetaInvalid ),
m_channel( 0 ),
m_sysExData( _sysex_data ),
m_sourcePort( NULL )
m_sourcePort( NULL ),
m_fromMidiPort( false )
{
m_data.m_sysExDataLen = _data_len;
}
@@ -124,7 +157,8 @@ struct midiEvent
m_channel( _copy.m_channel ),
m_data( _copy.m_data ),
m_sysExData( _copy.m_sysExData ),
m_sourcePort( _copy.m_sourcePort )
m_sourcePort( _copy.m_sourcePort ),
m_fromMidiPort( _copy.m_fromMidiPort )
{
}
@@ -148,6 +182,16 @@ struct midiEvent
return m_data.m_param[0];
}
inline uint8_t controllerNumber() const
{
return m_data.m_param[0];
}
inline uint8_t controllerValue() const
{
return m_data.m_param[1];
}
inline Sint16 velocity() const
{
return m_data.m_param[1];
@@ -181,6 +225,15 @@ struct midiEvent
( (float)( PanningRight - PanningLeft ) ) );
}
void setFromMidiPort( bool enabled )
{
m_fromMidiPort = enabled;
}
bool isFromMidiPort() const
{
return m_fromMidiPort;
}
MidiEventTypes m_type; // MIDI event type
MidiMetaEvents m_metaEvent; // Meta event (mostly unused)
@@ -195,6 +248,10 @@ struct midiEvent
const char * m_sysExData;
const void * m_sourcePort;
private:
bool m_fromMidiPort;
} ;

View File

@@ -77,10 +77,10 @@ public:
const float _freq,
const bool _looped = false );
void visualize( QPainter & _p, const QRect & _dr, const QRect & _clip );
inline void visualize( QPainter & _p, const QRect & _dr )
void visualize( QPainter & _p, const QRect & _dr, const QRect & _clip, f_cnt_t _from_frame = 0, f_cnt_t _to_frame = 0 );
inline void visualize( QPainter & _p, const QRect & _dr, f_cnt_t _from_frame = 0, f_cnt_t _to_frame = 0 )
{
visualize( _p, _dr, _dr );
visualize( _p, _dr, _dr, _from_frame, _to_frame );
}
inline const QString & audioFile() const
@@ -132,6 +132,16 @@ public:
return m_frequency;
}
sample_rate_t sampleRate() const
{
return m_sampleRate;
}
int sampleLength() const
{
return double( m_endFrame - m_startFrame ) / m_sampleRate * 1000;
}
inline void setFrequency( float _freq )
{
m_varLock.lock();

View File

@@ -105,8 +105,11 @@ private slots:
void toggleDisableChActInd( bool _disabled );
void toggleManualChPiano( bool _enabled );
void toggleSmoothScroll( bool _enabled );
void toggleAutoSave( bool _enabled );
void toggleOneInstrumentTrackWindow( bool _enabled );
void toggleCompactTrackButtons( bool _enabled );
void toggleSyncVSTPlugins( bool _enabled );
void toggleAnimateAFP( bool _enabled );
private:
@@ -152,8 +155,11 @@ private:
bool m_disableChActInd;
bool m_manualChPiano;
bool m_smoothScroll;
bool m_enableAutoSave;
bool m_oneInstrumentTrackWindow;
bool m_compactTrackButtons;
bool m_syncVSTPlugins;
bool m_animateAFP;
typedef QMap<QString, AudioDevice::setupWidget *> AswMap;
typedef QMap<QString, MidiClient::setupWidget *> MswMap;

View File

@@ -1,7 +1,7 @@
/*
* song.h - class song - the root of the model-tree
*
* Copyright (c) 2004-2011 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -25,13 +25,14 @@
#ifndef _SONG_H
#define _SONG_H
#include <QtCore/QSharedMemory>
#include <QtCore/QVector>
#include "track_container.h"
#include "AutomatableModel.h"
#include "Controller.h"
#include "MeterModel.h"
#include "VST_sync_shm.h"
class AutomationTrack;
class pattern;
@@ -94,7 +95,46 @@ public:
void processNextBuffer();
inline int getMilliseconds() const
{
return m_elapsedMilliSeconds;
}
inline void setMilliSeconds( float _ellapsedMilliSeconds )
{
m_elapsedMilliSeconds = (_ellapsedMilliSeconds);
}
inline int getTacts() const
{
return currentTact();
}
inline int ticksPerTact() const
{
return DefaultTicksPerTact *
m_timeSigModel.getNumerator() /
m_timeSigModel.getDenominator();
}
// Returns the beat position inside the bar, 0-based
inline int getBeat() const
{
return (currentTick() - currentTact()*ticksPerTact()) /
(ticksPerTact() / m_timeSigModel.getNumerator() );
}
// the remainder after bar and beat are removed
inline int getBeatTicks() const
{
return (currentTick() - currentTact()*ticksPerTact()) %
(ticksPerTact() / m_timeSigModel.getNumerator() );
}
inline int getTicks() const
{
return currentTick();
}
inline bool isTempoAutomated()
{
return m_tempoModel.isAutomated();
}
inline bool isPaused() const
{
return m_paused;
@@ -117,6 +157,11 @@ public:
return m_exporting;
}
inline void setExportLoop( bool exportLoop )
{
m_exportLoop = exportLoop;
}
inline bool isRecording() const
{
return m_recording;
@@ -126,8 +171,16 @@ public:
inline bool isExportDone() const
{
return m_exporting == true &&
m_playPos[Mode_PlaySong].getTact() >= length() + 1;
if ( m_exportLoop )
{
return m_exporting == true &&
m_playPos[Mode_PlaySong].getTact() >= length();
}
else
{
return m_exporting == true &&
m_playPos[Mode_PlaySong].getTact() >= length() + 1;
}
}
inline PlayModes playMode() const
@@ -212,7 +265,8 @@ public slots:
void stop();
void importProject();
void exportProject();
void exportProject(bool multiExport=false);
void exportProjectTracks();
void startExport();
void stopExport();
@@ -240,6 +294,8 @@ private slots:
void updateFramesPerTick();
void updateSampleRateSHM();
private:
@@ -248,13 +304,6 @@ private:
virtual ~song();
inline int ticksPerTact() const
{
return DefaultTicksPerTact *
m_timeSigModel.getNumerator() /
m_timeSigModel.getDenominator();
}
inline tact_t currentTact() const
{
return m_playPos[m_playMode].getTact();
@@ -287,6 +336,7 @@ private:
volatile bool m_recording;
volatile bool m_exporting;
volatile bool m_exportLoop;
volatile bool m_playing;
volatile bool m_paused;
@@ -300,6 +350,25 @@ private:
pattern * m_patternToPlay;
bool m_loopPattern;
double m_elapsedMilliSeconds;
tick_t m_elapsedTicks;
tact_t m_elapsedTacts;
enum Actions
{
ActionStop,
ActionPlaySong,
ActionPlayTrack,
ActionPlayBB,
ActionPlayPattern,
ActionPause,
ActionResumeFromPause
} ;
QVector<Actions> m_actions;
int m_shmID;
sncVST * m_SncVSTplug;
QSharedMemory m_shmQtID;
friend class engine;
friend class songEditor;

View File

@@ -59,6 +59,13 @@ const int TRACK_OP_WIDTH = 78;
const int DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT = 96;
const int TRACK_OP_WIDTH_COMPACT = 60;
/*! The minimum track height in pixels
*
* Tracks can be resized by shift-dragging anywhere inside the track
* display. This sets the minimum size in pixels for a track.
*/
const Uint16 MINIMAL_TRACK_HEIGHT = 8;
const Uint16 DEFAULT_TRACK_HEIGHT = 32;
const int TCO_BORDER_WIDTH = 1;
@@ -435,6 +442,13 @@ public:
using Model::dataChanged;
inline int getHeight() {
return ( m_height >= MINIMAL_TRACK_HEIGHT ? m_height : DEFAULT_TRACK_HEIGHT );
}
inline void setHeight( int _height ) {
m_height = _height;
}
public slots:
virtual void setName( const QString & _new_name )
@@ -450,6 +464,7 @@ private:
trackContainer * m_trackContainer;
TrackTypes m_type;
QString m_name;
int m_height;
BoolModel m_mutedModel;
BoolModel m_soloModel;