Example #1
0
static SLresult IRecord_SetDurationLimit(SLRecordItf self, SLmillisecond msec)
{
    SL_ENTER_INTERFACE

    IRecord *this = (IRecord *) self;
    interface_lock_exclusive(this);
    if (this->mDurationLimit != msec) {
        this->mDurationLimit = msec;
        interface_unlock_exclusive_attributes(this, ATTR_TRANSPORT);
    } else {
        interface_unlock_exclusive(this);
    }
    result = SL_RESULT_SUCCESS;

    SL_LEAVE_INTERFACE
}
Example #2
0
static SLresult IVolume_SetVolumeLevel(SLVolumeItf self, SLmillibel level_)
{
    SL_ENTER_INTERFACE

    int level = level_;
    if (!((SL_MILLIBEL_MIN <= level) && (level <= PLATFORM_MILLIBEL_MAX_VOLUME))) {
        result = SL_RESULT_PARAMETER_INVALID;
    } else {
        IVolume *thiz = (IVolume *) self;
        interface_lock_exclusive(thiz);
        SLmillibel oldLevel = thiz->mLevel;
        if (oldLevel != level) {
            thiz->mLevel = level;
            interface_unlock_exclusive_attributes(thiz, ATTR_GAIN);
        } else {
            interface_unlock_exclusive(thiz);
        }
        result = SL_RESULT_SUCCESS;
    }

    SL_LEAVE_INTERFACE
}