2 * Copyright (c) 2013 Canonical Ltd
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include <android/hardware/audio.h>
25 #include <android/hardware/hardware.h>
27 int main(int argc
, char **argv
)
29 struct hw_module_t
*hwmod
= 0;
30 struct audio_hw_device
*audiohw
;
32 hw_get_module_by_class(AUDIO_HARDWARE_MODULE_ID
,
33 AUDIO_HARDWARE_MODULE_ID_PRIMARY
,
34 (const hw_module_t
**) &hwmod
);
35 assert(hwmod
!= NULL
);
37 assert(audio_hw_device_open(hwmod
, &audiohw
) == 0);
38 assert(audiohw
->init_check(audiohw
) == 0);
39 printf("Audio Hardware Interface initialized.\n");
41 if (audiohw
->get_master_volume
) {
43 audiohw
->get_master_volume(audiohw
, &volume
);
44 printf("Master Volume: %f\n", volume
);
47 if (audiohw
->get_master_mute
) {
49 audiohw
->get_master_mute(audiohw
, &mute
);
50 printf("Master Mute: %d\n", mute
);
53 audio_hw_device_close(audiohw
);
58 // vim:ts=4:sw=4:noexpandtab