added undo/redo-system and other features

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@104 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-03-14 13:30:28 +00:00
parent a6d0f95bb4
commit fe9d017e02
63 changed files with 2402 additions and 2476 deletions

View File

@@ -2,5 +2,5 @@ if VST_SUPPORT
VESTIGE_SUBDIR=vestige
endif
SUBDIRS = audio_file_processor bit_invader organic plucked_string_synth triple_oscillator $(VESTIGE_SUBDIR)
SUBDIRS = audio_file_processor bit_invader midi_import organic plucked_string_synth triple_oscillator $(VESTIGE_SUBDIR)

View File

@@ -28,7 +28,6 @@
#ifdef QT4
#include <QPainter>
#include <QButtonGroup>
#include <QBitmap>
#include <Qt/QtXml>
#include <QFileInfo>
@@ -37,7 +36,6 @@
#else
#include <qpainter.h>
#include <qbuttongroup.h>
#include <qbitmap.h>
#include <qdom.h>
#include <qfileinfo.h>
@@ -104,7 +102,7 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
}
m_openAudioFileButton = new pixmapButton( this );
m_openAudioFileButton = new pixmapButton( this, eng() );
m_openAudioFileButton->setCheckable( FALSE );
m_openAudioFileButton->setCursor( QCursor( Qt::PointingHandCursor ) );
m_openAudioFileButton->move( 200, 90 );
@@ -130,7 +128,7 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
"are not reset, so please don't wonder if your sample "
"doesn't sound like the original one..." ) );
m_reverseButton = new pixmapButton( this );
m_reverseButton = new pixmapButton( this, eng() );
m_reverseButton->move( 160, 124 );
m_reverseButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"reverse_on" ) );
@@ -149,7 +147,7 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
"This is useful for cool effects, e.g. a reversed "
"crash." ) );
m_loopButton = new pixmapButton( this );
m_loopButton = new pixmapButton( this, eng() );
m_loopButton->move( 180, 124 );
m_loopButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"loop_on" ) );
@@ -226,16 +224,12 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
"AudioFileProcessor returns if a note is longer than "
"the sample between start- and end-point." ) );
m_viewLinesPB = new pixmapButton( this );
m_viewLinesPB = new pixmapButton( this, eng() );
m_viewLinesPB->move( 154, 158 );
m_viewLinesPB->setBgGraphic( getBackground( m_viewLinesPB ) );
if( m_drawMethod == sampleBuffer::LINE_CONNECT )
{
#ifdef QT4
m_viewLinesPB->setChecked( TRUE );
#else
m_viewLinesPB->setOn( TRUE );
#endif
}
connect( m_viewLinesPB, SIGNAL( toggled( bool ) ), this,
SLOT( lineDrawBtnToggled( bool ) ) );
@@ -249,16 +243,12 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
"sound itself. It just gives you another view to your "
"sample." ) );
m_viewDotsPB = new pixmapButton( this );
m_viewDotsPB = new pixmapButton( this, eng() );
m_viewDotsPB->move( 204, 158 );
m_viewDotsPB->setBgGraphic( getBackground( m_viewDotsPB ) );
if( m_drawMethod == sampleBuffer::DOTS )
{
#ifdef QT4
m_viewDotsPB->setChecked( TRUE );
#else
m_viewDotsPB->setOn( TRUE );
#endif
}
connect( m_viewDotsPB, SIGNAL( toggled( bool ) ), this,
SLOT( dotDrawBtnToggled( bool ) ) );
@@ -271,13 +261,12 @@ audioFileProcessor::audioFileProcessor( channelTrack * _channel_track ) :
"with dots. This doesn't change the sound itself. "
"It just gives you another view to your sample." ) );
QButtonGroup * view_group = new QButtonGroup( this );
automatableButtonGroup * view_group = new automatableButtonGroup( this,
eng() );
view_group->addButton( m_viewLinesPB );
view_group->addButton( m_viewDotsPB );
view_group->setExclusive( TRUE );
#ifndef QT4
view_group->hide();
#ifndef QT4
setBackgroundMode( Qt::NoBackground );
#endif
setAcceptDrops( TRUE );

View File

@@ -202,13 +202,13 @@ bitInvader::bitInvader( channelTrack * _channel_track ) :
this, SLOT ( sampleSizeChanged( float ) )
);
m_interpolationToggle = new ledCheckBox( "Interpolation", this );
m_interpolationToggle = new ledCheckBox( "Interpolation", this, eng() );
m_interpolationToggle->move( 55,80 );
connect( m_interpolationToggle, SIGNAL( toggled( bool ) ),
this, SLOT ( interpolationToggle( bool ) ) );
m_normalizeToggle = new ledCheckBox( "Normalize", this );
m_normalizeToggle = new ledCheckBox( "Normalize", this, eng() );
m_normalizeToggle->move( 55, 100 );
connect( m_normalizeToggle, SIGNAL( toggled( bool ) ),
@@ -233,58 +233,57 @@ bitInvader::bitInvader( channelTrack * _channel_track ) :
connect( m_graph, SIGNAL ( sampleChanged( void ) ),
this, SLOT ( sampleChanged( void ) ) );
sinWaveBtn = new pixmapButton( this );
sinWaveBtn = new pixmapButton( this, eng() );
sinWaveBtn->move( 188, 120 );
sinWaveBtn->setActiveGraphic( embed::getIconPixmap(
"sin_wave_inactive" ) );
"sin_wave_active" ) );
sinWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"sin_wave_inactive" ) );
sinWaveBtn->setChecked( TRUE );
toolTip::add( sinWaveBtn,
tr( "Click here if you want a sine-wave for "
"current oscillator." ) );
triangleWaveBtn = new pixmapButton( this );
triangleWaveBtn = new pixmapButton( this, eng() );
triangleWaveBtn->move( 188, 136 );
triangleWaveBtn->setActiveGraphic(
embed::getIconPixmap( "triangle_wave_inactive" ) );
embed::getIconPixmap( "triangle_wave_active" ) );
triangleWaveBtn->setInactiveGraphic(
embed::getIconPixmap( "triangle_wave_inactive" ) );
toolTip::add( triangleWaveBtn,
tr( "Click here if you want a triangle-wave "
"for current oscillator." ) );
sawWaveBtn = new pixmapButton( this );
sawWaveBtn = new pixmapButton( this, eng() );
sawWaveBtn->move( 188, 152 );
sawWaveBtn->setActiveGraphic( embed::getIconPixmap(
"saw_wave_inactive" ) );
"saw_wave_active" ) );
sawWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"saw_wave_inactive" ) );
toolTip::add( sawWaveBtn,
tr( "Click here if you want a saw-wave for "
"current oscillator." ) );
sqrWaveBtn = new pixmapButton( this );
sqrWaveBtn = new pixmapButton( this, eng() );
sqrWaveBtn->move( 188, 168 );
sqrWaveBtn->setActiveGraphic( embed::getIconPixmap(
"square_wave_inactive" ) );
"square_wave_active" ) );
sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap(
"square_wave_inactive" ) );
toolTip::add( sqrWaveBtn,
tr( "Click here if you want a square-wave for "
"current oscillator." ) );
whiteNoiseWaveBtn = new pixmapButton( this );
whiteNoiseWaveBtn = new pixmapButton( this, eng() );
whiteNoiseWaveBtn->move( 188, 184 );
whiteNoiseWaveBtn->setActiveGraphic(
embed::getIconPixmap( "white_noise_wave_inactive" ) );
embed::getIconPixmap( "white_noise_wave_active" ) );
whiteNoiseWaveBtn->setInactiveGraphic(
embed::getIconPixmap( "white_noise_wave_inactive" ) );
toolTip::add( whiteNoiseWaveBtn,
tr( "Click here if you want a white-noise for "
"current oscillator." ) );
usrWaveBtn = new pixmapButton( this );
usrWaveBtn = new pixmapButton( this, eng() );
usrWaveBtn->move( 188, 200 );
usrWaveBtn->setActiveGraphic( embed::getIconPixmap(
"usr_wave_active" ) );
@@ -310,7 +309,7 @@ bitInvader::bitInvader( channelTrack * _channel_track ) :
smoothBtn = new pixmapButton( this );
smoothBtn = new pixmapButton( this, eng() );
smoothBtn->move( 55, 225 );
smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"smooth" ) );

