summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/hardware_legacy/AudioHardwareInterface.h5
-rw-r--r--include/hardware_legacy/AudioPolicyInterface.h27
-rw-r--r--include/hardware_legacy/AudioPolicyManagerBase.h20
3 files changed, 32 insertions, 20 deletions
diff --git a/include/hardware_legacy/AudioHardwareInterface.h b/include/hardware_legacy/AudioHardwareInterface.h
index 847fe6b..c781218 100644
--- a/include/hardware_legacy/AudioHardwareInterface.h
+++ b/include/hardware_legacy/AudioHardwareInterface.h
@@ -56,7 +56,7 @@ public:
virtual size_t bufferSize() const = 0;
/**
- * returns the output channel nask
+ * returns the output channel mask
*/
virtual uint32_t channels() const = 0;
@@ -166,7 +166,7 @@ public:
virtual String8 getParameters(const String8& keys) = 0;
- // Return the amount of input frames lost in the audio driver since the last call of this function.
+ // Return the number of input frames lost in the audio driver since the last call of this function.
// Audio driver is expected to reset the value to 0 and restart counting upon returning the current value by this function call.
// Such loss typically occurs when the user space process is blocked longer than the capacity of audio driver buffers.
// Unit: the number of input audio frames
@@ -236,6 +236,7 @@ public:
uint32_t *sampleRate=0,
status_t *status=0) = 0;
virtual void closeOutputStream(AudioStreamOut* out) = 0;
+
/** This method creates and opens the audio hardware input stream */
virtual AudioStreamIn* openInputStream(
uint32_t devices,
diff --git a/include/hardware_legacy/AudioPolicyInterface.h b/include/hardware_legacy/AudioPolicyInterface.h
index 1ee0e20..9743489 100644
--- a/include/hardware_legacy/AudioPolicyInterface.h
+++ b/include/hardware_legacy/AudioPolicyInterface.h
@@ -69,16 +69,14 @@ public:
virtual status_t setDeviceConnectionState(AudioSystem::audio_devices device,
AudioSystem::device_connection_state state,
const char *device_address) = 0;
- // retreive a device connection status
+ // retrieve a device connection status
virtual AudioSystem::device_connection_state getDeviceConnectionState(AudioSystem::audio_devices device,
const char *device_address) = 0;
// indicate a change in phone state. Valid phones states are defined by AudioSystem::audio_mode
virtual void setPhoneState(int state) = 0;
- // indicate a change in ringer mode
- virtual void setRingerMode(uint32_t mode, uint32_t mask) = 0;
// force using a specific device category for the specified usage
virtual void setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config) = 0;
- // retreive current device category forced for a given usage
+ // retrieve current device category forced for a given usage
virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage) = 0;
// set a system property (e.g. camera sound always audible)
virtual void setSystemProperty(const char* property, const char* value) = 0;
@@ -89,7 +87,7 @@ public:
// Audio routing query functions
//
- // request an output appriate for playback of the supplied stream type and parameters
+ // request an output appropriate for playback of the supplied stream type and parameters
virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream,
uint32_t samplingRate = 0,
uint32_t format = AudioSystem::FORMAT_DEFAULT,
@@ -106,7 +104,7 @@ public:
// releases the output.
virtual void releaseOutput(audio_io_handle_t output) = 0;
- // request an input appriate for record from the supplied device with supplied parameters.
+ // request an input appropriate for record from the supplied device with supplied parameters.
virtual audio_io_handle_t getInput(int inputSource,
uint32_t samplingRate = 0,
uint32_t Format = AudioSystem::FORMAT_DEFAULT,
@@ -128,10 +126,19 @@ public:
int indexMin,
int indexMax) = 0;
- // sets the new stream volume at a level corresponding to the supplied index
- virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index) = 0;
- // retreive current volume index for the specified stream
- virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index) = 0;
+ // sets the new stream volume at a level corresponding to the supplied index for the
+ // supplied device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means
+ // setting volume for all devices
+ virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream,
+ int index,
+ audio_devices_t device) = 0;
+
+ // retrieve current volume index for the specified stream and the
+ // specified device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means
+ // querying the volume of the active device.
+ virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream,
+ int *index,
+ audio_devices_t device) = 0;
// return the strategy corresponding to a given stream type
virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream) = 0;
diff --git a/include/hardware_legacy/AudioPolicyManagerBase.h b/include/hardware_legacy/AudioPolicyManagerBase.h
index 3ab748d..2a37200 100644
--- a/include/hardware_legacy/AudioPolicyManagerBase.h
+++ b/include/hardware_legacy/AudioPolicyManagerBase.h
@@ -70,7 +70,6 @@ public:
virtual AudioSystem::device_connection_state getDeviceConnectionState(AudioSystem::audio_devices device,
const char *device_address);
virtual void setPhoneState(int state);
- virtual void setRingerMode(uint32_t mode, uint32_t mask);
virtual void setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config);
virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage);
virtual void setSystemProperty(const char* property, const char* value);
@@ -101,8 +100,12 @@ public:
virtual void initStreamVolume(AudioSystem::stream_type stream,
int indexMin,
int indexMax);
- virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index);
- virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index);
+ virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream,
+ int index,
+ audio_devices_t device);
+ virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream,
+ int *index,
+ audio_devices_t device);
// return the strategy corresponding to a given stream type
virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream);
@@ -219,14 +222,14 @@ protected:
class StreamDescriptor
{
public:
- StreamDescriptor()
- : mIndexMin(0), mIndexMax(1), mIndexCur(1), mCanBeMuted(true) {}
+ StreamDescriptor();
- void dump(char* buffer, size_t size);
+ int getVolumeIndex(audio_devices_t device);
+ void dump(int fd);
int mIndexMin; // min volume index
int mIndexMax; // max volume index
- int mIndexCur; // current volume index
+ KeyedVector<audio_devices_t, int> mIndexCur; // current volume index per device
bool mCanBeMuted; // true is the stream can be muted
const VolumeCurvePoint *mVolumeCurve[DEVICE_CATEGORY_CNT];
@@ -340,6 +343,8 @@ protected:
// returns the category the device belongs to with regard to volume curve management
static device_category getDeviceCategory(uint32_t device);
+ // extract one device relevant for volume control from multiple device selection
+ static audio_devices_t getDeviceForVolume(audio_devices_t device);
AudioPolicyClientInterface *mpClientInterface; // audio policy client interface
audio_io_handle_t mHardwareOutput; // hardware output handler
@@ -351,7 +356,6 @@ protected:
uint32_t mAvailableOutputDevices; // bit field of all available output devices
uint32_t mAvailableInputDevices; // bit field of all available input devices
int mPhoneState; // current phone state
- uint32_t mRingerMode; // current ringer mode
AudioSystem::forced_config mForceUse[AudioSystem::NUM_FORCE_USE]; // current forced use configuration
StreamDescriptor mStreams[AudioSystem::NUM_STREAM_TYPES]; // stream descriptors for volume control