Merge branch 'stable-1.2'

# Conflicts:
#	.gitmodules
#	.travis.yml
#	.travis/linux..before_install.sh
#	.travis/linux..install.sh
#	CMakeLists.txt
#	cmake/linux/package_linux.sh.in
#	cmake/modules/BuildPlugin.cmake
#	include/AutomatableModel.h
#	plugins/MidiImport/MidiImport.cpp
#	plugins/carlapatchbay/CMakeLists.txt
#	plugins/carlarack/CMakeLists.txt
#	src/core/Song.cpp
#	src/core/Track.cpp
#	src/gui/editors/SongEditor.cpp
#	tests/src/core/AutomatableModelTest.cpp
This commit is contained in:
Hyunjin Song
2020-04-04 12:08:55 +09:00
40 changed files with 329 additions and 160 deletions

View File

@@ -202,13 +202,19 @@ bool HydrogenImport::readSong()
else
{
unsigned nLayer = 0;
QDomNode layerNode = instrumentNode.firstChildElement( "layer" );
QDomNode instrumentComponentNode = instrumentNode.firstChildElement("instrumentComponent");
if (instrumentComponentNode.isNull())
{
instrumentComponentNode = instrumentNode;
}
QDomNode layerNode = instrumentComponentNode.firstChildElement( "layer" );
while ( ! layerNode.isNull() )
{
if ( nLayer >= MAX_LAYERS )
{
printf( "nLayer >= MAX_LAYERS" );
continue;
printf("nLayer >= MAX_LAYERS\n");
break;
}
QString sFilename = LocalFileMng::readXmlString( layerNode, "filename", "" );
QString sMode = LocalFileMng::readXmlString( layerNode, "smode", "forward" );

View File

@@ -217,8 +217,7 @@ public:
p( NULL ),
it_inst( NULL ),
isSF2( false ),
hasNotes( false ),
lastEnd( 0 )
hasNotes( false )
{ }
InstrumentTrack * it;
@@ -226,7 +225,6 @@ public:
Instrument * it_inst;
bool isSF2;
bool hasNotes;
MidiTime lastEnd;
QString trackName;
smfMidiChannel * create( TrackContainer* tc, QString tn )
@@ -257,9 +255,11 @@ public:
if( trackName != "") {
it->setName( tn );
}
lastEnd = 0;
// General MIDI default
it->pitchRangeModel()->setInitValue( 2 );
// Create a default pattern
p = dynamic_cast<Pattern*>(it->createTCO(0));
}
return this;
}
@@ -267,16 +267,37 @@ public:
void addNote( Note & n )
{
if( !p || n.pos() > lastEnd + DefaultTicksPerBar )
if (!p)
{
MidiTime pPos = MidiTime( n.pos().getBar(), 0 );
p = dynamic_cast<Pattern*>( it->createTCO( 0 ) );
p->movePosition( pPos );
p = dynamic_cast<Pattern*>(it->createTCO(0));
}
p->addNote(n, false);
hasNotes = true;
lastEnd = n.pos() + n.length();
n.setPos( n.pos( p->startPosition() ) );
p->addNote( n, false );
}
void splitPatterns()
{
Pattern * newPattern = nullptr;
MidiTime lastEnd(0);
p->rearrangeAllNotes();
for (auto n : p->notes())
{
if (!newPattern || n->pos() > lastEnd + DefaultTicksPerBar)
{
MidiTime pPos = MidiTime(n->pos().getBar(), 0);
newPattern = dynamic_cast<Pattern*>(it->createTCO(0));
newPattern->movePosition(pPos);
}
lastEnd = n->pos() + n->length();
Note newNote(*n);
newNote.setPos(n->pos(newPattern->startPosition()));
newPattern->addNote(newNote, false);
}
delete p;
p = nullptr;
}
};
@@ -539,7 +560,11 @@ bool MidiImport::readSMF( TrackContainer* tc )
for( int c=0; c < 256; ++c )
{
if( !chs[c].hasNotes && chs[c].it )
if (chs[c].hasNotes)
{
chs[c].splitPatterns();
}
else if (chs[c].it)
{
printf(" Should remove empty track\n");
// must delete trackView first - but where is it?

View File

@@ -6,7 +6,30 @@ IF(NOT CMAKE_VERSION VERSION_LESS 3.9)
CMAKE_POLICY(SET CMP0068 OLD)
ENDIF()
if(LMMS_HAVE_CARLA)
# If Carla was not provided by the system, make a dummy library instead
if(LMMS_HAVE_WEAKCARLA)
# Mimic the autoconf header
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/autoconf)
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/autoconf/config.h "")
SET(CARLA_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/carla/source
${CMAKE_CURRENT_SOURCE_DIR}/carla/source/includes
${CMAKE_CURRENT_SOURCE_DIR}/carla/source/utils
${CMAKE_CURRENT_SOURCE_DIR}/carla/source/backend
${CMAKE_CURRENT_BINARY_DIR}/autoconf
)
ADD_LIBRARY(carla_native-plugin SHARED DummyCarla.cpp)
TARGET_INCLUDE_DIRECTORIES(carla_native-plugin PUBLIC ${CARLA_INCLUDE_DIRS})
INSTALL(TARGETS carla_native-plugin
LIBRARY DESTINATION "${PLUGIN_DIR}/optional"
RUNTIME DESTINATION "${PLUGIN_DIR}/optional"
)
SET(CARLA_LIBRARIES carla_native-plugin)
# Set parent scope variables so carlarack and carlapatchbay can see them
SET(CARLA_LIBRARIES ${CARLA_LIBRARIES} PARENT_SCOPE)
endif()
if(LMMS_HAVE_CARLA OR LMMS_HAVE_WEAKCARLA)
INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES(${CARLA_INCLUDE_DIRS})
LINK_DIRECTORIES(${CARLA_LIBRARY_DIRS})
@@ -17,4 +40,7 @@ if(LMMS_HAVE_CARLA)
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH TRUE
INSTALL_RPATH "${CARLA_RPATH}")
endif(LMMS_HAVE_CARLA)
IF(LMMS_HAVE_WEAKCARLA)
ADD_DEPENDENCIES(carlabase carla_native-plugin)
ENDIF()
endif()

