• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Unionman Technology Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef AUDIO_EXTERNAL_RENDER_H
17 #define AUDIO_EXTERNAL_RENDER_H
18 
19 #include <stdint.h>
20 
21 #if defined(__cplusplus)
22 extern "C" {
23 #endif
24 
25 typedef struct audio_render_s {
26     void *priv_data;
27 
28     int (*init)(struct audio_render_s *r);
29     int (*finalize)(struct audio_render_s *r);
30     int (*config)(struct audio_render_s *r, uint32_t channels, uint32_t bits_per_sample, uint32_t sample_rate);
31     int (*write)(struct audio_render_s *r, uint8_t *data, uint32_t size);
32     int (*start)(struct audio_render_s *r);
33     int (*stop)(struct audio_render_s *r);
34     int (*pause)(struct audio_render_s *r);
35     int (*resume)(struct audio_render_s *r);
36     uint32_t (*get_latency)(struct audio_render_s *r);      /* get latency in unit of ms */
37     int (*set_mute)(struct audio_render_s *r, int mute);    /* 1: enable mute ; 0: disable mute */
38     int (*set_volume)(struct audio_render_s *r, float volume);
39 } audio_render_t;
40 
41 
42 audio_render_t *audio_render_get(void);
43 
44 
45 #if defined(__cplusplus)
46 }  /* extern "C" */
47 #endif
48 
49 #endif
50