audio_hw_device Struct Reference

audio_hw_device Struct Reference

#include < audio.h >

Data Fields

struct hw_device_t   common
 
uint32_t(*  get_supported_devices )(const struct audio_hw_device *dev)
 
int(*  init_check )(const struct audio_hw_device *dev)
 
int(*  set_voice_volume )(struct audio_hw_device *dev, float volume)
 
int(*  set_master_volume )(struct audio_hw_device *dev, float volume)
 
int(*  get_master_volume )(struct audio_hw_device *dev, float *volume)
 
int(*  set_mode )(struct audio_hw_device *dev, audio_mode_t mode)
 
int(*  set_mic_mute )(struct audio_hw_device *dev, bool state)
 
int(*  get_mic_mute )(const struct audio_hw_device *dev, bool *state)
 
int(*  set_parameters )(struct audio_hw_device *dev, const char *kv_pairs)
 
char *(*  get_parameters )(const struct audio_hw_device *dev, const char *keys)
 
size_t(*  get_input_buffer_size )(const struct audio_hw_device *dev, const struct audio_config *config)
 
int(*  open_output_stream )(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, struct audio_config *config, struct audio_stream_out **stream_out, const char *address)
 
void(*  close_output_stream )(struct audio_hw_device *dev, struct audio_stream_out *stream_out)
 
int(*  open_input_stream )(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, struct audio_config *config, struct audio_stream_in **stream_in, audio_input_flags_t flags, const char *address, audio_source_t source)
 
void(*  close_input_stream )(struct audio_hw_device *dev, struct audio_stream_in *stream_in)
 
int(*  dump )(const struct audio_hw_device *dev, int fd)
 
int(*  set_master_mute )(struct audio_hw_device *dev, bool mute)
 
int(*  get_master_mute )(struct audio_hw_device *dev, bool *mute)
 
int(*  create_audio_patch )(struct audio_hw_device *dev, unsigned int num_sources, const struct audio_port_config *sources, unsigned int num_sinks, const struct audio_port_config *sinks, audio_patch_handle_t *handle)
 
int(*  release_audio_patch )(struct audio_hw_device *dev, audio_patch_handle_t handle)
 
int(*  get_audio_port )(struct audio_hw_device *dev, struct audio_port *port)
 
int(*  set_audio_port_config )(struct audio_hw_device *dev, const struct audio_port_config *config)
 

Detailed Description

Definition at line 516 of file audio.h .

Field Documentation

void(* close_input_stream)(struct audio_hw_device *dev, struct audio_stream_in *stream_in)

Definition at line 620 of file audio.h .

void(* close_output_stream)(struct audio_hw_device *dev, struct audio_stream_out *stream_out)

Definition at line 607 of file audio.h .

struct hw_device_t common

Common methods of the audio device. This must be the first member of audio_hw_device as users of this structure will cast a hw_device_t to audio_hw_device pointer in contexts where it's known the hw_device_t references an audio_hw_device .

Definition at line 522 of file audio.h .

int(* create_audio_patch)(struct audio_hw_device *dev, unsigned int num_sources, const struct audio_port_config *sources, unsigned int num_sinks, const struct audio_port_config *sinks, audio_patch_handle_t *handle)

Routing control

Definition at line 648 of file audio.h .

int(* dump)(const struct audio_hw_device *dev, int fd)

This method dumps the state of the audio hardware

Definition at line 624 of file audio.h .

int(* get_audio_port)(struct audio_hw_device *dev, struct audio_port *port)

Definition at line 665 of file audio.h .

size_t(* get_input_buffer_size)(const struct audio_hw_device *dev, const struct audio_config *config)

Definition at line 588 of file audio.h .

int(* get_master_mute)(struct audio_hw_device *dev, bool *mute)

Get the current master mute status for the HAL, if the HAL supports master mute control. AudioFlinger will query this value from the primary audio HAL when the service starts and use the value for setting the initial master mute across all HALs. HALs which do not support this method may leave it set to NULL.

Definition at line 639 of file audio.h .

int(* get_master_volume)(struct audio_hw_device *dev, float *volume)

Get the current master volume value for the HAL, if the HAL supports master volume control. AudioFlinger will query this value from the primary audio HAL when the service starts and use the value for setting the initial master volume across all HALs. HALs which do not support this method may leave it set to NULL.

Definition at line 561 of file audio.h .

int(* get_mic_mute)(const struct audio_hw_device *dev, bool *state)

Definition at line 572 of file audio.h .

char*(* get_parameters)(const struct audio_hw_device *dev, const char *keys)

Definition at line 581 of file audio.h .

uint32_t(* get_supported_devices)(const struct audio_hw_device *dev)

used by audio flinger to enumerate what devices are supported by each audio_hw_device implementation.

Return value is a bitmask of 1 or more values of audio_devices_t

NOTE: audio HAL implementations starting with AUDIO_DEVICE_API_VERSION_2_0 do not implement this function. All supported devices should be listed in audio_policy.conf file and the audio policy manager must choose the appropriate audio module based on information in this file.

Definition at line 536 of file audio.h .

int(* init_check)(const struct audio_hw_device *dev)

check to see if the audio hardware interface has been initialized. returns 0 on success, -ENODEV on failure.

Definition at line 542 of file audio.h .

int(* open_input_stream)(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, struct audio_config *config, struct audio_stream_in **stream_in, audio_input_flags_t flags, const char *address, audio_source_t source)

This method creates and opens the audio hardware input stream

Definition at line 611 of file audio.h .

int(* open_output_stream)(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, struct audio_config *config, struct audio_stream_out **stream_out, const char *address)

This method creates and opens the audio hardware output stream. The "address" parameter qualifies the "devices" audio device type if needed. The format format depends on the device type:

  • Bluetooth devices use the MAC address of the device in the form "00:11:22:AA:BB:CC"
  • USB devices use the ALSA card and device numbers in the form "card=X;device=Y"
  • Other devices may use a number or any other string.

Definition at line 599 of file audio.h .

int(* release_audio_patch)(struct audio_hw_device *dev, audio_patch_handle_t handle)

Definition at line 656 of file audio.h .

int(* set_audio_port_config)(struct audio_hw_device *dev, const struct audio_port_config *config)

Definition at line 669 of file audio.h .

int(* set_master_mute)(struct audio_hw_device *dev, bool mute)

set the audio mute status for all audio activities. If any value other than 0 is returned, the software mixer will emulate this capability.

Definition at line 630 of file audio.h .

int(* set_master_volume)(struct audio_hw_device *dev, float volume)

set the audio volume for all audio activities other than voice call. Range between 0.0 and 1.0. If any value other than 0 is returned, the software mixer will emulate this capability.

Definition at line 552 of file audio.h .

int(* set_mic_mute)(struct audio_hw_device *dev, bool state)

Definition at line 571 of file audio.h .

int(* set_mode)(struct audio_hw_device *dev, audio_mode_t mode)

set_mode is called when the audio mode changes. AUDIO_MODE_NORMAL mode is for standard audio playback, AUDIO_MODE_RINGTONE when a ringtone is playing, and AUDIO_MODE_IN_CALL when a call is in progress.

Definition at line 568 of file audio.h .

int(* set_parameters)(struct audio_hw_device *dev, const char *kv_pairs)

Definition at line 575 of file audio.h .

int(* set_voice_volume)(struct audio_hw_device *dev, float volume)

set the audio volume of a voice call. Range is between 0.0 and 1.0

Definition at line 545 of file audio.h .


The documentation for this struct was generated from the following file:
  • hardware/libhardware/include/hardware/ audio.h