summaryrefslogtreecommitdiff
path: root/libs/JSystem/src/JAudio2/JAISoundParams.cpp
blob: 5d2ac2095a27b1dcba8230906dc3f2e59673a396 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "JSystem/JSystem.h" // IWYU pragma: keep

#include "JSystem/JAudio2/JAISoundParams.h"

void JAISoundParamsMove::moveVolume(f32 newValue, u32 maxSteps) {
    JUT_ASSERT(12, (newValue>=0.f));
    if (maxSteps == 0) {
        params_.mVolume = newValue;
        transition_.volume_.remainingSteps_ = 0;
    } else {
        transition_.volume_.set(newValue, params_.mVolume, maxSteps);
    }
}

void JAISoundParamsMove::movePitch(f32 newValue, u32 maxSteps) {
    JUT_ASSERT(27, (newValue>=0.f));
    if (maxSteps == 0) {
        params_.mPitch = newValue;
        transition_.pitch_.remainingSteps_ = 0;
    } else {
        transition_.pitch_.set(newValue, params_.mPitch, maxSteps);
    }
}

void JAISoundParamsMove::moveFxMix(f32 newValue, u32 maxSteps) {
    if (maxSteps == 0) {
        params_.mFxMix = newValue;
        transition_.fxMix_.remainingSteps_ = 0;
    } else {
        transition_.fxMix_.set(newValue, params_.mFxMix, maxSteps);
    }
}

void JAISoundParamsMove::movePan(f32 newValue, u32 maxSteps) {
    if (maxSteps == 0) {
        params_.mPan = newValue;
        transition_.pan_.remainingSteps_ = 0;
    } else {
        transition_.pan_.set(newValue, params_.mPan, maxSteps);
    }
}

void JAISoundParamsMove::moveDolby(f32 newValue, u32 maxSteps) {
    if (maxSteps == 0) {
        params_.mDolby = newValue;
        transition_.dolby_.remainingSteps_ = 0;
    } else {
        transition_.dolby_.set(newValue, params_.mDolby, maxSteps);
    }
}