audio policy: move device_category type outside volume class
This patch prepares the removal of hard coded volume tables by
moving outside volume class the device_category enumeration.
Change-Id: Ic712377898276a39bb782ac0bc7f793cdd7fa8bd
Signed-off-by: François Gaffie <francois.gaffie@intel.com>
diff --git a/services/audiopolicy/common/include/Volume.h b/services/audiopolicy/common/include/Volume.h
index 712f7a7..d091179 100755
--- a/services/audiopolicy/common/include/Volume.h
+++ b/services/audiopolicy/common/include/Volume.h
@@ -30,6 +30,17 @@
float mDBAttenuation;
};
+/**
+ * device categories used for volume curve management.
+ */
+enum device_category {
+ DEVICE_CATEGORY_HEADSET,
+ DEVICE_CATEGORY_SPEAKER,
+ DEVICE_CATEGORY_EARPIECE,
+ DEVICE_CATEGORY_EXT_MEDIA,
+ DEVICE_CATEGORY_CNT
+};
+
class Volume
{
public:
@@ -50,17 +61,6 @@
};
/**
- * device categories used for volume curve management.
- */
- enum device_category {
- DEVICE_CATEGORY_HEADSET,
- DEVICE_CATEGORY_SPEAKER,
- DEVICE_CATEGORY_EARPIECE,
- DEVICE_CATEGORY_EXT_MEDIA,
- DEVICE_CATEGORY_CNT
- };
-
- /**
* extract one device relevant for volume control from multiple device selection
*
* @param[in] device for which the volume category is associated
diff --git a/services/audiopolicy/common/managerdefinitions/include/StreamDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/StreamDescriptor.h
index 84db5ab..fbc942c 100644
--- a/services/audiopolicy/common/managerdefinitions/include/StreamDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/StreamDescriptor.h
@@ -41,14 +41,14 @@
void dump(int fd) const;
- void setVolumeCurvePoint(Volume::device_category deviceCategory, const VolumeCurvePoint *point);
- const VolumeCurvePoint *getVolumeCurvePoint(Volume::device_category deviceCategory) const
+ void setVolumeCurvePoint(device_category deviceCategory, const VolumeCurvePoint *point);
+ const VolumeCurvePoint *getVolumeCurvePoint(device_category deviceCategory) const
{
return mVolumeCurve[deviceCategory];
}
private:
- const VolumeCurvePoint *mVolumeCurve[Volume::DEVICE_CATEGORY_CNT];
+ const VolumeCurvePoint *mVolumeCurve[DEVICE_CATEGORY_CNT];
KeyedVector<audio_devices_t, int> mIndexCur; /**< current volume index per device. */
int mIndexMin; /**< min volume index. */
int mIndexMax; /**< max volume index. */
@@ -71,11 +71,11 @@
status_t dump(int fd) const;
void setVolumeCurvePoint(audio_stream_type_t stream,
- Volume::device_category deviceCategory,
+ device_category deviceCategory,
const VolumeCurvePoint *point);
const VolumeCurvePoint *getVolumeCurvePoint(audio_stream_type_t stream,
- Volume::device_category deviceCategory) const;
+ device_category deviceCategory) const;
void setVolumeIndexMin(audio_stream_type_t stream,int volIndexMin);
void setVolumeIndexMax(audio_stream_type_t stream,int volIndexMax);
diff --git a/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp
index 4ca27c2..12c7930 100644
--- a/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/StreamDescriptor.cpp
@@ -71,7 +71,7 @@
mIndexMax = volIndexMax;
}
-void StreamDescriptor::setVolumeCurvePoint(Volume::device_category deviceCategory,
+void StreamDescriptor::setVolumeCurvePoint(device_category deviceCategory,
const VolumeCurvePoint *point)
{
mVolumeCurve[deviceCategory] = point;
@@ -121,14 +121,14 @@
}
void StreamDescriptorCollection::setVolumeCurvePoint(audio_stream_type_t stream,
- Volume::device_category deviceCategory,
+ device_category deviceCategory,
const VolumeCurvePoint *point)
{
editValueAt(stream).setVolumeCurvePoint(deviceCategory, point);
}
const VolumeCurvePoint *StreamDescriptorCollection::getVolumeCurvePoint(audio_stream_type_t stream,
- Volume::device_category deviceCategory) const
+ device_category deviceCategory) const
{
return valueAt(stream).getVolumeCurvePoint(deviceCategory);
}