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
1a2445e8
Commit
1a2445e8
authored
Dec 09, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes for the new resampler.
parent
b390ef98
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
research/mal_resampler.h
research/mal_resampler.h
+12
-11
No files found.
research/mal_resampler.h
View file @
1a2445e8
...
@@ -394,7 +394,6 @@ typedef union
...
@@ -394,7 +394,6 @@ typedef union
float
*
f32
[
MAL_MAX_CHANNELS
];
float
*
f32
[
MAL_MAX_CHANNELS
];
mal_int16
*
s16
[
MAL_MAX_CHANNELS
];
mal_int16
*
s16
[
MAL_MAX_CHANNELS
];
}
mal_resampler_deinterleaved_pointers
;
}
mal_resampler_deinterleaved_pointers
;
typedef
union
typedef
union
{
{
float
*
f32
;
float
*
f32
;
...
@@ -510,7 +509,7 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
...
@@ -510,7 +509,7 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
}
}
framesJustRead
=
pResampler
->
readF32
(
pResampler
,
framesToReadRightNow
,
ppDeinterleavedFrames
);
framesJustRead
=
pResampler
->
readF32
(
pResampler
,
framesToReadRightNow
,
ppDeinterleavedFrames
);
mal_interleave_pcm_frames
(
pResampler
->
config
.
format
,
pResampler
->
config
.
channels
,
framesJustRead
,
(
const
void
**
)
ppDeinterleavedFrames
,
runningFramesOutInterleaved
.
f32
);
mal_interleave_pcm_frames
(
pResampler
->
config
.
format
,
pResampler
->
config
.
channels
,
framesJustRead
,
ppDeinterleavedFrames
,
runningFramesOutInterleaved
.
f32
);
}
}
}
else
{
}
else
{
if
(
pResampler
->
config
.
layout
==
mal_stream_layout_interleaved
)
{
if
(
pResampler
->
config
.
layout
==
mal_stream_layout_interleaved
)
{
...
@@ -523,7 +522,7 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
...
@@ -523,7 +522,7 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
}
}
framesJustRead
=
pResampler
->
readS16
(
pResampler
,
framesToReadRightNow
,
ppDeinterleavedFrames
);
framesJustRead
=
pResampler
->
readS16
(
pResampler
,
framesToReadRightNow
,
ppDeinterleavedFrames
);
mal_interleave_pcm_frames
(
pResampler
->
config
.
format
,
pResampler
->
config
.
channels
,
framesJustRead
,
(
const
void
**
)
ppDeinterleavedFrames
,
runningFramesOutInterleaved
.
s16
);
mal_interleave_pcm_frames
(
pResampler
->
config
.
format
,
pResampler
->
config
.
channels
,
framesJustRead
,
ppDeinterleavedFrames
,
runningFramesOutInterleaved
.
s16
);
}
}
}
}
...
@@ -537,7 +536,7 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
...
@@ -537,7 +536,7 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
pResampler
->
windowTime
+=
(
framesToReadRightNow
*
pResampler
->
config
.
ratio
);
pResampler
->
windowTime
+=
(
framesToReadRightNow
*
pResampler
->
config
.
ratio
);
if
(
pResampler
->
config
.
format
==
mal_format_f32
)
{
if
(
pResampler
->
config
.
format
==
mal_format_f32
)
{
if
(
pResampler
->
config
.
layout
==
mal_stream_layout_interleaved
)
{
if
(
pResampler
->
config
.
layout
==
mal_stream_layout_
de
interleaved
)
{
for
(
mal_uint32
iChannel
=
0
;
iChannel
<
pResampler
->
config
.
channels
;
++
iChannel
)
{
for
(
mal_uint32
iChannel
=
0
;
iChannel
<
pResampler
->
config
.
channels
;
++
iChannel
)
{
runningFramesOutDeinterleaved
.
f32
[
iChannel
]
+=
framesToReadRightNow
;
runningFramesOutDeinterleaved
.
f32
[
iChannel
]
+=
framesToReadRightNow
;
}
}
...
@@ -545,7 +544,7 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
...
@@ -545,7 +544,7 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
runningFramesOutInterleaved
.
f32
+=
framesToReadRightNow
*
pResampler
->
config
.
channels
;
runningFramesOutInterleaved
.
f32
+=
framesToReadRightNow
*
pResampler
->
config
.
channels
;
}
}
}
else
{
}
else
{
if
(
pResampler
->
config
.
layout
==
mal_stream_layout_interleaved
)
{
if
(
pResampler
->
config
.
layout
==
mal_stream_layout_
de
interleaved
)
{
for
(
mal_uint32
iChannel
=
0
;
iChannel
<
pResampler
->
config
.
channels
;
++
iChannel
)
{
for
(
mal_uint32
iChannel
=
0
;
iChannel
<
pResampler
->
config
.
channels
;
++
iChannel
)
{
runningFramesOutDeinterleaved
.
s16
[
iChannel
]
+=
framesToReadRightNow
;
runningFramesOutDeinterleaved
.
s16
[
iChannel
]
+=
framesToReadRightNow
;
}
}
...
@@ -609,9 +608,10 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
...
@@ -609,9 +608,10 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
if
(
pResampler
->
config
.
layout
==
mal_stream_layout_deinterleaved
)
{
if
(
pResampler
->
config
.
layout
==
mal_stream_layout_deinterleaved
)
{
framesReadFromClient
=
pResampler
->
config
.
onRead
(
pResampler
,
framesToReadFromClient
,
clientDst
.
f32
);
framesReadFromClient
=
pResampler
->
config
.
onRead
(
pResampler
,
framesToReadFromClient
,
clientDst
.
f32
);
}
else
{
}
else
{
float
pInterleavedFrames
[
mal_countof
(
pResampler
->
cache
.
f32
)];
float
buffer
[
mal_countof
(
pResampler
->
cache
.
f32
)];
framesReadFromClient
=
pResampler
->
config
.
onRead
(
pResampler
,
framesToReadFromClient
,
(
void
**
)
&
pInterleavedFrames
);
float
*
pInterleavedFrames
=
buffer
;
mal_deinterleave_pcm_frames
(
pResampler
->
config
.
format
,
pResampler
->
config
.
channels
,
framesReadFromClient
,
pInterleavedFrames
,
(
void
**
)
clientDst
.
f32
);
framesReadFromClient
=
pResampler
->
config
.
onRead
(
pResampler
,
framesToReadFromClient
,
&
pInterleavedFrames
);
mal_deinterleave_pcm_frames
(
pResampler
->
config
.
format
,
pResampler
->
config
.
channels
,
framesReadFromClient
,
pInterleavedFrames
,
clientDst
.
f32
);
}
}
}
else
{
}
else
{
for
(
mal_uint32
iChannel
=
0
;
iChannel
<
pResampler
->
config
.
channels
;
++
iChannel
)
{
for
(
mal_uint32
iChannel
=
0
;
iChannel
<
pResampler
->
config
.
channels
;
++
iChannel
)
{
...
@@ -621,9 +621,10 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
...
@@ -621,9 +621,10 @@ mal_uint64 mal_resampler_read(mal_resampler* pResampler, mal_uint64 frameCount,
if
(
pResampler
->
config
.
layout
==
mal_stream_layout_deinterleaved
)
{
if
(
pResampler
->
config
.
layout
==
mal_stream_layout_deinterleaved
)
{
framesReadFromClient
=
pResampler
->
config
.
onRead
(
pResampler
,
framesToReadFromClient
,
clientDst
.
s16
);
framesReadFromClient
=
pResampler
->
config
.
onRead
(
pResampler
,
framesToReadFromClient
,
clientDst
.
s16
);
}
else
{
}
else
{
mal_int16
pInterleavedFrames
[
mal_countof
(
pResampler
->
cache
.
s16
)];
mal_int16
buffer
[
mal_countof
(
pResampler
->
cache
.
s16
)];
framesReadFromClient
=
pResampler
->
config
.
onRead
(
pResampler
,
framesToReadFromClient
,
(
void
**
)
&
pInterleavedFrames
);
mal_int16
*
pInterleavedFrames
=
buffer
;
mal_deinterleave_pcm_frames
(
pResampler
->
config
.
format
,
pResampler
->
config
.
channels
,
framesReadFromClient
,
pInterleavedFrames
,
(
void
**
)
clientDst
.
s16
);
framesReadFromClient
=
pResampler
->
config
.
onRead
(
pResampler
,
framesToReadFromClient
,
&
pInterleavedFrames
);
mal_deinterleave_pcm_frames
(
pResampler
->
config
.
format
,
pResampler
->
config
.
channels
,
framesReadFromClient
,
pInterleavedFrames
,
clientDst
.
s16
);
}
}
}
}
...
...
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