
海拉尔网站制作公司哪家好,找创新互联建站!从网页设计、网站建设、微信开发、APP开发、响应式网站等网站项目制作,到程序开发,运营维护。创新互联建站成立与2013年到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联建站。
音频采集的主要工作是通过输入设备将声音采集并转码为音频数据,同时对采集任务进行管理。
| 接口名 | 描述 | 
|---|---|
| AudioCapturer(AudioCapturerInfo audioCapturerInfo) throws IllegalArgumentException | 构造函数,设置录音相关音频参数,使用默认录音设备。 | 
| AudioCapturer(AudioCapturerInfo audioCapturerInfo, AudioDeviceDescriptor devInfo) throws IllegalArgumentException | 构造函数,设置录音相关音频参数并指定录音设备。 | 
| static int getMinBufferSize(int sampleRate, int channelCount, int audioFormat) | 获取指定参数条件下所需的最小缓冲区大小。 | 
| boolean addSoundEffect(UUID type, String packageName) | 增加录音的音频音效。 | 
| boolean start() | 开始录音。 | 
| int read(byte[] data, int offset, int size) | 读取音频数据。 | 
| int read(byte[] data, int offset, int size, boolean isBlocking) | 读取音频数据并写入传入的 byte 数组中。 | 
| int read(float[] data, int offsetInFloats, int sizeInFloats) | 阻塞式读取音频数据并写入传入的 float 数组中。 | 
| int read(float[] data, int offsetInFloats, int sizeInFloats, boolean isBlocking) | 读取音频数据并写入传入的 float 数组中。 | 
| int read(short[] data, int offsetInShorts, int sizeInShorts) | 阻塞式读取音频数据并写入传入的 short 数组中。 | 
| int read(short[] data, int offsetInShorts, int sizeInShorts, boolean isBlocking) | 读取音频数据并写入传入的 short 数组中。 | 
| int read(java.nio.ByteBuffer buffer, int sizeInBytes) | 阻塞式读取音频数据并写入传入的 ByteBuffer 对象中。 | 
| int read(java.nio.ByteBuffer buffer, int sizeInBytes, boolean isBlocking) | 读取音频数据并写入传入的 ByteBuffer 对象中。 | 
| boolean stop() | 停止录音。 | 
| boolean release() | 释放录音资源。 | 
| AudioDeviceDescriptor getSelectedDevice() | 获取输入设备信息。 | 
| AudioDeviceDescriptor getCurrentDevice() | 获取当前正在录制音频的设备信息。 | 
| int getCapturerSessionId() | 获取录音的 session ID。 | 
| Set | 获取已经激活的音频音效列表。 | 
| AudioCapturer.State getState() | 获取音频采集状态。 | 
| int getSampleRate() | 获取采样率。 | 
| int getAudioInputSource() | 获取录音的输入设备信息。 | 
| int getBufferFrameCount() | 获取以帧为单位的缓冲区大小。 | 
| int getChannelCount() | 获取音频采集通道数。 | 
| AudioStreamInfo.EncodingFormat getEncodingFormat() | 获取音频采集的音频编码格式。 | 
| boolean getAudioTime(Timestamp timestamp, Timestamp.Timebase timebase) | 获取一个即时的捕获时间戳。 | 
   AudioStreamInfo audioStreamInfo = new AudioStreamInfo.Builder().sampleRate(
       AudioStreamInfo.SAMPLE_RATE_UNSPECIFIED)
       .audioStreamFlag(AudioStreamInfo.AudioStreamFlag.AUDIO_STREAM_FLAG_NONE)
       .encodingFormat(AudioStreamInfo.EncodingFormat.ENCODING_INVALID)
       .channelMask(AudioStreamInfo.ChannelMask.CHANNEL_INVALID)
       .streamUsage(AudioStreamInfo.StreamUsage.STREAM_USAGE_UNKNOWN)
       .build();
   AudioStreamInfo audioStreamInfo = new AudioStreamInfo.Builder().encodingFormat(
       AudioStreamInfo.EncodingFormat.ENCODING_PCM_16BIT) // 16-bit PCM
       .channelMask(AudioStreamInfo.ChannelMask.CHANNEL_IN_STEREO) // 双声道
       .sampleRate(44100) // 44.1kHz
       .build();
   AudioCapturerInfo audioCapturerInfo = new AudioCapturerInfo.Builder().audioStreamInfo(audioStreamInfo)
       .build();
   private AudioManager audioManager = new AudioManager();
    
   public void main() {
       AudioCapturerCallback cb = new AudioCapturerCallback() {
           @Override
           public void onCapturerConfigChanged(List configs) {
               configs.forEach(config -> doSomething(config));
           }
       };
       audioManager.registerAudioCapturerCallback(cb);
   }
    
   private void doSomething(AudioCapturerConfig config) {
       ...
   } 
                本文题目:创新互联鸿蒙OS教程:鸿蒙OS音频采集开发指导
                
                网页路径:http://www.csdahua.cn/qtweb/news1/27051.html
            
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网