From 9f5f5e36ad35684b4de9afc8906e1d0a0f3110e3 Mon Sep 17 00:00:00 2001 From: "stevethefiddle@gmail.com" Date: Thu, 25 Dec 2014 18:22:59 +0000 Subject: [PATCH] Experimental Nyquist time/date property (idefed out). --- src/Experimental.h | 3 +++ src/effects/nyquist/Nyquist.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/Experimental.h b/src/Experimental.h index c761c158e..9b96aa4c8 100644 --- a/src/Experimental.h +++ b/src/Experimental.h @@ -200,4 +200,7 @@ // Define to enable Nyquist audio clip boundary control (Steve Daulton Dec 2014) // #define EXPERIMENTAL_NYQUIST_SPLIT_CONTROL +// Define to enable Nyquist time/date property list +// #define EXPERIMENTAL_NYQUIST_TIME_PROPERTY + #endif diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 7930f19d3..35186f44a 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -50,6 +50,10 @@ effects from this one class. #include #include +#if defined EXPERIMENTAL_NYQUIST_TIME_PROPERTY +#include +#endif + #include "../../AudacityApp.h" #include "../../FileNames.h" #include "../../Internat.h" @@ -515,6 +519,32 @@ bool EffectNyquist::Process() } mProps += wxString::Format(wxT("(putprop '*SYSTEM-DIR* (list %s) 'PLUGIN)\n"), list.RemoveLast().c_str()); +#if defined EXPERIMENTAL_NYQUIST_TIME_PROPERTY + // Date and time: + wxDateTime now = wxDateTime::Now(); + int year = now.GetYear(); + int doy = now.GetDayOfYear(); + int dom = now.GetDay(); + // enumerated constants + wxDateTime::Month month = now.GetMonth(); + wxDateTime::WeekDay day = now.GetWeekDay(); + + // Date/time as a list: year, day of year, hour, minute, seconds + mProps += wxString::Format(wxT("(setf *SYSTEM-TIME* (list %d %d %d %d %d))\n"), + year, doy, now.GetHour(), now.GetMinute(), now.GetSecond()); + + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'DATE)\n"), now.FormatDate().c_str()); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'TIME)\n"), now.FormatTime().c_str()); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'ISO-DATE)\n"), now.FormatISODate().c_str()); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'ISO-TIME)\n"), now.FormatISOTime().c_str()); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* %d 'YEAR)\n"), year); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* %d 'DAY)\n"), dom); // day of month + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* %d 'MONTH)\n"), month); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'MONTH-NAME)\n"), now.GetMonthName(month).c_str()); + mProps += wxString::Format(wxT("(putprop '*SYSTEM-TIME* \"%s\" 'DAY-NAME)\n"), now.GetWeekDayName(day).c_str()); +#endif + + TrackListIterator all(project->GetTracks()); Track *t; int numTracks = 0;