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
d46c1ee8
Commit
d46c1ee8
authored
Apr 05, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: Disable ALSA's automatic data conversion.
Public issue
https://github.com/dr-soft/miniaudio/issues/146
parent
c433e029
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
7 deletions
+29
-7
miniaudio.h
miniaudio.h
+29
-7
No files found.
miniaudio.h
View file @
d46c1ee8
...
@@ -3176,7 +3176,10 @@ typedef struct
...
@@ -3176,7 +3176,10 @@ typedef struct
} wasapi;
} wasapi;
struct
struct
{
{
ma_bool32 noMMap; /* Disables MMap mode. */
ma_bool32 noMMap; /* Disables MMap mode. */
ma_bool32 noAutoFormat; /* Opens the ALSA device with SND_PCM_NO_AUTO_FORMAT. */
ma_bool32 noAutoChannels; /* Opens the ALSA device with SND_PCM_NO_AUTO_CHANNELS. */
ma_bool32 noAutoResample; /* Opens the ALSA device with SND_PCM_NO_AUTO_RESAMPLE. */
} alsa;
} alsa;
struct
struct
{
{
...
@@ -4554,6 +4557,15 @@ then be set directly on the structure. Below are the members of the `ma_device_c
...
@@ -4554,6 +4557,15 @@ then be set directly on the structure. Below are the members of the `ma_device_c
alsa.noMMap
alsa.noMMap
ALSA only. When set to true, disables MMap mode. Defaults to false.
ALSA only. When set to true, disables MMap mode. Defaults to false.
alsa.noAutoFormat
ALSA only. When set to true, disables ALSA's automatic format conversion by including the SND_PCM_NO_AUTO_FORMAT flag. Defaults to false.
alsa.noAutoChannels
ALSA only. When set to true, disables ALSA's automatic channel conversion by including the SND_PCM_NO_AUTO_CHANNELS flag. Defaults to false.
alsa.noAutoResample
ALSA only. When set to true, disables ALSA's automatic resampling by including the SND_PCM_NO_AUTO_RESAMPLE flag. Defaults to false.
pulse.pStreamNamePlayback
pulse.pStreamNamePlayback
PulseAudio only. Sets the stream name for playback.
PulseAudio only. Sets the stream name for playback.
...
@@ -16636,11 +16648,10 @@ static ma_bool32 ma_does_id_exist_in_list__alsa(ma_device_id* pUniqueIDs, ma_uin
...
@@ -16636,11 +16648,10 @@ static ma_bool32 ma_does_id_exist_in_list__alsa(ma_device_id* pUniqueIDs, ma_uin
}
}
static ma_result ma_context_open_pcm__alsa(ma_context* pContext, ma_share_mode shareMode, ma_device_type deviceType, const ma_device_id* pDeviceID, ma_snd_pcm_t** ppPCM)
static ma_result ma_context_open_pcm__alsa(ma_context* pContext, ma_share_mode shareMode, ma_device_type deviceType, const ma_device_id* pDeviceID,
int openMode,
ma_snd_pcm_t** ppPCM)
{
{
ma_snd_pcm_t* pPCM;
ma_snd_pcm_t* pPCM;
ma_snd_pcm_stream_t stream;
ma_snd_pcm_stream_t stream;
int openMode;
MA_ASSERT(pContext != NULL);
MA_ASSERT(pContext != NULL);
MA_ASSERT(ppPCM != NULL);
MA_ASSERT(ppPCM != NULL);
...
@@ -16648,8 +16659,7 @@ static ma_result ma_context_open_pcm__alsa(ma_context* pContext, ma_share_mode s
...
@@ -16648,8 +16659,7 @@ static ma_result ma_context_open_pcm__alsa(ma_context* pContext, ma_share_mode s
*ppPCM = NULL;
*ppPCM = NULL;
pPCM = NULL;
pPCM = NULL;
stream = (deviceType == ma_device_type_playback) ? MA_SND_PCM_STREAM_PLAYBACK : MA_SND_PCM_STREAM_CAPTURE;
stream = (deviceType == ma_device_type_playback) ? MA_SND_PCM_STREAM_PLAYBACK : MA_SND_PCM_STREAM_CAPTURE;
openMode = MA_SND_PCM_NO_AUTO_RESAMPLE | MA_SND_PCM_NO_AUTO_CHANNELS | MA_SND_PCM_NO_AUTO_FORMAT;
if (pDeviceID == NULL) {
if (pDeviceID == NULL) {
ma_bool32 isDeviceOpen;
ma_bool32 isDeviceOpen;
...
@@ -16983,7 +16993,7 @@ static ma_result ma_context_get_device_info__alsa(ma_context* pContext, ma_devic
...
@@ -16983,7 +16993,7 @@ static ma_result ma_context_get_device_info__alsa(ma_context* pContext, ma_devic
}
}
/* For detailed info we need to open the device. */
/* For detailed info we need to open the device. */
result = ma_context_open_pcm__alsa(pContext, shareMode, deviceType, pDeviceID, &pPCM);
result = ma_context_open_pcm__alsa(pContext, shareMode, deviceType, pDeviceID,
0,
&pPCM);
if (result != MA_SUCCESS) {
if (result != MA_SUCCESS) {
return result;
return result;
}
}
...
@@ -17334,6 +17344,7 @@ static ma_result ma_device_init_by_type__alsa(ma_context* pContext, const ma_dev
...
@@ -17334,6 +17344,7 @@ static ma_result ma_device_init_by_type__alsa(ma_context* pContext, const ma_dev
ma_channel internalChannelMap[MA_MAX_CHANNELS];
ma_channel internalChannelMap[MA_MAX_CHANNELS];
ma_uint32 internalPeriodSizeInFrames;
ma_uint32 internalPeriodSizeInFrames;
ma_uint32 internalPeriods;
ma_uint32 internalPeriods;
int openMode;
ma_snd_pcm_hw_params_t* pHWParams;
ma_snd_pcm_hw_params_t* pHWParams;
ma_snd_pcm_sw_params_t* pSWParams;
ma_snd_pcm_sw_params_t* pSWParams;
ma_snd_pcm_uframes_t bufferBoundary;
ma_snd_pcm_uframes_t bufferBoundary;
...
@@ -17348,7 +17359,18 @@ static ma_result ma_device_init_by_type__alsa(ma_context* pContext, const ma_dev
...
@@ -17348,7 +17359,18 @@ static ma_result ma_device_init_by_type__alsa(ma_context* pContext, const ma_dev
shareMode = (deviceType == ma_device_type_capture) ? pConfig->capture.shareMode : pConfig->playback.shareMode;
shareMode = (deviceType == ma_device_type_capture) ? pConfig->capture.shareMode : pConfig->playback.shareMode;
pDeviceID = (deviceType == ma_device_type_capture) ? pConfig->capture.pDeviceID : pConfig->playback.pDeviceID;
pDeviceID = (deviceType == ma_device_type_capture) ? pConfig->capture.pDeviceID : pConfig->playback.pDeviceID;
result = ma_context_open_pcm__alsa(pContext, shareMode, deviceType, pDeviceID, &pPCM);
openMode = 0;
if (pConfig->alsa.noAutoResample) {
openMode |= MA_SND_PCM_NO_AUTO_RESAMPLE;
}
if (pConfig->alsa.noAutoChannels) {
openMode |= MA_SND_PCM_NO_AUTO_CHANNELS;
}
if (pConfig->alsa.noAutoFormat) {
openMode |= MA_SND_PCM_NO_AUTO_FORMAT;
}
result = ma_context_open_pcm__alsa(pContext, shareMode, deviceType, pDeviceID, openMode, &pPCM);
if (result != MA_SUCCESS) {
if (result != MA_SUCCESS) {
return result;
return result;
}
}
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