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
35af204e
Commit
35af204e
authored
Dec 03, 2017
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up whitespace.
parent
5d0705b3
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
567 additions
and
567 deletions
+567
-567
README.md
README.md
+7
-7
examples/advanced_config.c
examples/advanced_config.c
+8
-8
examples/multi_playback.c
examples/multi_playback.c
+78
-78
examples/simple_capture.c
examples/simple_capture.c
+3
-3
examples/simple_enumeration.c
examples/simple_enumeration.c
+34
-34
examples/simple_playback.c
examples/simple_playback.c
+7
-7
mini_al.h
mini_al.h
+430
-430
No files found.
README.md
View file @
35af204e
...
@@ -73,7 +73,7 @@ mal_uint32 on_send_frames_to_device(mal_device* pDevice, mal_uint32 frameCount,
...
@@ -73,7 +73,7 @@ mal_uint32 on_send_frames_to_device(mal_device* pDevice, mal_uint32 frameCount,
if
(
pWav
==
NULL
)
{
if
(
pWav
==
NULL
)
{
return
0
;
return
0
;
}
}
return
(
mal_uint32
)
drwav_read_s16
(
pWav
,
frameCount
*
pDevice
->
channels
,
(
mal_int16
*
)
pSamples
)
/
pDevice
->
channels
;
return
(
mal_uint32
)
drwav_read_s16
(
pWav
,
frameCount
*
pDevice
->
channels
,
(
mal_int16
*
)
pSamples
)
/
pDevice
->
channels
;
}
}
...
@@ -93,12 +93,12 @@ int main(int argc, char** argv)
...
@@ -93,12 +93,12 @@ int main(int argc, char** argv)
mal_context
context
;
mal_context
context
;
if
(
mal_context_init
(
NULL
,
0
,
NULL
,
&
context
)
!=
MAL_SUCCESS
)
{
if
(
mal_context_init
(
NULL
,
0
,
NULL
,
&
context
)
!=
MAL_SUCCESS
)
{
printf
(
"Failed to initialize context.
\n
"
);
printf
(
"Failed to initialize context.
\n
"
);
drwav_uninit
(
&
wav
);
drwav_uninit
(
&
wav
);
return
-
3
;
return
-
3
;
}
}
mal_device_config
config
=
mal_device_config_init_playback
(
mal_format_s16
,
wav
.
channels
,
wav
.
sampleRate
,
on_send_frames_to_device
);
mal_device_config
config
=
mal_device_config_init_playback
(
mal_format_s16
,
wav
.
channels
,
wav
.
sampleRate
,
on_send_frames_to_device
);
mal_device
device
;
mal_device
device
;
if
(
mal_device_init
(
&
context
,
mal_device_type_playback
,
NULL
,
&
config
,
&
wav
,
&
device
)
!=
MAL_SUCCESS
)
{
if
(
mal_device_init
(
&
context
,
mal_device_type_playback
,
NULL
,
&
config
,
&
wav
,
&
device
)
!=
MAL_SUCCESS
)
{
printf
(
"Failed to open playback device.
\n
"
);
printf
(
"Failed to open playback device.
\n
"
);
...
@@ -114,14 +114,14 @@ int main(int argc, char** argv)
...
@@ -114,14 +114,14 @@ int main(int argc, char** argv)
drwav_uninit
(
&
wav
);
drwav_uninit
(
&
wav
);
return
-
5
;
return
-
5
;
}
}
printf
(
"Press Enter to quit..."
);
printf
(
"Press Enter to quit..."
);
getchar
();
getchar
();
mal_device_uninit
(
&
device
);
mal_device_uninit
(
&
device
);
mal_context_uninit
(
&
context
);
mal_context_uninit
(
&
context
);
drwav_uninit
(
&
wav
);
drwav_uninit
(
&
wav
);
return
0
;
return
0
;
}
}
```
```
...
...
examples/advanced_config.c
View file @
35af204e
...
@@ -81,9 +81,9 @@ int main(int argc, char** argv)
...
@@ -81,9 +81,9 @@ int main(int argc, char** argv)
}
}
printf
(
"Playback Devices (%d)
\n
"
,
playbackDeviceCount
);
printf
(
"Playback Devices (%d)
\n
"
,
playbackDeviceCount
);
for
(
mal_uint32
iDevice
=
0
;
iDevice
<
playbackDeviceCount
;
++
iDevice
)
{
for
(
mal_uint32
iDevice
=
0
;
iDevice
<
playbackDeviceCount
;
++
iDevice
)
{
printf
(
" %u: %s
\n
"
,
iDevice
,
pPlaybackDeviceInfos
[
iDevice
].
name
);
printf
(
" %u: %s
\n
"
,
iDevice
,
pPlaybackDeviceInfos
[
iDevice
].
name
);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
...
@@ -103,9 +103,9 @@ int main(int argc, char** argv)
...
@@ -103,9 +103,9 @@ int main(int argc, char** argv)
}
}
printf
(
"Capture Devices (%d)
\n
"
,
captureDeviceCount
);
printf
(
"Capture Devices (%d)
\n
"
,
captureDeviceCount
);
for
(
mal_uint32
iDevice
=
0
;
iDevice
<
captureDeviceCount
;
++
iDevice
)
{
for
(
mal_uint32
iDevice
=
0
;
iDevice
<
captureDeviceCount
;
++
iDevice
)
{
printf
(
" %u: %s
\n
"
,
iDevice
,
pCaptureDeviceInfos
[
iDevice
].
name
);
printf
(
" %u: %s
\n
"
,
iDevice
,
pCaptureDeviceInfos
[
iDevice
].
name
);
}
}
// Open the device.
// Open the device.
...
@@ -169,10 +169,10 @@ int main(int argc, char** argv)
...
@@ -169,10 +169,10 @@ int main(int argc, char** argv)
printf
(
"Press Enter to quit..."
);
printf
(
"Press Enter to quit..."
);
getchar
();
getchar
();
mal_device_uninit
(
&
playbackDevice
);
mal_device_uninit
(
&
playbackDevice
);
mal_context_uninit
(
&
context
);
mal_context_uninit
(
&
context
);
return
0
;
return
0
;
}
}
examples/multi_playback.c
View file @
35af204e
...
@@ -22,96 +22,96 @@
...
@@ -22,96 +22,96 @@
mal_uint32
on_send_flac_frames_to_device
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
void
*
pSamples
)
mal_uint32
on_send_flac_frames_to_device
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
void
*
pSamples
)
{
{
drflac
*
pFlac
=
(
drflac
*
)
pDevice
->
pUserData
;
drflac
*
pFlac
=
(
drflac
*
)
pDevice
->
pUserData
;
if
(
pFlac
==
NULL
)
{
if
(
pFlac
==
NULL
)
{
return
0
;
return
0
;
}
}
return
(
mal_uint32
)
drflac_read_s16
(
pFlac
,
frameCount
*
pDevice
->
channels
,
(
mal_int16
*
)
pSamples
)
/
pDevice
->
channels
;
return
(
mal_uint32
)
drflac_read_s16
(
pFlac
,
frameCount
*
pDevice
->
channels
,
(
mal_int16
*
)
pSamples
)
/
pDevice
->
channels
;
}
}
mal_uint32
on_send_wav_frames_to_device
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
void
*
pSamples
)
mal_uint32
on_send_wav_frames_to_device
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
void
*
pSamples
)
{
{
drwav
*
pWav
=
(
drwav
*
)
pDevice
->
pUserData
;
drwav
*
pWav
=
(
drwav
*
)
pDevice
->
pUserData
;
if
(
pWav
==
NULL
)
{
if
(
pWav
==
NULL
)
{
return
0
;
return
0
;
}
}
return
(
mal_uint32
)
drwav_read_s16
(
pWav
,
frameCount
*
pDevice
->
channels
,
(
mal_int16
*
)
pSamples
)
/
pDevice
->
channels
;
return
(
mal_uint32
)
drwav_read_s16
(
pWav
,
frameCount
*
pDevice
->
channels
,
(
mal_int16
*
)
pSamples
)
/
pDevice
->
channels
;
}
}
mal_uint32
on_send_vorbis_frames_to_device
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
void
*
pSamples
)
mal_uint32
on_send_vorbis_frames_to_device
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
void
*
pSamples
)
{
{
stb_vorbis
*
pVorbis
=
(
stb_vorbis
*
)
pDevice
->
pUserData
;
stb_vorbis
*
pVorbis
=
(
stb_vorbis
*
)
pDevice
->
pUserData
;
if
(
pVorbis
==
NULL
)
{
if
(
pVorbis
==
NULL
)
{
return
0
;
return
0
;
}
}
return
(
mal_uint32
)
stb_vorbis_get_samples_short_interleaved
(
pVorbis
,
pDevice
->
channels
,
(
short
*
)
pSamples
,
frameCount
*
pDevice
->
channels
)
/
pDevice
->
channels
;
return
(
mal_uint32
)
stb_vorbis_get_samples_short_interleaved
(
pVorbis
,
pDevice
->
channels
,
(
short
*
)
pSamples
,
frameCount
*
pDevice
->
channels
)
/
pDevice
->
channels
;
}
}
mal_uint32
on_send_mod_frames_to_device
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
void
*
pSamples
)
mal_uint32
on_send_mod_frames_to_device
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
void
*
pSamples
)
{
{
jar_mod_context_t
*
pMod
=
(
jar_mod_context_t
*
)
pDevice
->
pUserData
;
jar_mod_context_t
*
pMod
=
(
jar_mod_context_t
*
)
pDevice
->
pUserData
;
if
(
pMod
==
NULL
)
{
if
(
pMod
==
NULL
)
{
return
0
;
return
0
;
}
}
jar_mod_fillbuffer
(
pMod
,
(
mal_int16
*
)
pSamples
,
frameCount
,
0
);
jar_mod_fillbuffer
(
pMod
,
(
mal_int16
*
)
pSamples
,
frameCount
,
0
);
return
frameCount
;
return
frameCount
;
}
}
mal_uint32
on_send_xm_frames_to_device
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
void
*
pSamples
)
mal_uint32
on_send_xm_frames_to_device
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
void
*
pSamples
)
{
{
jar_xm_context_t
*
pXM
=
(
jar_xm_context_t
*
)
pDevice
->
pUserData
;
jar_xm_context_t
*
pXM
=
(
jar_xm_context_t
*
)
pDevice
->
pUserData
;
if
(
pXM
==
NULL
)
{
if
(
pXM
==
NULL
)
{
return
0
;
return
0
;
}
}
jar_xm_generate_samples_16bit
(
pXM
,
(
short
*
)
pSamples
,
frameCount
);
jar_xm_generate_samples_16bit
(
pXM
,
(
short
*
)
pSamples
,
frameCount
);
return
frameCount
;
return
frameCount
;
}
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
int
exitcode
=
0
;
int
exitcode
=
0
;
if
(
argc
<
2
)
{
if
(
argc
<
2
)
{
printf
(
"No input file."
);
printf
(
"No input file."
);
return
-
1
;
return
-
1
;
}
}
enum
{
UNK
,
FLAC
,
WAV
,
VORBIS
,
MOD
,
XM
}
type
=
UNK
;
enum
{
UNK
,
FLAC
,
WAV
,
VORBIS
,
MOD
,
XM
}
type
=
UNK
;
jar_mod_context_t
mod
;
jar_mod_context_t
mod
;
jar_mod_init
(
&
mod
);
jar_mod_init
(
&
mod
);
jar_xm_context_t
*
xm
=
0
;
jar_xm_context_t
*
xm
=
0
;
drflac
*
flac
=
NULL
;
drflac
*
flac
=
NULL
;
drwav
*
wav
=
NULL
;
drwav
*
wav
=
NULL
;
stb_vorbis
*
vorbis
=
NULL
;
stb_vorbis
*
vorbis
=
NULL
;
if
(
type
==
UNK
&&
(
flac
=
drflac_open_file
(
argv
[
1
]))
!=
NULL
)
type
=
FLAC
;
if
(
type
==
UNK
&&
(
flac
=
drflac_open_file
(
argv
[
1
]))
!=
NULL
)
type
=
FLAC
;
if
(
type
==
UNK
&&
(
wav
=
drwav_open_file
(
argv
[
1
]))
!=
NULL
)
type
=
WAV
;
if
(
type
==
UNK
&&
(
wav
=
drwav_open_file
(
argv
[
1
]))
!=
NULL
)
type
=
WAV
;
if
(
type
==
UNK
&&
(
vorbis
=
stb_vorbis_open_filename
(
argv
[
1
],
NULL
,
NULL
))
!=
NULL
)
type
=
VORBIS
;
if
(
type
==
UNK
&&
(
vorbis
=
stb_vorbis_open_filename
(
argv
[
1
],
NULL
,
NULL
))
!=
NULL
)
type
=
VORBIS
;
if
(
type
==
UNK
&&
(
jar_xm_create_context_from_file
(
&
xm
,
48000
,
argv
[
1
])
==
0
))
type
=
XM
;
if
(
type
==
UNK
&&
(
jar_xm_create_context_from_file
(
&
xm
,
48000
,
argv
[
1
])
==
0
))
type
=
XM
;
if
(
type
==
UNK
&&
(
jar_mod_load_file
(
&
mod
,
argv
[
1
])
!=
0
)
)
type
=
MOD
;
if
(
type
==
UNK
&&
(
jar_mod_load_file
(
&
mod
,
argv
[
1
])
!=
0
)
)
type
=
MOD
;
if
(
type
==
UNK
)
{
if
(
type
==
UNK
)
{
printf
(
"Not a valid input file."
);
printf
(
"Not a valid input file."
);
exitcode
=
-
2
;
exitcode
=
-
2
;
goto
end
;
goto
end
;
}
}
mal_context
context
;
mal_context
context
;
if
(
mal_context_init
(
NULL
,
0
,
NULL
,
&
context
)
!=
MAL_SUCCESS
)
{
if
(
mal_context_init
(
NULL
,
0
,
NULL
,
&
context
)
!=
MAL_SUCCESS
)
{
printf
(
"Failed to initialize context."
);
printf
(
"Failed to initialize context."
);
exitcode
=
-
3
;
exitcode
=
-
3
;
goto
end
;
goto
end
;
}
}
void
*
pUserData
=
NULL
;
void
*
pUserData
=
NULL
;
mal_device_config
config
;
mal_device_config
config
;
switch
(
type
)
switch
(
type
)
{
{
case
FLAC
:
case
FLAC
:
...
@@ -140,34 +140,34 @@ int main(int argc, char** argv)
...
@@ -140,34 +140,34 @@ int main(int argc, char** argv)
break
;
break
;
}
}
mal_device
device
;
mal_device
device
;
if
(
mal_device_init
(
&
context
,
mal_device_type_playback
,
NULL
,
&
config
,
pUserData
,
&
device
)
!=
MAL_SUCCESS
)
{
if
(
mal_device_init
(
&
context
,
mal_device_type_playback
,
NULL
,
&
config
,
pUserData
,
&
device
)
!=
MAL_SUCCESS
)
{
printf
(
"Failed to open playback device."
);
printf
(
"Failed to open playback device."
);
mal_context_uninit
(
&
context
);
mal_context_uninit
(
&
context
);
exitcode
=
-
4
;
exitcode
=
-
4
;
goto
end
;
goto
end
;
}
}
if
(
mal_device_start
(
&
device
)
!=
MAL_SUCCESS
)
{
if
(
mal_device_start
(
&
device
)
!=
MAL_SUCCESS
)
{
printf
(
"Failed to start playback device.
\n
"
);
printf
(
"Failed to start playback device.
\n
"
);
mal_device_uninit
(
&
device
);
mal_device_uninit
(
&
device
);
mal_context_uninit
(
&
context
);
mal_context_uninit
(
&
context
);
exitcode
=
-
4
;
exitcode
=
-
4
;
goto
end
;
goto
end
;
}
}
printf
(
"Press Enter to quit..."
);
printf
(
"Press Enter to quit..."
);
getchar
();
getchar
();
mal_device_uninit
(
&
device
);
mal_device_uninit
(
&
device
);
mal_context_uninit
(
&
context
);
mal_context_uninit
(
&
context
);
end:
;
end:
;
drflac_close
(
flac
);
drflac_close
(
flac
);
drwav_close
(
wav
);
drwav_close
(
wav
);
stb_vorbis_close
(
vorbis
);
stb_vorbis_close
(
vorbis
);
jar_mod_unload
(
&
mod
);
jar_mod_unload
(
&
mod
);
if
(
xm
)
jar_xm_free_context
(
xm
);
if
(
xm
)
jar_xm_free_context
(
xm
);
return
exitcode
;
return
exitcode
;
}
}
examples/simple_capture.c
View file @
35af204e
...
@@ -15,7 +15,7 @@ mal_uint32 playbackSample = 0;
...
@@ -15,7 +15,7 @@ mal_uint32 playbackSample = 0;
void
on_recv_frames
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
const
void
*
pSamples
)
void
on_recv_frames
(
mal_device
*
pDevice
,
mal_uint32
frameCount
,
const
void
*
pSamples
)
{
{
mal_uint32
sampleCount
=
frameCount
*
pDevice
->
channels
;
mal_uint32
sampleCount
=
frameCount
*
pDevice
->
channels
;
mal_uint32
newCapturedSampleCount
=
capturedSampleCount
+
sampleCount
;
mal_uint32
newCapturedSampleCount
=
capturedSampleCount
+
sampleCount
;
mal_int16
*
pNewCapturedSamples
=
(
mal_int16
*
)
realloc
(
pCapturedSamples
,
newCapturedSampleCount
*
sizeof
(
mal_int16
));
mal_int16
*
pNewCapturedSamples
=
(
mal_int16
*
)
realloc
(
pCapturedSamples
,
newCapturedSampleCount
*
sizeof
(
mal_int16
));
if
(
pNewCapturedSamples
==
NULL
)
{
if
(
pNewCapturedSamples
==
NULL
)
{
...
@@ -74,8 +74,8 @@ int main()
...
@@ -74,8 +74,8 @@ int main()
getchar
();
getchar
();
mal_device_uninit
(
&
captureDevice
);
mal_device_uninit
(
&
captureDevice
);
printf
(
"Playing...
\n
"
);
printf
(
"Playing...
\n
"
);
mal_device
playbackDevice
;
mal_device
playbackDevice
;
...
...
examples/simple_enumeration.c
View file @
35af204e
...
@@ -14,40 +14,40 @@ int main(int argc, char** argv)
...
@@ -14,40 +14,40 @@ int main(int argc, char** argv)
return
-
2
;
return
-
2
;
}
}
mal_device_info
infos
[
32
];
mal_device_info
infos
[
32
];
mal_uint32
infoCount
=
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
mal_uint32
infoCount
=
sizeof
(
infos
)
/
sizeof
(
infos
[
0
]);
// Playback devices.
// Playback devices.
mal_result
result
=
mal_enumerate_devices
(
&
context
,
mal_device_type_playback
,
&
infoCount
,
infos
);
mal_result
result
=
mal_enumerate_devices
(
&
context
,
mal_device_type_playback
,
&
infoCount
,
infos
);
if
(
result
!=
MAL_SUCCESS
)
{
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Failed to enumerate playback devices."
);
printf
(
"Failed to enumerate playback devices."
);
mal_context_uninit
(
&
context
);
mal_context_uninit
(
&
context
);
return
-
3
;
return
-
3
;
}
}
printf
(
"Playback Devices
\n
"
);
printf
(
"Playback Devices
\n
"
);
for
(
mal_uint32
iDevice
=
0
;
iDevice
<
infoCount
;
++
iDevice
)
{
for
(
mal_uint32
iDevice
=
0
;
iDevice
<
infoCount
;
++
iDevice
)
{
printf
(
" %u: %s
\n
"
,
iDevice
,
infos
[
iDevice
].
name
);
printf
(
" %u: %s
\n
"
,
iDevice
,
infos
[
iDevice
].
name
);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
// Capture devices.
// Capture devices.
result
=
mal_enumerate_devices
(
&
context
,
mal_device_type_capture
,
&
infoCount
,
infos
);
result
=
mal_enumerate_devices
(
&
context
,
mal_device_type_capture
,
&
infoCount
,
infos
);
if
(
result
!=
MAL_SUCCESS
)
{
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Failed to enumerate capture devices."
);
printf
(
"Failed to enumerate capture devices."
);
mal_context_uninit
(
&
context
);
mal_context_uninit
(
&
context
);
return
-
4
;
return
-
4
;
}
}
printf
(
"Capture Devices
\n
"
);
printf
(
"Capture Devices
\n
"
);
for
(
mal_uint32
iDevice
=
0
;
iDevice
<
infoCount
;
++
iDevice
)
{
for
(
mal_uint32
iDevice
=
0
;
iDevice
<
infoCount
;
++
iDevice
)
{
printf
(
" %u: %s
\n
"
,
iDevice
,
infos
[
iDevice
].
name
);
printf
(
" %u: %s
\n
"
,
iDevice
,
infos
[
iDevice
].
name
);
}
}
mal_context_uninit
(
&
context
);
mal_context_uninit
(
&
context
);
return
0
;
return
0
;
}
}
examples/simple_playback.c
View file @
35af204e
...
@@ -13,7 +13,7 @@ mal_uint32 on_send_frames_to_device(mal_device* pDevice, mal_uint32 frameCount,
...
@@ -13,7 +13,7 @@ mal_uint32 on_send_frames_to_device(mal_device* pDevice, mal_uint32 frameCount,
if
(
pWav
==
NULL
)
{
if
(
pWav
==
NULL
)
{
return
0
;
return
0
;
}
}
return
(
mal_uint32
)
drwav_read_s16
(
pWav
,
frameCount
*
pDevice
->
channels
,
(
mal_int16
*
)
pSamples
)
/
pDevice
->
channels
;
return
(
mal_uint32
)
drwav_read_s16
(
pWav
,
frameCount
*
pDevice
->
channels
,
(
mal_int16
*
)
pSamples
)
/
pDevice
->
channels
;
}
}
...
@@ -33,12 +33,12 @@ int main(int argc, char** argv)
...
@@ -33,12 +33,12 @@ int main(int argc, char** argv)
mal_context
context
;
mal_context
context
;
if
(
mal_context_init
(
NULL
,
0
,
NULL
,
&
context
)
!=
MAL_SUCCESS
)
{
if
(
mal_context_init
(
NULL
,
0
,
NULL
,
&
context
)
!=
MAL_SUCCESS
)
{
printf
(
"Failed to initialize context.
\n
"
);
printf
(
"Failed to initialize context.
\n
"
);
drwav_uninit
(
&
wav
);
drwav_uninit
(
&
wav
);
return
-
3
;
return
-
3
;
}
}
mal_device_config
config
=
mal_device_config_init_playback
(
mal_format_s16
,
wav
.
channels
,
wav
.
sampleRate
,
on_send_frames_to_device
);
mal_device_config
config
=
mal_device_config_init_playback
(
mal_format_s16
,
wav
.
channels
,
wav
.
sampleRate
,
on_send_frames_to_device
);
mal_device
device
;
mal_device
device
;
if
(
mal_device_init
(
&
context
,
mal_device_type_playback
,
NULL
,
&
config
,
&
wav
,
&
device
)
!=
MAL_SUCCESS
)
{
if
(
mal_device_init
(
&
context
,
mal_device_type_playback
,
NULL
,
&
config
,
&
wav
,
&
device
)
!=
MAL_SUCCESS
)
{
printf
(
"Failed to open playback device.
\n
"
);
printf
(
"Failed to open playback device.
\n
"
);
...
@@ -54,13 +54,13 @@ int main(int argc, char** argv)
...
@@ -54,13 +54,13 @@ int main(int argc, char** argv)
drwav_uninit
(
&
wav
);
drwav_uninit
(
&
wav
);
return
-
5
;
return
-
5
;
}
}
printf
(
"Press Enter to quit..."
);
printf
(
"Press Enter to quit..."
);
getchar
();
getchar
();
mal_device_uninit
(
&
device
);
mal_device_uninit
(
&
device
);
mal_context_uninit
(
&
context
);
mal_context_uninit
(
&
context
);
drwav_uninit
(
&
wav
);
drwav_uninit
(
&
wav
);
return
0
;
return
0
;
}
}
mini_al.h
View file @
35af204e
This diff is collapsed.
Click to expand it.
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