Refactored audiogen tool

This commit is contained in:
2023-02-13 17:07:24 -08:00
parent f1d13d2e45
commit 0794b8739c
21 changed files with 357 additions and 163 deletions

View File

@@ -5,9 +5,22 @@
#pragma once
#include "assert/assert.hpp"
#include "util/file.hpp"
#include "util/mathutils.hpp"
#if defined(_MSC_VER)
#include <direct.h>
#include <windows.h>
#define getcwd _getcwd
#define FILE_PATH_SEP '\\'
#define fileMkdir(path, perms) _mkdir(path)
#elif defined(__GNUC__)
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#define FILE_PATH_SEP '/'
#define fileMkdir(path, perms) mkdir(path, perms)
#endif
#define FILE_BUFFER_SIZE 512
namespace Dawn {
@@ -23,6 +36,9 @@ namespace Dawn {
size_t length;
public:
static std::string normalizeSlashes(std::string str);
static void mkdirp(std::string path);
std::string filename;
/**
@@ -47,6 +63,14 @@ namespace Dawn {
*/
bool_t isOpen();
/**
* Returns whether or not the file exists. Will open the connection if it
* does exist.
*
* @return True if exists, otherwsie if it doesn't.
*/
bool_t exists();
/**
* Closes the currently open interface to the file. Done automatically
* when this object is disposed.
@@ -78,6 +102,14 @@ namespace Dawn {
*/
bool_t writeString(std::string in);
/**
* Write raw bytes to the file.
*
* @param data Data to write.
* @return True if written successfully, otherwise false.
*/
bool_t writeRaw(char *data, size_t );
~File();
};
}