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
0998798b
Commit
0998798b
authored
Mar 06, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move some code in preparation for removing dependency on asoundlib.h
parent
8fa09a84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
mini_al.h
mini_al.h
+27
-27
No files found.
mini_al.h
View file @
0998798b
...
@@ -5830,33 +5830,6 @@ static mal_result mal_device__main_loop__winmm(mal_device* pDevice)
...
@@ -5830,33 +5830,6 @@ static mal_result mal_device__main_loop__winmm(mal_device* pDevice)
#ifdef MAL_HAS_ALSA
#ifdef MAL_HAS_ALSA
#include <alsa/asoundlib.h>
#include <alsa/asoundlib.h>
// This array allows mini_al to control device-specific default buffer sizes. This uses a scaling factor. Order is important. If
// any part of the string is present in the device's name, the associated scale will be used.
struct
{
const
char
*
name
;
float
scale
;
}
g_malDefaultBufferSizeScalesALSA
[]
=
{
{
"bcm2835 IEC958/HDMI"
,
20
},
{
"bcm2835 ALSA"
,
20
}
};
static
float
mal_find_default_buffer_size_scale__alsa
(
const
char
*
deviceName
)
{
if
(
deviceName
==
NULL
)
{
return
1
;
}
for
(
size_t
i
=
0
;
i
<
mal_countof
(
g_malDefaultBufferSizeScalesALSA
);
++
i
)
{
if
(
strstr
(
g_malDefaultBufferSizeScalesALSA
[
i
].
name
,
deviceName
)
!=
NULL
)
{
return
g_malDefaultBufferSizeScalesALSA
[
i
].
scale
;
}
}
return
1
;
}
typedef int (* mal_snd_pcm_open_proc) (snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode);
typedef int (* mal_snd_pcm_open_proc) (snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode);
typedef int (* mal_snd_pcm_close_proc) (snd_pcm_t *pcm);
typedef int (* mal_snd_pcm_close_proc) (snd_pcm_t *pcm);
typedef size_t (* mal_snd_pcm_hw_params_sizeof_proc) (void);
typedef size_t (* mal_snd_pcm_hw_params_sizeof_proc) (void);
...
@@ -5910,10 +5883,37 @@ static snd_pcm_format_t g_mal_ALSAFormats[] = {
...
@@ -5910,10 +5883,37 @@ static snd_pcm_format_t g_mal_ALSAFormats[] = {
SND_PCM_FORMAT_U8, // mal_format_u8
SND_PCM_FORMAT_U8, // mal_format_u8
SND_PCM_FORMAT_S16_LE, // mal_format_s16
SND_PCM_FORMAT_S16_LE, // mal_format_s16
SND_PCM_FORMAT_S24_3LE, // mal_format_s24
SND_PCM_FORMAT_S24_3LE, // mal_format_s24
//SND_PCM_FORMAT_S24_LE, // mal_format_s24_32
SND_PCM_FORMAT_S32_LE, // mal_format_s32
SND_PCM_FORMAT_S32_LE, // mal_format_s32
SND_PCM_FORMAT_FLOAT_LE // mal_format_f32
SND_PCM_FORMAT_FLOAT_LE // mal_format_f32
};
};
// This array allows mini_al to control device-specific default buffer sizes. This uses a scaling factor. Order is important. If
// any part of the string is present in the device's name, the associated scale will be used.
struct
{
const char* name;
float scale;
} g_malDefaultBufferSizeScalesALSA[] = {
{"bcm2835 IEC958/HDMI", 20},
{"bcm2835 ALSA", 20}
};
static float mal_find_default_buffer_size_scale__alsa(const char* deviceName)
{
if (deviceName == NULL) {
return 1;
}
for (size_t i = 0; i < mal_countof(g_malDefaultBufferSizeScalesALSA); ++i) {
if (strstr(g_malDefaultBufferSizeScalesALSA[i].name, deviceName) != NULL) {
return g_malDefaultBufferSizeScalesALSA[i].scale;
}
}
return 1;
}
snd_pcm_format_t mal_convert_mal_format_to_alsa_format(mal_format format)
snd_pcm_format_t mal_convert_mal_format_to_alsa_format(mal_format format)
{
{
return g_mal_ALSAFormats[format];
return g_mal_ALSAFormats[format];
...
...
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