Safe Haskell | None |
---|---|
Language | Haskell98 |
Binary 'Graph Definition' as understood by scsynth
.
There are both encoders and decoders.
Synopsis
- type Name = ASCII
- type Control = (Name, Int)
- type Sample = Double
- data Input = Input Int Int
- input_ugen_ix :: Input -> Maybe Int
- type Rate = Int
- type Output = Rate
- type Special = Int
- type UGen = (Name, Rate, [Input], [Output], Special)
- ugen_rate :: UGen -> Rate
- ugen_inputs :: UGen -> [Input]
- ugen_outputs :: UGen -> [Output]
- ugen_is_control :: UGen -> Bool
- input_is_control :: Graphdef -> Input -> Bool
- data Graphdef = Graphdef {
- graphdef_name :: Name
- graphdef_constants :: [Sample]
- graphdef_controls :: [(Control, Sample)]
- graphdef_ugens :: [UGen]
- graphdef_ugen :: Graphdef -> Int -> UGen
- graphdef_control :: Graphdef -> Int -> (Control, Sample)
- graphdef_constant_nid :: Graphdef -> Int -> Int
- graphdef_control_nid :: Graphdef -> Int -> Int
- graphdef_ugen_nid :: Graphdef -> Int -> Int
- read_sample :: Handle -> IO Sample
- read_control :: (Handle -> IO Int) -> Handle -> IO Control
- read_input :: (Handle -> IO Int) -> Handle -> IO Input
- read_output :: Handle -> IO Output
- read_ugen :: (Handle -> IO Int) -> Handle -> IO UGen
- read_graphdef :: Handle -> IO Graphdef
- read_graphdef_file :: FilePath -> IO Graphdef
- encode_pstr :: Name -> ByteString
- encode_input :: Input -> ByteString
- encode_control :: Control -> ByteString
- encode_ugen :: UGen -> ByteString
- encode_sample :: Sample -> ByteString
- encode_graphdef :: Graphdef -> ByteString
- graphdef_stat :: Graphdef -> String
Type
Inputs are a ugen-index and a port-index. If the ugen-index is -1 it indicates a constant.
ugen_is_control :: UGen -> Bool Source #
Predicate to examine Ugen name and decide if it is a control.
Graph definition type.
Graphdef | |
|
graphdef_control :: Graphdef -> Int -> (Control, Sample) Source #
Lookup Control and default value by index.
Read (version 0 or 2).
read_graphdef_file :: FilePath -> IO Graphdef Source #
Read Graphdef from file.
dir = "/home/rohan/sw/rsc3-disassembler/scsyndef/" pp nm = read_graphdef_file (dir ++ nm) >>= putStrLn . graphdef_stat pp "simple.scsyndef" pp "with-ctl.scsyndef" pp "mce.scsyndef" pp "mrg.scsyndef"
Encode (version zero)
encode_pstr :: Name -> ByteString Source #
Pascal (length prefixed) encoding of string.
encode_input :: Input -> ByteString Source #
Byte-encode Input
.
encode_control :: Control -> ByteString Source #
Byte-encode Control
.
encode_ugen :: UGen -> ByteString Source #
Byte-encode UGen
.
encode_sample :: Sample -> ByteString Source #
Encode Sample
as 32-bit IEEE float.
encode_graphdef :: Graphdef -> ByteString Source #
Encode Graphdef
.