Merge branch 'stable-1.2' into master (@liushuyu)

This commit is contained in:
Hyunin Song
2017-07-15 07:56:28 +09:00
113 changed files with 1513 additions and 609 deletions

74
include/AudioFileMP3.h Normal file
View File

@@ -0,0 +1,74 @@
/*
* AudioFileMP3.h - Audio-device which encodes a wave stream into
* an MP3 file. This is used for song export.
*
* Copyright (c) 2017 to present Michael Gregorius <michael.gregorius.git/at/arcor[dot]de>
*
* This file is part of LMMS - https://lmms.io
*
* 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 AUDIO_FILE_MP3_H
#define AUDIO_FILE_MP3_H
#include "lmmsconfig.h"
#ifdef LMMS_HAVE_MP3LAME
#include "AudioFileDevice.h"
#include "lame/lame.h"
class AudioFileMP3 : public AudioFileDevice
{
public:
AudioFileMP3( OutputSettings const & outputSettings,
const ch_cnt_t _channels,
bool & successful,
const QString & _file,
Mixer* mixer );
virtual ~AudioFileMP3();
static AudioFileDevice * getInst( const QString & outputFilename,
OutputSettings const & outputSettings,
const ch_cnt_t channels,
Mixer* mixer,
bool & successful )
{
return new AudioFileMP3( outputSettings, channels, successful,
outputFilename, mixer );
}
protected:
virtual void writeBuffer( const surroundSampleFrame * /* _buf*/,
const fpp_t /*_frames*/,
const float /*_master_gain*/ );
private:
void flushRemainingBuffers();
bool initEncoder();
void tearDownEncoder();
private:
lame_t m_lame;
};
#endif
#endif

View File

@@ -407,7 +407,7 @@ public:
{
}
float getRoundedValue() const;
float getDigitCount();
int getDigitCount() const;
defaultTypedMethods(float);
} ;

View File

@@ -217,6 +217,9 @@ public:
const QString & value( const QString & cls,
const QString & attribute ) const;
const QString & value( const QString & cls,
const QString & attribute,
const QString & defaultVal ) const;
void setValue( const QString & cls, const QString & attribute,
const QString & value );
void deleteValue( const QString & cls, const QString & attribute);

View File

@@ -57,7 +57,7 @@ public:
protected:
virtual void mousePressEvent( QMouseEvent * _me );
virtual void resizeEvent( QResizeEvent * _re );
virtual void paintEvent( QPaintEvent * _pe );
private:

View File

@@ -110,8 +110,7 @@ public:
enum SessionState
{
Normal,
Recover,
Limited,
Recover
};
void setSession( SessionState session )
@@ -143,7 +142,7 @@ public:
return m_keyMods.m_alt;
}
static void saveWidgetState( QWidget * _w, QDomElement & _de, QSize const & sizeIfInvisible = QSize(0, 0) );
static void saveWidgetState( QWidget * _w, QDomElement & _de );
static void restoreWidgetState( QWidget * _w, const QDomElement & _de );
public slots:

View File

@@ -38,6 +38,13 @@ public:
NumDepths
};
enum StereoMode
{
StereoMode_Stereo,
StereoMode_JointStereo,
StereoMode_Mono
};
class BitRateSettings
{
public:
@@ -60,10 +67,19 @@ public:
public:
OutputSettings( sample_rate_t sampleRate,
BitRateSettings const & bitRateSettings,
BitDepth bitDepth ) :
BitDepth bitDepth,
StereoMode stereoMode ) :
m_sampleRate(sampleRate),
m_bitRateSettings(bitRateSettings),
m_bitDepth(bitDepth)
m_bitDepth(bitDepth),
m_stereoMode(stereoMode)
{
}
OutputSettings( sample_rate_t sampleRate,
BitRateSettings const & bitRateSettings,
BitDepth bitDepth ) :
OutputSettings(sampleRate, bitRateSettings, bitDepth, StereoMode_Stereo )
{
}
@@ -76,10 +92,14 @@ public:
BitDepth getBitDepth() const { return m_bitDepth; }
void setBitDepth(BitDepth bitDepth) { m_bitDepth = bitDepth; }
StereoMode getStereoMode() const { return m_stereoMode; }
void setStereoMode(StereoMode stereoMode) { m_stereoMode = stereoMode; }
private:
sample_rate_t m_sampleRate;
BitRateSettings m_bitRateSettings;
BitDepth m_bitDepth;
StereoMode m_stereoMode;
};
#endif

View File

@@ -88,7 +88,7 @@ public:
{
return m_patternType;
}
void checkType();
// next/previous track based on position in the containing track
Pattern * previousPattern() const;
@@ -132,6 +132,7 @@ private:
MidiTime beatPatternLength() const;
void setType( PatternTypes _new_pattern_type );
void checkType();
void resizeToFirstTrack();

View File

