9 #define DM_EXTERN extern "C"
15 #if defined(_WIN32) || defined(__CYGWIN__)
18 #define DMAPI DM_EXTERN __attribute__((dllexport))
20 #define DMAPI DM_EXTERN __declspec(dllexport)
24 #define DMAPI DM_EXTERN __attribute__((dllimport))
26 #define DMAPI DM_EXTERN __declspec(dllimport)
31 #define DMAPI DM_EXTERN __attribute__((visibility("default")))
32 #define DMINT DM_EXTERN __attribute__((visibility("hidden")))
35 #define DMAPI DM_EXTERN
36 #define DMINT DM_EXTERN
196typedef void DmLogHandler(
void* ctx,
DmLogLevel lvl,
char const* msg);
size_t DmGuid_toString(DmGuid const *slf, char *out, size_t len)
Convert the given GUID to a string.
void Dm_setLogger(DmLogLevel lvl, DmLogHandler *log, void *ctx)
Set a callback to send log messages to.
DmResult
Possible operation result values.
DmLogLevel
The set of message levels supported by the logging facilities.
void DmMemoryFree(void *ctx, void *ptr)
A free-like memory de-allocation function.
void * DmMemoryAlloc(void *ctx, size_t len)
A malloc-like memory allocation function.
uint32_t DmRng(void *ctx)
A rand_r-like random number generation function.
void Dm_setRandomNumberGenerator(DmRng *rng, void *ctx)
Set the random number generator to use internally.
DmResult Dm_setHeapAllocator(DmMemoryAlloc *alloc, DmMemoryFree *free, void *ctx)
Set the memory allocator to use internally.
void Dm_setLoggerDefault(DmLogLevel lvl)
Set a default logging function.
void Dm_setLoggerLevel(DmLogLevel lvl)
Set the log level of the library.
@ DmResult_NOT_FOUND
A resource was not found.
@ DmResult_INVALID_ARGUMENT
An invalid argument was provided.
@ DmResult_INVALID_STATE
The operation could not be completed because the system is in an invalid state.
@ DmResult_SUCCESS
The operation completed successfully.
@ DmResult_MEMORY_EXHAUSTED
A memory allocation failed.
@ DmResult_FILE_CORRUPT
A resource file could not be parsed.
@ DmResult_MUTEX_ERROR
A mutex could not be locked.
@ DmLogLevel_TRACE
The log message is a tracing message.
@ DmLogLevel_DEBUG
The log message is a debug message.
@ DmLogLevel_WARN
The log message indicates a warning.
@ DmLogLevel_FATAL
The log message indicates a fatal error.
@ DmLogLevel_INFO
The log message is informational.
@ DmLogLevel_ERROR
The log message indicates an error.
DmLoaderOptions
Configuration flags for DirectMusic Loaders.
struct DmLoader DmLoader
Represents a DirectMusic Loader.
DmResult DmLoader_create(DmLoader **slf, DmLoaderOptions opt)
Create a new DirectMusic Loader object.
void * DmLoaderResolverCallback(void *ctx, char const *file, size_t *len)
A function used to look up and read in DirectMusic objects by file name.
DmResult DmLoader_getSegment(DmLoader *slf, char const *name, DmSegment **segment)
Get a segment from the loader's cache or load it by file name.
void DmLoader_release(DmLoader *slf)
Subtract one from the reference count of a loader.
DmResult DmLoader_addResolver(DmLoader *slf, DmLoaderResolverCallback *resolve, void *ctx)
Add a resolver to the loader.
DmLoader * DmLoader_retain(DmLoader *slf)
Add one to the reference count of a loader.
@ DmLoader_DOWNLOAD
Automatically download references.
@ DmLoader_DEFAULT
Default options for loader objects.
DmSegment * DmSegment_retain(DmSegment *slf)
Add one to the reference count of a segment.
DmResult DmSegment_download(DmSegment *slf, DmLoader *loader)
Download all resources needed by the segment.
DmGuid const * DmSegment_getGuid(DmSegment const *slf)
Get the GUID of the given segment.
char const * DmSegment_getName(DmSegment const *slf)
Get the name of the given segment.
struct DmSegment DmSegment
Represents a DirectMusic Segment.
void DmSegment_release(DmSegment *slf)
Subtract one from the reference count of a segment.
uint32_t DmSegment_getRepeats(DmSegment const *slf)
Get the number of times the segment repeats.
double DmSegment_getLength(DmSegment const *slf)
Get the length of the given segment in seconds.
Contains a 128-bit GUID (aka UUID) value.
uint8_t data[16]
The bytes representing the GUID's value.