-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change!(java):
blocking
パッケージを作ってクラス移動
- Loading branch information
Showing
26 changed files
with
493 additions
and
388 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
.../voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/AccelerationMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package jp.hiroshiba.voicevoxcore; | ||
|
||
/** ハードウェアアクセラレーションモード。 */ | ||
public enum AccelerationMode { | ||
/** 実行環境に合わせて自動的に選択する。 */ | ||
AUTO, | ||
/** CPUに設定する。 */ | ||
CPU, | ||
/** GPUに設定する。 */ | ||
GPU, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/SpeakerMeta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package jp.hiroshiba.voicevoxcore; | ||
|
||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
import jakarta.annotation.Nonnull; | ||
import jakarta.annotation.Nullable; | ||
|
||
/** 話者(speaker)のメタ情報。 */ | ||
public class SpeakerMeta { | ||
/** 話者名。 */ | ||
@SerializedName("name") | ||
@Expose | ||
@Nonnull | ||
public final String name; | ||
|
||
/** 話者に属するスタイル。 */ | ||
@SerializedName("styles") | ||
@Expose | ||
@Nonnull | ||
public final StyleMeta[] styles; | ||
|
||
/** 話者のUUID。 */ | ||
@SerializedName("speaker_uuid") | ||
@Expose | ||
@Nonnull | ||
public final String speakerUuid; | ||
|
||
/** 話者のバージョン。 */ | ||
@SerializedName("version") | ||
@Expose | ||
@Nonnull | ||
public final String version; | ||
|
||
/** | ||
* 話者の順番。 | ||
* | ||
* <p>{@code SpeakerMeta}の列は、この値に対して昇順に並んでいるべきである。 | ||
*/ | ||
@SerializedName("order") | ||
@Expose | ||
@Nullable | ||
public final Integer order; | ||
|
||
private SpeakerMeta() { | ||
// GSONからコンストラクトするため、このメソッドは呼ばれることは無い。 | ||
// このメソッドは@Nonnullを満たすために必要。 | ||
this.name = ""; | ||
this.styles = new StyleMeta[0]; | ||
this.speakerUuid = ""; | ||
this.version = ""; | ||
this.order = null; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/StyleMeta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package jp.hiroshiba.voicevoxcore; | ||
|
||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
import jakarta.annotation.Nonnull; | ||
import jakarta.annotation.Nullable; | ||
|
||
/** スタイル(style)のメタ情報。 */ | ||
public class StyleMeta { | ||
/** スタイル名。 */ | ||
@SerializedName("name") | ||
@Expose | ||
@Nonnull | ||
public final String name; | ||
|
||
/** スタイルID。 */ | ||
@SerializedName("id") | ||
@Expose | ||
public final int id; | ||
|
||
/** スタイルに対応するモデルの種類。 */ | ||
@SerializedName("type") | ||
@Expose | ||
@Nonnull | ||
public final StyleType type; | ||
|
||
/** | ||
* 話者の順番。 | ||
* | ||
* <p>{@link SpeakerMeta#styles}の列は、この値に対して昇順に並んでいるべきである。 | ||
*/ | ||
@SerializedName("order") | ||
@Expose | ||
@Nullable | ||
public final Integer order; | ||
|
||
private StyleMeta() { | ||
this.name = ""; | ||
this.id = 0; | ||
this.type = StyleType.TALK; | ||
this.order = null; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/StyleType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package jp.hiroshiba.voicevoxcore; | ||
|
||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** スタイル(style)に対応するモデルの種類。 */ | ||
public enum StyleType { | ||
/** 音声合成クエリの作成と音声合成が可能。 */ | ||
@SerializedName("talk") | ||
@Expose | ||
TALK, | ||
} |
143 changes: 143 additions & 0 deletions
143
crates/voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/UserDictWord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
package jp.hiroshiba.voicevoxcore; | ||
|
||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
import jakarta.annotation.Nonnull; | ||
import jakarta.validation.constraints.Max; | ||
import jakarta.validation.constraints.Min; | ||
|
||
/** ユーザー辞書の単語。 */ | ||
public class UserDictWord { | ||
/** 単語の表層形。 */ | ||
@SerializedName("surface") | ||
@Expose | ||
@Nonnull | ||
public String surface; | ||
|
||
/** 単語の発音。 発音として有効なカタカナである必要がある。 */ | ||
@SerializedName("pronunciation") | ||
@Expose | ||
@Nonnull | ||
public String pronunciation; | ||
|
||
/** | ||
* 単語の種類。 | ||
* | ||
* @see Type | ||
*/ | ||
@SerializedName("word_type") | ||
@Expose | ||
@Nonnull | ||
public Type wordType; | ||
|
||
/** アクセント型。 音が下がる場所を指す。 */ | ||
@SerializedName("accent_type") | ||
@Expose | ||
public int accentType; | ||
|
||
/** 単語の優先度。 0から10までの整数。 数字が大きいほど優先度が高くなる。 1から9までの値を指定することを推奨。 */ | ||
@SerializedName("priority") | ||
@Expose | ||
@Min(0) | ||
@Max(10) | ||
public int priority; | ||
|
||
/** | ||
* {@link UserDictWord}を作成する。 | ||
* | ||
* @param surface 言葉の表層形。 | ||
* @param pronunciation 言葉の発音。 | ||
* @throws IllegalArgumentException pronunciationが不正な場合。 | ||
*/ | ||
public UserDictWord(String surface, String pronunciation) { | ||
if (surface == null) { | ||
throw new NullPointerException("surface"); | ||
} | ||
if (pronunciation == null) { | ||
throw new NullPointerException("pronunciation"); | ||
} | ||
|
||
this.surface = rsToZenkaku(surface); | ||
rsValidatePronunciation(pronunciation); | ||
this.pronunciation = pronunciation; | ||
this.wordType = Type.COMMON_NOUN; | ||
this.accentType = 0; | ||
this.priority = 5; | ||
} | ||
|
||
/** | ||
* 単語の種類を設定する。 | ||
* | ||
* @param wordType 単語の種類。 | ||
* @return このインスタンス。 | ||
*/ | ||
public UserDictWord wordType(Type wordType) { | ||
if (wordType == null) { | ||
throw new NullPointerException("wordType"); | ||
} | ||
this.wordType = wordType; | ||
return this; | ||
} | ||
|
||
/** | ||
* アクセント型を設定する。 | ||
* | ||
* @param accentType アクセント型。 | ||
* @return このインスタンス。 | ||
*/ | ||
public UserDictWord accentType(int accentType) { | ||
if (accentType < 0) { | ||
throw new IllegalArgumentException("accentType"); | ||
} | ||
this.accentType = accentType; | ||
return this; | ||
} | ||
|
||
/** | ||
* 優先度を設定する。 | ||
* | ||
* @param priority 優先度。 | ||
* @return このインスタンス。 | ||
* @throws IllegalArgumentException priorityが0未満または10より大きい場合。 | ||
*/ | ||
public UserDictWord priority(int priority) { | ||
if (priority < 0 || priority > 10) { | ||
throw new IllegalArgumentException("priority"); | ||
} | ||
this.priority = priority; | ||
return this; | ||
} | ||
|
||
@Nonnull | ||
private static native String rsToZenkaku(String surface); | ||
|
||
private static native void rsValidatePronunciation(String pronunciation); | ||
|
||
/** 単語の種類。 */ | ||
public static enum Type { | ||
/** 固有名詞。 */ | ||
@SerializedName("PROPER_NOUN") | ||
@Expose | ||
PROPER_NOUN, | ||
|
||
/** 一般名詞。 */ | ||
@SerializedName("COMMON_NOUN") | ||
@Expose | ||
COMMON_NOUN, | ||
|
||
/** 動詞。 */ | ||
@SerializedName("VERB") | ||
@Expose | ||
VERB, | ||
|
||
/** 形容詞。 */ | ||
@SerializedName("ADJECTIVE") | ||
@Expose | ||
ADJECTIVE, | ||
|
||
/** 語尾。 */ | ||
@SerializedName("SUFFIX") | ||
@Expose | ||
SUFFIX, | ||
} | ||
} |
Oops, something went wrong.