79 lines
1.8 KiB
C++
79 lines
1.8 KiB
C++
#include "delay/buffer_multi.hpp"
|
|
#include "test_common.hpp"
|
|
#include <delay/buffer.hpp>
|
|
#include <mix.hpp>
|
|
|
|
#include <cstdio>
|
|
#include <iostream>
|
|
|
|
|
|
int test_mix_1()
|
|
{
|
|
std::cout << "----------------------------------------------" << std::endl;
|
|
std::cout << "Start test_mix_1::shuffle" << std::endl;
|
|
std::cout << "----------------------------------------------" << std::endl;
|
|
|
|
{
|
|
dsp::Buffer<int> r_buf(5);
|
|
dsp::Buffer<int> t_buf{105, 106, 107, 108, 109};
|
|
t_buf = {105, 106, 107, 108, 109};
|
|
|
|
dsp::Buffer<int> s_spec = {1, 3, 2, 4, 0};
|
|
Shuffle<int>::outOfPlace(t_buf, r_buf, s_spec);
|
|
print(r_buf, 5, "r-buf");
|
|
}
|
|
{
|
|
dsp::BufferMulti<int> r_buf(5, 5);
|
|
dsp::BufferMulti<int> t_buf{5, 5};
|
|
t_buf[0] = {105, 106, 107, 108, 109};
|
|
t_buf[1] = {205, 206, 207, 208, 209};
|
|
t_buf[2] = {305, 306, 307, 308, 309};
|
|
t_buf[3] = {405, 406, 407, 408, 409};
|
|
t_buf[4] = {505, 506, 507, 508, 509};
|
|
print(t_buf[0], 5, "t-buf 0");
|
|
print(t_buf[1], 5, "t-buf 1");
|
|
|
|
dsp::Buffer<int> s_spec = {-1, 0, -3, 2, -4};
|
|
Shuffle<int>::outOfPlace(t_buf, r_buf, s_spec);
|
|
print(r_buf[0], 5, "r-buf 0");
|
|
print(r_buf[1], 5, "r-buf 1");
|
|
print(r_buf[2], 5, "r-buf 2");
|
|
print(r_buf[3], 5, "r-buf 3");
|
|
print(r_buf[4], 5, "r-buf 4");
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int test_mix_2()
|
|
{
|
|
dsp::BufferMulti<int> r_buf(5, 20);
|
|
|
|
for (int i=0; i < 20; i++)
|
|
{
|
|
r_buf = 100 +i ;
|
|
++r_buf;
|
|
}
|
|
|
|
r_buf.reset();
|
|
for (int c=0; c < r_buf.numChannels(); c++)
|
|
{
|
|
print(r_buf[c], 20, "r-buf");
|
|
std::cout << "----------------------------------------------" << std::endl;
|
|
}
|
|
|
|
for (int c=0; c < r_buf.numChannels(); c++)
|
|
{
|
|
dsp::Buffer<int> v(r_buf[c], c);
|
|
print(v, 20, "v-buf");
|
|
std::cout << "----------------------------------------------" << std::endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int test_mix()
|
|
{
|
|
test_mix_1();
|
|
test_mix_2();
|
|
return 0;
|
|
} |