mixer

二つの信号の積を返します。 2つ目の信号は演算による理想信号でなければいけません。

mixer
(
Sg1
Sg2
)
(
Sg1 sg1
,
Sg2 sg2
)
if (
isInfinite!Sg2
)

Examples

1 scope(failure) {writefln("Unittest failure :%s(%s)", __FILE__, __LINE__); stdout.flush();}
2 scope(success) {writefln("Unittest success :%s(%s)", __FILE__, __LINE__); stdout.flush();}
3 
4 auto arr1 = [0, 1, 0, 1, 0, 1, 0, 1].repeatStream;
5 auto arr2 = [0, 0, 1, 1, 0, 0, 1, 1].repeatStream;
6 auto mx1 = arr1.mixer(arr2);
7 static assert(isInfinite!(typeof(mx1)));
8 static assert(isInputStream!(typeof(mx1)));
9 
10 int[] buf1 = new int[16];
11 assert(mx1.read(buf1) == [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]);
12 
13 auto arr3 = [0, 0, 0, 0, 1, 1, 1, 1].repeatStream;
14 auto mx2 = mx1.mixer(arr3);
15 
16 int[] buf2 = new int[16];
17 assert(mx2.read(buf2) == [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1]);

Meta