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
b7b1cd6b
Commit
b7b1cd6b
authored
Oct 25, 2016
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OpenSL|ES: Use ANDROIDSIMPLEBUFFERQUEUE instead of BUFFERQUEUE.
parent
1b20f532
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
17 deletions
+25
-17
mini_al.h
mini_al.h
+25
-17
No files found.
mini_al.h
View file @
b7b1cd6b
...
@@ -3029,7 +3029,7 @@ static mal_result mal_device_init__slse(mal_device* pDevice, mal_device_type typ
...
@@ -3029,7 +3029,7 @@ static mal_result mal_device_init__slse(mal_device* pDevice, mal_device_type typ
pDevice
->
bufferSizeInFrames
=
pDevice
->
sles
.
periodSizeInFrames
*
periods
;
pDevice
->
bufferSizeInFrames
=
pDevice
->
sles
.
periodSizeInFrames
*
periods
;
SLDataLocator_BufferQueue
queue
;
SLDataLocator_BufferQueue
queue
;
queue
.
locatorType
=
SL_DATALOCATOR_BUFFERQUEUE
;
queue
.
locatorType
=
SL_DATALOCATOR_
ANDROIDSIMPLE
BUFFERQUEUE
;
queue
.
numBuffers
=
periods
;
queue
.
numBuffers
=
periods
;
SLDataFormat_PCM
pcm
;
SLDataFormat_PCM
pcm
;
...
@@ -3075,7 +3075,7 @@ static mal_result mal_device_init__slse(mal_device* pDevice, mal_device_type typ
...
@@ -3075,7 +3075,7 @@ static mal_result mal_device_init__slse(mal_device* pDevice, mal_device_type typ
sink
.
pLocator
=
&
outmixLocator
;
sink
.
pLocator
=
&
outmixLocator
;
sink
.
pFormat
=
NULL
;
sink
.
pFormat
=
NULL
;
const
SLInterfaceID
itfIDs1
[]
=
{
SL_IID_BUFFERQUEUE
};
const
SLInterfaceID
itfIDs1
[]
=
{
SL_IID_
ANDROIDSIMPLE
BUFFERQUEUE
};
const
SLboolean
itfIDsRequired1
[]
=
{
SL_BOOLEAN_TRUE
};
const
SLboolean
itfIDsRequired1
[]
=
{
SL_BOOLEAN_TRUE
};
if
((
*
g_malEngineSL
)
->
CreateAudioPlayer
(
g_malEngineSL
,
(
SLObjectItf
*
)
&
pDevice
->
sles
.
pAudioPlayerObj
,
&
source
,
&
sink
,
1
,
itfIDs1
,
itfIDsRequired1
)
!=
SL_RESULT_SUCCESS
)
{
if
((
*
g_malEngineSL
)
->
CreateAudioPlayer
(
g_malEngineSL
,
(
SLObjectItf
*
)
&
pDevice
->
sles
.
pAudioPlayerObj
,
&
source
,
&
sink
,
1
,
itfIDs1
,
itfIDsRequired1
)
!=
SL_RESULT_SUCCESS
)
{
mal_device_uninit__slse
(
pDevice
);
mal_device_uninit__slse
(
pDevice
);
...
@@ -3142,6 +3142,7 @@ static mal_result mal_device__start_backend__slse(mal_device* pDevice)
...
@@ -3142,6 +3142,7 @@ static mal_result mal_device__start_backend__slse(mal_device* pDevice)
{
{
mal_assert
(
pDevice
!=
NULL
);
mal_assert
(
pDevice
!=
NULL
);
if
(
pDevice
->
type
==
mal_device_type_playback
)
{
SLresult
resultSL
=
MAL_SLES_PLAY
(
pDevice
->
sles
.
pAudioPlayer
)
->
SetPlayState
((
SLPlayItf
)
pDevice
->
sles
.
pAudioPlayer
,
SL_PLAYSTATE_PLAYING
);
SLresult
resultSL
=
MAL_SLES_PLAY
(
pDevice
->
sles
.
pAudioPlayer
)
->
SetPlayState
((
SLPlayItf
)
pDevice
->
sles
.
pAudioPlayer
,
SL_PLAYSTATE_PLAYING
);
if
(
resultSL
!=
SL_RESULT_SUCCESS
)
{
if
(
resultSL
!=
SL_RESULT_SUCCESS
)
{
return
MAL_FAILED_TO_START_BACKEND_DEVICE
;
return
MAL_FAILED_TO_START_BACKEND_DEVICE
;
...
@@ -3152,12 +3153,15 @@ static mal_result mal_device__start_backend__slse(mal_device* pDevice)
...
@@ -3152,12 +3153,15 @@ static mal_result mal_device__start_backend__slse(mal_device* pDevice)
size_t
periodSizeInBytes
=
pDevice
->
sles
.
periodSizeInFrames
*
pDevice
->
channels
*
mal_get_sample_size_in_bytes
(
pDevice
->
format
);
size_t
periodSizeInBytes
=
pDevice
->
sles
.
periodSizeInFrames
*
pDevice
->
channels
*
mal_get_sample_size_in_bytes
(
pDevice
->
format
);
for
(
mal_uint32
iPeriod
=
0
;
iPeriod
<
pDevice
->
periods
;
++
iPeriod
)
{
for
(
mal_uint32
iPeriod
=
0
;
iPeriod
<
pDevice
->
periods
;
++
iPeriod
)
{
resultSL
=
MAL_SLES_BUFFERQUEUE
(
pDevice
->
sles
.
pBufferQueue
)
->
Enqueue
((
SLAndroidSimpleBufferQueueItf
)
pDevice
->
sles
.
pBufferQueue
,
pDevice
->
sles
.
pBuffer
+
(
periodSizeInBytes
*
iPeriod
),
periodSizeInBytes
);
resultSL
=
MAL_SLES_BUFFERQUEUE
(
pDevice
->
sles
.
pBufferQueue
)
->
Enqueue
((
SLAndroidSimpleBufferQueueItf
)
pDevice
->
sles
.
pBufferQueue
,
pDevice
->
sles
.
pBuffer
+
(
periodSizeInBytes
*
iPeriod
),
periodSizeInBytes
);
if
(
resultSL
!=
SL_RESULT_SUCCESS
)
{
if
(
resultSL
!=
SL_RESULT_SUCCESS
)
{
SLresult
resultSL
=
MAL_SLES_PLAY
(
pDevice
->
sles
.
pAudioPlayer
)
->
SetPlayState
((
SLPlayItf
)
pDevice
->
sles
.
pAudioPlayer
,
SL_PLAYSTATE_STOPPED
);
SLresult
resultSL
=
MAL_SLES_PLAY
(
pDevice
->
sles
.
pAudioPlayer
)
->
SetPlayState
((
SLPlayItf
)
pDevice
->
sles
.
pAudioPlayer
,
SL_PLAYSTATE_STOPPED
);
return
MAL_FAILED_TO_START_BACKEND_DEVICE
;
return
MAL_FAILED_TO_START_BACKEND_DEVICE
;
}
}
}
}
}
else
{
// TODO: Implement me.
}
return
MAL_SUCCESS
;
return
MAL_SUCCESS
;
}
}
...
@@ -3166,10 +3170,14 @@ static mal_result mal_device__stop_backend__slse(mal_device* pDevice)
...
@@ -3166,10 +3170,14 @@ static mal_result mal_device__stop_backend__slse(mal_device* pDevice)
{
{
mal_assert
(
pDevice
!=
NULL
);
mal_assert
(
pDevice
!=
NULL
);
if
(
pDevice
->
type
==
mal_device_type_playback
)
{
SLresult
resultSL
=
MAL_SLES_PLAY
(
pDevice
->
sles
.
pAudioPlayer
)
->
SetPlayState
((
SLPlayItf
)
pDevice
->
sles
.
pAudioPlayer
,
SL_PLAYSTATE_STOPPED
);
SLresult
resultSL
=
MAL_SLES_PLAY
(
pDevice
->
sles
.
pAudioPlayer
)
->
SetPlayState
((
SLPlayItf
)
pDevice
->
sles
.
pAudioPlayer
,
SL_PLAYSTATE_STOPPED
);
if
(
resultSL
!=
SL_RESULT_SUCCESS
)
{
if
(
resultSL
!=
SL_RESULT_SUCCESS
)
{
return
MAL_FAILED_TO_STOP_BACKEND_DEVICE
;
return
MAL_FAILED_TO_STOP_BACKEND_DEVICE
;
}
}
}
else
{
// TODO: Implement me.
}
// Make sure any queued buffers are cleared.
// Make sure any queued buffers are cleared.
MAL_SLES_BUFFERQUEUE
(
pDevice
->
sles
.
pBufferQueue
)
->
Clear
((
SLAndroidSimpleBufferQueueItf
)
pDevice
->
sles
.
pBufferQueue
);
MAL_SLES_BUFFERQUEUE
(
pDevice
->
sles
.
pBufferQueue
)
->
Clear
((
SLAndroidSimpleBufferQueueItf
)
pDevice
->
sles
.
pBufferQueue
);
...
...
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