Mercurial > hg > c4dm-chord-transcriptions
comparison chordtools/syntaxcheck.m @ 1:8973548174c1 tip
adding tools to repo
author | christopherh |
---|---|
date | Mon, 06 May 2013 14:43:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:0a4ad3e72e75 | 1:8973548174c1 |
---|---|
1 % | |
2 %SYNTAXCHECK Checks symbol for correct syntax. | |
3 % | |
4 % [success, errormessage] = syntaxcheck(chordsymbol, {verbose}) | |
5 % | |
6 % Checks symbol for correct syntax and checks for valid note, shorthand | |
7 % and interval values. | |
8 % | |
9 % calls getchordinfo | |
10 % | |
11 % Success = 1 if symbol has correct syntax, 0 otherwise. | |
12 % | |
13 % If optional argument 'verbose' is 1, function prints any errormessage to | |
14 % the screen. | |
15 % | |
16 % Returns: chordinfo (struct) | |
17 % success (boolean) true or false for correct syntax | |
18 % errormessage (string) | |
19 % | |
20 % See also: getchordinfo | |
21 % | |
22 % Author: Christopher Harte, March 2009 | |
23 % | |
24 % Copyright: Centre for Digital Music, Queen Mary University of London 2005 | |
25 % | |
26 % This file is part of the C4DM Chord Toolkit V2.0 | |
27 % | |
28 % The C4DM Chord Toolkit is free software; you can redistribute it and/or | |
29 % modify it under the terms of the GNU General Public License as published | |
30 % by the Free Software Foundation; either version 2 of the License, or | |
31 % (at your option) any later version. | |
32 % | |
33 % The C4DM Chord Toolkit is distributed in the hope that it will be useful, | |
34 % but WITHOUT ANY WARRANTY; without even the implied warranty of | |
35 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
36 % GNU General Public License for more details. | |
37 % | |
38 % You should have received a copy of the GNU General Public License | |
39 % along with the C4DM Toolkit; if not, write to the Free Software | |
40 % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
41 | |
42 % | |
43 function [success, errormessage] = syntaxcheck(chordsymbol, verbose) | |
44 | |
45 if nargin < 2 | |
46 verbose = 0; | |
47 end | |
48 | |
49 errormessage = ''; | |
50 chordinfo = []; | |
51 | |
52 success = 0; | |
53 | |
54 [root,short,intervals,bass, success, errormessage] = getchordinfo(chordsymbol,verbose); | |
55 | |
56 if (success ==0) && (verbose == 1) | |
57 fprintf(1,errormessage); | |
58 end |