blob: d3aa4e852fdbb165b6e598e967991d06d3150bd7 [file] [log] [blame]
Phil Burk2355edb2016-12-26 13:54:02 -08001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/**
18 * Simple fake HAL that supports ALSA MMAP/NOIRQ mode.
19 */
20
21#ifndef FAKE_AUDIO_HAL_H
22#define FAKE_AUDIO_HAL_H
23
Phil Burk5ed503c2017-02-01 09:38:15 -080024//namespace aaudio {
Phil Burk2355edb2016-12-26 13:54:02 -080025
26using sample_t = int16_t;
27struct mmap_buffer_info {
28 int fd;
29 int32_t burst_size_in_frames;
30 int32_t buffer_capacity_in_frames;
31 int32_t buffer_capacity_in_bytes;
32 int32_t sample_rate;
33 int32_t channel_count;
34 sample_t *hw_buffer;
35};
36
37typedef void *fake_hal_stream_ptr;
38
39//extern "C"
40//{
41
Phil Burk3df348f2017-02-08 11:41:55 -080042int fake_hal_open(int card_id, int device_id,
43 int frameCapacity,
44 fake_hal_stream_ptr *stream_pp);
Phil Burk2355edb2016-12-26 13:54:02 -080045
46int fake_hal_get_mmap_info(fake_hal_stream_ptr stream, mmap_buffer_info *info);
47
48int fake_hal_start(fake_hal_stream_ptr stream);
49
50int fake_hal_pause(fake_hal_stream_ptr stream);
51
52int fake_hal_get_frame_counter(fake_hal_stream_ptr stream, int *frame_counter);
53
54int fake_hal_close(fake_hal_stream_ptr stream);
55
56//} /* "C" */
57
Phil Burk5ed503c2017-02-01 09:38:15 -080058//} /* namespace aaudio */
Phil Burk2355edb2016-12-26 13:54:02 -080059
60#endif // FAKE_AUDIO_HAL_H