1
0
forked from Redacted/ReMixer

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:
2024-08-30 12:52:45 -05:00
parent c1c5969058
commit d6433afe46
4 changed files with 17 additions and 10 deletions

View File

@@ -85,8 +85,8 @@ You know the drill, send those pull requests.
## 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.

View File

@@ -15,11 +15,13 @@
#include <pulse/stream.h>
#include <pulse/thread-mainloop.h>
#include <iostream>
#include "sound.h"
#include "SoundSubsystem.h"
#include <ReMixer/sound.h>
#include <ReMixer/SoundSubsystem.h>
#include <ReMixer/ReMixer.h>
namespace ReMixer {
class Stream {
private:
std::string name;

View File

@@ -4,9 +4,9 @@
/// (c) 2024 Redacted Software
/// This work is explicitly dedicated to the public domain, for the hopeful betterment of the software industry.
/// @file StreamManager.h
/// @desc This class manages internal creation and storage of active Streams.
/// @edit 2024-08-06
/// @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>
@@ -37,6 +37,7 @@
test.Play(test_stream, test_sound);
//test.Play(test_stream2, ogg_test_sound);
std::cout << "This text will print after the sound plays>" << std::endl;
while(true)
{
//std::this_thread::sleep_for(25ms);

View File

@@ -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) {
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.seekg(0, std::ios::end);