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
6f9da62c
Commit
6f9da62c
authored
Jul 17, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experiment with a new readme layout.
parent
5f18131f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
84 deletions
+88
-84
README.md
README.md
+88
-84
No files found.
README.md
View file @
6f9da62c
...
...
@@ -11,17 +11,97 @@
</p>
<p
align=
"center"
>
<a
href=
"#features"
>
Features
</a>
-
<a
href=
"#examples"
>
Examples
</a>
-
<a
href=
"#documentation"
>
Documentation
</a>
-
<a
href=
"#major-features"
>
Major Features
</a>
-
<a
href=
"#supported-platforms"
>
Supported Platforms
</a>
-
<a
href=
"#backends"
>
Backends
</a>
-
<a
href=
"#building"
>
Building
</a>
-
<a
href=
"#examples"
>
Examples
</a>
-
<a
href=
"#documentation"
>
Documentation
</a>
-
<a
href=
"#unofficial-bindings"
>
Unofficial Bindings
</a>
</p>
Featur
es
Exampl
es
========
This example shows how to decode and play a sound.
```
c
#define MINIAUDIO_IMPLEMENTATION
#include "../miniaudio.h"
#include <stdio.h>
void
data_callback
(
ma_device
*
pDevice
,
void
*
pOutput
,
const
void
*
pInput
,
ma_uint32
frameCount
)
{
ma_decoder
*
pDecoder
=
(
ma_decoder
*
)
pDevice
->
pUserData
;
if
(
pDecoder
==
NULL
)
{
return
;
}
ma_decoder_read_pcm_frames
(
pDecoder
,
pOutput
,
frameCount
);
(
void
)
pInput
;
}
int
main
(
int
argc
,
char
**
argv
)
{
ma_result
result
;
ma_decoder
decoder
;
ma_device_config
deviceConfig
;
ma_device
device
;
if
(
argc
<
2
)
{
printf
(
"No input file.
\n
"
);
return
-
1
;
}
result
=
ma_decoder_init_file
(
argv
[
1
],
NULL
,
&
decoder
);
if
(
result
!=
MA_SUCCESS
)
{
return
-
2
;
}
deviceConfig
=
ma_device_config_init
(
ma_device_type_playback
);
deviceConfig
.
playback
.
format
=
decoder
.
outputFormat
;
deviceConfig
.
playback
.
channels
=
decoder
.
outputChannels
;
deviceConfig
.
sampleRate
=
decoder
.
outputSampleRate
;
deviceConfig
.
dataCallback
=
data_callback
;
deviceConfig
.
pUserData
=
&
decoder
;
if
(
ma_device_init
(
NULL
,
&
deviceConfig
,
&
device
)
!=
MA_SUCCESS
)
{
printf
(
"Failed to open playback device.
\n
"
);
ma_decoder_uninit
(
&
decoder
);
return
-
3
;
}
if
(
ma_device_start
(
&
device
)
!=
MA_SUCCESS
)
{
printf
(
"Failed to start playback device.
\n
"
);
ma_device_uninit
(
&
device
);
ma_decoder_uninit
(
&
decoder
);
return
-
4
;
}
printf
(
"Press Enter to quit..."
);
getchar
();
ma_device_uninit
(
&
device
);
ma_decoder_uninit
(
&
decoder
);
return
0
;
}
```
More examples can be found in the
[
examples
](
examples
)
folder or online here: https://miniaud.io/docs/examples/
Documentation
=============
Online documentation can be found here: https://miniaud.io/docs/
Documentation can also be found at the top of
[
miniaudio.h
](
https://raw.githubusercontent.com/dr-soft/miniaudio/master/miniaudio.h
)
which is always the most up-to-date and authoritive source of information on how to use miniaudio. All other
documentation is generated from this in-code documentation.
Major Features
==============
-
Your choice of either public domain or
[
MIT No Attribution
](
https://github.com/aws/mit-0
)
.
-
Entirely contained within a single file for easy integration into your source tree.
-
No external dependencies except for the C standard library and backend libraries.
...
...
@@ -66,6 +146,9 @@ Features
-
WAV
-
Lock free ring buffer (single producer, single consumer).
Refer to the
[
Programming Manual
](
https://miniaud.io/docs/manual/
)
for a more complete description of
available features in miniaudio.
Supported Platforms
===================
...
...
@@ -117,87 +200,8 @@ single translation unit (AKA unity builds), you can just #include the .c file in
Note that the split version is auto-generated using a tool and is based on the main file in the root directory.
If you want to contribute, please make the change in the main file.
Examples
========
This example shows how to decode and play a sound.
```
c
#define MINIAUDIO_IMPLEMENTATION
#include "../miniaudio.h"
#include <stdio.h>
void
data_callback
(
ma_device
*
pDevice
,
void
*
pOutput
,
const
void
*
pInput
,
ma_uint32
frameCount
)
{
ma_decoder
*
pDecoder
=
(
ma_decoder
*
)
pDevice
->
pUserData
;
if
(
pDecoder
==
NULL
)
{
return
;
}
ma_decoder_read_pcm_frames
(
pDecoder
,
pOutput
,
frameCount
);
(
void
)
pInput
;
}
int
main
(
int
argc
,
char
**
argv
)
{
ma_result
result
;
ma_decoder
decoder
;
ma_device_config
deviceConfig
;
ma_device
device
;
if
(
argc
<
2
)
{
printf
(
"No input file.
\n
"
);
return
-
1
;
}
result
=
ma_decoder_init_file
(
argv
[
1
],
NULL
,
&
decoder
);
if
(
result
!=
MA_SUCCESS
)
{
return
-
2
;
}
deviceConfig
=
ma_device_config_init
(
ma_device_type_playback
);
deviceConfig
.
playback
.
format
=
decoder
.
outputFormat
;
deviceConfig
.
playback
.
channels
=
decoder
.
outputChannels
;
deviceConfig
.
sampleRate
=
decoder
.
outputSampleRate
;
deviceConfig
.
dataCallback
=
data_callback
;
deviceConfig
.
pUserData
=
&
decoder
;
if
(
ma_device_init
(
NULL
,
&
deviceConfig
,
&
device
)
!=
MA_SUCCESS
)
{
printf
(
"Failed to open playback device.
\n
"
);
ma_decoder_uninit
(
&
decoder
);
return
-
3
;
}
if
(
ma_device_start
(
&
device
)
!=
MA_SUCCESS
)
{
printf
(
"Failed to start playback device.
\n
"
);
ma_device_uninit
(
&
device
);
ma_decoder_uninit
(
&
decoder
);
return
-
4
;
}
printf
(
"Press Enter to quit..."
);
getchar
();
ma_device_uninit
(
&
device
);
ma_decoder_uninit
(
&
decoder
);
return
0
;
}
```
More examples can be found in the
[
examples
](
examples
)
folder.
Documentation
=============
Documentation can be found at the top of
[
miniaudio.h
](
https://raw.githubusercontent.com/dr-soft/miniaudio/master/miniaudio.h
)
which is always the most up-to-date and authoritive source of information on how to use miniaudio.
Vorbis Decoding
===============
---------------
Vorbis decoding is enabled via stb_vorbis. To use it, you need to include the header section of stb_vorbis
before the implementation of miniaudio. You can enable Vorbis by doing the following:
...
...
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