File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
marytts-runtime/src/main/java/marytts/config Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,15 @@ public static void checkConsistency() throws MaryConfigurationException {
71
71
+ "', but there is no corresponding language config." );
72
72
}
73
73
}
74
+ // Check that for each synthesis config, we have a matching synthesis class
75
+ if (getSynthesisConfigs () == null ){
76
+ throw new MaryConfigurationException ("No synthesizer config" );
77
+ }
78
+ for (SynthesisConfig sc : getSynthesisConfigs ()) {
79
+ if (MaryProperties .synthesizerClasses ().contains (sc .getSynthesisName ())) {
80
+ throw new MaryConfigurationException ("Synthesizer '" + sc .getSynthesisName () + "' is not in config properties." );
81
+ }
82
+ }
74
83
}
75
84
76
85
public static int countConfigs () {
@@ -145,6 +154,17 @@ public static LanguageConfig getLanguageConfig(Locale locale) {
145
154
return null ;
146
155
}
147
156
157
+ public static Iterable <SynthesisConfig > getSynthesisConfigs () {
158
+ Set <SynthesisConfig > scs = new HashSet <SynthesisConfig >();
159
+ for (MaryConfig mc : configLoader ) {
160
+ if (mc .isSynthesisConfig ()) {
161
+ SynthesisConfig sc = (SynthesisConfig ) mc ;
162
+ scs .add (sc );
163
+ }
164
+ }
165
+ return scs ;
166
+ }
167
+
148
168
/**
149
169
* Get the voice config for the given voice name, or null if there is no such voice config.
150
170
*
Original file line number Diff line number Diff line change @@ -33,10 +33,22 @@ public class SynthesisConfig extends MaryConfig {
33
33
34
34
public SynthesisConfig (InputStream propertyStream ) throws MaryConfigurationException {
35
35
super (propertyStream );
36
+ if (getSynthesisName () == null ) {
37
+ throw new MaryConfigurationException ("No synthesizer class defined in config file" );
38
+ }
36
39
}
37
40
38
41
@ Override
39
42
public boolean isSynthesisConfig () {
40
43
return true ;
41
44
}
45
+
46
+ /**
47
+ * The synthesizer's name.
48
+ *
49
+ * @return
50
+ */
51
+ public String getSynthesisName () {
52
+ return getProperties ().getProperty ("synthesizers.classes.list" );
53
+ }
42
54
}
You can’t perform that action at this time.
0 commit comments