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
521a6623
Commit
521a6623
authored
Apr 21, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update dr_wav.
parent
5e8a299a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
9 deletions
+30
-9
extras/dr_wav.h
extras/dr_wav.h
+30
-9
No files found.
extras/dr_wav.h
View file @
521a6623
/*
/*
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.
1 - 2020-04-13
dr_wav - v0.12.
2 - 2020-04-21
David Reid - mackron@gmail.com
David Reid - mackron@gmail.com
...
@@ -40,7 +40,7 @@ You can then #include this file in other parts of the program as you would with
...
@@ -40,7 +40,7 @@ You can then #include this file in other parts of the program as you would with
```c
```c
drwav wav;
drwav wav;
if (!drwav_init_file(&wav, "my_song.wav")) {
if (!drwav_init_file(&wav, "my_song.wav"
, NULL
)) {
// Error opening WAV file.
// Error opening WAV file.
}
}
...
@@ -58,7 +58,7 @@ If you just want to quickly open and read the audio data in a single operation y
...
@@ -58,7 +58,7 @@ If you just want to quickly open and read the audio data in a single operation y
unsigned int channels;
unsigned int channels;
unsigned int sampleRate;
unsigned int sampleRate;
drwav_uint64 totalPCMFrameCount;
drwav_uint64 totalPCMFrameCount;
float* pSampleData = drwav_open_file_and_read_pcm_frames_f32("my_song.wav", &channels, &sampleRate, &totalPCMFrameCount);
float* pSampleData = drwav_open_file_and_read_pcm_frames_f32("my_song.wav", &channels, &sampleRate, &totalPCMFrameCount
, NULL
);
if (pSampleData == NULL) {
if (pSampleData == NULL) {
// Error opening and reading WAV file.
// Error opening and reading WAV file.
}
}
...
@@ -2935,12 +2935,21 @@ DRWAV_API drwav_bool32 drwav_init_file(drwav* pWav, const char* filename, const
...
@@ -2935,12 +2935,21 @@ DRWAV_API drwav_bool32 drwav_init_file(drwav* pWav, const char* filename, const
static
drwav_bool32
drwav_init_file__internal_FILE
(
drwav
*
pWav
,
FILE
*
pFile
,
drwav_chunk_proc
onChunk
,
void
*
pChunkUserData
,
drwav_uint32
flags
,
const
drwav_allocation_callbacks
*
pAllocationCallbacks
)
static
drwav_bool32
drwav_init_file__internal_FILE
(
drwav
*
pWav
,
FILE
*
pFile
,
drwav_chunk_proc
onChunk
,
void
*
pChunkUserData
,
drwav_uint32
flags
,
const
drwav_allocation_callbacks
*
pAllocationCallbacks
)
{
{
if
(
!
drwav_preinit
(
pWav
,
drwav__on_read_stdio
,
drwav__on_seek_stdio
,
(
void
*
)
pFile
,
pAllocationCallbacks
))
{
drwav_bool32
result
;
result
=
drwav_preinit
(
pWav
,
drwav__on_read_stdio
,
drwav__on_seek_stdio
,
(
void
*
)
pFile
,
pAllocationCallbacks
);
if
(
result
!=
DRWAV_TRUE
)
{
fclose
(
pFile
);
fclose
(
pFile
);
return
DRWAV_FALSE
;
return
result
;
}
}
return
drwav_init__internal
(
pWav
,
onChunk
,
pChunkUserData
,
flags
);
result
=
drwav_init__internal
(
pWav
,
onChunk
,
pChunkUserData
,
flags
);
if
(
result
!=
DRWAV_TRUE
)
{
fclose
(
pFile
);
return
result
;
}
return
DRWAV_TRUE
;
}
}
DRWAV_API
drwav_bool32
drwav_init_file_ex
(
drwav
*
pWav
,
const
char
*
filename
,
drwav_chunk_proc
onChunk
,
void
*
pChunkUserData
,
drwav_uint32
flags
,
const
drwav_allocation_callbacks
*
pAllocationCallbacks
)
DRWAV_API
drwav_bool32
drwav_init_file_ex
(
drwav
*
pWav
,
const
char
*
filename
,
drwav_chunk_proc
onChunk
,
void
*
pChunkUserData
,
drwav_uint32
flags
,
const
drwav_allocation_callbacks
*
pAllocationCallbacks
)
...
@@ -2973,12 +2982,21 @@ DRWAV_API drwav_bool32 drwav_init_file_ex_w(drwav* pWav, const wchar_t* filename
...
@@ -2973,12 +2982,21 @@ DRWAV_API drwav_bool32 drwav_init_file_ex_w(drwav* pWav, const wchar_t* filename
static
drwav_bool32
drwav_init_file_write__internal_FILE
(
drwav
*
pWav
,
FILE
*
pFile
,
const
drwav_data_format
*
pFormat
,
drwav_uint64
totalSampleCount
,
drwav_bool32
isSequential
,
const
drwav_allocation_callbacks
*
pAllocationCallbacks
)
static
drwav_bool32
drwav_init_file_write__internal_FILE
(
drwav
*
pWav
,
FILE
*
pFile
,
const
drwav_data_format
*
pFormat
,
drwav_uint64
totalSampleCount
,
drwav_bool32
isSequential
,
const
drwav_allocation_callbacks
*
pAllocationCallbacks
)
{
{
if
(
!
drwav_preinit_write
(
pWav
,
pFormat
,
isSequential
,
drwav__on_write_stdio
,
drwav__on_seek_stdio
,
(
void
*
)
pFile
,
pAllocationCallbacks
))
{
drwav_bool32
result
;
result
=
drwav_preinit_write
(
pWav
,
pFormat
,
isSequential
,
drwav__on_write_stdio
,
drwav__on_seek_stdio
,
(
void
*
)
pFile
,
pAllocationCallbacks
);
if
(
result
!=
DRWAV_TRUE
)
{
fclose
(
pFile
);
fclose
(
pFile
);
return
DRWAV_FALSE
;
return
result
;
}
}
return
drwav_init_write__internal
(
pWav
,
pFormat
,
totalSampleCount
);
result
=
drwav_init_write__internal
(
pWav
,
pFormat
,
totalSampleCount
);
if
(
result
!=
DRWAV_TRUE
)
{
fclose
(
pFile
);
return
result
;
}
return
DRWAV_TRUE
;
}
}
static
drwav_bool32
drwav_init_file_write__internal
(
drwav
*
pWav
,
const
char
*
filename
,
const
drwav_data_format
*
pFormat
,
drwav_uint64
totalSampleCount
,
drwav_bool32
isSequential
,
const
drwav_allocation_callbacks
*
pAllocationCallbacks
)
static
drwav_bool32
drwav_init_file_write__internal
(
drwav
*
pWav
,
const
char
*
filename
,
const
drwav_data_format
*
pFormat
,
drwav_uint64
totalSampleCount
,
drwav_bool32
isSequential
,
const
drwav_allocation_callbacks
*
pAllocationCallbacks
)
...
@@ -5734,6 +5752,9 @@ two different ways to initialize a drwav object.
...
@@ -5734,6 +5752,9 @@ two different ways to initialize a drwav object.
/*
/*
REVISION HISTORY
REVISION HISTORY
================
================
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.
v0.12.1 - 2020-04-13
v0.12.1 - 2020-04-13
- Fix some pedantic warnings.
- Fix some pedantic warnings.
...
...
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