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
f30f75a8
Commit
f30f75a8
authored
Mar 06, 2019
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the blocking test.
parent
2866bc2b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
136 deletions
+12
-136
tests/mal_blocking.c
tests/mal_blocking.c
+0
-124
tests/mal_test_0.vcxproj
tests/mal_test_0.vcxproj
+12
-12
No files found.
tests/mal_blocking.c
deleted
100644 → 0
View file @
2866bc2b
#include <stdio.h>
#define DR_WAV_IMPLEMENTATION
#include "../extras/dr_wav.h"
#define MINI_AL_IMPLEMENTATION
#include "../mini_al.h"
void
on_log
(
mal_context
*
pContext
,
mal_device
*
pDevice
,
mal_uint32
logLevel
,
const
char
*
message
)
{
(
void
)
pContext
;
(
void
)
pDevice
;
(
void
)
logLevel
;
printf
(
"%s
\n
"
,
message
);
}
int
main
(
int
argc
,
char
**
argv
)
{
(
void
)
argc
;
(
void
)
argv
;
mal_result
result
;
mal_backend
backend
=
mal_backend_audio4
;
mal_context_config
contextConfig
=
mal_context_config_init
();
contextConfig
.
logCallback
=
on_log
;
mal_device_config
deviceConfig
=
mal_device_config_init
(
mal_device_type_playback
);
deviceConfig
.
playback
.
format
=
mal_format_f32
;
deviceConfig
.
capture
.
format
=
mal_format_f32
;
deviceConfig
.
bufferSizeInFrames
=
1024
*
8
;
//deviceConfig.bufferSizeInMilliseconds = 80;
deviceConfig
.
periods
=
2
;
#if 1
/* Playback */
mal_device
device
;
result
=
mal_device_init_ex
(
&
backend
,
1
,
NULL
,
&
deviceConfig
,
&
device
);
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Failed to initialize device.
\n
"
);
return
-
1
;
}
printf
(
"Is Passthrough: %s
\n
"
,
device
.
playback
.
converter
.
isPassthrough
?
"YES"
:
"NO"
);
printf
(
"Format: %s -> %s
\n
"
,
mal_get_format_name
(
device
.
playback
.
format
),
mal_get_format_name
(
device
.
playback
.
internalFormat
));
printf
(
"Channels: %d -> %d
\n
"
,
device
.
playback
.
channels
,
device
.
playback
.
internalChannels
);
printf
(
"Sample Rate: %d -> %d
\n
"
,
device
.
sampleRate
,
device
.
playback
.
internalSampleRate
);
printf
(
"Buffer Size In Frames: %d
\n
"
,
device
.
playback
.
internalBufferSizeInFrames
);
mal_decoder_config
decoderConfig
=
mal_decoder_config_init
(
mal_format_f32
,
device
.
playback
.
channels
,
device
.
sampleRate
);
mal_decoder
decoder
;
printf
(
"LOADING DECODER
\n
"
);
result
=
mal_decoder_init_file
(
"res/sine_s16_mono_48000.wav"
,
&
decoderConfig
,
&
decoder
);
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Failed to load sound file.
\n
"
);
}
/* The device is started by just writing data to it. In our case we are just writing a sine wave. */
mal_sine_wave
sineWave
;
mal_sine_wave_init
(
0
.
25
,
400
,
device
.
sampleRate
/
2
,
&
sineWave
);
mal_bool32
stopped
=
MAL_FALSE
;
while
(
!
stopped
)
{
float
buffer
[
1024
*
32
];
float
*
pBuffer
=
buffer
;
//mal_uint32 frameCount = (mal_uint32)mal_sine_wave_read_f32_ex(&sineWave, mal_countof(buffer) / device.playback.channels, device.playback.channels, mal_stream_layout_interleaved, &pBuffer);
mal_uint32
frameCount
=
(
mal_uint32
)
mal_decoder_read_pcm_frames
(
&
decoder
,
mal_countof
(
buffer
)
/
device
.
playback
.
channels
,
pBuffer
);
result
=
mal_device_write
(
&
device
,
pBuffer
,
frameCount
);
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Error occurred while writing to the device.
\n
"
);
break
;
}
printf
(
"TESTING: frameCount=%d
\n
"
,
frameCount
);
}
mal_decoder_uninit
(
&
decoder
);
#else
/* Capture */
mal_device
device
;
result
=
mal_device_init_ex
(
&
backend
,
1
,
NULL
,
&
deviceConfig
,
&
device
);
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Failed to initialize device.
\n
"
);
return
-
1
;
}
printf
(
"Is Passthrough: %s
\n
"
,
device
.
capture
.
converter
.
isPassthrough
?
"YES"
:
"NO"
);
printf
(
"Format: %s
\n
"
,
mal_get_format_name
(
device
.
capture
.
format
));
drwav_data_format
format
;
format
.
container
=
drwav_container_riff
;
format
.
format
=
DR_WAVE_FORMAT_IEEE_FLOAT
;
format
.
channels
=
device
.
capture
.
channels
;
format
.
sampleRate
=
device
.
sampleRate
;
format
.
bitsPerSample
=
32
;
drwav
*
pWav
=
drwav_open_file_write
(
"recording.wav"
,
&
format
);
if
(
pWav
==
NULL
)
{
printf
(
"Failed to open output wav file.
\n
"
);
return
-
1
;
}
int
counter
=
0
;
mal_bool32
stopped
=
MAL_FALSE
;
while
(
!
stopped
)
{
float
buffer
[
1024
*
4
];
mal_uint32
frameCount
=
mal_countof
(
buffer
)
/
device
.
capture
.
channels
;
result
=
mal_device_read
(
&
device
,
buffer
,
frameCount
);
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Error occurred while reading from the device.
\n
"
);
break
;
}
drwav_write_pcm_frames
(
pWav
,
frameCount
,
buffer
);
printf
(
"TESTING: frameCount=%d
\n
"
,
frameCount
);
if
(
counter
++
>
16
)
{
break
;
}
}
#endif
printf
(
"DONE
\n
"
);
return
0
;
}
tests/mal_test_0.vcxproj
View file @
f30f75a8
...
...
@@ -271,12 +271,12 @@
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
true
</ExcludedFromBuild>
</ClCompile>
<ClCompile
Include=
"..\examples\advanced_config.c"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|ARM'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|ARM'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
tru
e
</ExcludedFromBuild>
</ClCompile>
<ClCompile
Include=
"..\examples\simple_capture.c"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
true
</ExcludedFromBuild>
...
...
@@ -335,12 +335,12 @@
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
true
</ExcludedFromBuild>
</ClCompile>
<ClCompile
Include=
"mal_no_device_io.c"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|ARM'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
tru
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|ARM'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|ARM'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
fals
e
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
fals
e
</ExcludedFromBuild>
</ClCompile>
<ClCompile
Include=
"mal_profiling.c"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
true
</ExcludedFromBuild>
...
...
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