Skip to content

Commit

Permalink
feat!: ビルダースタイルの締めの"exec"/"execute"を"perform"に
Browse files Browse the repository at this point in the history
BREAKING-CHANGE: Java APIのメソッド名変更
  • Loading branch information
qryxip committed Dec 29, 2024
1 parent ef66cc2 commit 1e985cd
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion crates/voicevox_core/src/__internal/doctest_fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub async fn synthesizer_with_sample_voice_model(
#[cfg(feature = "load-onnxruntime")]
crate::nonblocking::Onnxruntime::load_once()
.filename(onnxruntime_dylib_path)
.exec()
.perform()
.await?,
#[cfg(feature = "link-onnxruntime")]
crate::nonblocking::Onnxruntime::init_once().await?,
Expand Down
8 changes: 4 additions & 4 deletions crates/voicevox_core/src/infer/runtimes/onnxruntime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ pub(crate) mod blocking {
{
Self::load_once()
.filename(test_util::ONNXRUNTIME_DYLIB_PATH)
.exec()
.perform()
.map_err(Into::into)
}

Expand Down Expand Up @@ -453,7 +453,7 @@ pub(crate) mod blocking {
}

/// 実行する。
pub fn exec(self) -> crate::Result<&'static Onnxruntime> {
pub fn perform(self) -> crate::Result<&'static Onnxruntime> {
Onnxruntime::once(|| ort::try_init_from(&self.filename, None))
}
}
Expand Down Expand Up @@ -604,8 +604,8 @@ pub(crate) mod nonblocking {
}

/// 実行する。
pub async fn exec(self) -> crate::Result<&'static Onnxruntime> {
let inner = crate::task::asyncify(|| self.0.exec()).await?;
pub async fn perform(self) -> crate::Result<&'static Onnxruntime> {
let inner = crate::task::asyncify(|| self.0.perform()).await?;
Ok(Onnxruntime::from_blocking(inner))
}
}
Expand Down
14 changes: 7 additions & 7 deletions crates/voicevox_core/src/synthesizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,7 @@ pub(crate) mod blocking {
}

