Merge remote-tracking branch 'upstream/master' into refactor-samplebuffer

This commit is contained in:
sakertooth
2023-09-25 21:04:44 -04:00
58 changed files with 520 additions and 278 deletions

View File

@@ -172,9 +172,6 @@ void AudioFileProcessor::playNote( NotePlayHandle * _n,
static_cast<Sample::Loop>(m_loopModel.value())))
{
applyRelease( _working_buffer, _n );
instrumentTrack()->processAudioBuffer( _working_buffer,
frames + offset, _n );
emit isPlaying((static_cast<Sample::PlaybackState*>(_n->m_pluginData)->frameIndex()));
}
else

View File

@@ -307,8 +307,6 @@ void BitInvader::playNote( NotePlayHandle * _n,
}
applyRelease( _working_buffer, _n );
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
}

View File

@@ -508,7 +508,6 @@ void CarlaInstrument::play(sampleFrame* workingBuffer)
if (fHandle == nullptr)
{
instrumentTrack()->processAudioBuffer(workingBuffer, bufsize, nullptr);
return;
}
@@ -556,8 +555,6 @@ void CarlaInstrument::play(sampleFrame* workingBuffer)
workingBuffer[i][0] = buf1[i];
workingBuffer[i][1] = buf2[i];
}
instrumentTrack()->processAudioBuffer(workingBuffer, bufsize, nullptr);
}
bool CarlaInstrument::handleMidiEvent(const MidiEvent& event, const TimePos&, f_cnt_t offset)

View File

@@ -419,7 +419,6 @@ void FreeBoyInstrument::playNote(NotePlayHandle* nph, sampleFrame* workingBuffer
}
framesLeft -= count;
}
instrumentTrack()->processAudioBuffer(workingBuffer, frames + offset, nph);
}

View File

@@ -494,8 +494,6 @@ void GigInstrument::play( sampleFrame * _working_buffer )
_working_buffer[i][0] *= m_gain.value();
_working_buffer[i][1] *= m_gain.value();
}
instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr );
}

View File

@@ -197,8 +197,6 @@ void KickerInstrument::playNote( NotePlayHandle * _n,
_working_buffer[f+offset][1] *= fac;
}
}
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
}

View File

