Capture error when requested file does not exist. An error message indicating missing file is now thrown to the API user.
This commit is contained in:
@@ -85,8 +85,8 @@ You know the drill, send those pull requests.
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
ReMixer is licensed under the MIT License. See the LICENSE file for more details.
|
ReMixer is expressly licensed to the Public Domain. See the LICENSE file for details.
|
||||||
|
|
||||||
## Contact
|
## Acknowledgements
|
||||||
|
|
||||||
For questions or support, please contact your-email@example.com.
|
ReMixer is developed and maintained by the boys from Redacted Software.
|
@@ -15,11 +15,13 @@
|
|||||||
#include <pulse/stream.h>
|
#include <pulse/stream.h>
|
||||||
#include <pulse/thread-mainloop.h>
|
#include <pulse/thread-mainloop.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "sound.h"
|
#include <ReMixer/sound.h>
|
||||||
#include "SoundSubsystem.h"
|
#include <ReMixer/SoundSubsystem.h>
|
||||||
#include <ReMixer/ReMixer.h>
|
#include <ReMixer/ReMixer.h>
|
||||||
|
|
||||||
namespace ReMixer {
|
namespace ReMixer {
|
||||||
|
|
||||||
|
|
||||||
class Stream {
|
class Stream {
|
||||||
private:
|
private:
|
||||||
std::string name;
|
std::string name;
|
||||||
|
7
main.cpp
7
main.cpp
@@ -4,9 +4,9 @@
|
|||||||
/// (c) 2024 Redacted Software
|
/// (c) 2024 Redacted Software
|
||||||
/// This work is explicitly dedicated to the public domain, for the hopeful betterment of the software industry.
|
/// This work is explicitly dedicated to the public domain, for the hopeful betterment of the software industry.
|
||||||
|
|
||||||
/// @file StreamManager.h
|
/// @file main.cpp
|
||||||
/// @desc This class manages internal creation and storage of active Streams.
|
/// @desc This file is the program code for the ReMixer-Test program.
|
||||||
/// @edit 2024-08-06
|
/// @edit 2024-08-30
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vorbis/codec.h>
|
#include <vorbis/codec.h>
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
test.Play(test_stream, test_sound);
|
test.Play(test_stream, test_sound);
|
||||||
//test.Play(test_stream2, ogg_test_sound);
|
//test.Play(test_stream2, ogg_test_sound);
|
||||||
|
|
||||||
|
std::cout << "This text will print after the sound plays>" << std::endl;
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
//std::this_thread::sleep_for(25ms);
|
//std::this_thread::sleep_for(25ms);
|
||||||
|
@@ -24,9 +24,13 @@ ReMixer::Sound ReMixer::Sound::FromPCMBuffer(std::vector<char> buffer, uint samp
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ReMixer::Sound::LoadPCMFile(const std::filesystem::path &file_name, uint sampleRate, StreamMode streamMode) {
|
void ReMixer::Sound::LoadPCMFile(const std::filesystem::path &file_name, uint sampleRate, StreamMode streamMode) {
|
||||||
|
|
||||||
|
|
||||||
std::ifstream file(file_name, std::ios::binary | std::ios::ate);
|
std::ifstream file(file_name, std::ios::binary | std::ios::ate);
|
||||||
|
|
||||||
|
if (!file.is_open())
|
||||||
|
{
|
||||||
|
throw std::runtime_error(std::format("No such file {} could be found", file_name.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
file.unsetf(std::ios::skipws);
|
file.unsetf(std::ios::skipws);
|
||||||
|
|
||||||
file.seekg(0, std::ios::end);
|
file.seekg(0, std::ios::end);
|
||||||
|
Reference in New Issue
Block a user