Working base
This commit is contained in:
@ -1,50 +1 @@
|
||||
use oxydsp_flowgraph::block::SyncBlock;
|
||||
use oxydsp_flowgraph::edge::In;
|
||||
use oxydsp_flowgraph::edge::Out;
|
||||
use oxydsp_flowgraph_macros::BlockIO;
|
||||
use oxydsp_flowgraph_macros::sync_block;
|
||||
|
||||
#[derive(BlockIO)]
|
||||
//#[sync_block]
|
||||
pub struct Test
|
||||
{
|
||||
#[input]
|
||||
input: In<u32>,
|
||||
|
||||
#[output]
|
||||
output: Out<u32>,
|
||||
}
|
||||
|
||||
impl oxydsp_flowgraph::block::Block for Test
|
||||
{
|
||||
fn work(&mut self) -> oxydsp_flowgraph::block::BlockResult
|
||||
{
|
||||
let mut len = usize::MAX;
|
||||
let mut input_reader = self.input.read();
|
||||
len = len.min(input_reader.len());
|
||||
let mut output_writer = self.output.write();
|
||||
len = len.min(output_writer.len());
|
||||
//let input = input_reader.pop().unwrap();
|
||||
let input = 0;
|
||||
for _ in 0..len
|
||||
{
|
||||
let (output_out,) = self.sync_work((input,));
|
||||
output_writer.push(output_out).unwrap();
|
||||
}
|
||||
oxydsp_flowgraph::block::BlockResult::Ok
|
||||
}
|
||||
}
|
||||
|
||||
impl SyncBlock for Test
|
||||
{
|
||||
type Input = (u32,);
|
||||
|
||||
type Output = (u32,);
|
||||
|
||||
fn sync_work(&mut self, (num,): Self::Input) -> Self::Output
|
||||
{
|
||||
(num,)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
Reference in New Issue
Block a user