Correct config payload

This commit is contained in:
Rafael Caricio 2022-03-31 15:19:25 +02:00
parent 8f85e53ca2
commit f463d0f68c
Signed by: rafaelcaricio
GPG key ID: 3C86DBCE8E93C947

View file

@ -1,7 +1,20 @@
// Copyright (C) 2022 Rafael Caricio <rafael@caricio.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at
// <https://mozilla.org/MPL/2.0/>.
//
// SPDX-License-Identifier: MPL-2.0
use serde_derive::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Debug)]
pub struct Configuration {
config: ConfigInner,
}
#[derive(Deserialize, Serialize, Debug)]
struct ConfigInner {
/// Sample rate the audio will be provided at.
sample_rate: i32,
@ -12,9 +25,11 @@ pub struct Configuration {
impl Configuration {
pub fn new(sample_rate: i32) -> Self {
Self {
sample_rate,
// We always want to receive the words with their time ranges.
words: true,
config: ConfigInner {
sample_rate,
// We always want to receive the words with their time ranges.
words: true,
},
}
}
}
@ -32,4 +47,4 @@ pub struct WordInfo {
pub word: String,
pub start: f64,
pub end: f64,
}
}