1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 08:30:06 +02:00

Merge branch 'master' into refactor

This commit is contained in:
Paul Licameli 2015-06-04 11:28:59 -04:00
commit 77a79c727c
4 changed files with 44 additions and 24 deletions

View File

@ -961,35 +961,33 @@ void AudacityApp::InitLang( const wxString & lang )
if( mLocale ) if( mLocale )
delete mLocale; delete mLocale;
// LL: I do not know why loading translations fail on the Mac if LANG is not wxString canon = lang;
// set, but for some reason it does. So wrap the creation of wxLocale
// with the default translation.
//
// 2013-09-13: I've checked this again and it is still required. Still
// no idea why.
// 2015-05-26: Disabled the hack since it prevents use of locale specific
// formatting (like comma as decimal separator).
#if defined(__WXMAC__disabled)
wxString oldval;
bool existed;
existed = wxGetEnv(wxT("LANG"), &oldval); #if defined(__WXMAC__)
wxSetEnv(wxT("LANG"), wxT("en_US")); // This should be reviewed again during the wx3 conversion.
// On OSX, the eventual call to setlocale() will fail to completely
// set the locale causing printf() and kin to still use the period
// as the decimal separator when the locale specifies something
// else.
const wxLanguageInfo *info = wxLocale::FindLanguageInfo(lang);
if (info) {
canon = info->CanonicalName;
}
// On OSX, if the LANG environment variable isn't set when
// using a language like Japanese, an assertion will trigger
// because conversion to Japanese from "?" doesn't return a
// valid length, so make OSX happy by defining/overriding
// the LANG environment variable with what the user has
// chosen.
wxSetEnv(wxT("LANG"), canon);
#endif #endif
#if wxCHECK_VERSION(3,0,0) #if wxCHECK_VERSION(3,0,0)
mLocale = new wxLocale(wxT(""), lang, wxT(""), true); mLocale = new wxLocale(wxT(""), canon, wxT(""), true);
#else #else
mLocale = new wxLocale(wxT(""), lang, wxT(""), true, true); mLocale = new wxLocale(wxT(""), canon, wxT(""), true, true);
#endif
#if defined(__WXMAC__disabled)
if (existed) {
wxSetEnv(wxT("LANG"), oldval);
}
else {
wxUnsetEnv(wxT("LANG"));
}
#endif #endif
for(unsigned int i=0; i<audacityPathList.GetCount(); i++) for(unsigned int i=0; i<audacityPathList.GetCount(); i++)

View File

@ -135,6 +135,25 @@ bool EffectAmplify::SetAutomationParameters(EffectAutomationParameters & parms)
return true; return true;
} }
bool EffectAmplify::LoadFactoryDefaults()
{
Init();
mRatioClip = 0.0;
if (mPeak > 0.0)
{
mRatio = 1.0 / mPeak;
mRatioClip = mRatio;
}
else
{
mRatio = 1.0;
}
mCanClip = false;
return TransferDataToWindow();
}
// Effect implementation // Effect implementation
bool EffectAmplify::Init() bool EffectAmplify::Init()

View File

@ -49,6 +49,7 @@ public:
virtual sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen); virtual sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen);
virtual bool GetAutomationParameters(EffectAutomationParameters & parms); virtual bool GetAutomationParameters(EffectAutomationParameters & parms);
virtual bool SetAutomationParameters(EffectAutomationParameters & parms); virtual bool SetAutomationParameters(EffectAutomationParameters & parms);
virtual bool LoadFactoryDefaults();
// Effect implementation // Effect implementation

View File

@ -2465,11 +2465,13 @@ void Effect::Preview(bool dryOnly)
return; return;
} }
mixLeft->Offset(-mixLeft->GetStartTime());
mixLeft->InsertSilence(0.0, mT0); mixLeft->InsertSilence(0.0, mT0);
mixLeft->SetSelected(true); mixLeft->SetSelected(true);
mixLeft->SetDisplay(WaveTrack::NoDisplay); mixLeft->SetDisplay(WaveTrack::NoDisplay);
mTracks->Add(mixLeft); mTracks->Add(mixLeft);
if (mixRight) { if (mixRight) {
mixRight->Offset(-mixRight->GetStartTime());
mixRight->InsertSilence(0.0, mT0); mixRight->InsertSilence(0.0, mT0);
mixRight->SetSelected(true); mixRight->SetSelected(true);
mTracks->Add(mixRight); mTracks->Add(mixRight);