Generated Wave Playback tests.
This commit is contained in:
28
main.cpp
28
main.cpp
@@ -26,30 +26,42 @@
|
|||||||
|
|
||||||
uint measurement = 44.1_kHz;
|
uint measurement = 44.1_kHz;
|
||||||
|
|
||||||
PulseAudioSubsystem test = PulseAudioSubsystem("PulseAudio Test");
|
PulseAudioSubsystem server = PulseAudioSubsystem("PulseAudio Test");
|
||||||
|
|
||||||
test.OnServerInfo += [] (const pa_server_info* info) {
|
server.OnServerInfo += [] (const pa_server_info* info) {
|
||||||
std::cout << info->host_name << " @ " << info->user_name << ", "
|
std::cout << info->host_name << " @ " << info->user_name << ", "
|
||||||
<< info->server_name << " v" << info->server_version << ", "
|
<< info->server_name << " v" << info->server_version << ", "
|
||||||
<< "default sink: " << info->default_sink_name << ", "
|
<< "default sink: " << info->default_sink_name << ", "
|
||||||
<< "default source" << info->default_source_name << std::endl;
|
<< "default source" << info->default_source_name << std::endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
PulseStream test_stream = test.CreateStream("Test Stream");
|
PulseStream test_stream = server.CreateStream("Test Stream");
|
||||||
//PulseStream test_stream2 = test.CreateStream("Another Test Stream");
|
//PulseStream test_stream2 = test.CreateStream("Another Test Stream");
|
||||||
|
|
||||||
//Sound test_sound = Sound::FromPCMFile("output.raw");
|
//Sound test_sound = Sound::FromPCMFile("output.raw");
|
||||||
Sound test_sound = Sound::FromOGGVorbisFile("wind.ogg");
|
Sound test_sound = Sound::FromOGGVorbisFile("wind.ogg");
|
||||||
|
|
||||||
Sound wave_test = Sound::FromSquareWave(10.f, 0.01f, 4000, 0);
|
Sound sine_sound = Sound::FromSineWave(5.f, 0.0025f, 3000, 0);
|
||||||
|
Sound sawtooth_sound = Sound::FromSawtoothWave(5.f, 0.025f, 2000, 0);
|
||||||
|
Sound triangle_sound = Sound::FromTriangleWave(5.f, 0.025f, 2000, 0);
|
||||||
|
Sound square_sound = Sound::FromSquareWave(5.f, 0.025f, 2000, 0);
|
||||||
|
|
||||||
|
server.Play(test_stream, sine_sound);
|
||||||
|
server.Play(test_stream, sawtooth_sound);
|
||||||
|
server.Play(test_stream, triangle_sound);
|
||||||
|
server.Play(test_stream, square_sound);
|
||||||
|
server.Play(test_stream, test_sound);
|
||||||
|
|
||||||
|
|
||||||
//test_sound = test_sound + ogg_test_sound;
|
//test_sound = test_sound + ogg_test_sound;
|
||||||
|
|
||||||
std::cout << "Sound Playback Length: " << wave_test.PlaybackLength() << " seconds." << std::endl;
|
//std::cout << "Sound Playback Length: " << wave_test.PlaybackLength() << " seconds." << std::endl;
|
||||||
|
|
||||||
|
//std::thread playback_thread([](PulseAudioSubsystem system, PulseStream stream, Sound sound){
|
||||||
|
//system.Play(stream, sound);
|
||||||
|
//}, test, test_stream, wave_test);
|
||||||
|
|
||||||
|
|
||||||
std::thread playback_thread([](PulseAudioSubsystem system, PulseStream stream, Sound sound){
|
|
||||||
system.Play(stream, sound);
|
|
||||||
}, test, test_stream, wave_test);
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
std::this_thread::sleep_for(25ms);
|
std::this_thread::sleep_for(25ms);
|
||||||
|
Reference in New Issue
Block a user