View File

@@ -0,0 +1,12 @@
AUTOMAKE_OPTIONS = foreign 1.4
INCLUDES = -I$(top_srcdir)/include -I.
AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="midiimport"
pkglib_LTLIBRARIES= libmidiimport.la
libmidiimport_la_SOURCES = midi_import.cpp midi_import.h

View File

@@ -0,0 +1,546 @@
/*
* midi_import.cpp - support for importing MIDI-files
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* This file partly contains code from Fluidsynth, Peter Hanappe
*
* 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 "midi_import.h"
#include "track_container.h"
#include "channel_track.h"
#include "pattern.h"
#ifdef QT4
#include <Qt/QtXml>
#include <QApplication>
#include <QProgressDialog>
#else
#include <qdom.h>
#include <qapplication.h>
#include <qprogressdialog.h>
#define pos at
#define setValue setProgress
#endif
#define makeID(_c0, _c1, _c2, _c3) \
( ( _c0 ) | ( ( _c1 ) << 8 ) | ( ( _c2 ) << 16 ) | ( ( _c3 ) << 24 ) )
extern "C"
{
plugin::descriptor midiimport_plugin_descriptor =
{
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ),
"MIDI Import",
QT_TRANSLATE_NOOP( "pluginBrowser",
"Filter for importing MIDI-files into LMMS" ),
"Tobias Doerffel <tobydox/at/users/dot/sf/dot/net>",
0x0100,
plugin::IMPORT_FILTER,
new QPixmap()
} ;
}
midiImport::midiImport( const QString & _file ) :
importFilter( _file, &midiimport_plugin_descriptor, NULL )
{
}
midiImport::~midiImport()
{
}
bool FASTCALL midiImport::tryImport( trackContainer * _tc )
{
if( openFile() == FALSE )
{
return( FALSE );
}
switch( readID() )
{
case makeID( 'M', 'T', 'h', 'd' ):
return( readSMF( _tc ) );
case makeID( 'R', 'I', 'F', 'F' ):
return( readRIFF( _tc ) );
default:
printf( "midiImport::importToTrackContainer(): not a "
"Standard MIDI file\n" );
return( FALSE );
}
}
bool FASTCALL midiImport::readSMF( trackContainer * _tc )
{
// the curren position is immediately after the "MThd" id
int header_len = readInt( 4 );
if( header_len < 6 )
{
invalid_format:
printf( "midiImport::readSMF(): invalid file format\n" );
return( FALSE );
}
int type = readInt( 2 );
if( type != 0 && type != 1 )
{
printf( "midiImport::readSMF(): type %d format is not "
"supported\n", type );
return( FALSE );
}
int num_tracks = readInt( 2 );
if( num_tracks < 1 || num_tracks > 1000 )
{
printf( "midiImport::readSMF(): invalid number of tracks (%d)\n",
num_tracks );
num_tracks = 0;
return( FALSE );
}
#ifdef LMMS_DEBUG
printf( "tracks: %d\n", num_tracks );
#endif
int time_division = readInt( 2 );
if( time_division < 0 )
{
goto invalid_format;
}
#ifdef LMMS_DEBUG
printf( "time-division: %d\n", time_division );
#endif
m_smpteTiming = !!( time_division & 0x8000 );
#ifdef QT4
QProgressDialog pd( trackContainer::tr( "Importing MIDI-file..." ),
trackContainer::tr( "Cancel" ), 0, num_tracks );
#else
QProgressDialog pd( trackContainer::tr( "Importing MIDI-file..." ),
trackContainer::tr( "Cancel" ), num_tracks,
0, 0, TRUE );
#endif
pd.setWindowTitle( trackContainer::tr( "Please wait..." ) );
pd.show();
// read tracks
for( int i = 0; i < num_tracks; ++i )
{
pd.setValue( i );
#ifdef QT4
qApp->processEvents( QEventLoop::AllEvents, 100 );
#else
qApp->processEvents( 100 );
#endif
if( pd.wasCanceled() )
{
return( FALSE );
}
int len;
// search for MTrk chunk
while( 1 )
{
Sint32 id = readID();
len = readInt( 4 );
if( file().atEnd() )
{
printf( "midiImport::readSMF(): unexpected end "
"of file\n" );
return( FALSE );
}
if( len < 0 || len >= 0x10000000 )
{
printf( "midiImport::readSMF(): invalid chunk "
"length %d\n", len );
return( FALSE );
}
if( id == makeID( 'M', 'T', 'r', 'k' ) )
{
break;
}
skip( len );
}
if( len <= 0 )
{
continue;
}
if( !readTrack( file().pos() + len ) )
{
return( FALSE );
}
if( i == 0 )
{
continue;
}
// now create new channel-track for reading track
channelTrack * ct = dynamic_cast<channelTrack *>(
track::create(
track::CHANNEL_TRACK,
_tc ) );
#ifdef LMMS_DEBUG
assert( ct != NULL );
#endif
// TODO: setup program, channel etc.
ct->loadInstrument( "tripleoscillator" );
ct->toggledChannelButton( FALSE );
// now create pattern to store notes in
pattern * p = dynamic_cast<pattern *>( ct->createTCO( 0 ) );
#ifdef LMMS_DEBUG
assert( p != NULL );
#endif
ct->addTCO( p );
// init keys
int keys[NOTES_PER_OCTAVE * OCTAVES][2];
for( int j = 0; j < NOTES_PER_OCTAVE * OCTAVES; ++j )
{
keys[j][0] = -1;
}
// now process every event
for( eventVector::const_iterator it = m_events.begin();
it != m_events.end(); ++it )
{
const int tick = it->first;
const midiEvent & ev = it->second;
switch( ev.m_type )
{
case NOTE_ON:
if( ev.key() >=
NOTES_PER_OCTAVE * OCTAVES )
{
continue;
}
if( ev.velocity() > 0 )
{
keys[ev.key()][0] = tick;
keys[ev.key()][1] =
ev.velocity();
break;
}
case NOTE_OFF:
if( ev.key() <
NOTES_PER_OCTAVE * OCTAVES &&
keys[ev.key()][0] >= 0 )
{
note n( midiTime( ( tick - keys[ev.key()][0] ) / 10 ),
midiTime( keys[ev.key()][0] / 10 ),
(tones)( ev.key() % NOTES_PER_OCTAVE ),
(octaves)( ev.key() / NOTES_PER_OCTAVE ),
keys[ev.key()][1] * 100 / 128 );
p->addNote( n );
keys[ev.key()][0] = -1;
}
break;
default:
/* printf( "Unhandled event: %#x\n",
ev.m_type );*/
break;
}
}
}
return( TRUE );
}
bool FASTCALL midiImport::readRIFF( trackContainer * _tc )
{
// skip file length
skip( 4 );
// check file type ("RMID" = RIFF MIDI)
if( readID() != makeID( 'R', 'M', 'I', 'D' ) )
{
invalid_format:
printf( "midiImport::readRIFF(): invalid file format\n" );
return( FALSE );
}
// search for "data" chunk
while( 1 )
{
int id = readID();
int len = read32LE();
if( file().atEnd() )
{
data_not_found:
printf( "midiImport::readRIFF(): data chunk not "
"found\n" );
return( FALSE );
}
if( id == makeID( 'd', 'a', 't', 'a' ) )
{
break;
}
if( len < 0 )
{
goto data_not_found;
}
skip( ( len + 1 ) & ~1 );
}
// the "data" chunk must contain data in SMF format
if( readID() != makeID( 'M', 'T', 'h', 'd' ) )
{
goto invalid_format;
}
return( readSMF( _tc ) );
}
bool FASTCALL midiImport::readTrack( int _track_end )
{
int tick = 0;
unsigned char last_cmd = 0;
// unsigned char port = 0;
m_events.clear();
// the current file position is after the track ID and length
while( (int) file().pos() < _track_end )
{
unsigned char cmd;
int len;
int delta_ticks = readVar();
if( delta_ticks < 0 )
{
break;
}
tick += delta_ticks;
int c = readByte();
if( c < 0 )
{
break;
}
if( c & 0x80 )
{
// have command
cmd = c;
if( cmd < 0xf0 )
{
last_cmd = cmd;
}
}
else
{
// running status
ungetChar( c );
cmd = last_cmd;
if( !cmd )
{
error();
return( FALSE );
}
}
switch( cmd & 0xF0 )
{
// channel msg with 2 parameter bytes
case NOTE_OFF:
case NOTE_ON:
case KEY_PRESSURE:
case CONTROL_CHANGE:
case PITCH_BEND:
{
int data1 = readByte() & 0x7F;
int data2 = readByte() & 0x7F;
m_events.push_back( qMakePair( tick,
midiEvent( static_cast<midiEventTypes>(
cmd & 0xF0 ),
cmd & 0x0F,
data1,
data2 ) ) );
break;
}
// channel msg with 1 parameter byte
case PROGRAM_CHANGE:
case CHANNEL_PRESSURE:
m_events.push_back( qMakePair( tick,
midiEvent( static_cast<midiEventTypes>(
cmd & 0xF0 ),
cmd & 0x0F,
readByte() & 0x7F ) ) );
break;
case MIDI_SYSEX:
switch( cmd )
{
case MIDI_SYSEX:
case MIDI_EOX:
{
len = readVar();
if( len < 0 )
{
error();
return( FALSE );
}
if( cmd == MIDI_SYSEX )
{
++len;
}
char * data = new char[len];
if( cmd == MIDI_SYSEX )
{
data[0] = MIDI_SYSEX;
}
for( ; c < len; ++c )
{
data[c] = readByte();
}
m_events.push_back(
qMakePair( tick,
midiEvent( MIDI_SYSEX, data, len ) ) );
break;
}
case MIDI_META_EVENT:
c = readByte();
len = readVar();
/* if( len < 0 )
{
error();
return( FALSE );
}*/
switch( c )
{
case 0x21: // port number
if( len < 1 )
{
error();
return( FALSE );
}
/* port = readByte() %
port_count;
skip( len - 1 );*/
skip( len );
break;
case 0x2F: // end of track
//track->end_tick = tick;
skip( _track_end -
file().pos() );
return( TRUE );
case 0x51: // tempo
if( len < 3 )
{
error();
return( FALSE );
}
if( m_smpteTiming )
{
// SMPTE timing
// doesnt change
skip( len );
}
else
{
/* event = new_event(track, 0);
event->type = SND_SEQ_EVENT_TEMPO;
event->port = port;
event->tick = tick;
event->data.tempo = read_byte() << 16;
event->data.tempo |= read_byte() << 8;
event->data.tempo |= read_byte();
skip( len -3 );*/
skip( len );
}
break;
default:// ignore all other
// meta events
skip( len );
break;
}
break;
default: // invalid Fx command
error();
return( FALSE );
}
break;
default: // cannot happen
error();
return( FALSE );
}
}
error();
return( FALSE );
}
void midiImport::error( void )
{
printf( "midiImport::readTrack(): invalid MIDI data (offset %#x)\n",
(unsigned int) file().pos() );
}
extern "C"
{
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( void * _data )
{
return( new midiImport( static_cast<const char *>( _data ) ) );
}
}
#undef pos
#undef setValue

