public AITalkController(string seed, string speaker, string lang = "standard") { config = new Config(seed, lang); waveOuts = new WaveOut[config.numWaveOut]; for (int i = 0; i < config.numWaveOut; i++) { waveOuts[i] = new WaveOut(); } waveOutIndex = 0; AITalk_TConfig tConfig = new AITalk_TConfig(); tConfig.codeAuthSeed = config.codeAuthSeed; tConfig.dirVoiceDBS = $@"Voice"; tConfig.hzVoiceDB = 44100; tConfig.msecTimeout = config.timeout; tConfig.pathLicense = $@"aitalk.lic"; code = AITalkAPI.Init(ref tConfig); if (code != AITalkResultCode.AITALKERR_SUCCESS) { throw new Exception("初期化に失敗"); } // 複数Langは非対応 // AITalkAPI.LangClear(); code = AITalkAPI.LangLoad($@"Lang\{config.lang}"); if (code != AITalkResultCode.AITALKERR_SUCCESS) { throw new Exception("言語ロードに失敗"); } SetSpeaker(speaker); InitializeTuning(); }
private void Init() { AITalk_TConfig config = new AITalk_TConfig(); // サンプルレート try { config.hzVoiceDB = samplingrate; } catch (FormatException ex) { return; } // dbsパス config.dirVoiceDBS = voicepath; // タイムアウト try { config.msecTimeout = timeout; } catch (FormatException ex) { return; } config.pathLicense = licensepath; config.codeAuthSeed = licensekey; config.lenAuthSeed = 0; // AITalkエンジンを初期化する AITalkResultCode res = aitalk.Init(config); }