From afb0777a6ef2cfd3d0fd547b31994de6baa0e1de Mon Sep 17 00:00:00 2001 From: tresf Date: Sun, 8 Feb 2015 18:22:14 -0500 Subject: [PATCH] Remove "(bad latency!)" warning from PulseAudio --- data/locale/ca.ts | 2 +- data/locale/cs.ts | 2 +- data/locale/de.ts | 2 +- data/locale/en.ts | 2 +- data/locale/es.ts | 2 +- data/locale/fa.ts | 2 +- data/locale/fr.ts | 2 +- data/locale/gl.ts | 2 +- data/locale/it.ts | 2 +- data/locale/ja.ts | 2 +- data/locale/ko.ts | 2 +- data/locale/nl.ts | 2 +- data/locale/pl.ts | 2 +- data/locale/pt.ts | 2 +- data/locale/ru.ts | 2 +- data/locale/sv.ts | 2 +- data/locale/zh.ts | 2 +- include/AudioPulseAudio.h | 2 +- include/ConfigManager.h | 15 +++++++++++ src/core/ConfigManager.cpp | 52 ++++++++++++++++++++++++++++++-------- 20 files changed, 75 insertions(+), 28 deletions(-) diff --git a/data/locale/ca.ts b/data/locale/ca.ts index f59930462..c58fb75f3 100644 --- a/data/locale/ca.ts +++ b/data/locale/ca.ts @@ -8521,7 +8521,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/cs.ts b/data/locale/cs.ts index 12bc754bb..f75924349 100644 --- a/data/locale/cs.ts +++ b/data/locale/cs.ts @@ -8523,7 +8523,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/de.ts b/data/locale/de.ts index f6f4194cd..fb91f0ed7 100644 --- a/data/locale/de.ts +++ b/data/locale/de.ts @@ -8568,7 +8568,7 @@ Dieser Chip wurde in Commodore 64 Computern genutzt. ALSA Raw-MIDI (Advanced Linux Sound Architecture) - PulseAudio (bad latency!) + PulseAudio PulseAudio (Schlechte Latenz!) diff --git a/data/locale/en.ts b/data/locale/en.ts index 49f9dcbd3..87db27019 100644 --- a/data/locale/en.ts +++ b/data/locale/en.ts @@ -8502,7 +8502,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/es.ts b/data/locale/es.ts index 5394c8973..37fca5929 100644 --- a/data/locale/es.ts +++ b/data/locale/es.ts @@ -8503,7 +8503,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/fa.ts b/data/locale/fa.ts index 50b3a3fad..1dc48d62a 100644 --- a/data/locale/fa.ts +++ b/data/locale/fa.ts @@ -8502,7 +8502,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/fr.ts b/data/locale/fr.ts index b2570b07c..ef8fc4177 100644 --- a/data/locale/fr.ts +++ b/data/locale/fr.ts @@ -8537,7 +8537,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/gl.ts b/data/locale/gl.ts index c06249d2d..d418fe848 100644 --- a/data/locale/gl.ts +++ b/data/locale/gl.ts @@ -8536,7 +8536,7 @@ Este chip empregábase no computador Commodore 64. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/it.ts b/data/locale/it.ts index fe49348ab..b8e2fcd24 100644 --- a/data/locale/it.ts +++ b/data/locale/it.ts @@ -8561,7 +8561,7 @@ Questo chip era utilizzato nel Commode 64. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/ja.ts b/data/locale/ja.ts index a568ffbbf..b5aa1586d 100644 --- a/data/locale/ja.ts +++ b/data/locale/ja.ts @@ -8538,7 +8538,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/ko.ts b/data/locale/ko.ts index ad7ee413f..200af7bb2 100644 --- a/data/locale/ko.ts +++ b/data/locale/ko.ts @@ -8507,7 +8507,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/nl.ts b/data/locale/nl.ts index e77143ee9..f775c1985 100644 --- a/data/locale/nl.ts +++ b/data/locale/nl.ts @@ -8506,7 +8506,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/pl.ts b/data/locale/pl.ts index 9cab92906..18a3899ea 100644 --- a/data/locale/pl.ts +++ b/data/locale/pl.ts @@ -8542,7 +8542,7 @@ Te układy scalone były stosowane w komputerach Commodore 64. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/pt.ts b/data/locale/pt.ts index ecc6bfab7..ae4e5d5ab 100644 --- a/data/locale/pt.ts +++ b/data/locale/pt.ts @@ -8540,7 +8540,7 @@ Este chip foi utilizado no computador Commodore 64. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/ru.ts b/data/locale/ru.ts index 950529e06..e7d086300 100644 --- a/data/locale/ru.ts +++ b/data/locale/ru.ts @@ -8598,7 +8598,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio PulseAudio (большая задержка!) diff --git a/data/locale/sv.ts b/data/locale/sv.ts index 85198a1eb..2cc7d6c64 100644 --- a/data/locale/sv.ts +++ b/data/locale/sv.ts @@ -8505,7 +8505,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/data/locale/zh.ts b/data/locale/zh.ts index 48e18d2bf..8978c1aa3 100644 --- a/data/locale/zh.ts +++ b/data/locale/zh.ts @@ -8517,7 +8517,7 @@ This chip was used in the Commodore 64 computer. - PulseAudio (bad latency!) + PulseAudio diff --git a/include/AudioPulseAudio.h b/include/AudioPulseAudio.h index f8893733c..5a8504d1f 100644 --- a/include/AudioPulseAudio.h +++ b/include/AudioPulseAudio.h @@ -46,7 +46,7 @@ public: inline static QString name() { - return QT_TRANSLATE_NOOP( "setupWidget", "PulseAudio (bad latency!)" ); + return QT_TRANSLATE_NOOP( "setupWidget", "PulseAudio" ); } static QString probeDevice(); diff --git a/include/ConfigManager.h b/include/ConfigManager.h index 0db1cd789..36fbdebb5 100644 --- a/include/ConfigManager.h +++ b/include/ConfigManager.h @@ -35,6 +35,7 @@ #include "export.h" #include "MemoryManager.h" +#include "lmmsversion.h" class Engine; @@ -100,6 +101,11 @@ public: return dataDir() + SAMPLES_PATH; } + QString defaultVersion() const + { + return LMMS_VERSION; + } + QString defaultArtworkDir() const { return m_dataDir + DEFAULT_THEME_PATH; @@ -144,6 +150,11 @@ public: { return m_workingDir + "recover.mmp"; } + + const QString & version() const + { + return m_version; + } #ifdef LMMS_HAVE_STK const QString & stkDir() const @@ -185,6 +196,7 @@ public: void setArtworkDir( const QString & _ad ); void setFLDir( const QString & _fd ); void setLADSPADir( const QString & _fd ); + void setVersion( const QString & _cv ); void setSTKDir( const QString & _fd ); void setDefaultSoundfont( const QString & _sf ); void setBackgroundArtwork( const QString & _ba ); @@ -197,6 +209,8 @@ private: ConfigManager( const ConfigManager & _c ); ~ConfigManager(); + + void upgrade(); const QString m_lmmsRcFile; QString m_workingDir; @@ -206,6 +220,7 @@ private: QString m_vstDir; QString m_flDir; QString m_ladDir; + QString m_version; #ifdef LMMS_HAVE_STK QString m_stkDir; #endif diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index 7fb9cbc5e..1254977f0 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -28,9 +28,9 @@ #include #include -#include "lmmsversion.h" #include "ConfigManager.h" #include "MainWindow.h" +#include "ProjectVersion.h" static inline QString ensureTrailingSlash( const QString & _s ) @@ -66,7 +66,8 @@ ConfigManager::ConfigManager() : m_pluginDir( qApp->applicationDirPath() + '/' + PLUGIN_DIR ), #endif m_vstDir( m_workingDir + "vst" + QDir::separator() ), - m_flDir( QDir::home().absolutePath() ) + m_flDir( QDir::home().absolutePath() ), + m_version( defaultVersion() ) { } @@ -81,6 +82,36 @@ ConfigManager::~ConfigManager() +void ConfigManager::upgrade() +{ + // Skip the upgrade if versions match + if ( m_version == LMMS_VERSION ) + { + return; + } + + ProjectVersion createdWith = m_version; + + // Remove trailing " (bad latency!)" string which was once saved with PulseAudio + if ( createdWith.setCompareType(Build) < "1.1.90" ) + { + if( value( "mixer", "audiodev" ).startsWith( "PulseAudio (" ) ) + { + setValue("mixer", "audiodev", "PulseAudio"); + } + } + + // Don't use old themes as they break the UI (i.e. 0.4 != 1.0, etc) + if ( createdWith.setCompareType(Minor) != LMMS_VERSION ) + { + m_artworkDir = defaultArtworkDir(); + } + + // Bump the version, now that we are upgraded + m_version = LMMS_VERSION; +} + + void ConfigManager::setWorkingDir( const QString & _wd ) { m_workingDir = ensureTrailingSlash( _wd ); @@ -251,6 +282,11 @@ void ConfigManager::loadConfigFile() QDomNode node = root.firstChild(); + // Cache the config version for upgrade() + if ( !root.attribute( "version" ).isNull() ) { + m_version = root.attribute( "version" ); + } + // create the settings-map out of the DOM while( !node.isNull() ) { @@ -289,13 +325,7 @@ void ConfigManager::loadConfigFile() node = node.nextSibling(); } - // don't use dated theme folders as they break the UI (i.e. 0.4 != 1.0, etc) - bool use_artwork_path = - root.attribute( "version" ).startsWith( - QString::number( LMMS_VERSION_MAJOR ) + "." + - QString::number( LMMS_VERSION_MINOR ) ); - - if( use_artwork_path && value( "paths", "artwork" ) != "" ) + if( value( "paths", "artwork" ) != "" ) { m_artworkDir = value( "paths", "artwork" ); if( !QDir( m_artworkDir ).exists() ) @@ -396,6 +426,8 @@ void ConfigManager::loadConfigFile() QDir().mkpath( userSamplesDir() ); QDir().mkpath( userPresetsDir() ); } + + upgrade(); } @@ -419,7 +451,7 @@ void ConfigManager::saveConfigFile() QDomDocument doc( "lmms-config-file" ); QDomElement lmms_config = doc.createElement( "lmms" ); - lmms_config.setAttribute( "version", LMMS_VERSION ); + lmms_config.setAttribute( "version", m_version ); doc.appendChild( lmms_config ); for( settingsMap::iterator it = m_settings.begin();