Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8036e9f1
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8036e9f1
编写于
10月 15, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 15, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5902 语音播报场景和语音识别,焦点抢占、播音、录音xts
Merge pull request !5902 from 黄建飞/master
上级
5d8547e5
008edc23
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
743 addition
and
0 deletion
+743
-0
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
...dard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
+28
-0
multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/AudioRenderer.test.js
...dard/audioRenderer/src/main/js/test/AudioRenderer.test.js
+715
-0
未找到文件。
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
浏览文件 @
8036e9f1
...
...
@@ -1710,6 +1710,34 @@ describe('audioCapturer', function () {
await
recPromise
(
audioCapturerOptions64000
,
done
);
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_1300
*@tc.name : AudioRec-Set11 , SourceType set SOURCE_TYPE_VOICE_RECOGNITION
*@tc.desc : record audio with parameter set 011
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_1300
'
,
2
,
async
function
(
done
)
{
let
audioStreamInfo64000
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_64000
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S32LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
,
};
let
audioCapturerInfo64000
=
{
source
:
audio
.
SourceType
.
SOURCE_TYPE_VOICE_RECOGNITION
,
capturerFlags
:
0
}
let
audioCapturerOptions64000
=
{
streamInfo
:
audioStreamInfo64000
,
capturerInfo
:
audioCapturerInfo64000
,
}
await
getFd
(
"
capture_js-64000-2C-32B.pcm
"
);
await
recPromise
(
audioCapturerOptions64000
,
done
);
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_RECORD_PROMISE_AUDIO_SCENE_DEFAULT_0100
*@tc.name : AudioRec-Set1
...
...
multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/AudioRenderer.test.js
浏览文件 @
8036e9f1
...
...
@@ -7205,6 +7205,721 @@ describe('audioRenderer', function () {
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8800
* @tc.name : StreamUsage - STREAM_USAGE_VOICE_ASSISTANT
* @tc.desc : StreamUsage - STREAM_USAGE_VOICE_ASSISTANT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8800
'
,
2
,
async
function
(
done
)
{
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_1
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_SPEECH
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_ASSISTANT
,
rendererFlags
:
0
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
readPath
=
'
StarWars10s-1C-44100-2SW.wav
'
;
await
getFdRead
(
readPath
,
done
);
let
resultFlag
=
await
playbackPromise
(
AudioRendererOptions
,
filePath
,
audio
.
AudioScene
.
AUDIO_SCENE_VOICE_CHAT
);
await
sleep
(
100
);
console
.
info
(
'
AudioFrameworkRenderLog: resultFlag :
'
+
resultFlag
);
expect
(
resultFlag
).
assertTrue
();
await
closeFileDescriptor
(
readPath
);
}
catch
(
error
)
{
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8800 : error =
"
+
error
);
expect
(
false
).
assertTrue
();
}
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0100
* @tc.name : STREAM_VOICE_CALL INTERRUPT STREAM_VOICE_ASSISTANT
* @tc.desc : STREAM_VOICE_CALL INTERRUPT STREAM_VOICE_ASSISTANT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0100
'
,
2
,
async
function
(
done
)
{
let
interrput_flag
=
false
;
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_1
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
// STREAM_VOICE_ASSISTANT
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_MUSIC
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_ASSISTANT
,
rendererFlags
:
0
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
let
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
});
audioRen
.
on
(
'
interrupt
'
,
async
(
interruptEvent
)
=>
{
console
.
info
(
"
AudioFrameworkRenderLog: InterruptType :
"
+
interruptEvent
.
eventType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptForceType :
"
+
interruptEvent
.
forceType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptHint :
"
+
interruptEvent
.
hintType
);
if
(
interruptEvent
.
hintType
>=
0
)
{
console
.
info
(
"
AudioFrameworkRenderLog: on'interrupt' SUCCESS
"
);
interrput_flag
=
true
;
}
});
let
a
=
await
audioRen
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
1000
);
// STREAM_VOICE_CALL
let
AudioRendererInfo_interrupt
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_SPEECH
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_COMMUNICATION
,
rendererFlags
:
0
}
let
AudioRendererOptions_interrupt
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo_interrupt
}
let
audioRen_interrupt
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions_interrupt
).
then
(
async
function
(
data
)
{
audioRen_interrupt
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : ERROR :
'
+
err
.
message
);
});
let
b
=
await
audioRen_interrupt
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen_interrupt setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen_interrupt
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
2000
);
expect
(
interrput_flag
).
assertTrue
();
}
catch
(
error
)
{
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0100 : error =
"
+
error
);
expect
(
false
).
assertTrue
();
}
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0200
* @tc.name : STREAM_RING INTERRUPT STREAM_VOICE_ASSISTANT
* @tc.desc : STREAM_RING INTERRUPT STREAM_VOICE_ASSISTANT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0200
'
,
2
,
async
function
(
done
)
{
let
interrput_flag
=
false
;
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_1
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
// STREAM_VOICE_ASSISTANT
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_MUSIC
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_ASSISTANT
,
rendererFlags
:
0
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
let
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
});
audioRen
.
on
(
'
interrupt
'
,
async
(
interruptEvent
)
=>
{
console
.
info
(
"
AudioFrameworkRenderLog: InterruptType :
"
+
interruptEvent
.
eventType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptForceType :
"
+
interruptEvent
.
forceType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptHint :
"
+
interruptEvent
.
hintType
);
if
(
interruptEvent
.
hintType
>=
0
)
{
console
.
info
(
"
AudioFrameworkRenderLog: on'interrupt' SUCCESS
"
);
interrput_flag
=
true
;
}
});
let
a
=
await
audioRen
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
1000
);
// STREAM_RING
let
AudioRendererInfo_interrupt
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_RINGTONE
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_NOTIFICATION_RINGTONE
,
rendererFlags
:
0
}
let
AudioRendererOptions_interrupt
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo_interrupt
}
let
audioRen_interrupt
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions_interrupt
).
then
(
async
function
(
data
)
{
audioRen_interrupt
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : ERROR :
'
+
err
.
message
);
});
let
b
=
await
audioRen_interrupt
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen_interrupt setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen_interrupt
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
2000
);
expect
(
interrput_flag
).
assertTrue
();
}
catch
(
error
)
{
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0200 : error =
"
+
error
);
expect
(
false
).
assertTrue
();
}
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0300
* @tc.name : STREAM_MUSIC INTERRUPT STREAM_VOICE_ASSISTANT
* @tc.desc : STREAM_MUSIC INTERRUPT STREAM_VOICE_ASSISTANT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0300
'
,
2
,
async
function
(
done
)
{
let
interrput_flag
=
false
;
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_1
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
// STREAM_VOICE_ASSISTANT
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_MUSIC
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_ASSISTANT
,
rendererFlags
:
0
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
let
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
});
audioRen
.
on
(
'
interrupt
'
,
async
(
interruptEvent
)
=>
{
console
.
info
(
"
AudioFrameworkRenderLog: InterruptType :
"
+
interruptEvent
.
eventType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptForceType :
"
+
interruptEvent
.
forceType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptHint :
"
+
interruptEvent
.
hintType
);
if
(
interruptEvent
.
hintType
>=
0
)
{
console
.
info
(
"
AudioFrameworkRenderLog: on'interrupt' SUCCESS
"
);
interrput_flag
=
true
;
}
});
let
a
=
await
audioRen
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
1000
);
// STREAM_MUSIC
let
AudioRendererInfo_interrupt
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_MUSIC
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_MEDIA
,
rendererFlags
:
0
}
let
AudioRendererOptions_interrupt
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo_interrupt
}
let
audioRen_interrupt
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions_interrupt
).
then
(
async
function
(
data
)
{
audioRen_interrupt
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : ERROR :
'
+
err
.
message
);
});
let
b
=
await
audioRen_interrupt
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen_interrupt setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen_interrupt
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
2000
);
expect
(
interrput_flag
).
assertTrue
();
}
catch
(
error
)
{
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0300 : error =
"
+
error
);
expect
(
false
).
assertTrue
();
}
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0400
* @tc.name : STREAM_VOICE_ASSISTANT INTERRUPT STREAM_VOICE_ASSISTANT
* @tc.desc : STREAM_VOICE_ASSISTANT INTERRUPT STREAM_VOICE_ASSISTANT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0400
'
,
2
,
async
function
(
done
)
{
let
interrput_flag
=
false
;
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_1
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
// STREAM_VOICE_ASSISTANT
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_MUSIC
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_ASSISTANT
,
rendererFlags
:
0
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
let
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
});
audioRen
.
on
(
'
interrupt
'
,
async
(
interruptEvent
)
=>
{
console
.
info
(
"
AudioFrameworkRenderLog: InterruptType :
"
+
interruptEvent
.
eventType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptForceType :
"
+
interruptEvent
.
forceType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptHint :
"
+
interruptEvent
.
hintType
);
if
(
interruptEvent
.
hintType
>=
0
)
{
console
.
info
(
"
AudioFrameworkRenderLog: on'interrupt' SUCCESS
"
);
interrput_flag
=
true
;
}
});
let
a
=
await
audioRen
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
1000
);
// STREAM_VOICE_ASSISTANT
let
AudioRendererInfo_interrupt
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_MUSIC
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_ASSISTANT
,
rendererFlags
:
0
}
let
AudioRendererOptions_interrupt
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo_interrupt
}
let
audioRen_interrupt
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions_interrupt
).
then
(
async
function
(
data
)
{
audioRen_interrupt
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : ERROR :
'
+
err
.
message
);
});
let
b
=
await
audioRen_interrupt
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen_interrupt setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen_interrupt
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
2000
);
expect
(
interrput_flag
).
assertTrue
();
}
catch
(
error
)
{
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0400 : error =
"
+
error
);
expect
(
false
).
assertTrue
();
}
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0500
* @tc.name : STREAM_VOICE_ASSISTANT INTERRUPT STREAM_VOICE_CALL
* @tc.desc : STREAM_VOICE_ASSISTANT INTERRUPT STREAM_VOICE_CALL
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0500
'
,
2
,
async
function
(
done
)
{
let
interrput_flag
=
false
;
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_1
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
// STREAM_VOICE_CALL
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_SPEECH
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_COMMUNICATION
,
rendererFlags
:
0
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
let
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
});
audioRen
.
on
(
'
interrupt
'
,
async
(
interruptEvent
)
=>
{
console
.
info
(
"
AudioFrameworkRenderLog: InterruptType :
"
+
interruptEvent
.
eventType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptForceType :
"
+
interruptEvent
.
forceType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptHint :
"
+
interruptEvent
.
hintType
);
if
(
interruptEvent
.
hintType
>=
0
)
{
console
.
info
(
"
AudioFrameworkRenderLog: on'interrupt' SUCCESS
"
);
interrput_flag
=
true
;
}
});
let
a
=
await
audioRen
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
1000
);
// STREAM_VOICE_ASSISTANT
let
AudioRendererInfo_interrupt
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_MUSIC
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_ASSISTANT
,
rendererFlags
:
0
}
let
AudioRendererOptions_interrupt
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo_interrupt
}
let
audioRen_interrupt
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions_interrupt
).
then
(
async
function
(
data
)
{
audioRen_interrupt
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : ERROR :
'
+
err
.
message
);
});
let
b
=
await
audioRen_interrupt
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen_interrupt setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen_interrupt
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
2000
);
expect
(
interrput_flag
).
assertFalse
();
}
catch
(
error
)
{
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0500 : error =
"
+
error
);
expect
(
false
).
assertTrue
();
}
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0600
* @tc.name : STREAM_VOICE_ASSISTANT INTERRUPT STREAM_RING
* @tc.desc : STREAM_VOICE_ASSISTANT INTERRUPT STREAM_RING
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0600
'
,
2
,
async
function
(
done
)
{
let
interrput_flag
=
false
;
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_1
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
// STREAM_RING
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_RINGTONE
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_NOTIFICATION_RINGTONE
,
rendererFlags
:
0
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
let
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
});
audioRen
.
on
(
'
interrupt
'
,
async
(
interruptEvent
)
=>
{
console
.
info
(
"
AudioFrameworkRenderLog: InterruptType :
"
+
interruptEvent
.
eventType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptForceType :
"
+
interruptEvent
.
forceType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptHint :
"
+
interruptEvent
.
hintType
);
if
(
interruptEvent
.
hintType
>=
0
)
{
console
.
info
(
"
AudioFrameworkRenderLog: on'interrupt' SUCCESS
"
);
interrput_flag
=
true
;
}
});
let
a
=
await
audioRen
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
1000
);
// STREAM_VOICE_ASSISTANT
let
AudioRendererInfo_interrupt
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_MUSIC
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_ASSISTANT
,
rendererFlags
:
0
}
let
AudioRendererOptions_interrupt
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo_interrupt
}
let
audioRen_interrupt
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions_interrupt
).
then
(
async
function
(
data
)
{
audioRen_interrupt
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : ERROR :
'
+
err
.
message
);
});
let
b
=
await
audioRen_interrupt
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen_interrupt setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen_interrupt
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
2000
);
expect
(
interrput_flag
).
assertFalse
();
}
catch
(
error
)
{
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0600 : error =
"
+
error
);
expect
(
false
).
assertTrue
();
}
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0700
* @tc.name : STREAM_VOICE_ASSISTANT INTERRUPT STREAM_MUSIC
* @tc.desc : STREAM_VOICE_ASSISTANT INTERRUPT STREAM_MUSIC
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0700
'
,
2
,
async
function
(
done
)
{
let
interrput_flag
=
false
;
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_1
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S16LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
// STREAM_MUSIC
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_MUSIC
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_MEDIA
,
rendererFlags
:
0
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
let
audioRen
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
(
async
function
(
data
)
{
audioRen
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender Created : ERROR :
'
+
err
.
message
);
});
audioRen
.
on
(
'
interrupt
'
,
async
(
interruptEvent
)
=>
{
console
.
info
(
"
AudioFrameworkRenderLog: InterruptType :
"
+
interruptEvent
.
eventType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptForceType :
"
+
interruptEvent
.
forceType
);
console
.
info
(
"
AudioFrameworkRenderLog: InterruptHint :
"
+
interruptEvent
.
hintType
);
if
(
interruptEvent
.
hintType
>=
0
)
{
console
.
info
(
"
AudioFrameworkRenderLog: on'interrupt' SUCCESS
"
);
interrput_flag
=
true
;
}
});
let
a
=
await
audioRen
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
1000
);
// STREAM_VOICE_ASSISTANT
let
AudioRendererInfo_interrupt
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_MUSIC
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_VOICE_ASSISTANT
,
rendererFlags
:
0
}
let
AudioRendererOptions_interrupt
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo_interrupt
}
let
audioRen_interrupt
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions_interrupt
).
then
(
async
function
(
data
)
{
audioRen_interrupt
=
data
;
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data state:
'
+
Object
.
keys
(
data
));
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : Success : Stream Type: SUCCESS data value:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: AudioRender2 Created : ERROR :
'
+
err
.
message
);
});
let
b
=
await
audioRen_interrupt
.
setInterruptMode
(
audio
.
InterruptMode
.
INDEPENDENT_MODE
);
console
.
info
(
"
AudioFrameworkRenderLog audioRen_interrupt setInterruptMode(INDEPENDENT_MODE) success
"
);
await
audioRen_interrupt
.
start
().
then
(
async
function
()
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 started :SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog: renderInstant2 start :ERROR :
'
+
err
.
message
);
});
await
sleep
(
2000
);
expect
(
interrput_flag
).
assertTrue
();
}
catch
(
error
)
{
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_INTERUPT_AUDIO_0700 : error =
"
+
error
);
expect
(
false
).
assertTrue
();
}
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0100
* @tc.name : SetInterruptMode mode 0 callback,is public share mode
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录