GUI Completed.

This commit is contained in:
Wong Cho Ching
2014-01-25 21:42:22 +08:00
parent 5ffc36ea68
commit 5fb9afc15a
7 changed files with 811 additions and 357 deletions

View File

@@ -472,6 +472,14 @@ sf2InstrumentView knob {
qproperty-lineWidth: 2;
}
sfxrInstrumentView knob {
color: #b06319;
qproperty-outerColor: rgb(194, 177, 145);
qproperty-innerRadius: 2;
qproperty-outerRadius: 10;
qproperty-lineWidth: 2;
}
opl2instrumentView knob {
color: rgb(128,128,128);
qproperty-outerColor: rgb(255,255,255);

View File

@@ -15,6 +15,7 @@ ADD_SUBDIRECTORY(papu)
ADD_SUBDIRECTORY(patman)
ADD_SUBDIRECTORY(peak_controller_effect)
ADD_SUBDIRECTORY(sf2_player)
ADD_SUBDIRECTORY(sfxr)
ADD_SUBDIRECTORY(sid)
ADD_SUBDIRECTORY(spectrum_analyzer)
ADD_SUBDIRECTORY(stereo_enhancer)

View File

@@ -1,3 +1,3 @@
INCLUDE(BuildPlugin)
BUILD_PLUGIN(sfxr sfxr.cpp sfxr.h MOCFILES EMBEDDED_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.png)
BUILD_PLUGIN(sfxr sfxr.cpp sfxr.h MOCFILES sfxr.h EMBEDDED_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 433 B

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
/*
* sfxr.h - declaration of classes of the LMMS sfxr plugin
* The original readme file of sfxr can be found in readme.txt in this directory.
*
* Copyright (c) 2014 Wong Cho Ching
*
@@ -29,19 +30,44 @@
#include "Instrument.h"
#include "InstrumentView.h"
#include "knob.h"
#include "graph.h"
#include "pixmap_button.h"
#include "led_checkbox.h"
class bitInvaderView;
class bSynth
enum SfxrWaves
{
SQR_WAVE, SAW_WAVE, SINE_WAVE, NOISE_WAVE, WAVES_NUM
};
const int WAVEFORM_BASE_X = 20;
const int WAVEFORM_BASE_Y = 14;
const int WAVEFORM_BUTTON_WIDTH = 16;
const int GENERATOR_BASE_X = 110;
const int GENERATOR_BASE_Y = 24;
const int GENERATOR_BUTTON_WIDTH = 16;
const int RAND_BUTTON_X = 160;
const int RAND_BUTTON_Y = 4;
const int MUTA_BUTTON_X = 205;
const int MUTA_BUTTON_Y = 4;
const int KNOBS_BASE_X = 20;
const int KNOBS_BASE_Y = 50;
const int KNOB_BLOCK_SIZE_X = 40;
const int KNOB_BLOCK_SIZE_Y = 40;
class SfxrSynth
{
public:
bSynth( float * sample, int length, notePlayHandle * _nph,
bool _interpolation, float factor,
SfxrSynth( float * sample, int length, notePlayHandle * _nph,
bool _interpolation, float factor,
const sample_rate_t _sample_rate );
virtual ~bSynth();
virtual ~SfxrSynth();
sample_t nextStringSample();
@@ -54,15 +80,39 @@ private:
const sample_rate_t sample_rate;
bool interpolation;
} ;
class bitInvader : public Instrument
};
/**
* @brief A class that simplify the constructor of FloatModel, with value [0,1]
*/
class SfxrZeroToOneFloatModel : public FloatModel
{
public:
SfxrZeroToOneFloatModel(float val, Model * parent):
FloatModel( val, 0.0, 1.0, 0.001, parent)
{
}
};
/**
* @brief A class that simplify the constructor of FloatModel, with value [-1,1]
*/
class SfxrNegPosOneFloatModel : public FloatModel
{
public:
SfxrNegPosOneFloatModel(float val, Model * parent):
FloatModel( val, -1.0, 1.0, 0.001, parent)
{
}
};
class sfxrInstrument : public Instrument
{
Q_OBJECT
public:
bitInvader(InstrumentTrack * _instrument_track );
virtual ~bitInvader();
sfxrInstrument(InstrumentTrack * _instrument_track );
virtual ~sfxrInstrument();
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
@@ -75,77 +125,127 @@ public:
virtual QString nodeName() const;
virtual f_cnt_t desiredReleaseFrames() const
{
return( 64 );
}
virtual f_cnt_t desiredReleaseFrames() const;
virtual PluginView * instantiateView( QWidget * _parent );
protected slots:
void lengthChanged();
void samplesChanged( int, int );
void resetModels();
void normalize();
protected slots:
void samplesChanged( int, int );
private:
FloatModel m_sampleLength;
graphModel m_graph;
BoolModel m_interpolation;
BoolModel m_normalize;
float m_normalizeFactor;
SfxrZeroToOneFloatModel m_attModel;
SfxrZeroToOneFloatModel m_holdModel;
SfxrZeroToOneFloatModel m_susModel;
SfxrZeroToOneFloatModel m_decModel;
friend class bitInvaderView;
} ;
SfxrZeroToOneFloatModel m_startFreqModel;
SfxrZeroToOneFloatModel m_minFreqModel;
SfxrNegPosOneFloatModel m_slideModel;
SfxrNegPosOneFloatModel m_dSlideModel;
SfxrZeroToOneFloatModel m_vibDepthModel;
SfxrZeroToOneFloatModel m_vibSpeedModel;
SfxrNegPosOneFloatModel m_changeAmtModel;
SfxrZeroToOneFloatModel m_changeSpeedModel;
SfxrZeroToOneFloatModel m_sqrDutyModel;
SfxrNegPosOneFloatModel m_sqrSweepModel;
SfxrZeroToOneFloatModel m_repeatSpeedModel;
SfxrNegPosOneFloatModel m_phaserOffsetModel;
SfxrNegPosOneFloatModel m_phaserSweepModel;
SfxrZeroToOneFloatModel m_lpFilCutModel;
SfxrNegPosOneFloatModel m_lpFilCutSweepModel;
SfxrZeroToOneFloatModel m_lpFilResoModel;
SfxrZeroToOneFloatModel m_hpFilCutModel;
SfxrNegPosOneFloatModel m_hpFilCutSweepModel;
IntModel m_waveFormModel;
friend class sfxrInstrumentView;
};
class bitInvaderView : public InstrumentView
class sfxrInstrumentView : public InstrumentView
{
Q_OBJECT
public:
bitInvaderView( Instrument * _instrument,
sfxrInstrumentView( Instrument * _instrument,
QWidget * _parent );
virtual ~bitInvaderView() {};
virtual ~sfxrInstrumentView() {};
protected slots:
//void sampleSizeChanged( float _new_sample_length );
void interpolationToggled( bool value );
void normalizeToggled( bool value );
void sinWaveClicked();
void triangleWaveClicked();
void sqrWaveClicked();
void sawWaveClicked();
void noiseWaveClicked();
void usrWaveClicked();
void smoothClicked( void );
void waveFormChanged();
void genPickup();
void genLaser();
void genExplosion();
void genPowerup();
void genHit();
void genJump();
void genBlip();
void randomize();
void mutate();
private:
virtual void modelChanged();
knob * m_sampleLengthKnob;
pixmapButton * m_sinWaveBtn;
pixmapButton * m_triangleWaveBtn;
pixmapButton * m_sqrWaveBtn;
knob * m_attKnob; //Attack Time
knob * m_holdKnob; //Sustain Time
knob * m_susKnob; //Sustain Punch
knob * m_decKnob; //Decay Time
knob * m_startFreqKnob; //Start Frequency
knob * m_minFreqKnob; //Min Frequency
knob * m_slideKnob; //Slide
knob * m_dSlideKnob; //Delta Slide
knob * m_vibDepthKnob; //Vibrato Depth
knob * m_vibSpeedKnob; //Vibrato Speed
knob * m_changeAmtKnob; //Change Amount
knob * m_changeSpeedKnob; //Change Speed
knob * m_sqrDutyKnob; //Squre Duty
knob * m_sqrSpeedKnob; //Squre Sweep
knob * m_repeatSpeedKnob; //Repeat Speed
knob * m_phaserOffsetKnob; //Phaser Offset
knob * m_phaserSweepKnob; //Phaser Sweep
knob * m_lpFilCutKnob; //LP Filter Cutoff
knob * m_lpFilCutSweepKnob; //LP Filter Cutoff Sweep
knob * m_lpFilResoKnob; //LP Filter Resonance
knob * m_hpFilCutKnob; //HP Filter Cutoff
knob * m_hpFilCutSweepKnob; //HP Filter Cutoff Sweep
automatableButtonGroup * m_waveBtnGroup;
pixmapButton * m_sqrWaveBtn; //NOTE: This button has Squre Duty
//and Squre Speed configurable
pixmapButton * m_sawWaveBtn;
pixmapButton * m_whiteNoiseWaveBtn;
pixmapButton * m_smoothBtn;
pixmapButton * m_usrWaveBtn;
pixmapButton * m_sinWaveBtn;
pixmapButton * m_noiseWaveBtn;
pixmapButton * m_pickupBtn;
pixmapButton * m_laserBtn;
pixmapButton * m_explosionBtn;
pixmapButton * m_powerupBtn;
pixmapButton * m_hitBtn;
pixmapButton * m_jumpBtn;
pixmapButton * m_blipBtn;
pixmapButton * m_randomizeBtn;
pixmapButton * m_mutateBtn;
static QPixmap * s_artwork;
graph * m_graph;
ledCheckBox * m_interpolationToggle;
ledCheckBox * m_normalizeToggle;
} ;
};