introduced engine-technology
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@81 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* audio_file_processor.cpp - instrument for using audio-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
|
||||
*
|
||||
@@ -41,6 +41,8 @@
|
||||
#include <qbitmap.h>
|
||||
#include <qdom.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <qcursor.h>
|
||||
#include <qwhatsthis.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -88,7 +90,7 @@ QPixmap * audioFileProcessor::s_artwork = NULL;
|
||||
audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
|
||||
instrument( _channel_track, &audiofileprocessor_plugin_descriptor ),
|
||||
specialBgHandlingWidget( PLUGIN_NAME::getIconPixmap( "artwork" ) ),
|
||||
m_sampleBuffer( "" ),
|
||||
m_sampleBuffer( eng(), "" ),
|
||||
m_drawMethod( sampleBuffer::LINE_CONNECT )
|
||||
{
|
||||
connect( &m_sampleBuffer, SIGNAL( sampleUpdated() ), this,
|
||||
@@ -166,7 +168,7 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
|
||||
"This is useful for things like string- and choir-"
|
||||
"samples." ) );
|
||||
|
||||
m_ampKnob = new knob( knobDark_28, this, tr( "Amplify" ) );
|
||||
m_ampKnob = new knob( knobDark_28, this, tr( "Amplify" ), eng() );
|
||||
m_ampKnob->setRange( 0, 500, 1.0f );
|
||||
m_ampKnob->move( 6, 114 );
|
||||
m_ampKnob->setValue( 100.0f, TRUE );
|
||||
@@ -184,7 +186,8 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
|
||||
"Otherwise it will be amplified up or down (your "
|
||||
"actual sample-file isn't touched!)" ) );
|
||||
|
||||
m_startKnob = new knob( knobDark_28, this, tr( "Start of sample" ) );
|
||||
m_startKnob = new knob( knobDark_28, this, tr( "Start of sample" ),
|
||||
eng() );
|
||||
m_startKnob->setRange( 0.0f, 1.0f, 0.00001f );
|
||||
m_startKnob->move( 46, 114 );
|
||||
m_startKnob->setValue( 0.0f, TRUE );
|
||||
@@ -203,7 +206,7 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
|
||||
"which AudioFileProcessor returns if a note is longer "
|
||||
"than the sample between start- and end-point." ) );
|
||||
|
||||
m_endKnob = new knob( knobDark_28, this, tr( "End of sample" ) );
|
||||
m_endKnob = new knob( knobDark_28, this, tr( "End of sample" ), eng() );
|
||||
m_endKnob->setRange( 0.0f, 1.0f, 0.00001f );
|
||||
m_endKnob->move( 84, 114 );
|
||||
m_endKnob->setValue( 1.0f, TRUE );
|
||||
@@ -365,7 +368,7 @@ Uint32 audioFileProcessor::getBeatLen( notePlayHandle * _n ) const
|
||||
const float freq_factor = BASE_FREQ /
|
||||
( getChannelTrack()->frequency( _n ) *
|
||||
DEFAULT_SAMPLE_RATE /
|
||||
mixer::inst()->sampleRate() );
|
||||
eng()->getMixer()->sampleRate() );
|
||||
|
||||
return( static_cast<Uint32>( floorf( ( m_sampleBuffer.endFrame() -
|
||||
m_sampleBuffer.startFrame() ) *
|
||||
@@ -398,12 +401,12 @@ void audioFileProcessor::setAudioFile( const QString & _audio_file )
|
||||
|
||||
void audioFileProcessor::playNote( notePlayHandle * _n )
|
||||
{
|
||||
const Uint32 frames = mixer::inst()->framesPerAudioBuffer();
|
||||
const Uint32 frames = eng()->getMixer()->framesPerAudioBuffer();
|
||||
sampleFrame * buf = bufferAllocator::alloc<sampleFrame>( frames );
|
||||
|
||||
// calculate frequency of note
|
||||
const float note_freq = getChannelTrack()->frequency( _n ) /
|
||||
( mixer::inst()->sampleRate() /
|
||||
( eng()->getMixer()->sampleRate() /
|
||||
DEFAULT_SAMPLE_RATE );
|
||||
if( m_sampleBuffer.play( buf, _n->totalFramesPlayed(),
|
||||
frames, note_freq,
|
||||
@@ -560,7 +563,7 @@ void audioFileProcessor::sampleUpdated( void )
|
||||
void audioFileProcessor::reverseBtnToggled( bool _on )
|
||||
{
|
||||
m_sampleBuffer.setReversed( _on );
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -568,7 +571,7 @@ void audioFileProcessor::reverseBtnToggled( bool _on )
|
||||
|
||||
void audioFileProcessor::lineDrawBtnToggled( bool _on )
|
||||
{
|
||||
if( _on )
|
||||
if( _on == TRUE )
|
||||
{
|
||||
m_drawMethod = sampleBuffer::LINE_CONNECT;
|
||||
sampleUpdated();
|
||||
@@ -580,7 +583,7 @@ void audioFileProcessor::lineDrawBtnToggled( bool _on )
|
||||
|
||||
void audioFileProcessor::dotDrawBtnToggled( bool _on )
|
||||
{
|
||||
if( _on )
|
||||
if( _on == TRUE )
|
||||
{
|
||||
m_drawMethod = sampleBuffer::DOTS;
|
||||
sampleUpdated();
|
||||
@@ -592,7 +595,7 @@ void audioFileProcessor::dotDrawBtnToggled( bool _on )
|
||||
|
||||
void audioFileProcessor::ampKnobChanged( float _val )
|
||||
{
|
||||
m_sampleBuffer.setAmplification( _val/100.0f );
|
||||
m_sampleBuffer.setAmplification( _val / 100.0f );
|
||||
}
|
||||
|
||||
|
||||
@@ -628,7 +631,7 @@ void audioFileProcessor::startKnobChanged( float _new_value )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_startKnob->setValue( m_endKnob->value() - 0.01 );
|
||||
m_startKnob->setValue( m_endKnob->value() - 0.01f );
|
||||
}
|
||||
update();
|
||||
}
|
||||
@@ -653,7 +656,7 @@ void audioFileProcessor::endKnobChanged( float _new_value )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_endKnob->setValue( m_startKnob->value() + 0.01 );
|
||||
m_endKnob->setValue( m_startKnob->value() + 0.01f );
|
||||
}
|
||||
update();
|
||||
}
|
||||
@@ -667,7 +670,7 @@ void audioFileProcessor::openAudioFile( void )
|
||||
if( af != "" )
|
||||
{
|
||||
setAudioFile( af );
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ plugin::descriptor bitinvader_plugin_descriptor =
|
||||
QPixmap * bitInvader::s_artwork = NULL;
|
||||
|
||||
|
||||
bSynth::bSynth(float* shape, int length, float _pitch, bool _interpolation, float factor)
|
||||
bSynth::bSynth(float* shape, int length, float _pitch, bool _interpolation, float factor, const sample_rate_t _sample_rate )
|
||||
{
|
||||
|
||||
interpolation = _interpolation;
|
||||
@@ -110,8 +110,8 @@ bSynth::bSynth(float* shape, int length, float _pitch, bool _interpolation, floa
|
||||
sample_realindex = 0;
|
||||
|
||||
|
||||
sample_step = static_cast<float>( sample_length /
|
||||
((float)mixer::inst()->sampleRate() / _pitch) );
|
||||
sample_step = static_cast<float>( sample_length / ( _sample_rate /
|
||||
_pitch ) );
|
||||
|
||||
|
||||
}
|
||||
@@ -190,7 +190,8 @@ bitInvader::bitInvader( channelTrack * _channel_track ) :
|
||||
}
|
||||
|
||||
|
||||
m_sampleLengthKnob = new knob( knobDark_28, this, tr( "Samplelength" ) );
|
||||
m_sampleLengthKnob = new knob( knobDark_28, this, tr( "Samplelength" ),
|
||||
eng() );
|
||||
m_sampleLengthKnob->setRange( 8, 128, 1 );
|
||||
m_sampleLengthKnob->setValue( 128, TRUE );
|
||||
m_sampleLengthKnob->move( 10, 120 );
|
||||
@@ -213,7 +214,7 @@ bitInvader::bitInvader( channelTrack * _channel_track ) :
|
||||
this, SLOT ( normalizeToggle( bool ) ) );
|
||||
|
||||
|
||||
m_graph = new graph( "", this );
|
||||
m_graph = new graph( this, eng() );
|
||||
m_graph->move(53,118); // 55,120 - 2px border
|
||||
m_graph->setCursor( QCursor( Qt::CrossCursor ) );
|
||||
|
||||
@@ -436,7 +437,7 @@ void bitInvader::usrWaveClicked( void )
|
||||
}
|
||||
|
||||
// load user shape
|
||||
sampleBuffer buffer;
|
||||
sampleBuffer buffer( eng() );
|
||||
QString af = buffer.openAudioFile();
|
||||
if ( af != "" )
|
||||
{
|
||||
@@ -634,15 +635,14 @@ void bitInvader::interpolationToggle( bool value )
|
||||
{
|
||||
interpolation = value;
|
||||
|
||||
songEditor::inst()->setModified();
|
||||
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
void bitInvader::normalizeToggle( bool value )
|
||||
{
|
||||
normalize = value;
|
||||
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
|
||||
}
|
||||
|
||||
@@ -674,8 +674,7 @@ void bitInvader::smoothClicked( void )
|
||||
update();
|
||||
m_graph->update();
|
||||
|
||||
songEditor::inst()->setModified();
|
||||
|
||||
eng()->getSongEditor()->setModified();
|
||||
|
||||
}
|
||||
|
||||
@@ -697,14 +696,15 @@ void bitInvader::playNote( notePlayHandle * _n )
|
||||
}
|
||||
|
||||
_n->m_pluginData = new bSynth( sample_shape, sample_length,freq
|
||||
, interpolation, factor );
|
||||
, interpolation, factor,
|
||||
eng()->getMixer()->sampleRate() );
|
||||
}
|
||||
|
||||
const Uint32 frames = mixer::inst()->framesPerAudioBuffer();
|
||||
const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer();
|
||||
sampleFrame * buf = bufferAllocator::alloc<sampleFrame>( frames );
|
||||
|
||||
bSynth * ps = static_cast<bSynth *>( _n->m_pluginData );
|
||||
for( Uint32 frame = 0; frame < frames; ++frame )
|
||||
for( fpab_t frame = 0; frame < frames; ++frame )
|
||||
{
|
||||
const sample_t cur = ps->nextStringSample();
|
||||
for( Uint8 chnl = 0; chnl < DEFAULT_CHANNELS; ++chnl )
|
||||
@@ -772,7 +772,7 @@ void bitInvader::sampleSizeChanged( float _new_sample_length )
|
||||
m_graph->setSamplePointer( sample_shape, sample_length );
|
||||
|
||||
// set Song modified
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
|
||||
}
|
||||
|
||||
@@ -793,7 +793,7 @@ void bitInvader::sampleChanged()
|
||||
m_graph->update();
|
||||
}
|
||||
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class pixmapButton;
|
||||
class bSynth
|
||||
{
|
||||
public:
|
||||
bSynth(float* sample, int length, float _pitch, bool _interpolation, float factor);
|
||||
bSynth(float* sample, int length, float _pitch, bool _interpolation, float factor, const sample_rate_t _sample_rate);
|
||||
virtual ~bSynth();
|
||||
|
||||
sample_t nextStringSample();
|
||||
|
||||
@@ -50,8 +50,9 @@ using namespace std;
|
||||
|
||||
|
||||
|
||||
graph::graph( const QString & _text, QWidget * _parent) :
|
||||
QWidget( _parent )
|
||||
graph::graph( QWidget * _parent, engine * _engine ) :
|
||||
QWidget( _parent ),
|
||||
engineObject( _engine )
|
||||
{
|
||||
|
||||
// m_background = 0; TODO
|
||||
@@ -86,7 +87,7 @@ void graph::setSamplePointer( float * _pointer, int _length )
|
||||
update();
|
||||
}
|
||||
|
||||
void graph::loadSampleFromFile( const QString filename )
|
||||
void graph::loadSampleFromFile( const QString & _filename )
|
||||
{
|
||||
// zero sample_shape
|
||||
for (int i = 0; i < sampleLength; i++)
|
||||
@@ -95,9 +96,8 @@ void graph::loadSampleFromFile( const QString filename )
|
||||
}
|
||||
|
||||
// load user shape
|
||||
sampleBuffer buffer;
|
||||
buffer.setAudioFile( filename );
|
||||
|
||||
sampleBuffer buffer( eng(), _filename );
|
||||
|
||||
// copy buffer data
|
||||
sampleLength = min( sampleLength, static_cast<int>(buffer.frames()) );
|
||||
for ( int i = 0; i < sampleLength; i++ )
|
||||
|
||||
@@ -39,22 +39,23 @@
|
||||
#include <qwidget.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qcursor.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//class QPixmap;
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
class graph : public QWidget
|
||||
class graph : public QWidget, public engineObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
graph( const QString & _txt, QWidget * _parent );
|
||||
graph( QWidget * _parent, engine * _engine );
|
||||
virtual ~graph();
|
||||
|
||||
void setSamplePointer( float * pointer, int length );
|
||||
void setBackground ( const QPixmap & _pixmap );
|
||||
void graph::loadSampleFromFile( QString filename );
|
||||
void loadSampleFromFile( const QString & _filename );
|
||||
|
||||
signals:
|
||||
void sampleSizeChanged( float f );
|
||||
|
||||
@@ -72,13 +72,15 @@ plugin::descriptor pluckedstringsynth_plugin_descriptor =
|
||||
pluckedStringSynth::pluckedStringSynth( channelTrack * _channel_track ) :
|
||||
instrument( _channel_track, &pluckedstringsynth_plugin_descriptor )
|
||||
{
|
||||
m_pickKnob = new knob( knobDark_28, this, tr( "Pick position" ) );
|
||||
m_pickKnob = new knob( knobDark_28, this, tr( "Pick position" ),
|
||||
eng() );
|
||||
m_pickKnob->setRange( 0.0f, 0.5f, 0.005f );
|
||||
m_pickKnob->setValue( 0.0f, TRUE );
|
||||
m_pickKnob->move( 86, 134 );
|
||||
m_pickKnob->setHintText( tr( "Pick position:" ) + " ", "" );
|
||||
|
||||
m_pickupKnob = new knob( knobDark_28, this, tr( "Pickup position" ) );
|
||||
m_pickupKnob = new knob( knobDark_28, this, tr( "Pickup position" ),
|
||||
eng() );
|
||||
m_pickupKnob->setRange( 0.0f, 0.5f, 0.005f );
|
||||
m_pickupKnob->setValue( 0.05f, TRUE );
|
||||
m_pickupKnob->move( 138, 134 );
|
||||
@@ -139,10 +141,11 @@ void pluckedStringSynth::playNote( notePlayHandle * _n )
|
||||
{
|
||||
float freq = getChannelTrack()->frequency( _n );
|
||||
_n->m_pluginData = new pluckSynth( freq, m_pickKnob->value(),
|
||||
m_pickupKnob->value() );
|
||||
m_pickupKnob->value(),
|
||||
eng()->getMixer()->sampleRate() );
|
||||
}
|
||||
|
||||
const Uint32 frames = mixer::inst()->framesPerAudioBuffer();
|
||||
const Uint32 frames = eng()->getMixer()->framesPerAudioBuffer();
|
||||
sampleFrame * buf = bufferAllocator::alloc<sampleFrame>( frames );
|
||||
|
||||
pluckSynth * ps = static_cast<pluckSynth *>( _n->m_pluginData );
|
||||
@@ -208,11 +211,11 @@ void FASTCALL pluckSynth::freeDelayLine( delayLine * _dl )
|
||||
|
||||
|
||||
|
||||
pluckSynth::pluckSynth( float _pitch, float _pick, float _pickup )
|
||||
pluckSynth::pluckSynth( const float _pitch, const float _pick,
|
||||
const float _pickup, const sample_rate_t _sample_rate )
|
||||
{
|
||||
const float AMP = 1.5f;
|
||||
int rail_length = static_cast<int>( mixer::inst()->sampleRate() / 2 /
|
||||
_pitch ) + 1;
|
||||
int rail_length = static_cast<int>( _sample_rate / 2 / _pitch ) + 1;
|
||||
// Round pick position to nearest spatial sample.
|
||||
// A pick position at x = 0 is not allowed.
|
||||
int pick_sample = static_cast<int>( tMax<float>( rail_length * _pick,
|
||||
|
||||
@@ -38,7 +38,8 @@ class notePlayHandle;
|
||||
class pluckSynth
|
||||
{
|
||||
public:
|
||||
pluckSynth( float _pitch, float _pick, float _pickup );
|
||||
pluckSynth( const float _pitch, const float _pick, const float _pickup,
|
||||
const sample_rate_t _sample_rate );
|
||||
|
||||
inline ~pluckSynth( void )
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <qbitmap.h>
|
||||
#include <qpainter.h>
|
||||
#include <qdom.h>
|
||||
#include <qwhatsthis.h>
|
||||
|
||||
#define setChecked setOn
|
||||
|
||||
@@ -53,6 +54,7 @@
|
||||
#include "buffer_allocator.h"
|
||||
#include "debug.h"
|
||||
#include "tooltip.h"
|
||||
#include "sample_buffer.h"
|
||||
|
||||
#include "embed.cpp"
|
||||
|
||||
@@ -81,6 +83,11 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
|
||||
m_modulationAlgo1( oscillator::MIX ),
|
||||
m_modulationAlgo2( oscillator::MIX )
|
||||
{
|
||||
for( int i = 0; i < NUM_OF_OSCILLATORS; ++i )
|
||||
{
|
||||
m_osc[i].m_sampleBuffer = new sampleBuffer( eng() );
|
||||
}
|
||||
|
||||
#ifdef QT4
|
||||
QPalette pal;
|
||||
pal.setBrush( backgroundRole(),
|
||||
@@ -258,10 +265,10 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
|
||||
|
||||
// setup volume-knob
|
||||
m_osc[i].volKnob = new knob( knobSmall_17, this, tr(
|
||||
"Osc %1 volume" ).arg( i+1 ) );
|
||||
"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 );
|
||||
m_osc[i].volKnob->setValue( DEFAULT_VOLUME, TRUE );
|
||||
m_osc[i].volKnob->setValue( DEFAULT_VOLUME / 3, TRUE );
|
||||
m_osc[i].volKnob->setHintText( tr( "Osc %1 volume:" ).arg(
|
||||
i+1 ) + " ", "%" );
|
||||
#ifdef QT4
|
||||
@@ -277,7 +284,7 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
|
||||
|
||||
// setup panning-knob
|
||||
m_osc[i].panKnob = new knob( knobSmall_17, this,
|
||||
tr( "Osc %1 panning" ).arg( i + 1 ) );
|
||||
tr( "Osc %1 panning" ).arg( i + 1 ), eng() );
|
||||
m_osc[i].panKnob->move( 33, 104+i*50 );
|
||||
m_osc[i].panKnob->setRange( PANNING_LEFT, PANNING_RIGHT, 1.0f );
|
||||
m_osc[i].panKnob->setValue( DEFAULT_PANNING, TRUE );
|
||||
@@ -295,7 +302,8 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
|
||||
|
||||
// setup coarse-knob
|
||||
m_osc[i].coarseKnob = new knob( knobSmall_17, this,
|
||||
tr("Osc %1 coarse detuning").arg( i + 1 ) );
|
||||
tr("Osc %1 coarse detuning").arg( i + 1 ),
|
||||
eng() );
|
||||
m_osc[i].coarseKnob->move( 66, 104 + i * 50 );
|
||||
m_osc[i].coarseKnob->setRange( -2 * NOTES_PER_OCTAVE,
|
||||
2 * NOTES_PER_OCTAVE, 1.0f );
|
||||
@@ -316,7 +324,8 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
|
||||
|
||||
// setup knob for left fine-detuning
|
||||
m_osc[i].fineLKnob = new knob( knobSmall_17, this,
|
||||
tr( "Osc %1 fine detuning left" ).arg( i+1 ) );
|
||||
tr( "Osc %1 fine detuning left" ).arg( i+1 ),
|
||||
eng() );
|
||||
m_osc[i].fineLKnob->move( 90, 104 + i * 50 );
|
||||
m_osc[i].fineLKnob->setRange( -100.0f, 100.0f, 1.0f );
|
||||
m_osc[i].fineLKnob->setValue( 0.0f, TRUE );
|
||||
@@ -338,7 +347,7 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
|
||||
// setup knob for right fine-detuning
|
||||
m_osc[i].fineRKnob = new knob( knobSmall_17, this,
|
||||
tr( "Osc %1 fine detuning right"
|
||||
).arg( i + 1 ) );
|
||||
).arg( i + 1 ), eng() );
|
||||
m_osc[i].fineRKnob->move( 110, 104 + i * 50 );
|
||||
m_osc[i].fineRKnob->setRange( -100.0f, 100.0f, 1.0f );
|
||||
m_osc[i].fineRKnob->setValue( 0.0f, TRUE );
|
||||
@@ -359,7 +368,8 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
|
||||
// setup phase-offset-knob
|
||||
m_osc[i].phaseOffsetKnob = new knob( knobSmall_17, this,
|
||||
tr( "Osc %1 phase-"
|
||||
"offset" ).arg( i+1 ) );
|
||||
"offset" ).arg( i+1 ),
|
||||
eng() );
|
||||
m_osc[i].phaseOffsetKnob->move( 142, 104 + i * 50 );
|
||||
m_osc[i].phaseOffsetKnob->setRange( 0.0f, 360.0f, 1.0f );
|
||||
m_osc[i].phaseOffsetKnob->setValue( 0.0f, TRUE );
|
||||
@@ -384,8 +394,8 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
|
||||
// setup stereo-phase-detuning-knob
|
||||
m_osc[i].stereoPhaseDetuningKnob = new knob( knobSmall_17, this,
|
||||
tr( "Osc %1 stereo phase-"
|
||||
"detuning" ).arg( i+1 )
|
||||
);
|
||||
"detuning" ).arg( i+1 ),
|
||||
eng() );
|
||||
m_osc[i].stereoPhaseDetuningKnob->move( 166, 104 + i * 50 );
|
||||
m_osc[i].stereoPhaseDetuningKnob->setRange( 0.0f, 360.0f,
|
||||
1.0f );
|
||||
@@ -601,6 +611,10 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
|
||||
|
||||
tripleOscillator::~tripleOscillator()
|
||||
{
|
||||
for( int i = 0; i < NUM_OF_OSCILLATORS; ++i )
|
||||
{
|
||||
delete m_osc[i].m_sampleBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -633,7 +647,7 @@ void tripleOscillator::saveSettings( QDomDocument & _doc,
|
||||
to_de.setAttribute( "wavetype" + is, QString::number(
|
||||
m_osc[i].waveShape ) );
|
||||
to_de.setAttribute( "userwavefile" + is,
|
||||
m_osc[i].m_sampleBuffer.audioFile() );
|
||||
m_osc[i].m_sampleBuffer->audioFile() );
|
||||
}
|
||||
|
||||
_parent.appendChild( to_de );
|
||||
@@ -669,7 +683,7 @@ void tripleOscillator::loadSettings( const QDomElement & _this )
|
||||
"phoffset" + is ).toFloat() );
|
||||
m_osc[i].stereoPhaseDetuningKnob->setValue( _this.attribute(
|
||||
"stphdetun" + is ).toFloat() );
|
||||
m_osc[i].m_sampleBuffer.setAudioFile( _this.attribute(
|
||||
m_osc[i].m_sampleBuffer->setAudioFile( _this.attribute(
|
||||
"userwavefile" + is ) );
|
||||
switch( _this.attribute( "wavetype" + is ).toInt() )
|
||||
{
|
||||
@@ -693,7 +707,7 @@ void tripleOscillator::loadSettings( const QDomElement & _this )
|
||||
break;
|
||||
case oscillator::USER_DEF_WAVE:
|
||||
toolTip::add( m_osc[i].usrWaveBtn,
|
||||
m_osc[i].m_sampleBuffer.audioFile() );
|
||||
m_osc[i].m_sampleBuffer->audioFile() );
|
||||
m_osc[i].usrWaveBtn->setChecked( TRUE );
|
||||
break;
|
||||
case oscillator::SIN_WAVE:
|
||||
@@ -762,14 +776,16 @@ void tripleOscillator::playNote( notePlayHandle * _n )
|
||||
static_cast<int>(
|
||||
m_osc[i].phaseOffsetKnob->value() +
|
||||
m_osc[i].stereoPhaseDetuningKnob->value() ),
|
||||
vol_fac_l );
|
||||
vol_fac_l,
|
||||
eng()->getMixer()->sampleRate() );
|
||||
oscs_r[i] = oscillator::createOsc(
|
||||
m_osc[i].waveShape,
|
||||
oscillator::MIX,
|
||||
freq*osc_detuning_r,
|
||||
static_cast<int>(
|
||||
m_osc[i].phaseOffsetKnob->value() ),
|
||||
vol_fac_r );
|
||||
vol_fac_r,
|
||||
eng()->getMixer()->sampleRate() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -780,7 +796,9 @@ void tripleOscillator::playNote( notePlayHandle * _n )
|
||||
static_cast<int>(
|
||||
m_osc[i].phaseOffsetKnob->value() +
|
||||
m_osc[i].stereoPhaseDetuningKnob->value() ),
|
||||
vol_fac_l, oscs_l[i + 1] );
|
||||
vol_fac_l,
|
||||
eng()->getMixer()->sampleRate(),
|
||||
oscs_l[i + 1] );
|
||||
oscs_r[i] = oscillator::createOsc(
|
||||
m_osc[i].waveShape,
|
||||
getModulationAlgo( i + 1 ),
|
||||
@@ -788,17 +806,18 @@ void tripleOscillator::playNote( notePlayHandle * _n )
|
||||
static_cast<int>(
|
||||
m_osc[i].phaseOffsetKnob->value() ),
|
||||
vol_fac_r,
|
||||
eng()->getMixer()->sampleRate(),
|
||||
oscs_r[i + 1] );
|
||||
}
|
||||
|
||||
if( m_osc[i].waveShape == oscillator::USER_DEF_WAVE )
|
||||
{
|
||||
oscs_l[i]->setUserWave(
|
||||
m_osc[i].m_sampleBuffer.data(),
|
||||
m_osc[i].m_sampleBuffer.frames() );
|
||||
m_osc[i].m_sampleBuffer->data(),
|
||||
m_osc[i].m_sampleBuffer->frames() );
|
||||
oscs_r[i]->setUserWave(
|
||||
m_osc[i].m_sampleBuffer.data(),
|
||||
m_osc[i].m_sampleBuffer.frames() );
|
||||
m_osc[i].m_sampleBuffer->data(),
|
||||
m_osc[i].m_sampleBuffer->frames() );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -813,7 +832,7 @@ void tripleOscillator::playNote( notePlayHandle * _n )
|
||||
oscillator * osc_r = static_cast<oscPtr *>( _n->m_pluginData
|
||||
)->oscRight;
|
||||
|
||||
const Uint32 frames = mixer::inst()->framesPerAudioBuffer();
|
||||
const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer();
|
||||
sampleFrame * buf = bufferAllocator::alloc<sampleFrame>( frames );
|
||||
|
||||
osc_l->update( buf, frames, 0 );
|
||||
@@ -857,7 +876,7 @@ void tripleOscillator::setModulationAlgo(
|
||||
m_modulationAlgo2 = _new_modulation_algo;
|
||||
}
|
||||
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -881,7 +900,7 @@ oscillator::modulationAlgos tripleOscillator::getModulationAlgo( int _n )
|
||||
void tripleOscillator::doSinWaveBtn( oscillatorData * _osc )
|
||||
{
|
||||
_osc->waveShape = oscillator::SIN_WAVE;
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -890,7 +909,7 @@ void tripleOscillator::doSinWaveBtn( oscillatorData * _osc )
|
||||
void tripleOscillator::doTriangleWaveBtn( oscillatorData * _osc )
|
||||
{
|
||||
_osc->waveShape = oscillator::TRIANGLE_WAVE;
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -899,7 +918,7 @@ void tripleOscillator::doTriangleWaveBtn( oscillatorData * _osc )
|
||||
void tripleOscillator::doSawWaveBtn( oscillatorData * _osc )
|
||||
{
|
||||
_osc->waveShape = oscillator::SAW_WAVE;
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -908,7 +927,7 @@ void tripleOscillator::doSawWaveBtn( oscillatorData * _osc )
|
||||
void tripleOscillator::doSqrWaveBtn( oscillatorData * _osc )
|
||||
{
|
||||
_osc->waveShape = oscillator::SQUARE_WAVE;
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -917,7 +936,7 @@ void tripleOscillator::doSqrWaveBtn( oscillatorData * _osc )
|
||||
void tripleOscillator::doMoogSawWaveBtn( oscillatorData * _osc )
|
||||
{
|
||||
_osc->waveShape = oscillator::MOOG_SAW_WAVE;
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -926,7 +945,7 @@ void tripleOscillator::doMoogSawWaveBtn( oscillatorData * _osc )
|
||||
void tripleOscillator::doExpWaveBtn( oscillatorData * _osc )
|
||||
{
|
||||
_osc->waveShape = oscillator::EXP_WAVE;
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -935,7 +954,7 @@ void tripleOscillator::doExpWaveBtn( oscillatorData * _osc )
|
||||
void tripleOscillator::doWhiteNoiseWaveBtn( oscillatorData * _osc )
|
||||
{
|
||||
_osc->waveShape = oscillator::WHITE_NOISE_WAVE;
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -944,7 +963,7 @@ void tripleOscillator::doWhiteNoiseWaveBtn( oscillatorData * _osc )
|
||||
void tripleOscillator::doUsrWaveBtn( oscillatorData * _osc )
|
||||
{
|
||||
_osc->waveShape = oscillator::USER_DEF_WAVE;
|
||||
songEditor::inst()->setModified();
|
||||
eng()->getSongEditor()->setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -992,15 +1011,15 @@ void tripleOscillator::osc01UserDefWaveCh( bool _on )
|
||||
|
||||
void tripleOscillator::osc01UserDefWaveDblClick( void )
|
||||
{
|
||||
QString af = m_osc[0].m_sampleBuffer.openAudioFile();
|
||||
QString af = m_osc[0].m_sampleBuffer->openAudioFile();
|
||||
if( af != "" )
|
||||
{
|
||||
m_osc[0].m_sampleBuffer.setAudioFile( af );
|
||||
m_osc[0].m_sampleBuffer->setAudioFile( af );
|
||||
/*#ifndef QT4
|
||||
toolTip::remove( m_osc[0].usrWaveBtn );
|
||||
#endif*/
|
||||
toolTip::add( m_osc[0].usrWaveBtn,
|
||||
m_osc[0].m_sampleBuffer.audioFile() );
|
||||
m_osc[0].m_sampleBuffer->audioFile() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1049,15 +1068,15 @@ void tripleOscillator::osc02UserDefWaveCh( bool _on )
|
||||
|
||||
void tripleOscillator::osc02UserDefWaveDblClick( void )
|
||||
{
|
||||
QString af = m_osc[1].m_sampleBuffer.openAudioFile();
|
||||
QString af = m_osc[1].m_sampleBuffer->openAudioFile();
|
||||
if( af != "" )
|
||||
{
|
||||
m_osc[1].m_sampleBuffer.setAudioFile( af );
|
||||
m_osc[1].m_sampleBuffer->setAudioFile( af );
|
||||
/*#ifndef QT4
|
||||
toolTip::remove( m_osc[1].usrWaveBtn );
|
||||
#endif*/
|
||||
toolTip::add( m_osc[1].usrWaveBtn,
|
||||
m_osc[1].m_sampleBuffer.audioFile() );
|
||||
m_osc[1].m_sampleBuffer->audioFile() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,15 +1124,15 @@ void tripleOscillator::osc03UserDefWaveCh( bool _on )
|
||||
|
||||
void tripleOscillator::osc03UserDefWaveDblClick( void )
|
||||
{
|
||||
QString af = m_osc[2].m_sampleBuffer.openAudioFile();
|
||||
QString af = m_osc[2].m_sampleBuffer->openAudioFile();
|
||||
if( af != "" )
|
||||
{
|
||||
m_osc[2].m_sampleBuffer.setAudioFile( af );
|
||||
m_osc[2].m_sampleBuffer->setAudioFile( af );
|
||||
/*#ifndef QT4
|
||||
toolTip::remove( m_osc[2].usrWaveBtn );
|
||||
#endif*/
|
||||
toolTip::add( m_osc[2].usrWaveBtn,
|
||||
m_osc[2].m_sampleBuffer.audioFile() );
|
||||
m_osc[2].m_sampleBuffer->audioFile() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
|
||||
#include "instrument.h"
|
||||
#include "oscillator.h"
|
||||
#include "sample_buffer.h"
|
||||
|
||||
|
||||
class knob;
|
||||
class pixmapButton;
|
||||
class notePlayHandle;
|
||||
class sampleBuffer;
|
||||
|
||||
|
||||
const int NUM_OF_OSCILLATORS = 3;
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
pixmapButton * expWaveBtn;
|
||||
pixmapButton * whiteNoiseWaveBtn;
|
||||
pixmapButton * usrWaveBtn;
|
||||
sampleBuffer m_sampleBuffer;
|
||||
sampleBuffer * m_sampleBuffer;
|
||||
} m_osc[NUM_OF_OSCILLATORS];
|
||||
|
||||
struct oscPtr
|
||||
|
||||
@@ -77,13 +77,14 @@
|
||||
|
||||
#include "templates.h"
|
||||
#include "config_mgr.h"
|
||||
#include "lmms_main_win.h"
|
||||
#include "main_window.h"
|
||||
#include "lvsl_client.h"
|
||||
|
||||
|
||||
|
||||
|
||||
remoteVSTPlugin::remoteVSTPlugin( const QString & _plugin ) :
|
||||
remoteVSTPlugin::remoteVSTPlugin( const QString & _plugin, engine * _engine ) :
|
||||
engineObject( _engine ),
|
||||
m_failed( TRUE ),
|
||||
m_plugin( _plugin ),
|
||||
m_pluginWidget( NULL ),
|
||||
@@ -241,7 +242,7 @@ void remoteVSTPlugin::showEditor( void )
|
||||
return;
|
||||
}
|
||||
|
||||
m_pluginWidget = new QWidget( lmmsMainWin::inst()->workspace() );
|
||||
m_pluginWidget = new QWidget( eng()->getMainWindow()->workspace() );
|
||||
m_pluginWidget->setFixedSize( m_pluginGeometry );
|
||||
m_pluginWidget->setWindowTitle( name() );
|
||||
m_pluginWidget->show();
|
||||
@@ -274,7 +275,7 @@ void remoteVSTPlugin::hideEditor( void )
|
||||
void remoteVSTPlugin::process( const sampleFrame * _in_buf,
|
||||
sampleFrame * _out_buf )
|
||||
{
|
||||
const fpab_t frames = mixer::inst()->framesPerAudioBuffer();
|
||||
const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer();
|
||||
|
||||
if( m_shm == NULL )
|
||||
{
|
||||
@@ -286,7 +287,7 @@ void remoteVSTPlugin::process( const sampleFrame * _in_buf,
|
||||
{
|
||||
(void) processNextMessage();
|
||||
}
|
||||
mixer::inst()->clearAudioBuffer( _out_buf, frames );
|
||||
eng()->getMixer()->clearAudioBuffer( _out_buf, frames );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -323,7 +324,7 @@ void remoteVSTPlugin::process( const sampleFrame * _in_buf,
|
||||
if( outputs != DEFAULT_CHANNELS )
|
||||
{
|
||||
// clear buffer, if plugin didn't fill up both channels
|
||||
mixer::inst()->clearAudioBuffer( _out_buf, frames );
|
||||
eng()->getMixer()->clearAudioBuffer( _out_buf, frames );
|
||||
}
|
||||
|
||||
for( ch_cnt_t ch = 0; ch < outputs; ++ch )
|
||||
@@ -341,23 +342,23 @@ void remoteVSTPlugin::process( const sampleFrame * _in_buf,
|
||||
|
||||
|
||||
void remoteVSTPlugin::enqueueMidiEvent( const midiEvent & _event,
|
||||
const Uint32 _frames_ahead )
|
||||
const f_cnt_t _frames_ahead )
|
||||
{
|
||||
lock();
|
||||
writeValueS<Sint16>( VST_ENQUEUE_MIDI_EVENT );
|
||||
writeValueS<midiEvent>( _event );
|
||||
writeValueS<Uint32>( _frames_ahead );
|
||||
writeValueS<f_cnt_t>( _frames_ahead );
|
||||
unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void remoteVSTPlugin::setBPM( Uint16 _bpm )
|
||||
void remoteVSTPlugin::setTempo( const bpm_t _bpm )
|
||||
{
|
||||
lock();
|
||||
writeValueS<Sint16>( VST_BPM );
|
||||
writeValueS<Uint16>( _bpm );
|
||||
writeValueS<bpm_t>( _bpm );
|
||||
unlock();
|
||||
}
|
||||
|
||||
@@ -465,14 +466,14 @@ Sint16 remoteVSTPlugin::processNextMessage( void )
|
||||
writeValueS<Sint16>( VST_SAMPLE_RATE );
|
||||
// handle is the same
|
||||
writeValueS<sample_rate_t>(
|
||||
mixer::inst()->sampleRate() );
|
||||
eng()->getMixer()->sampleRate() );
|
||||
break;
|
||||
|
||||
case VST_GET_BUFFER_SIZE:
|
||||
writeValueS<Sint16>( VST_BUFFER_SIZE );
|
||||
// handle is the same
|
||||
writeValueS<fpab_t>(
|
||||
mixer::inst()->framesPerAudioBuffer() );
|
||||
eng()->getMixer()->framesPerAudioBuffer() );
|
||||
break;
|
||||
|
||||
case VST_SHM_KEY_AND_SIZE:
|
||||
|
||||
@@ -44,13 +44,14 @@
|
||||
#include "mixer.h"
|
||||
#include "communication.h"
|
||||
#include "midi.h"
|
||||
#include "engine.h"
|
||||
|
||||
|
||||
|
||||
class remoteVSTPlugin
|
||||
class remoteVSTPlugin : public engineObject
|
||||
{
|
||||
public:
|
||||
remoteVSTPlugin( const QString & _plugin );
|
||||
remoteVSTPlugin( const QString & _plugin, engine * _engine );
|
||||
~remoteVSTPlugin();
|
||||
|
||||
void showEditor( void );
|
||||
@@ -80,7 +81,7 @@ public:
|
||||
sampleFrame * _out_buf );
|
||||
void FASTCALL enqueueMidiEvent( const midiEvent & _event,
|
||||
const Uint32 _frames_ahead );
|
||||
void FASTCALL setBPM( const Uint16 _bpm );
|
||||
void FASTCALL setTempo( const bpm_t _bpm );
|
||||
|
||||
const QMap<QString, QString> & parameterDump( void );
|
||||
void setParameterDump( const QMap<QString, QString> & _pdump );
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <qdir.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qcursor.h>
|
||||
#include <qwhatsthis.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -52,13 +53,13 @@
|
||||
#include "note_play_handle.h"
|
||||
#include "buffer_allocator.h"
|
||||
#include "mixer.h"
|
||||
#include "song_editor.h"
|
||||
#include "instrument_play_handle.h"
|
||||
#include "pixmap_button.h"
|
||||
#include "tooltip.h"
|
||||
#include "spc_bg_hndl_widget.h"
|
||||
#include "vestige.h"
|
||||
#include "text_float.h"
|
||||
#include "song_editor.h"
|
||||
#include "lvsl_client.h"
|
||||
|
||||
#include "embed.cpp"
|
||||
@@ -105,8 +106,8 @@ vestigeInstrument::vestigeInstrument( channelTrack * _channel_track ) :
|
||||
setErasePixmap( *s_artwork );
|
||||
#endif
|
||||
|
||||
connect( songEditor::inst(), SIGNAL( bpmChanged( int ) ),
|
||||
this, SLOT( changeBPM( int ) ) );
|
||||
connect( eng()->getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ),
|
||||
this, SLOT( changeTempo( bpm_t ) ) );
|
||||
|
||||
m_openPluginButton = new pixmapButton( this );
|
||||
m_openPluginButton->setCheckable( FALSE );
|
||||
@@ -155,7 +156,7 @@ vestigeInstrument::vestigeInstrument( channelTrack * _channel_track ) :
|
||||
|
||||
// now we need a play-handle which cares for calling play()
|
||||
instrumentPlayHandle * iph = new instrumentPlayHandle( this );
|
||||
mixer::inst()->addPlayHandle( iph );
|
||||
eng()->getMixer()->addPlayHandle( iph );
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +271,7 @@ void vestigeInstrument::setParameter( const QString & _param,
|
||||
PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ),
|
||||
0 );
|
||||
m_pluginMutex.lock();
|
||||
m_plugin = new remoteVSTPlugin( m_pluginDLL );
|
||||
m_plugin = new remoteVSTPlugin( m_pluginDLL, eng() );
|
||||
if( m_plugin->failed() )
|
||||
{
|
||||
m_pluginMutex.unlock();
|
||||
@@ -300,7 +301,7 @@ void vestigeInstrument::setParameter( const QString & _param,
|
||||
return;
|
||||
}*/
|
||||
m_plugin->showEditor();
|
||||
m_plugin->setBPM( songEditor::inst()->getBPM() );
|
||||
m_plugin->setTempo( eng()->getSongEditor()->getTempo() );
|
||||
if( set_ch_name == TRUE )
|
||||
{
|
||||
getChannelTrack()->setName( m_plugin->name() );
|
||||
@@ -332,7 +333,7 @@ void vestigeInstrument::play( void )
|
||||
return;
|
||||
}
|
||||
|
||||
const Uint32 frames = mixer::inst()->framesPerAudioBuffer();
|
||||
const fpab_t frames = eng()->getMixer()->framesPerAudioBuffer();
|
||||
sampleFrame * buf = bufferAllocator::alloc<sampleFrame>( frames );
|
||||
|
||||
m_plugin->process( NULL, buf );
|
||||
@@ -476,12 +477,12 @@ void vestigeInstrument::noteOffAll( void )
|
||||
|
||||
|
||||
|
||||
void vestigeInstrument::changeBPM( int _new_val )
|
||||
void vestigeInstrument::changeTempo( bpm_t _new_tempo )
|
||||
{
|
||||
m_pluginMutex.lock();
|
||||
if( m_plugin != NULL )
|
||||
{
|
||||
m_plugin->setBPM( _new_val );
|
||||
m_plugin->setTempo( _new_tempo );
|
||||
}
|
||||
m_pluginMutex.unlock();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ protected slots:
|
||||
void openPlugin( void );
|
||||
void toggleGUI( void );
|
||||
void noteOffAll( void );
|
||||
void changeBPM( int _new_val );
|
||||
void changeTempo( bpm_t _new_tempo );
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user