Skip to content

Commit

Permalink
Switch Sid to submodule (LMMS#5724)
Browse files Browse the repository at this point in the history
Also refactors to TitleCase, uses newer SID namespace
  • Loading branch information
tresf authored and IanCaio committed Mar 28, 2021
1 parent 70b22b4 commit 81e765a
Show file tree
Hide file tree
Showing 62 changed files with 92 additions and 8,381 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@
[submodule "plugins/carlabase/carla"]
path = plugins/carlabase/carla
url = https:/falktx/carla
[submodule "plugins/sid/resid"]
path = plugins/Sid/resid
url = https:/simonowen/resid
2 changes: 1 addition & 1 deletion cmake/modules/PluginList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ SET(LMMS_PLUGIN_LIST
ReverbSC
sf2_player
sfxr
sid
Sid
SpectrumAnalyzer
stereo_enhancer
stereo_matrix
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
51 changes: 51 additions & 0 deletions plugins/Sid/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
INCLUDE(BuildPlugin)

INCLUDE_DIRECTORIES(resid)

BUILD_PLUGIN(sid
SidInstrument.cpp
SidInstrument.h
resid/envelope.h
resid/extfilt.h
resid/filter.h
resid/pot.h
resid/siddefs.h
resid/sid.h
resid/spline.h
resid/voice.h
resid/wave.h
resid/envelope.cc
resid/extfilt.cc
resid/filter.cc
resid/pot.cc
resid/sid.cc
resid/version.cc
resid/voice.cc
resid/wave6581_PS_.cc
resid/wave6581_PST.cc
resid/wave6581_P_T.cc
resid/wave6581__ST.cc
resid/wave8580_PS_.cc
resid/wave8580_PST.cc
resid/wave8580_P_T.cc
resid/wave8580__ST.cc
resid/wave.cc
MOCFILES SidInstrument.h
EMBEDDED_RESOURCES *.png)

# Parse VERSION
FILE(READ "resid/CMakeLists.txt" lines)
STRING(REGEX MATCH "set\\(MAJOR_VER [A-Za-z0-9_]*\\)" MAJOR_RAW ${lines})
STRING(REGEX MATCH "set\\(MINOR_VER [A-Za-z0-9_]*\\)" MINOR_RAW ${lines})
STRING(REGEX MATCH "set\\(PATCH_VER [A-Za-z0-9_]*\\)" PATCH_RAW ${lines})
SEPARATE_ARGUMENTS(MAJOR_RAW)
SEPARATE_ARGUMENTS(MINOR_RAW)
SEPARATE_ARGUMENTS(PATCH_RAW)
LIST(GET MAJOR_RAW 1 MAJOR_RAW)
LIST(GET MINOR_RAW 1 MINOR_RAW)
LIST(GET PATCH_RAW 1 PATCH_RAW)
STRING(REPLACE ")" "" MAJOR_VER "${MAJOR_RAW}")
STRING(REPLACE ")" "" MINOR_VER "${MINOR_RAW}")
STRING(REPLACE ")" "" PATCH_VER "${PATCH_RAW}")

TARGET_COMPILE_DEFINITIONS(sid PRIVATE VERSION="${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}")
50 changes: 25 additions & 25 deletions plugins/sid/sid_instrument.cpp → plugins/Sid/SidInstrument.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* sid_instrument.cpp - ResID based software-synthesizer
* SidInstrument.cpp - ResID based software-synthesizer
*
* Copyright (c) 2008 Csaba Hruska <csaba.hruska/at/gmail.com>
* Attila Herman <attila589/at/gmail.com>
Expand Down Expand Up @@ -32,7 +32,7 @@

#include "sid.h"

#include "sid_instrument.h"
#include "SidInstrument.h"
#include "Engine.h"
#include "InstrumentTrack.h"
#include "Knob.h"
Expand Down Expand Up @@ -119,7 +119,7 @@ voiceObject::~voiceObject()
}


sidInstrument::sidInstrument( InstrumentTrack * _instrument_track ) :
SidInstrument::SidInstrument( InstrumentTrack * _instrument_track ) :
Instrument( _instrument_track, &sid_plugin_descriptor ),
// filter
m_filterFCModel( 1024.0f, 0.0f, 2047.0f, 1.0f, this, tr( "Cutoff frequency" ) ),
Expand All @@ -138,12 +138,12 @@ sidInstrument::sidInstrument( InstrumentTrack * _instrument_track ) :
}


