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
d1f26b4d
Commit
d1f26b4d
authored
Feb 19, 2019
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bugs with sndio.
parent
7fba7e5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
mini_al.h
mini_al.h
+2
-0
tests/mal_blocking.c
tests/mal_blocking.c
+11
-1
No files found.
mini_al.h
View file @
d1f26b4d
...
@@ -17786,6 +17786,7 @@ mal_result mal_device_init_handle__sndio(mal_context* pContext, const mal_device
...
@@ -17786,6 +17786,7 @@ mal_result mal_device_init_handle__sndio(mal_context* pContext, const mal_device
internalBufferSizeInFrames = par.appbufsz;
internalBufferSizeInFrames = par.appbufsz;
if (deviceType == mal_device_type_capture) {
if (deviceType == mal_device_type_capture) {
pDevice->sndio.handleCapture = handle;
pDevice->capture.internalFormat = internalFormat;
pDevice->capture.internalFormat = internalFormat;
pDevice->capture.internalChannels = internalChannels;
pDevice->capture.internalChannels = internalChannels;
pDevice->capture.internalSampleRate = internalSampleRate;
pDevice->capture.internalSampleRate = internalSampleRate;
...
@@ -17793,6 +17794,7 @@ mal_result mal_device_init_handle__sndio(mal_context* pContext, const mal_device
...
@@ -17793,6 +17794,7 @@ mal_result mal_device_init_handle__sndio(mal_context* pContext, const mal_device
pDevice->capture.internalBufferSizeInFrames = internalBufferSizeInFrames;
pDevice->capture.internalBufferSizeInFrames = internalBufferSizeInFrames;
pDevice->capture.internalPeriods = internalPeriods;
pDevice->capture.internalPeriods = internalPeriods;
} else {
} else {
pDevice->sndio.handlePlayback = handle;
pDevice->playback.internalFormat = internalFormat;
pDevice->playback.internalFormat = internalFormat;
pDevice->playback.internalChannels = internalChannels;
pDevice->playback.internalChannels = internalChannels;
pDevice->playback.internalSampleRate = internalSampleRate;
pDevice->playback.internalSampleRate = internalSampleRate;
tests/mal_blocking.c
View file @
d1f26b4d
...
@@ -6,6 +6,14 @@
...
@@ -6,6 +6,14 @@
#define MINI_AL_IMPLEMENTATION
#define MINI_AL_IMPLEMENTATION
#include "../mini_al.h"
#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
)
int
main
(
int
argc
,
char
**
argv
)
{
{
(
void
)
argc
;
(
void
)
argc
;
...
@@ -14,6 +22,9 @@ int main(int argc, char** argv)
...
@@ -14,6 +22,9 @@ int main(int argc, char** argv)
mal_result
result
;
mal_result
result
;
mal_backend
backend
=
mal_backend_audio4
;
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
);
mal_device_config
deviceConfig
=
mal_device_config_init
(
mal_device_type_playback
);
deviceConfig
.
playback
.
format
=
mal_format_f32
;
deviceConfig
.
playback
.
format
=
mal_format_f32
;
deviceConfig
.
capture
.
format
=
mal_format_f32
;
deviceConfig
.
capture
.
format
=
mal_format_f32
;
...
@@ -53,7 +64,6 @@ int main(int argc, char** argv)
...
@@ -53,7 +64,6 @@ int main(int argc, char** argv)
float
buffer
[
1024
*
32
];
float
*
pBuffer
=
buffer
;
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_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
);
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
);
result
=
mal_device_write
(
&
device
,
pBuffer
,
frameCount
);
if
(
result
!=
MAL_SUCCESS
)
{
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Error occurred while writing to the device.
\n
"
);
printf
(
"Error occurred while writing to the device.
\n
"
);
...
...
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