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
3a347e04
Commit
3a347e04
authored
Aug 29, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug where a sound is never marked as not playing.
parent
ecb139a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
research/ma_engine.c
research/ma_engine.c
+1
-1
research/ma_engine.h
research/ma_engine.h
+16
-6
No files found.
research/ma_engine.c
View file @
3a347e04
...
...
@@ -98,7 +98,7 @@ int main(int argc, char** argv)
ma_sound_start
(
&
sound
);
//ma_sleep(1000);
ma_sound_set_looping
(
&
sound2
,
MA_TRUE
);
//
ma_sound_set_looping(&sound2, MA_TRUE);
ma_sound_set_volume
(
&
sound2
,
0
.
5
f
);
ma_sound_start
(
&
sound2
);
...
...
research/ma_engine.h
View file @
3a347e04
...
...
@@ -999,6 +999,7 @@ MA_API ma_result ma_sound_set_fade_point_in_milliseconds(ma_sound* pSound, ma_ui
MA_API
ma_result
ma_sound_set_fade_point_auto_reset
(
ma_sound
*
pSound
,
ma_uint32
fadePointIndex
,
ma_bool32
autoReset
);
MA_API
ma_result
ma_sound_set_start_delay
(
ma_sound
*
pSound
,
ma_uint64
delayInMilliseconds
);
MA_API
ma_result
ma_sound_set_stop_delay
(
ma_sound
*
pSound
,
ma_uint64
delayInMilliseconds
);
MA_API
ma_bool32
ma_sound_is_playing
(
const
ma_sound
*
pSound
);
MA_API
ma_bool32
ma_sound_at_end
(
const
ma_sound
*
pSound
);
MA_API
ma_result
ma_sound_get_time_in_frames
(
const
ma_sound
*
pSound
,
ma_uint64
*
pTimeInFrames
);
MA_API
ma_result
ma_sound_seek_to_pcm_frame
(
ma_sound
*
pSound
,
ma_uint64
frameIndex
);
/* Just a wrapper around ma_data_source_seek_to_pcm_frame(). */
...
...
@@ -5355,6 +5356,12 @@ static void ma_engine_mix_sound(ma_engine* pEngine, ma_sound_group* pGroup, ma_s
the mixer to optimize the volume = 0 case, and let the effect do it's own internal optimizations in non-audible cases.
*/
result
=
ma_mixer_mix_data_source
(
&
pGroup
->
mixer
,
pSound
->
pDataSource
,
offsetInFrames
,
(
frameCount
-
offsetInFrames
),
&
framesProcessed
,
pSound
->
volume
,
&
pSound
->
effect
,
pSound
->
isLooping
);
/* If we reached the end of the sound we'll want to mark it as at the end and stop it. This should never be returned for looping sounds. */
if
(
result
==
MA_AT_END
)
{
ma_sound_stop_internal
(
pSound
);
c89atomic_exchange_32
(
&
pSound
->
atEnd
,
MA_TRUE
);
/* This will be set to false in ma_sound_start(). */
}
/*
For the benefit of the main effect we need to ensure the local time is updated explicitly. This is required for allowing time-based effects to
...
...
@@ -5365,12 +5372,6 @@ static void ma_engine_mix_sound(ma_engine* pEngine, ma_sound_group* pGroup, ma_s
ma_engine_effect_set_time
(
&
pSound
->
effect
,
currentTimeInFrames
);
}
/* If we reached the end of the sound we'll want to mark it as at the end and stop it. This should never be returned for looping sounds. */
if
(
result
==
MA_AT_END
)
{
ma_sound_stop_internal
(
pSound
);
c89atomic_exchange_32
(
&
pSound
->
atEnd
,
MA_TRUE
);
/* This will be set to false in ma_sound_start(). */
}
pSound
->
runningTimeInEngineFrames
+=
offsetInFrames
+
framesProcessed
;
}
else
{
/* The sound hasn't started yet. Just keep advancing time forward, but leave the data source alone. */
...
...
@@ -6339,6 +6340,15 @@ MA_API ma_result ma_sound_set_stop_delay(ma_sound* pSound, ma_uint64 delayInMill
return
MA_SUCCESS
;
}
MA_API
ma_bool32
ma_sound_is_playing
(
const
ma_sound
*
pSound
)
{
if
(
pSound
==
NULL
)
{
return
MA_FALSE
;
}
return
pSound
->
isPlaying
;
}
MA_API
ma_bool32
ma_sound_at_end
(
const
ma_sound
*
pSound
)
{
if
(
pSound
==
NULL
)
{
...
...
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