1- //! ` CeVIO AI` APIのメイン実装
1+ //! CeVIO AI APIのメイン実装
22//!
3- //! このモジュールは`CeVIO AI`との通信を行うメインの構造体と機能を提供します 。
3+ //! このモジュールはCeVIO AIとの通信を行うメインの構造体と機能を提供します 。
44//! COM(Component Object Model)を使用してCeVIO AIと安全に通信し、
55//! 音声合成、パラメータ制御、キャスト管理などの機能を提供します。
66
@@ -24,25 +24,25 @@ use serde::{Deserialize, Serialize};
2424
2525use crate :: {
2626 com_manager:: ComGuard ,
27- error:: { CevioError , Result } ,
27+ error:: { CevioAIError , Result } ,
2828 parameter:: { Alpha , Speed , Tone , ToneScale , VoicePreset , Volume } ,
2929} ;
3030use cevio_ai_sys:: {
3131 IServiceControl2V40 , ISpeakingState2 , ITalker2V40 , ITalkerComponent2 , ServiceControl2V40 ,
3232 Talker2V40 ,
3333} ;
3434
35- /// ` CeVIO AI`初期化設定
35+ /// CeVIO AI初期化設定
3636///
37- /// ` CeVIO AI`の初期化時に使用する設定を定義します 。
37+ /// CeVIO AIの初期化時に使用する設定を定義します 。
3838/// ビルダーパターンで構築可能です。
3939///
4040/// # Example
4141///
4242/// ```no_run
43- /// use cevio_ai::{CevioConfigBuilder , Volume, Speed};
43+ /// use cevio_ai::{CevioAIConfigBuilder , Volume, Speed};
4444///
45- /// let config = CevioConfigBuilder ::default()
45+ /// let config = CevioAIConfigBuilder ::default()
4646/// .start_host(true)
4747/// .initial_cast("さとうささら")
4848/// .initial_volume(Volume::new(80).unwrap())
@@ -53,14 +53,14 @@ use cevio_ai_sys::{
5353#[ derive( Default , Builder , Debug , Clone ) ]
5454#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
5555#[ builder( setter( into, strip_option) , default ) ]
56- pub struct CevioConfig {
57- /// ` CeVIO AI`を自動起動するか
56+ pub struct CevioAIConfig {
57+ /// CeVIO AIを自動起動するか
5858 ///
5959 /// `true`の場合、CeVIO AIが起動していなければ自動的に起動します。
6060 /// 既に起動済みの場合は何もしません。
6161 pub start_host : bool ,
6262
63- /// ` 起動時に待機しない(start_hostがtrueの場合のみ有効` )
63+ /// 起動時に待機しない(start_hostがtrueの場合のみ有効)
6464 ///
6565 /// - `true`: 起動のみ行い、アクセス可能になるのを待たずに戻ります
6666 /// - `false`: 起動後、外部からアクセス可能になるまで待機します
@@ -91,13 +91,13 @@ pub struct CevioConfig {
9191 pub operation_timeout : Option < Duration > ,
9292}
9393
94- /// ` CeVIO AI`終了モード
94+ /// CeVIO AI終了モード
9595///
96- /// ` CeVIO AI`に終了を要求する際の処理モードを指定します 。
96+ /// CeVIO AIに終了を要求する際の処理モードを指定します 。
9797pub enum CloseMode {
9898 /// 編集中の場合、保存や終了キャンセルが可能
9999 ///
100- /// ` CeVIO AI`が編集中の場合 、ユーザーに保存確認ダイアログが表示され、
100+ /// CeVIO AIが編集中の場合 、ユーザーに保存確認ダイアログが表示され、
101101 /// 保存するか終了をキャンセルできます。
102102 Interactive = 0 ,
103103
@@ -107,7 +107,7 @@ pub enum CloseMode {
107107 Force = 1 ,
108108}
109109
110- /// ` StartHostの結果コード`
110+ /// StartHostの結果コード
111111#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
112112#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
113113enum HostStartResult {
@@ -136,9 +136,9 @@ impl HostStartResult {
136136 }
137137}
138138
139- /// ` CeVIO AI`制御インターフェース
139+ /// CeVIO AI制御インターフェース
140140///
141- /// ` CeVIO AI`と通信するためのメインインターフェースです 。
141+ /// CeVIO AIと通信するためのメインインターフェースです 。
142142/// トーク機能(音声合成)と制御機能を提供します。
143143///
144144/// # Thread Safety
@@ -148,7 +148,7 @@ impl HostStartResult {
148148/// # Example
149149///
150150/// ```no_run
151- /// use cevio_ai::{Cevio , CastBuilder};
151+ /// use cevio_ai::{CevioAI , CastBuilder};
152152///
153153/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
154154/// // CeVIO AIの初期化
@@ -178,10 +178,10 @@ pub struct CevioAI {
178178}
179179
180180impl CevioAI {
181- /// ` CeVIO AI`インスタンスを作成します 。
181+ /// CeVIO AIインスタンスを作成します 。
182182 ///
183- /// ` COM初期化とCeVIO` AIのCOMオブジェクトを作成します。
184- /// ` CeVIO AI`が起動していない場合でもインスタンスは作成されます 。
183+ /// COM初期化とCeVIO AIのCOMオブジェクトを作成します。
184+ /// CeVIO AIが起動していない場合でもインスタンスは作成されます 。
185185 ///
186186 /// # Errors
187187 ///
@@ -203,9 +203,9 @@ impl CevioAI {
203203 }
204204 }
205205
206- /// ` 設定を指定してCeVIO` AIインスタンスを作成します。
206+ /// 設定を指定してCeVIO AIインスタンスを作成します。
207207 ///
208- /// ` 指定された設定に基づいてCeVIO` AIを初期化します。
208+ /// 指定された設定に基づいてCeVIO AIを初期化します。
209209 ///
210210 /// # Arguments
211211 ///
@@ -214,9 +214,9 @@ impl CevioAI {
214214 /// # Errors
215215 ///
216216 /// - インスタンス作成に失敗した場合
217- /// - ` CeVIO AI`起動に失敗した場合 (`start_host`が`true`の場合)
217+ /// - CeVIO AI起動に失敗した場合 (`start_host`が`true`の場合)
218218 /// - パラメータ設定に失敗した場合
219- pub fn with_config ( config : CevioConfig ) -> Result < Self > {
219+ pub fn with_config ( config : CevioAIConfig ) -> Result < Self > {
220220 let cevio = Self :: new ( ) ?;
221221
222222 if config. start_host {
@@ -250,7 +250,7 @@ impl CevioAI {
250250 Ok ( cevio)
251251 }
252252
253- /// ` CeVIO AI`を起動します 。
253+ /// CeVIO AIを起動します 。
254254 ///
255255 /// 起動済みの場合は何もしません。
256256 ///
@@ -261,22 +261,22 @@ impl CevioAI {
261261 ///
262262 /// # Errors
263263 ///
264- /// - `CevioError ::InstallUnknown` - インストール状態が不明
265- /// - `CevioError ::ExecutableNotFound` - 実行ファイルが見つからない
266- /// - `CevioError ::ProcessStartFailed` - プロセスの起動に失敗
267- /// - `CevioError ::AppTerminated` - アプリケーション起動後、エラーにより終了
264+ /// - `CevioAIError ::InstallUnknown` - インストール状態が不明
265+ /// - `CevioAIError ::ExecutableNotFound` - 実行ファイルが見つからない
266+ /// - `CevioAIError ::ProcessStartFailed` - プロセスの起動に失敗
267+ /// - `CevioAIError ::AppTerminated` - アプリケーション起動後、エラーにより終了
268268 pub fn start ( & self , no_wait : bool ) -> Result < ( ) > {
269269 let result = unsafe { self . service . lock ( ) . StartHost ( VARIANT_BOOL :: from ( no_wait) ) } ?;
270270 match HostStartResult :: from_i32 ( result) {
271271 HostStartResult :: Succeeded => Ok ( ( ) ) ,
272- HostStartResult :: NotRegistered => Err ( CevioError :: InstallUnknown ) ,
273- HostStartResult :: FileNotFound => Err ( CevioError :: ExecutableNotFound ) ,
274- HostStartResult :: StartingFailed => Err ( CevioError :: ProcessStartFailed ) ,
275- HostStartResult :: HostError => Err ( CevioError :: AppTerminated ) ,
272+ HostStartResult :: NotRegistered => Err ( CevioAIError :: InstallUnknown ) ,
273+ HostStartResult :: FileNotFound => Err ( CevioAIError :: ExecutableNotFound ) ,
274+ HostStartResult :: StartingFailed => Err ( CevioAIError :: ProcessStartFailed ) ,
275+ HostStartResult :: HostError => Err ( CevioAIError :: AppTerminated ) ,
276276 }
277277 }
278278
279- /// ` CeVIO AI`に終了を要求します 。
279+ /// CeVIO AIに終了を要求します 。
280280 ///
281281 /// # Arguments
282282 ///
@@ -599,6 +599,7 @@ impl CevioAI {
599599/// ```no_run
600600/// use cevio_ai::{CastBuilder, Volume, Speed, VoicePreset};
601601///
602+ /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
602603/// // 個別にパラメータを設定
603604/// let cast = CastBuilder::default()
604605/// .cast("さとうささら")
@@ -620,6 +621,9 @@ impl CevioAI {
620621/// .from_preset(VoicePreset::Happy)
621622/// .build()
622623/// .unwrap();
624+ ///
625+ /// # Ok(())
626+ /// # }
623627/// ```
624628#[ derive( Default , Builder , Debug , Clone , PartialEq , Eq ) ]
625629#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
@@ -706,10 +710,10 @@ impl Component {
706710 ///
707711 /// # Errors
708712 ///
709- /// 値が100を超える場合は `CevioError ::InvalidParameter` を返します。
713+ /// 値が100を超える場合は `CevioAIError ::InvalidParameter` を返します。
710714 pub fn set_value ( & self , value : u8 ) -> Result < ( ) > {
711715 if value > 100 {
712- return Err ( CevioError :: InvalidParameter ( format ! (
716+ return Err ( CevioAIError :: InvalidParameter ( format ! (
713717 "Component value must be 0-100, got {value}"
714718 ) ) ) ;
715719 }
0 commit comments