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
5852d6ed
Commit
5852d6ed
authored
Apr 30, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update extras.
parent
07730e7a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
67 deletions
+77
-67
extras/dr_flac.h
extras/dr_flac.h
+11
-8
extras/dr_mp3.h
extras/dr_mp3.h
+7
-4
extras/dr_wav.h
extras/dr_wav.h
+59
-55
No files found.
extras/dr_flac.h
View file @
5852d6ed
/*
/*
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_flac - v0.12.1
1 - 2020-04-19
dr_flac - v0.12.1
2 - 2020-04-30
David Reid - mackron@gmail.com
David Reid - mackron@gmail.com
...
@@ -2809,7 +2809,7 @@ static drflac_result drflac__read_utf8_coded_number(drflac_bs* bs, drflac_uint64
...
@@ -2809,7 +2809,7 @@ static drflac_result drflac__read_utf8_coded_number(drflac_bs* bs, drflac_uint64
{
{
drflac_uint8
crc
;
drflac_uint8
crc
;
drflac_uint64
result
;
drflac_uint64
result
;
unsigned
char
utf8
[
7
]
=
{
0
};
drflac_uint8
utf8
[
7
]
=
{
0
};
int
byteCount
;
int
byteCount
;
int
i
;
int
i
;
...
@@ -4749,7 +4749,7 @@ static drflac_bool32 drflac__decode_samples_with_residual(drflac_bs* bs, drflac_
...
@@ -4749,7 +4749,7 @@ static drflac_bool32 drflac__decode_samples_with_residual(drflac_bs* bs, drflac_
return
DRFLAC_FALSE
;
return
DRFLAC_FALSE
;
}
}
}
else
{
}
else
{
unsigned
char
unencodedBitsPerSample
=
0
;
drflac_uint8
unencodedBitsPerSample
=
0
;
if
(
!
drflac__read_uint8
(
bs
,
5
,
&
unencodedBitsPerSample
))
{
if
(
!
drflac__read_uint8
(
bs
,
5
,
&
unencodedBitsPerSample
))
{
return
DRFLAC_FALSE
;
return
DRFLAC_FALSE
;
}
}
...
@@ -4841,7 +4841,7 @@ static drflac_bool32 drflac__read_and_seek_residual(drflac_bs* bs, drflac_uint32
...
@@ -4841,7 +4841,7 @@ static drflac_bool32 drflac__read_and_seek_residual(drflac_bs* bs, drflac_uint32
return
DRFLAC_FALSE
;
return
DRFLAC_FALSE
;
}
}
}
else
{
}
else
{
unsigned
char
unencodedBitsPerSample
=
0
;
drflac_uint8
unencodedBitsPerSample
=
0
;
if
(
!
drflac__read_uint8
(
bs
,
5
,
&
unencodedBitsPerSample
))
{
if
(
!
drflac__read_uint8
(
bs
,
5
,
&
unencodedBitsPerSample
))
{
return
DRFLAC_FALSE
;
return
DRFLAC_FALSE
;
}
}
...
@@ -5190,7 +5190,7 @@ static drflac_bool32 drflac__read_subframe_header(drflac_bs* bs, drflac_subframe
...
@@ -5190,7 +5190,7 @@ static drflac_bool32 drflac__read_subframe_header(drflac_bs* bs, drflac_subframe
if
(
!
drflac__seek_past_next_set_bit
(
bs
,
&
wastedBitsPerSample
))
{
if
(
!
drflac__seek_past_next_set_bit
(
bs
,
&
wastedBitsPerSample
))
{
return
DRFLAC_FALSE
;
return
DRFLAC_FALSE
;
}
}
pSubframe
->
wastedBitsPerSample
=
(
unsigned
char
)
wastedBitsPerSample
+
1
;
pSubframe
->
wastedBitsPerSample
=
(
drflac_uint8
)
wastedBitsPerSample
+
1
;
}
}
return
DRFLAC_TRUE
;
return
DRFLAC_TRUE
;
...
@@ -5313,7 +5313,7 @@ static drflac_bool32 drflac__seek_subframe(drflac_bs* bs, drflac_frame* frame, i
...
@@ -5313,7 +5313,7 @@ static drflac_bool32 drflac__seek_subframe(drflac_bs* bs, drflac_frame* frame, i
case
DRFLAC_SUBFRAME_LPC
:
case
DRFLAC_SUBFRAME_LPC
:
{
{
unsigned
char
lpcPrecision
;
drflac_uint8
lpcPrecision
;
unsigned
int
bitsToSeek
=
pSubframe
->
lpcOrder
*
subframeBitsPerSample
;
unsigned
int
bitsToSeek
=
pSubframe
->
lpcOrder
*
subframeBitsPerSample
;
if
(
!
drflac__seek_bits
(
bs
,
bitsToSeek
))
{
if
(
!
drflac__seek_bits
(
bs
,
bitsToSeek
))
{
...
@@ -8505,7 +8505,7 @@ DRFLAC_API drflac* drflac_open_memory(const void* pData, size_t dataSize, const
...
@@ -8505,7 +8505,7 @@ DRFLAC_API drflac* drflac_open_memory(const void* pData, size_t dataSize, const
drflac__memory_stream
memoryStream
;
drflac__memory_stream
memoryStream
;
drflac
*
pFlac
;
drflac
*
pFlac
;
memoryStream
.
data
=
(
const
unsigned
char
*
)
pData
;
memoryStream
.
data
=
(
const
drflac_uint8
*
)
pData
;
memoryStream
.
dataSize
=
dataSize
;
memoryStream
.
dataSize
=
dataSize
;
memoryStream
.
currentReadPos
=
0
;
memoryStream
.
currentReadPos
=
0
;
pFlac
=
drflac_open
(
drflac__on_read_memory
,
drflac__on_seek_memory
,
&
memoryStream
,
pAllocationCallbacks
);
pFlac
=
drflac_open
(
drflac__on_read_memory
,
drflac__on_seek_memory
,
&
memoryStream
,
pAllocationCallbacks
);
...
@@ -8536,7 +8536,7 @@ DRFLAC_API drflac* drflac_open_memory_with_metadata(const void* pData, size_t da
...
@@ -8536,7 +8536,7 @@ DRFLAC_API drflac* drflac_open_memory_with_metadata(const void* pData, size_t da
drflac__memory_stream
memoryStream
;
drflac__memory_stream
memoryStream
;
drflac
*
pFlac
;
drflac
*
pFlac
;
memoryStream
.
data
=
(
const
unsigned
char
*
)
pData
;
memoryStream
.
data
=
(
const
drflac_uint8
*
)
pData
;
memoryStream
.
dataSize
=
dataSize
;
memoryStream
.
dataSize
=
dataSize
;
memoryStream
.
currentReadPos
=
0
;
memoryStream
.
currentReadPos
=
0
;
pFlac
=
drflac_open_with_metadata_private
(
drflac__on_read_memory
,
drflac__on_seek_memory
,
onMeta
,
drflac_container_unknown
,
&
memoryStream
,
pUserData
,
pAllocationCallbacks
);
pFlac
=
drflac_open_with_metadata_private
(
drflac__on_read_memory
,
drflac__on_seek_memory
,
onMeta
,
drflac_container_unknown
,
&
memoryStream
,
pUserData
,
pAllocationCallbacks
);
...
@@ -11705,6 +11705,9 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
...
@@ -11705,6 +11705,9 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
/*
/*
REVISION HISTORY
REVISION HISTORY
================
================
v0.12.12 - 2020-04-30
- Fix compilation errors with VC6.
v0.12.11 - 2020-04-19
v0.12.11 - 2020-04-19
- Fix some pedantic warnings.
- Fix some pedantic warnings.
- Fix some undefined behaviour warnings.
- Fix some undefined behaviour warnings.
...
...
extras/dr_mp3.h
View file @
5852d6ed
/*
/*
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_mp3 - v0.6.
8 - 2020-04-26
dr_mp3 - v0.6.
9 - 2020-04-30
David Reid - mackron@gmail.com
David Reid - mackron@gmail.com
...
@@ -249,14 +249,14 @@ typedef struct
...
@@ -249,14 +249,14 @@ typedef struct
{
{
float
mdct_overlap
[
2
][
9
*
32
],
qmf_state
[
15
*
2
*
32
];
float
mdct_overlap
[
2
][
9
*
32
],
qmf_state
[
15
*
2
*
32
];
int
reserv
,
free_format_bytes
;
int
reserv
,
free_format_bytes
;
unsigned
char
header
[
4
],
reserv_buf
[
511
];
drmp3_uint8
header
[
4
],
reserv_buf
[
511
];
}
drmp3dec
;
}
drmp3dec
;
/* Initializes a low level decoder. */
/* Initializes a low level decoder. */
DRMP3_API
void
drmp3dec_init
(
drmp3dec
*
dec
);
DRMP3_API
void
drmp3dec_init
(
drmp3dec
*
dec
);
/* Reads a frame from a low level decoder. */
/* Reads a frame from a low level decoder. */
DRMP3_API
int
drmp3dec_decode_frame
(
drmp3dec
*
dec
,
const
unsigned
char
*
mp3
,
int
mp3_bytes
,
void
*
pcm
,
drmp3dec_frame_info
*
info
);
DRMP3_API
int
drmp3dec_decode_frame
(
drmp3dec
*
dec
,
const
drmp3_uint8
*
mp3
,
int
mp3_bytes
,
void
*
pcm
,
drmp3dec_frame_info
*
info
);
/* Helper for converting between f32 and s16. */
/* Helper for converting between f32 and s16. */
DRMP3_API
void
drmp3dec_f32_to_s16
(
const
float
*
in
,
drmp3_int16
*
out
,
size_t
num_samples
);
DRMP3_API
void
drmp3dec_f32_to_s16
(
const
float
*
in
,
drmp3_int16
*
out
,
size_t
num_samples
);
...
@@ -2182,7 +2182,7 @@ DRMP3_API void drmp3dec_init(drmp3dec *dec)
...
@@ -2182,7 +2182,7 @@ DRMP3_API void drmp3dec_init(drmp3dec *dec)
dec
->
header
[
0
]
=
0
;
dec
->
header
[
0
]
=
0
;
}
}
DRMP3_API
int
drmp3dec_decode_frame
(
drmp3dec
*
dec
,
const
unsigned
char
*
mp3
,
int
mp3_bytes
,
void
*
pcm
,
drmp3dec_frame_info
*
info
)
DRMP3_API
int
drmp3dec_decode_frame
(
drmp3dec
*
dec
,
const
drmp3_uint8
*
mp3
,
int
mp3_bytes
,
void
*
pcm
,
drmp3dec_frame_info
*
info
)
{
{
int
i
=
0
,
igr
,
frame_size
=
0
,
success
=
1
;
int
i
=
0
,
igr
,
frame_size
=
0
,
success
=
1
;
const
drmp3_uint8
*
hdr
;
const
drmp3_uint8
*
hdr
;
...
@@ -4390,6 +4390,9 @@ counts rather than sample counts.
...
@@ -4390,6 +4390,9 @@ counts rather than sample counts.
/*
/*
REVISION HISTORY
REVISION HISTORY
================
================
v0.6.9 - 2020-04-30
- Change the `pcm` parameter of drmp3dec_decode_frame() to a `const drmp3_uint8*` for consistency with internal APIs.
v0.6.8 - 2020-04-26
v0.6.8 - 2020-04-26
- Optimizations to decoding when initializing from memory.
- Optimizations to decoding when initializing from memory.
...
...
extras/dr_wav.h
View file @
5852d6ed
/*
/*
WAV audio loader and writer. Choice of public domain or MIT-0. See license statements at the end of this file.
WAV audio loader and writer. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_wav - v0.12.
2 - 2020-04-21
dr_wav - v0.12.
3 - 2020-04-30
David Reid - mackron@gmail.com
David Reid - mackron@gmail.com
...
@@ -905,18 +905,18 @@ DRWAV_API drwav_int32* drwav_open_memory_and_read_pcm_frames_s32(const void* dat
...
@@ -905,18 +905,18 @@ DRWAV_API drwav_int32* drwav_open_memory_and_read_pcm_frames_s32(const void* dat
DRWAV_API
void
drwav_free
(
void
*
p
,
const
drwav_allocation_callbacks
*
pAllocationCallbacks
);
DRWAV_API
void
drwav_free
(
void
*
p
,
const
drwav_allocation_callbacks
*
pAllocationCallbacks
);
/* Converts bytes from a wav stream to a sized type of native endian. */
/* Converts bytes from a wav stream to a sized type of native endian. */
DRWAV_API
drwav_uint16
drwav_bytes_to_u16
(
const
unsigned
char
*
data
);
DRWAV_API
drwav_uint16
drwav_bytes_to_u16
(
const
drwav_uint8
*
data
);
DRWAV_API
drwav_int16
drwav_bytes_to_s16
(
const
unsigned
char
*
data
);
DRWAV_API
drwav_int16
drwav_bytes_to_s16
(
const
drwav_uint8
*
data
);
DRWAV_API
drwav_uint32
drwav_bytes_to_u32
(
const
unsigned
char
*
data
);
DRWAV_API
drwav_uint32
drwav_bytes_to_u32
(
const
drwav_uint8
*
data
);
DRWAV_API
drwav_int32
drwav_bytes_to_s32
(
const
unsigned
char
*
data
);
DRWAV_API
drwav_int32
drwav_bytes_to_s32
(
const
drwav_uint8
*
data
);
DRWAV_API
drwav_uint64
drwav_bytes_to_u64
(
const
unsigned
char
*
data
);
DRWAV_API
drwav_uint64
drwav_bytes_to_u64
(
const
drwav_uint8
*
data
);
DRWAV_API
drwav_int64
drwav_bytes_to_s64
(
const
unsigned
char
*
data
);
DRWAV_API
drwav_int64
drwav_bytes_to_s64
(
const
drwav_uint8
*
data
);
/* Compares a GUID for the purpose of checking the type of a Wave64 chunk. */
/* Compares a GUID for the purpose of checking the type of a Wave64 chunk. */
DRWAV_API
drwav_bool32
drwav_guid_equal
(
const
drwav_uint8
a
[
16
],
const
drwav_uint8
b
[
16
]);
DRWAV_API
drwav_bool32
drwav_guid_equal
(
const
drwav_uint8
a
[
16
],
const
drwav_uint8
b
[
16
]);
/* Compares a four-character-code for the purpose of checking the type of a RIFF chunk. */
/* Compares a four-character-code for the purpose of checking the type of a RIFF chunk. */
DRWAV_API
drwav_bool32
drwav_fourcc_equal
(
const
unsigned
char
*
a
,
const
char
*
b
);
DRWAV_API
drwav_bool32
drwav_fourcc_equal
(
const
drwav_uint8
*
a
,
const
char
*
b
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
@@ -1071,7 +1071,7 @@ static DRWAV_INLINE drwav_bool32 drwav__guid_equal(const drwav_uint8 a[16], cons
...
@@ -1071,7 +1071,7 @@ static DRWAV_INLINE drwav_bool32 drwav__guid_equal(const drwav_uint8 a[16], cons
return
DRWAV_TRUE
;
return
DRWAV_TRUE
;
}
}
static
DRWAV_INLINE
drwav_bool32
drwav__fourcc_equal
(
const
unsigned
char
*
a
,
const
char
*
b
)
static
DRWAV_INLINE
drwav_bool32
drwav__fourcc_equal
(
const
drwav_uint8
*
a
,
const
char
*
b
)
{
{
return
return
a
[
0
]
==
b
[
0
]
&&
a
[
0
]
==
b
[
0
]
&&
...
@@ -1094,39 +1094,39 @@ static DRWAV_INLINE int drwav__is_little_endian(void)
...
@@ -1094,39 +1094,39 @@ static DRWAV_INLINE int drwav__is_little_endian(void)
#endif
#endif
}
}
static
DRWAV_INLINE
drwav_uint16
drwav__bytes_to_u16
(
const
unsigned
char
*
data
)
static
DRWAV_INLINE
drwav_uint16
drwav__bytes_to_u16
(
const
drwav_uint8
*
data
)
{
{
return
(
data
[
0
]
<<
0
)
|
(
data
[
1
]
<<
8
);
return
(
data
[
0
]
<<
0
)
|
(
data
[
1
]
<<
8
);
}
}
static
DRWAV_INLINE
drwav_int16
drwav__bytes_to_s16
(
const
unsigned
char
*
data
)
static
DRWAV_INLINE
drwav_int16
drwav__bytes_to_s16
(
const
drwav_uint8
*
data
)
{
{
return
(
short
)
drwav__bytes_to_u16
(
data
);
return
(
short
)
drwav__bytes_to_u16
(
data
);
}
}
static
DRWAV_INLINE
drwav_uint32
drwav__bytes_to_u32
(
const
unsigned
char
*
data
)
static
DRWAV_INLINE
drwav_uint32
drwav__bytes_to_u32
(
const
drwav_uint8
*
data
)
{
{
return
(
data
[
0
]
<<
0
)
|
(
data
[
1
]
<<
8
)
|
(
data
[
2
]
<<
16
)
|
(
data
[
3
]
<<
24
);
return
(
data
[
0
]
<<
0
)
|
(
data
[
1
]
<<
8
)
|
(
data
[
2
]
<<
16
)
|
(
data
[
3
]
<<
24
);
}
}
static
DRWAV_INLINE
drwav_int32
drwav__bytes_to_s32
(
const
unsigned
char
*
data
)
static
DRWAV_INLINE
drwav_int32
drwav__bytes_to_s32
(
const
drwav_uint8
*
data
)
{
{
return
(
drwav_int32
)
drwav__bytes_to_u32
(
data
);
return
(
drwav_int32
)
drwav__bytes_to_u32
(
data
);
}
}
static
DRWAV_INLINE
drwav_uint64
drwav__bytes_to_u64
(
const
unsigned
char
*
data
)
static
DRWAV_INLINE
drwav_uint64
drwav__bytes_to_u64
(
const
drwav_uint8
*
data
)
{
{
return
return
((
drwav_uint64
)
data
[
0
]
<<
0
)
|
((
drwav_uint64
)
data
[
1
]
<<
8
)
|
((
drwav_uint64
)
data
[
2
]
<<
16
)
|
((
drwav_uint64
)
data
[
3
]
<<
24
)
|
((
drwav_uint64
)
data
[
0
]
<<
0
)
|
((
drwav_uint64
)
data
[
1
]
<<
8
)
|
((
drwav_uint64
)
data
[
2
]
<<
16
)
|
((
drwav_uint64
)
data
[
3
]
<<
24
)
|
((
drwav_uint64
)
data
[
4
]
<<
32
)
|
((
drwav_uint64
)
data
[
5
]
<<
40
)
|
((
drwav_uint64
)
data
[
6
]
<<
48
)
|
((
drwav_uint64
)
data
[
7
]
<<
56
);
((
drwav_uint64
)
data
[
4
]
<<
32
)
|
((
drwav_uint64
)
data
[
5
]
<<
40
)
|
((
drwav_uint64
)
data
[
6
]
<<
48
)
|
((
drwav_uint64
)
data
[
7
]
<<
56
);
}
}
static
DRWAV_INLINE
drwav_int64
drwav__bytes_to_s64
(
const
unsigned
char
*
data
)
static
DRWAV_INLINE
drwav_int64
drwav__bytes_to_s64
(
const
drwav_uint8
*
data
)
{
{
return
(
drwav_int64
)
drwav__bytes_to_u64
(
data
);
return
(
drwav_int64
)
drwav__bytes_to_u64
(
data
);
}
}
static
DRWAV_INLINE
void
drwav__bytes_to_guid
(
const
unsigned
char
*
data
,
drwav_uint8
*
guid
)
static
DRWAV_INLINE
void
drwav__bytes_to_guid
(
const
drwav_uint8
*
data
,
drwav_uint8
*
guid
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
16
;
++
i
)
{
for
(
i
=
0
;
i
<
16
;
++
i
)
{
...
@@ -1495,7 +1495,7 @@ static drwav_bool32 drwav_init_write__internal(drwav* pWav, const drwav_data_for
...
@@ -1495,7 +1495,7 @@ static drwav_bool32 drwav_init_write__internal(drwav* pWav, const drwav_data_for
static
drwav_result
drwav__read_chunk_header
(
drwav_read_proc
onRead
,
void
*
pUserData
,
drwav_container
container
,
drwav_uint64
*
pRunningBytesReadOut
,
drwav_chunk_header
*
pHeaderOut
)
static
drwav_result
drwav__read_chunk_header
(
drwav_read_proc
onRead
,
void
*
pUserData
,
drwav_container
container
,
drwav_uint64
*
pRunningBytesReadOut
,
drwav_chunk_header
*
pHeaderOut
)
{
{
if
(
container
==
drwav_container_riff
)
{
if
(
container
==
drwav_container_riff
)
{
unsigned
char
sizeInBytes
[
4
];
drwav_uint8
sizeInBytes
[
4
];
if
(
onRead
(
pUserData
,
pHeaderOut
->
id
.
fourcc
,
4
)
!=
4
)
{
if
(
onRead
(
pUserData
,
pHeaderOut
->
id
.
fourcc
,
4
)
!=
4
)
{
return
DRWAV_AT_END
;
return
DRWAV_AT_END
;
...
@@ -1509,7 +1509,7 @@ static drwav_result drwav__read_chunk_header(drwav_read_proc onRead, void* pUser
...
@@ -1509,7 +1509,7 @@ static drwav_result drwav__read_chunk_header(drwav_read_proc onRead, void* pUser
pHeaderOut
->
paddingSize
=
drwav__chunk_padding_size_riff
(
pHeaderOut
->
sizeInBytes
);
pHeaderOut
->
paddingSize
=
drwav__chunk_padding_size_riff
(
pHeaderOut
->
sizeInBytes
);
*
pRunningBytesReadOut
+=
8
;
*
pRunningBytesReadOut
+=
8
;
}
else
{
}
else
{
unsigned
char
sizeInBytes
[
8
];
drwav_uint8
sizeInBytes
[
8
];
if
(
onRead
(
pUserData
,
pHeaderOut
->
id
.
guid
,
16
)
!=
16
)
{
if
(
onRead
(
pUserData
,
pHeaderOut
->
id
.
guid
,
16
)
!=
16
)
{
return
DRWAV_AT_END
;
return
DRWAV_AT_END
;
...
@@ -1578,7 +1578,7 @@ static drwav_bool32 drwav__seek_from_start(drwav_seek_proc onSeek, drwav_uint64
...
@@ -1578,7 +1578,7 @@ static drwav_bool32 drwav__seek_from_start(drwav_seek_proc onSeek, drwav_uint64
static
drwav_bool32
drwav__read_fmt
(
drwav_read_proc
onRead
,
drwav_seek_proc
onSeek
,
void
*
pUserData
,
drwav_container
container
,
drwav_uint64
*
pRunningBytesReadOut
,
drwav_fmt
*
fmtOut
)
static
drwav_bool32
drwav__read_fmt
(
drwav_read_proc
onRead
,
drwav_seek_proc
onSeek
,
void
*
pUserData
,
drwav_container
container
,
drwav_uint64
*
pRunningBytesReadOut
,
drwav_fmt
*
fmtOut
)
{
{
drwav_chunk_header
header
;
drwav_chunk_header
header
;
unsigned
char
fmt
[
16
];
drwav_uint8
fmt
[
16
];
if
(
drwav__read_chunk_header
(
onRead
,
pUserData
,
container
,
pRunningBytesReadOut
,
&
header
)
!=
DRWAV_SUCCESS
)
{
if
(
drwav__read_chunk_header
(
onRead
,
pUserData
,
container
,
pRunningBytesReadOut
,
&
header
)
!=
DRWAV_SUCCESS
)
{
return
DRWAV_FALSE
;
return
DRWAV_FALSE
;
...
@@ -1629,7 +1629,7 @@ static drwav_bool32 drwav__read_fmt(drwav_read_proc onRead, drwav_seek_proc onSe
...
@@ -1629,7 +1629,7 @@ static drwav_bool32 drwav__read_fmt(drwav_read_proc onRead, drwav_seek_proc onSe
memset
(
fmtOut
->
subFormat
,
0
,
sizeof
(
fmtOut
->
subFormat
));
memset
(
fmtOut
->
subFormat
,
0
,
sizeof
(
fmtOut
->
subFormat
));
if
(
header
.
sizeInBytes
>
16
)
{
if
(
header
.
sizeInBytes
>
16
)
{
unsigned
char
fmt_cbSize
[
2
];
drwav_uint8
fmt_cbSize
[
2
];
int
bytesReadSoFar
=
0
;
int
bytesReadSoFar
=
0
;
if
(
onRead
(
pUserData
,
fmt_cbSize
,
sizeof
(
fmt_cbSize
))
!=
sizeof
(
fmt_cbSize
))
{
if
(
onRead
(
pUserData
,
fmt_cbSize
,
sizeof
(
fmt_cbSize
))
!=
sizeof
(
fmt_cbSize
))
{
...
@@ -1649,7 +1649,7 @@ static drwav_bool32 drwav__read_fmt(drwav_read_proc onRead, drwav_seek_proc onSe
...
@@ -1649,7 +1649,7 @@ static drwav_bool32 drwav__read_fmt(drwav_read_proc onRead, drwav_seek_proc onSe
}
}
if
(
fmtOut
->
formatTag
==
DR_WAVE_FORMAT_EXTENSIBLE
)
{
if
(
fmtOut
->
formatTag
==
DR_WAVE_FORMAT_EXTENSIBLE
)
{
unsigned
char
fmtext
[
22
];
drwav_uint8
fmtext
[
22
];
if
(
onRead
(
pUserData
,
fmtext
,
fmtOut
->
extendedSize
)
!=
fmtOut
->
extendedSize
)
{
if
(
onRead
(
pUserData
,
fmtext
,
fmtOut
->
extendedSize
)
!=
fmtOut
->
extendedSize
)
{
return
DRWAV_FALSE
;
/* Expecting more data. */
return
DRWAV_FALSE
;
/* Expecting more data. */
}
}
...
@@ -1771,7 +1771,7 @@ static drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc onChunk,
...
@@ -1771,7 +1771,7 @@ static drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc onChunk,
drwav_uint64
cursor
;
/* <-- Keeps track of the byte position so we can seek to specific locations. */
drwav_uint64
cursor
;
/* <-- Keeps track of the byte position so we can seek to specific locations. */
drwav_bool32
sequential
;
drwav_bool32
sequential
;
unsigned
char
riff
[
4
];
drwav_uint8
riff
[
4
];
drwav_fmt
fmt
;
drwav_fmt
fmt
;
unsigned
short
translatedFormatTag
;
unsigned
short
translatedFormatTag
;
drwav_uint64
sampleCountFromFactChunk
;
drwav_uint64
sampleCountFromFactChunk
;
...
@@ -1815,8 +1815,8 @@ static drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc onChunk,
...
@@ -1815,8 +1815,8 @@ static drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc onChunk,
if
(
pWav
->
container
==
drwav_container_riff
)
{
if
(
pWav
->
container
==
drwav_container_riff
)
{
unsigned
char
chunkSizeBytes
[
4
];
drwav_uint8
chunkSizeBytes
[
4
];
unsigned
char
wave
[
4
];
drwav_uint8
wave
[
4
];
/* RIFF/WAVE */
/* RIFF/WAVE */
if
(
drwav__on_read
(
pWav
->
onRead
,
pWav
->
pUserData
,
chunkSizeBytes
,
sizeof
(
chunkSizeBytes
),
&
cursor
)
!=
sizeof
(
chunkSizeBytes
))
{
if
(
drwav__on_read
(
pWav
->
onRead
,
pWav
->
pUserData
,
chunkSizeBytes
,
sizeof
(
chunkSizeBytes
),
&
cursor
)
!=
sizeof
(
chunkSizeBytes
))
{
...
@@ -1835,7 +1835,7 @@ static drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc onChunk,
...
@@ -1835,7 +1835,7 @@ static drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc onChunk,
return
DRWAV_FALSE
;
/* Expecting "WAVE". */
return
DRWAV_FALSE
;
/* Expecting "WAVE". */
}
}
}
else
{
}
else
{
unsigned
char
chunkSizeBytes
[
8
];
drwav_uint8
chunkSizeBytes
[
8
];
drwav_uint8
wave
[
16
];
drwav_uint8
wave
[
16
];
/* W64 */
/* W64 */
...
@@ -1984,7 +1984,7 @@ static drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc onChunk,
...
@@ -1984,7 +1984,7 @@ static drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc onChunk,
/* "smpl" chunk. */
/* "smpl" chunk. */
if
(
pWav
->
container
==
drwav_container_riff
)
{
if
(
pWav
->
container
==
drwav_container_riff
)
{
if
(
drwav__fourcc_equal
(
header
.
id
.
fourcc
,
"smpl"
))
{
if
(
drwav__fourcc_equal
(
header
.
id
.
fourcc
,
"smpl"
))
{
unsigned
char
smplHeaderData
[
36
];
/* 36 = size of the smpl header section, not including the loop data. */
drwav_uint8
smplHeaderData
[
36
];
/* 36 = size of the smpl header section, not including the loop data. */
if
(
chunkSize
>=
sizeof
(
smplHeaderData
))
{
if
(
chunkSize
>=
sizeof
(
smplHeaderData
))
{
drwav_uint64
bytesJustRead
=
drwav__on_read
(
pWav
->
onRead
,
pWav
->
pUserData
,
smplHeaderData
,
sizeof
(
smplHeaderData
),
&
cursor
);
drwav_uint64
bytesJustRead
=
drwav__on_read
(
pWav
->
onRead
,
pWav
->
pUserData
,
smplHeaderData
,
sizeof
(
smplHeaderData
),
&
cursor
);
chunkSize
-=
bytesJustRead
;
chunkSize
-=
bytesJustRead
;
...
@@ -2003,7 +2003,7 @@ static drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc onChunk,
...
@@ -2003,7 +2003,7 @@ static drwav_bool32 drwav_init__internal(drwav* pWav, drwav_chunk_proc onChunk,
pWav
->
smpl
.
samplerData
=
drwav__bytes_to_u32
(
smplHeaderData
+
32
);
pWav
->
smpl
.
samplerData
=
drwav__bytes_to_u32
(
smplHeaderData
+
32
);
for
(
iLoop
=
0
;
iLoop
<
pWav
->
smpl
.
numSampleLoops
&&
iLoop
<
drwav_countof
(
pWav
->
smpl
.
loops
);
++
iLoop
)
{
for
(
iLoop
=
0
;
iLoop
<
pWav
->
smpl
.
numSampleLoops
&&
iLoop
<
drwav_countof
(
pWav
->
smpl
.
loops
);
++
iLoop
)
{
unsigned
char
smplLoopData
[
24
];
/* 24 = size of a loop section in the smpl chunk. */
drwav_uint8
smplLoopData
[
24
];
/* 24 = size of a loop section in the smpl chunk. */
bytesJustRead
=
drwav__on_read
(
pWav
->
onRead
,
pWav
->
pUserData
,
smplLoopData
,
sizeof
(
smplLoopData
),
&
cursor
);
bytesJustRead
=
drwav__on_read
(
pWav
->
onRead
,
pWav
->
pUserData
,
smplLoopData
,
sizeof
(
smplLoopData
),
&
cursor
);
chunkSize
-=
bytesJustRead
;
chunkSize
-=
bytesJustRead
;
...
@@ -2348,7 +2348,8 @@ DRWAV_API drwav_bool32 drwav_init_write_sequential_pcm_frames(drwav* pWav, const
...
@@ -2348,7 +2348,8 @@ DRWAV_API drwav_bool32 drwav_init_write_sequential_pcm_frames(drwav* pWav, const
DRWAV_API
drwav_uint64
drwav_target_write_size_bytes
(
const
drwav_data_format
*
pFormat
,
drwav_uint64
totalSampleCount
)
DRWAV_API
drwav_uint64
drwav_target_write_size_bytes
(
const
drwav_data_format
*
pFormat
,
drwav_uint64
totalSampleCount
)
{
{
drwav_uint64
targetDataSizeBytes
=
(
drwav_uint64
)(
totalSampleCount
*
pFormat
->
channels
*
pFormat
->
bitsPerSample
/
8.0
);
/* Casting totalSampleCount to drwav_int64 for VC6 compatibility. No issues in practice because nobody is going to exhaust the whole 63 bits. */
drwav_uint64
targetDataSizeBytes
=
(
drwav_uint64
)((
drwav_int64
)
totalSampleCount
*
pFormat
->
channels
*
pFormat
->
bitsPerSample
/
8.0
);
drwav_uint64
riffChunkSizeBytes
;
drwav_uint64
riffChunkSizeBytes
;
drwav_uint64
fileSizeBytes
;
drwav_uint64
fileSizeBytes
;
...
@@ -3195,7 +3196,7 @@ DRWAV_API drwav_bool32 drwav_init_memory_ex(drwav* pWav, const void* data, size_
...
@@ -3195,7 +3196,7 @@ DRWAV_API drwav_bool32 drwav_init_memory_ex(drwav* pWav, const void* data, size_
return
DRWAV_FALSE
;
return
DRWAV_FALSE
;
}
}
pWav
->
memoryStream
.
data
=
(
const
unsigned
char
*
)
data
;
pWav
->
memoryStream
.
data
=
(
const
drwav_uint8
*
)
data
;
pWav
->
memoryStream
.
dataSize
=
dataSize
;
pWav
->
memoryStream
.
dataSize
=
dataSize
;
pWav
->
memoryStream
.
currentReadPos
=
0
;
pWav
->
memoryStream
.
currentReadPos
=
0
;
...
@@ -4009,7 +4010,7 @@ static DRWAV_INLINE drwav_int16 drwav__mulaw_to_s16(drwav_uint8 sampleIn)
...
@@ -4009,7 +4010,7 @@ static DRWAV_INLINE drwav_int16 drwav__mulaw_to_s16(drwav_uint8 sampleIn)
static
void
drwav__pcm_to_s16
(
drwav_int16
*
pOut
,
const
unsigned
char
*
pIn
,
size_t
totalSampleCount
,
unsigned
int
bytesPerSample
)
static
void
drwav__pcm_to_s16
(
drwav_int16
*
pOut
,
const
drwav_uint8
*
pIn
,
size_t
totalSampleCount
,
unsigned
int
bytesPerSample
)
{
{
unsigned
int
i
;
unsigned
int
i
;
...
@@ -4061,7 +4062,7 @@ static void drwav__pcm_to_s16(drwav_int16* pOut, const unsigned char* pIn, size_
...
@@ -4061,7 +4062,7 @@ static void drwav__pcm_to_s16(drwav_int16* pOut, const unsigned char* pIn, size_
}
}
}
}
static
void
drwav__ieee_to_s16
(
drwav_int16
*
pOut
,
const
unsigned
char
*
pIn
,
size_t
totalSampleCount
,
unsigned
int
bytesPerSample
)
static
void
drwav__ieee_to_s16
(
drwav_int16
*
pOut
,
const
drwav_uint8
*
pIn
,
size_t
totalSampleCount
,
unsigned
int
bytesPerSample
)
{
{
if
(
bytesPerSample
==
4
)
{
if
(
bytesPerSample
==
4
)
{
drwav_f32_to_s16
(
pOut
,
(
const
float
*
)
pIn
,
totalSampleCount
);
drwav_f32_to_s16
(
pOut
,
(
const
float
*
)
pIn
,
totalSampleCount
);
...
@@ -4080,7 +4081,7 @@ static drwav_uint64 drwav_read_pcm_frames_s16__pcm(drwav* pWav, drwav_uint64 fra
...
@@ -4080,7 +4081,7 @@ static drwav_uint64 drwav_read_pcm_frames_s16__pcm(drwav* pWav, drwav_uint64 fra
{
{
drwav_uint32
bytesPerFrame
;
drwav_uint32
bytesPerFrame
;
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
/* Fast path. */
/* Fast path. */
if
(
pWav
->
translatedFormatTag
==
DR_WAVE_FORMAT_PCM
&&
pWav
->
bitsPerSample
==
16
)
{
if
(
pWav
->
translatedFormatTag
==
DR_WAVE_FORMAT_PCM
&&
pWav
->
bitsPerSample
==
16
)
{
...
@@ -4113,7 +4114,7 @@ static drwav_uint64 drwav_read_pcm_frames_s16__pcm(drwav* pWav, drwav_uint64 fra
...
@@ -4113,7 +4114,7 @@ static drwav_uint64 drwav_read_pcm_frames_s16__pcm(drwav* pWav, drwav_uint64 fra
static
drwav_uint64
drwav_read_pcm_frames_s16__ieee
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int16
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_s16__ieee
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int16
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
if
(
bytesPerFrame
==
0
)
{
if
(
bytesPerFrame
==
0
)
{
...
@@ -4141,7 +4142,7 @@ static drwav_uint64 drwav_read_pcm_frames_s16__ieee(drwav* pWav, drwav_uint64 fr
...
@@ -4141,7 +4142,7 @@ static drwav_uint64 drwav_read_pcm_frames_s16__ieee(drwav* pWav, drwav_uint64 fr
static
drwav_uint64
drwav_read_pcm_frames_s16__alaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int16
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_s16__alaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int16
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
if
(
bytesPerFrame
==
0
)
{
if
(
bytesPerFrame
==
0
)
{
...
@@ -4169,7 +4170,7 @@ static drwav_uint64 drwav_read_pcm_frames_s16__alaw(drwav* pWav, drwav_uint64 fr
...
@@ -4169,7 +4170,7 @@ static drwav_uint64 drwav_read_pcm_frames_s16__alaw(drwav* pWav, drwav_uint64 fr
static
drwav_uint64
drwav_read_pcm_frames_s16__mulaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int16
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_s16__mulaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int16
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
if
(
bytesPerFrame
==
0
)
{
if
(
bytesPerFrame
==
0
)
{
...
@@ -4270,7 +4271,7 @@ DRWAV_API void drwav_s24_to_s16(drwav_int16* pOut, const drwav_uint8* pIn, size_
...
@@ -4270,7 +4271,7 @@ DRWAV_API void drwav_s24_to_s16(drwav_int16* pOut, const drwav_uint8* pIn, size_
int
r
;
int
r
;
size_t
i
;
size_t
i
;
for
(
i
=
0
;
i
<
sampleCount
;
++
i
)
{
for
(
i
=
0
;
i
<
sampleCount
;
++
i
)
{
int
x
=
((
int
)(((
unsigned
int
)(((
const
unsigned
char
*
)
pIn
)[
i
*
3
+
0
])
<<
8
)
|
((
unsigned
int
)(((
const
unsigned
char
*
)
pIn
)[
i
*
3
+
1
])
<<
16
)
|
((
unsigned
int
)(((
const
unsigned
char
*
)
pIn
)[
i
*
3
+
2
]))
<<
24
))
>>
8
;
int
x
=
((
int
)(((
unsigned
int
)(((
const
drwav_uint8
*
)
pIn
)[
i
*
3
+
0
])
<<
8
)
|
((
unsigned
int
)(((
const
drwav_uint8
*
)
pIn
)[
i
*
3
+
1
])
<<
16
)
|
((
unsigned
int
)(((
const
drwav_uint8
*
)
pIn
)[
i
*
3
+
2
]))
<<
24
))
>>
8
;
r
=
x
>>
8
;
r
=
x
>>
8
;
pOut
[
i
]
=
(
short
)
r
;
pOut
[
i
]
=
(
short
)
r
;
}
}
...
@@ -4335,7 +4336,7 @@ DRWAV_API void drwav_mulaw_to_s16(drwav_int16* pOut, const drwav_uint8* pIn, siz
...
@@ -4335,7 +4336,7 @@ DRWAV_API void drwav_mulaw_to_s16(drwav_int16* pOut, const drwav_uint8* pIn, siz
static
void
drwav__pcm_to_f32
(
float
*
pOut
,
const
unsigned
char
*
pIn
,
size_t
sampleCount
,
unsigned
int
bytesPerSample
)
static
void
drwav__pcm_to_f32
(
float
*
pOut
,
const
drwav_uint8
*
pIn
,
size_t
sampleCount
,
unsigned
int
bytesPerSample
)
{
{
unsigned
int
i
;
unsigned
int
i
;
...
@@ -4384,7 +4385,7 @@ static void drwav__pcm_to_f32(float* pOut, const unsigned char* pIn, size_t samp
...
@@ -4384,7 +4385,7 @@ static void drwav__pcm_to_f32(float* pOut, const unsigned char* pIn, size_t samp
}
}
}
}
static
void
drwav__ieee_to_f32
(
float
*
pOut
,
const
unsigned
char
*
pIn
,
size_t
sampleCount
,
unsigned
int
bytesPerSample
)
static
void
drwav__ieee_to_f32
(
float
*
pOut
,
const
drwav_uint8
*
pIn
,
size_t
sampleCount
,
unsigned
int
bytesPerSample
)
{
{
if
(
bytesPerSample
==
4
)
{
if
(
bytesPerSample
==
4
)
{
unsigned
int
i
;
unsigned
int
i
;
...
@@ -4406,7 +4407,7 @@ static void drwav__ieee_to_f32(float* pOut, const unsigned char* pIn, size_t sam
...
@@ -4406,7 +4407,7 @@ static void drwav__ieee_to_f32(float* pOut, const unsigned char* pIn, size_t sam
static
drwav_uint64
drwav_read_pcm_frames_f32__pcm
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
float
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_f32__pcm
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
float
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
if
(
bytesPerFrame
==
0
)
{
if
(
bytesPerFrame
==
0
)
{
...
@@ -4482,7 +4483,7 @@ static drwav_uint64 drwav_read_pcm_frames_f32__ima(drwav* pWav, drwav_uint64 fra
...
@@ -4482,7 +4483,7 @@ static drwav_uint64 drwav_read_pcm_frames_f32__ima(drwav* pWav, drwav_uint64 fra
static
drwav_uint64
drwav_read_pcm_frames_f32__ieee
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
float
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_f32__ieee
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
float
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
;
drwav_uint32
bytesPerFrame
;
/* Fast path. */
/* Fast path. */
...
@@ -4516,7 +4517,7 @@ static drwav_uint64 drwav_read_pcm_frames_f32__ieee(drwav* pWav, drwav_uint64 fr
...
@@ -4516,7 +4517,7 @@ static drwav_uint64 drwav_read_pcm_frames_f32__ieee(drwav* pWav, drwav_uint64 fr
static
drwav_uint64
drwav_read_pcm_frames_f32__alaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
float
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_f32__alaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
float
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
if
(
bytesPerFrame
==
0
)
{
if
(
bytesPerFrame
==
0
)
{
return
0
;
return
0
;
...
@@ -4543,7 +4544,7 @@ static drwav_uint64 drwav_read_pcm_frames_f32__alaw(drwav* pWav, drwav_uint64 fr
...
@@ -4543,7 +4544,7 @@ static drwav_uint64 drwav_read_pcm_frames_f32__alaw(drwav* pWav, drwav_uint64 fr
static
drwav_uint64
drwav_read_pcm_frames_f32__mulaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
float
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_f32__mulaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
float
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
if
(
bytesPerFrame
==
0
)
{
if
(
bytesPerFrame
==
0
)
{
...
@@ -4736,7 +4737,7 @@ DRWAV_API void drwav_mulaw_to_f32(float* pOut, const drwav_uint8* pIn, size_t sa
...
@@ -4736,7 +4737,7 @@ DRWAV_API void drwav_mulaw_to_f32(float* pOut, const drwav_uint8* pIn, size_t sa
static
void
drwav__pcm_to_s32
(
drwav_int32
*
pOut
,
const
unsigned
char
*
pIn
,
size_t
totalSampleCount
,
unsigned
int
bytesPerSample
)
static
void
drwav__pcm_to_s32
(
drwav_int32
*
pOut
,
const
drwav_uint8
*
pIn
,
size_t
totalSampleCount
,
unsigned
int
bytesPerSample
)
{
{
unsigned
int
i
;
unsigned
int
i
;
...
@@ -4787,7 +4788,7 @@ static void drwav__pcm_to_s32(drwav_int32* pOut, const unsigned char* pIn, size_
...
@@ -4787,7 +4788,7 @@ static void drwav__pcm_to_s32(drwav_int32* pOut, const unsigned char* pIn, size_
}
}
}
}
static
void
drwav__ieee_to_s32
(
drwav_int32
*
pOut
,
const
unsigned
char
*
pIn
,
size_t
totalSampleCount
,
unsigned
int
bytesPerSample
)
static
void
drwav__ieee_to_s32
(
drwav_int32
*
pOut
,
const
drwav_uint8
*
pIn
,
size_t
totalSampleCount
,
unsigned
int
bytesPerSample
)
{
{
if
(
bytesPerSample
==
4
)
{
if
(
bytesPerSample
==
4
)
{
drwav_f32_to_s32
(
pOut
,
(
const
float
*
)
pIn
,
totalSampleCount
);
drwav_f32_to_s32
(
pOut
,
(
const
float
*
)
pIn
,
totalSampleCount
);
...
@@ -4806,7 +4807,7 @@ static void drwav__ieee_to_s32(drwav_int32* pOut, const unsigned char* pIn, size
...
@@ -4806,7 +4807,7 @@ static void drwav__ieee_to_s32(drwav_int32* pOut, const unsigned char* pIn, size
static
drwav_uint64
drwav_read_pcm_frames_s32__pcm
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int32
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_s32__pcm
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int32
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
;
drwav_uint32
bytesPerFrame
;
/* Fast path. */
/* Fast path. */
...
@@ -4888,7 +4889,7 @@ static drwav_uint64 drwav_read_pcm_frames_s32__ima(drwav* pWav, drwav_uint64 fra
...
@@ -4888,7 +4889,7 @@ static drwav_uint64 drwav_read_pcm_frames_s32__ima(drwav* pWav, drwav_uint64 fra
static
drwav_uint64
drwav_read_pcm_frames_s32__ieee
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int32
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_s32__ieee
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int32
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
if
(
bytesPerFrame
==
0
)
{
if
(
bytesPerFrame
==
0
)
{
...
@@ -4916,7 +4917,7 @@ static drwav_uint64 drwav_read_pcm_frames_s32__ieee(drwav* pWav, drwav_uint64 fr
...
@@ -4916,7 +4917,7 @@ static drwav_uint64 drwav_read_pcm_frames_s32__ieee(drwav* pWav, drwav_uint64 fr
static
drwav_uint64
drwav_read_pcm_frames_s32__alaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int32
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_s32__alaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int32
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
if
(
bytesPerFrame
==
0
)
{
if
(
bytesPerFrame
==
0
)
{
...
@@ -4944,7 +4945,7 @@ static drwav_uint64 drwav_read_pcm_frames_s32__alaw(drwav* pWav, drwav_uint64 fr
...
@@ -4944,7 +4945,7 @@ static drwav_uint64 drwav_read_pcm_frames_s32__alaw(drwav* pWav, drwav_uint64 fr
static
drwav_uint64
drwav_read_pcm_frames_s32__mulaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int32
*
pBufferOut
)
static
drwav_uint64
drwav_read_pcm_frames_s32__mulaw
(
drwav
*
pWav
,
drwav_uint64
framesToRead
,
drwav_int32
*
pBufferOut
)
{
{
drwav_uint64
totalFramesRead
;
drwav_uint64
totalFramesRead
;
unsigned
char
sampleData
[
4096
];
drwav_uint8
sampleData
[
4096
];
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
drwav_uint32
bytesPerFrame
=
drwav_get_bytes_per_pcm_frame
(
pWav
);
if
(
bytesPerFrame
==
0
)
{
if
(
bytesPerFrame
==
0
)
{
...
@@ -5521,32 +5522,32 @@ DRWAV_API void drwav_free(void* p, const drwav_allocation_callbacks* pAllocation
...
@@ -5521,32 +5522,32 @@ DRWAV_API void drwav_free(void* p, const drwav_allocation_callbacks* pAllocation
}
}
}
}
DRWAV_API
drwav_uint16
drwav_bytes_to_u16
(
const
unsigned
char
*
data
)
DRWAV_API
drwav_uint16
drwav_bytes_to_u16
(
const
drwav_uint8
*
data
)
{
{
return
drwav__bytes_to_u16
(
data
);
return
drwav__bytes_to_u16
(
data
);
}
}
DRWAV_API
drwav_int16
drwav_bytes_to_s16
(
const
unsigned
char
*
data
)
DRWAV_API
drwav_int16
drwav_bytes_to_s16
(
const
drwav_uint8
*
data
)
{
{
return
drwav__bytes_to_s16
(
data
);
return
drwav__bytes_to_s16
(
data
);
}
}
DRWAV_API
drwav_uint32
drwav_bytes_to_u32
(
const
unsigned
char
*
data
)
DRWAV_API
drwav_uint32
drwav_bytes_to_u32
(
const
drwav_uint8
*
data
)
{
{
return
drwav__bytes_to_u32
(
data
);
return
drwav__bytes_to_u32
(
data
);
}
}
DRWAV_API
drwav_int32
drwav_bytes_to_s32
(
const
unsigned
char
*
data
)
DRWAV_API
drwav_int32
drwav_bytes_to_s32
(
const
drwav_uint8
*
data
)
{
{
return
drwav__bytes_to_s32
(
data
);
return
drwav__bytes_to_s32
(
data
);
}
}
DRWAV_API
drwav_uint64
drwav_bytes_to_u64
(
const
unsigned
char
*
data
)
DRWAV_API
drwav_uint64
drwav_bytes_to_u64
(
const
drwav_uint8
*
data
)
{
{
return
drwav__bytes_to_u64
(
data
);
return
drwav__bytes_to_u64
(
data
);
}
}
DRWAV_API
drwav_int64
drwav_bytes_to_s64
(
const
unsigned
char
*
data
)
DRWAV_API
drwav_int64
drwav_bytes_to_s64
(
const
drwav_uint8
*
data
)
{
{
return
drwav__bytes_to_s64
(
data
);
return
drwav__bytes_to_s64
(
data
);
}
}
...
@@ -5557,7 +5558,7 @@ DRWAV_API drwav_bool32 drwav_guid_equal(const drwav_uint8 a[16], const drwav_uin
...
@@ -5557,7 +5558,7 @@ DRWAV_API drwav_bool32 drwav_guid_equal(const drwav_uint8 a[16], const drwav_uin
return
drwav__guid_equal
(
a
,
b
);
return
drwav__guid_equal
(
a
,
b
);
}
}
DRWAV_API
drwav_bool32
drwav_fourcc_equal
(
const
unsigned
char
*
a
,
const
char
*
b
)
DRWAV_API
drwav_bool32
drwav_fourcc_equal
(
const
drwav_uint8
*
a
,
const
char
*
b
)
{
{
return
drwav__fourcc_equal
(
a
,
b
);
return
drwav__fourcc_equal
(
a
,
b
);
}
}
...
@@ -5752,6 +5753,9 @@ two different ways to initialize a drwav object.
...
@@ -5752,6 +5753,9 @@ two different ways to initialize a drwav object.
/*
/*
REVISION HISTORY
REVISION HISTORY
================
================
v0.12.3 - 2020-04-30
- Fix compilation errors with VC6.
v0.12.2 - 2020-04-21
v0.12.2 - 2020-04-21
- Fix a bug where drwav_init_file() does not close the file handle after attempting to load an erroneous file.
- Fix a bug where drwav_init_file() does not close the file handle after attempting to load an erroneous file.
...
...
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