未验证 提交 b0624206 编写于 作者: T T_lab 提交者: Gitee

!3 修改全局查询

Merge pull request !3 from whynot/master
......@@ -89,12 +89,33 @@
});
```
## 静态音效管理
## 音频场景全局音效查询
主要包括XXX。
主要包括全局音效查询相应ContentType和StreamUsage对应场景的音效模式。
对于播放音频类的应用,开发者需要关注该应用的音频流使用什么音效模式并做出相应的操作,比如音乐App播放时,应选择音乐场景下的模式。在使用查询接口前,开发者需要使用getStreamManager()创建一个AudioStreamManager实例。
### 获取XXX接口
### 获取全局音效查询接口
管理播放实例音效的接口XXX。
1.创建AudioStreamManager实例。
在使用AudioStreamManager的API前,需要使用getStreamManager()创建一个AudioStreamManager实例。
### 查询当前XXX音效模式
```ts
import audio from '@ohos.multimedia.audio';
let audioManager = audio.getAudioManager();
let audioStreamManager = audioManager.getStreamManager();
```
2.管理播放实例音效的接口getAudioEffectInfoArray()查询音效模式。
### 查询当前ContentType和StreamUsage对应场景的音效模式
```ts
audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC, audio.StreamUsage.STREAM_USAGE_MEDIA, async (err, AudioEffectInfoArray) => {
if (err) {
console.error(`Failed to get effect info array`);
return;
} else {
console.info(`getAudioEffectInfoArray: ${getAudioEffectInfoArray}`);
}
});
```
......@@ -117,7 +117,3 @@
}
```
# 音频场景音效查询
对于播放音频类的应用,开发者需要关注该应用的音频流使用什么音效模式并做出相应的操作,比如音乐App播放时,应选择音乐场景下的模式。参考[使用AudioStreamManager开发音效查询功能](../reference/apis/js-apis-audio.md#getaudioeffectinfoarray10)
......@@ -3400,18 +3400,7 @@ audioStreamManager.getAudioEffectInfoArray(audio.ContentType.CONTENT_TYPE_MUSIC,
console.error(`getAudioEffectInfoArray :ERROR: ${err}`);
return;
} else {
if (AudioEffectInfoArray == null) {
console.error(`getAudioEffectInfoArray is null ptr.`);
return;
}
console.info(`The contentType of ${CONTENT_TYPE_MUSIC} and the streamUsage of ${STREAM_USAGE_MEDIA} 's effect mode are: `);
for (let i = 0; i < AudioEffectInfoArray.length; i++) {
for (const key in audio.AudioEffectMode) {
if (audio.AudioEffectMode[key] === AudioEffectInfoArray[i]) {
console.info(`${key}, `);
}
}
}
console.info(`The contentType of ${CONTENT_TYPE_MUSIC} and the streamUsage of ${STREAM_USAGE_MEDIA} 's effect mode are: ${AudioEffectInfoArray}`);
}
});
```
......@@ -3443,18 +3432,7 @@ getAudioEffectInfoArray(content: ContentType, usage: StreamUsage): Promise&lt;Au
async function getAudioEffectInfoArray(){
await audioStreamManager.getAudioEffectInfoArray().then( function (AudioEffectInfoArray) {
console.info(`getAudioEffectInfoArray ######### Get Promise is called ##########`);
if (AudioEffectInfoArray == null) {
console.error(`getAudioEffectInfoArray is null ptr.`);
return;
}
console.info(`The contentType of ${CONTENT_TYPE_MUSIC} and the streamUsage of ${STREAM_USAGE_MEDIA} 's effect mode are: `);
for (let i = 0; i < AudioEffectInfoArray.length; i++) {
for (const key in audio.AudioEffectMode) {
if (audio.AudioEffectMode[key] === AudioEffectInfoArray[i]) {
console.info(`${key}, `);
}
}
}
console.info(`The contentType of ${CONTENT_TYPE_MUSIC} and the streamUsage of ${STREAM_USAGE_MEDIA} 's effect mode are: ${AudioEffectInfoArray}`);
}).catch((err) => {
console.error(`getAudioEffectInfoArray :ERROR: ${err}`);
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册