@@ -39,11 +39,14 @@ public:
{
WaveFile,
OggFile,
MP3File,
NumFileFormats
} ;
struct FileEncodeDevice
{
bool isAvailable() const { return m_getDevInst != nullptr; }
ExportFileFormats m_fileFormat;
const char * m_description;
const char * m_extension;

View File

@@ -153,6 +153,7 @@ public:
public slots:
void updateTcos();
void setPlayingTcos( bool isPlaying );
private:
FloatModel m_volumeModel;

View File

@@ -97,6 +97,10 @@ public:
void processNextBuffer();
inline int getLoadingTrackCount() const
{
return m_nLoadingTrack;
}
inline int getMilliseconds() const
{
return m_elapsedMilliSeconds;
@@ -339,6 +343,7 @@ private:
ControllerVector m_controllers;
int m_nLoadingTrack;
QString m_fileName;
QString m_oldFileName;

View File

@@ -81,6 +81,7 @@ public slots:
void setEditModeSelect();
void updatePosition( const MidiTime & t );
void updatePositionLine();
protected:
virtual void closeEvent( QCloseEvent * ce );
@@ -152,6 +153,9 @@ public:
SongEditor* m_editor;
protected:
virtual void resizeEvent( QResizeEvent * event );
protected slots:
void play();
void record();
@@ -162,6 +166,7 @@ protected slots:
signals:
void playTriggered();
void resized();
private:
QAction* m_addBBTrackAction;

View File

@@ -29,25 +29,47 @@
#include <QWidget>
#include <QtCore/QMap>
const int TEXT_TAB_HEIGHT = 14;
const int GRAPHIC_TAB_HEIGHT = 17;
class TabWidget : public QWidget
{
Q_OBJECT
public:
TabWidget( const QString & _caption, QWidget * _parent );
TabWidget( const QString & _caption, QWidget * _parent, bool usePixmap = false );
virtual ~TabWidget();
void addTab( QWidget * _w, const QString & _name, int _idx = -1 );
void addTab( QWidget * w, const QString & name, const char *pixmap = NULL, int idx = -1 );
void setActiveTab( int _idx );
void setActiveTab( int idx );
int findTabAtPos( const QPoint *pos );
inline int activeTab() const
{
return( m_activeTab );
}
// Themeability
Q_PROPERTY( QColor tabText READ tabText WRITE setTabText)
Q_PROPERTY( QColor tabTitleText READ tabTitleText WRITE setTabTitleText)
Q_PROPERTY( QColor tabSelected READ tabSelected WRITE setTabSelected)
Q_PROPERTY( QColor tabBackground READ tabBackground WRITE setTabBackground)
Q_PROPERTY( QColor tabBorder READ tabBorder WRITE setTabBorder)
QColor tabText() const;
void setTabText( const QColor & c );
QColor tabTitleText() const;
void setTabTitleText( const QColor & c );
QColor tabSelected() const;
void setTabSelected( const QColor & c );
QColor tabBackground() const;
void setTabBackground( const QColor & c );
QColor tabBorder() const;
void setTabBorder( const QColor & c );
protected:
virtual bool event( QEvent * event );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void paintEvent( QPaintEvent * _pe );
virtual void resizeEvent( QResizeEvent * _re );
@@ -57,16 +79,26 @@ protected:
private:
struct widgetDesc
{
QWidget * w; // ptr to widget
QString name; // name for widget
int nwidth; // width of name when painting
QWidget * w; // ptr to widget
const char * pixmap; // artwork for the widget
QString name; // name for widget
int nwidth; // width of name when painting (only valid for text tab)
} ;
typedef QMap<int, widgetDesc> widgetStack;
widgetStack m_widgets;
int m_activeTab;
QString m_caption;
quint8 m_tabheight;
int m_activeTab;
QString m_caption; // Tab caption, used as the tooltip text on icon tabs
quint8 m_tabbarHeight; // The height of the tab bar
quint8 m_tabheight; // The height of the tabs
bool m_usePixmap; // true if the tabs are to be displayed with icons. False for text tabs.
QColor m_tabText; // The color of the tabs' text.
QColor m_tabTitleText; // The color of the TabWidget's title text.
QColor m_tabSelected; // The highlighting color for the selected tab.
QColor m_tabBackground; // The TabWidget's background color.
QColor m_tabBorder; // The TabWidget's borders color.
} ;
#endif

View File

@@ -29,9 +29,10 @@
#include <QToolButton>
#include <QLineEdit>
class TrackView;
class TrackRenameLineEdit;
class TrackLabelButton : public QToolButton
{
@@ -60,7 +61,7 @@ protected:
private:
TrackView * m_trackView;
QString m_iconName;
QLineEdit * m_renameLineEdit;
TrackRenameLineEdit * m_renameLineEdit;
QRect m_buttonRect;
QString elideName( const QString &name );

View File

@@ -0,0 +1,46 @@
/*
* TrackRenameLineEdit.h - class TrackRenameLineEdit
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2017 Alexandre Almeida <http://m374lx.users.sourceforge.net/>
*
* This file is part of LMMS - https://lmms.io
*
* 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 TRACK_RENAME_LINE_EDIT_H
#define TRACK_RENAME_LINE_EDIT_H
#include <QLineEdit>
class TrackRenameLineEdit : public QLineEdit
{
Q_OBJECT
public:
TrackRenameLineEdit( QWidget * parent );
void show();
protected:
virtual void keyPressEvent( QKeyEvent * ke );
private:
QString m_oldName;
} ;
#endif