summaryrefslogtreecommitdiff
path: root/libs/JSystem/src/JAudio2/JAISoundHandles.cpp
blob: a0e2a761589ce1d7d57a3d9180b7ddea3d52a314 (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
#include "JSystem/JSystem.h" // IWYU pragma: keep

#include "JSystem/JAudio2/JAISoundHandles.h"

JAISoundHandle* JAISoundHandles::getHandleSoundID(JAISoundID id) {
    for (int i = 0; i < numHandles_; i++) {
        if (handle_[i].isSoundAttached()) {
            if (handle_[i]->getID() == id) {
                return &handle_[i];
            }
        }
    }

    return NULL;
}

JAISoundHandle* JAISoundHandles::getFreeHandle() {
    for (int i = 0; i < numHandles_; i++) {
        if (!handle_[i].isSoundAttached()) {
            return &handle_[i];
        }
    }

    return NULL;
}