@@ -57,15 +57,15 @@ public IEnumerable<Voicebank> SearchAll() {
5757 return result ;
5858 }
5959
60- public static void LoadVoicebank ( Voicebank voicebank ) {
60+ public static void LoadVoicebank ( Voicebank voicebank , bool isTest ) {
6161 LoadInfo ( voicebank , voicebank . File , voicebank . BasePath ) ;
62- LoadOtoSets ( voicebank , Path . GetDirectoryName ( voicebank . File ) ) ;
62+ LoadOtoSets ( voicebank , Path . GetDirectoryName ( voicebank . File ) , isTest ) ;
6363 }
6464
65- public static void LoadOtoSets ( Voicebank voicebank , string dirPath ) {
65+ public static void LoadOtoSets ( Voicebank voicebank , string dirPath , bool isTest ) {
6666 var otoFile = Path . Combine ( dirPath , kOtoIni ) ;
6767 if ( File . Exists ( otoFile ) ) {
68- var otoSet = ParseOtoSet ( otoFile , voicebank . TextFileEncoding ) ;
68+ var otoSet = ParseOtoSet ( otoFile , voicebank . TextFileEncoding , isTest ) ;
6969 var voicebankDir = Path . GetDirectoryName ( voicebank . File ) ;
7070 otoSet . Name = Path . GetRelativePath ( voicebankDir , dirPath ) ;
7171 if ( otoSet . Name == "." ) {
@@ -75,7 +75,7 @@ public static void LoadOtoSets(Voicebank voicebank, string dirPath) {
7575 }
7676 var dirs = Directory . GetDirectories ( dirPath ) ;
7777 foreach ( var dir in dirs ) {
78- LoadOtoSets ( voicebank , dir ) ;
78+ LoadOtoSets ( voicebank , dir , isTest ) ;
7979 }
8080 }
8181
@@ -288,10 +288,10 @@ public static Dictionary<Tuple<string, string>, SortedSet<int>> ParsePrefixMap(S
288288 }
289289 }
290290
291- public static OtoSet ParseOtoSet ( string filePath , Encoding encoding ) {
291+ public static OtoSet ParseOtoSet ( string filePath , Encoding encoding , bool isTest ) {
292292 try {
293293 using ( var stream = File . OpenRead ( filePath ) ) {
294- var otoSet = ParseOtoSet ( stream , filePath , encoding ) ;
294+ var otoSet = ParseOtoSet ( stream , filePath , encoding , isTest ) ;
295295 AddAliasForMissingFiles ( otoSet ) ;
296296 return otoSet ;
297297 }
@@ -301,7 +301,7 @@ public static OtoSet ParseOtoSet(string filePath, Encoding encoding) {
301301 return null ;
302302 }
303303
304- public static OtoSet ParseOtoSet ( Stream stream , string filePath , Encoding encoding ) {
304+ public static OtoSet ParseOtoSet ( Stream stream , string filePath , Encoding encoding , bool isTest ) {
305305 OtoSet otoSet ;
306306 using ( var reader = new StreamReader ( stream , encoding ) ) {
307307 var trace = new FileTrace { file = filePath , lineNumber = 0 } ;
@@ -312,7 +312,7 @@ public static OtoSet ParseOtoSet(Stream stream, string filePath, Encoding encodi
312312 var line = reader . ReadLine ( ) . Trim ( ) ;
313313 trace . line = line ;
314314 try {
315- Oto oto = ParseOto ( line , trace ) ;
315+ Oto oto = ParseOto ( line , trace , isTest ) ;
316316 if ( oto != null ) {
317317 otoSet . Otos . Add ( oto ) ;
318318 }
@@ -346,7 +346,7 @@ static void AddAliasForMissingFiles(OtoSet otoSet) {
346346 }
347347 }
348348
349- static Oto ParseOto ( string line , FileTrace trace ) {
349+ static Oto ParseOto ( string line , FileTrace trace , bool isTest ) {
350350 const string format = "<wav>=<alias>,<offset>,<consonant>,<cutoff>,<preutter>,<overlap>" ;
351351 var oto = new Oto {
352352 FileTrace = new FileTrace ( trace ) ,
@@ -386,13 +386,13 @@ static Oto ParseOto(string line, FileTrace trace) {
386386 oto . Error = $ "{ trace } \n Failed to parse overlap. Format is { format } .";
387387 return oto ;
388388 }
389- #if DEBUG == false
390- string path = Path . Combine ( Path . GetDirectoryName ( trace . file ) , oto . Wav ) ;
391- if ( ! File . Exists ( path ) ) {
392- oto . Error = $ "{ trace } \n Sound file missing. { path } ";
393- return oto ;
389+ if ( ! isTest ) {
390+ string path = Path . Combine ( Path . GetDirectoryName ( trace . file ) , oto . Wav ) ;
391+ if ( ! File . Exists ( path ) ) {
392+ oto . Error = $ "{ trace } \n Sound file missing. { path } ";
393+ return oto ;
394+ }
394395 }
395- #endif
396396 oto . IsValid = true ;
397397 return oto ;
398398 }
0 commit comments