sidInstrument::~sidInstrument()
SidInstrument::~SidInstrument()
{
}


void sidInstrument::saveSettings( QDomDocument & _doc,
void SidInstrument::saveSettings( QDomDocument & _doc,
QDomElement & _this )
{
// voices
Expand Down Expand Up @@ -189,7 +189,7 @@ void sidInstrument::saveSettings( QDomDocument & _doc,



void sidInstrument::loadSettings( const QDomElement & _this )
void SidInstrument::loadSettings( const QDomElement & _this )
{
// voices
for( int i = 0; i < 3; ++i )
Expand Down Expand Up @@ -223,15 +223,15 @@ void sidInstrument::loadSettings( const QDomElement & _this )



QString sidInstrument::nodeName() const
QString SidInstrument::nodeName() const
{
return( sid_plugin_descriptor.name );
}




f_cnt_t sidInstrument::desiredReleaseFrames() const
f_cnt_t SidInstrument::desiredReleaseFrames() const
{
const float samplerate = Engine::mixer()->processingSampleRate();
int maxrel = 0;
Expand All @@ -247,7 +247,7 @@ f_cnt_t sidInstrument::desiredReleaseFrames() const



static int sid_fillbuffer(unsigned char* sidreg, cSID *sid, int tdelta, short *ptr, int samples)
static int sid_fillbuffer(unsigned char* sidreg, SID *sid, int tdelta, short *ptr, int samples)
{
int tdelta2;
int result;
Expand Down Expand Up @@ -302,7 +302,7 @@ static int sid_fillbuffer(unsigned char* sidreg, cSID *sid, int tdelta, short *p



void sidInstrument::playNote( NotePlayHandle * _n,
void SidInstrument::playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer )
{
const f_cnt_t tfp = _n->totalFramesPlayed();
Expand All @@ -312,7 +312,7 @@ void sidInstrument::playNote( NotePlayHandle * _n,

if ( tfp == 0 )
{
cSID *sid = new cSID();
SID *sid = new SID();
sid->set_sampling_parameters( clockrate, SAMPLE_FAST, samplerate );
sid->set_chip_model( MOS8580 );
sid->enable_filter( true );
Expand All @@ -322,7 +322,7 @@ void sidInstrument::playNote( NotePlayHandle * _n,
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const f_cnt_t offset = _n->noteOffset();

cSID *sid = static_cast<cSID *>( _n->m_pluginData );
SID *sid = static_cast<SID *>( _n->m_pluginData );
int delta_t = clockrate * frames / samplerate + 4;
// avoid variable length array for msvc compat
short* buf = reinterpret_cast<short*>(_working_buffer + offset);
Expand Down Expand Up @@ -446,17 +446,17 @@ void sidInstrument::playNote( NotePlayHandle * _n,



void sidInstrument::deleteNotePluginData( NotePlayHandle * _n )
void SidInstrument::deleteNotePluginData( NotePlayHandle * _n )
{
delete static_cast<cSID *>( _n->m_pluginData );
delete static_cast<SID *>( _n->m_pluginData );
}




PluginView * sidInstrument::instantiateView( QWidget * _parent )
PluginView * SidInstrument::instantiateView( QWidget * _parent )
{
return( new sidInstrumentView( this, _parent ) );
return( new SidInstrumentView( this, _parent ) );
}


Expand All @@ -481,7 +481,7 @@ class sidKnob : public Knob



sidInstrumentView::sidInstrumentView( Instrument * _instrument,
SidInstrumentView::SidInstrumentView( Instrument * _instrument,
QWidget * _parent ) :
InstrumentViewFixedSize( _instrument, _parent )
{
Expand Down Expand Up @@ -657,13 +657,13 @@ sidInstrumentView::sidInstrumentView( Instrument * _instrument,
}


sidInstrumentView::~sidInstrumentView()
SidInstrumentView::~SidInstrumentView()
{
}

void sidInstrumentView::updateKnobHint()
void SidInstrumentView::updateKnobHint()
{
sidInstrument * k = castModel<sidInstrument>();
SidInstrument * k = castModel<SidInstrument>();

for( int i = 0; i < 3; ++i )
{
Expand Down Expand Up @@ -702,9 +702,9 @@ void sidInstrumentView::updateKnobHint()



void sidInstrumentView::updateKnobToolTip()
void SidInstrumentView::updateKnobToolTip()
{
sidInstrument * k = castModel<sidInstrument>();
SidInstrument * k = castModel<SidInstrument>();
for( int i = 0; i < 3; ++i )
{
ToolTip::add( m_voiceKnobs[i].m_sustKnob,
Expand All @@ -722,9 +722,9 @@ void sidInstrumentView::updateKnobToolTip()



void sidInstrumentView::modelChanged()
void SidInstrumentView::modelChanged()
{
sidInstrument * k = castModel<sidInstrument>();
SidInstrument * k = castModel<SidInstrument>();

m_volKnob->setModel( &k->m_volumeModel );
m_resKnob->setModel( &k->m_filterResonanceModel );
Expand Down Expand Up @@ -796,7 +796,7 @@ extern "C"
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return( new sidInstrument( static_cast<InstrumentTrack *>( m ) ) );
return( new SidInstrument( static_cast<InstrumentTrack *>( m ) ) );
}


Expand Down
22 changes: 11 additions & 11 deletions plugins/sid/sid_instrument.h → plugins/Sid/SidInstrument.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* sid_Instrument.h - ResID based software-synthesizer
* SidInstrument.h - ResID based software-synthesizer
*
* Copyright (c) 2008 Csaba Hruska <csaba.hruska/at/gmail.com>
* Attila Herman <attila589/at/gmail.com>
Expand Down Expand Up @@ -33,7 +33,7 @@
#include "Knob.h"


class sidInstrumentView;
class SidInstrumentView;
class NotePlayHandle;
class automatableButtonGroup;
class PixmapButton;
Expand Down Expand Up @@ -67,11 +67,11 @@ class voiceObject : public Model
BoolModel m_filteredModel;
BoolModel m_testModel;

friend class sidInstrument;
friend class sidInstrumentView;
friend class SidInstrument;
friend class SidInstrumentView;
} ;

class sidInstrument : public Instrument
class SidInstrument : public Instrument
{
Q_OBJECT
public:
Expand All @@ -89,8 +89,8 @@ class sidInstrument : public Instrument
};


sidInstrument( InstrumentTrack * _instrument_track );
virtual ~sidInstrument();
SidInstrument( InstrumentTrack * _instrument_track );
virtual ~SidInstrument();

virtual void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer );
Expand Down Expand Up @@ -126,18 +126,18 @@ class sidInstrument : public Instrument

IntModel m_chipModel;

friend class sidInstrumentView;
friend class SidInstrumentView;

} ;



class sidInstrumentView : public InstrumentViewFixedSize
class SidInstrumentView : public InstrumentViewFixedSize
{
Q_OBJECT
public:
sidInstrumentView( Instrument * _instrument, QWidget * _parent );
virtual ~sidInstrumentView();
SidInstrumentView( Instrument * _instrument, QWidget * _parent );
virtual ~SidInstrumentView();

private:
virtual void modelChanged();
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions plugins/Sid/resid
Submodule resid added at 02afcc
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
5 changes: 0 additions & 5 deletions plugins/sid/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 81e765a

Please sign in to comment.