summaryrefslogtreecommitdiff
path: root/src/JSystem/JStudio/JStudio_JAudio/control.cpp
blob: 7793bc559daf9ffcb8fac434b084eb44e80e6be5 (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
51
52
53
54
55
56
57
58
59
//
// Generated by dtk
// Translation Unit: control.cpp
//

#include "JSystem/JSystem.h" // IWYU pragma: keep

#include "JSystem/JStudio/JStudio_JAudio/control.h"

namespace JStudio_JAudio {

namespace {

// Fake inline.
// TODO: supposed to use JStudio::TObject::createFromAdaptor instead of this somehow
inline JStudio::TObject_sound* sound_creator(const JStudio::stb::data::TParse_TBlock_object& data, JStudio_JAudio::TAdaptor_sound* adaptor)
{
    JStudio::TObject_sound* object = new JStudio::TObject_sound(data, adaptor);

    if (!object) {
        return NULL;
    }
    if (object->mpAdaptor) {
        object->mpAdaptor->adaptor_do_prepare(object);
    }
    return object;
}

/* 80278B98-80278C4C       .text createObject_SOUND_JAI___Q214JStudio_JAudio21@unnamed@control_cpp@FRCQ47JStudio3stb4data20TParse_TBlock_objectP8JAIBasic */
JStudio::TObject* createObject_SOUND_JAI_(const JStudio::stb::data::TParse_TBlock_object& parseBlock, JAIBasic* sound) {
    TAdaptor_sound* adaptor = new TAdaptor_sound(sound);
    if (!adaptor) {
        return NULL;
    }

    return sound_creator(parseBlock, adaptor);
}

} // namespace

/* 80278C4C-80278CAC       .text __dt__Q214JStudio_JAudio13TCreateObjectFv */
TCreateObject::~TCreateObject() {}

/* 80278CAC-80278D20       .text create__Q214JStudio_JAudio13TCreateObjectFPPQ27JStudio7TObjectRCQ47JStudio3stb4data20TParse_TBlock_object */
bool TCreateObject::create(JStudio::TObject** object, const JStudio::stb::data::TParse_TBlock_object& data) {
    JStudioAudioCreateFunc createFunc;
    switch (data.get()->type) {
    case 'JSND':
        createFunc = createObject_SOUND_JAI_;
        break;
    default:
        return false;
    }

    *object = createFunc(data, mSound);
    return true;
}

} // namespace JStudio_JAudio