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
7926e035
Commit
7926e035
authored
Jan 18, 2017
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the C++ build.
parent
eb70fb5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
29 deletions
+60
-29
mini_al.h
mini_al.h
+60
-29
No files found.
mini_al.h
View file @
7926e035
...
...
@@ -225,8 +225,8 @@ typedef uint32_t mal_uint32;
typedef
int64_t
mal_int64
;
typedef
uint64_t
mal_uint64
;
#endif
typedef
mal_
int8
mal_bool8
;
typedef
mal_
int32
mal_bool32
;
typedef
mal_
uint8
mal_bool8
;
typedef
mal_
uint32
mal_bool32
;
#define MAL_TRUE 1
#define MAL_FALSE 0
...
...
@@ -919,13 +919,15 @@ mal_uint32 mal_get_sample_size_in_bytes(mal_format format);
// DSP
//
///////////////////////////////////////////////////////////////////////////////
#if 0
#include "tools/mal_build/bin/mini_al_dsp.h"
#else
// Initializes a DSP object.
mal_result
mal_dsp_init
(
mal_dsp_config
*
pConfig
,
mal_dsp
*
pDSP
);
// Reads a number of samples and runs them through the DSP processor.
mal_uint32
mal_dsp_process
(
mal_dsp
*
pDSP
,
mal_dsp_read_proc
onRead
,
void
*
pUserData
,
void
*
p
SamplesOut
,
mal_uint32
sampl
eCount
);
mal_uint32
mal_dsp_process
(
mal_dsp
*
pDSP
,
mal_dsp_read_proc
onRead
,
void
*
pUserData
,
void
*
p
FramesOut
,
mal_uint32
fram
eCount
);
#endif
#ifdef __cplusplus
}
...
...
@@ -1687,7 +1689,7 @@ static inline void mal_device__send_frames_to_client(mal_device* pDevice, mal_ui
mal_device__on_read_from_device__data
data
;
data
.
pDevice
=
pDevice
;
data
.
frameCount
=
frameCount
;
data
.
pFrames
=
pSamples
;
data
.
pFrames
=
(
const
mal_uint8
*
)
pSamples
;
mal_uint8
chunkBuffer
[
4096
];
mal_uint32
chunkFrameCount
=
sizeof
(
chunkBuffer
)
/
mal_get_sample_size_in_bytes
(
pDevice
->
format
)
/
pDevice
->
channels
;
...
...
@@ -1976,6 +1978,12 @@ const IID g_malIID_IAudioCaptureClient_Instance = {0xC8ADBD64, 0xE71E, 0x48A0,
#define g_malIID_IAudioCaptureClient &g_malIID_IAudioCaptureClient_Instance
#endif
#ifdef __cplusplus
#define mal_is_guid_equal(a, b) IsEqualGUID(a, b)
#else
#define mal_is_guid_equal(a, b) IsEqualGUID(&a, &b)
#endif
mal_result
mal_context_init__wasapi
(
mal_context
*
pContext
)
{
mal_assert
(
pContext
!=
NULL
);
...
...
@@ -2270,7 +2278,7 @@ static mal_result mal_device_init__wasapi(mal_context* pContext, mal_device_type
return
mal_post_error
(
pDevice
,
"[WASAPI] Failed to find best device mix format."
,
MAL_WASAPI_FAILED_TO_ACTIVATE_DEVICE
);
}
if
(
IsEqualGUID
(
&
wf
.
SubFormat
,
&
MAL_GUID_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
))
{
if
(
mal_is_guid_equal
(
wf
.
SubFormat
,
MAL_GUID_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
))
{
pDevice
->
internalFormat
=
mal_format_f32
;
}
else
{
if
(
wf
.
Format
.
wBitsPerSample
==
32
)
{
...
...
@@ -5690,6 +5698,27 @@ mal_uint32 mal_get_sample_size_in_bytes(mal_format format)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
//
// AUTO-GENERATED
//
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#if 1
#include "tools/mal_build/bin/mini_al_dsp.c"
#else
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
...
...
@@ -5730,10 +5759,10 @@ static void mal_pcm_convert(void* pOut, mal_format formatOut, const void* pIn, m
{
switch
(
formatOut
)
{
case
mal_format_s16
:
mal_pcm_u8_to_s16
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s24
:
mal_pcm_u8_to_s24
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s32
:
mal_pcm_u8_to_s32
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_f32
:
mal_pcm_u8_to_f32
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s16
:
mal_pcm_u8_to_s16
(
(
short
*
)
pOut
,
(
const
unsigned
char
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_s24
:
mal_pcm_u8_to_s24
(
pOut
,
(
const
unsigned
char
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_s32
:
mal_pcm_u8_to_s32
(
(
int
*
)
pOut
,
(
const
unsigned
char
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_f32
:
mal_pcm_u8_to_f32
(
(
float
*
)
pOut
,
(
const
unsigned
char
*
)
pIn
,
sampleCount
);
return
;
default:
break
;
}
}
break
;
...
...
@@ -5742,10 +5771,10 @@ static void mal_pcm_convert(void* pOut, mal_format formatOut, const void* pIn, m
{
switch
(
formatOut
)
{
case
mal_format_u8
:
mal_pcm_s16_to_u8
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s24
:
mal_pcm_s16_to_s24
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s32
:
mal_pcm_s16_to_s32
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_f32
:
mal_pcm_s16_to_f32
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_u8
:
mal_pcm_s16_to_u8
(
(
unsigned
char
*
)
pOut
,
(
const
short
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_s24
:
mal_pcm_s16_to_s24
(
pOut
,
(
const
short
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_s32
:
mal_pcm_s16_to_s32
(
(
int
*
)
pOut
,
(
const
short
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_f32
:
mal_pcm_s16_to_f32
(
(
float
*
)
pOut
,
(
const
short
*
)
pIn
,
sampleCount
);
return
;
default:
break
;
}
}
break
;
...
...
@@ -5754,10 +5783,10 @@ static void mal_pcm_convert(void* pOut, mal_format formatOut, const void* pIn, m
{
switch
(
formatOut
)
{
case
mal_format_u8
:
mal_pcm_s24_to_u8
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s16
:
mal_pcm_s24_to_s16
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s32
:
mal_pcm_s24_to_s32
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_f32
:
mal_pcm_s24_to_f32
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_u8
:
mal_pcm_s24_to_u8
(
(
unsigned
char
*
)
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s16
:
mal_pcm_s24_to_s16
(
(
short
*
)
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s32
:
mal_pcm_s24_to_s32
(
(
int
*
)
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_f32
:
mal_pcm_s24_to_f32
(
(
float
*
)
pOut
,
pIn
,
sampleCount
);
return
;
default:
break
;
}
}
break
;
...
...
@@ -5766,10 +5795,10 @@ static void mal_pcm_convert(void* pOut, mal_format formatOut, const void* pIn, m
{
switch
(
formatOut
)
{
case
mal_format_u8
:
mal_pcm_s32_to_u8
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s16
:
mal_pcm_s32_to_s16
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s24
:
mal_pcm_s32_to_s24
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_f32
:
mal_pcm_s32_to_f32
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_u8
:
mal_pcm_s32_to_u8
(
(
unsigned
char
*
)
pOut
,
(
const
int
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_s16
:
mal_pcm_s32_to_s16
(
(
short
*
)
pOut
,
(
const
int
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_s24
:
mal_pcm_s32_to_s24
(
pOut
,
(
const
int
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_f32
:
mal_pcm_s32_to_f32
(
(
float
*
)
pOut
,
(
const
int
*
)
pIn
,
sampleCount
);
return
;
default:
break
;
}
}
break
;
...
...
@@ -5778,10 +5807,10 @@ static void mal_pcm_convert(void* pOut, mal_format formatOut, const void* pIn, m
{
switch
(
formatOut
)
{
case
mal_format_u8
:
mal_pcm_f32_to_u8
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s16
:
mal_pcm_f32_to_s16
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s24
:
mal_pcm_f32_to_s24
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_s32
:
mal_pcm_f32_to_s32
(
pOut
,
pIn
,
sampleCount
);
return
;
case
mal_format_u8
:
mal_pcm_f32_to_u8
(
(
unsigned
char
*
)
pOut
,
(
const
float
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_s16
:
mal_pcm_f32_to_s16
(
(
short
*
)
pOut
,
(
const
float
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_s24
:
mal_pcm_f32_to_s24
(
pOut
,
(
const
float
*
)
pIn
,
sampleCount
);
return
;
case
mal_format_s32
:
mal_pcm_f32_to_s32
(
(
int
*
)
pOut
,
(
const
float
*
)
pIn
,
sampleCount
);
return
;
default:
break
;
}
}
break
;
...
...
@@ -5790,6 +5819,7 @@ static void mal_pcm_convert(void* pOut, mal_format formatOut, const void* pIn, m
}
}
#if 0
static void mal_rearrange_channels(float* pFrame, mal_uint32 channels, mal_uint32 channelMap[18])
{
float temp;
...
...
@@ -5814,6 +5844,7 @@ static void mal_rearrange_channels(float* pFrame, mal_uint32 channels, mal_uint3
case 1: temp = pFrame[ 0]; pFrame[ 0] = pFrame[channelMap[ 0]]; pFrame[channelMap[ 0]] = temp;
}
}
#endif
static
void
mal_dsp_mix_channels__dec
(
float
*
pFramesOut
,
mal_uint32
channelsOut
,
const
float
*
pFramesIn
,
mal_uint32
channelsIn
,
mal_uint32
frameCount
,
mal_channel_mix_mode
mode
)
{
...
...
@@ -6066,7 +6097,7 @@ void mal_dsp_process_do_next_op(mal_dsp* pDSP, mal_dsp_op* pOP)
}
break
;
}
// The outpus from this operation become the inputs of the next.
// The outpu
t
s from this operation become the inputs of the next.
pOP
->
pInputData
=
pOP
->
pOutputData
;
pOP
->
inputFormat
=
pOP
->
outputFormat
;
pOP
->
inputChannels
=
pOP
->
outputChannels
;
...
...
@@ -6116,7 +6147,7 @@ mal_uint32 mal_dsp_process_generic(mal_dsp* pDSP, mal_dsp_read_proc onRead, void
}
mal_uint32
framesToRead
=
(
mal_uint32
)(
frameCount
*
(
1
/
pDSP
->
src
.
ratio
));
while
(
framesToRead
>
0
)
{
while
(
totalFramesProcessed
<
frameCount
)
{
mal_dsp_op
op
;
op
.
pInputData
=
pSampleData
[
0
];
op
.
inputFormat
=
pDSP
->
config
.
formatIn
;
...
...
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