/// 実行する。
pub fn exec(self) -> crate::Result<AudioFeature> {
pub fn perform(self) -> crate::Result<AudioFeature> {
self.synthesizer
.precompute_render(self.audio_query, self.style_id, &self.options)
.block_on()
Expand All @@ -1818,7 +1818,7 @@ pub(crate) mod blocking {
}

/// 実行する。
pub fn exec(self) -> crate::Result<Vec<u8>> {
pub fn perform(self) -> crate::Result<Vec<u8>> {
self.synthesizer
.synthesis(self.audio_query, self.style_id, &self.options)
.block_on()
Expand All @@ -1841,7 +1841,7 @@ pub(crate) mod blocking {
}

/// 実行する。
pub fn exec(self) -> crate::Result<Vec<u8>> {
pub fn perform(self) -> crate::Result<Vec<u8>> {
self.synthesizer
.tts_from_kana(self.kana, self.style_id, &self.options)
.block_on()
Expand All @@ -1863,7 +1863,7 @@ pub(crate) mod blocking {
}

/// 実行する。
pub fn exec(self) -> crate::Result<Vec<u8>> {
pub fn perform(self) -> crate::Result<Vec<u8>> {
self.synthesizer
.tts(self.text, self.style_id, &self.options)
.block_on()
Expand Down Expand Up @@ -2235,7 +2235,7 @@ pub(crate) mod nonblocking {
}

/// 実行する。
pub async fn exec(self) -> crate::Result<Vec<u8>> {
pub async fn perform(self) -> crate::Result<Vec<u8>> {
self.synthesizer
.synthesis(self.audio_query, self.style_id, &self.options)
.await
Expand All @@ -2258,7 +2258,7 @@ pub(crate) mod nonblocking {
}

/// 実行する。
pub async fn exec(self) -> crate::Result<Vec<u8>> {
pub async fn perform(self) -> crate::Result<Vec<u8>> {
self.synthesizer
.tts_from_kana(self.kana, self.style_id, &self.options)
.await
Expand All @@ -2280,7 +2280,7 @@ pub(crate) mod nonblocking {
}

/// 実行する。
pub async fn exec(self) -> crate::Result<Vec<u8>> {
pub async fn perform(self) -> crate::Result<Vec<u8>> {
self.synthesizer
.tts(self.text, self.style_id, &self.options)
.await
Expand Down
6 changes: 3 additions & 3 deletions crates/voicevox_core_c_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ pub unsafe extern "C" fn voicevox_synthesizer_synthesis(
.body()
.synthesis(&audio_query, StyleId::new(style_id))
.enable_interrogative_upspeak(enable_interrogative_upspeak)
.exec()?;
.perform()?;
U8_SLICE_OWNER.own_and_lend(wav, output_wav, output_wav_length);
Ok(())
})())
Expand Down Expand Up @@ -1149,7 +1149,7 @@ pub unsafe extern "C" fn voicevox_synthesizer_tts_from_kana(
.body()
.tts_from_kana(kana, StyleId::new(style_id))
.enable_interrogative_upspeak(enable_interrogative_upspeak)
.exec()?;
.perform()?;
U8_SLICE_OWNER.own_and_lend(output, output_wav, output_wav_length);
Ok(())
})())
Expand Down Expand Up @@ -1194,7 +1194,7 @@ pub unsafe extern "C" fn voicevox_synthesizer_tts(
.body()
.tts(text, StyleId::new(style_id))
.enable_interrogative_upspeak(enable_interrogative_upspeak)
.exec()?;
.perform()?;
U8_SLICE_OWNER.own_and_lend(output, output_wav, output_wav_length);
Ok(())
})())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public List<AccentPhrase> replaceMoraPitch(List<AccentPhrase> accentPhrases, int
* @param audioQuery {@link AudioQuery}。
* @param styleId スタイルID。
* @return {@link SynthesisConfigurator}。
* @see SynthesisConfigurator#execute
* @see SynthesisConfigurator#perform
*/
@Nonnull
public SynthesisConfigurator synthesis(AudioQuery audioQuery, int styleId) {
Expand All @@ -266,7 +266,7 @@ public SynthesisConfigurator synthesis(AudioQuery audioQuery, int styleId) {
* @param kana AquesTalk風記法。
* @param styleId スタイルID。
* @return {@link TtsFromKanaConfigurator}。
* @see TtsFromKanaConfigurator#execute
* @see TtsFromKanaConfigurator#perform
*/
@Nonnull
public TtsFromKanaConfigurator ttsFromKana(String kana, int styleId) {
Expand All @@ -279,7 +279,7 @@ public TtsFromKanaConfigurator ttsFromKana(String kana, int styleId) {
* @param text 日本語のテキスト。
* @param styleId スタイルID。
* @return {@link TtsConfigurator}。
* @see TtsConfigurator#execute
* @see TtsConfigurator#perform
*/
@Nonnull
public TtsConfigurator tts(String text, int styleId) {
Expand Down Expand Up @@ -434,7 +434,7 @@ public SynthesisConfigurator interrogativeUpspeak(boolean interrogativeUpspeak)
* @throws RunModelException 推論に失敗した場合。
*/
@Nonnull
public byte[] execute() throws RunModelException {
public byte[] perform() throws RunModelException {
if (!Utils.isU32(styleId)) {
throw new IllegalArgumentException("styleId");
}
Expand Down Expand Up @@ -479,7 +479,7 @@ public TtsFromKanaConfigurator interrogativeUpspeak(boolean interrogativeUpspeak
* @throws RunModelException 推論に失敗した場合。
*/
@Nonnull
public byte[] execute() throws RunModelException {
public byte[] perform() throws RunModelException {
if (!Utils.isU32(styleId)) {
throw new IllegalArgumentException("styleId");
}
Expand Down Expand Up @@ -522,7 +522,7 @@ public TtsConfigurator interrogativeUpspeak(boolean interrogativeUpspeak) {
* @throws RunModelException 推論に失敗した場合。
*/
@Nonnull
public byte[] execute() throws RunModelException {
public byte[] perform() throws RunModelException {
if (!Utils.isU32(styleId)) {
throw new IllegalArgumentException("styleId");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void checkAudioQuery() throws RunModelException, InvalidModelDataException {
}

AudioQuery query = synthesizer.createAudioQuery("こんにちは", synthesizer.metas()[0].styles[0].id);
synthesizer.synthesis(query, synthesizer.metas()[0].styles[0].id).execute();
synthesizer.synthesis(query, synthesizer.metas()[0].styles[0].id).perform();
}

@Test
Expand Down Expand Up @@ -124,6 +124,6 @@ void checkTts() throws RunModelException, InvalidModelDataException {
try (VoiceModelFile model = openModel()) {
synthesizer.loadVoiceModel(model);
}
synthesizer.tts("こんにちは", synthesizer.metas()[0].styles[0].id).execute();
synthesizer.tts("こんにちは", synthesizer.metas()[0].styles[0].id).perform();
}
}
2 changes: 1 addition & 1 deletion crates/voicevox_core_java_api/src/onnxruntime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Onnxruntime_rs
let filename = String::from(env.get_string(&filename)?);
let internal = voicevox_core::blocking::Onnxruntime::load_once()
.filename(filename)
.exec()?;
.perform()?;
env.set_rust_field(&this, "handle", internal)?;
Ok(())
})
Expand Down
6 changes: 3 additions & 3 deletions crates/voicevox_core_java_api/src/synthesizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rs
let wave = internal
.synthesis(&audio_query, voicevox_core::StyleId::new(style_id))
.enable_interrogative_upspeak(enable_interrogative_upspeak != 0)
.exec()?;
.perform()?;

let j_bytes = env.byte_array_from_slice(&wave)?;

Expand Down Expand Up @@ -463,7 +463,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rs
let wave = internal
.tts_from_kana(&kana, voicevox_core::StyleId::new(style_id))
.enable_interrogative_upspeak(enable_interrogative_upspeak != 0)
.exec()?;
.perform()?;

let j_bytes = env.byte_array_from_slice(&wave)?;

Expand Down Expand Up @@ -493,7 +493,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_blocking_Synthesizer_rs
let wave = internal
.tts(&text, voicevox_core::StyleId::new(style_id))
.enable_interrogative_upspeak(enable_interrogative_upspeak != 0)
.exec()?;
.perform()?;

let j_bytes = env.byte_array_from_slice(&wave)?;

Expand Down
18 changes: 9 additions & 9 deletions crates/voicevox_core_python_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ mod blocking {
.get_or_try_init(|| {
let inner = voicevox_core::blocking::Onnxruntime::load_once()
.filename(filename)
.exec()
.perform()
.into_py_result(py)?;
Py::new(py, Self(inner))
})
Expand Down Expand Up @@ -699,7 +699,7 @@ mod blocking {
.read()?
.precompute_render(&audio_query, StyleId::new(style_id))
.enable_interrogative_upspeak(enable_interrogative_upspeak)
.exec()
.perform()
.into_py_result(py)?;
Ok(AudioFeature { audio })
}
Expand Down Expand Up @@ -748,7 +748,7 @@ mod blocking {
.read()?
.synthesis(&audio_query, StyleId::new(style_id))
.enable_interrogative_upspeak(enable_interrogative_upspeak)
.exec()
.perform()
.into_py_result(py)?;
Ok(PyBytes::new(py, wav))
}
Expand All @@ -772,7 +772,7 @@ mod blocking {
.read()?
.tts_from_kana(kana, style_id)
.enable_interrogative_upspeak(enable_interrogative_upspeak)
.exec()
.perform()
.into_py_result(py)?;
Ok(PyBytes::new(py, wav))
}
Expand All @@ -796,7 +796,7 @@ mod blocking {
.read()?
.tts(text, style_id)
.enable_interrogative_upspeak(enable_interrogative_upspeak)
.exec()
.perform()
.into_py_result(py)?;
Ok(PyBytes::new(py, wav))
}
Expand Down Expand Up @@ -1008,7 +1008,7 @@ mod asyncio {
pyo3_asyncio::tokio::future_into_py(py, async move {
let inner = voicevox_core::nonblocking::Onnxruntime::load_once()
.filename(filename)
.exec()
.perform()
.await;

ONNXRUNTIME.get_or_try_init(|| {
Expand Down Expand Up @@ -1364,7 +1364,7 @@ mod asyncio {
.read()?
.synthesis(&audio_query, StyleId::new(style_id))
.enable_interrogative_upspeak(enable_interrogative_upspeak)
.exec()
.perform()
.await;
Python::with_gil(|py| {
let wav = wav.into_py_result(py)?;
Expand Down Expand Up @@ -1398,7 +1398,7 @@ mod asyncio {
.read()?
.tts_from_kana(&kana, style_id)
.enable_interrogative_upspeak(enable_interrogative_upspeak)
.exec()
.perform()
.await;

Python::with_gil(|py| {
Expand Down Expand Up @@ -1433,7 +1433,7 @@ mod asyncio {
.read()?
.tts(&text, style_id)
.enable_interrogative_upspeak(enable_interrogative_upspeak)
.exec()
.perform()
.await;

Python::with_gil(|py| {
Expand Down

0 comments on commit 1e985cd

Please sign in to comment.