* introduced new project-export dialog

* new class for easily rendering a project into a file
* when changing quality-settings tell audio-devices about it so that they can adjust their output-samplerate



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@958 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-05-11 20:08:34 +00:00
parent 5cfb1b2f96
commit e32eed940f
28 changed files with 956 additions and 522 deletions

View File

@@ -81,6 +81,7 @@ public:
private:
virtual void startProcessing( void );
virtual void stopProcessing( void );
virtual void applyQualitySettings( void );
virtual void run( void );
int setHWParams( const ch_cnt_t _channels, snd_pcm_access_t _access );

View File

@@ -83,11 +83,15 @@ public:
virtual void startProcessing( void )
{
m_in_process = TRUE;
m_inProcess = TRUE;
}
virtual void stopProcessing( void );
virtual void applyQualitySettings( void )
{
}
class setupWidget : public tabWidget
{
@@ -163,7 +167,7 @@ private:
sample_rate_t m_sampleRate;
ch_cnt_t m_channels;
mixer * m_mixer;
bool m_in_process;
bool m_inProcess;
QMutex m_devMutex;

View File

@@ -45,6 +45,10 @@ public:
mixer * _mixer );
virtual ~audioFileDevice();
QString outputFile( void ) const
{
return( m_outputFile.fileName() );
}
protected:
@@ -89,4 +93,16 @@ private:
} ;
typedef audioFileDevice * ( * audioFileDeviceInstantiaton )
( const sample_rate_t _sample_rate,
const ch_cnt_t _channels,
bool & _success_ful,
const QString & _file,
const bool _use_vbr,
const bitrate_t _nom_bitrate,
const bitrate_t _min_bitrate,
const bitrate_t _max_bitrate,
mixer * _mixer );
#endif

View File

@@ -80,6 +80,7 @@ public:
private:
virtual void startProcessing( void );
virtual void stopProcessing( void );
virtual void applyQualitySettings( void );
virtual void registerPort( audioPort * _port );
virtual void unregisterPort( audioPort * _port );

View File

@@ -76,6 +76,7 @@ public:
private:
virtual void startProcessing( void );
virtual void stopProcessing( void );
virtual void applyQualitySettings( void );
virtual void run( void );
int m_audioFD;

View File

@@ -77,6 +77,7 @@ public:
private:
virtual void startProcessing( void );
virtual void stopProcessing( void );
virtual void applyQualitySettings( void );
static void sdlAudioCallback( void * _udata, Uint8 * _buf, int _len );
void sdlAudioCallback( Uint8 * _buf, int _len );

View File

@@ -53,7 +53,7 @@ public:
inline bool isSampleExact( void ) const
{
return m_sampleExact ||
engine::getMixer()->qualitySettings().
engine::getMixer()->currentQualitySettings().
sampleExactControllers;
}

View File

