00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "gWavMerger-main.h"
00018 #include "Config.h"
00019 #include "Delays.h"
00020
00021
00022 Delays::Delays (Config& cfg_)
00023 : m_config (cfg_)
00024 {
00025 string::size_type idx;
00026 string raw_delay [2];
00027 raw_delay [0] = m_config.get_pre_delay ();
00028 raw_delay [1] = m_config.get_post_delay ();
00029 m_is_rel [0] = false;
00030 m_is_rel [1] = false;
00031
00032 DL((TRACE,"raw_delay[0] = \"%s\"\n",raw_delay[0].c_str ()));
00033 DL((TRACE,"raw_delay[1] = \"%s\"\n",raw_delay[1].c_str ()));
00034
00035 for (int i = 0; i < 2; i++) {
00036 if ((idx = raw_delay [i].find ('x')) == string::npos) {
00037 m_delay [i] = "--duration=" + raw_delay [i].substr (0, idx);
00038 }
00039 else {
00040 m_delay [i] = "--multiplier=" + raw_delay [i].substr (0, idx);
00041 m_is_rel [i] = true;
00042 }
00043 }
00044
00045 DL((TRACE,"m_delay[0] = \"%s\" (%s)\n",
00046 m_delay[0].c_str (), m_is_rel [0] ? "relative" : "seconds"));
00047 DL((TRACE,"m_delay[1] = \"%s\" (%s)\n",
00048 m_delay[1].c_str (), m_is_rel [1] ? "relative" : "seconds"));
00049 }
00050
00051 string
00052
00053 Delays::operator() (int idx_, const string& infile_) const
00054 {
00055 if (idx_ >= 0 && idx_ < 2) {
00056 if (m_is_rel [idx_]) {
00057 return m_delay [idx_] + " --input-file=" + infile_;
00058 }
00059 return m_delay [idx_];
00060 }
00061 else {
00062 return "";
00063 }
00064 }