Skip to content

Commit 6ed4bf1

Browse files
committed
fix: Cevio関連の型名を修正し、ドキュメントを更新
1 parent 2b04df1 commit 6ed4bf1

6 files changed

Lines changed: 74 additions & 78 deletions

File tree

crates/cevio-ai-sys/src/lib.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
//! CeVIO AI の低レベル FFI バインディング
2+
//!
3+
//! このクレートは、日本語音声合成ソフトウェア CeVIO AI 用の生の Windows COM インターフェースバインディングを提供します。
4+
//! これらのバインディングは CeVIO.Talk.RemoteService2.winmd メタデータファイルから自動生成されます。
5+
//!
6+
//! # プラットフォームサポート
7+
//!
8+
//! このクレートは Windows COM インターフェースに依存するため、**Windows 専用**です。
9+
//!
10+
//! # 使用方法
11+
//!
12+
//! このクレートは生の COM インターフェースを公開します。より高レベルで安全な API については、代わりに `cevio-ai` クレートの使用を検討してください。
13+
//!
14+
//! # 安全性について
15+
//!
16+
//! このクレートが公開する COM インターフェースは本質的に unsafe です。`unsafe_send` フィーチャが有効な場合、
17+
//! 特定のインターフェースが `Mutex` でラップされることを前提として `Send` が実装されます。
18+
119
pub use bindings::CeVIO::Talk::RemoteService2::{
220
IPhonemeData2, IPhonemeDataArray2, IServiceControl2, IServiceControl2V40,
321
IServiceControl2V40Part, ISpeakingState2, IStringArray2, ITalker2, ITalker2V40,

crates/cevio-ai/src/cevio.rs

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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

2525
use crate::{
2626
com_manager::ComGuard,
27-
error::{CevioError, Result},
27+
error::{CevioAIError, Result},
2828
parameter::{Alpha, Speed, Tone, ToneScale, VoicePreset, Volume},
2929
};
3030
use 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に終了を要求する際の処理モードを指定します
9797
pub 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))]
113113
enum 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

180180
impl 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
}

crates/cevio-ai/src/com_manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use windows::{
66
},
77
};
88

9-
use parking_lot::{const_mutex, Mutex};
9+
use parking_lot::Mutex;
1010

1111
static COM_MANAGER: std::sync::LazyLock<Mutex<ComManager>> =
12-
std::sync::LazyLock::new(|| const_mutex(ComManager::new()));
12+
std::sync::LazyLock::new(|| Mutex::new(ComManager::new()));
1313

1414
struct ComManager {
1515
ref_count: usize,

crates/cevio-ai/src/error.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
//! エラー処理関連の型定義
22
//!
33
//! このモジュールは、CeVIO APIで発生する可能性のあるエラーを定義します。
4-
//! すべてのエラーは`CevioError`列挙型にまとめられており、
4+
//! すべてのエラーは`CevioAIError`列挙型にまとめられており、
55
//! `thiserror`クレートを使用して詳細なエラーメッセージを提供します。
66
7-
use crate::{CastBuilderError, CevioConfigBuilderError};
7+
use crate::{CastBuilderError, CevioAIConfigBuilderError};
88
use thiserror::Error;
99

1010
#[derive(Debug, Error)]
11-
pub enum CevioError {
11+
pub enum CevioAIError {
1212
#[error("Windows API error: {0}")]
1313
Windows(#[from] windows::core::Error),
1414
#[error("BuilderError error: {0}")]
1515
BuilderError(#[from] CastBuilderError),
1616
#[error("ConfigBuilderError error: {0}")]
17-
ConfigBuilderError(#[from] CevioConfigBuilderError),
17+
ConfigBuilderError(#[from] CevioAIConfigBuilderError),
1818
#[error("Installation state is unknown")]
1919
InstallUnknown,
2020
#[error("Executable not found")]
@@ -27,4 +27,4 @@ pub enum CevioError {
2727
InvalidParameter(String),
2828
}
2929

30-
pub type Result<T> = std::result::Result<T, CevioError>;
30+
pub type Result<T> = std::result::Result<T, CevioAIError>;

crates/cevio-ai/src/lib.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
//! # `CeVIO AI` Rust API
1+
//! # CeVIO AI Rust API
22
//!
3-
//! `CeVIO AI`の機能をRustから安全に利用するためのライブラリです。
4-
//!
5-
//! ## 主な機能
6-
//!
7-
//! - **音声合成**: テキストから音声を生成
8-
//! - **音声パラメータ制御**: 音量、速度、音程、抑揚、声質の調整
9-
//! - **キャスト管理**: 利用可能なキャストの一覧取得と切り替え
10-
//! - **音素データ取得**: テキストの音素情報とタイミングを取得
11-
//! - **WAVファイル出力**: 音声をファイルに保存
3+
//! CeVIO AIの機能をRustから安全に利用するためのライブラリです。
124
//!
135
//! ## 基本的な使用方法
146
//!
@@ -17,7 +9,7 @@
179
//!
1810
//! fn main() -> Result<()> {
1911
//! // CeVIOインスタンスを作成
20-
//! let cevio = Cevio::new()?;
12+
//! let cevio = CevioAI::new()?;
2113
//!
2214
//! // CeVIO AIを起動
2315
//! cevio.start(false)?;
@@ -46,13 +38,13 @@
4638
//! use cevio_ai::*;
4739
//!
4840
//! fn main() -> Result<()> {
49-
//! let config = CevioConfigBuilder::default()
41+
//! let config = CevioAIConfigBuilder::default()
5042
//! .start_host(true)
5143
//! .initial_cast("さとうささら")
5244
//! .initial_volume(Volume::new(80)?)
5345
//! .build()?;
5446
//!
55-
//! let cevio = Cevio::with_config(config)?;
47+
//! let cevio = CevioAI::with_config(config)?;
5648
//!
5749
//! // 既に設定済みなのですぐに使用可能
5850
//! let state = cevio.speak("こんにちは")?;
@@ -82,7 +74,7 @@ mod tests {
8274
// 公式のサンプル
8375
// https://cevio.jp/guide/cevio_ai/interface/com/
8476
fn minimal() -> Result<()> {
85-
let cevio = Cevio::new()?;
77+
let cevio = CevioAI::new()?;
8678

8779
// 【CeVIO AI】起動
8880
cevio.start(false)?;
@@ -119,7 +111,7 @@ mod tests {
119111
#[test]
120112
#[serial]
121113
fn full() -> Result<()> {
122-
let cevio = Cevio::new()?;
114+
let cevio = CevioAI::new()?;
123115

124116
// 【CeVIO AI】起動
125117
cevio.start(false)?;
@@ -167,14 +159,14 @@ mod tests {
167159
#[serial]
168160
fn test_builder_patterns() -> Result<()> {
169161
// CevioConfigのテスト
170-
let config = CevioConfigBuilder::default()
162+
let config = CevioAIConfigBuilder::default()
171163
.start_host(true)
172164
.no_wait(false)
173165
.initial_cast("さとうささら")
174166
.initial_volume(Volume::new(80).unwrap())
175167
.build()?;
176168

177-
let _cevio = Cevio::with_config(config)?;
169+
let _cevio = CevioAI::with_config(config)?;
178170

179171
// CastBuilderの新しいメソッドのテスト
180172
let _cast_defaults = CastBuilder::default()

crates/cevio-sys/.metadata/generate.proj

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)