help needed: Cannot set stream type: audio player already realized

190 Aufrufe
Direkt zur ersten ungelesenen Nachricht

余曦文

ungelesen,
25.02.2015, 23:15:5525.02.15
an andro...@googlegroups.com
opensl es work with earspeaker , make this mistake,please help me

result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_ANDROIDCONFIGURATION, &configItf);
assert(SL_RESULT_SUCCESS == result);
(void) result;
SLint32 streamType = SL_ANDROID_STREAM_VOICE;
result = (*configItf)->SetConfiguration(configItf, SL_ANDROID_KEY_STREAM_TYPE, &streamType, sizeof(SLint32));
assert(SL_RESULT_SUCCESS == result);
(void) result;

Glenn Kasten

ungelesen,
26.02.2015, 15:24:0226.02.15
an andro...@googlegroups.com
I don't have the full context.  Can you give the other APIs you called before this?
And which API returned status "already realized"?

余曦文

ungelesen,
01.03.2015, 19:14:0901.03.15
an andro...@googlegroups.com
thank you first, I mean I want to change speaker to earpiece in opensl,so I need to  SetConfiguration,like this:
       result = (*configItf)->SetConfiguration(configItf, SL_ANDROID_KEY_STREAM_TYPE, &streamType, sizeof(SLint32));
assert(SL_RESULT_SUCCESS == result);
(void) result;
but it must set before   this:
// realize the player
result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE );
assert(SL_RESULT_SUCCESS == result);
(void) result;
so when i  change earpiece to speaker again, it  tells me "already realized"   
do you understand?

Glenn Kasten於 2015年2月27日星期五 UTC+8上午4時24分02秒寫道:

Glenn Kasten

ungelesen,
01.03.2015, 22:26:2801.03.15
an andro...@googlegroups.com
SL_ANDROID_KEY_STREAM_TYPE is a configuration (creation) parameter,
not a runtime parameter. If you want to change SL_ANDROID_KEY_STREAM_TYPE after creation,
you will need to destroy the player and re-create it.

余曦文

ungelesen,
02.03.2015, 01:15:1302.03.15
an andro...@googlegroups.com
yes,i did it as you said,and it worked ok, but i feel the code is too long, i look up the user guide,it says this configuration is the same as android API,so i decide change speaker to earpiece by android's API, anyway thank you Glenn.

Glenn Kasten於 2015年3月2日星期一 UTC+8上午11時26分28秒寫道:
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten