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
b3d0858e
Commit
b3d0858e
authored
Jun 13, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug where data buffers never return MA_AT_END.
parent
7a9ce3d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
21 deletions
+31
-21
research/miniaudio_engine.h
research/miniaudio_engine.h
+31
-21
No files found.
research/miniaudio_engine.h
View file @
b3d0858e
...
@@ -7421,7 +7421,7 @@ MA_API ma_result ma_resource_manager_data_buffer_uninit(ma_resource_manager_data
...
@@ -7421,7 +7421,7 @@ MA_API ma_result ma_resource_manager_data_buffer_uninit(ma_resource_manager_data
MA_API
ma_result
ma_resource_manager_data_buffer_read_pcm_frames
(
ma_resource_manager_data_buffer
*
pDataBuffer
,
void
*
pFramesOut
,
ma_uint64
frameCount
,
ma_uint64
*
pFramesRead
)
MA_API
ma_result
ma_resource_manager_data_buffer_read_pcm_frames
(
ma_resource_manager_data_buffer
*
pDataBuffer
,
void
*
pFramesOut
,
ma_uint64
frameCount
,
ma_uint64
*
pFramesRead
)
{
{
ma_result
result
;
ma_result
result
=
MA_SUCCESS
;
ma_uint64
framesRead
;
ma_uint64
framesRead
;
ma_bool32
isLooping
;
ma_bool32
isLooping
;
ma_bool32
isDecodedBufferBusy
=
MA_FALSE
;
ma_bool32
isDecodedBufferBusy
=
MA_FALSE
;
...
@@ -7461,35 +7461,41 @@ MA_API ma_result ma_resource_manager_data_buffer_read_pcm_frames(ma_resource_man
...
@@ -7461,35 +7461,41 @@ MA_API ma_result ma_resource_manager_data_buffer_read_pcm_frames(ma_resource_man
/* Don't try reading more than the available frame count. */
/* Don't try reading more than the available frame count. */
if
(
frameCount
>
availableFrames
)
{
if
(
frameCount
>
availableFrames
)
{
frameCount
=
availableFrames
;
frameCount
=
availableFrames
;
isDecodedBufferBusy
=
MA_TRUE
;
isDecodedBufferBusy
=
(
ma_resource_manager_data_buffer_node_result
(
pDataBuffer
->
pNode
)
==
MA_BUSY
);
if
(
!
isDecodedBufferBusy
&&
availableFrames
==
0
)
{
result
=
MA_AT_END
;
}
}
}
}
}
}
}
result
=
ma_resource_manager_data_buffer_get_looping
(
pDataBuffer
,
&
isLooping
);
if
(
result
==
MA_SUCCESS
)
{
if
(
result
!=
MA_SUCCESS
)
{
result
=
ma_resource_manager_data_buffer_get_looping
(
pDataBuffer
,
&
isLooping
);
return
result
;
if
(
result
!=
MA_SUCCESS
)
{
}
return
result
;
}
result
=
ma_data_source_read_pcm_frames
(
ma_resource_manager_data_buffer_get_connector
(
pDataBuffer
),
pFramesOut
,
frameCount
,
&
framesRead
,
isLooping
);
result
=
ma_data_source_read_pcm_frames
(
ma_resource_manager_data_buffer_get_connector
(
pDataBuffer
),
pFramesOut
,
frameCount
,
&
framesRead
,
isLooping
);
pDataBuffer
->
cursorInPCMFrames
+=
framesRead
;
pDataBuffer
->
cursorInPCMFrames
+=
framesRead
;
/*
/*
If we returned MA_AT_END, but the node is still loading, we don't want to return that code or else the caller will interpret the sound
If we returned MA_AT_END, but the node is still loading, we don't want to return that code or else the caller will interpret the sound
as at the end and terminate decoding.
as at the end and terminate decoding.
*/
*/
if
(
result
==
MA_AT_END
)
{
if
(
result
==
MA_AT_END
)
{
if
(
ma_resource_manager_data_buffer_node_result
(
pDataBuffer
->
pNode
)
==
MA_BUSY
)
{
if
(
ma_resource_manager_data_buffer_node_result
(
pDataBuffer
->
pNode
)
==
MA_BUSY
)
{
result
=
MA_BUSY
;
result
=
MA_BUSY
;
}
}
}
}
if
(
isDecodedBufferBusy
)
{
if
(
isDecodedBufferBusy
)
{
result
=
MA_BUSY
;
result
=
MA_BUSY
;
}
}
if
(
pFramesRead
!=
NULL
)
{
if
(
pFramesRead
!=
NULL
)
{
*
pFramesRead
=
framesRead
;
*
pFramesRead
=
framesRead
;
}
}
}
return
result
;
return
result
;
...
@@ -10261,6 +10267,8 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
...
@@ -10261,6 +10267,8 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
}
}
#endif
#endif
//Com_Printf("listenerpos = %f %f %f\n", pListener->position.x, pListener->position.y, pListener->position.z);
/*
/*
Multiply the lookat matrix by the spatializer position to transform it to listener
Multiply the lookat matrix by the spatializer position to transform it to listener
space. This allows calculations to work based on the sound being relative to the
space. This allows calculations to work based on the sound being relative to the
...
@@ -10281,6 +10289,8 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
...
@@ -10281,6 +10289,8 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer,
}
}
#endif
#endif
//Com_Printf("relativePos = %f %f %f\n", relativePos.x, relativePos.y, relativePos.z);
/*
/*
The direction of the sound needs to also be transformed so that it's relative to the
The direction of the sound needs to also be transformed so that it's relative to the
rotation of the listener.
rotation of the listener.
...
...
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