Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
63ac5e17
Commit
63ac5e17
authored
Dec 10, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update documentation to make it clear that structs are transparent.
parent
0e682351
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
miniaudio.h
miniaudio.h
+17
-0
No files found.
miniaudio.h
View file @
63ac5e17
...
@@ -26,6 +26,12 @@ miniaudio includes both low level and high level APIs. The low level API is good
...
@@ -26,6 +26,12 @@ miniaudio includes both low level and high level APIs. The low level API is good
to do all of their mixing themselves and only require a light weight interface to the underlying
to do all of their mixing themselves and only require a light weight interface to the underlying
audio device. The high level API is good for those who have complex mixing and effect requirements.
audio device. The high level API is good for those who have complex mixing and effect requirements.
In miniaudio, objects are transparent structures. Unlike many other libraries, there are no handles
to opaque objects which means you need to allocate memory for objects yourself. In the examples
presented in this documentation you will often see objects declared on the stack. You need to be
careful when translating these examples to your own code so that you don't accidentally declare
your objects on the stack and then cause them to become invalid once the function returns.
1.1. Low Level API
1.1. Low Level API
------------------
------------------
...
@@ -304,6 +310,17 @@ with `ma_engine_get_resource_manager()`. The engine itself is a node graph (`ma_
...
@@ -304,6 +310,17 @@ with `ma_engine_get_resource_manager()`. The engine itself is a node graph (`ma_
means you can pass a pointer to the engine object into any of the `ma_node_graph` APIs (with a
means you can pass a pointer to the engine object into any of the `ma_node_graph` APIs (with a
cast). Alternatively, you can use `ma_engine_get_node_graph()` instead of a cast.
cast). Alternatively, you can use `ma_engine_get_node_graph()` instead of a cast.
Note that all objects in miniaudio, including the `ma_engine` object in the example above, are
transparent structures. There are no handles to opaque structures in miniaudio which means you need
to be mindful of how you declare them. In the example above we are declaring it on the stack, but
this will result in the struct being invalidated once the function encapsulating it returns. If
allocating the engine on the heap is more appropriate, you can easily do so with a standard call
to malloc() or whatever heap allocation routine you like:
```c
ma_engine* pEngine = ma_malloc(sizeof(*pEngine), &myAllocationCallbacks);
```
The `ma_engine` API uses the same config/init pattern used all throughout miniaudio. To configure
The `ma_engine` API uses the same config/init pattern used all throughout miniaudio. To configure
an engine, you can fill out a `ma_engine_config` object and pass it into the first parameter of
an engine, you can fill out a `ma_engine_config` object and pass it into the first parameter of
`ma_engine_init()`:
`ma_engine_init()`:
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment