Starting fsk demod

This commit is contained in:
2026-03-22 13:29:06 +01:00
parent f468cb3c6d
commit f1f769e0e6
24 changed files with 1050 additions and 245 deletions

View File

@ -9,8 +9,10 @@ pub enum BlockResult
// Signifies that the block finished its work
// Running it again would be useless
// This triggers the graph shutdown
Terminated,
// Kill graph
Exit,
}
pub trait BlockIO

View File

@ -0,0 +1,5 @@
// Represents a FlowGrahWide, simultaneous event
pub enum FlowGraphEvent
{
Kill(String),
}

View File

@ -49,20 +49,15 @@ impl FlowGraph
crate::block::BlockResult::Ok =>
{}
crate::block::BlockResult::Terminated =>
{ //break 'outer;
}
crate::block::BlockResult::Exit =>
{
break 'outer;
}
}
}
}
for _ in 0..10_000
{
for x in self.blocks.iter_mut()
{
x.work();
}
}
})
}

View File

@ -131,7 +131,7 @@ impl<T: 'static> Out<T>
}
}
pub fn push_iter<I: Iterator<Item = (T, Option<Tag>)>>(&mut self, mut iter: I) -> bool
pub fn push_iter<I: Iterator<Item = Tagged<T>>>(&mut self, mut iter: I) -> bool
{
let writer = self.write();
let len = writer.len();
@ -140,17 +140,7 @@ impl<T: 'static> Out<T>
{
if let Some(elt) = iter.next()
{
match elt.1
{
Some(tag) =>
{
let _ = writer.push(Tagged(elt.0, Some(tag)));
}
None =>
{
let _ = writer.push_no_tag(elt.0);
}
}
let _ = writer.push(elt);
}
else
{
@ -220,7 +210,13 @@ impl<T> OutWriter<'_, T>
pub fn push(&self, data: Tagged<T>) -> Result<(), Tagged<T>>
{
let (data, tag) = data.into();
let (data, mut tag) = data.into();
let position = self.data_writer.next_index();
if let Some(tag) = &mut tag
{
tag.position = position
}
match self.data_writer.push(data)
{
Ok(_) if tag.is_some() =>

View File

@ -3,8 +3,10 @@
pub mod block;
pub mod edge;
pub mod event;
pub mod graph;
pub mod io;
pub mod stream;
pub mod tag;
pub use oxydsp_flowgraph_macros::{BlockIO, sync_block};
pub use oxydsp_flowgraph_macros::BlockIO;
pub use oxydsp_flowgraph_macros::sync_block;

View File

@ -22,6 +22,14 @@ pub struct Tag
impl Tag
{
pub fn new() -> Self
{
Self {
position: 0,
data: Default::default(),
}
}
pub fn merge_tag_opts<const N: usize>(tag_opts: [Option<Tag>; N]) -> Option<Tag>
{
let mut out_tag = None;
@ -31,6 +39,27 @@ impl Tag
}
out_tag
}
pub fn tag<T: 'static + Send + Sync>(&self, key: impl AsRef<str>, value: T)
{
self.data
.lock()
.unwrap()
.insert(key.as_ref().to_owned(), Arc::new(value));
}
pub fn retrieve(&self, key: impl AsRef<str>) -> Option<Arc<dyn Any + Send + Sync>>
{
self.data.lock().unwrap().get(key.as_ref()).cloned()
}
}
impl Default for Tag
{
fn default() -> Self
{
Self::new()
}
}
pub trait TagValue: Clone {}
@ -93,6 +122,10 @@ impl<T> Tagged<T>
{
pub fn new(inner: T, tag: Option<Tag>) -> Self
{
if tag.is_none()
{
//println!("data has no tag");
}
Self(inner, tag)
}
@ -156,11 +189,11 @@ impl<T> From<(T, Option<Tag>)> for Tagged<T>
}
}
impl<T> Into<(T, Option<Tag>)> for Tagged<T>
impl<T> From<Tagged<T>> for (T, Option<Tag>)
{
fn into(self) -> (T, Option<Tag>)
fn from(val: Tagged<T>) -> Self
{
(self.0, self.1)
(val.0, val.1)
}
}