chenlh
2025-08-29 faba6b022b86f066d95b1cfdf752573724d5fbcd
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
60
61
62
63
64
/*
 * ctrl.h
 *
 *  Created on: 2025Äê7ÔÂ23ÈÕ
 *      Author: 86189
 */
 
#ifndef PARAM_CTRL_H_
#define PARAM_CTRL_H_
 
#include <map>
#include "IModule.h"
 
//Ô¤Éè²ÎÊý½âÎöÓÃ
typedef u32 (*ParamCtrl_fn)(IModule* m, void* handle, int &plen);
//²ÎÊý¿ØÖÆÓÃ
typedef u32 (*Ctrl_fn)(IModule* m, u32 pID, s16* val_c);
 
class ParamEntry {
private:
    //u16 module_type;
    ParamCtrl_fn param;
    Ctrl_fn ctrl;
 
public:
    ParamCtrl_fn GetParamEntry(){
        return param;
    }
 
    Ctrl_fn GetCtrlEntry(){
        return ctrl;
    }
    ParamEntry() : param(nullptr), ctrl(nullptr) {}
    ParamEntry(ParamCtrl_fn fparam, Ctrl_fn fctrl){
        //module_type = type;
        param = fparam;
        ctrl = fctrl;
    }
};
 
class param_ctrl_t{
protected:
    std::map<u32, ParamEntry> mctrl_list;
public:
    ParamCtrl_fn GetParamEntry(u32 mtype)
    {
        if(mctrl_list.count(mtype))
            return mctrl_list[mtype].GetParamEntry();
        else
            return NULL;
    }
 
    Ctrl_fn GetCtrlEntry(u32 mtype)
    {
        if(mctrl_list.count(mtype))
            return mctrl_list[mtype].GetCtrlEntry();
        else
            return NULL;
    }
};
 
 
 
#endif /* PARAM_CTRL_H_ */