Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert #503 定数化されたものを関数へ戻します #557

Merged
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ members = [
anyhow = "1.0.65"
async_zip = { version = "0.0.11", features = ["full"] }
clap = { version = "4.0.10", features = ["derive"] }
const-default = { version = "1.0.0", features = ["derive"] }
easy-ext = "1.0.1"
fs-err = { version = "2.9.0", features = ["tokio"] }
itertools = "0.10.5"
Expand Down
2 changes: 0 additions & 2 deletions crates/voicevox_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ directml = ["onnxruntime/directml"]
anyhow.workspace = true
async_zip.workspace = true
cfg-if = "1.0.0"
const-default.workspace = true
derive-getters.workspace = true
derive-new = "0.5.9"
duplicate = "1.0.0"
easy-ext.workspace = true
fs-err.workspace = true
futures = "0.3.26"
Expand Down
42 changes: 12 additions & 30 deletions crates/voicevox_core/src/voice_synthesizer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use std::sync::Arc;

use const_default::ConstDefault;
use duplicate::duplicate_item;

use crate::engine::{create_kana, parse_kana, AccentPhraseModel, OpenJtalk, SynthesisEngine};

use super::*;
Expand Down Expand Up @@ -31,7 +28,7 @@ impl From<&TtsOptions> for SynthesisOptions {
/// [`Synthesizer::create_accent_phrases`]のオプション。
///
/// [`Synthesizer::create_accent_phrases`]: Synthesizer::create_accent_phrases
#[derive(ConstDefault)]
#[derive(Default)]
pub struct AccentPhrasesOptions {
/// AquesTalk風記法としてテキストを解釈する。
pub kana: bool,
Expand All @@ -40,7 +37,7 @@ pub struct AccentPhrasesOptions {
/// [`Synthesizer::audio_query`]のオプション。
///
/// [`Synthesizer::audio_query`]: Synthesizer::audio_query
#[derive(ConstDefault)]
#[derive(Default)]
pub struct AudioQueryOptions {
/// AquesTalk風記法としてテキストを解釈する。
pub kana: bool,
Expand All @@ -67,52 +64,37 @@ impl AsRef<TtsOptions> for TtsOptions {
}
}

impl ConstDefault for TtsOptions {
const DEFAULT: Self = Self {
enable_interrogative_upspeak: true,
kana: ConstDefault::DEFAULT,
};
impl Default for TtsOptions {
fn default() -> Self {
Self {
enable_interrogative_upspeak: true,
kana: Default::default(),
}
}
}

/// ハードウェアアクセラレーションモードを設定する設定値。
#[derive(Debug, PartialEq, Eq)]
#[derive(Default, Debug, PartialEq, Eq)]
pub enum AccelerationMode {
/// 実行環境に合った適切なハードウェアアクセラレーションモードを選択する。
#[default]
Auto,
/// ハードウェアアクセラレーションモードを"CPU"に設定する。
Cpu,
/// ハードウェアアクセラレーションモードを"GPU"に設定する。
Gpu,
}

impl ConstDefault for AccelerationMode {
const DEFAULT: Self = Self::Auto;
}

/// [`Synthesizer::new_with_initialize`]のオプション。
///
/// [`Synthesizer::new_with_initialize`]: Synthesizer::new_with_initialize
#[derive(ConstDefault)]
#[derive(Default)]
pub struct InitializeOptions {
pub acceleration_mode: AccelerationMode,
pub cpu_num_threads: u16,
pub load_all_models: bool,
}

#[duplicate_item(
T;
[ AccentPhrasesOptions ];
[ AudioQueryOptions ];
[ TtsOptions ];
[ AccelerationMode ];
[ InitializeOptions ];
)]
impl Default for T {
fn default() -> Self {
Self::DEFAULT
}
}

/// 音声シンセサイザ。
pub struct Synthesizer {
synthesis_engine: SynthesisEngine,
Expand Down
1 change: 0 additions & 1 deletion crates/voicevox_core_c_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ name = "e2e"
directml = ["voicevox_core/directml"]

[dependencies]
const-default.workspace = true
derive-getters.workspace = true
libc = "0.2.134"
once_cell.workspace = true
Expand Down
84 changes: 63 additions & 21 deletions crates/voicevox_core_c_api/include/voicevox_core.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading