Home | History | Annotate | Download | only in media

Lines Matching defs:VolumeShaper

32 #define LOG_TAG "VolumeShaper"
34 // turn on VolumeShaper logging
42 // The native VolumeShaper class mirrors the java VolumeShaper class;
45 // VolumeShaper methods are not safe for multiple thread access.
51 class VolumeShaper {
59 #define MIN_CURVE_TIME 0.f // type S: start of VolumeShaper curve (normalized)
60 #define MAX_CURVE_TIME 1.f // type S: end of VolumeShaper curve (normalized)
86 /* VolumeShaper::Status is equivalent to status_t if negative
99 /* VolumeShaper.Configuration derives from the Interpolator class and adds
103 * See "frameworks/base/media/java/android/media/VolumeShaper.java" for
108 // Must match with VolumeShaper.java in frameworks/base.
114 // Must match with VolumeShaper.java in frameworks/base.
123 // Bring from base class; must match with VolumeShaper.java in frameworks/base.
260 * new VolumeShaper curve, when replacing one VolumeShaper
287 // The parcel layout must match VolumeShaper.java
316 ss << "VolumeShaper::Configuration{mType=" << static_cast<int32_t>(mType);
334 /* VolumeShaper::Operation expresses an operation to perform on the
338 * See "frameworks/base/media/java/android/media/VolumeShaper.java" for
343 // Must match with VolumeShaper.java.
440 ss << "VolumeShaper::Operation{mFlags=" << static_cast<int32_t>(mFlags) ;
453 /* VolumeShaper.State is returned when requesting the last
454 * state of the VolumeShaper.
457 * See "frameworks/base/media/java/android/media/VolumeShaper.java" for
499 ss << "VolumeShaper::State{mVolume=" << mVolume;
541 ss << "VolumeShaper::Translate{mOffset=" << mOffset;
567 /* Native implementation of VolumeShaper. This is NOT mirrored
575 VolumeShaper(
576 const sp<VolumeShaper::Configuration> &configuration,
577 const sp<VolumeShaper::Operation> &operation)
585 && (getFlags() & VolumeShaper::Operation::FLAG_DELAY) == 0) {
591 VolumeShaper::Operation::Flag getFlags() const {
593 ? VolumeShaper::Operation::FLAG_NONE : mOperation->getFlags();
597 * If the VolumeShaper has not been started, compute what the volume
600 sp<VolumeShaper::State> getState() const {
603 VS_LOG("delayed VolumeShaper, using cached offset:%f for volume:%f",
605 return new VolumeShaper::State(volume, mDelayXOffset);
607 return new VolumeShaper::State(mLastVolume, mLastXOffset);
628 if ((getFlags() & VolumeShaper::Operation::FLAG_DELAY) != 0) {
631 VS_LOG("delayed VolumeShaper, using cached offset %f", mDelayXOffset);
636 & VolumeShaper::Configuration::OPTION_FLAG_CLOCK_TIME) != 0;
661 ss << "VolumeShaper{mStartFrame=" << mStartFrame;
674 sp<VolumeShaper::Configuration> mConfiguration;
675 sp<VolumeShaper::Operation> mOperation;
681 S mDelayXOffset; // xOffset to use for first invocation of VolumeShaper.
692 S normalizedTime = (getFlags() & VolumeShaper::Operation::FLAG_REVERSE) != 0 ?
711 if (getFlags() & VolumeShaper::Operation::FLAG_REVERSE) {
732 }; // VolumeShaper
758 , mVolumeShaperIdCounter(VolumeShaper::kSystemVolumeShapersMax)
762 VolumeShaper::Status applyVolumeShaper(
763 const sp<VolumeShaper::Configuration> &configuration,
764 const sp<VolumeShaper::Operation> &operation_in) {
766 sp<VolumeShaper::Operation> operation(new VolumeShaper::Operation(operation_in));
772 return VolumeShaper::Status(BAD_VALUE);
776 return VolumeShaper::Status(BAD_VALUE);
781 return VolumeShaper::Status(BAD_VALUE);
786 case VolumeShaper::Configuration::TYPE_SCALE: {
794 if ((operation->getFlags() & VolumeShaper::Operation::FLAG_JOIN) != 0) {
796 // to match the last-used volume of the replacing VolumeShaper.
813 & VolumeShaper::Operation::FLAG_CREATE_IF_NECESSARY) != 0) {
827 if (id >= VolumeShaper::kSystemVolumeShapersMax
828 && numberOfUserVolumeShapers_l() >= VolumeShaper::kUserVolumeShapersMax) {
830 return VolumeShaper::Status(INVALID_OPERATION);
833 // create new VolumeShaper with default behavior.
834 mVolumeShapers.emplace_back(configuration, new VolumeShaper::Operation());
839 case VolumeShaper::Configuration::TYPE_ID: {
844 return VolumeShaper::Status(INVALID_OPERATION);
846 if ((operation->getFlags() & VolumeShaper::Operation::FLAG_TERMINATE) != 0) {
852 & VolumeShaper::Configuration::OPTION_FLAG_CLOCK_TIME) != 0;
853 if ((it->getFlags() & VolumeShaper::Operation::FLAG_REVERSE) !=
854 (operation->getFlags() & VolumeShaper::Operation::FLAG_REVERSE)) {
856 const int64_t frameCount = clockTime ? VolumeShaper::getNowUs() : mLastFrame;
874 const int64_t frameCount = clockTime ? VolumeShaper::getNowUs() : mLastFrame;
878 (operation->getFlags() & VolumeShaper::Operation::FLAG_REVERSE) != 0 ?
890 return VolumeShaper::Status(id);
893 sp<VolumeShaper::State> getVolumeShaperState(int id) {
956 void forall(const std::function<VolumeShaper::Status (const VolumeShaper &)> &lambda) {
960 VolumeShaper::Status status = lambda(shaper);
975 void setIdIfNecessary(const sp<VolumeShaper::Configuration> &configuration) {
976 if (configuration->getType() == VolumeShaper::Configuration::TYPE_SCALE) {
983 mVolumeShaperIdCounter = VolumeShaper::kSystemVolumeShapersMax;
999 std::list<VolumeShaper>::iterator findId_l(int32_t id) {
1000 std::list<VolumeShaper>::iterator it = mVolumeShapers.begin();
1012 count += (shaper.mConfiguration->getId() >= VolumeShaper::kSystemVolumeShapersMax);
1022 std::list<VolumeShaper> mVolumeShapers; // list provides stable iterators on erase