OscStream -> OscUdpStream

This commit is contained in:
Franz Heinzmann (Frando) 2021-02-19 19:03:34 +01:00
parent 7558fd3fe9
commit 8d70acc5d2
2 changed files with 6 additions and 6 deletions

View file

@ -2,7 +2,7 @@ use async_std::stream::StreamExt;
use log::*;
use rosc::{OscMessage, OscPacket, OscType};
use studiox::osc::OscStream;
use studiox::osc::OscUdpStream;
use studiox::spawn::FaustHandle;
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 switcher_rx = switcher.take_receiver().unwrap().map(Event::Switcher);
let faust_rx = OscStream::bind(addr_faust_rx).await?.map(Event::FaustRx);
let command_osc_rx = OscStream::bind(addr_commands).await?;
let faust_rx = OscUdpStream::bind(addr_faust_rx).await?.map(Event::FaustRx);
let command_osc_rx = OscUdpStream::bind(addr_commands).await?;
let command_osc_tx = command_osc_rx.sender();
let command_osc_rx = command_osc_rx.map(Event::CommandRx);

View file

@ -10,11 +10,11 @@ use std::task::{Context, Poll};
use crate::switcher::SwitcherError;
use crate::udp::UdpStream;
pub struct OscStream {
pub struct OscUdpStream {
stream: UdpStream,
}
impl OscStream {
impl OscUdpStream {
pub fn new(socket: UdpSocket) -> Self {
let socket = Arc::new(socket);
let stream = UdpStream::new(socket);
@ -39,7 +39,7 @@ impl OscStream {
OscSender::new(self.stream.clone_socket())
}
}
impl Stream for OscStream {
impl Stream for OscUdpStream {
type Item = Result<OscPacket, SwitcherError>;
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));