View File

@@ -0,0 +1,12 @@
// A dummy Carla interface
#include "CarlaNativePlugin.h"
const char* carla_get_library_filename() { return nullptr; }
const char* carla_get_library_folder() { return nullptr; }
const NativePluginDescriptor* carla_get_native_rack_plugin() { return nullptr; }
const NativePluginDescriptor* carla_get_native_patchbay_plugin() { return nullptr; }
const NativePluginDescriptor* carla_get_native_patchbay16_plugin() { return nullptr; }
const NativePluginDescriptor* carla_get_native_patchbay32_plugin() { return nullptr; }
const NativePluginDescriptor* carla_get_native_patchbay64_plugin() { return nullptr; }
const NativePluginDescriptor* carla_get_native_patchbay_cv_plugin() { return nullptr; }
CarlaBackend::CarlaEngine* carla_get_native_plugin_engine(const NativePluginDescriptor* desc, NativePluginHandle handle) { return nullptr; }

View File

@@ -438,7 +438,8 @@ PluginView* CarlaInstrument::instantiateView(QWidget* parent)
// Disable plugin focus per https://bugreports.qt.io/browse/QTBUG-30181
#ifndef CARLA_OS_MAC
if (QWidget* const window = parent->window())
fHost.uiParentId = window->winId();
// TODO: Remove cast; Only needed for Qt4
fHost.uiParentId = (uintptr_t)window->winId();
else
#endif
fHost.uiParentId = 0;

BIN
plugins/carlabase/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -1,4 +1,4 @@
if(LMMS_HAVE_CARLA)
if(LMMS_HAVE_CARLA OR LMMS_HAVE_WEAKCARLA)
ADD_DEFINITIONS(-DCARLA_PLUGIN_PATCHBAY -DCARLA_PLUGIN_SYNTH)
INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES(${CARLA_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}/../carlabase")
@@ -6,4 +6,4 @@ if(LMMS_HAVE_CARLA)
${CARLA_LIBRARY_DIRS})
LINK_LIBRARIES(carlabase)
BUILD_PLUGIN(carlapatchbay carlapatchbay.cpp EMBEDDED_RESOURCES logo.png)
endif(LMMS_HAVE_CARLA)
endif()

View File

@@ -1,4 +1,4 @@
if(LMMS_HAVE_CARLA)
if(LMMS_HAVE_CARLA OR LMMS_HAVE_WEAKCARLA)
ADD_DEFINITIONS(-DCARLA_PLUGIN_RACK -DCARLA_PLUGIN_SYNTH)
INCLUDE(BuildPlugin)
INCLUDE_DIRECTORIES(${CARLA_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}/../carlabase")
@@ -6,4 +6,4 @@ if(LMMS_HAVE_CARLA)
${CARLA_LIBRARY_DIRS})
LINK_LIBRARIES(carlabase)
BUILD_PLUGIN(carlarack carlarack.cpp EMBEDDED_RESOURCES logo.png)
endif(LMMS_HAVE_CARLA)
endif()

