Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

/home/vlg/develop/gwavmerger/src/Delays.cpp

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //------------------------------------------------------------------------------
00003 //                              Delays.cpp
00004 //------------------------------------------------------------------------------
00005 // $Id: Delays.cpp,v 1.6 2003/02/07 05:15:09 vlg Exp $
00006 //------------------------------------------------------------------------------
00007 //  Copyright (c) 2001 by Vladislav Grinchenko
00008 //
00009 //  This program is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU General Public License
00011 //  as published by the Free Software Foundation; either version
00012 //  2 of the License, or (at your option) any later version.
00013 //------------------------------------------------------------------------------
00014 // Created: 05/16/2002
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) {   // seconds
00037             m_delay [i] = "--duration=" + raw_delay [i].substr (0, idx);
00038         }
00039         else {                                               // relative
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 }

Generated on Tue Feb 11 23:05:19 2003 for gwavmerger by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002