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
581b90d2
Commit
581b90d2
authored
Feb 19, 2019
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix OSS build.
parent
79e83313
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
mini_al.h
mini_al.h
+2
-2
tests/mal_blocking.c
tests/mal_blocking.c
+20
-20
No files found.
mini_al.h
View file @
581b90d2
...
@@ -19025,8 +19025,8 @@ mal_result mal_device_init_fd__oss(mal_context* pContext, const mal_device_confi
...
@@ -19025,8 +19025,8 @@ mal_result mal_device_init_fd__oss(mal_context* pContext, const mal_device_confi
ossFragmentSizePower += 1;
ossFragmentSizePower += 1;
}
}
ossFragment = (int)((p
Device
->periods << 16) | ossFragmentSizePower);
ossFragment = (int)((p
Config
->periods << 16) | ossFragmentSizePower);
ossResult = ioctl(
pDevice->oss.
fd, SNDCTL_DSP_SETFRAGMENT, &ossFragment);
ossResult = ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &ossFragment);
if (ossResult == -1) {
if (ossResult == -1) {
close(fd);
close(fd);
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[OSS] Failed to set fragment size and period count.", MAL_FORMAT_NOT_SUPPORTED);
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[OSS] Failed to set fragment size and period count.", MAL_FORMAT_NOT_SUPPORTED);
tests/mal_blocking.c
View file @
581b90d2
...
@@ -14,29 +14,29 @@ int main(int argc, char** argv)
...
@@ -14,29 +14,29 @@ int main(int argc, char** argv)
mal_result
result
;
mal_result
result
;
mal_backend
backend
=
mal_backend_oss
;
mal_backend
backend
=
mal_backend_oss
;
mal_device_config
deviceConfig
=
mal_device_config_init_default
(
NULL
);
mal_device_config
deviceConfig
=
mal_device_config_init
(
mal_device_type_playback
);
deviceConfig
.
format
=
mal_format_f32
;
deviceConfig
.
playback
.
format
=
mal_format_f32
;
deviceConfig
.
capture
.
format
=
mal_format_f32
;
deviceConfig
.
bufferSizeInFrames
=
1024
*
8
;
deviceConfig
.
bufferSizeInFrames
=
1024
*
8
;
//deviceConfig.bufferSizeInMilliseconds = 80;
//deviceConfig.bufferSizeInMilliseconds = 80;
deviceConfig
.
periods
=
2
;
deviceConfig
.
periods
=
2
;
deviceConfig
.
shareMode
=
mal_share_mode_shared
;
#if
1
#if
0
/* Playback */
/* Playback */
mal_device device;
mal_device device;
result
=
mal_device_init_ex
(
&
backend
,
1
,
NULL
,
mal_device_type_playback
,
NULL
,
&
deviceConfig
,
&
device
);
result = mal_device_init_ex(&backend, 1, NULL, &deviceConfig, &device);
if (result != MAL_SUCCESS) {
if (result != MAL_SUCCESS) {
printf("Failed to initialize device.\n");
printf("Failed to initialize device.\n");
return -1;
return -1;
}
}
printf
(
"Is Passthrough: %s
\n
"
,
device
.
dsp
.
isPassthrough
?
"YES"
:
"NO"
);
printf("Is Passthrough: %s\n", device.
playback.converter
.isPassthrough ? "YES" : "NO");
printf
(
"Format: %s -> %s
\n
"
,
mal_get_format_name
(
device
.
format
),
mal_get_format_name
(
device
.
internalFormat
));
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
.
channels
,
device
.
internalChannels
);
printf("Channels: %d -> %d\n", device.
playback.channels, device.playback
.internalChannels);
printf
(
"Sample Rate: %d -> %d
\n
"
,
device
.
sampleRate
,
device
.
internalSampleRate
);
printf("Sample Rate: %d -> %d\n", device.sampleRate, device.
playback.
internalSampleRate);
printf
(
"Buffer Size In Frames: %d
\n
"
,
device
.
b
ufferSizeInFrames
);
printf("Buffer Size In Frames: %d\n", device.
playback.internalB
ufferSizeInFrames);
mal_decoder_config
decoderConfig
=
mal_decoder_config_init
(
mal_format_f32
,
device
.
channels
,
device
.
sampleRate
);
mal_decoder_config decoderConfig = mal_decoder_config_init(mal_format_f32, device.
playback.
channels, device.sampleRate);
mal_decoder decoder;
mal_decoder decoder;
printf("LOADING DECODER\n");
printf("LOADING DECODER\n");
result = mal_decoder_init_file("res/sine_s16_mono_48000.wav", &decoderConfig, &decoder);
result = mal_decoder_init_file("res/sine_s16_mono_48000.wav", &decoderConfig, &decoder);
...
@@ -51,8 +51,8 @@ int main(int argc, char** argv)
...
@@ -51,8 +51,8 @@ int main(int argc, char** argv)
mal_bool32 stopped = MAL_FALSE;
mal_bool32 stopped = MAL_FALSE;
while (!stopped) {
while (!stopped) {
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.
channels, device
.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
.
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) {
...
@@ -62,22 +62,24 @@ int main(int argc, char** argv)
...
@@ -62,22 +62,24 @@ int main(int argc, char** argv)
printf("TESTING: frameCount=%d\n", frameCount);
printf("TESTING: frameCount=%d\n", frameCount);
}
}
mal_decoder_uninit(&decoder);
#else
#else
/* Capture */
/* Capture */
mal_device
device
;
mal_device
device
;
result
=
mal_device_init_ex
(
&
backend
,
1
,
NULL
,
mal_device_type_capture
,
NULL
,
&
deviceConfig
,
&
device
);
result
=
mal_device_init_ex
(
&
backend
,
1
,
NULL
,
&
deviceConfig
,
&
device
);
if
(
result
!=
MAL_SUCCESS
)
{
if
(
result
!=
MAL_SUCCESS
)
{
printf
(
"Failed to initialize device.
\n
"
);
printf
(
"Failed to initialize device.
\n
"
);
return
-
1
;
return
-
1
;
}
}
printf
(
"Is Passthrough: %s
\n
"
,
device
.
dsp
.
isPassthrough
?
"YES"
:
"NO"
);
printf
(
"Is Passthrough: %s
\n
"
,
device
.
capture
.
converter
.
isPassthrough
?
"YES"
:
"NO"
);
printf
(
"Format: %s
\n
"
,
mal_get_format_name
(
device
.
format
));
printf
(
"Format: %s
\n
"
,
mal_get_format_name
(
device
.
capture
.
format
));
drwav_data_format
format
;
drwav_data_format
format
;
format
.
container
=
drwav_container_riff
;
format
.
container
=
drwav_container_riff
;
format
.
format
=
DR_WAVE_FORMAT_IEEE_FLOAT
;
format
.
format
=
DR_WAVE_FORMAT_IEEE_FLOAT
;
format
.
channels
=
device
.
channels
;
format
.
channels
=
device
.
c
apture
.
c
hannels
;
format
.
sampleRate
=
device
.
sampleRate
;
format
.
sampleRate
=
device
.
sampleRate
;
format
.
bitsPerSample
=
32
;
format
.
bitsPerSample
=
32
;
drwav
*
pWav
=
drwav_open_file_write
(
"recording.wav"
,
&
format
);
drwav
*
pWav
=
drwav_open_file_write
(
"recording.wav"
,
&
format
);
...
@@ -90,7 +92,7 @@ int main(int argc, char** argv)
...
@@ -90,7 +92,7 @@ int main(int argc, char** argv)
mal_bool32
stopped
=
MAL_FALSE
;
mal_bool32
stopped
=
MAL_FALSE
;
while
(
!
stopped
)
{
while
(
!
stopped
)
{
float
buffer
[
1024
*
4
];
float
buffer
[
1024
*
4
];
mal_uint32
frameCount
=
mal_countof
(
buffer
)
/
device
.
channels
;
mal_uint32
frameCount
=
mal_countof
(
buffer
)
/
device
.
c
apture
.
c
hannels
;
result
=
mal_device_read
(
&
device
,
buffer
,
frameCount
);
result
=
mal_device_read
(
&
device
,
buffer
,
frameCount
);
if
(
result
!=
MAL_SUCCESS
)
{
if
(
result
!=
MAL_SUCCESS
)
{
...
@@ -105,8 +107,6 @@ int main(int argc, char** argv)
...
@@ -105,8 +107,6 @@ int main(int argc, char** argv)
break
;
break
;
}
}
}
}
mal_decoder_uninit
(
&
decoder
);
#endif
#endif
printf
(
"DONE
\n
"
);
printf
(
"DONE
\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