Add Fade-Ends macro. (a new item in Tools menu)
This commit is contained in:
parent
c0dcba66dd
commit
6e40d6d969
|
@ -88,6 +88,7 @@ static const std::pair<const wxChar*, const wxChar*> SpecialCommands[] = {
|
|||
// end CLEANSPEECH remnant
|
||||
|
||||
static const wxString MP3Conversion = wxT("MP3 Conversion");
|
||||
static const wxString FadeEnds = wxT("Fade Ends");
|
||||
|
||||
MacroCommands::MacroCommands()
|
||||
{
|
||||
|
@ -96,10 +97,34 @@ MacroCommands::MacroCommands()
|
|||
|
||||
wxArrayString names = GetNames();
|
||||
|
||||
if (names.Index(MP3Conversion) == wxNOT_FOUND) {
|
||||
AddMacro(MP3Conversion);
|
||||
RestoreMacro(MP3Conversion);
|
||||
WriteMacro(MP3Conversion);
|
||||
wxArrayString defaults;
|
||||
defaults.Add( MP3Conversion );
|
||||
defaults.Add( FadeEnds );
|
||||
|
||||
for( size_t i = 0;i<defaults.Count();i++){
|
||||
wxString name = defaults[i];
|
||||
if (names.Index(name) == wxNOT_FOUND) {
|
||||
AddMacro(name);
|
||||
RestoreMacro(name);
|
||||
WriteMacro(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MacroCommands::RestoreMacro(const wxString & name)
|
||||
{
|
||||
// TIDY-ME: Effects change their name with localisation.
|
||||
// Commands (at least currently) don't. Messy.
|
||||
ResetMacro();
|
||||
if (name == MP3Conversion){
|
||||
AddToMacro( wxT("Normalize") );
|
||||
AddToMacro( wxT("ExportMP3") );
|
||||
} else if (name == FadeEnds ){
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"1\"") );
|
||||
AddToMacro( wxT("FadeIn") );
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"1\" FromEnd=\"1\"") );
|
||||
AddToMacro( wxT("FadeOut") );
|
||||
AddToMacro( wxT("Select: Start=\"0\" End=\"0\"") );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,14 +267,6 @@ bool MacroCommands::RenameMacro(const wxString & oldchain, const wxString & newc
|
|||
return wxRenameFile(oname.GetFullPath(), nname.GetFullPath());
|
||||
}
|
||||
|
||||
void MacroCommands::SetWavToMp3Macro() // a function per default chain? This is flawed design! MJS
|
||||
{
|
||||
ResetMacro();
|
||||
|
||||
AddToMacro( wxT("Normalize") );
|
||||
AddToMacro( wxT("ExportMP3") );
|
||||
}
|
||||
|
||||
// Gets all commands that are valid for this mode.
|
||||
auto MacroCommands::GetAllCommands() -> CommandNameVector
|
||||
{
|
||||
|
@ -865,14 +882,7 @@ bool MacroCommands::IsFixed(const wxString & name)
|
|||
return false;
|
||||
}
|
||||
|
||||
void MacroCommands::RestoreMacro(const wxString & name)
|
||||
{
|
||||
// TIDY-ME: Effects change their name with localisation.
|
||||
// Commands (at least currently) don't. Messy.
|
||||
|
||||
if (name == MP3Conversion)
|
||||
SetWavToMp3Macro();
|
||||
}
|
||||
|
||||
void MacroCommands::Split(const wxString & str, wxString & command, wxString & param)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ class MacroCommands final {
|
|||
// These commands do not depend on the command list.
|
||||
static wxArrayString GetNames();
|
||||
|
||||
// A pair of user-visible name, and internal string identifier
|
||||
// A triple of user-visible name, internal string identifier and type/help string.
|
||||
using CommandName = std::tuple<wxString, wxString, wxString>;
|
||||
using CommandNameVector = std::vector<CommandName>;
|
||||
// Result is sorted by user-visible name
|
||||
|
@ -56,6 +56,7 @@ class MacroCommands final {
|
|||
// These commands do depend on the command list.
|
||||
void ResetMacro();
|
||||
|
||||
void RestoreMacro(const wxString & name);
|
||||
bool ReadMacro(const wxString & macro);
|
||||
bool WriteMacro(const wxString & macro);
|
||||
bool AddMacro(const wxString & macro);
|
||||
|
@ -71,12 +72,8 @@ class MacroCommands final {
|
|||
wxString GetMessage(){ return mMessage;};
|
||||
void AddToMessage(const wxString & msgIn ){ mMessage += msgIn;};
|
||||
|
||||
void SetWavToMp3Macro();
|
||||
|
||||
bool IsFixed(const wxString & name);
|
||||
|
||||
void RestoreMacro(const wxString & name);
|
||||
|
||||
void Split(const wxString & str, wxString & command, wxString & param);
|
||||
wxString Join(const wxString & command, const wxString & param);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user