62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
/// ReMixer
|
|
/// A Public Domain C++ Audio Playback Library
|
|
/// By william @ RedactedSoftware. Thanks to Dawsh & Maxine.
|
|
/// (c) 2024 Redacted Software
|
|
/// This work is explicitly dedicated to the public domain, for the hopeful betterment of the software industry.
|
|
|
|
/// @file main.cpp
|
|
/// @desc This file is the program code for the ReMixer-Test program.
|
|
/// @edit 2024-08-30
|
|
|
|
#include <iostream>
|
|
#include <vorbis/codec.h>
|
|
#include <vorbis/vorbisfile.h>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <thread>
|
|
#include <ReMixer/stream.h>
|
|
#include <ReMixer/sound.h>
|
|
#include <ReMixer/PulseSubsystem.h>
|
|
#include <ReMixer/ReMixer.h>
|
|
|
|
|
|
[[noreturn]] int main() {
|
|
|
|
|
|
using namespace ReMixer;
|
|
using namespace std::chrono_literals;
|
|
|
|
uint measurement = 44.1_kHz;
|
|
|
|
PulseAudioSubsystem test = PulseAudioSubsystem("PulseAudio Test");
|
|
|
|
PulseStream test_stream = test.CreateStream("Test Stream");
|
|
PulseStream test_stream2 = test.CreateStream("Another Test Stream");
|
|
|
|
Sound test_sound = Sound::FromPCMFile("wind.raw");
|
|
Sound ogg_test_sound = Sound::FromOGGVorbisFile("wind.ogg");
|
|
|
|
std::thread playback_thread([](PulseAudioSubsystem system, PulseStream stream, Sound sound){
|
|
system.Play(stream, sound);
|
|
}, test, test_stream, ogg_test_sound);
|
|
|
|
playback_thread.join();
|
|
|
|
playback_thread.detach();
|
|
|
|
|
|
//test.Play(test_stream2, ogg_test_sound);
|
|
|
|
std::cout << "This text will print after the sound plays." << std::endl;
|
|
|
|
return 0;
|
|
}
|
|
|
|
//Windows :(
|
|
#ifdef _WIN32
|
|
extern "C" {
|
|
int wmain(int argc, wchar_t* argv[]) {
|
|
return main();
|
|
}
|
|
}
|
|
#endif |