Improve audio and midi support.
This commit is contained in:
parent
9bcc0ae88e
commit
8b5f485d1e
47 changed files with 1446 additions and 634 deletions
34
test/audio/TestAudioWriter.cpp
Normal file
34
test/audio/TestAudioWriter.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "AudioSample.h"
|
||||
#include "AudioSynth.h"
|
||||
#include "AudioWriter.h"
|
||||
|
||||
#include "TestCase.h"
|
||||
#include "TestCaseRunner.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class TestWriteWav : public TestCase
|
||||
{
|
||||
public:
|
||||
bool Run() override
|
||||
{
|
||||
AudioWriter writer;
|
||||
writer.SetPath("test.wav");
|
||||
|
||||
AudioSynth synth;
|
||||
auto sample = synth.GetSineWave(240, 5);
|
||||
|
||||
writer.Write(sample);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
TestCaseRunner runner;
|
||||
runner.AddTestCase("TestWriteNav", std::make_unique<TestWriteWav>());
|
||||
|
||||
const auto testsPassed = runner.Run();
|
||||
return testsPassed ? 0 : -1;
|
||||
}
|
31
test/audio/TestMidiReader.cpp
Normal file
31
test/audio/TestMidiReader.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include "MidiReader.h"
|
||||
|
||||
#include "TestCase.h"
|
||||
#include "TestCaseRunner.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
class TestReadMidi : public TestCase
|
||||
{
|
||||
public:
|
||||
bool Run() override
|
||||
{
|
||||
MidiReader reader;
|
||||
reader.Read("/home/jmsgrogan/Downloads/test.mid");
|
||||
|
||||
auto document = reader.GetDocument();
|
||||
std::cout << document->Serialize() << std::endl;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
TestCaseRunner runner;
|
||||
runner.AddTestCase("TestReadMidi", std::make_unique<TestReadMidi>());
|
||||
|
||||
const auto testsPassed = runner.Run();
|
||||
return testsPassed ? 0 : -1;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue