Merged my own and Toby's changes from last week.
Modified Files: ChangeLog Makefile.am TODO data/presets/TripleOscillator/Makefile include/base64.h include/config_mgr.h include/file_browser.h include/instrument_track.h include/knob.h include/mixer.h include/mmp.h include/sample_buffer.h include/sample_track.h include/setup_dialog.h include/spc_bg_hndl_widget.h plugins/audio_file_processor/audio_file_processor.cpp plugins/audio_file_processor/audio_file_processor.h plugins/bit_invader/bit_invader.cpp plugins/organic/organic.cpp plugins/organic/organic.h plugins/plucked_string_synth/plucked_string_synth.cpp plugins/triple_oscillator/triple_oscillator.cpp plugins/triple_oscillator/triple_oscillator.h plugins/vestige/lvsl_client.cpp plugins/vestige/vestige.cpp plugins/vibed/impulse_editor.cpp plugins/vibed/nine_button_selector.cpp plugins/vibed/nine_button_selector.h plugins/vibed/vibed.cpp plugins/vibed/vibed.h src/lmms_single_source.cpp src/core/bb_editor.cpp src/core/config_mgr.cpp src/core/file_browser.cpp src/core/main_window.cpp src/core/midi_tab_widget.cpp src/core/mixer.cpp src/core/piano_roll.cpp src/core/setup_dialog.cpp src/core/song_editor.cpp src/core/track.cpp src/lib/mmp.cpp src/lib/sample_buffer.cpp src/tracks/instrument_track.cpp src/tracks/sample_track.cpp src/widgets/fade_button.cpp src/widgets/group_box.cpp src/widgets/lcd_spinbox.cpp src/widgets/project_notes.cpp src/widgets/tab_widget.cpp src/widgets/text_float.cpp src/widgets/tool_button.cpp Added Files: data/themes/blue_scene/auto_limit.png data/themes/default/auto_limit.png include/volume_knob.h src/widgets/volume_knob.cpp git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@131 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
125
ChangeLog
125
ChangeLog
@@ -1,3 +1,128 @@
|
||||
2006-04-16 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
|
||||
* Makefile.am:
|
||||
* src/lmms_single_source.cpp:
|
||||
* include/knob.h:
|
||||
* include/instrument_track.h:
|
||||
* src/tracks/instrument_track.cpp:
|
||||
*+src/include/volume_knob.h:
|
||||
*+src/widgets/volume_knob.cpp:
|
||||
* include/setup_dialog.h:
|
||||
* src/core/setup_dialog.cpp:
|
||||
* include/sample_track.h:
|
||||
* src/tracks/sample_track.cpp:
|
||||
* plugins/audio_file_processor/audio_file_processor.h:
|
||||
* plugins/audio_file_processor/audio_file_processor.cpp:
|
||||
* plugins/organic/organic.h:
|
||||
* plugins/organic/organic.cpp:
|
||||
* plugins/triple_oscillator/triple_oscillator.h:
|
||||
* plugins/triple_oscillator/triple_oscillator.cpp:
|
||||
* plugins/vibed/vibed.h:
|
||||
* plugins/vibed/vibed.cpp:
|
||||
Added a volume knob widget that will display the volume level as
|
||||
either a percentage or in dbV, which can be selected from the
|
||||
general settings in the setup dialog. Changed vibed to use a
|
||||
volume range from 0 to 200 to bring it in line with every other
|
||||
volume knob in lmms. Unfortunately, this will break any existing
|
||||
presets, but better to do it now before many of them actually
|
||||
exist.
|
||||
|
||||
* src/core/mixer.cpp:
|
||||
Changed the number of channels processed from the fixed value of
|
||||
SURROUND_CHANNELS to m_audioDev->channels() so that only the
|
||||
number of channels that will be output get processed instead of
|
||||
the maximum number of channels that could be defined.
|
||||
|
||||
2006-04-15 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
|
||||
* include/mixer.h:
|
||||
* src/core/mixer.cpp:
|
||||
* src/core/song_editor.cpp:
|
||||
*+data/themes/default/auto_limit.png:
|
||||
*+data/themes/blue_scene/auto_limit.png:
|
||||
Added auto limiter option. Main window now has a button next to
|
||||
the high-quality button to toggle the auto limiter on and off
|
||||
The limiter scales the whole section between zero crossings where
|
||||
a clip occurs. This required adding another processing buffer
|
||||
in the mixer, which will double the latency when the auto limiter
|
||||
is being used, but when it's not being used, there is no change
|
||||
to the latency. Because it's based on detecting the zero
|
||||
crossings, the lowest frequency for which it is effective is
|
||||
sample_rate/(4*buffer_len).
|
||||
|
||||
2006-04-14 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* src/lib/mmp.cpp:
|
||||
clean metadata-nodes when saving projects, project-templates or presets
|
||||
|
||||
* plugins/vibed/vibed.cpp:
|
||||
- in vibed::loadSettings():
|
||||
- simplified loading of wave-shape
|
||||
- delete base64-decoded data at the end
|
||||
- commented out code in destructor as it is not neccessary - to be
|
||||
removed someday
|
||||
|
||||
* include/base64.h:
|
||||
fixed fatal bug in Qt4-version of base64::decode(): memcpy()ed data to
|
||||
_data instead of *_data
|
||||
|
||||
* src/widgets/group_box.cpp:
|
||||
* src/widgets/tab_widget.cpp:
|
||||
some fine-tuning of Qt4-version of painting-code
|
||||
|
||||
* src/widgets/lcd_spinbox.cpp:
|
||||
explicitely set black background-color in Qt4-version
|
||||
|
||||
* src/core/midi_tab_widget.cpp:
|
||||
Qt4-version of MIDI-connection-code is now working
|
||||
|
||||
* src/core/main_window.cpp:
|
||||
* plugins/vibed/impulse_editor.cpp:
|
||||
* plugins/vibed/nine_button_selector.cpp:
|
||||
* plugins/vibed/vibed.cpp:
|
||||
* plugins/plucked_string_synth/plucked_string_synth.cpp:
|
||||
* plugins/triple_oscillator/triple_oscillator.cpp:
|
||||
* plugins/bit_invader/bit_invader.cpp:
|
||||
* plugins/organic/organic.cpp:
|
||||
* src/core/song_editor.cpp:
|
||||
* src/core/piano_roll.cpp:
|
||||
* src/core/main_window.cpp:
|
||||
* src/core/bb_editor.cpp:
|
||||
* src/core/track.cpp:
|
||||
* src/widgets/project_notes.cpp:
|
||||
* src/widgets/group_box.cpp:
|
||||
* src/widgets/tab_widget.cpp:
|
||||
* src/widgets/tool_button.cpp:
|
||||
added missing setAutoFillBackground( TRUE )-call for making QWidget
|
||||
paint specified background-color/pixmap - makes Qt4-version of LMMS
|
||||
almost usable
|
||||
|
||||
* src/widgets/tab_widget.cpp:
|
||||
per default hide newly added tabs
|
||||
|
||||
* include/spc_bg_hndl_widget.h:
|
||||
added missing code for painting pixmap-backgrounds in Qt4-version
|
||||
|
||||
* plugins/vestige/lvsl_client.cpp:
|
||||
use QX11EmbedContainer instead of QX11EmbedWidget in Qt4-version ->
|
||||
working VST-support in Qt4-version of LMMS
|
||||
|
||||
* include/sample_buffer.h:
|
||||
* src/lib/sample_buffer.cpp:
|
||||
- when loading sample, first look for it in user's working-directory,
|
||||
then in LMMS' factory-samples-directory
|
||||
- simplified making the path of a sample-file relative
|
||||
|
||||
* include/config_mgr.h:
|
||||
* src/core/config_mgr.cpp:
|
||||
* src/core/main_window.cpp:
|
||||
* src/tracks/instrument_track.cpp:
|
||||
replaced methods projectsDir(), presetsDir() and samplesDir() with
|
||||
userProjectsDir(), factoryProjectsDir(), userPresetsDir(),
|
||||
factoryPresetsDir() etc.
|
||||
|
||||
* include/file_browser.h:
|
||||
* src/core/file_browser.cpp:
|
||||
try to avoid duplicate "/" in paths - fixes some problems
|
||||
|
||||
2006-04-10 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* most files:
|
||||
|
||||
@@ -95,7 +95,8 @@ lmms_MOC = \
|
||||
./tool_button.moc \
|
||||
./track_container.moc \
|
||||
./track.moc \
|
||||
./visualization_widget.moc
|
||||
./visualization_widget.moc \
|
||||
./volume_knob.moc
|
||||
|
||||
|
||||
BUILT_SOURCES = $(lmms_MOC)
|
||||
@@ -193,6 +194,7 @@ lmms_SOURCES = \
|
||||
$(srcdir)/src/widgets/tool_button.cpp \
|
||||
$(srcdir)/src/widgets/tooltip.cpp \
|
||||
$(srcdir)/src/widgets/visualization_widget.cpp \
|
||||
$(srcdir)/src/widgets/volume_knob.cpp \
|
||||
$(srcdir)/src/lmms_single_source.cpp \
|
||||
$(srcdir)/include/pch.h \
|
||||
$(srcdir)/include/debug.h \
|
||||
@@ -284,6 +286,7 @@ lmms_SOURCES = \
|
||||
$(srcdir)/include/led_checkbox.h \
|
||||
$(srcdir)/include/text_float.h \
|
||||
$(srcdir)/include/tempo_sync_knob.h \
|
||||
$(srcdir)/include/volume_knob.h \
|
||||
$(srcdir)/include/setup_dialog.h \
|
||||
$(srcdir)/include/dummy_plugin.h \
|
||||
$(srcdir)/include/dummy_instrument.h \
|
||||
|
||||
1
TODO
1
TODO
@@ -1,7 +1,6 @@
|
||||
- replace rest of wizard by simple directory-selection-dialog for working-dir when running the first time
|
||||
- do REAL release in envelopes (can't be precalculated as it depends on key-press-duration/rest of envelope)
|
||||
- correctly load steps/dots from FLP-files
|
||||
- vibed-plugin: do not crash at destruction
|
||||
- convert FL-Plucked!-parameters to Vibed-parameters
|
||||
- in flp-import-filter: merge play-list-items if possible
|
||||
- integrated sample-browser in context-menu of sample-track/-tco
|
||||
|
||||
BIN
data/themes/blue_scene/auto_limit.png
Normal file
BIN
data/themes/blue_scene/auto_limit.png
Normal file
Binary file not shown.
BIN
data/themes/default/auto_limit.png
Normal file
BIN
data/themes/default/auto_limit.png
Normal file
Binary file not shown.
@@ -42,7 +42,8 @@ class QVariant;
|
||||
namespace base64
|
||||
{
|
||||
#ifndef QT3
|
||||
inline void encode( const char * _data, const int _size, QString & _dst )
|
||||
inline void encode( const char * _data, const int _size,
|
||||
QString & _dst )
|
||||
{
|
||||
_dst = QByteArray( _data, _size ).toBase64();
|
||||
}
|
||||
@@ -52,7 +53,7 @@ namespace base64
|
||||
QByteArray data = QByteArray::fromBase64( _b64.toAscii() );
|
||||
*_size = data.size();
|
||||
*_data = new char[*_size];
|
||||
memcpy( _data, data.constData(), *_size );
|
||||
memcpy( *_data, data.constData(), *_size );
|
||||
}
|
||||
#else
|
||||
void encode( const char * _data, const int _size, QString & _dst );
|
||||
|
||||
@@ -92,19 +92,34 @@ public:
|
||||
return( m_workingDir );
|
||||
}
|
||||
|
||||
QString projectsDir( void ) const
|
||||
QString userProjectsDir( void ) const
|
||||
{
|
||||
return( m_workingDir + PROJECTS_PATH );
|
||||
return( workingDir() + PROJECTS_PATH );
|
||||
}
|
||||
|
||||
QString presetsDir( void ) const
|
||||
QString userPresetsDir( void ) const
|
||||
{
|
||||
return( m_workingDir + PRESETS_PATH );
|
||||
return( workingDir() + PRESETS_PATH );
|
||||
}
|
||||
|
||||
QString samplesDir( void ) const
|
||||
QString userSamplesDir( void ) const
|
||||
{
|
||||
return( m_workingDir + SAMPLES_PATH );
|
||||
return( workingDir() + SAMPLES_PATH );
|
||||
}
|
||||
|
||||
QString factoryProjectsDir( void ) const
|
||||
{
|
||||
return( dataDir() + PROJECTS_PATH );
|
||||
}
|
||||
|
||||
QString factoryPresetsDir( void ) const
|
||||
{
|
||||
return( dataDir() + PRESETS_PATH );
|
||||
}
|
||||
|
||||
QString factorySamplesDir( void ) const
|
||||
{
|
||||
return( dataDir() + SAMPLES_PATH );
|
||||
}
|
||||
|
||||
QString defaultArtworkDir( void ) const
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
#include <qlistview.h>
|
||||
#include <qdir.h>
|
||||
|
||||
#define cleanPath cleanDirPath
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -145,11 +147,9 @@ public:
|
||||
{
|
||||
_path = m_directories[0];
|
||||
}
|
||||
#ifdef QT4
|
||||
return( QDir::cleanPath( _path + "/" + text( 0 ) + "/" ) );
|
||||
#else
|
||||
return( QDir::cleanDirPath( _path + "/" + text( 0 ) + "/" ) );
|
||||
#endif
|
||||
return( QDir::cleanPath( _path + QDir::separator() +
|
||||
text( 0 ) ) +
|
||||
QDir::separator() );
|
||||
}
|
||||
|
||||
inline const QPixmap * pixmap( int ) const
|
||||
@@ -194,7 +194,8 @@ public:
|
||||
|
||||
inline QString fullName( void ) const
|
||||
{
|
||||
return( m_path + "/" + text( 0 ) );
|
||||
return( QDir::cleanPath( m_path ) + QDir::separator() +
|
||||
text( 0 ) );
|
||||
}
|
||||
inline const QPixmap * pixmap( int ) const
|
||||
{
|
||||
@@ -230,5 +231,9 @@ private:
|
||||
} ;
|
||||
|
||||
|
||||
#ifdef QT3
|
||||
#undef cleanPath
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#include "gui_templates.h"
|
||||
#include "tab_widget.h"
|
||||
#include "engine.h"
|
||||
|
||||
#include "volume_knob.h"
|
||||
|
||||
class QLineEdit;
|
||||
class arpAndChordsTabWidget;
|
||||
@@ -60,7 +60,6 @@ class instrumentTrackButton;
|
||||
class envelopeTabWidget;
|
||||
class fadeButton;
|
||||
class instrument;
|
||||
class knob;
|
||||
class lcdSpinBox;
|
||||
class midiPort;
|
||||
class midiTabWidget;
|
||||
@@ -223,7 +222,7 @@ private:
|
||||
// widgets on the top of a instrument-track-window
|
||||
tabWidget * m_generalSettingsWidget;
|
||||
QLineEdit * m_instrumentNameLE;
|
||||
knob * m_volumeKnob;
|
||||
volumeKnob * m_volumeKnob;
|
||||
surroundArea * m_surroundArea;
|
||||
lcdSpinBox * m_effectChannelNumber;
|
||||
QPushButton * m_saveSettingsBtn;
|
||||
@@ -242,7 +241,7 @@ private:
|
||||
|
||||
|
||||
// widgets in track-settings-widget
|
||||
knob * m_tswVolumeKnob;
|
||||
volumeKnob * m_tswVolumeKnob;
|
||||
fadeButton * m_tswActivityIndicator;
|
||||
instrumentTrackButton * m_tswInstrumentTrackButton;
|
||||
QMenu * m_tswMidiMenu;
|
||||
|
||||
@@ -90,7 +90,7 @@ public slots:
|
||||
void reset( void );
|
||||
void copyValue( void );
|
||||
void pasteValue( void );
|
||||
void enterValue( void );
|
||||
virtual void enterValue( void );
|
||||
void connectToMidiDevice( void );
|
||||
void displayHelp( void );
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
|
||||
inline const surroundSampleFrame * currentAudioBuffer( void ) const
|
||||
{
|
||||
return( m_curBuf );
|
||||
return( m_writeBuf );
|
||||
}
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void setHighQuality( bool _hq_on = FALSE );
|
||||
|
||||
void setClipScaling( bool _state );
|
||||
|
||||
signals:
|
||||
void sampleRateChanged( void );
|
||||
@@ -315,15 +315,29 @@ private:
|
||||
void processBuffer( const surroundSampleFrame * _buf,
|
||||
const fx_ch_t _fx_chnl );
|
||||
|
||||
|
||||
void FASTCALL scaleClip( fpab_t _frame, ch_cnt_t _chnl );
|
||||
|
||||
vvector<audioPort *> m_audioPorts;
|
||||
|
||||
fpab_t m_framesPerAudioBuffer;
|
||||
|
||||
surroundSampleFrame * m_curBuf;
|
||||
surroundSampleFrame * m_nextBuf;
|
||||
|
||||
surroundSampleFrame * m_readBuf;
|
||||
surroundSampleFrame * m_writeBuf;
|
||||
|
||||
vvector<surroundSampleFrame *> m_bufferPool;
|
||||
Uint8 m_readBuffer;
|
||||
Uint8 m_writeBuffer;
|
||||
Uint8 m_analBuffer;
|
||||
Uint8 m_poolDepth;
|
||||
|
||||
bool m_scaleClip;
|
||||
surroundSampleFrame m_maxClip;
|
||||
surroundSampleFrame m_previousSample;
|
||||
fpab_t m_halfStart[SURROUND_CHANNELS];
|
||||
bool m_clipped[SURROUND_CHANNELS];
|
||||
bool m_oldBuffer[SURROUND_CHANNELS];
|
||||
bool m_newBuffer[SURROUND_CHANNELS];
|
||||
|
||||
Uint8 m_cpuLoad;
|
||||
|
||||
playHandleVector m_playHandles;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mmp.h - class for reading and writing multimedia-project-files
|
||||
*
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -90,6 +90,9 @@ private:
|
||||
static projectTypes FASTCALL type( const QString & _type_name );
|
||||
static QString FASTCALL typeName( projectTypes _project_type );
|
||||
|
||||
void cleanMetaNodes( QDomElement _de );
|
||||
|
||||
|
||||
struct typeDescStruct
|
||||
{
|
||||
projectTypes m_type;
|
||||
|
||||
@@ -162,6 +162,9 @@ public slots:
|
||||
private:
|
||||
void FASTCALL update( bool _keep_settings = FALSE );
|
||||
|
||||
static QString tryToMakeRelative( const QString & _file );
|
||||
|
||||
|
||||
#ifdef SDL_SDL_SOUND_H
|
||||
f_cnt_t FASTCALL decodeSampleSDL( const char * _f,
|
||||
int_sample_t * & _buf,
|
||||
|
||||
@@ -42,12 +42,13 @@
|
||||
|
||||
#include "track.h"
|
||||
#include "sample_buffer.h"
|
||||
#include "volume_knob.h"
|
||||
|
||||
|
||||
class nameLabel;
|
||||
class audioPort;
|
||||
class QLabel;
|
||||
class knob;
|
||||
|
||||
//class sampleTCOSettingsDialog;
|
||||
|
||||
|
||||
@@ -152,7 +153,7 @@ private:
|
||||
nameLabel * m_trackLabel;
|
||||
audioPort * m_audioPort;
|
||||
|
||||
knob * m_volumeKnob;
|
||||
volumeKnob * m_volumeKnob;
|
||||
float m_volume;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -98,7 +98,7 @@ private slots:
|
||||
void toggleGIMPLikeWindows( bool _enabled );
|
||||
void toggleNoWizard( bool _enabled );
|
||||
void toggleNoMsgAfterSetup( bool _enabled );
|
||||
|
||||
void toggleDisplaydBV( bool _enabled );
|
||||
|
||||
void openWorkingDir( void );
|
||||
void openVSTDir( void );
|
||||
@@ -122,6 +122,7 @@ private:
|
||||
bool m_gimpLikeWindows;
|
||||
bool m_noWizard;
|
||||
bool m_noMsgAfterSetup;
|
||||
bool m_displaydBV;
|
||||
|
||||
|
||||
QLineEdit * m_wdLineEdit;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* spc_bg_hndl_widget.h - class specialBgHandlingWidget
|
||||
*
|
||||
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -100,11 +100,18 @@ public:
|
||||
{
|
||||
#ifdef QT4
|
||||
QPainter p( &pm );
|
||||
// TODO: fix that for background-pixmaps, because
|
||||
// drawing is started at the top left edge even
|
||||
// if this widget isn't posated there
|
||||
p.fillRect( _w->rect(), pw->palette().brush(
|
||||
pw->backgroundRole() ) );
|
||||
const QBrush & br = pw->palette().brush(
|
||||
pw->backgroundRole() );
|
||||
if( br.style() == Qt::TexturePattern )
|
||||
{
|
||||
p.drawPixmap( 0, 0, br.texture(),
|
||||
_w->x(), _w->y(),
|
||||
_w->width(), _w->height() );
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.fill( br.color() );
|
||||
}
|
||||
#else
|
||||
const QPixmap * pbp = pw->paletteBackgroundPixmap();
|
||||
if( pbp == NULL )
|
||||
|
||||
59
include/volume_knob.h
Normal file
59
include/volume_knob.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* volume_knob.h - defines a knob that display it's value as either a
|
||||
* percentage or in dbV.
|
||||
*
|
||||
* Copyright (c) 2006 Danny McRae <khjklujn/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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
#ifndef _VOLUME_KNOB_H
|
||||
#define _VOLUME_KNOB_H
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
#include <QtGui/QPixmap>
|
||||
|
||||
#else
|
||||
|
||||
#include <qpixmap.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include "knob.h"
|
||||
|
||||
|
||||
class volumeKnob: public knob
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
volumeKnob( int _knob_num, QWidget * _parent, const QString & _name,
|
||||
engine * _engine );
|
||||
~volumeKnob();
|
||||
|
||||
public slots:
|
||||
void enterValue( void );
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent( QMouseEvent * _me );
|
||||
virtual void mouseMoveEvent( QMouseEvent * _me );
|
||||
virtual void wheelEvent( QWheelEvent * _we );
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
#undef SINGLE_SOURCE_COMPILE
|
||||
#include "embed.cpp"
|
||||
|
||||
#include "volume_knob.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
@@ -169,7 +169,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) :
|
||||
"This is useful for things like string- and choir-"
|
||||
"samples." ) );
|
||||
|
||||
m_ampKnob = new knob( knobDark_28, this, tr( "Amplify" ), eng() );
|
||||
m_ampKnob = new volumeKnob( knobDark_28, this, tr( "Amplify" ), eng() );
|
||||
m_ampKnob->setRange( 0, 500, 1.0f );
|
||||
m_ampKnob->move( 6, 114 );
|
||||
m_ampKnob->setInitValue( 100.0f );
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
class knob;
|
||||
class pixmapButton;
|
||||
class volumeKnob;
|
||||
|
||||
|
||||
class audioFileProcessor : public instrument, public specialBgHandlingWidget
|
||||
@@ -100,7 +101,7 @@ private:
|
||||
sampleBuffer::drawMethods m_drawMethod;
|
||||
|
||||
QPixmap m_graph;
|
||||
knob * m_ampKnob;
|
||||
volumeKnob * m_ampKnob;
|
||||
knob * m_startKnob;
|
||||
knob * m_endKnob;
|
||||
pixmapButton * m_openAudioFileButton;
|
||||
|
||||
@@ -321,6 +321,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) :
|
||||
|
||||
|
||||
#ifdef QT4
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
|
||||
"artwork" ) );
|
||||
|
||||
@@ -58,13 +58,11 @@ using namespace std;
|
||||
#include "knob.h"
|
||||
#include "pixmap_button.h"
|
||||
#include "tooltip.h"
|
||||
#include "song_editor.h"
|
||||
#include "oscillator.h"
|
||||
#include "sample_buffer.h"
|
||||
#include "base64.h"
|
||||
|
||||
#undef SINGLE_SOURCE_COMPILE
|
||||
#include "embed.cpp"
|
||||
#include "volume_knob.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
@@ -125,7 +123,7 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) :
|
||||
);
|
||||
|
||||
// setup volume-knob
|
||||
m_osc[i].volKnob = new knob( knobGreen_17, this, tr(
|
||||
m_osc[i].volKnob = new volumeKnob( knobGreen_17, this, tr(
|
||||
"Osc %1 volume" ).arg( i+1 ), eng() );
|
||||
m_osc[i].volKnob->move( 25+i*20, 110 );
|
||||
m_osc[i].volKnob->setRange( 0, 100, 1.0f );
|
||||
@@ -208,6 +206,7 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) :
|
||||
|
||||
|
||||
#ifdef QT4
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
|
||||
"artwork" ) );
|
||||
|
||||
@@ -37,6 +37,7 @@ class QPixmap;
|
||||
class knob;
|
||||
class notePlayHandle;
|
||||
class pixmapButton;
|
||||
class volumeKnob;
|
||||
|
||||
|
||||
class organicInstrument : public instrument, public specialBgHandlingWidget
|
||||
@@ -83,7 +84,7 @@ private:
|
||||
{
|
||||
oscillator::waveShapes waveShape;
|
||||
knob * oscKnob;
|
||||
knob * volKnob;
|
||||
volumeKnob * volKnob;
|
||||
knob * panKnob;
|
||||
knob * detuneKnob;
|
||||
float harmonic;
|
||||
|
||||
@@ -85,6 +85,7 @@ pluckedStringSynth::pluckedStringSynth( instrumentTrack * _channel_track ) :
|
||||
m_pickupKnob->move( 138, 134 );
|
||||
m_pickupKnob->setHintText( tr( "Pickup position:" ) + " ", "" );
|
||||
#ifdef QT4
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
|
||||
"artwork" ) );
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
|
||||
#undef SINGLE_SOURCE_COMPILE
|
||||
#include "embed.cpp"
|
||||
#include "volume_knob.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
@@ -90,6 +91,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) :
|
||||
}
|
||||
|
||||
#ifdef QT4
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setBrush( backgroundRole(),
|
||||
PLUGIN_NAME::getIconPixmap( "artwork" ) );
|
||||
@@ -216,7 +218,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) :
|
||||
m_osc[i].waveShape = oscillator::SIN_WAVE;
|
||||
|
||||
// setup volume-knob
|
||||
m_osc[i].volKnob = new knob( knobSmall_17, this, tr(
|
||||
m_osc[i].volKnob = new volumeKnob( knobSmall_17, this, tr(
|
||||
"Osc %1 volume" ).arg( i+1 ), eng() );
|
||||
m_osc[i].volKnob->move( 6, 104+i*50 );
|
||||
m_osc[i].volKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f );
|
||||
|
||||
@@ -36,7 +36,7 @@ class knob;
|
||||
class notePlayHandle;
|
||||
class pixmapButton;
|
||||
class sampleBuffer;
|
||||
|
||||
class volumeKnob;
|
||||
|
||||
const int NUM_OF_OSCILLATORS = 3;
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
struct oscillatorData
|
||||
{
|
||||
oscillator::waveShapes waveShape;
|
||||
knob * volKnob;
|
||||
volumeKnob * volKnob;
|
||||
knob * panKnob;
|
||||
knob * coarseKnob;
|
||||
knob * fineLKnob;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <QtCore/QLocale>
|
||||
#include <QtCore/QTime>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QX11EmbedWidget>
|
||||
#include <QtGui/QX11EmbedContainer>
|
||||
#include <QtGui/QX11Info>
|
||||
|
||||
#else
|
||||
@@ -40,8 +40,8 @@
|
||||
|
||||
#include "qxembed.h"
|
||||
|
||||
#define QX11EmbedWidget QXEmbed
|
||||
#define embedInto embed
|
||||
#define QX11EmbedContainer QXEmbed
|
||||
#define embedClient embed
|
||||
|
||||
#endif
|
||||
|
||||
@@ -246,10 +246,13 @@ void remoteVSTPlugin::showEditor( void )
|
||||
m_pluginWidget = new QWidget( eng()->getMainWindow()->workspace() );
|
||||
m_pluginWidget->setFixedSize( m_pluginGeometry );
|
||||
m_pluginWidget->setWindowTitle( name() );
|
||||
#ifndef QT3
|
||||
eng()->getMainWindow()->workspace()->addWindow( m_pluginWidget );
|
||||
#endif
|
||||
m_pluginWidget->show();
|
||||
|
||||
QX11EmbedWidget * xe = new QX11EmbedWidget( m_pluginWidget );
|
||||
xe->embedInto( m_pluginXID );
|
||||
QX11EmbedContainer * xe = new QX11EmbedContainer( m_pluginWidget );
|
||||
xe->embedClient( m_pluginXID );
|
||||
xe->setFixedSize( m_pluginGeometry );
|
||||
//xe->setAutoDelete( FALSE );
|
||||
xe->show();
|
||||
|
||||
@@ -100,9 +100,9 @@ vestigeInstrument::vestigeInstrument( instrumentTrack * _channel_track ) :
|
||||
}
|
||||
|
||||
#ifdef QT4
|
||||
QPalette pal;
|
||||
/* QPalette pal;
|
||||
pal.setBrush( backgroundRole(), *s_artwork);
|
||||
setPalette( pal );
|
||||
setPalette( pal );*/
|
||||
#else
|
||||
setErasePixmap( *s_artwork );
|
||||
#endif
|
||||
@@ -254,7 +254,7 @@ void vestigeInstrument::setParameter( const QString & _param,
|
||||
if( _param == "plugin" && _value != "" )
|
||||
{
|
||||
m_pluginMutex.lock();
|
||||
bool set_ch_name = ( m_plugin != NULL &&
|
||||
const bool set_ch_name = ( m_plugin != NULL &&
|
||||
getInstrumentTrack()->name() == m_plugin->name() ) ||
|
||||
getInstrumentTrack()->name() ==
|
||||
instrumentTrack::tr( "Default" );
|
||||
@@ -267,7 +267,7 @@ void vestigeInstrument::setParameter( const QString & _param,
|
||||
tr( "Loading plugin" ),
|
||||
tr( "Please wait while loading VST-plugin..." ),
|
||||
PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ),
|
||||
0 );
|
||||
0 );
|
||||
m_pluginMutex.lock();
|
||||
m_plugin = new remoteVSTPlugin( m_pluginDLL, eng() );
|
||||
if( m_plugin->failed() )
|
||||
|
||||
@@ -63,8 +63,9 @@ impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y,
|
||||
setFixedSize( 153, 124 );
|
||||
m_base = QPixmap::grabWidget( _parent, _x, _y );
|
||||
#ifndef QT3
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal = palette();
|
||||
pal.setBrush( backgroundRole(), QBrush( m_base ) );
|
||||
pal.setBrush( backgroundRole(), m_base );
|
||||
setPalette( pal );
|
||||
#else
|
||||
setPaletteBackgroundPixmap( m_base );
|
||||
|
||||
@@ -73,8 +73,9 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on,
|
||||
m_base = QPixmap::grabWidget( _parent, _x, _y );
|
||||
move( _x, _y );
|
||||
#ifndef QT3
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal = palette();
|
||||
pal.setBrush( backgroundRole(), QBrush( m_base ) );
|
||||
pal.setBrush( backgroundRole(), m_base );
|
||||
setPalette( pal );
|
||||
#else
|
||||
setPaletteBackgroundPixmap( m_base );
|
||||
|
||||
@@ -79,7 +79,7 @@ signals:
|
||||
void nineButtonSelection( Uint8 );
|
||||
|
||||
private:
|
||||
vlist<pixmapButton*> m_buttons;
|
||||
vlist<pixmapButton *> m_buttons;
|
||||
pixmapButton * m_button;
|
||||
pixmapButton * m_lastBtn;
|
||||
QPixmap m_base;
|
||||
|
||||
@@ -52,12 +52,13 @@
|
||||
#include "knob.h"
|
||||
#include "tooltip.h"
|
||||
#include "oscillator.h"
|
||||
#include "song_editor.h"
|
||||
#include "string_container.h"
|
||||
#include "base64.h"
|
||||
|
||||
#undef SINGLE_SOURCE_COMPILE
|
||||
#include "embed.cpp"
|
||||
#include "volume_knob.h"
|
||||
#include "volume.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
@@ -83,6 +84,7 @@ vibed::vibed( instrumentTrack * _channel_track ) :
|
||||
m_sampleLength( 128 )
|
||||
{
|
||||
#ifdef QT4
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
|
||||
"artwork" ) );
|
||||
@@ -115,11 +117,11 @@ vibed::vibed( instrumentTrack * _channel_track ) :
|
||||
|
||||
"The 'N' button will normalize the waveform.") );
|
||||
|
||||
m_volumeKnob = new knob( knobBright_26, this,
|
||||
m_volumeKnob = new volumeKnob( knobBright_26, this,
|
||||
tr( "Volume" ),
|
||||
eng() );
|
||||
m_volumeKnob->setRange( 0.0f, 2.0f, 0.01f );
|
||||
m_volumeKnob->setInitValue( 1.0f );
|
||||
m_volumeKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f );
|
||||
m_volumeKnob->setInitValue( DEFAULT_VOLUME );
|
||||
m_volumeKnob->move( 103, 142 );
|
||||
m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "" );
|
||||
m_volumeKnob->hide();
|
||||
@@ -407,6 +409,7 @@ vibed::vibed( instrumentTrack * _channel_track ) :
|
||||
|
||||
vibed::~vibed()
|
||||
{
|
||||
/*
|
||||
for( Uint8 harm = 0; harm < 9; harm++ )
|
||||
{
|
||||
delete m_pickKnobs[harm];
|
||||
@@ -420,7 +423,7 @@ vibed::~vibed()
|
||||
delete m_editors[harm];
|
||||
delete m_impulses[harm];
|
||||
delete m_harmonics[harm];
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
@@ -546,14 +549,22 @@ void vibed::loadSettings( const QDomElement & _this )
|
||||
m_impulses[i]->setChecked(
|
||||
_this.attribute( name ).toInt() );
|
||||
|
||||
name = "graph" + QString::number( i );
|
||||
float shape[128];
|
||||
int size = 0;
|
||||
QString sampleString = _this.attribute( name );
|
||||
char * dst = 0;
|
||||
base64::decode( sampleString, &dst, &size );
|
||||
memcpy( shape, dst, size );
|
||||
m_editors[i]->setValues( shape );
|
||||
float * shp = 0;
|
||||
base64::decode( _this.attribute( "graph" +
|
||||
QString::number( i ) ),
|
||||
(char * *) &shp, &size );
|
||||
// TODO: check whether size == 128 * sizeof( float ),
|
||||
// otherwise me might and up in a segfault
|
||||
m_editors[i]->setValues( shp );
|
||||
delete[] shp;
|
||||
|
||||
// TODO: do one of the following to avoid
|
||||
// "uninitialized" wave-shape-buttongroup
|
||||
// - activate random-wave-shape-button here
|
||||
// - make wave-shape-buttons simple toggle-buttons
|
||||
// instead of checkable buttons
|
||||
// - save and restore selected wave-shape-button
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,7 +634,8 @@ void vibed::playNote( notePlayHandle * _n )
|
||||
{
|
||||
if( ps->exists( string ) )
|
||||
{
|
||||
vol = m_volumeKnobs[string]->value();
|
||||
vol = ( m_volumeKnobs[string]->value() ) /
|
||||
100.0f;
|
||||
pan = (
|
||||
m_panKnobs[string]->value() + 1 ) / 2.0;
|
||||
sample = ps->getStringSample( s );
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
class knob;
|
||||
class notePlayHandle;
|
||||
class volumeKnob;
|
||||
|
||||
|
||||
class vibed : public instrument
|
||||
@@ -66,7 +67,7 @@ private:
|
||||
vlist<knob*> m_pickKnobs;
|
||||
vlist<knob*> m_pickupKnobs;
|
||||
vlist<knob*> m_stiffnessKnobs;
|
||||
vlist<knob*> m_volumeKnobs;
|
||||
vlist<volumeKnob*> m_volumeKnobs;
|
||||
vlist<knob*> m_panKnobs;
|
||||
vlist<knob*> m_detuneKnobs;
|
||||
vlist<knob*> m_randomKnobs;
|
||||
@@ -78,7 +79,7 @@ private:
|
||||
knob * m_pickKnob;
|
||||
knob * m_pickupKnob;
|
||||
knob * m_stiffnessKnob;
|
||||
knob * m_volumeKnob;
|
||||
volumeKnob * m_volumeKnob;
|
||||
knob * m_panKnob;
|
||||
knob * m_detuneKnob;
|
||||
knob * m_randomKnob;
|
||||
|
||||
@@ -70,9 +70,10 @@ bbEditor::bbEditor( engine * _engine ) :
|
||||
m_toolBar->setFixedHeight( 32 );
|
||||
m_toolBar->move( 0, 0 );
|
||||
#ifdef QT4
|
||||
m_toolBar->setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setBrush( QPalette::Background, QBrush(
|
||||
embed::getIconPixmap( "toolbar_bg" ) ) );
|
||||
pal.setBrush( m_toolBar->backgroundRole(),
|
||||
embed::getIconPixmap( "toolbar_bg" ) );
|
||||
m_toolBar->setPalette( pal );
|
||||
#else
|
||||
m_toolBar->setPaletteBackgroundPixmap( embed::getIconPixmap(
|
||||
|
||||
@@ -108,7 +108,7 @@ void mkPath( const QString & _path )
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void linkFile( const QString & _src, const QString & _dst )
|
||||
{
|
||||
#ifdef QT4
|
||||
@@ -149,7 +149,7 @@ void copyFile( const QString & _src, const QString & _dst )
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -596,9 +596,9 @@ void configManager::accept( void )
|
||||
}
|
||||
}
|
||||
|
||||
mkPath( projectsDir() );
|
||||
mkPath( samplesDir() );
|
||||
mkPath( presetsDir() );
|
||||
mkPath( userProjectsDir() );
|
||||
mkPath( userSamplesDir() );
|
||||
mkPath( userPresetsDir() );
|
||||
/* processFilesRecursively( m_dataDir + "samples/", m_workingDir +
|
||||
"samples/",
|
||||
m_samplesCopyRB->isChecked() ?
|
||||
|
||||
@@ -170,7 +170,8 @@ void fileBrowser::addItems( const QString & _path )
|
||||
{
|
||||
QString cur_file = files[files.size() - i - 1];
|
||||
if( cur_file[0] != '.' &&
|
||||
!QFileInfo( _path + "/" + cur_file ).isDir()
|
||||
QFileInfo( _path + QDir::separator() +
|
||||
cur_file ).isDir() == FALSE
|
||||
#ifdef QT4
|
||||
// TBD
|
||||
#else
|
||||
@@ -188,7 +189,8 @@ void fileBrowser::addItems( const QString & _path )
|
||||
{
|
||||
QString cur_file = files[files.size() - i - 1];
|
||||
if( cur_file[0] != '.' &&
|
||||
QFileInfo( _path + "/" + cur_file ).isDir() )
|
||||
QFileInfo( _path + QDir::separator() +
|
||||
cur_file ).isDir() )
|
||||
{
|
||||
QListViewItem * item = m_l->findItem( cur_file, 0 );
|
||||
if( item == NULL )
|
||||
@@ -744,13 +746,13 @@ bool directory::addItems( const QString & _path )
|
||||
QString cur_file = files[files.size() - i - 1];
|
||||
#ifdef QT4
|
||||
if( cur_file[0] != '.' && !QFileInfo(
|
||||
thisDir.absolutePath() + "/" +
|
||||
thisDir.absolutePath() + QDir::separator() +
|
||||
cur_file ).isDir() &&
|
||||
thisDir.match( m_filter, cur_file.toLower() )
|
||||
/*QDir::match( FILE_FILTER, cur_file )*/ )
|
||||
#else
|
||||
if( cur_file[0] != '.' && !QFileInfo(
|
||||
thisDir.absPath() + "/" +
|
||||
thisDir.absPath() + QDir::separator() +
|
||||
cur_file ).isDir() &&
|
||||
thisDir.match( m_filter, cur_file.lower() )
|
||||
/*QDir::match( FILE_FILTER, cur_file )*/ )
|
||||
@@ -766,11 +768,11 @@ bool directory::addItems( const QString & _path )
|
||||
QString cur_file = files[files.size() - i - 1];
|
||||
#ifdef QT4
|
||||
if( cur_file[0] != '.' && QFileInfo(
|
||||
thisDir.absolutePath() + "/" +
|
||||
thisDir.absolutePath() + QDir::separator() +
|
||||
cur_file ).isDir() )
|
||||
#else
|
||||
if( cur_file[0] != '.' && QFileInfo(
|
||||
thisDir.absPath() + "/" +
|
||||
thisDir.absPath() + QDir::separator() +
|
||||
cur_file ).isDir() )
|
||||
#endif
|
||||
{
|
||||
|
||||
@@ -126,26 +126,26 @@ mainWindow::mainWindow( engine * _engine ) :
|
||||
int id = 0;
|
||||
QString wdir = configManager::inst()->workingDir();
|
||||
side_bar->appendTab( new pluginBrowser( splitter, eng() ), ++id );
|
||||
side_bar->appendTab( new fileBrowser( configManager::inst()->dataDir()+
|
||||
PROJECTS_PATH + "*" +
|
||||
wdir+PROJECTS_PATH,
|
||||
side_bar->appendTab( new fileBrowser(
|
||||
configManager::inst()->factoryProjectsDir() + "*" +
|
||||
configManager::inst()->userProjectsDir(),
|
||||
"*.mmp *.xml *.mid *.flp",
|
||||
tr( "My projects" ),
|
||||
embed::getIconPixmap( "project_file" ),
|
||||
splitter, eng() ),
|
||||
++id );
|
||||
side_bar->appendTab( new fileBrowser( configManager::inst()->dataDir()+
|
||||
SAMPLES_PATH + "*" +
|
||||
wdir+SAMPLES_PATH,
|
||||
side_bar->appendTab( new fileBrowser(
|
||||
configManager::inst()->factorySamplesDir() + "*" +
|
||||
configManager::inst()->userSamplesDir(),
|
||||
"*.wav *.ogg *.au"
|
||||
"*.voc *.aif *.aiff *.flac *.raw",
|
||||
tr( "My samples" ),
|
||||
embed::getIconPixmap( "sound_file" ),
|
||||
splitter, eng() ),
|
||||
++id );
|
||||
side_bar->appendTab( new fileBrowser( configManager::inst()->dataDir()+
|
||||
PRESETS_PATH + "*" +
|
||||
wdir+PRESETS_PATH,
|
||||
side_bar->appendTab( new fileBrowser(
|
||||
configManager::inst()->factoryPresetsDir() + "*" +
|
||||
configManager::inst()->userPresetsDir(),
|
||||
"*.cs.xml", tr( "My presets" ),
|
||||
embed::getIconPixmap( "preset_file" ),
|
||||
splitter, eng() ),
|
||||
@@ -184,9 +184,10 @@ mainWindow::mainWindow( engine * _engine ) :
|
||||
m_toolBar->setFixedHeight( 64 );
|
||||
m_toolBar->move( 0, 0 );
|
||||
#ifdef QT4
|
||||
m_toolBar->setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setBrush( m_toolBar->backgroundRole(), QBrush(
|
||||
embed::getIconPixmap( "main_toolbar_bg" ) ) );
|
||||
pal.setBrush( m_toolBar->backgroundRole(),
|
||||
embed::getIconPixmap( "main_toolbar_bg" ) );
|
||||
m_toolBar->setPalette( pal );
|
||||
#else
|
||||
m_toolBar->setPaletteBackgroundPixmap(
|
||||
@@ -264,7 +265,7 @@ void mainWindow::finalize( void )
|
||||
this, SLOT( createNewProject() ),
|
||||
m_toolBar );
|
||||
|
||||
QDir d( configManager::inst()->projectsDir() + "templates" );
|
||||
QDir d( configManager::inst()->factoryProjectsDir() + "templates" );
|
||||
QStringList templates = d.entryList(
|
||||
#ifdef QT4
|
||||
QStringList( "*.mpt" ),
|
||||
@@ -668,7 +669,8 @@ void mainWindow::createNewProjectFromTemplate( int _idx )
|
||||
eng()->getSongEditor()->mayChangeProject() == TRUE )
|
||||
{
|
||||
eng()->getSongEditor()->createNewProjectFromTemplate(
|
||||
configManager::inst()->projectsDir() + "templates/" +
|
||||
configManager::inst()->factoryProjectsDir() +
|
||||
"templates/" +
|
||||
m_templatesMenu->text( _idx ) + ".mpt" );
|
||||
}
|
||||
#endif
|
||||
@@ -690,7 +692,7 @@ void mainWindow::openProject( void )
|
||||
this, "", TRUE );
|
||||
ofd.setWindowTitle( tr( "Open project" ) );
|
||||
#endif
|
||||
ofd.setDirectory( configManager::inst()->projectsDir() );
|
||||
ofd.setDirectory( configManager::inst()->userProjectsDir() );
|
||||
ofd.setFileMode( QFileDialog::ExistingFiles );
|
||||
if( ofd.exec () == QDialog::Accepted &&
|
||||
!ofd.selectedFiles().isEmpty() )
|
||||
@@ -746,7 +748,7 @@ bool mainWindow::saveProjectAs( void )
|
||||
}
|
||||
else
|
||||
{
|
||||
sfd.setDirectory( configManager::inst()->projectsDir() );
|
||||
sfd.setDirectory( configManager::inst()->userProjectsDir() );
|
||||
}
|
||||
|
||||
if( sfd.exec () == QFileDialog::Accepted &&
|
||||
|
||||
@@ -310,6 +310,7 @@ void midiTabWidget::loadSettings( const QDomElement & _this )
|
||||
if( ( *it )->isChecked() !=
|
||||
( rp.indexOf( ( *it )->text() ) != -1 ) )
|
||||
{
|
||||
( *it )->setChecked( TRUE );
|
||||
activatedReadablePort( *it );
|
||||
}
|
||||
}
|
||||
@@ -340,6 +341,7 @@ void midiTabWidget::loadSettings( const QDomElement & _this )
|
||||
if( ( *it )->isChecked() !=
|
||||
( wp.indexOf( ( *it )->text() ) != -1 ) )
|
||||
{
|
||||
( *it )->setChecked( TRUE );
|
||||
activatedWriteablePort( *it );
|
||||
}
|
||||
}
|
||||
@@ -418,6 +420,7 @@ void midiTabWidget::midiPortModeToggled( bool )
|
||||
{
|
||||
if( ( *it )->isChecked() == TRUE )
|
||||
{
|
||||
( *it )->setChecked( FALSE );
|
||||
activatedReadablePort( *it );
|
||||
}
|
||||
}
|
||||
@@ -441,6 +444,7 @@ void midiTabWidget::midiPortModeToggled( bool )
|
||||
{
|
||||
if( ( *it )->isChecked() == TRUE )
|
||||
{
|
||||
( *it )->setChecked( FALSE );
|
||||
activatedWriteablePort( *it );
|
||||
}
|
||||
}
|
||||
@@ -494,6 +498,7 @@ void midiTabWidget::readablePortsChanged( void )
|
||||
{
|
||||
#ifdef QT4
|
||||
QAction * item = m_readablePorts->addAction( *it );
|
||||
item->setCheckable( TRUE );
|
||||
if( selected_ports.indexOf( *it ) != -1 )
|
||||
{
|
||||
item->setChecked( TRUE );
|
||||
@@ -545,6 +550,7 @@ void midiTabWidget::writeablePortsChanged( void )
|
||||
{
|
||||
#ifdef QT4
|
||||
QAction * item = m_writeablePorts->addAction( *it );
|
||||
item->setCheckable( TRUE );
|
||||
if( selected_ports.indexOf( *it ) != -1 )
|
||||
{
|
||||
item->setChecked( TRUE );
|
||||
@@ -566,13 +572,12 @@ void midiTabWidget::writeablePortsChanged( void )
|
||||
void midiTabWidget::activatedReadablePort( QAction * _item )
|
||||
{
|
||||
// make sure, MIDI-port is configured for input
|
||||
if( _item->isChecked() == FALSE &&
|
||||
if( _item->isChecked() == TRUE &&
|
||||
m_midiPort->mode() != midiPort::INPUT &&
|
||||
m_midiPort->mode() != midiPort::DUPLEX )
|
||||
{
|
||||
m_receiveCheckBox->setChecked( TRUE );
|
||||
}
|
||||
_item->setChecked( !_item->isChecked() );
|
||||
eng()->getMixer()->getMIDIClient()->subscribeReadablePort( m_midiPort,
|
||||
_item->text(), !_item->isChecked() );
|
||||
}
|
||||
@@ -583,13 +588,12 @@ void midiTabWidget::activatedReadablePort( QAction * _item )
|
||||
void midiTabWidget::activatedWriteablePort( QAction * _item )
|
||||
{
|
||||
// make sure, MIDI-port is configured for output
|
||||
if( _item->isChecked() == FALSE &&
|
||||
if( _item->isChecked() == TRUE &&
|
||||
m_midiPort->mode() != midiPort::OUTPUT &&
|
||||
m_midiPort->mode() != midiPort::DUPLEX )
|
||||
{
|
||||
m_sendCheckBox->setChecked( TRUE );
|
||||
}
|
||||
_item->setChecked( !_item->isChecked() );
|
||||
eng()->getMixer()->getMIDIClient()->subscribeWriteablePort( m_midiPort,
|
||||
_item->text(), !_item->isChecked() );
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ mixer::mixer( engine * _engine ) :
|
||||
QObject(),
|
||||
engineObject( _engine ),
|
||||
m_framesPerAudioBuffer( DEFAULT_BUFFER_SIZE ),
|
||||
m_curBuf( NULL ),
|
||||
m_nextBuf( NULL ),
|
||||
m_readBuf( NULL ),
|
||||
m_writeBuf( NULL ),
|
||||
m_cpuLoad( 0 ),
|
||||
m_qualityLevel( DEFAULT_QUALITY_LEVEL ),
|
||||
m_masterGain( 1.0f ),
|
||||
@@ -86,15 +86,16 @@ mixer::mixer( engine * _engine ) :
|
||||
QString::number( m_framesPerAudioBuffer ) );
|
||||
}
|
||||
|
||||
m_curBuf = bufferAllocator::alloc<surroundSampleFrame>(
|
||||
m_framesPerAudioBuffer );
|
||||
m_nextBuf = bufferAllocator::alloc<surroundSampleFrame>(
|
||||
m_framesPerAudioBuffer );
|
||||
|
||||
// now clear our two output-buffers before using them...
|
||||
clearAudioBuffer( m_curBuf, m_framesPerAudioBuffer );
|
||||
clearAudioBuffer( m_nextBuf, m_framesPerAudioBuffer );
|
||||
|
||||
for( Uint8 i = 0; i < 3; i++ )
|
||||
{
|
||||
m_readBuf = bufferAllocator::alloc<surroundSampleFrame>(
|
||||
m_framesPerAudioBuffer );
|
||||
|
||||
clearAudioBuffer( m_readBuf, m_framesPerAudioBuffer );
|
||||
m_bufferPool.push_back( m_readBuf );
|
||||
}
|
||||
|
||||
setClipScaling( FALSE );
|
||||
}
|
||||
|
||||
|
||||
@@ -105,8 +106,10 @@ mixer::~mixer()
|
||||
delete m_audioDev;
|
||||
delete m_midiClient;
|
||||
|
||||
bufferAllocator::free( m_curBuf );
|
||||
bufferAllocator::free( m_nextBuf );
|
||||
for( Uint8 i = 0; i < 3; i++ )
|
||||
{
|
||||
bufferAllocator::free( m_bufferPool[i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -146,6 +149,47 @@ bool mixer::criticalXRuns( void ) const
|
||||
|
||||
|
||||
|
||||
void mixer::setClipScaling( bool _state )
|
||||
{
|
||||
m_mixMutex.lock();
|
||||
|
||||
m_scaleClip = _state;
|
||||
|
||||
if( _state )
|
||||
{
|
||||
m_poolDepth = 3;
|
||||
m_readBuffer = 0;
|
||||
m_analBuffer = m_readBuffer + 1;
|
||||
m_writeBuffer = m_poolDepth - 1;
|
||||
|
||||
for( ch_cnt_t chnl=0; chnl < m_audioDev->channels(); ++chnl )
|
||||
{
|
||||
m_clipped[chnl] = FALSE;
|
||||
m_halfStart[chnl] = m_framesPerAudioBuffer;
|
||||
m_maxClip[chnl] = 1.0f;
|
||||
m_previousSample[chnl] = 0.0;
|
||||
m_newBuffer[chnl] = FALSE;
|
||||
}
|
||||
for( Uint8 i = 0; i < 3; i++ )
|
||||
{
|
||||
m_readBuf = m_bufferPool[i];
|
||||
clearAudioBuffer( m_readBuf, m_framesPerAudioBuffer );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_poolDepth = 2;
|
||||
m_readBuffer = 0;
|
||||
m_writeBuffer = 1;
|
||||
m_analBuffer = 1;
|
||||
}
|
||||
|
||||
m_mixMutex.unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const surroundSampleFrame * mixer::renderNextBuffer( void )
|
||||
{
|
||||
microTimer timer;
|
||||
@@ -190,10 +234,21 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
|
||||
|
||||
// now swap the buffers... current buffer becomes next (last)
|
||||
// buffer and the next buffer becomes current (first) buffer
|
||||
qSwap( m_curBuf, m_nextBuf );
|
||||
|
||||
// qSwap( m_curBuf, m_nextBuf );
|
||||
m_writeBuffer++;
|
||||
m_writeBuffer %= m_poolDepth;
|
||||
|
||||
m_readBuffer++;
|
||||
m_readBuffer %= m_poolDepth;
|
||||
|
||||
m_analBuffer++;
|
||||
m_analBuffer %= m_poolDepth;
|
||||
|
||||
m_writeBuf = m_bufferPool[m_writeBuffer];
|
||||
m_readBuf = m_bufferPool[m_readBuffer];
|
||||
|
||||
// clear last audio-buffer
|
||||
clearAudioBuffer( m_curBuf, m_framesPerAudioBuffer );
|
||||
clearAudioBuffer( m_writeBuf, m_framesPerAudioBuffer );
|
||||
|
||||
// if( criticalXRuns() == FALSE )
|
||||
{
|
||||
@@ -223,19 +278,19 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
|
||||
{
|
||||
if( ( *it )->m_bufferUsage != audioPort::NONE )
|
||||
{
|
||||
processBuffer( ( *it )->firstBuffer(),
|
||||
( *it )->nextFxChannel() );
|
||||
processBuffer(
|
||||
( *it )->firstBuffer(),
|
||||
( *it )->nextFxChannel() );
|
||||
( *it )->nextPeriod();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
emit nextAudioBuffer( m_curBuf, m_framesPerAudioBuffer );
|
||||
emit nextAudioBuffer( m_readBuf, m_framesPerAudioBuffer );
|
||||
|
||||
m_mixMutex.unlock();
|
||||
|
||||
|
||||
// and trigger LFOs
|
||||
envelopeAndLFOWidget::triggerLFO( eng() );
|
||||
|
||||
@@ -244,7 +299,7 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
|
||||
m_cpuLoad = tLimit( (int) ( new_cpu_load * 0.1f + m_cpuLoad * 0.9f ), 0,
|
||||
100 );
|
||||
|
||||
return( m_curBuf );
|
||||
return( m_readBuf );
|
||||
}
|
||||
|
||||
|
||||
@@ -303,7 +358,7 @@ void FASTCALL mixer::bufferToPort( const sampleFrame * _buf,
|
||||
|
||||
for( fpab_t frame = start_frame; frame < loop1_frame; ++frame )
|
||||
{
|
||||
for( ch_cnt_t chnl = 0; chnl < SURROUND_CHANNELS; ++chnl )
|
||||
for( ch_cnt_t chnl = 0; chnl < m_audioDev->channels(); ++chnl )
|
||||
{
|
||||
_port->firstBuffer()[frame][chnl] +=
|
||||
_buf[frame - start_frame][chnl %
|
||||
@@ -319,7 +374,7 @@ void FASTCALL mixer::bufferToPort( const sampleFrame * _buf,
|
||||
m_framesPerAudioBuffer );
|
||||
for( fpab_t frame = 0; frame < end_frame; ++frame )
|
||||
{
|
||||
for( ch_cnt_t chnl = 0; chnl < SURROUND_CHANNELS;
|
||||
for( ch_cnt_t chnl = 0; chnl < m_audioDev->channels();
|
||||
++chnl )
|
||||
{
|
||||
_port->secondBuffer()[frame][chnl] +=
|
||||
@@ -569,13 +624,93 @@ void mixer::processBuffer( const surroundSampleFrame * _buf,
|
||||
fx_ch_t/* _fx_chnl */ )
|
||||
{
|
||||
// TODO: effect-implementation
|
||||
for( fpab_t frame = 0; frame < m_framesPerAudioBuffer; ++frame )
|
||||
|
||||
if( m_scaleClip )
|
||||
{
|
||||
for( ch_cnt_t chnl = 0; chnl < SURROUND_CHANNELS; ++chnl )
|
||||
for( ch_cnt_t chnl=0;
|
||||
chnl < m_audioDev->channels();
|
||||
++chnl )
|
||||
{
|
||||
m_curBuf[frame][chnl] += _buf[frame][chnl];
|
||||
m_newBuffer[chnl] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
for( fpab_t frame = 0; frame < m_framesPerAudioBuffer; ++frame )
|
||||
{
|
||||
for( ch_cnt_t chnl = 0; chnl < m_audioDev->channels(); ++chnl )
|
||||
{
|
||||
m_writeBuf[frame][chnl] += _buf[frame][chnl];
|
||||
|
||||
if( m_scaleClip )
|
||||
{
|
||||
scaleClip( frame, chnl );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FASTCALL mixer::scaleClip( fpab_t _frame, ch_cnt_t _chnl )
|
||||
{
|
||||
// Check for zero crossing
|
||||
if( ( m_writeBuf[_frame][_chnl] >=0 &&
|
||||
m_previousSample[_chnl] < 0 ) ||
|
||||
( m_writeBuf[_frame][_chnl] <=0 &&
|
||||
m_previousSample[_chnl] > 0 ) )
|
||||
{
|
||||
// if a clip occurred between the zero
|
||||
// crossings, scale the half-wave
|
||||
if( m_clipped[_chnl] )
|
||||
{
|
||||
if( m_newBuffer[_chnl] )
|
||||
{
|
||||
for( fpab_t i = m_halfStart[_chnl];
|
||||
i < m_framesPerAudioBuffer;
|
||||
i++ )
|
||||
{
|
||||
m_bufferPool[m_analBuffer][i][_chnl] /=
|
||||
m_maxClip[_chnl];
|
||||
}
|
||||
|
||||
for( fpab_t i = 0;
|
||||
i < _frame;
|
||||
i++ )
|
||||
{
|
||||
m_writeBuf[i][_chnl] /=
|
||||
m_maxClip[_chnl];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( fpab_t i = m_halfStart[_chnl];
|
||||
i < _frame;
|
||||
i++ )
|
||||
{
|
||||
m_writeBuf[i][_chnl] /= m_maxClip[_chnl];
|
||||
}
|
||||
}
|
||||
}
|
||||
m_halfStart[_chnl] = _frame;
|
||||
m_clipped[_chnl] = FALSE;
|
||||
m_newBuffer[_chnl] = FALSE;
|
||||
m_maxClip[_chnl] = 1.0;
|
||||
}
|
||||
|
||||
// check for clip
|
||||
if( fabs( m_writeBuf[_frame][_chnl] ) > 1.0f )
|
||||
{
|
||||
m_clipped[_chnl] = TRUE;
|
||||
if( fabs( m_writeBuf[_frame][_chnl] ) >
|
||||
m_maxClip[_chnl] )
|
||||
{
|
||||
m_maxClip[_chnl] = fabs(
|
||||
m_writeBuf[_frame][_chnl] );
|
||||
}
|
||||
}
|
||||
|
||||
m_previousSample[_chnl] = m_writeBuf[_frame][_chnl];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -209,9 +209,10 @@ pianoRoll::pianoRoll( engine * _engine ) :
|
||||
m_toolBar->setFixedHeight( 32 );
|
||||
m_toolBar->move( 0, 0 );
|
||||
#ifdef QT4
|
||||
m_toolBar->setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setBrush( m_toolBar->backgroundRole(), QBrush(
|
||||
embed::getIconPixmap( "toolbar_bg" ) ) );
|
||||
pal.setBrush( m_toolBar->backgroundRole(),
|
||||
embed::getIconPixmap( "toolbar_bg" ) );
|
||||
m_toolBar->setPalette( pal );
|
||||
#else
|
||||
m_toolBar->setPaletteBackgroundPixmap( embed::getIconPixmap(
|
||||
|
||||
@@ -111,6 +111,8 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
|
||||
m_noWizard( configManager::inst()->value( "app", "nowizard" ).toInt() ),
|
||||
m_noMsgAfterSetup( configManager::inst()->value( "app",
|
||||
"nomsgaftersetup" ).toInt() ),
|
||||
m_displaydBV( configManager::inst()->value( "app",
|
||||
"displaydbv" ).toInt() ),
|
||||
m_workingDir( configManager::inst()->workingDir() ),
|
||||
m_vstDir( configManager::inst()->vstDir() ),
|
||||
m_artworkDir( configManager::inst()->artworkDir() ),
|
||||
@@ -187,7 +189,7 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
|
||||
|
||||
|
||||
tabWidget * misc_tw = new tabWidget( tr( "MISC" ), general );
|
||||
misc_tw->setFixedHeight( 110 );
|
||||
misc_tw->setFixedHeight( 128 );
|
||||
|
||||
ledCheckBox * disable_tooltips = new ledCheckBox(
|
||||
tr( "Disable tooltips (no spurious "
|
||||
@@ -238,6 +240,14 @@ setupDialog::setupDialog( engine * _engine, configTabs _tab_to_open ) :
|
||||
this, SLOT( toggleNoMsgAfterSetup( bool ) ) );
|
||||
|
||||
|
||||
ledCheckBox * dbv = new ledCheckBox(
|
||||
tr( "Display volume as dbV " ),
|
||||
misc_tw, eng() );
|
||||
dbv->move( 10, 108 );
|
||||
dbv->setChecked( m_displaydBV );
|
||||
connect( dbv, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( toggleDisplaydBV( bool ) ) );
|
||||
|
||||
gen_layout->addWidget( bufsize_tw );
|
||||
gen_layout->addSpacing( 10 );
|
||||
gen_layout->addWidget( misc_tw );
|
||||
@@ -635,6 +645,8 @@ void setupDialog::accept( void )
|
||||
QString::number( m_noWizard ) );
|
||||
configManager::inst()->setValue( "app", "nomsgaftersetup",
|
||||
QString::number( m_noMsgAfterSetup ) );
|
||||
configManager::inst()->setValue( "app", "displaydbv",
|
||||
QString::number( m_displaydBV ) );
|
||||
configManager::inst()->setValue( "ui",
|
||||
"disablechannelactivityindicators",
|
||||
QString::number( m_disableChActInd ) );
|
||||
@@ -768,6 +780,14 @@ void setupDialog::toggleNoMsgAfterSetup( bool _enabled )
|
||||
|
||||
|
||||
|
||||
void setupDialog::toggleDisplaydBV( bool _enabled )
|
||||
{
|
||||
m_displaydBV = _enabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void setupDialog::toggleDisableChActInd( bool _disabled )
|
||||
{
|
||||
m_disableChActInd = _disabled;
|
||||
|
||||
@@ -190,6 +190,16 @@ songEditor::songEditor( engine * _engine ) :
|
||||
eng()->getMainWindow()->addWidgetToToolBar( hq_btn, 1, col );
|
||||
|
||||
|
||||
toolButton * cp_btn = new toolButton( embed::getIconPixmap( "auto_limit" ),
|
||||
tr( "Auto limiter" ),
|
||||
NULL, NULL, tb );
|
||||
cp_btn->setCheckable( TRUE );
|
||||
connect( cp_btn, SIGNAL( toggled( bool ) ), eng()->getMixer(),
|
||||
SLOT( setClipScaling( bool ) ) );
|
||||
cp_btn->setFixedWidth( 30 );
|
||||
eng()->getMainWindow()->addWidgetToToolBar( cp_btn, 1, col + 1 );
|
||||
|
||||
|
||||
eng()->getMainWindow()->addSpacingToToolBar( 10 );
|
||||
|
||||
|
||||
@@ -286,9 +296,10 @@ songEditor::songEditor( engine * _engine ) :
|
||||
m_toolBar->setFixedHeight( 32 );
|
||||
m_toolBar->move( 0, 0 );
|
||||
#ifdef QT4
|
||||
m_toolBar->setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setBrush( m_toolBar->backgroundRole(), QBrush(
|
||||
embed::getIconPixmap( "toolbar_bg" ) ) );
|
||||
pal.setBrush( m_toolBar->backgroundRole(),
|
||||
embed::getIconPixmap( "toolbar_bg" ) );
|
||||
m_toolBar->setPalette( pal );
|
||||
#else
|
||||
m_toolBar->setPaletteBackgroundPixmap( embed::getIconPixmap(
|
||||
@@ -1629,7 +1640,7 @@ void songEditor::importProject( void )
|
||||
this, "", TRUE );
|
||||
ofd.setWindowTitle( tr( "Import file" ) );
|
||||
#endif
|
||||
ofd.setDirectory( configManager::inst()->projectsDir() );
|
||||
ofd.setDirectory( configManager::inst()->userProjectsDir() );
|
||||
ofd.setFileMode( QFileDialog::ExistingFiles );
|
||||
if( ofd.exec () == QDialog::Accepted && !ofd.selectedFiles().isEmpty() )
|
||||
{
|
||||
|
||||
@@ -576,6 +576,7 @@ trackContentWidget::trackContentWidget( trackWidget * _parent ) :
|
||||
m_trackWidget( _parent )
|
||||
{
|
||||
#ifdef QT4
|
||||
setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setColor( backgroundRole(), QColor( 96, 96, 96 ) );
|
||||
setPalette( pal );
|
||||
@@ -1151,6 +1152,7 @@ trackWidget::trackWidget( track * _track, QWidget * _parent ) :
|
||||
m_action( NONE )
|
||||
{
|
||||
#ifdef QT4
|
||||
m_trackOperationsWidget.setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setColor( m_trackOperationsWidget.backgroundRole(),
|
||||
QColor( 128, 128, 128 ) );
|
||||
@@ -1163,6 +1165,7 @@ trackWidget::trackWidget( track * _track, QWidget * _parent ) :
|
||||
|
||||
|
||||
#ifdef QT4
|
||||
m_trackSettingsWidget.setAutoFillBackground( TRUE );
|
||||
pal.setColor( m_trackSettingsWidget.backgroundRole(),
|
||||
QColor( 64, 64, 64 ) );
|
||||
m_trackSettingsWidget.setPalette( pal );
|
||||
|
||||
@@ -186,11 +186,7 @@ multimediaProject::~multimediaProject()
|
||||
|
||||
bool multimediaProject::writeFile( const QString & _fn, bool _overwrite_check )
|
||||
{
|
||||
QString xml = "<?xml version=\"1.0\"?>\n" + toString(
|
||||
#if QT_VERSION >= 0x030100
|
||||
2
|
||||
#endif
|
||||
);
|
||||
bool clean_meta_nodes = FALSE;
|
||||
QString fn = _fn;
|
||||
if( type() == INSTRUMENT_TRACK_SETTINGS )
|
||||
{
|
||||
@@ -198,6 +194,7 @@ bool multimediaProject::writeFile( const QString & _fn, bool _overwrite_check )
|
||||
{
|
||||
fn += ".cs.xml";
|
||||
}
|
||||
clean_meta_nodes = TRUE;
|
||||
}
|
||||
else if( type() == SONG_PROJECT )
|
||||
{
|
||||
@@ -206,6 +203,7 @@ bool multimediaProject::writeFile( const QString & _fn, bool _overwrite_check )
|
||||
{
|
||||
fn += ".mmp";
|
||||
}
|
||||
clean_meta_nodes = TRUE;
|
||||
}
|
||||
else if( type() == SONG_PROJECT_TEMPLATE )
|
||||
{
|
||||
@@ -213,6 +211,12 @@ bool multimediaProject::writeFile( const QString & _fn, bool _overwrite_check )
|
||||
{
|
||||
fn += ".mpt";
|
||||
}
|
||||
clean_meta_nodes = TRUE;
|
||||
}
|
||||
|
||||
if( clean_meta_nodes == TRUE )
|
||||
{
|
||||
cleanMetaNodes( documentElement() );
|
||||
}
|
||||
|
||||
|
||||
@@ -257,6 +261,11 @@ bool multimediaProject::writeFile( const QString & _fn, bool _overwrite_check )
|
||||
).arg( fn ) );
|
||||
return( FALSE );
|
||||
}
|
||||
QString xml = "<?xml version=\"1.0\"?>\n" + toString(
|
||||
#if QT_VERSION >= 0x030100
|
||||
2
|
||||
#endif
|
||||
);
|
||||
#ifdef QT4
|
||||
outfile.write( xml.toAscii().constData(), xml.length() );
|
||||
#else
|
||||
@@ -315,4 +324,31 @@ QString multimediaProject::typeName( projectTypes _project_type )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void multimediaProject::cleanMetaNodes( QDomElement _de )
|
||||
{
|
||||
QDomNode node = _de.firstChild();
|
||||
while( !node.isNull() )
|
||||
{
|
||||
if( node.isElement() )
|
||||
{
|
||||
if( node.toElement().attribute( "metadata" ).toInt() )
|
||||
{
|
||||
QDomNode ns = node.nextSibling();
|
||||
_de.removeChild( node );
|
||||
node = ns;
|
||||
continue;
|
||||
}
|
||||
if( node.hasChildNodes() )
|
||||
{
|
||||
cleanMetaNodes( node.toElement() );
|
||||
}
|
||||
}
|
||||
node = node.nextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -250,7 +250,12 @@ void sampleBuffer::update( bool _keep_settings )
|
||||
// name
|
||||
if( file[0] != '/' )
|
||||
{
|
||||
file = configManager::inst()->samplesDir() + file;
|
||||
file = configManager::inst()->userSamplesDir() + file;
|
||||
if( QFileInfo( file ).exists() == FALSE )
|
||||
{
|
||||
file =
|
||||
configManager::inst()->factorySamplesDir() + m_audioFile;
|
||||
}
|
||||
}
|
||||
const char * f =
|
||||
#ifdef QT4
|
||||
@@ -970,7 +975,12 @@ QString sampleBuffer::openAudioFile( void ) const
|
||||
QString f = m_audioFile;
|
||||
if( QFileInfo( f ).isRelative() )
|
||||
{
|
||||
f = configManager::inst()->samplesDir() + f;
|
||||
f = configManager::inst()->userSamplesDir() + f;
|
||||
if( QFileInfo( f ).exists() == FALSE )
|
||||
{
|
||||
f = configManager::inst()->factorySamplesDir() +
|
||||
m_audioFile;
|
||||
}
|
||||
}
|
||||
#ifdef QT4
|
||||
dir = QFileInfo( f ).absolutePath();
|
||||
@@ -980,7 +990,7 @@ QString sampleBuffer::openAudioFile( void ) const
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = configManager::inst()->samplesDir();
|
||||
dir = configManager::inst()->userSamplesDir();
|
||||
}
|
||||
// change dir to position of previously opened file
|
||||
ofd.setDirectory( dir );
|
||||
@@ -1031,19 +1041,7 @@ QString sampleBuffer::openAudioFile( void ) const
|
||||
{
|
||||
return( "" );
|
||||
}
|
||||
QString sf = ofd.selectedFiles()[0];
|
||||
if( !QFileInfo( sf ).isRelative() )
|
||||
{
|
||||
#if QT_VERSION >= 0x030100
|
||||
sf = sf.replace( configManager::inst()->samplesDir(),
|
||||
"" );
|
||||
#else
|
||||
sf = sf.replace( QRegExp(
|
||||
configManager::inst()->samplesDir() ),
|
||||
"" );
|
||||
#endif
|
||||
}
|
||||
return( sf );
|
||||
return( tryToMakeRelative( ofd.selectedFiles()[0] ) );
|
||||
}
|
||||
|
||||
return( "" );
|
||||
@@ -1228,20 +1226,7 @@ sampleBuffer * sampleBuffer::resample( sampleFrame * _data,
|
||||
|
||||
void sampleBuffer::setAudioFile( const QString & _audio_file )
|
||||
{
|
||||
m_audioFile = _audio_file;
|
||||
// try to make path of audio-file relative if it's posated
|
||||
// within LMMS-working-dir
|
||||
if( !QFileInfo( m_audioFile ).isRelative() )
|
||||
{
|
||||
#if QT_VERSION >= 0x030100
|
||||
m_audioFile = m_audioFile.replace(
|
||||
configManager::inst()->samplesDir(), "" );
|
||||
#else
|
||||
m_audioFile = m_audioFile.replace(
|
||||
QRegExp( configManager::inst()->samplesDir() ),
|
||||
"" );
|
||||
#endif
|
||||
}
|
||||
m_audioFile = tryToMakeRelative( _audio_file );
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -1470,6 +1455,28 @@ void sampleBuffer::deleteResamplingData( void * * _ptr )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QString sampleBuffer::tryToMakeRelative( const QString & _file )
|
||||
{
|
||||
if( QFileInfo( _file ).isRelative() == FALSE )
|
||||
{
|
||||
QString fsd = configManager::inst()->factorySamplesDir();
|
||||
QString usd = configManager::inst()->userSamplesDir();
|
||||
if( _file.contains( fsd ) )
|
||||
{
|
||||
return( QString( _file ).replace( fsd, "" ) );
|
||||
}
|
||||
else if( _file.contains( usd ) )
|
||||
{
|
||||
return( QString( _file ).replace( usd, "" ) );
|
||||
}
|
||||
}
|
||||
return( _file );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#undef write
|
||||
#undef read
|
||||
#undef pos
|
||||
|
||||
@@ -85,4 +85,5 @@
|
||||
#include "src/widgets/nstate_button.cpp"
|
||||
#include "src/widgets/lcd_spinbox.cpp"
|
||||
#include "src/widgets/automatable_button.cpp"
|
||||
#include "src/widgets/volume_knob.cpp"
|
||||
#endif
|
||||
|
||||
@@ -73,7 +73,6 @@
|
||||
#include "note_play_handle.h"
|
||||
#include "embed.h"
|
||||
#include "fade_button.h"
|
||||
#include "knob.h"
|
||||
#include "lcd_spinbox.h"
|
||||
#include "led_checkbox.h"
|
||||
#include "piano_widget.h"
|
||||
@@ -85,6 +84,7 @@
|
||||
#include "debug.h"
|
||||
#include "mmp.h"
|
||||
#include "string_pair_drag.h"
|
||||
#include "volume_knob.h"
|
||||
|
||||
|
||||
const char * volume_help = QT_TRANSLATE_NOOP( "instrumentTrack",
|
||||
@@ -148,7 +148,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
|
||||
|
||||
|
||||
// creation of widgets for track-settings-widget
|
||||
m_tswVolumeKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
|
||||
m_tswVolumeKnob = new volumeKnob( knobSmall_17, getTrackSettingsWidget(),
|
||||
tr( "Channel volume" ), eng() );
|
||||
m_tswVolumeKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f );
|
||||
m_tswVolumeKnob->setInitValue( DEFAULT_VOLUME );
|
||||
@@ -219,7 +219,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
|
||||
|
||||
|
||||
// setup volume-knob
|
||||
m_volumeKnob = new knob( knobBright_26, m_generalSettingsWidget,
|
||||
m_volumeKnob = new volumeKnob( knobBright_26, m_generalSettingsWidget,
|
||||
tr( "Channel volume" ), eng() );
|
||||
m_volumeKnob->move( 10, 44 );
|
||||
m_volumeKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f );
|
||||
@@ -235,7 +235,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
|
||||
tr( volume_help ) );
|
||||
/* connect( m_volumeKnob, SIGNAL( valueChanged( float ) ), this,
|
||||
SLOT( volValueChanged( float ) ) );*/
|
||||
knob::linkObjects( m_tswVolumeKnob, m_volumeKnob );
|
||||
volumeKnob::linkObjects( m_tswVolumeKnob, m_volumeKnob );
|
||||
|
||||
|
||||
// setup surround-area
|
||||
@@ -362,6 +362,10 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
|
||||
|
||||
|
||||
_tc->updateAfterTrackAdd();
|
||||
#ifndef QT3
|
||||
setFixedWidth( CHANNEL_WIDTH );
|
||||
resize( sizeHint() );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -393,7 +397,7 @@ void instrumentTrack::saveSettingsBtnClicked( void )
|
||||
sfd.setFilter( tr( "Channel-Settings-File (*.cs.xml)" ) );
|
||||
#endif
|
||||
|
||||
QString preset_root = configManager::inst()->presetsDir();
|
||||
QString preset_root = configManager::inst()->userPresetsDir();
|
||||
if( !QDir( preset_root ).exists() )
|
||||
{
|
||||
QDir().mkdir( preset_root );
|
||||
|
||||
@@ -372,7 +372,7 @@ sampleTrack::sampleTrack( trackContainer * _tc ) :
|
||||
m_trackLabel->setGeometry( 26, 1, DEFAULT_SETTINGS_WIDGET_WIDTH-2, 29 );
|
||||
m_trackLabel->show();
|
||||
|
||||
m_volumeKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
|
||||
m_volumeKnob = new volumeKnob( knobSmall_17, getTrackSettingsWidget(),
|
||||
tr( "Channel volume" ), eng() );
|
||||
m_volumeKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f );
|
||||
m_volumeKnob->setInitValue( DEFAULT_VOLUME );
|
||||
|
||||
@@ -116,7 +116,11 @@ void fadeButton::paintEvent( QPaintEvent * _pe )
|
||||
QPainter p( &draw_pm, this );
|
||||
#endif
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
#ifndef QT3
|
||||
p.drawRect( 0, 0, rect().right(), rect().bottom() );
|
||||
#else
|
||||
p.drawRect( rect() );
|
||||
#endif
|
||||
#ifndef QT4
|
||||
// and blit all the drawn stuff on the screen...
|
||||
bitBlt( this, rect().topLeft(), &draw_pm );
|
||||
|
||||
@@ -65,6 +65,10 @@ groupBox::groupBox( const QString & _caption, QWidget * _parent,
|
||||
m_origHeight( height() ),
|
||||
m_animating( FALSE )
|
||||
{
|
||||
#ifndef QT3
|
||||
setAutoFillBackground( TRUE );
|
||||
#endif
|
||||
|
||||
if( s_ledBg == NULL )
|
||||
{
|
||||
s_ledBg = new QPixmap( embed::getIconPixmap(
|
||||
@@ -193,9 +197,11 @@ void groupBox::animate( void )
|
||||
void groupBox::updatePixmap( void )
|
||||
{
|
||||
#ifndef QT3
|
||||
const int c = 0;
|
||||
QColor bg_color = QApplication::palette().color( QPalette::Active,
|
||||
QPalette::Background );
|
||||
#else
|
||||
const int c = 1;
|
||||
QColor bg_color = QApplication::palette().active().background();
|
||||
#endif
|
||||
QPixmap pm( size() );
|
||||
@@ -205,7 +211,7 @@ void groupBox::updatePixmap( void )
|
||||
|
||||
// outer rect
|
||||
p.setPen( bg_color.dark( 200 ) );
|
||||
p.drawRect( 0, 0, width(), height() );
|
||||
p.drawRect( 0, 0, width() - 1 + c, height() - 1 + c );
|
||||
|
||||
// brighter line at bottom/right
|
||||
p.setPen( bg_color.light( 125 ) );
|
||||
@@ -223,7 +229,7 @@ void groupBox::updatePixmap( void )
|
||||
p.drawLine( 2 + s_ledBg->width(), 11, width() - 3, 11 );
|
||||
|
||||
// black inner rect
|
||||
p.drawRect( 1, 1, width() - 2, height() - 2 );
|
||||
p.drawRect( 1, 1, width() - 3 + c, height() - 3 + c );
|
||||
|
||||
|
||||
//p.setPen( QColor( 255, 255, 255 ) );
|
||||
@@ -238,7 +244,6 @@ void groupBox::updatePixmap( void )
|
||||
#ifdef QT4
|
||||
QPalette pal = palette();
|
||||
pal.setBrush( backgroundRole(), QBrush( pm ) );
|
||||
/* pal.setColor( QPalette::Background, QColor( 96, 96, 96 ) );*/
|
||||
setPalette( pal );
|
||||
#else
|
||||
setPaletteBackgroundColor( bg_color.dark( 132 ) );
|
||||
|
||||
@@ -59,6 +59,15 @@ lcdSpinBox::lcdSpinBox( int _min, int _max, int _num_digits,
|
||||
m_number->setFrameShape( QFrame::Panel );
|
||||
m_number->setFrameShadow( QFrame::Sunken );
|
||||
m_number->setSegmentStyle( QLCDNumber::Flat );
|
||||
#ifndef QT3
|
||||
QPalette pal;
|
||||
pal.setColor( QPalette::Light, Qt::gray );
|
||||
pal.setColor( QPalette::Mid, Qt::darkGray );
|
||||
pal.setColor( QPalette::Dark, Qt::black );
|
||||
pal.setColor( m_number->backgroundRole(), Qt::black );
|
||||
m_number->setPalette( pal );
|
||||
m_number->setAutoFillBackground( TRUE );
|
||||
#endif
|
||||
setEnabled( TRUE );
|
||||
|
||||
// value is automatically limited to given range
|
||||
|
||||
@@ -87,6 +87,7 @@ projectNotes::projectNotes( engine * _engine) :
|
||||
|
||||
m_edit = new QTextEdit( this );
|
||||
#ifdef QT4
|
||||
m_edit->setAutoFillBackground( TRUE );
|
||||
QPalette pal;
|
||||
pal.setColor( m_edit->backgroundRole(), QColor( 64, 64, 64 ) );
|
||||
m_edit->setPalette( pal );
|
||||
|
||||
@@ -63,6 +63,7 @@ tabWidget::tabWidget( const QString & _caption, QWidget * _parent ) :
|
||||
setBackgroundMode( Qt::NoBackground );
|
||||
#endif*/
|
||||
#ifndef QT3
|
||||
setAutoFillBackground( TRUE );
|
||||
QColor bg_color = QApplication::palette().color( QPalette::Active,
|
||||
QPalette::Background ).
|
||||
dark( 132 );
|
||||
@@ -98,7 +99,7 @@ void tabWidget::addTab( QWidget * _w, const QString & _name, int _idx )
|
||||
m_widgets[_idx] = d;
|
||||
_w->setFixedSize( width() - 4, height() - 14 );
|
||||
_w->move( 2, 12 );
|
||||
_w->show();
|
||||
_w->hide();
|
||||
|
||||
if( m_widgets.contains( m_activeTab ) )
|
||||
{
|
||||
@@ -171,24 +172,27 @@ void tabWidget::paintEvent( QPaintEvent * _pe )
|
||||
{
|
||||
#ifdef QT4
|
||||
QPainter p( this );
|
||||
p.fillRect( 0, 0, width() - 1, height() - 1, QColor( 96, 96, 96 ) );
|
||||
const int c = 0;
|
||||
#else
|
||||
QPixmap pm( size() );
|
||||
pm.fill( QColor( 96, 96, 96 ) );
|
||||
|
||||
QPainter p( &pm );
|
||||
const int c = 1;
|
||||
#endif
|
||||
bool big_tab_captions = ( m_caption == "" );
|
||||
int add = big_tab_captions ? 1 : 0;
|
||||
|
||||
p.setPen( QColor( 64, 64, 64 ) );
|
||||
p.drawRect( 0, 0, width(), height() );
|
||||
p.drawRect( 0, 0, width() - 1 + c, height() - 1 + c );
|
||||
|
||||
p.setPen( QColor( 160, 160, 160 ) );
|
||||
p.drawLine( width() - 1, 0, width() - 1, height() - 1 );
|
||||
p.drawLine( 0, height() - 1, width() - 1, height() - 1 );
|
||||
|
||||
p.setPen( QColor( 0, 0, 0 ) );
|
||||
p.drawRect( 1, 1, width() - 2, height() - 2 );
|
||||
p.drawRect( 1, 1, width() - 3 + c, height() - 3 + c );
|
||||
|
||||
p.fillRect( 2, 2, width() - 4, 9 + add, QColor( 30, 45, 60 ) );
|
||||
p.drawLine( 2, 11 + add, width() - 3, 11 + add );
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
#include "text_float.h"
|
||||
#include "gui_templates.h"
|
||||
#include "main_window.h"
|
||||
|
||||
|
||||
|
||||
@@ -153,6 +154,16 @@ textFloat * textFloat::displayMessage( const QString & _msg, int _timeout,
|
||||
{
|
||||
#ifdef QT4
|
||||
QWidget * mw = QApplication::activeWindow();
|
||||
if( mw == NULL )
|
||||
{
|
||||
foreach( QWidget * w, QApplication::topLevelWidgets() )
|
||||
{
|
||||
if( mw == NULL || dynamic_cast<mainWindow *>( w ) )
|
||||
{
|
||||
mw = w;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
QWidget * mw = qApp->mainWidget();
|
||||
if( mw == NULL )
|
||||
@@ -215,7 +226,11 @@ void textFloat::paintEvent( QPaintEvent * _pe )
|
||||
|
||||
p.setFont( pointSize<8>( p.font() ) );
|
||||
|
||||
#ifndef QT3
|
||||
p.drawRect( 0, 0, rect().right(), rect().bottom() );
|
||||
#else
|
||||
p.drawRect( rect() );
|
||||
#endif
|
||||
|
||||
// p.setPen( Qt::black );
|
||||
// small message?
|
||||
|
||||
@@ -42,6 +42,9 @@ toolButton::toolButton( const QPixmap & _pixmap, const QString & _tooltip,
|
||||
m_colorStandard( s_stdColor ),
|
||||
m_colorHighlighted( s_hlColor )
|
||||
{
|
||||
#ifndef QT3
|
||||
setAutoFillBackground( TRUE );
|
||||
#endif
|
||||
if( _receiver != NULL && _slot != NULL )
|
||||
{
|
||||
connect( this, SIGNAL( clicked() ), _receiver, _slot );
|
||||
|
||||
229
src/widgets/volume_knob.cpp
Normal file
229
src/widgets/volume_knob.cpp
Normal file
@@ -0,0 +1,229 @@
|
||||
#ifndef SINGLE_SOURCE_COMPILE
|
||||
|
||||
/*
|
||||
* volume_knob.cpp - defines a knob that display it's value as either a
|
||||
* percentage or in dbV.
|
||||
*
|
||||
* Copyright (c) 2006 Danny McRae <khjklujn/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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "volume_knob.h"
|
||||
|
||||
|
||||
volumeKnob::volumeKnob( int _knob_num, QWidget * _parent, const QString & _name,
|
||||
engine * _engine ):
|
||||
knob( _knob_num, _parent, _name, _engine )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
volumeKnob::~volumeKnob()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//! Mouse press event handler
|
||||
void volumeKnob::mousePressEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( _me->button() == Qt::LeftButton &&
|
||||
eng()->getMainWindow()->isCtrlPressed() == FALSE )
|
||||
{
|
||||
setJournalling( FALSE );
|
||||
m_oldValue = value();
|
||||
|
||||
const QPoint & p = _me->pos();
|
||||
m_origMousePos = p;
|
||||
|
||||
if( configManager::inst()->value( "knobs",
|
||||
"classicalusability").toInt() )
|
||||
{
|
||||
m_mouseOffset = getValue( p ) - value();
|
||||
}
|
||||
emit sliderPressed();
|
||||
|
||||
if( !configManager::inst()->value( "knobs", "classicalusability"
|
||||
).toInt() )
|
||||
{
|
||||
QApplication::setOverrideCursor( Qt::BlankCursor );
|
||||
}
|
||||
s_textFloat->reparent( this );
|
||||
|
||||
QString val;
|
||||
if( configManager::inst()->value( "app", "displaydbv" ).toInt() )
|
||||
{
|
||||
val = QString( " %1 dBV" ).arg(
|
||||
20.0 * log10( value() / 100.0 ),
|
||||
3, 'f', 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
val = QString( " %1%" ).arg( value(), 3, 'f', 0 );
|
||||
}
|
||||
s_textFloat->setText( m_hintTextBeforeValue + val );
|
||||
|
||||
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
|
||||
QPoint( m_knobPixmap->width() + 2, 0 ) );
|
||||
s_textFloat->show();
|
||||
m_buttonPressed = TRUE;
|
||||
}
|
||||
else if( _me->button() == Qt::LeftButton &&
|
||||
eng()->getMainWindow()->isCtrlPressed() == TRUE )
|
||||
{
|
||||
new stringPairDrag( "float_value", QString::number( value() ),
|
||||
QPixmap(), this, eng() );
|
||||
}
|
||||
else if( _me->button() == Qt::MidButton )
|
||||
{
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//! Mouse Move Event handler
|
||||
void volumeKnob::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
if( m_buttonPressed == TRUE )
|
||||
{
|
||||
setPosition( _me->pos() );
|
||||
emit sliderMoved( value() );
|
||||
if( !configManager::inst()->value( "knobs",
|
||||
"classicalusability").toInt() )
|
||||
{
|
||||
QCursor::setPos( mapToGlobal( m_origMousePos ) );
|
||||
}
|
||||
}
|
||||
|
||||
QString val;
|
||||
if( configManager::inst()->value( "app", "displaydbv" ).toInt() )
|
||||
{
|
||||
val = QString( " %1 dBV" ).arg(
|
||||
20.0 * log10( value() / 100.0 ),
|
||||
3, 'f', 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
val = QString( " %1%" ).arg( value(), 3, 'f', 0 );
|
||||
}
|
||||
s_textFloat->setText( m_hintTextBeforeValue + val );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void volumeKnob::wheelEvent( QWheelEvent * _we )
|
||||
{
|
||||
_we->accept();
|
||||
const int inc = ( _we->delta() > 0 ) ? 1 : -1;
|
||||
incValue( inc );
|
||||
|
||||
|
||||
s_textFloat->reparent( this );
|
||||
|
||||
QString val;
|
||||
if( configManager::inst()->value( "app", "displaydbv" ).toInt() )
|
||||
{
|
||||
val = QString( " %1 dBV" ).arg(
|
||||
20.0 * log10( value() / 100.0 ),
|
||||
3, 'f', 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
val = QString( " %1%" ).arg( value(), 3, 'f', 0 );
|
||||
}
|
||||
s_textFloat->setText( m_hintTextBeforeValue + val );
|
||||
|
||||
s_textFloat->move( mapTo( topLevelWidget(), QPoint( 0, 0 ) ) +
|
||||
QPoint( m_knobPixmap->width() + 2, 0 ) );
|
||||
s_textFloat->setVisibilityTimeOut( 1000 );
|
||||
|
||||
emit sliderMoved( value() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void volumeKnob::enterValue( void )
|
||||
{
|
||||
bool ok;
|
||||
float new_val;
|
||||
if( configManager::inst()->value( "app", "displaydbv" ).toInt() )
|
||||
{
|
||||
new_val = QInputDialog::getDouble(
|
||||
#ifdef QT4
|
||||
this,
|
||||
#endif
|
||||
accessibleName(),
|
||||
tr( "Please enter a new value between "
|
||||
"-96.0 dbV and 6.0 dbV:" ),
|
||||
20.0 * log10( value() / 100.0 ),
|
||||
-96.0, 6.0,
|
||||
4, &ok
|
||||
#ifndef QT4
|
||||
, this
|
||||
#endif
|
||||
);
|
||||
if( new_val <= -96.0 )
|
||||
{
|
||||
new_val = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_val = pow( 10.0, ( new_val / 20.0 ) ) * 100.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_val = QInputDialog::getDouble(
|
||||
#ifdef QT4
|
||||
this,
|
||||
#endif
|
||||
accessibleName(),
|
||||
tr( "Please enter a new value between "
|
||||
"%1 and %2:" ).arg(
|
||||
minValue() ).arg( maxValue() ),
|
||||
value(), minValue(), maxValue(),
|
||||
4, &ok
|
||||
#ifndef QT4
|
||||
, this
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
if( ok )
|
||||
{
|
||||
setValue( new_val );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "volume_knob.moc"
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user