141
plugins/midi_import/midi_import.h Executable file
View File

@@ -0,0 +1,141 @@
/*
* midi_import_filter.h - support for importing MIDI-files
*
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _MIDI_IMPORT_H
#define _MIDI_IMPORT_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "qt3support.h"
#ifdef QT4
#include <QString>
#include <QPair>
#include <QVector>
#else
#include <qstring.h>
#include <qpair.h>
#include <qvaluevector.h>
#endif
#include "midi.h"
#include "import_filter.h"
class midiImport : public importFilter
{
public:
midiImport( const QString & _file );
virtual ~midiImport();
private:
virtual bool tryImport( trackContainer * _tc );
bool FASTCALL readSMF( trackContainer * _tc );
bool FASTCALL readRIFF( trackContainer * _tc );
bool FASTCALL readTrack( int _track_end );
void error( void );
inline int readInt( int _bytes )
{
int c, value = 0;
do
{
c = readByte();
if( c == -1 )
{
return( -1 );
}
value = ( value << 8 ) | c;
} while( --_bytes );
return( value );
}
inline Sint32 read32LE( void )
{
int value = readByte();
value |= readByte() << 8;
value |= readByte() << 16;
value |= readByte() << 24;
return( value );
}
inline int readVar( void )
{
int c = readByte();
int value = c & 0x7f;
if( c & 0x80 )
{
c = readByte();
value = ( value << 7 ) | ( c & 0x7f );
if( c & 0x80 )
{
c = readByte();
value = ( value << 7 ) | ( c & 0x7f );
if( c & 0x80 )
{
c = readByte();
value = ( value << 7 ) | c;
if( c & 0x80 )
{
return -1;
}
}
}
}
return( !file().atEnd() ? value : -1 );
}
inline Sint32 readID( void )
{
return( read32LE() );
}
inline void skip( int _bytes )
{
while( _bytes > 0 )
{
readByte();
--_bytes;
}
}
typedef vvector<QPair<int, midiEvent> > eventVector;
eventVector m_events;
bool m_smpteTiming;
} ;
#endif

View File

@@ -28,13 +28,11 @@
#ifdef QT4
#include <Qt/QtXml>
#include <QButtonGroup>
#include <QBitmap>
#include <QPainter>
#else
#include <qbuttongroup.h>
#include <qbitmap.h>
#include <qpainter.h>
#include <qdom.h>
@@ -50,11 +48,13 @@
#include "channel_track.h"
#include "note_play_handle.h"
#include "knob.h"
#include "pixmap_button.h"
#include "buffer_allocator.h"
#include "debug.h"
#include "tooltip.h"
#include "sample_buffer.h"
#include "automatable_button.h"
#include "pixmap_button.h"
#undef SINGLE_SOURCE_COMPILE
#include "embed.cpp"
@@ -98,165 +98,116 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
setErasePixmap( PLUGIN_NAME::getIconPixmap( "artwork" ) );
#endif
m_fm1OscBtn = new pixmapButton( this );
m_fm1OscBtn->move( 80, 50 );
m_fm1OscBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
pixmapButton * fm_osc1_btn = new pixmapButton( this, eng() );
fm_osc1_btn->move( 80, 50 );
fm_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"fm_active" ) );
m_fm1OscBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
fm_osc1_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"fm_inactive" ) );
m_fm1OscBtn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap( "btn_mask" ).
fm_osc1_btn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap( "btn_mask" ).
createHeuristicMask() ) );
connect( m_fm1OscBtn, SIGNAL( toggled( bool ) ), this,
SLOT( fm1BtnToggled( bool ) ) );
toolTip::add( m_fm1OscBtn, tr( "use frequency modulation for "
toolTip::add( fm_osc1_btn, tr( "use frequency modulation for "
"modulating oscillator 2 with "
"oscillator 1" ) );
m_am1OscBtn = new pixmapButton( this );
m_am1OscBtn->move( 120, 50 );
m_am1OscBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
pixmapButton * am_osc1_btn = new pixmapButton( this, eng() );
am_osc1_btn->move( 120, 50 );
am_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"am_active" ) );
m_am1OscBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
am_osc1_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"am_inactive" ) );
m_am1OscBtn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap( "btn_mask" ).
am_osc1_btn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap( "btn_mask" ).
createHeuristicMask() ) );
connect( m_am1OscBtn, SIGNAL( toggled( bool ) ), this,
SLOT( am1BtnToggled( bool ) ) );
toolTip::add( m_am1OscBtn, tr( "use amplitude modulation for "
toolTip::add( am_osc1_btn, tr( "use amplitude modulation for "
"modulating oscillator 2 with "
"oscillator 1" ) );
m_mix1OscBtn = new pixmapButton( this );
m_mix1OscBtn->move( 160, 50 );
m_mix1OscBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
pixmapButton * mix_osc1_btn = new pixmapButton( this, eng() );
mix_osc1_btn->move( 160, 50 );
mix_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"mix_active" ) );
m_mix1OscBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
mix_osc1_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"mix_inactive" ) );
m_mix1OscBtn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap(
mix_osc1_btn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap(
"btn_mask" ).createHeuristicMask() ) );
connect( m_mix1OscBtn, SIGNAL( toggled( bool ) ), this,
SLOT( mix1BtnToggled( bool ) ) );
toolTip::add( m_mix1OscBtn, tr( "mix output of oscillator 1 & 2" ) );
toolTip::add( mix_osc1_btn, tr( "mix output of oscillator 1 & 2" ) );
m_sync1OscBtn = new pixmapButton( this );
m_sync1OscBtn->move( 200, 50 );
m_sync1OscBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
pixmapButton * sync_osc1_btn = new pixmapButton( this, eng() );
sync_osc1_btn->move( 200, 50 );
sync_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"sync_active" ) );
m_sync1OscBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
sync_osc1_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"sync_inactive" ) );
m_sync1OscBtn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap(
sync_osc1_btn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap(
"btn_mask" ).createHeuristicMask() ) );
connect( m_sync1OscBtn, SIGNAL( toggled( bool ) ), this, SLOT(
sync1BtnToggled( bool ) ) );
toolTip::add( m_sync1OscBtn, tr( "synchronize oscillator 1 with "
toolTip::add( sync_osc1_btn, tr( "synchronize oscillator 1 with "
"oscillator 2" ) );
if( m_modulationAlgo1 == oscillator::FREQ_MODULATION )
{
m_fm1OscBtn->setChecked( TRUE );
}
else if( m_modulationAlgo1 == oscillator::AMP_MODULATION )
{
m_am1OscBtn->setChecked( TRUE );
}
else if( m_modulationAlgo1 == oscillator::MIX )
{
m_mix1OscBtn->setChecked( TRUE );
}
else if( m_modulationAlgo1 == oscillator::SYNC )
{
m_sync1OscBtn->setChecked( TRUE );
}
m_mod1BtnGrp = new automatableButtonGroup( this, eng() );
m_mod1BtnGrp->addButton( fm_osc1_btn );
m_mod1BtnGrp->addButton( am_osc1_btn );
m_mod1BtnGrp->addButton( mix_osc1_btn );
m_mod1BtnGrp->addButton( sync_osc1_btn );
m_mod1BtnGrp->setInitValue( m_modulationAlgo1 );
QButtonGroup * modulation_algo_group1 = new QButtonGroup( this );
modulation_algo_group1->addButton( m_fm1OscBtn );
modulation_algo_group1->addButton( m_am1OscBtn );
modulation_algo_group1->addButton( m_mix1OscBtn );
modulation_algo_group1->addButton( m_sync1OscBtn );
modulation_algo_group1->setExclusive( TRUE );
#ifndef QT4
modulation_algo_group1->hide();
#endif
connect( m_mod1BtnGrp, SIGNAL( valueChanged( int ) ),
this, SLOT( mod1Ch( int ) ) );
m_fm2OscBtn = new pixmapButton( this );
m_fm2OscBtn->move( 80, 70 );
m_fm2OscBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
pixmapButton * fm_osc2_btn = new pixmapButton( this, eng() );
fm_osc2_btn->move( 80, 70 );
fm_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"fm_active" ) );
m_fm2OscBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
fm_osc2_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"fm_inactive" ) );
m_fm2OscBtn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap( "btn_mask" ).
fm_osc2_btn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap( "btn_mask" ).
createHeuristicMask() ) );
connect( m_fm2OscBtn, SIGNAL( toggled( bool ) ), this, SLOT(
fm2BtnToggled( bool ) ) );
toolTip::add( m_fm2OscBtn, tr( "use frequency modulation for "
toolTip::add( fm_osc2_btn, tr( "use frequency modulation for "
"modulating oscillator 3 with "
"oscillator 2" ) );
m_am2OscBtn = new pixmapButton( this );
m_am2OscBtn->move( 120, 70 );
m_am2OscBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
pixmapButton * am_osc2_btn = new pixmapButton( this, eng() );
am_osc2_btn->move( 120, 70 );
am_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"am_active" ) );
m_am2OscBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
am_osc2_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"am_inactive" ) );
m_am2OscBtn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap( "btn_mask" ).
am_osc2_btn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap( "btn_mask" ).
createHeuristicMask() ) );
connect( m_am2OscBtn, SIGNAL( toggled( bool ) ), this,
SLOT( am2BtnToggled( bool ) ) );
toolTip::add( m_am2OscBtn, tr( "use amplitude modulation for "
toolTip::add( am_osc2_btn, tr( "use amplitude modulation for "
"modulating oscillator 3 with "
"oscillator 2" ) );
m_mix2OscBtn = new pixmapButton( this );
m_mix2OscBtn->move( 160, 70 );
m_mix2OscBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
pixmapButton * mix_osc2_btn = new pixmapButton( this, eng() );
mix_osc2_btn->move( 160, 70 );
mix_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"mix_active" ) );
m_mix2OscBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
mix_osc2_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"mix_inactive" ) );
m_mix2OscBtn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap(
mix_osc2_btn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap(
"btn_mask" ).createHeuristicMask() ) );
connect( m_mix2OscBtn, SIGNAL( toggled( bool ) ), this,
SLOT( mix2BtnToggled( bool ) ) );
toolTip::add( m_mix2OscBtn, tr("mix output of oscillator 2 & 3" ) );
toolTip::add( mix_osc2_btn, tr("mix output of oscillator 2 & 3" ) );
m_sync2OscBtn = new pixmapButton( this );
m_sync2OscBtn->move( 200, 70 );
m_sync2OscBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
pixmapButton * sync_osc2_btn = new pixmapButton( this, eng() );
sync_osc2_btn->move( 200, 70 );
sync_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"sync_active" ) );
m_sync2OscBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
sync_osc2_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
"sync_inactive" ) );
m_sync2OscBtn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap(
sync_osc2_btn->setMask( QBitmap( PLUGIN_NAME::getIconPixmap(
"btn_mask" ).createHeuristicMask() ) );
connect( m_sync2OscBtn, SIGNAL( toggled( bool ) ), this,
SLOT( sync2BtnToggled( bool ) ) );
toolTip::add( m_sync2OscBtn, tr( "synchronize oscillator 2 with "
toolTip::add( sync_osc2_btn, tr( "synchronize oscillator 2 with "
"oscillator 3" ) );
if( m_modulationAlgo2 == oscillator::FREQ_MODULATION )
{
m_fm2OscBtn->setChecked( TRUE );
}
else if( m_modulationAlgo2 == oscillator::AMP_MODULATION )
{
m_am2OscBtn->setChecked( TRUE );
}
else if( m_modulationAlgo2 == oscillator::MIX )
{
m_mix2OscBtn->setChecked( TRUE );
}
else if( m_modulationAlgo2 == oscillator::SYNC )
{
m_sync2OscBtn->setChecked( TRUE );
}
m_mod2BtnGrp = new automatableButtonGroup( this, eng() );
m_mod2BtnGrp->addButton( fm_osc2_btn );
m_mod2BtnGrp->addButton( am_osc2_btn );
m_mod2BtnGrp->addButton( mix_osc2_btn );
m_mod2BtnGrp->addButton( sync_osc2_btn );
m_mod2BtnGrp->setInitValue( m_modulationAlgo2 );
QButtonGroup * modulation_algo_group2 = new QButtonGroup( this );
modulation_algo_group2->addButton( m_fm2OscBtn );
modulation_algo_group2->addButton( m_am2OscBtn );
modulation_algo_group2->addButton( m_mix2OscBtn );
modulation_algo_group2->addButton( m_sync2OscBtn );
modulation_algo_group2->setExclusive( TRUE );
#ifndef QT4
modulation_algo_group2->hide();
#endif
connect( m_mod2BtnGrp, SIGNAL( valueChanged( int ) ),
this, SLOT( mod2Ch( int ) ) );
for( int i = 0; i < NUM_OF_OSCILLATORS; ++i )
@@ -419,78 +370,78 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
"channel. This is very good for creating wide "
"stereo-sounds." ).arg( i+1 ) );
m_osc[i].sinWaveBtn = new pixmapButton( this );
m_osc[i].sinWaveBtn->move( 188, 105 + i * 50 );
m_osc[i].sinWaveBtn->setActiveGraphic( embed::getIconPixmap(
pixmapButton * sin_wave_btn = new pixmapButton( this, eng() );
sin_wave_btn->move( 188, 105 + i * 50 );
sin_wave_btn->setActiveGraphic( embed::getIconPixmap(
"sin_wave_active" ) );
m_osc[i].sinWaveBtn->setInactiveGraphic( embed::getIconPixmap(
sin_wave_btn->setInactiveGraphic( embed::getIconPixmap(
"sin_wave_inactive" ) );
m_osc[i].sinWaveBtn->setChecked( TRUE );
toolTip::add( m_osc[i].sinWaveBtn,
sin_wave_btn->setChecked( TRUE );
toolTip::add( sin_wave_btn,
tr( "Click here if you want a sine-wave for "
"current oscillator." ) );
m_osc[i].triangleWaveBtn = new pixmapButton( this );
m_osc[i].triangleWaveBtn->move( 203, 105 + i * 50 );
m_osc[i].triangleWaveBtn->setActiveGraphic(
pixmapButton * triangle_wave_btn = new pixmapButton( this, eng() );
triangle_wave_btn->move( 203, 105 + i * 50 );
triangle_wave_btn->setActiveGraphic(
embed::getIconPixmap( "triangle_wave_active" ) );
m_osc[i].triangleWaveBtn->setInactiveGraphic(
triangle_wave_btn->setInactiveGraphic(
embed::getIconPixmap( "triangle_wave_inactive" ) );
toolTip::add( m_osc[i].triangleWaveBtn,
toolTip::add( triangle_wave_btn,
tr( "Click here if you want a triangle-wave "
"for current oscillator." ) );
m_osc[i].sawWaveBtn = new pixmapButton( this );
m_osc[i].sawWaveBtn->move( 218, 105 + i * 50 );
m_osc[i].sawWaveBtn->setActiveGraphic( embed::getIconPixmap(
pixmapButton * saw_wave_btn = new pixmapButton( this, eng() );
saw_wave_btn->move( 218, 105 + i * 50 );
saw_wave_btn->setActiveGraphic( embed::getIconPixmap(
"saw_wave_active" ) );
m_osc[i].sawWaveBtn->setInactiveGraphic( embed::getIconPixmap(
saw_wave_btn->setInactiveGraphic( embed::getIconPixmap(
"saw_wave_inactive" ) );
toolTip::add( m_osc[i].sawWaveBtn,
toolTip::add( saw_wave_btn,
tr( "Click here if you want a saw-wave for "
"current oscillator." ) );
m_osc[i].sqrWaveBtn = new pixmapButton( this );
m_osc[i].sqrWaveBtn->move( 233, 105 + i * 50 );
m_osc[i].sqrWaveBtn->setActiveGraphic( embed::getIconPixmap(
pixmapButton * sqr_wave_btn = new pixmapButton( this, eng() );
sqr_wave_btn->move( 233, 105 + i * 50 );
sqr_wave_btn->setActiveGraphic( embed::getIconPixmap(
"square_wave_active" ) );
m_osc[i].sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap(
sqr_wave_btn->setInactiveGraphic( embed::getIconPixmap(
"square_wave_inactive" ) );
toolTip::add( m_osc[i].sqrWaveBtn,
toolTip::add( sqr_wave_btn,
tr( "Click here if you want a square-wave for "
"current oscillator." ) );
m_osc[i].moogSawWaveBtn = new pixmapButton( this );
m_osc[i].moogSawWaveBtn->move( 188, 120+i*50 );
m_osc[i].moogSawWaveBtn->setActiveGraphic(
pixmapButton * moog_saw_wave_btn = new pixmapButton( this, eng() );
moog_saw_wave_btn->move( 188, 120+i*50 );
moog_saw_wave_btn->setActiveGraphic(
embed::getIconPixmap( "moog_saw_wave_active" ) );
m_osc[i].moogSawWaveBtn->setInactiveGraphic(
moog_saw_wave_btn->setInactiveGraphic(
embed::getIconPixmap( "moog_saw_wave_inactive" ) );
toolTip::add( m_osc[i].moogSawWaveBtn,
toolTip::add( moog_saw_wave_btn,
tr( "Click here if you want a moog-saw-wave "
"for current oscillator." ) );
m_osc[i].expWaveBtn = new pixmapButton( this );
m_osc[i].expWaveBtn->move( 203, 120+i*50 );
m_osc[i].expWaveBtn->setActiveGraphic( embed::getIconPixmap(
pixmapButton * exp_wave_btn = new pixmapButton( this, eng() );
exp_wave_btn->move( 203, 120+i*50 );
exp_wave_btn->setActiveGraphic( embed::getIconPixmap(
"exp_wave_active" ) );
m_osc[i].expWaveBtn->setInactiveGraphic( embed::getIconPixmap(
exp_wave_btn->setInactiveGraphic( embed::getIconPixmap(
"exp_wave_inactive" ) );
toolTip::add( m_osc[i].expWaveBtn,
toolTip::add( exp_wave_btn,
tr( "Click here if you want an exponential "
"wave for current oscillator." ) );
m_osc[i].whiteNoiseWaveBtn = new pixmapButton( this );
m_osc[i].whiteNoiseWaveBtn->move( 218, 120+i*50 );
m_osc[i].whiteNoiseWaveBtn->setActiveGraphic(
pixmapButton * white_noise_btn = new pixmapButton( this, eng() );
white_noise_btn->move( 218, 120+i*50 );
white_noise_btn->setActiveGraphic(
embed::getIconPixmap( "white_noise_wave_active" ) );
m_osc[i].whiteNoiseWaveBtn->setInactiveGraphic(
white_noise_btn->setInactiveGraphic(
embed::getIconPixmap( "white_noise_wave_inactive" ) );
toolTip::add( m_osc[i].whiteNoiseWaveBtn,
toolTip::add( white_noise_btn,
tr( "Click here if you want a white-noise for "
"current oscillator." ) );
m_osc[i].usrWaveBtn = new pixmapButton( this );
m_osc[i].usrWaveBtn = new pixmapButton( this, eng() );
m_osc[i].usrWaveBtn->move( 233, 120+i*50 );
m_osc[i].usrWaveBtn->setActiveGraphic( embed::getIconPixmap(
"usr_wave_active" ) );
@@ -500,109 +451,42 @@ tripleOscillator::tripleOscillator( channelTrack * _channel_track ) :
tr( "Click here if you want a user-defined "
"wave-shape for current oscillator." ) );
QButtonGroup * wave_btn_group = new QButtonGroup( this );
wave_btn_group->addButton( m_osc[i].sinWaveBtn );
wave_btn_group->addButton( m_osc[i].triangleWaveBtn );
wave_btn_group->addButton( m_osc[i].sawWaveBtn );
wave_btn_group->addButton( m_osc[i].sqrWaveBtn );
wave_btn_group->addButton( m_osc[i].moogSawWaveBtn );
wave_btn_group->addButton( m_osc[i].expWaveBtn );
wave_btn_group->addButton( m_osc[i].whiteNoiseWaveBtn );
wave_btn_group->addButton( m_osc[i].usrWaveBtn );
wave_btn_group->setExclusive( TRUE );
#ifndef QT4
wave_btn_group->hide();
#endif
m_osc[i].waveBtnGrp = new automatableButtonGroup( this, eng() );
m_osc[i].waveBtnGrp->addButton( sin_wave_btn );
m_osc[i].waveBtnGrp->addButton( triangle_wave_btn );
m_osc[i].waveBtnGrp->addButton( saw_wave_btn );
m_osc[i].waveBtnGrp->addButton( sqr_wave_btn );
m_osc[i].waveBtnGrp->addButton( moog_saw_wave_btn );
m_osc[i].waveBtnGrp->addButton( exp_wave_btn );
m_osc[i].waveBtnGrp->addButton( white_noise_btn );
m_osc[i].waveBtnGrp->addButton( m_osc[i].usrWaveBtn );
if( i == 0 )
{ // Osc 1
connect( m_osc[i].sinWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc01SinWaveCh( bool ) ) );
connect( m_osc[i].triangleWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc01TriangleWaveCh( bool ) ) );
connect( m_osc[i].sawWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc01SawWaveCh( bool ) ) );
connect( m_osc[i].sqrWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc01SquareWaveCh( bool ) ) );
connect( m_osc[i].moogSawWaveBtn,
SIGNAL(toggled( bool ) ), this,
SLOT( osc01MoogSawWaveCh( bool ) ) );
connect( m_osc[i].expWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc01ExpWaveCh( bool ) ) );
connect( m_osc[i].whiteNoiseWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc01WhiteNoiseCh( bool ) ) );
connect( m_osc[i].usrWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc01UserDefWaveCh( bool ) ) );
{
connect( m_osc[i].waveBtnGrp,
SIGNAL( valueChanged( int ) ),
this, SLOT( osc0WaveCh( int ) ) );
connect( m_osc[i].usrWaveBtn,
SIGNAL( doubleClicked() ), this,
SLOT( osc01UserDefWaveDblClick() ) );
SLOT( osc0UserDefWaveDblClick() ) );
}
else if( i == 1 )
{ // Osc 2
connect( m_osc[i].sinWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc02SinWaveCh( bool ) ) );
connect( m_osc[i].triangleWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc02TriangleWaveCh( bool ) ) );
connect( m_osc[i].sawWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc02SawWaveCh( bool ) ) );
connect( m_osc[i].sqrWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc02SquareWaveCh( bool ) ) );
connect( m_osc[i].moogSawWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc02MoogSawWaveCh( bool ) ) );
connect( m_osc[i].expWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc02ExpWaveCh( bool ) ) );
connect( m_osc[i].whiteNoiseWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc02WhiteNoiseCh( bool ) ) );
connect( m_osc[i].usrWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc02UserDefWaveCh( bool ) ) );
{
connect( m_osc[i].waveBtnGrp,
SIGNAL( valueChanged( int ) ),
this, SLOT( osc1WaveCh( int ) ) );
connect( m_osc[i].usrWaveBtn,
SIGNAL( doubleClicked() ), this,
SLOT( osc02UserDefWaveDblClick() ) );
SLOT( osc1UserDefWaveDblClick() ) );
}
else if( i == 2 )
{ // Osc 3
connect( m_osc[i].sinWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc03SinWaveCh( bool ) ) );
connect( m_osc[i].triangleWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc03TriangleWaveCh( bool ) ) );
connect( m_osc[i].sawWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc03SawWaveCh( bool ) ) );
connect( m_osc[i].sqrWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc03SquareWaveCh( bool ) ) );
connect( m_osc[i].moogSawWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc03MoogSawWaveCh( bool ) ) );
connect( m_osc[i].expWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc03ExpWaveCh( bool ) ) );
connect( m_osc[i].whiteNoiseWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc03WhiteNoiseCh( bool ) ) );
connect( m_osc[i].usrWaveBtn,
SIGNAL( toggled( bool ) ), this,
SLOT( osc03UserDefWaveCh( bool ) ) );
{
connect( m_osc[i].waveBtnGrp,
SIGNAL( valueChanged( int ) ),
this, SLOT( osc2WaveCh( int ) ) );
connect( m_osc[i].usrWaveBtn,
SIGNAL( doubleClicked() ), this,
SLOT( osc03UserDefWaveDblClick() ) );
SLOT( osc2UserDefWaveDblClick() ) );
}
}
}
@@ -664,8 +548,8 @@ void tripleOscillator::loadSettings( const QDomElement & _this )
m_modulationAlgo2 = static_cast<oscillator::modulationAlgos>(
_this.attribute( "modalgo2" ).toInt() );
getModulationButton( m_modulationAlgo1, 1 )->setChecked( TRUE );
getModulationButton( m_modulationAlgo2, 2 )->setChecked( TRUE );
m_mod1BtnGrp->setInitValue( m_modulationAlgo1 );
m_mod2BtnGrp->setInitValue( m_modulationAlgo2 );
for( int i = 0; i < NUM_OF_OSCILLATORS; ++i )
{
@@ -686,36 +570,8 @@ void tripleOscillator::loadSettings( const QDomElement & _this )
"stphdetun" + is ).toFloat() );
m_osc[i].m_sampleBuffer->setAudioFile( _this.attribute(
"userwavefile" + is ) );
switch( _this.attribute( "wavetype" + is ).toInt() )
{
case oscillator::TRIANGLE_WAVE:
m_osc[i].triangleWaveBtn->setChecked( TRUE );
break;
case oscillator::SAW_WAVE:
m_osc[i].sawWaveBtn->setChecked( TRUE );
break;
case oscillator::SQUARE_WAVE:
m_osc[i].sqrWaveBtn->setChecked( TRUE );
break;
case oscillator::MOOG_SAW_WAVE:
m_osc[i].moogSawWaveBtn->setChecked( TRUE );
break;
case oscillator::EXP_WAVE:
m_osc[i].expWaveBtn->setChecked( TRUE );
break;
case oscillator::WHITE_NOISE_WAVE:
m_osc[i].whiteNoiseWaveBtn->setChecked( TRUE );
break;
case oscillator::USER_DEF_WAVE:
toolTip::add( m_osc[i].usrWaveBtn,
m_osc[i].m_sampleBuffer->audioFile() );
m_osc[i].usrWaveBtn->setChecked( TRUE );
break;
case oscillator::SIN_WAVE:
default:
m_osc[i].sinWaveBtn->setChecked( TRUE );
break;
}
m_osc[i].waveBtnGrp->setValue( _this.attribute( "wavetype" +
is ).toInt() );
}
}
@@ -863,26 +719,85 @@ void tripleOscillator::deleteNotePluginData( notePlayHandle * _n )
// now follows all the stupid UI-Code...
void tripleOscillator::setModulationAlgo(
oscillator::modulationAlgos _new_modulation_algo, int _n )
void tripleOscillator::osc0WaveCh( int _n )
{
if( _n == 1 )
{
m_modulationAlgo1 = _new_modulation_algo;
}
else
{
m_modulationAlgo2 = _new_modulation_algo;
}
eng()->getSongEditor()->setModified();
m_osc[0].waveShape = static_cast<oscillator::waveShapes>( _n );
}
void tripleOscillator::osc1WaveCh( int _n )
{
m_osc[1].waveShape = static_cast<oscillator::waveShapes>( _n );
}
void tripleOscillator::osc2WaveCh( int _n )
{
m_osc[2].waveShape = static_cast<oscillator::waveShapes>( _n );
}
void tripleOscillator::mod1Ch( int _n )
{
m_modulationAlgo1 = static_cast<oscillator::modulationAlgos>( _n );
}
void tripleOscillator::mod2Ch( int _n )
{
m_modulationAlgo2 = static_cast<oscillator::modulationAlgos>( _n );
}
void tripleOscillator::osc0UserDefWaveDblClick( void )
{
QString af = m_osc[0].m_sampleBuffer->openAudioFile();
if( af != "" )
{
m_osc[0].m_sampleBuffer->setAudioFile( af );
toolTip::add( m_osc[0].usrWaveBtn,
m_osc[0].m_sampleBuffer->audioFile() );
}
}
void tripleOscillator::osc1UserDefWaveDblClick( void )
{
QString af = m_osc[1].m_sampleBuffer->openAudioFile();
if( af != "" )
{
m_osc[1].m_sampleBuffer->setAudioFile( af );
toolTip::add( m_osc[1].usrWaveBtn,
m_osc[1].m_sampleBuffer->audioFile() );
}
}
void tripleOscillator::osc2UserDefWaveDblClick( void )
{
QString af = m_osc[2].m_sampleBuffer->openAudioFile();
if( af != "" )
{
m_osc[2].m_sampleBuffer->setAudioFile( af );
toolTip::add( m_osc[2].usrWaveBtn,
m_osc[2].m_sampleBuffer->audioFile() );
}
}
oscillator::modulationAlgos tripleOscillator::getModulationAlgo( int _n )
{
if( _n == 1 )
@@ -898,337 +813,6 @@ oscillator::modulationAlgos tripleOscillator::getModulationAlgo( int _n )
void tripleOscillator::doSinWaveBtn( oscillatorData * _osc )
{
_osc->waveShape = oscillator::SIN_WAVE;
eng()->getSongEditor()->setModified();
}
void tripleOscillator::doTriangleWaveBtn( oscillatorData * _osc )
{
_osc->waveShape = oscillator::TRIANGLE_WAVE;
eng()->getSongEditor()->setModified();
}
void tripleOscillator::doSawWaveBtn( oscillatorData * _osc )
{
_osc->waveShape = oscillator::SAW_WAVE;
eng()->getSongEditor()->setModified();
}
void tripleOscillator::doSqrWaveBtn( oscillatorData * _osc )
{
_osc->waveShape = oscillator::SQUARE_WAVE;
eng()->getSongEditor()->setModified();
}
void tripleOscillator::doMoogSawWaveBtn( oscillatorData * _osc )
{
_osc->waveShape = oscillator::MOOG_SAW_WAVE;
eng()->getSongEditor()->setModified();
}
void tripleOscillator::doExpWaveBtn( oscillatorData * _osc )
{
_osc->waveShape = oscillator::EXP_WAVE;
eng()->getSongEditor()->setModified();
}
void tripleOscillator::doWhiteNoiseWaveBtn( oscillatorData * _osc )
{
_osc->waveShape = oscillator::WHITE_NOISE_WAVE;
eng()->getSongEditor()->setModified();
}
void tripleOscillator::doUsrWaveBtn( oscillatorData * _osc )
{
_osc->waveShape = oscillator::USER_DEF_WAVE;
eng()->getSongEditor()->setModified();
}
// Slots for Osc 1
void tripleOscillator::osc01SinWaveCh( bool _on )
{
if( _on ) doSinWaveBtn( &m_osc[0] );
}
void tripleOscillator::osc01TriangleWaveCh( bool _on )
{
if( _on ) doTriangleWaveBtn( &m_osc[0] );
}
void tripleOscillator::osc01SawWaveCh( bool _on )
{
if( _on ) doSawWaveBtn( &m_osc[0] );
}
void tripleOscillator::osc01SquareWaveCh( bool _on )
{
if( _on ) doSqrWaveBtn( &m_osc[0] );
}
void tripleOscillator::osc01MoogSawWaveCh( bool _on )
{
if( _on ) doMoogSawWaveBtn( &m_osc[0] );
}
void tripleOscillator::osc01ExpWaveCh( bool _on )
{
if( _on ) doExpWaveBtn( &m_osc[0] );
}
void tripleOscillator::osc01WhiteNoiseCh( bool _on )
{
if( _on ) doWhiteNoiseWaveBtn( &m_osc[0] );
}
void tripleOscillator::osc01UserDefWaveCh( bool _on )
{
if( _on ) doUsrWaveBtn( &m_osc[0] );
}
void tripleOscillator::osc01UserDefWaveDblClick( void )
{
QString af = m_osc[0].m_sampleBuffer->openAudioFile();
if( 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() );
}
}
// Slots for Osc 2
void tripleOscillator::osc02SinWaveCh( bool _on )
{
if( _on ) doSinWaveBtn( &m_osc[1] );
}
void tripleOscillator::osc02TriangleWaveCh( bool _on )
{
if( _on ) doTriangleWaveBtn( &m_osc[1] );
}
void tripleOscillator::osc02SawWaveCh( bool _on )
{
if( _on ) doSawWaveBtn( &m_osc[1] );
}
void tripleOscillator::osc02SquareWaveCh( bool _on )
{
if( _on ) doSqrWaveBtn( &m_osc[1] );
}
void tripleOscillator::osc02MoogSawWaveCh( bool _on )
{
if( _on ) doMoogSawWaveBtn( &m_osc[1] );
}
void tripleOscillator::osc02ExpWaveCh( bool _on )
{
if( _on ) doExpWaveBtn( &m_osc[1] );
}
void tripleOscillator::osc02WhiteNoiseCh( bool _on )
{
if( _on ) doWhiteNoiseWaveBtn( &m_osc[1] );
}
void tripleOscillator::osc02UserDefWaveCh( bool _on )
{
if( _on ) doUsrWaveBtn( &m_osc[1] );
}
void tripleOscillator::osc02UserDefWaveDblClick( void )
{
QString af = m_osc[1].m_sampleBuffer->openAudioFile();
if( 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() );
}
}
// Slots for Osc 3
void tripleOscillator::osc03SinWaveCh( bool _on )
{
if( _on ) doSinWaveBtn( &m_osc[2] );
}
void tripleOscillator::osc03TriangleWaveCh( bool _on )
{
if( _on ) doTriangleWaveBtn( &m_osc[2] );
}
void tripleOscillator::osc03SawWaveCh( bool _on )
{
if( _on ) doSawWaveBtn( &m_osc[2] );
}
void tripleOscillator::osc03SquareWaveCh( bool _on )
{
if( _on ) doSqrWaveBtn( &m_osc[2] );
}
void tripleOscillator::osc03MoogSawWaveCh( bool _on )
{
if( _on ) doMoogSawWaveBtn( &m_osc[2] );
}
void tripleOscillator::osc03ExpWaveCh( bool _on )
{
if( _on ) doExpWaveBtn( &m_osc[2] );
}
void tripleOscillator::osc03WhiteNoiseCh( bool _on )
{
if( _on ) doWhiteNoiseWaveBtn( &m_osc[2] );
}
void tripleOscillator::osc03UserDefWaveCh( bool _on )
{
if( _on ) doUsrWaveBtn( &m_osc[2] );
}
void tripleOscillator::osc03UserDefWaveDblClick( void )
{
QString af = m_osc[2].m_sampleBuffer->openAudioFile();
if( 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() );
}
}
void tripleOscillator::fm1BtnToggled( bool _on )
{
if( _on ) setModulationAlgo( oscillator::FREQ_MODULATION, 1 );
}
void tripleOscillator::am1BtnToggled( bool _on )
{
if( _on ) setModulationAlgo( oscillator::AMP_MODULATION, 1 );
}
void tripleOscillator::mix1BtnToggled( bool _on )
{
if( _on ) setModulationAlgo( oscillator::MIX, 1 );
}
void tripleOscillator::sync1BtnToggled( bool _on )
{
if( _on ) setModulationAlgo( oscillator::SYNC, 1 );
}
void tripleOscillator::fm2BtnToggled( bool _on )
{
if( _on ) setModulationAlgo( oscillator::FREQ_MODULATION, 2 );
}
void tripleOscillator::am2BtnToggled( bool _on )
{
if( _on ) setModulationAlgo( oscillator::AMP_MODULATION, 2 );
}
void tripleOscillator::mix2BtnToggled( bool _on )
{
if( _on ) setModulationAlgo( oscillator::MIX, 2 );
}
void tripleOscillator::sync2BtnToggled( bool _on )
{
if( _on ) setModulationAlgo( oscillator::SYNC, 2 );
}
pixmapButton * tripleOscillator::getModulationButton(
oscillator::modulationAlgos _modulation_algo, int _n )
{
if( _n == 1 )
{
switch( _modulation_algo )
{
case oscillator::FREQ_MODULATION: return( m_fm1OscBtn );
case oscillator::AMP_MODULATION: return( m_am1OscBtn );
case oscillator::MIX: return( m_mix1OscBtn );
case oscillator::SYNC: return( m_sync1OscBtn );
}
}
else
{
switch( _modulation_algo )
{
case oscillator::FREQ_MODULATION: return( m_fm2OscBtn );
case oscillator::AMP_MODULATION: return( m_am2OscBtn );
case oscillator::MIX: return( m_mix2OscBtn );
case oscillator::SYNC: return( m_sync2OscBtn );
}
}
#ifdef LMMS_DEBUG
// there's something really not ok, if this case occurs, so let's exit
assert( 1 != 1 );
#endif
return( NULL );
}
extern "C"
{

View File

@@ -31,9 +31,10 @@
#include "oscillator.h"
class automatableButtonGroup;
class knob;
class pixmapButton;
class notePlayHandle;
class pixmapButton;
class sampleBuffer;
@@ -44,7 +45,7 @@ class tripleOscillator : public instrument
{
Q_OBJECT
public:
tripleOscillator( channelTrack * _channel ) FASTCALL;
tripleOscillator( channelTrack * _channel );
virtual ~tripleOscillator();
virtual void FASTCALL playNote( notePlayHandle * _n );
@@ -59,49 +60,15 @@ public:
protected slots:
// Slots for Osc 1
void osc01SinWaveCh( bool _on );
void osc01TriangleWaveCh( bool _on );
void osc01SawWaveCh( bool _on );
void osc01SquareWaveCh( bool _on );
void osc01MoogSawWaveCh( bool _on );
void osc01ExpWaveCh( bool _on );
void osc01WhiteNoiseCh( bool _on );
void osc01UserDefWaveCh( bool _on );
void osc01UserDefWaveDblClick( void );
void osc0WaveCh( int _n );
void osc1WaveCh( int _n );
void osc2WaveCh( int _n );
void osc0UserDefWaveDblClick( void );
void osc1UserDefWaveDblClick( void );
void osc2UserDefWaveDblClick( void );
// Slots for Osc 2
void osc02SinWaveCh( bool _on );
void osc02TriangleWaveCh( bool _on );
void osc02SawWaveCh( bool _on );
void osc02SquareWaveCh( bool _on );
void osc02MoogSawWaveCh( bool _on );
void osc02ExpWaveCh( bool _on );
void osc02WhiteNoiseCh( bool _on );
void osc02UserDefWaveCh( bool _on );
void osc02UserDefWaveDblClick( void );
// Slots for Osc 3
void osc03SinWaveCh( bool _on );
void osc03TriangleWaveCh( bool _on );
void osc03SawWaveCh( bool _on );
void osc03SquareWaveCh( bool _on );
void osc03MoogSawWaveCh( bool _on );
void osc03ExpWaveCh( bool _on );
void osc03WhiteNoiseCh( bool _on );
void osc03UserDefWaveCh( bool _on );
void osc03UserDefWaveDblClick( void );
// modulation-type-button slots
void fm1BtnToggled( bool _on );
void am1BtnToggled( bool _on );
void mix1BtnToggled( bool _on );
void sync1BtnToggled( bool _on );
void fm2BtnToggled( bool _on );
void am2BtnToggled( bool _on );
void mix2BtnToggled( bool _on );
void sync2BtnToggled( bool _on );
void mod1Ch( int _n );
void mod2Ch( int _n );
private:
@@ -117,13 +84,7 @@ private:
knob * fineRKnob;
knob * phaseOffsetKnob;
knob * stereoPhaseDetuningKnob;
pixmapButton * sinWaveBtn;
pixmapButton * triangleWaveBtn;
pixmapButton * sawWaveBtn;
pixmapButton * sqrWaveBtn;
pixmapButton * moogSawWaveBtn;
pixmapButton * expWaveBtn;
pixmapButton * whiteNoiseWaveBtn;
automatableButtonGroup * waveBtnGrp;
pixmapButton * usrWaveBtn;
sampleBuffer * m_sampleBuffer;
} m_osc[NUM_OF_OSCILLATORS];
@@ -135,33 +96,18 @@ private:
} ;
void FASTCALL doSinWaveBtn( oscillatorData * _osc );
void FASTCALL doTriangleWaveBtn( oscillatorData * _osc );
void FASTCALL doSawWaveBtn( oscillatorData * _osc );
void FASTCALL doSqrWaveBtn( oscillatorData * _osc );
void FASTCALL doMoogSawWaveBtn( oscillatorData * _osc );
void FASTCALL doExpWaveBtn( oscillatorData * _osc );
void FASTCALL doWhiteNoiseWaveBtn( oscillatorData * _osc );
void FASTCALL doUsrWaveBtn( oscillatorData * _osc );
pixmapButton * FASTCALL getModulationButton(
oscillator::modulationAlgos _modulation_algo, int _n );
void FASTCALL setModulationAlgo(
oscillator::modulationAlgos _new_modulation_algo, int _n );
/* pixmapButton * FASTCALL getModulationButton(
oscillator::modulationAlgos _modulation_algo, int _n );*/
/* void FASTCALL setModulationAlgo(
oscillator::modulationAlgos _new_modulation_algo, int _n );*/
oscillator::modulationAlgos FASTCALL getModulationAlgo( int _n );
pixmapButton * m_fm1OscBtn;
pixmapButton * m_am1OscBtn;
pixmapButton * m_mix1OscBtn;
pixmapButton * m_sync1OscBtn;
pixmapButton * m_fm2OscBtn;
pixmapButton * m_am2OscBtn;
pixmapButton * m_mix2OscBtn;
pixmapButton * m_sync2OscBtn;
oscillator::modulationAlgos m_modulationAlgo1;
oscillator::modulationAlgos m_modulationAlgo2;
automatableButtonGroup * m_mod1BtnGrp;
automatableButtonGroup * m_mod2BtnGrp;
} ;

View File

@@ -110,7 +110,7 @@ vestigeInstrument::vestigeInstrument( channelTrack * _channel_track ) :
connect( eng()->getSongEditor(), SIGNAL( tempoChanged( bpm_t ) ),
this, SLOT( changeTempo( bpm_t ) ) );
m_openPluginButton = new pixmapButton( this );
m_openPluginButton = new pixmapButton( this, eng() );
m_openPluginButton->setCheckable( FALSE );
m_openPluginButton->setCursor( Qt::PointingHandCursor );
m_openPluginButton->move( 200, 70 );