made interface a library
This commit is contained in:
parent
a000276c22
commit
9d107d6c26
3 changed files with 16 additions and 10 deletions
|
@ -35,12 +35,13 @@ struct Configurable {
|
||||||
max: f32,
|
max: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A fake trait in the sense that these methods are exposed as symbols, not trait methods
|
||||||
trait Auto {
|
trait Auto {
|
||||||
/// entrypoint
|
/// entrypoint
|
||||||
async fn run(interface: &AutoInterface);
|
async fn run(interface: &AutoInterface);
|
||||||
/// register
|
/// register
|
||||||
fn default_configs() -> [Configurable];
|
fn default_configs() -> [Configurable];
|
||||||
|
fn name() -> &'static str;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn auto (interface: &AutoInterface) {
|
async fn auto (interface: &AutoInterface) {
|
||||||
|
|
12
interface/src/lib.rs
Normal file
12
interface/src/lib.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#![feature(iter_collect_into)]
|
||||||
|
|
||||||
|
use atomic_float::AtomicF32;
|
||||||
|
use gui::DEFAULT_VOLUME_THRESHOLD;
|
||||||
|
|
||||||
|
pub mod gui;
|
||||||
|
pub mod storage_dir;
|
||||||
|
pub mod combatlog;
|
||||||
|
pub mod auto;
|
||||||
|
|
||||||
|
pub const POWER_THRESHOLD: AtomicF32 = AtomicF32::new(DEFAULT_VOLUME_THRESHOLD);
|
||||||
|
|
|
@ -1,23 +1,16 @@
|
||||||
#![feature(iter_collect_into)]
|
|
||||||
use std::{fmt::format, ops::ControlFlow, result, sync::{atomic::Ordering, Arc}, thread::{self, sleep}, time::Duration};
|
use std::{fmt::format, ops::ControlFlow, result, sync::{atomic::Ordering, Arc}, thread::{self, sleep}, time::Duration};
|
||||||
|
|
||||||
use anyhow::{Context, Ok, Result};
|
use anyhow::{Context, Ok, Result};
|
||||||
use atomic_float::AtomicF32;
|
use atomic_float::AtomicF32;
|
||||||
use combatlog::{combat_logger, CombatData};
|
use interface::{combatlog::{combat_logger, CombatData}, POWER_THRESHOLD};
|
||||||
use common::{ControlPacket, TelemetryPacket};
|
use common::{ControlPacket, TelemetryPacket};
|
||||||
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
|
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
|
||||||
use egui_toast::{Toast, ToastKind};
|
use egui_toast::{Toast, ToastKind};
|
||||||
use gui::{gui, GUIData, DEFAULT_VOLUME_THRESHOLD, GUI};
|
use interface::gui::{gui, GUIData, DEFAULT_VOLUME_THRESHOLD, GUI};
|
||||||
use pitch_detection::{detector::{mcleod::McLeodDetector, PitchDetector}, utils};
|
use pitch_detection::{detector::{mcleod::McLeodDetector, PitchDetector}, utils};
|
||||||
use rust_music_theory::note::{Note, NoteLetter, Pitch, Tuning};
|
use rust_music_theory::note::{Note, NoteLetter, Pitch, Tuning};
|
||||||
use tokio::{io::{AsyncReadExt, AsyncWriteExt, BufWriter, WriteHalf}, net::{tcp::{OwnedReadHalf, OwnedWriteHalf}, TcpStream}, spawn, sync::{self, broadcast, mpsc, watch, RwLock}, time::timeout};
|
use tokio::{io::{AsyncReadExt, AsyncWriteExt, BufWriter, WriteHalf}, net::{tcp::{OwnedReadHalf, OwnedWriteHalf}, TcpStream}, spawn, sync::{self, broadcast, mpsc, watch, RwLock}, time::timeout};
|
||||||
|
|
||||||
mod gui;
|
|
||||||
mod storage_dir;
|
|
||||||
mod combatlog;
|
|
||||||
mod auto;
|
|
||||||
|
|
||||||
pub const POWER_THRESHOLD: AtomicF32 = AtomicF32::new(DEFAULT_VOLUME_THRESHOLD);
|
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let (logging_sender, combatlog) = mpsc::channel(64);
|
let (logging_sender, combatlog) = mpsc::channel(64);
|
||||||
|
|
Loading…
Reference in a new issue