Previous topic

Reactions

Next topic

The Table Module Block

This Page

SampleHold Block

signal Sample { default: 0.0 rate: none domain: AudioDomain reset: none }

AnalongIn[1] >> SampleHold ( event: DigitalIn[1] ) >> Sample;
module SampleHold {
        input:                  Input
        output:                 Output
        propertyName:           'event'
        propertyDirection:      in
        propertyBlock:          trigger Trigger {}
        internalBlock:          [
                hybrid Input {
                        type:           [ 'Stream Real', 'Stream Integer', 'Constant Real', 'Constant Integer' ]
                        default:        [ 0.0, 0 ]
                        rate:           none
                        domain:         streamDomain
                        reset:          none
                },
                hybrid Output {
                        type:           [ 'Stream Real', 'Stream Integer' ]
                        default:        [ 0.0, 0 ]
                        rate:           none
                        domain:         streamDomain
                        reset:          none
                },
                reaction GetSample {
                        output:         Sample
                        onExecution:    Reset
                        terminateWhen:  Sampled
                        internalBlock:  [
                                hybrid Sample {
                                        type:           [ 'Stream Real', 'Stream Integer' ]
                                        default:        [ 0.0, 0 ]
                                        rate:           none
                                        reset:          none
                                        domain:         streamDomain
                                },
                                switch Sampled { default: Off reset: Reset },
                                trigger Reset {}
                        ]
                        streams:        [
                                Input >> Sample;
                                on >> Sampled;
                        ]
                }
        ]
        streams:                Trigger >> GetSample () >> Output;
}