mixer

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

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

Examples

scope(failure) {writefln("Unittest failure :%s(%s)", __FILE__, __LINE__); stdout.flush();}
scope(success) {writefln("Unittest success :%s(%s)", __FILE__, __LINE__); stdout.flush();}

auto arr1 = [0, 1, 0, 1, 0, 1, 0, 1].repeatStream;
auto arr2 = [0, 0, 1, 1, 0, 0, 1, 1].repeatStream;
auto mx1 = arr1.mixer(arr2);
static assert(isInfinite!(typeof(mx1)));
static assert(isInputStream!(typeof(mx1)));

int[] buf1 = new int[16];
assert(mx1.read(buf1) == [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]);

auto arr3 = [0, 0, 0, 0, 1, 1, 1, 1].repeatStream;
auto mx2 = mx1.mixer(arr3);

int[] buf2 = new int[16];
assert(mx2.read(buf2) == [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1]);

Meta