Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
[submodule "plugins/CarlaBase/carla"]
path = plugins/CarlaBase/carla
url = https://github.com/falktx/carla
[submodule "plugins/Sid/resid/resid"]
path = plugins/Sid/resid/resid
url = https://github.com/libsidplayfp/resid
[submodule "plugins/Sid/resid"]
path = plugins/Sid/resid
url = https://github.com/simonowen/resid
[submodule "src/3rdparty/jack2"]
path = src/3rdparty/jack2
url = https://github.com/jackaudio/jack2
Expand Down
36 changes: 25 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ OPTION(WANT_SOUNDIO "Include libsoundio support" ON)
OPTION(WANT_SDL "Include SDL (Simple DirectMedia Layer) support" ON)
OPTION(WANT_SF2 "Include SoundFont2 player plugin" ON)
OPTION(WANT_GIG "Include GIG player plugin" ON)
option(WANT_SID "Include Sid instrument" ON)
OPTION(WANT_STK "Include Stk (Synthesis Toolkit) support" ON)
OPTION(WANT_SWH "Include Steve Harris's LADSPA plugins" ON)
OPTION(WANT_TAP "Include Tom's Audio Processing LADSPA plugins" ON)
Expand Down Expand Up @@ -303,6 +302,11 @@ ELSE(WANT_CMT)
ENDIF(WANT_CMT)

IF(WANT_SWH)
IF(LMMS_BUILD_APPLE)
# Prefer system perl over Homebrew, MacPorts, etc
SET(Perl_ROOT "/usr/bin")
ENDIF()
FIND_PACKAGE(Perl)
IF(PERL_FOUND)
SET(LMMS_HAVE_SWH TRUE)
SET(STATUS_SWH "OK")
Expand Down Expand Up @@ -351,15 +355,26 @@ IF(WANT_SDL)
ENDIF()
ENDIF()

# check for Sid
if(WANT_SID)
if(PERL_FOUND)
set(LMMS_HAVE_SID TRUE)
set(STATUS_SID "OK")
else()
set(STATUS_SID "not found, please install perl if you require the Sid instrument")
endif()
endif()
# fallback to SDL1
IF(WANT_SDL AND NOT LMMS_HAVE_SDL2)
# Fallback to SDL1.2
SET(SDL_BUILDING_LIBRARY TRUE)
FIND_PACKAGE(SDL)
IF(SDL_FOUND)
SET(LMMS_HAVE_SDL TRUE)
SET(STATUS_SDL "OK, using SDL1.2")
# fix mingw since 53abd65
IF(NOT SDL_INCLUDE_DIR)
SET(SDL_INCLUDE_DIR "${CMAKE_FIND_ROOT_PATH}/include")
ENDIF()

ELSE()
SET(STATUS_SDL "not found, please install libsdl2-dev (or similar) "
"if you require SDL support")
SET(SDL_INCLUDE_DIR "")
SET(SDL_LIBRARY "")
ENDIF()
ENDIF()

# check for Stk
IF(WANT_STK)
Expand Down Expand Up @@ -851,7 +866,6 @@ MESSAGE(
"* ZynAddSubFX instrument : ${STATUS_ZYN}\n"
"* Carla Patchbay & Rack : ${STATUS_CARLA}\n"
"* SoundFont2 player : ${STATUS_FLUIDSYNTH}\n"
"* Sid instrument : ${STATUS_SID}\n"
"* Stk Mallets : ${STATUS_STK}\n"
"* VST plugin host : ${STATUS_VST}\n"
" * 32-bit Windows host : ${STATUS_VST_32}\n"
Expand Down
47 changes: 42 additions & 5 deletions plugins/Sid/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,51 @@
INCLUDE(BuildPlugin)

if(NOT LMMS_HAVE_SID)
return()
endif()
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)

add_subdirectory(resid)
target_link_libraries(sid resid)
# 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}")
28 changes: 15 additions & 13 deletions plugins/Sid/SidInstrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ SidInstrument::SidInstrument( InstrumentTrack * _instrument_track ) :
{
// A Filter object needs to be created only once to do some initialization, avoiding
// dropouts down the line when we have to play a note for the first time.
[[maybe_unused]] static auto s_filter = reSID::Filter{};
[[maybe_unused]] static auto s_filter = Filter{};

for( int i = 0; i < 3; ++i )
{
Expand Down Expand Up @@ -237,7 +237,9 @@ float SidInstrument::desiredReleaseTimeMs() const
}


static int sid_fillbuffer(unsigned char* sidreg, reSID::SID *sid, int tdelta, short *ptr, int samples)


static int sid_fillbuffer(unsigned char* sidreg, SID *sid, int tdelta, short *ptr, int samples)
{
int total = 0;
// customly added
Expand Down Expand Up @@ -297,17 +299,17 @@ void SidInstrument::playNote( NotePlayHandle * _n,

if (!_n->m_pluginData)
{
auto sid = new reSID::SID();
sid->set_sampling_parameters(clockrate, reSID::SAMPLE_FAST, samplerate);
sid->set_chip_model(reSID::MOS8580);
SID *sid = new SID();
sid->set_sampling_parameters( clockrate, SAMPLE_FAST, samplerate );
sid->set_chip_model( MOS8580 );
sid->enable_filter( true );
sid->reset();
_n->m_pluginData = sid;
}
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const f_cnt_t offset = _n->noteOffset();

auto sid = static_cast<reSID::SID*>(_n->m_pluginData);
SID *sid = static_cast<SID *>( _n->m_pluginData );
int delta_t = clockrate * frames / samplerate + 4;
#ifndef _MSC_VER
short buf[frames];
Expand All @@ -323,20 +325,20 @@ void SidInstrument::playNote( NotePlayHandle * _n,

if( (ChipModel)m_chipModel.value() == ChipModel::MOS6581 )
{
sid->set_chip_model(reSID::MOS6581);
sid->set_chip_model( MOS6581 );
}
else
{
sid->set_chip_model(reSID::MOS8580);
sid->set_chip_model( MOS8580 );
}

// voices
reSID::reg8 data8 = 0;
reSID::reg16 data16 = 0;
size_t base = 0;
reg8 data8 = 0;
reg8 data16 = 0;
reg8 base = 0;
float freq = 0.0;
float note = 0.0;
for (size_t i = 0; i < 3; ++i)
for( reg8 i = 0 ; i < 3 ; ++i )
{
base = i*7;
// freq ( Fn = Fout / Fclk * 16777216 ) + coarse detuning
Expand Down Expand Up @@ -435,7 +437,7 @@ void SidInstrument::playNote( NotePlayHandle * _n,

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


Expand Down
1 change: 1 addition & 0 deletions plugins/Sid/resid
Submodule resid added at 65248e
70 changes: 0 additions & 70 deletions plugins/Sid/resid/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion plugins/Sid/resid/resid
Submodule resid deleted from ef7246
Loading