diff --git a/build.rs b/build.rs index 2389134965..5c0635ef0c 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,11 @@ extern crate prost_build; fn main() { - prost_build::compile_protos(&["protos/audio.proto"], - &["protos/"]).unwrap(); + //prost_build::compile_protos(&["protos/audio.proto"], + // &["protos/"]).unwrap(); + prost_build::Config::new() + .out_dir("src/protos/") + .compile_protos(&["protos/audio.proto"], + &["protos/"]) + .unwrap(); } \ No newline at end of file diff --git a/protos/audio.proto b/protos/audio.proto index 709ff39118..5aea5efd67 100644 --- a/protos/audio.proto +++ b/protos/audio.proto @@ -1,9 +1,15 @@ syntax = "proto3"; -package voder.audio; +package voder_audio; -message AudioSample { +message VocodeAudioRequest { repeated int32 integer_audio = 1; repeated float float_audio = 2; bool skip_vocode = 3; } + +message VocodeAudioResponse { + repeated int32 integer_audio = 1; + repeated float float_audio = 2; +} + diff --git a/src/main.rs b/src/main.rs index 5cd3eae476..7be0161bb1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,14 +13,18 @@ extern crate wavy; extern crate world_sys; extern crate zmq; -include!(concat!(env!("OUT_DIR"), "/voder.audio.rs")); +//include!(concat!(env!("OUT_DIR"), "/voder.audio.rs")); pub mod ipc; //pub mod model; +pub mod protos; pub mod synthesis; use wavy::*; +use protos::voder_audio::VocodeAudioRequest; +use protos::voder_audio::VocodeAudioResponse; + use byteorder::{ByteOrder, BigEndian, LittleEndian, ReadBytesExt}; use cpal::traits::{DeviceTrait, EventLoopTrait, HostTrait}; use failure::_core::time::Duration; @@ -128,6 +132,8 @@ fn run_cpal_audio() -> Result<(), failure::Error> { } } + let mut outgoing = VocodeAudioRequest::default(); + match socket.send(&bytes, 0) { Ok(_) => { //println!("Sent len: {}", bytes.len()); diff --git a/src/protos/mod.rs b/src/protos/mod.rs new file mode 100644 index 0000000000..5e3380f41f --- /dev/null +++ b/src/protos/mod.rs @@ -0,0 +1 @@ +pub mod voder_audio; \ No newline at end of file diff --git a/src/protos/voder_audio.rs b/src/protos/voder_audio.rs new file mode 100644 index 0000000000..92f8518d96 --- /dev/null +++ b/src/protos/voder_audio.rs @@ -0,0 +1,16 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VocodeAudioRequest { + #[prost(int32, repeated, tag="1")] + pub integer_audio: ::std::vec::Vec, + #[prost(float, repeated, tag="2")] + pub float_audio: ::std::vec::Vec, + #[prost(bool, tag="3")] + pub skip_vocode: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VocodeAudioResponse { + #[prost(int32, repeated, tag="1")] + pub integer_audio: ::std::vec::Vec, + #[prost(float, repeated, tag="2")] + pub float_audio: ::std::vec::Vec, +}