use -r argument with JACK if realtime is not requested in engine dialog (also applied...
[ArdourMidi.git] / libs / ardour / tape_file_matcher.cc
blob0f8594d7317d477fee2f48a6d82577b9f66ae1e7
1 /*
2 Copyright (C) 2007 Tim Mayberry
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #include "pbd/error.h"
21 #include "ardour/tape_file_matcher.h"
23 #include "i18n.h"
25 using namespace std;
27 namespace {
29 const char* const tape_file_regex_string = X_("/T[0-9][0-9][0-9][0-9]-");
33 namespace ARDOUR {
35 TapeFileMatcher::TapeFileMatcher()
37 int err;
39 if ((err = regcomp (&m_compiled_pattern,
40 tape_file_regex_string, REG_EXTENDED|REG_NOSUB)))
42 char msg[256];
44 regerror (err, &m_compiled_pattern, msg, sizeof (msg));
46 PBD::error << string_compose (_("Cannot compile tape track regexp for use (%1)"), msg) << endmsg;
47 // throw
52 bool
53 TapeFileMatcher::matches (const string& audio_filename) const
56 if (regexec (&m_compiled_pattern, audio_filename.c_str(), 0, 0, 0) == 0)
58 // matches
59 return true;
61 return false;
64 } // namespace ARDOUR