@@ -16,6 +16,7 @@ SET(COMPILE_FLAGS "${COMPILE_FLAGS} ${PIC_FLAGS}")
# Loop over every XML file
FILE(GLOB XML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ladspa/*.xml")
LIST(SORT XML_SOURCES)
FOREACH(_item ${XML_SOURCES})
# Get library name and (soon to be) C file
GET_FILENAME_COMPONENT(_plugin "${_item}" NAME_WE)
@@ -24,7 +25,7 @@ FOREACH(_item ${XML_SOURCES})
# Coerce XML source file to C
ADD_CUSTOM_COMMAND(
OUTPUT "${_out_file}"
COMMAND ./makestub.pl "${_item}" > "${_out_file}"
COMMAND "${PERL_EXECUTABLE}" ./makestub.pl "${_item}" > "${_out_file}"
DEPENDS "${_item}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ladspa"
VERBATIM

View File

@@ -790,7 +790,6 @@ void Lb302Synth::play( sampleFrame * _working_buffer )
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
process( _working_buffer, frames );
instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr );
// release_frame = 0; //removed for issue # 1432
}

View File

@@ -197,8 +197,6 @@ void Lv2Instrument::play(sampleFrame *buf)
copyModelsToLmms();
copyBuffersToLmms(buf, fpp);
instrumentTrack()->processAudioBuffer(buf, fpp, nullptr);
}

View File

@@ -1040,8 +1040,6 @@ void MonstroInstrument::playNote( NotePlayHandle * _n,
ms->renderOutput( frames, _working_buffer + offset );
//applyRelease( _working_buffer, _n ); // we have our own release
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
}
void MonstroInstrument::deleteNotePluginData( NotePlayHandle * _n )

View File

@@ -561,8 +561,6 @@ void NesInstrument::playNote( NotePlayHandle * n, sampleFrame * workingBuffer )
nes->renderOutput( workingBuffer + offset, frames );
applyRelease( workingBuffer, n );
instrumentTrack()->processAudioBuffer( workingBuffer, frames + offset, n );
}

View File

@@ -412,10 +412,6 @@ void OpulenzInstrument::play( sampleFrame * _working_buffer )
}
}
emulatorMutex.unlock();
// Throw the data to the track...
instrumentTrack()->processAudioBuffer( _working_buffer, frameCount, nullptr );
}

View File

@@ -312,8 +312,6 @@ void OrganicInstrument::playNote( NotePlayHandle * _n,
}
// -- --
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
}

View File

@@ -157,8 +157,6 @@ void PatmanInstrument::playNote( NotePlayHandle * _n,
play_freq, m_loopedModel.value() ? Sample::Loop::On : Sample::Loop::Off))
{
applyRelease( _working_buffer, _n );
instrumentTrack()->processAudioBuffer( _working_buffer,
frames + offset, _n );
}
else
{
@@ -436,7 +434,7 @@ namespace gui
PatmanView::PatmanView( Instrument * _instrument, QWidget * _parent ) :
InstrumentViewFixedSize( _instrument, _parent ),
m_pi( nullptr )
m_pi(castModel<PatmanInstrument>())
{
setAutoFillBackground( true );
QPalette pal;
@@ -477,7 +475,15 @@ PatmanView::PatmanView( Instrument * _instrument, QWidget * _parent ) :
"tune_off" ) );
m_tuneButton->setToolTip(tr("Tune mode"));
m_displayFilename = tr( "No file selected" );
if (m_pi->m_patchFile.isEmpty())
{
m_displayFilename = tr("No file selected");
}
else
{
updateFilename();
}
setAcceptDrops( true );
}

View File

@@ -848,7 +848,6 @@ void Sf2Instrument::play( sampleFrame * _working_buffer )
if( m_playingNotes.isEmpty() )
{
renderFrames( frames, _working_buffer );
instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr );
return;
}
@@ -906,7 +905,6 @@ void Sf2Instrument::play( sampleFrame * _working_buffer )
{
renderFrames( frames - currentFrame, _working_buffer + currentFrame );
}
instrumentTrack()->processAudioBuffer( _working_buffer, frames, nullptr );
}

View File

@@ -480,9 +480,6 @@ void SfxrInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffe
delete[] pitchedBuffer;
applyRelease( _working_buffer, _n );
instrumentTrack()->processAudioBuffer( _working_buffer, frameNum + offset, _n );
}

View File

@@ -1,51 +1,14 @@
INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES(resid)
if(NOT LMMS_HAVE_SID)
return()
endif()
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}")
add_subdirectory(resid)
target_link_libraries(sid resid)

View File

@@ -239,7 +239,7 @@ f_cnt_t SidInstrument::desiredReleaseFrames() const
static int sid_fillbuffer(unsigned char* sidreg, SID *sid, int tdelta, short *ptr, int samples)
static int sid_fillbuffer(unsigned char* sidreg, reSID::SID *sid, int tdelta, short *ptr, int samples)
{
int tdelta2;
int result;
@@ -302,9 +302,9 @@ void SidInstrument::playNote( NotePlayHandle * _n,
if (!_n->m_pluginData)
{
SID *sid = new SID();
sid->set_sampling_parameters( clockrate, SAMPLE_FAST, samplerate );
sid->set_chip_model( MOS8580 );
auto sid = new reSID::SID();
sid->set_sampling_parameters(clockrate, reSID::SAMPLE_FAST, samplerate);
sid->set_chip_model(reSID::MOS8580);
sid->enable_filter( true );
sid->reset();
_n->m_pluginData = sid;
@@ -312,7 +312,7 @@ void SidInstrument::playNote( NotePlayHandle * _n,
const fpp_t frames = _n->framesLeftForCurrentPeriod();
const f_cnt_t offset = _n->noteOffset();
SID *sid = static_cast<SID *>( _n->m_pluginData );
auto sid = static_cast<reSID::SID*>(_n->m_pluginData);
int delta_t = clockrate * frames / samplerate + 4;
// avoid variable length array for msvc compat
auto buf = reinterpret_cast<short*>(_working_buffer + offset);
@@ -325,20 +325,20 @@ void SidInstrument::playNote( NotePlayHandle * _n,
if( (ChipModel)m_chipModel.value() == ChipModel::MOS6581 )
{
sid->set_chip_model( MOS6581 );
sid->set_chip_model(reSID::MOS6581);
}
else
{
sid->set_chip_model( MOS8580 );
sid->set_chip_model(reSID::MOS8580);
}
// voices
reg8 data8 = 0;
reg8 data16 = 0;
reg8 base = 0;
reSID::reg8 data8 = 0;
reSID::reg16 data16 = 0;
size_t base = 0;
float freq = 0.0;
float note = 0.0;
for( reg8 i = 0 ; i < 3 ; ++i )
for (size_t i = 0; i < 3; ++i)
{
base = i*7;
// freq ( Fn = Fout / Fclk * 16777216 ) + coarse detuning
@@ -429,8 +429,6 @@ void SidInstrument::playNote( NotePlayHandle * _n,
_working_buffer[frame+offset][ch] = s;
}
}
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
}
@@ -438,7 +436,7 @@ void SidInstrument::playNote( NotePlayHandle * _n,
void SidInstrument::deleteNotePluginData( NotePlayHandle * _n )
{
delete static_cast<SID *>( _n->m_pluginData );
delete static_cast<reSID::SID*>(_n->m_pluginData);
}

View File

@@ -0,0 +1,68 @@
# These are the defaults
set(RESID_INLINING 1)
set(RESID_INLINE inline)
set(RESID_BRANCH_HINTS 1)
set(NEW_8580_FILTER 0)
set(HAVE_BOOL 1)
set(HAVE_LOG1P 1)
if(CMAKE_CXX_COMPILER_ID MATCHES "GCC|Clang")
set(HAVE_BUILTIN_EXPECT 1)
else()
set(HAVE_BUILTIN_EXPECT 0)
endif()
configure_file(resid/siddefs.h.in resid/siddefs.h @ONLY)
add_library(resid_objects OBJECT
resid/sid.cc
resid/voice.cc
resid/wave.cc
resid/envelope.cc
resid/filter.cc
resid/dac.cc
resid/extfilt.cc
resid/pot.cc
resid/version.cc
)
target_include_directories(resid_objects PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/resid"
"${CMAKE_CURRENT_BINARY_DIR}/resid"
)
target_compile_definitions(resid_objects PUBLIC VERSION="1.0")
set(RESID_WAVES
wave6581_PST
wave6581_PS_
wave6581_P_T
wave6581__ST
wave8580_PST
wave8580_PS_
wave8580_P_T
wave8580__ST
)
set(RESID_SAMP2SRC_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/resid/samp2src.pl)
foreach(WAVE_DATA IN LISTS RESID_WAVES)
set(WAVE_DATA_IN ${CMAKE_CURRENT_SOURCE_DIR}/resid/${WAVE_DATA}.dat)
set(WAVE_SRC_OUT ${CMAKE_CURRENT_BINARY_DIR}/resid/${WAVE_DATA}.h)
set(WAVE_COMMAND
"${PERL_EXECUTABLE}"
"${RESID_SAMP2SRC_SCRIPT}"
"${WAVE_DATA}"
"${WAVE_DATA_IN}"
"${WAVE_SRC_OUT}"
)
add_custom_command(OUTPUT ${WAVE_SRC_OUT} COMMAND ${WAVE_COMMAND} VERBATIM)
target_sources(resid_objects PUBLIC ${WAVE_SRC_OUT})
endforeach()
# TODO CMake 3.12: Use target_link_libraries() to propagate usage requirements directly to sid plugin
add_library(resid INTERFACE)
target_sources(resid INTERFACE $<TARGET_OBJECTS:resid_objects>)
get_target_property(resid_includes resid_objects INCLUDE_DIRECTORIES)
target_include_directories(resid INTERFACE ${resid_includes})

View File

@@ -359,8 +359,6 @@ void MalletsInstrument::playNote( NotePlayHandle * _n,
_working_buffer[frame][1] = ps->nextSampleRight() *
( m_scalers[p] + add_scale );
}
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
}

View File

@@ -387,8 +387,6 @@ void TripleOscillator::playNote( NotePlayHandle * _n,
applyFadeIn(_working_buffer, _n);
applyRelease( _working_buffer, _n );
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
}

View File

@@ -399,8 +399,6 @@ void VestigeInstrument::play( sampleFrame * _buf )
{
if (!m_pluginMutex.tryLock(Engine::getSong()->isExporting() ? -1 : 0)) {return;}
const fpp_t frames = Engine::audioEngine()->framesPerPeriod();
if( m_plugin == nullptr )
{
m_pluginMutex.unlock();
@@ -409,8 +407,6 @@ void VestigeInstrument::play( sampleFrame * _buf )
m_plugin->process( nullptr, _buf );
instrumentTrack()->processAudioBuffer( _buf, frames, nullptr );
m_pluginMutex.unlock();
}

View File

@@ -251,8 +251,6 @@ void Vibed::playNote(NotePlayHandle* n, sampleFrame* workingBuffer)
}
}
}
instrumentTrack()->processAudioBuffer(workingBuffer, frames + offset, n);
}
void Vibed::deleteNotePluginData(NotePlayHandle* n)

View File

@@ -82,7 +82,11 @@ void VstSubPluginFeatures::addPluginsFromDir( QStringList* filenames, QString pa
}
}
QStringList dlls = QDir( ConfigManager::inst()->vstDir() + path ).
entryList( QStringList() << "*.dll",
entryList( QStringList() << "*.dll"
#ifdef LMMS_BUILD_LINUX
<< "*.so"
#endif
,
QDir::Files, QDir::Name );
for( int i = 0; i < dlls.size(); i++ )
{

View File

@@ -445,8 +445,6 @@ void WatsynInstrument::playNote( NotePlayHandle * _n,
}
applyRelease( _working_buffer, _n );
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
}

View File

@@ -233,8 +233,6 @@ void Xpressive::playNote(NotePlayHandle* nph, sampleFrame* working_buffer) {
const f_cnt_t offset = nph->noteOffset();
ps->renderOutput(frames, working_buffer + offset);
instrumentTrack()->processAudioBuffer(working_buffer, frames + offset, nph);
}
void Xpressive::deleteNotePluginData(NotePlayHandle* nph) {

View File

@@ -341,7 +341,6 @@ void ZynAddSubFxInstrument::play( sampleFrame * _buf )
m_plugin->processAudio( _buf );
}
m_pluginMutex.unlock();
instrumentTrack()->processAudioBuffer( _buf, Engine::audioEngine()->framesPerPeriod(), nullptr );
}