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
b287d94f
Commit
b287d94f
authored
Jun 03, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename some functions for consistency.
parent
fe068143
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
11 deletions
+30
-11
research/ma_engine.c
research/ma_engine.c
+21
-2
research/ma_engine.h
research/ma_engine.h
+9
-9
No files found.
research/ma_engine.c
View file @
b287d94f
...
@@ -28,7 +28,7 @@ int main(int argc, char** argv)
...
@@ -28,7 +28,7 @@ int main(int argc, char** argv)
return
-
1
;
return
-
1
;
}
}
result
=
ma_engine_
create_sound
_from_file
(
&
engine
,
argv
[
1
],
NULL
,
&
sound
);
result
=
ma_engine_
sound_init
_from_file
(
&
engine
,
argv
[
1
],
NULL
,
&
sound
);
if
(
result
!=
MA_SUCCESS
)
{
if
(
result
!=
MA_SUCCESS
)
{
ma_engine_uninit
(
&
engine
);
ma_engine_uninit
(
&
engine
);
return
-
1
;
return
-
1
;
...
@@ -40,11 +40,30 @@ int main(int argc, char** argv)
...
@@ -40,11 +40,30 @@ int main(int argc, char** argv)
ma_engine_sound_start
(
&
engine
,
&
sound
);
ma_engine_sound_start
(
&
engine
,
&
sound
);
float
pitch
=
1
;
float
pitchStep
=
0
.
01
f
;
float
pitchMin
=
0
.
125
f
;
float
pitchMax
=
8
;
for
(;;)
{
pitch
+=
pitchStep
;
if
(
pitch
<
pitchMin
)
{
pitch
=
pitchMin
;
pitchStep
=
-
pitchStep
;
}
if
(
pitch
>
pitchMax
)
{
pitch
=
pitchMax
;
pitchStep
=
-
pitchStep
;
}
ma_engine_sound_set_pitch
(
&
engine
,
&
sound
,
pitch
);
Sleep
(
1
);
}
printf
(
"Press Enter to quit..."
);
printf
(
"Press Enter to quit..."
);
getchar
();
getchar
();
ma_engine_
delete_sound
(
&
engine
,
&
sound
);
ma_engine_
sound_uninit
(
&
engine
,
&
sound
);
ma_engine_uninit
(
&
engine
);
ma_engine_uninit
(
&
engine
);
return
0
;
return
0
;
...
...
research/ma_engine.h
View file @
b287d94f
...
@@ -309,10 +309,10 @@ MA_API ma_result ma_engine_set_volume(ma_engine* pEngine, float volume);
...
@@ -309,10 +309,10 @@ MA_API ma_result ma_engine_set_volume(ma_engine* pEngine, float volume);
MA_API
ma_result
ma_engine_set_gain_db
(
ma_engine
*
pEngine
,
float
gainDB
);
MA_API
ma_result
ma_engine_set_gain_db
(
ma_engine
*
pEngine
,
float
gainDB
);
#ifndef MA_NO_RESOURCE_MANAGER
#ifndef MA_NO_RESOURCE_MANAGER
MA_API
ma_result
ma_engine_
create_sound
_from_file
(
ma_engine
*
pEngine
,
const
char
*
pFilePath
,
ma_sound_group
*
pGroup
,
ma_sound
*
pSound
);
MA_API
ma_result
ma_engine_
sound_init
_from_file
(
ma_engine
*
pEngine
,
const
char
*
pFilePath
,
ma_sound_group
*
pGroup
,
ma_sound
*
pSound
);
#endif
#endif
MA_API
ma_result
ma_engine_
create_sound
_from_data_source
(
ma_engine
*
pEngine
,
ma_data_source
*
pDataSource
,
ma_sound_group
*
pGroup
,
ma_sound
*
pSound
);
MA_API
ma_result
ma_engine_
sound_init
_from_data_source
(
ma_engine
*
pEngine
,
ma_data_source
*
pDataSource
,
ma_sound_group
*
pGroup
,
ma_sound
*
pSound
);
MA_API
void
ma_engine_
delete_sound
(
ma_engine
*
pEngine
,
ma_sound
*
pSound
);
MA_API
void
ma_engine_
sound_uninit
(
ma_engine
*
pEngine
,
ma_sound
*
pSound
);
MA_API
ma_result
ma_engine_sound_start
(
ma_engine
*
pEngine
,
ma_sound
*
pSound
);
MA_API
ma_result
ma_engine_sound_start
(
ma_engine
*
pEngine
,
ma_sound
*
pSound
);
MA_API
ma_result
ma_engine_sound_stop
(
ma_engine
*
pEngine
,
ma_sound
*
pSound
);
MA_API
ma_result
ma_engine_sound_stop
(
ma_engine
*
pEngine
,
ma_sound
*
pSound
);
MA_API
ma_result
ma_engine_sound_set_volume
(
ma_engine
*
pEngine
,
ma_sound
*
pSound
,
float
volume
);
MA_API
ma_result
ma_engine_sound_set_volume
(
ma_engine
*
pEngine
,
ma_sound
*
pSound
,
float
volume
);
...
@@ -1089,7 +1089,7 @@ MA_API ma_result ma_engine_set_gain_db(ma_engine* pEngine, float gainDB)
...
@@ -1089,7 +1089,7 @@ MA_API ma_result ma_engine_set_gain_db(ma_engine* pEngine, float gainDB)
#ifndef MA_NO_RESOURCE_MANAGER
#ifndef MA_NO_RESOURCE_MANAGER
MA_API
ma_result
ma_engine_
create_sound
_from_file
(
ma_engine
*
pEngine
,
const
char
*
pFilePath
,
ma_sound_group
*
pGroup
,
ma_sound
*
pSound
)
MA_API
ma_result
ma_engine_
sound_init
_from_file
(
ma_engine
*
pEngine
,
const
char
*
pFilePath
,
ma_sound_group
*
pGroup
,
ma_sound
*
pSound
)
{
{
ma_result
result
;
ma_result
result
;
ma_data_source
*
pDataSource
;
ma_data_source
*
pDataSource
;
...
@@ -1111,7 +1111,7 @@ MA_API ma_result ma_engine_create_sound_from_file(ma_engine* pEngine, const char
...
@@ -1111,7 +1111,7 @@ MA_API ma_result ma_engine_create_sound_from_file(ma_engine* pEngine, const char
}
}
/* Now that we have our data source we can create the sound using our generic function. */
/* Now that we have our data source we can create the sound using our generic function. */
result
=
ma_engine_
create_sound
_from_data_source
(
pEngine
,
pDataSource
,
pGroup
,
pSound
);
result
=
ma_engine_
sound_init
_from_data_source
(
pEngine
,
pDataSource
,
pGroup
,
pSound
);
if
(
result
!=
MA_SUCCESS
)
{
if
(
result
!=
MA_SUCCESS
)
{
return
result
;
return
result
;
}
}
...
@@ -1526,7 +1526,7 @@ static ma_result ma_engine_effect_reinit(ma_engine* pEngine, ma_engine_effect* p
...
@@ -1526,7 +1526,7 @@ static ma_result ma_engine_effect_reinit(ma_engine* pEngine, ma_engine_effect* p
return
ma_engine_effect_init
(
pEngine
,
pEffect
);
return
ma_engine_effect_init
(
pEngine
,
pEffect
);
}
}
MA_API
ma_result
ma_engine_
create_sound
_from_data_source
(
ma_engine
*
pEngine
,
ma_data_source
*
pDataSource
,
ma_sound_group
*
pGroup
,
ma_sound
*
pSound
)
MA_API
ma_result
ma_engine_
sound_init
_from_data_source
(
ma_engine
*
pEngine
,
ma_data_source
*
pDataSource
,
ma_sound_group
*
pGroup
,
ma_sound
*
pSound
)
{
{
ma_result
result
;
ma_result
result
;
...
@@ -1561,7 +1561,7 @@ MA_API ma_result ma_engine_create_sound_from_data_source(ma_engine* pEngine, ma_
...
@@ -1561,7 +1561,7 @@ MA_API ma_result ma_engine_create_sound_from_data_source(ma_engine* pEngine, ma_
return
MA_SUCCESS
;
return
MA_SUCCESS
;
}
}
MA_API
void
ma_engine_
delete_sound
(
ma_engine
*
pEngine
,
ma_sound
*
pSound
)
MA_API
void
ma_engine_
sound_uninit
(
ma_engine
*
pEngine
,
ma_sound
*
pSound
)
{
{
ma_result
result
;
ma_result
result
;
...
@@ -1798,7 +1798,7 @@ MA_API ma_result ma_engine_play_sound(ma_engine* pEngine, const char* pFilePath,
...
@@ -1798,7 +1798,7 @@ MA_API ma_result ma_engine_play_sound(ma_engine* pEngine, const char* pFilePath,
result
=
ma_engine_effect_reinit
(
pEngine
,
&
pSound
->
effect
);
result
=
ma_engine_effect_reinit
(
pEngine
,
&
pSound
->
effect
);
if
(
result
!=
MA_SUCCESS
)
{
if
(
result
!=
MA_SUCCESS
)
{
/* We failed to reinitialize the effect. The sound is currently in a bad state and we need to delete it and return an error. Should never happen. */
/* We failed to reinitialize the effect. The sound is currently in a bad state and we need to delete it and return an error. Should never happen. */
ma_engine_
delete_sound
(
pEngine
,
pSound
);
ma_engine_
sound_uninit
(
pEngine
,
pSound
);
return
result
;
return
result
;
}
}
...
@@ -1811,7 +1811,7 @@ MA_API ma_result ma_engine_play_sound(ma_engine* pEngine, const char* pFilePath,
...
@@ -1811,7 +1811,7 @@ MA_API ma_result ma_engine_play_sound(ma_engine* pEngine, const char* pFilePath,
return
MA_OUT_OF_MEMORY
;
return
MA_OUT_OF_MEMORY
;
}
}
result
=
ma_engine_
create_sound
_from_file
(
pEngine
,
pFilePath
,
pGroup
,
pSound
);
result
=
ma_engine_
sound_init
_from_file
(
pEngine
,
pFilePath
,
pGroup
,
pSound
);
if
(
result
!=
MA_SUCCESS
)
{
if
(
result
!=
MA_SUCCESS
)
{
ma__free_from_callbacks
(
pEngine
,
&
pEngine
->
allocationCallbacks
);
ma__free_from_callbacks
(
pEngine
,
&
pEngine
->
allocationCallbacks
);
return
result
;
return
result
;
...
...
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