OscStream -> OscUdpStream
This commit is contained in:
parent
7558fd3fe9
commit
8d70acc5d2
2 changed files with 6 additions and 6 deletions
|
|
@ -2,7 +2,7 @@ use async_std::stream::StreamExt;
|
||||||
use log::*;
|
use log::*;
|
||||||
use rosc::{OscMessage, OscPacket, OscType};
|
use rosc::{OscMessage, OscPacket, OscType};
|
||||||
|
|
||||||
use studiox::osc::OscStream;
|
use studiox::osc::OscUdpStream;
|
||||||
use studiox::spawn::FaustHandle;
|
use studiox::spawn::FaustHandle;
|
||||||
use studiox::switcher::{SwitcherError, SwitcherEvent, SwitcherHandle};
|
use studiox::switcher::{SwitcherError, SwitcherEvent, SwitcherHandle};
|
||||||
|
|
||||||
|
|
@ -45,8 +45,8 @@ async fn main_loop(faust_handle: &FaustHandle) -> anyhow::Result<()> {
|
||||||
let mut switcher = SwitcherHandle::run();
|
let mut switcher = SwitcherHandle::run();
|
||||||
let switcher_rx = switcher.take_receiver().unwrap().map(Event::Switcher);
|
let switcher_rx = switcher.take_receiver().unwrap().map(Event::Switcher);
|
||||||
|
|
||||||
let faust_rx = OscStream::bind(addr_faust_rx).await?.map(Event::FaustRx);
|
let faust_rx = OscUdpStream::bind(addr_faust_rx).await?.map(Event::FaustRx);
|
||||||
let command_osc_rx = OscStream::bind(addr_commands).await?;
|
let command_osc_rx = OscUdpStream::bind(addr_commands).await?;
|
||||||
let command_osc_tx = command_osc_rx.sender();
|
let command_osc_tx = command_osc_rx.sender();
|
||||||
let command_osc_rx = command_osc_rx.map(Event::CommandRx);
|
let command_osc_rx = command_osc_rx.map(Event::CommandRx);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ use std::task::{Context, Poll};
|
||||||
use crate::switcher::SwitcherError;
|
use crate::switcher::SwitcherError;
|
||||||
use crate::udp::UdpStream;
|
use crate::udp::UdpStream;
|
||||||
|
|
||||||
pub struct OscStream {
|
pub struct OscUdpStream {
|
||||||
stream: UdpStream,
|
stream: UdpStream,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OscStream {
|
impl OscUdpStream {
|
||||||
pub fn new(socket: UdpSocket) -> Self {
|
pub fn new(socket: UdpSocket) -> Self {
|
||||||
let socket = Arc::new(socket);
|
let socket = Arc::new(socket);
|
||||||
let stream = UdpStream::new(socket);
|
let stream = UdpStream::new(socket);
|
||||||
|
|
@ -39,7 +39,7 @@ impl OscStream {
|
||||||
OscSender::new(self.stream.clone_socket())
|
OscSender::new(self.stream.clone_socket())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl Stream for OscStream {
|
impl Stream for OscUdpStream {
|
||||||
type Item = Result<OscPacket, SwitcherError>;
|
type Item = Result<OscPacket, SwitcherError>;
|
||||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||||
let packet = ready!(Pin::new(&mut self.stream).poll_next(cx));
|
let packet = ready!(Pin::new(&mut self.stream).poll_next(cx));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue