[vConnect/trunk/stand2.0] modified: stand.h; PATH_SEPARATORを削除
@@ -18,18 +18,3 @@ | ||
18 | 18 | mutex_t hMutex = NULL; |
19 | 19 | mutex_t hFFTWMutex = NULL; |
20 | 20 | #endif |
21 | - | |
22 | -/** | |
23 | - * str中の文字列searchをreplaceに置換する | |
24 | - */ | |
25 | -void string_replace( string_t& str, string_t search, string_t replace ) | |
26 | -{ | |
27 | - int indx = str.find( search, 0 ); | |
28 | - int slen = search.length(); | |
29 | - int rlen = replace.length(); | |
30 | - while( indx != string_t::npos ) | |
31 | - { | |
32 | - str.replace( indx, slen, replace ); | |
33 | - indx = str.find( search, indx - slen + rlen + 1 ); | |
34 | - } | |
35 | -} |
@@ -28,15 +28,15 @@ | ||
28 | 28 | * @param dstDir 出力先ディレクトリ名. |
29 | 29 | * @returns 分析に成功した場合true,それ以外はfalseを返します. |
30 | 30 | */ |
31 | - bool convert( const char *otoIni, const char *dstDir ) | |
31 | + bool convert( const char *otoIni, const char *directory ) | |
32 | 32 | { |
33 | - string srcDir = otoIni; | |
34 | - string dstDir_s = dstDir; | |
35 | - srcDir = srcDir.substr( 0, srcDir.rfind( PATH_SEPARATOR ) ); | |
33 | + string sourceDirectory = Path::getDirectoryName( otoIni ); | |
34 | + string destinationDirectory = directory; | |
36 | 35 | int count = 0; |
37 | 36 | |
38 | 37 | TextInputStream reader( otoIni, "Shift_JIS" ); |
39 | - TextOutputStream writer( (dstDir_s + "oto.ini").c_str(), "Shift_JIS", "\x0D\x0A" ); | |
38 | + string destinationOtoIni = Path::combine( destinationDirectory, "oto.ini" ); | |
39 | + TextOutputStream writer( destinationOtoIni, "Shift_JIS", "\x0D\x0A" ); | |
40 | 40 | while( reader.ready() ){ |
41 | 41 | string buffer = reader.readLine(); |
42 | 42 | if( buffer.length() == 0 ){ |
@@ -44,7 +44,7 @@ | ||
44 | 44 | } |
45 | 45 | count++; |
46 | 46 | |
47 | - string line = this->processRecord( buffer, count, srcDir, dstDir_s ); | |
47 | + string line = this->processRecord( buffer, count, sourceDirectory, destinationDirectory ); | |
48 | 48 | |
49 | 49 | if( line.length() > 0 ){ |
50 | 50 | writer.writeLine( line ); |
@@ -91,8 +91,9 @@ | ||
91 | 91 | cerr << "Begin analysis : " << alias << " @ " << fileName << endl; |
92 | 92 | |
93 | 93 | waveFileEx waveFile; |
94 | - if( waveFile.readWaveFile( sourceDirectory + PATH_SEPARATOR + fileName ) != 1 ){ | |
95 | - cout << "error ; can't open the file, " << (sourceDirectory + PATH_SEPARATOR + fileName).c_str() << endl; | |
94 | + string waveFilePath = Path::combine( sourceDirectory, fileName ); | |
95 | + if( waveFile.readWaveFile( waveFilePath ) != 1 ){ | |
96 | + cout << "error ; can't open the file, " << waveFilePath << endl; | |
96 | 97 | return ""; |
97 | 98 | } |
98 | 99 | int waveLength = waveFile.getWaveLength( leftBlank, rightBlank ); |
@@ -125,11 +126,11 @@ | ||
125 | 126 | phoneme.computeWave( wave, waveLength, 44100, 2.0 ); |
126 | 127 | cerr << " Done. Elapsed time = " << (clock() - cl) << "[ms]" << endl; |
127 | 128 | |
128 | - fileName = destinationDirectory + vvdName; | |
129 | - if( phoneme.writePhoneme( fileName.c_str() ) ){ | |
130 | - cerr << "Wrote file : " << fileName << endl; | |
129 | + string vvdFilePath = Path::combine( destinationDirectory, vvdName ); | |
130 | + if( phoneme.writePhoneme( vvdFilePath.c_str() ) ){ | |
131 | + cerr << "Wrote file : " << vvdFilePath << endl; | |
131 | 132 | }else{ |
132 | - cerr << "Error. Failed to write : " << fileName << endl; | |
133 | + cerr << "Error. Failed to write : " << vvdFilePath << endl; | |
133 | 134 | } |
134 | 135 | cerr << "====" << endl; |
135 | 136 |
@@ -184,18 +184,6 @@ | ||
184 | 184 | #endif |
185 | 185 | #endif |
186 | 186 | |
187 | -// パスの区切り文字を決める | |
188 | -const string_t PATH_SEPARATOR_SLANT = _T("/"); | |
189 | -const string_t PATH_SEPARATOR_BACKSLASH = _T("\\"); | |
190 | -const int NUM_PSUDE_PATH_SEPARATOR = 2; | |
191 | -// ウォン記号と円記号.円記号の方はバックスラッシュの代替としての円記号ではなく,Unicodeのマジな円記号なので書き換えるとき注意 | |
192 | -static string_t PSUDE_PATH_SEPARATOR[NUM_PSUDE_PATH_SEPARATOR] = { _T("¥"), _T("₩") }; | |
193 | -#ifdef STND_OS_WIN | |
194 | -const string_t PATH_SEPARATOR = PATH_SEPARATOR_BACKSLASH; | |
195 | -#else | |
196 | -const string_t PATH_SEPARATOR = PATH_SEPARATOR_SLANT; | |
197 | -#endif | |
198 | - | |
199 | 187 | #define LINEBUFF_LEN 4096 |
200 | 188 | |
201 | 189 | /* マルチスレッド実装の種類 動かせる? |