Merge branch 'stable-1.2'

# Conflicts:
#	.travis/osx..install.sh
#	CMakeLists.txt
#	cmake/apple/install_apple.sh.in
#	doc/lmms.1
#	include/VstSyncController.h
#	plugins/carlabase/carla.h
#	plugins/vestige/vestige.cpp
#	plugins/vst_base/CMakeLists.txt
#	plugins/vst_base/RemoteVstPlugin.cpp
#	plugins/vst_base/Win64/CMakeLists.txt
#	plugins/zynaddsubfx/zynaddsubfx
#	plugins/zynaddsubfx/zynaddsubfx/src/Misc/QtXmlWrapper.cpp
#	src/core/Song.cpp
#	src/core/main.cpp
This commit is contained in:
Hyunjin Song
2018-09-18 09:30:57 +09:00
40 changed files with 584 additions and 305 deletions

View File

@@ -28,6 +28,7 @@
#include "AutomationPattern.h"
#include "ControllerConnection.h"
#include "LocaleHelper.h"
#include "Mixer.h"
#include "ProjectJournal.h"
@@ -180,7 +181,7 @@ void AutomatableModel::loadSettings( const QDomElement& element, const QString&
if( node.isElement() )
{
changeID( node.toElement().attribute( "id" ).toInt() );
setValue( node.toElement().attribute( "value" ).toFloat() );
setValue( LocaleHelper::toFloat( node.toElement().attribute( "value" ) ) );
if( node.toElement().hasAttribute( "scale_type" ) )
{
if( node.toElement().attribute( "scale_type" ) == "linear" )
@@ -201,7 +202,7 @@ void AutomatableModel::loadSettings( const QDomElement& element, const QString&
if( element.hasAttribute( name ) )
// attribute => read the element's value from the attribute list
{
setInitValue( element.attribute( name ).toFloat() );
setInitValue( LocaleHelper::toFloat( element.attribute( name ) ) );
}
else
{

View File

@@ -28,6 +28,7 @@
#include "AutomationPatternView.h"
#include "AutomationTrack.h"
#include "LocaleHelper.h"
#include "Note.h"
#include "ProjectJournal.h"
#include "BBTrackContainer.h"
@@ -144,11 +145,11 @@ void AutomationPattern::setProgressionType(
void AutomationPattern::setTension( QString _new_tension )
{
bool ok;
float nt = _new_tension.toFloat( & ok );
float nt = LocaleHelper::toFloat(_new_tension, & ok);
if( ok && nt > -0.01 && nt < 1.01 )
{
m_tension = _new_tension.toFloat();
m_tension = nt;
}
}
@@ -585,7 +586,7 @@ void AutomationPattern::loadSettings( const QDomElement & _this )
if( element.tagName() == "time" )
{
m_timeMap[element.attribute( "pos" ).toInt()]
= element.attribute( "value" ).toFloat();
= LocaleHelper::toFloat(element.attribute("value"));
}
else if( element.tagName() == "object" )
{

View File

@@ -38,6 +38,7 @@
#include "Effect.h"
#include "embed.h"
#include "GuiApplication.h"
#include "LocaleHelper.h"
#include "PluginFactory.h"
#include "ProjectVersion.h"
#include "SongEditor.h"
@@ -65,37 +66,6 @@ DataFile::typeDescStruct
DataFile::LocaleHelper::LocaleHelper( Mode mode )
{
switch( mode )
{
case ModeLoad:
// set a locale for which QString::fromFloat() returns valid values if
// floating point separator is a comma - otherwise we would fail to load
// older projects made by people from various countries due to their
// locale settings
QLocale::setDefault( QLocale::German );
break;
case ModeSave:
// set default locale to C so that floating point decimals are rendered to
// strings with periods as decimal point instead of commas in some countries
QLocale::setDefault( QLocale::C );
default: break;
}
}
DataFile::LocaleHelper::~LocaleHelper()
{
// revert to original locale
QLocale::setDefault( QLocale::system() );
}
DataFile::DataFile( Type type ) :
QDomDocument( "lmms-project" ),
@@ -416,8 +386,8 @@ void DataFile::upgrade_0_2_1_20070501()
QDomElement el = list.item( i ).toElement();
if( el.attribute( "vol" ) != "" )
{
el.setAttribute( "vol", el.attribute(
"vol" ).toFloat() * 100.0f );
el.setAttribute( "vol", LocaleHelper::toFloat(
el.attribute( "vol" ) ) * 100.0f );
}
else
{
@@ -543,7 +513,7 @@ void DataFile::upgrade_0_2_1_20070508()
QDomElement el = list.item( i ).toElement();
if( el.hasAttribute( "vol" ) )
{
float value = el.attribute( "vol" ).toFloat();
float value = LocaleHelper::toFloat( el.attribute( "vol" ) );
value = roundf( value * 0.585786438f );
el.setAttribute( "vol", value );
}

View File

@@ -831,14 +831,138 @@ void Mixer::runChangesInModel()
}
}
bool Mixer::isAudioDevNameValid(QString name)
{
#ifdef LMMS_HAVE_SDL
if (name == AudioSdl::name())
{
return true;
}
#endif
#ifdef LMMS_HAVE_ALSA
if (name == AudioAlsa::name())
{
return true;
}
#endif
#ifdef LMMS_HAVE_PULSEAUDIO
if (name == AudioPulseAudio::name())
{
return true;
}
#endif
#ifdef LMMS_HAVE_OSS
if (name == AudioOss::name())
{
return true;
}
#endif
#ifdef LMMS_HAVE_SNDIO
if (name == AudioSndio::name())
{
return true;
}
#endif
#ifdef LMMS_HAVE_JACK
if (name == AudioJack::name())
{
return true;
}
#endif
#ifdef LMMS_HAVE_PORTAUDIO
if (name == AudioPortAudio::name())
{
return true;
}
#endif
#ifdef LMMS_HAVE_SOUNDIO
if (name == AudioSoundIo::name())
{
return true;
}
#endif
if (name == AudioDummy::name())
{
return true;
}
return false;
}
bool Mixer::isMidiDevNameValid(QString name)
{
#ifdef LMMS_HAVE_ALSA
if (name == MidiAlsaSeq::name() || name == MidiAlsaRaw::name())
{
return true;
}
#endif
#ifdef LMMS_HAVE_JACK
if (name == MidiJack::name())
{
return true;
}
#endif
#ifdef LMMS_HAVE_OSS
if (name == MidiOss::name())
{
return true;
}
#endif
#ifdef LMMS_HAVE_SNDIO
if (name == MidiSndio::name())
{
return true;
}
#endif
#ifdef LMMS_BUILD_WIN32
if (name == MidiWinMM::name())
{
return true;
}
#endif
#ifdef LMMS_BUILD_APPLE
if (name == MidiApple::name())
{
return true;
}
#endif
if (name == MidiDummy::name())
{
return true;
}
return false;
}
AudioDevice * Mixer::tryAudioDevices()
{
bool success_ful = false;
AudioDevice * dev = NULL;
QString dev_name = ConfigManager::inst()->value( "mixer", "audiodev" );
if( !isAudioDevNameValid( dev_name ) )
{
dev_name = "";
}
m_audioDevStartFailed = false;
@@ -982,6 +1106,10 @@ MidiClient * Mixer::tryMidiClients()
{
QString client_name = ConfigManager::inst()->value( "mixer",
"mididev" );
if( !isMidiDevNameValid( client_name ) )
{
client_name = "";
}
#ifdef LMMS_HAVE_ALSA
if( client_name == MidiAlsaSeq::name() || client_name == "" )

View File

@@ -187,6 +187,8 @@ void Song::savePos()
void Song::processNextBuffer()
{
m_vstSyncController.setPlaybackJumped( false );
// if not playing, nothing to do
if( m_playing == false )
{
@@ -255,10 +257,21 @@ void Song::processNextBuffer()
setToTime(tl->loopBegin());
m_playPos[m_playMode].setTicks(
tl->loopBegin().getTicks() );
m_vstSyncController.setAbsolutePosition(
tl->loopBegin().getTicks() );
m_vstSyncController.setPlaybackJumped( true );
emit updateSampleTracks();
}
}
if( m_playPos[m_playMode].jumped() )
{
m_vstSyncController.setPlaybackJumped( true );
m_playPos[m_playMode].setJumped( false );
}
f_cnt_t framesPlayed = 0;
const float framesPerTick = Engine::framesPerTick();
@@ -312,6 +325,7 @@ void Song::processNextBuffer()
setToTimeByTicks(ticks);
m_vstSyncController.setAbsolutePosition( ticks );
m_vstSyncController.setPlaybackJumped( true );
}
}
m_playPos[m_playMode].setTicks( ticks );
@@ -326,8 +340,12 @@ void Song::processNextBuffer()
// beginning of the range
if( m_playPos[m_playMode] >= tl->loopEnd() )
{
m_playPos[m_playMode].setTicks( tl->loopBegin().getTicks() );
ticks = tl->loopBegin().getTicks();
m_playPos[m_playMode].setTicks( ticks );
setToTime(tl->loopBegin());
m_vstSyncController.setAbsolutePosition( ticks );
m_vstSyncController.setPlaybackJumped( true );
}
else if( m_playPos[m_playMode] == tl->loopEnd() - 1 )
{
@@ -604,6 +622,7 @@ void Song::setPlayPos( tick_t ticks, PlayModes playMode )
m_elapsedMilliSeconds[playMode] += MidiTime::ticksToMilliseconds( ticks - ticksFromPlayMode, getTempo() );
m_playPos[playMode].setTicks( ticks );
m_playPos[playMode].setCurrentFrame( 0.0f );
m_playPos[playMode].setJumped( true );
// send a signal if playposition changes during playback
if( isPlaying() )
@@ -995,8 +1014,6 @@ void Song::loadProject( const QString & fileName )
clearErrors();
DataFile::LocaleHelper localeHelper( DataFile::LocaleHelper::ModeLoad );
Engine::mixer()->requestChangeInModel();
// get the header information from the DOM
@@ -1147,8 +1164,6 @@ void Song::loadProject( const QString & fileName )
// only save current song as _filename and do nothing else
bool Song::saveProjectFile( const QString & filename )
{
DataFile::LocaleHelper localeHelper( DataFile::LocaleHelper::ModeSave );
DataFile dataFile( DataFile::SongProject );
m_tempoModel.saveSettings( dataFile, dataFile.head(), "bpm" );

View File

@@ -141,65 +141,57 @@ void printHelp()
{
printf( "LMMS %s\n"
"Copyright (c) %s\n\n"
"Usage: lmms [ -a ]\n"
" [ -b <bitrate> ]\n"
" [ -c <configfile> ]\n"
" [ -d <in> ]\n"
" [ -f <format> ]\n"
" [ --geometry <geometry> ]\n"
" [ -h ]\n"
" [ -i <method> ]\n"
" [ --import <in> [-e]]\n"
" [ -l ]\n"
" [ -m <mode>]\n"
" [ -o <path> ]\n"
" [ -p <out> ]\n"
" [ -r <project file> ] [ options ]\n"
" [ -s <samplerate> ]\n"
" [ -u <in> <out> ]\n"
" [ -v ]\n"
" [ -x <value> ]\n"
" [ <file to load> ]\n\n"
"-a, --float 32bit float bit depth\n"
"-b, --bitrate <bitrate> Specify output bitrate in KBit/s\n"
" Default: 160.\n"
"-c, --config <configfile> Get the configuration from <configfile>\n"
"-d, --dump <in> Dump XML of compressed file <in>\n"
"-f, --format <format> Specify format of render-output where\n"
" Format is either 'wav', 'flac', 'ogg' or 'mp3'.\n"
" --geometry <geometry> Specify the size and position of the main window\n"
" geometry is <xsizexysize+xoffset+yoffsety>.\n"
"-h, --help Show this usage information and exit.\n"
"-i, --interpolation <method> Specify interpolation method\n"
" Possible values:\n"
" - linear\n"
" - sincfastest (default)\n"
" - sincmedium\n"
" - sincbest\n"
" --import <in> [-e] Import MIDI file <in>.\n"
" If -e is specified lmms exits after importing the file.\n"
"-l, --loop Render as a loop\n"
"-m, --mode Stereo mode used for MP3 export\n"
" Possible values: s, j, m\n"
" s: Stereo\n"
" j: Joint Stereo\n"
" m: Mono\n"
" Default: j\n"
"-o, --output <path> Render into <path>\n"
" For --render, provide a file path\n"
" For --rendertracks, provide a directory path\n"
"-p, --profile <out> Dump profiling information to file <out>\n"
"-r, --render <project file> Render given project file\n"
" --rendertracks <project> Render each track to a different file\n"
"-s, --samplerate <samplerate> Specify output samplerate in Hz\n"
" Range: 44100 (default) to 192000\n"
"-u, --upgrade <in> [out] Upgrade file <in> and save as <out>\n"
" Standard out is used if no output file is specifed\n"
"-v, --version Show version information and exit.\n"
" --allowroot Bypass root user startup check (use with caution).\n"
"-x, --oversampling <value> Specify oversampling\n"
" Possible values: 1, 2, 4, 8\n"
" Default: 2\n\n",
"Usage: lmms [global options...] [<action> [action parameters...]]\n\n"
"Actions:\n"
" <no action> [options...] [<project>] Start LMMS in normal GUI mode\n"
" dump <in> Dump XML of compressed file <in>\n"
" render <project> [options...] Render given project file\n"
" rendertracks <project> [options...] Render each track to a different file\n"
" upgrade <in> [out] Upgrade file <in> and save as <out>\n"
" Standard out is used if no output file\n"
" is specifed\n"
"\nGlobal options:\n"
" --allowroot Bypass root user startup check (use with\n"
" caution).\n"
" -c, --config <configfile> Get the configuration from <configfile>\n"
" -h, --help Show this usage information and exit.\n"
" -v, --version Show version information and exit.\n"
"\nOptions if no action is given:\n"
" --geometry <geometry> Specify the size and position of\n"
" the main window\n"
" geometry is <xsizexysize+xoffset+yoffsety>.\n"
" --import <in> [-e] Import MIDI or Hydrogen file <in>.\n"
" If -e is specified lmms exits after importing the file.\n"
"\nOptions for \"render\" and \"rendertracks\":\n"
" -a, --float Use 32bit float bit depth\n"
" -b, --bitrate <bitrate> Specify output bitrate in KBit/s\n"
" Default: 160.\n"
" -f, --format <format> Specify format of render-output where\n"
" Format is either 'wav', 'flac', 'ogg' or 'mp3'.\n"
" -i, --interpolation <method> Specify interpolation method\n"
" Possible values:\n"
" - linear\n"
" - sincfastest (default)\n"
" - sincmedium\n"
" - sincbest\n"
" -l, --loop Render as a loop\n"
" -m, --mode Stereo mode used for MP3 export\n"
" Possible values: s, j, m\n"
" s: Stereo\n"
" j: Joint Stereo\n"
" m: Mono\n"
" Default: j\n"
" -o, --output <path> Render into <path>\n"
" For \"render\", provide a file path\n"
" For \"rendertracks\", provide a directory path\n"
" If not specified, render will overwrite the input file\n"
" For \"rendertracks\", this might be required\n"
" -p, --profile <out> Dump profiling information to file <out>\n"
" -s, --samplerate <samplerate> Specify output samplerate in Hz\n"
" Range: 44100 (default) to 192000\n"
" -x, --oversampling <value> Specify oversampling\n"
" Possible values: 1, 2, 4, 8\n"
" Default: 2\n\n",
LMMS_VERSION, LMMS_PROJECT_COPYRIGHT );
}
@@ -274,11 +266,11 @@ int main( int argc, char * * argv )
if( arg == "--help" || arg == "-h" ||
arg == "--version" || arg == "-v" ||
arg == "--render" || arg == "-r" )
arg == "render" || arg == "--render" || arg == "-r" )
{
coreOnly = true;
}
else if( arg == "--rendertracks" )
else if( arg == "rendertracks" || arg == "--rendertracks" )
{
coreOnly = true;
renderTracks = true;
@@ -333,7 +325,7 @@ int main( int argc, char * * argv )
printHelp();
return EXIT_SUCCESS;
}
else if( arg == "--upgrade" || arg == "-u" )
else if( arg == "upgrade" || arg == "--upgrade" || arg == "-u")
{
++i;
@@ -369,7 +361,7 @@ int main( int argc, char * * argv )
#endif
}
else if( arg == "--dump" || arg == "-d" )
else if( arg == "dump" || arg == "--dump" || arg == "-d" )
{
++i;
@@ -386,7 +378,8 @@ int main( int argc, char * * argv )
return EXIT_SUCCESS;
}
else if( arg == "--render" || arg == "-r" || arg == "--rendertracks" )
else if( arg == "render" || arg == "--render" || arg == "-r" ||
arg == "rendertracks" || arg == "--rendertracks" )
{
++i;

View File

@@ -590,7 +590,7 @@ void FxMixerView::updateFaders()
{
const float opl = m_fxChannelViews[i]->m_fader->getPeak_L();
const float opr = m_fxChannelViews[i]->m_fader->getPeak_R();
const float fall_off = 1.2;
const float fallOff = 1.07;
if( m->effectChannel(i)->m_peakLeft > opl )
{
m_fxChannelViews[i]->m_fader->setPeak_L( m->effectChannel(i)->m_peakLeft );
@@ -598,7 +598,7 @@ void FxMixerView::updateFaders()
}
else
{
m_fxChannelViews[i]->m_fader->setPeak_L( opl/fall_off );
m_fxChannelViews[i]->m_fader->setPeak_L( opl/fallOff );
}
if( m->effectChannel(i)->m_peakRight > opr )
@@ -608,7 +608,7 @@ void FxMixerView::updateFaders()
}
else
{
m_fxChannelViews[i]->m_fader->setPeak_R( opr/fall_off );
m_fxChannelViews[i]->m_fader->setPeak_R( opr/fallOff );
}
}
}

View File

@@ -213,7 +213,7 @@ MainWindow::MainWindow() :
vbox->addWidget( w );
setCentralWidget( main_widget );
m_updateTimer.start( 1000 / 20, this ); // 20 fps
m_updateTimer.start( 1000 / 60, this ); // 60 fps
if( ConfigManager::inst()->value( "ui", "enableautosave" ).toInt() )
{
@@ -555,7 +555,9 @@ void MainWindow::finalize()
}
// look whether mixer failed to start the audio device selected by the
// user and is using AudioDummy as a fallback
else if( Engine::mixer()->audioDevStartFailed() )
// or the audio device is set to invalid one
else if( Engine::mixer()->audioDevStartFailed() || !Mixer::isAudioDevNameValid(
ConfigManager::inst()->value( "mixer", "audiodev" ) ) )
{
// if so, offer the audio settings section of the setup dialog
SetupDialog sd( SetupDialog::AudioSettings );
@@ -767,7 +769,10 @@ void MainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de )
// first restore the window, as attempting to resize a maximized window causes graphics glitching
_w->setWindowState( _w->windowState() & ~(Qt::WindowMaximized | Qt::WindowMinimized) );
_w->resize( r.size() );
// Check isEmpty() to work around corrupt project files with empty size
if ( ! r.size().isEmpty() ) {
_w->resize( r.size() );
}
_w->move( r.topLeft() );
// set the window to its correct minimized/maximized/restored state

View File

@@ -812,7 +812,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
// If no preferred audio device is saved, save the current one
QString audioDevName =
ConfigManager::inst()->value( "mixer", "audiodev" );
if( audioDevName.length() == 0 )
if( m_audioInterfaces->findText(audioDevName) < 0 )
{
audioDevName = Engine::mixer()->audioDevName();
ConfigManager::inst()->setValue(
@@ -908,7 +908,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
QString midiDevName =
ConfigManager::inst()->value( "mixer", "mididev" );
if( midiDevName.length() == 0 )
if( m_midiInterfaces->findText(midiDevName) < 0 )
{
midiDevName = Engine::mixer()->midiClientName();
ConfigManager::inst()->setValue(

View File

@@ -364,6 +364,7 @@ void TimeLineWidget::mouseMoveEvent( QMouseEvent* event )
Engine::getSong()->setToTime(t, Song::Mode_None);
}
m_pos.setCurrentFrame( 0 );
m_pos.setJumped( true );
updatePosition();
positionMarkerMoved();
break;

View File

@@ -41,6 +41,7 @@
#include "embed.h"
#include "gui_templates.h"
#include "GuiApplication.h"
#include "LocaleHelper.h"
#include "MainWindow.h"
#include "ProjectJournal.h"
#include "Song.h"
@@ -558,7 +559,7 @@ void Knob::dropEvent( QDropEvent * _de )
QString val = StringPairDrag::decodeValue( _de );
if( type == "float_value" )
{
model()->setValue( val.toFloat() );
model()->setValue( LocaleHelper::toFloat(val) );
_de->accept();
}
else if( type == "automatable_model" )

View File

@@ -1611,8 +1611,6 @@ void InstrumentTrackWindow::saveSettingsBtnClicked()
!sfd.selectedFiles().isEmpty() &&
!sfd.selectedFiles().first().isEmpty() )
{
DataFile::LocaleHelper localeHelper( DataFile::LocaleHelper::ModeSave );
DataFile dataFile( DataFile::InstrumentTrackSettings );
m_track->setSimpleSerializing();
m_track->saveSettings( dataFile, dataFile.content() );