Added volume knob to sample tracks.
Modified Files: include/sample_track.h src/tracks/sample_track.cpp git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@121 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2006-04-05 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* include/sample_track.h:
|
||||
* src/tracks/sample_track.cpp:
|
||||
- add volume knob to sample tracks
|
||||
|
||||
2006-04-05 Danny McRae <khjklujn/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* plugins/vibed/impulse_editor.cpp:
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
class nameLabel;
|
||||
class audioPort;
|
||||
class QLabel;
|
||||
class knob;
|
||||
//class sampleTCOSettingsDialog;
|
||||
|
||||
|
||||
@@ -75,7 +76,6 @@ public slots:
|
||||
void setSampleFile( const QString & _sf );
|
||||
void updateLength( bpm_t = 0 );
|
||||
|
||||
|
||||
protected:
|
||||
virtual void dragEnterEvent( QDragEnterEvent * _dee );
|
||||
virtual void dropEvent( QDropEvent * _de );
|
||||
@@ -140,17 +140,20 @@ public:
|
||||
virtual void FASTCALL loadTrackSpecificSettings( const QDomElement &
|
||||
_this );
|
||||
|
||||
|
||||
public slots:
|
||||
virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "sampletrack" );
|
||||
}
|
||||
void setVolume( float _new_volume );
|
||||
|
||||
|
||||
private:
|
||||
nameLabel * m_trackLabel;
|
||||
audioPort * m_audioPort;
|
||||
|
||||
knob * m_volumeKnob;
|
||||
float m_volume;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
#include "tooltip.h"
|
||||
#include "audio_port.h"
|
||||
#include "string_pair_drag.h"
|
||||
|
||||
#include "knob.h"
|
||||
#include "volume.h"
|
||||
|
||||
|
||||
sampleTCO::sampleTCO( track * _track ) :
|
||||
@@ -359,16 +360,36 @@ void sampleTCOSettingsDialog::setSampleFile( const QString & _f )
|
||||
|
||||
sampleTrack::sampleTrack( trackContainer * _tc ) :
|
||||
track( _tc ),
|
||||
m_audioPort( new audioPort( tr( "Sample track" ), eng() ) )
|
||||
m_audioPort( new audioPort( tr( "Sample track" ), eng() ) ),
|
||||
m_volume( 1.0f )
|
||||
{
|
||||
getTrackWidget()->setFixedHeight( 32 );
|
||||
|
||||
m_trackLabel = new nameLabel( tr( "Sample track" ),
|
||||
getTrackSettingsWidget(), eng() );
|
||||
m_trackLabel->setPixmap( embed::getIconPixmap( "sample_track" ) );
|
||||
m_trackLabel->setGeometry( 1, 1, DEFAULT_SETTINGS_WIDGET_WIDTH-2, 29 );
|
||||
m_trackLabel->setGeometry( 26, 1, DEFAULT_SETTINGS_WIDGET_WIDTH-2, 29 );
|
||||
m_trackLabel->show();
|
||||
|
||||
m_volumeKnob = new knob( knobSmall_17, getTrackSettingsWidget(),
|
||||
tr( "Channel volume" ), eng() );
|
||||
m_volumeKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f );
|
||||
m_volumeKnob->setInitValue( DEFAULT_VOLUME );
|
||||
m_volumeKnob->setHintText( tr( "Channel volume:" ) + " ", "%" );
|
||||
m_volumeKnob->move( 4, 4 );
|
||||
m_volumeKnob->setLabel( tr( "VOL" ) );
|
||||
m_volumeKnob->show();
|
||||
connect( m_volumeKnob, SIGNAL( valueChanged( float ) ),
|
||||
this, SLOT( setVolume( float ) ) );
|
||||
#ifdef QT4
|
||||
m_volumeKnob->setWhatsThis(
|
||||
#else
|
||||
QWhatsThis::add( m_volumeKnob,
|
||||
#endif
|
||||
tr( "With this knob you can set "
|
||||
"the volume of the opened "
|
||||
"channel." ) );
|
||||
|
||||
_tc->updateAfterTrackAdd();
|
||||
}
|
||||
|
||||
@@ -382,6 +403,16 @@ sampleTrack::~sampleTrack()
|
||||
|
||||
|
||||
|
||||
void sampleTrack::setVolume( float _new_volume )
|
||||
{
|
||||
if( _new_volume <= MAX_VOLUME )
|
||||
{
|
||||
m_volume = _new_volume / 100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
track::trackTypes sampleTrack::type( void ) const
|
||||
{
|
||||
@@ -408,9 +439,9 @@ bool FASTCALL sampleTrack::play( const midiTime & _start,
|
||||
|
||||
sampleFrame * buf = bufferAllocator::alloc<sampleFrame>( _frames );
|
||||
|
||||
volumeVector v = { 1.0f, 1.0f
|
||||
volumeVector v = { m_volume, m_volume
|
||||
#ifndef DISABLE_SURROUND
|
||||
, 1.0f, 1.0f
|
||||
, m_volume, m_volume
|
||||
#endif
|
||||
} ;
|
||||
float fpt = eng()->getSongEditor()->framesPerTact();
|
||||
@@ -456,6 +487,7 @@ void sampleTrack::saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
{
|
||||
_this.setAttribute( "name", m_trackLabel->text() );
|
||||
_this.setAttribute( "icon", m_trackLabel->pixmapFile() );
|
||||
_this.setAttribute( "vol", m_volume );
|
||||
}
|
||||
|
||||
|
||||
@@ -468,6 +500,16 @@ void sampleTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
{
|
||||
m_trackLabel->setPixmapFile( _this.attribute( "icon" ) );
|
||||
}
|
||||
if( _this.attribute( "vol" ) != "" )
|
||||
{
|
||||
m_volume = _this.attribute( "vol" ).toFloat();
|
||||
m_volumeKnob->setValue( m_volume * 100.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_volumeKnob->setValue( 100.0f );
|
||||
m_volume = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user