42 using namespace Nsound;
49 static const char *
THIS_FILE =
"Wavefile_UnitTest.cc";
66 data1[1] *= 0.666666666666666;
67 data1[2] *= 0.333333333333333;
70 cout <<
TEST_HEADER <<
"Testing Wavefile::write(48-bit), read(48-bit) ..." << flush;
72 data1 >>
"test_wavefile.wav";
76 data <<
"test_wavefile.wav";
83 gold <<
"gold/Wavefile_out1.wav";
90 for(
int32 i = 0; i < 3; ++i)
92 if(abs_diff[i].getMax() >
GAMMA)
95 <<
"Output did not match gold file!"
98 diff[i].
plot(
"data - gold");
100 gold[i].plot(
"gold");
111 cout <<
TEST_HEADER <<
"Testing Wavefile::write(24-bit), read(24-bit) ..." << flush;
115 data1 >>
"test_wavefile2.wav";
118 data <<
"test_wavefile2.wav";
124 gold <<
"gold/Wavefile_out2.wav";
131 for(
int32 i = 0; i < 1; ++i)
133 if(abs_diff[i].getMax() > 0.5 *
GAMMA)
136 <<
"Output did not match gold file!"
139 diff[i].
plot(
"data - gold");
140 data[i].
plot(
"data");
141 gold[i].plot(
"gold");
149 cout << SUCCESS << endl;
static void show()
Acutally draw the plots to the screen.
static const float64 GAMMA
#define TEST_ERROR_HEADER
void plot(const std::string &title="AudioStream") const
virtual float64 generate(const float64 &frequency)
This is a real-time method for the wavetable oscillator.
static const char * THIS_FILE
static void setDefaultSampleSize(uint32 size)
void abs()
This method calls abs on all buffers held in the stream.