Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Graph
and related types.
- type NodeId = Int
- type PortIndex = Int
- data Graph = Graph {}
- data KType
- data FromPort
- = FromPort_C { }
- | FromPort_K { }
- | FromPort_U { }
- data ToPort = ToPort NodeId PortIndex
- type Edge = (FromPort, ToPort)
- data Node
- = NodeC {
- node_id :: NodeId
- node_c_value :: Sample
- | NodeK {
- node_id :: NodeId
- node_k_rate :: Rate
- node_k_index :: Maybe Int
- node_k_name :: String
- node_k_default :: Sample
- node_k_type :: KType
- node_k_meta :: Maybe (C_Meta Sample)
- | NodeU {
- node_id :: NodeId
- node_u_rate :: Rate
- node_u_name :: String
- node_u_inputs :: [FromPort]
- node_u_outputs :: [Output]
- node_u_special :: Special
- node_u_ugenid :: UGenId
- | NodeP { }
- = NodeC {
- node_k_eq :: Node -> Node -> Bool
- find_node :: Graph -> NodeId -> Maybe Node
- node_label :: Node -> String
- port_idx_or_zero :: FromPort -> PortIndex
- is_node_c :: Node -> Bool
- is_node_k :: Node -> Bool
- is_node_u :: Node -> Bool
- edges :: [Node] -> [Edge]
- as_from_port :: Node -> FromPort
- from_port_node :: Graph -> FromPort -> Maybe Node
- empty_graph :: Graph
- graph_maximum_id :: Graph -> NodeId
- node_k_cmp :: Node -> Node -> Ordering
- ktype :: Rate -> Bool -> KType
- find_c_p :: Sample -> Node -> Bool
- push_c :: Sample -> Graph -> (Node, Graph)
- mk_node_c :: Constant -> Graph -> (Node, Graph)
- find_k_p :: String -> Node -> Bool
- push_k :: Control -> Graph -> (Node, Graph)
- mk_node_k :: Control -> Graph -> (Node, Graph)
- type UGenParts = (Rate, String, [FromPort], [Output], Special, UGenId)
- find_u_p :: UGenParts -> Node -> Bool
- push_u :: UGenParts -> Graph -> (Node, Graph)
- mk_node_u_acc :: [UGen] -> [Node] -> Graph -> ([Node], Graph)
- mk_node_u :: Primitive -> Graph -> (Node, Graph)
- mk_node_p :: Node -> PortIndex -> Graph -> (Node, Graph)
- mk_node :: UGen -> Graph -> (Node, Graph)
- prepare_root :: UGen -> UGen
- sort_controls :: [Node] -> [Node]
- mk_graph :: UGen -> Graph
- type Map = IntMap Int
- type Maps = (Map, [Node], Map, Map, [(KType, Int)])
- node_ktype :: Node -> Maybe KType
- mk_ktype_map :: [Node] -> [(KType, Int)]
- ktype_map_lookup :: KType -> [(KType, Int)] -> Int
- mk_maps :: Graph -> Maps
- fetch :: NodeId -> Map -> Int
- fetch_k :: NodeId -> KType -> [Node] -> Int
- type KS_COUNT = (Int, Int, Int, Int)
- ks_count :: [Node] -> KS_COUNT
- mk_implicit_ctl :: [Node] -> [Node]
- add_implicit_ctl :: Graph -> Graph
- localbuf_count :: [Node] -> Int
- add_implicit_buf :: Graph -> Graph
- add_implicit :: Graph -> Graph
- is_implicit_control :: Node -> Bool
- is_implicit :: Node -> Bool
- remove_implicit :: Graph -> Graph
- is_from_port_u :: FromPort -> Bool
- multiple_u_out_edges :: [Edge] -> [FromPort]
- node_descendents :: Graph -> Node -> [Node]
- pv_multiple_out_edges :: Graph -> [Node]
- pv_validate :: Graph -> Graph
- ugen_to_graph :: UGen -> Graph
Type
Type to represent unit generator graph.
Enumeration of the four operating rates for controls.
Type to represent the left hand side of an edge in a unit generator graph.
Type to represent nodes in unit generator graph.
NodeC | |
| |
NodeK | |
| |
NodeU | |
| |
NodeP | |
|
Building
port_idx_or_zero :: FromPort -> PortIndex Source
Get port_idx
for FromPort_U
, else 0
.
The empty Graph
.
graph_maximum_id :: Graph -> NodeId Source
node_k_cmp :: Node -> Node -> Ordering Source
Compare NodeK
values on
node_k_type
.
find_c_p :: Sample -> Node -> Bool Source
Predicate to determine if Node
is a constant with indicated value.
find_k_p :: String -> Node -> Bool Source
Predicate to determine if Node
is a control with indicated
name. Names must be unique.
mk_node_p :: Node -> PortIndex -> Graph -> (Node, Graph) Source
Proxies do not get stored in the graph.
prepare_root :: UGen -> UGen Source
Transform mce nodes to mrg nodes
sort_controls :: [Node] -> [Node] Source
If controls have been given indices they must be coherent.
Encoding
fetch_k :: NodeId -> KType -> [Node] -> Int Source
Controls are a special case. We need to know not the overall index but the index in relation to controls of the same type.
Implicit (Control, MaxLocalBuf)
mk_implicit_ctl :: [Node] -> [Node] Source
Construct implicit control unit generator Nodes
. Unit
generators are only constructed for instances of control types that
are present.
add_implicit_ctl :: Graph -> Graph Source
Add implicit control UGens to Graph
.
localbuf_count :: [Node] -> Int Source
Zero if no local buffers, or if maxLocalBufs is given.
add_implicit_buf :: Graph -> Graph Source
Add implicit maxLocalBufs
if not present.
add_implicit :: Graph -> Graph Source
is_implicit_control :: Node -> Bool Source
Is Node
an implicit control UGen?
is_implicit :: Node -> Bool Source
Is Node implicit?
remove_implicit :: Graph -> Graph Source
Remove implicit UGens from Graph
Queries
is_from_port_u :: FromPort -> Bool Source
Is FromPort
FromPort_U
.
multiple_u_out_edges :: [Edge] -> [FromPort] Source
List of FromPort_U
at e with multiple out edges.
PV edge accounting
pv_validate :: Graph -> Graph Source
Error if graph has invalid PV
subgraph, ie. multiple out edges
at PV
node not connecting to Unpack1FFT
& PackFFT
.
ugen_to_graph :: UGen -> Graph Source
Transform a unit generator into a graph.
import Sound.SC3.UGen ugen_to_graph (out 0 (pan2 (sinOsc AR 440 0) 0.5 0.1))