@@ -1,69 +0,0 @@
/*
* export.h - header which is needed for song-export
*
* Copyright (c) 2004-2008 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 _EXPORT_H
#define _EXPORT_H
#include <QtCore/QString>
#include "types.h"
class audioFileDevice;
class mixer;
typedef audioFileDevice * ( * getDeviceInst)( const sample_rate_t _sample_rate,
const ch_cnt_t _channels,
bool & _success_ful,
const QString & _file,
const bool _use_vbr,
const bitrate_t _nom_bitrate,
const bitrate_t _min_bitrate,
const bitrate_t _max_bitrate,
mixer * _mixer );
enum ExportFileTypes
{
WaveFile,
OggFile,
NullFile = 0xFF
} ;
struct fileEncodeDevice
{
ExportFileTypes m_fileType;
const char * m_description;
const char * m_extension;
getDeviceInst m_getDevInst;
} ;
extern fileEncodeDevice fileEncodeDevices[];
#endif

View File

@@ -29,20 +29,12 @@
#include <QtGui/QDialog>
#include "export.h"
#include "automatable_model.h"
#include "combobox.h"
#include "ui_export_project.uic"
class projectRenderer;
class QLabel;
class QPushButton;
class QProgressBar;
class ledCheckBox;
class pixmapButton;
class exportProjectDialog : public QDialog
class exportProjectDialog : public QDialog, public Ui::ExportProjectDialog
{
Q_OBJECT
public:
@@ -50,47 +42,18 @@ public:
virtual ~exportProjectDialog();
public slots:
void exportBtnClicked( void );
protected:
virtual void keyPressEvent( QKeyEvent * _ke );
virtual void reject( void );
virtual void closeEvent( QCloseEvent * _ce );
private slots:
void changedType( const QString & );
void cancelBtnClicked( void );
void startBtnClicked( void );
private:
void finishProjectExport( void );
void abortProjectExport( void );
static ExportFileTypes getFileTypeFromExtension( const QString & _ext );
static Sint16 s_availableBitrates[];
comboBoxModel m_typeModel;
comboBoxModel m_kbpsModel;
boolModel m_vbrEnabledModel;
boolModel m_hqmEnabledModel;
QLabel * m_typeLbl;
comboBox * m_typeCombo;
QLabel * m_kbpsLbl;
comboBox * m_kbpsCombo;
ledCheckBox * m_vbrCb;
ledCheckBox * m_hqmCb;
QLabel * m_hourglassLbl;
QPushButton * m_exportBtn;
QPushButton * m_cancelBtn;
QProgressBar * m_exportProgressBar;
QString m_fileName;
ExportFileTypes m_fileType;
bool m_deleteFile;
projectRenderer * m_renderer;
} ;

View File

@@ -101,6 +101,7 @@ public:
Mode_HighQuality,
Mode_FinalMix
} ;
enum Interpolation
{
Interpolation_Linear,
@@ -199,6 +200,8 @@ public:
}
void setAudioDevice( audioDevice * _dev );
void setAudioDevice( audioDevice * _dev,
const struct qualitySettings & _qs );
void restoreAudioDevice( void );
inline audioDevice * audioDev( void )
{
@@ -291,7 +294,7 @@ public:
return( m_cpuLoad );
}
const qualitySettings & qualitySettings( void ) const
const qualitySettings & currentQualitySettings( void ) const
{
return( m_qualitySettings );
}

View File

@@ -0,0 +1,84 @@
/*
* project_renderer.h - projectRenderer-class for easily rendering projects
*
* Copyright (c) 2008 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 _PROJECT_RENDERER_H
#define _PROJECT_RENDERER_H
#include "audio_file_device.h"
class projectRenderer : public QThread
{
Q_OBJECT
public:
enum ExportFileTypes
{
WaveFile,
OggFile,
NullFile = 0xFF
} ;
struct outputSettings
{
sample_rate_t samplerate;
bool vbr;
int bitrate;
outputSettings( sample_rate_t _sr, bool _vbr, int _bitrate ) :
samplerate( _sr ),
vbr( _vbr ),
bitrate( _bitrate )
{
}
} ;
projectRenderer( const mixer::qualitySettings & _qs,
const outputSettings & _os,
ExportFileTypes _file_type,
const QString & _out_file );
virtual ~projectRenderer();
static ExportFileTypes getFileTypeFromExtension( const QString & _ext );
public slots:
void startProcessing( void );
void abortProcessing( void );
signals:
void progressChanged( int );
private:
virtual void run( void );
audioFileDevice * m_fileDev;
mixer::qualitySettings m_qualitySettings;
volatile bool m_abort;
} ;
#endif

View File

@@ -194,7 +194,7 @@ public slots:
void exportProject( void );
void startExport( void );
void cancelExport( void );
void stopExport( void );
void setModified( void );

View File

@@ -57,6 +57,7 @@ signals:
private slots:
void setHighQuality( bool );
void scrolled( int _new_pos );
void updateTimeLinePosition( void );