Skip to content
Open
Changes from all 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
35 changes: 16 additions & 19 deletions obs-rvc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,39 +327,39 @@ impl GetPropertiesSource for RvcInferenceFilter {

p.add(
SETTING_MODEL_PATH,
obs_string!("模型路径"),
PathProp::new(PathType::File).with_filter(obs_string!("ONNX 模型文件 (*.onnx)")),
obs_string!("Model Path"),
PathProp::new(PathType::File).with_filter(obs_string!("ONNX Model File Path (*.onnx)")),
);

p.add(
SETTING_INDEX_PATH,
obs_string!("RVC 音高索引文件路径"),
PathProp::new(PathType::File).with_filter(obs_string!("Index 文件 (*.index)")),
obs_string!("RVC Pitch Index File Path"),
PathProp::new(PathType::File).with_filter(obs_string!("RVC Pitch Index File Path (*.index)")),
);

let mut version_list =
p.add_list::<RvcModelVersion>(SETTING_MODEL_VERSION, obs_string!("模型版本"), false);
p.add_list::<RvcModelVersion>(SETTING_MODEL_VERSION, obs_string!("Model Version"), false);

version_list.push(obs_string!("v1"), RvcModelVersion::V1);
version_list.push(obs_string!("v2"), RvcModelVersion::V2);

p.add(
SETTING_DEST_SAMPLE_RATE,
obs_string!("模型目标采样率"),
obs_string!("Destination Sample Rate"),
NumberProp::new_int()
.with_range(16000..=48000)
.with_step(4000)
.with_slider(),
);

let mut pitch_algorithm_list =
p.add_list::<PitchAlgorithm>(SETTING_PITCH_ALGORITHM, obs_string!("音高算法"), false);
p.add_list::<PitchAlgorithm>(SETTING_PITCH_ALGORITHM, obs_string!("Pitch Algorithm"), false);

pitch_algorithm_list.push(obs_string!("RMVPE"), PitchAlgorithm::Rmvpe);

p.add(
SETTING_PITCH_SHIFT,
obs_string!("音调设置"),
obs_string!("Pitch Shift"),
NumberProp::new_int()
.with_range(-24..=24)
.with_step(1)
Expand All @@ -368,55 +368,55 @@ impl GetPropertiesSource for RvcInferenceFilter {

p.add(
SETTING_RESONANCE_SHIFT,
obs_string!("共振偏移"),
obs_string!("Resonance Shift"),
NumberProp::new_float(0.07)
.with_range(-5.0..=5.0)
.with_slider(),
);

p.add(
SETTING_INDEX_RATE,
obs_string!("索引率"),
obs_string!("Index Rate"),
NumberProp::new_float(0.01)
.with_range(0.00..=1.00)
.with_slider(),
);

p.add(
SETTING_LOUDNESS_FACTOR,
obs_string!("响度因子"),
obs_string!("Loudness Factor"),
NumberProp::new_float(0.01)
.with_range(0.00..=1.00)
.with_slider(),
);

p.add(
SETTING_SAMPLE_LENGTH,
obs_string!("采样长度"),
obs_string!("Sample Length"),
NumberProp::new_float(0.01)
.with_range(0.01..=1.50)
.with_slider(),
);

p.add(
SETTING_FADE_LENGTH,
obs_string!("淡入淡出长度"),
obs_string!("Fade In/Out Length"),
NumberProp::new_float(0.01)
.with_range(0.01..=0.15)
.with_slider(),
);

p.add(
SETTING_EXTRA_INFERENCE_TIME,
obs_string!("额外推理时长"),
obs_string!("Extra Inference Time"),
NumberProp::new_float(0.01)
.with_range(0.00..=5.00)
.with_slider(),
);

p.add(
SETTING_SKIP_INFERENCE,
obs_string!("跳过推理"),
obs_string!("Skip Inference"),
BoolProp
);

Expand Down Expand Up @@ -784,7 +784,6 @@ fn process_one_frame(input_sample: &[f32], state: &mut RvcInferenceState) -> nda
*output_sola_buffer_view = *output_sola_buffer_view * fade_in + sola * fade_out;
});


// self.sola_buffer.assign(&output[self.sample_frame_size..(self.sample_frame_size + self.sola_buffer_frame_size)]);
state.sola_buffer.assign(&output.slice(s![
state.sample_frame_size..(state.sample_frame_size + state.sola_buffer_frame_size)
Expand Down Expand Up @@ -920,11 +919,9 @@ impl Drop for RvcInferenceFilter {

impl Module for RvcInferenceModule {
fn new(context: ModuleRef) -> Self {

let binary_path = PathBuf::from(context.binary_path().unwrap().as_str());
let data_path = PathBuf::from(context.data_path().unwrap().as_str());


unsafe {
BINARY_PATH = Some(binary_path);
DATA_PATH = Some(data_path);
Expand Down Expand Up @@ -964,4 +961,4 @@ impl Module for RvcInferenceModule {
}
}

obs_register_module!(RvcInferenceModule);
obs_register_module!(RvcInferenceModule);