View File

@@ -338,6 +338,7 @@ void malletsInstrument::playNote( NotePlayHandle * _n,
Engine::mixer()->processingSampleRate() );
}
m.unlock();
static_cast<malletsSynth *>(_n->m_pluginData)->setPresetIndex(p);
}
const fpp_t frames = _n->framesLeftForCurrentPeriod();
@@ -345,6 +346,7 @@ void malletsInstrument::playNote( NotePlayHandle * _n,
malletsSynth * ps = static_cast<malletsSynth *>( _n->m_pluginData );
ps->setFrequency( freq );
p = ps->presetIndex();
sample_t add_scale = 0.0f;
if( p == 10 && m_isOldVersionModel.value() == true )
@@ -355,9 +357,9 @@ void malletsInstrument::playNote( NotePlayHandle * _n,
for( fpp_t frame = offset; frame < frames + offset; ++frame )
{
_working_buffer[frame][0] = ps->nextSampleLeft() *
( m_scalers[m_presetsModel.value()] + add_scale );
( m_scalers[p] + add_scale );
_working_buffer[frame][1] = ps->nextSampleRight() *
( m_scalers[m_presetsModel.value()] + add_scale );
( m_scalers[p] + add_scale );
}
instrumentTrack()->processAudioBuffer( _working_buffer, frames + offset, _n );
@@ -579,7 +581,6 @@ void malletsInstrumentView::modelChanged()
void malletsInstrumentView::changePreset()
{
malletsInstrument * inst = castModel<malletsInstrument>();
inst->instrumentTrack()->silenceAllNotes();
int _preset = inst->m_presetsModel.value();
if( _preset < 9 )
@@ -614,7 +615,8 @@ malletsSynth::malletsSynth( const StkFloat _pitch,
const StkFloat _control11,
const int _control16,
const uint8_t _delay,
const sample_rate_t _sample_rate )
const sample_rate_t _sample_rate ) :
m_presetIndex(0)
{
try
{
@@ -664,7 +666,8 @@ malletsSynth::malletsSynth( const StkFloat _pitch,
const StkFloat _control11,
const StkFloat _control128,
const uint8_t _delay,
const sample_rate_t _sample_rate )
const sample_rate_t _sample_rate ) :
m_presetIndex(0)
{
try
{
@@ -712,7 +715,8 @@ malletsSynth::malletsSynth( const StkFloat _pitch,
const StkFloat _control64,
const StkFloat _control128,
const uint8_t _delay,
const sample_rate_t _sample_rate )
const sample_rate_t _sample_rate ) :
m_presetIndex(0)
{
try
{

View File

@@ -120,8 +120,19 @@ public:
}
}
inline int presetIndex()
{
return m_presetIndex;
}
inline void setPresetIndex(int presetIndex)
{
m_presetIndex = presetIndex;
}
protected:
int m_presetIndex;
Instrmnt * m_voice;
StkFloat * m_delay;

View File

@@ -1085,7 +1085,7 @@ void RemoteVstPlugin::getParameterDump()
for( int i = 0; i < m_plugin->numParams; ++i )
{
char paramName[32];
char paramName[256];
memset( paramName, 0, sizeof( paramName ) );
pluginDispatch( effGetParamName, i, 0, paramName );
paramName[sizeof(paramName)-1] = 0;
@@ -1299,7 +1299,7 @@ void RemoteVstPlugin::savePreset( const std::string & _file )
if (!isPreset &&!chunky) uIntToFile = (unsigned int) m_plugin->numPrograms;
pBank->numPrograms = endian_swap( uIntToFile );
FILE * stream = F_OPEN_UTF8( _file, "w" );
FILE * stream = F_OPEN_UTF8( _file, "wb" );
if (!stream)
{
fprintf( stderr,
@@ -1357,7 +1357,7 @@ void RemoteVstPlugin::loadPresetFile( const std::string & _file )
unsigned int * pLen = new unsigned int[ 1 ];
unsigned int len = 0;
sBank * pBank = (sBank*) new char[ sizeof( sBank ) ];
FILE * stream = F_OPEN_UTF8( _file, "r" );
FILE * stream = F_OPEN_UTF8( _file, "rb" );
if (!stream)
{
fprintf( stderr,