Nu:Tekt NTS-1 digital SDK  v1.1-0
usermodfx.h
Go to the documentation of this file.
1 /*
2  BSD 3-Clause License
3 
4  Copyright (c) 2018, KORG INC.
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without
8  modification, are permitted provided that the following conditions are met:
9 
10  * Redistributions of source code must retain the above copyright notice, this
11  list of conditions and the following disclaimer.
12 
13  * Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17  * Neither the name of the copyright holder nor the names of its
18  contributors may be used to endorse or promote products derived from
19  this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 //*/
33 
45 #ifndef __usermodfx_h
46 #define __usermodfx_h
47 
48 #include <stdint.h>
49 
50 #include "fx_api.h"
51 #include "userprg.h"
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 
63 #define __sdram __attribute__((section(".sdram")))
64 
68  typedef enum {
73  k_num_user_modfx_param_id
75 
77  typedef void (*UserModFXFuncEntry)(uint32_t platform, uint32_t api);
79  typedef void (*UserModFXFuncInit)(uint32_t platform, uint32_t api);
81  typedef void (*UserModFXFuncProcess)(const float *main_xn, float *main_yn,
82  const float *sub_xn, float *sub_yn,
83  uint32_t frames);
85  typedef void (*UserModFXSuspend)(void);
87  typedef void (*UserModFXResume)(void);
89  typedef void (*UserModFXFuncParam)(uint8_t index, int32_t value);
91  typedef void (*UserModFXFuncDummy)(void);
92 
94 #pragma pack(push, 1)
95  typedef struct user_modfx_hook_table {
96  uint8_t magic[4];
97  uint32_t api;
98  uint8_t platform;
99  uint8_t reserved0[7];
100 
101  UserModFXFuncEntry func_entry;
102  UserModFXFuncProcess func_process;
103  UserModFXSuspend func_suspend;
104  UserModFXResume func_resume;
105  UserModFXFuncParam func_param;
106  UserModFXFuncDummy reserved1[7];
107  } user_modfx_hook_table_t;
108 #pragma pack(pop)
109 
111 #pragma pack(push, 1)
112  typedef struct user_modfx_data {
113  user_prg_header_t header;
114  user_modfx_hook_table_t hooks;
115  // code bytes following
116  } user_modfx_data_t;
117 #pragma pack(pop)
118 
124 #define MODFX_INIT __attribute__((used)) _hook_init
125 #define MODFX_PROCESS __attribute__((used)) _hook_process
126 #define MODFX_SUSPEND __attribute__((used)) _hook_suspend
127 #define MODFX_RESUME __attribute__((used)) _hook_resume
128 #define MODFX_PARAM __attribute__((used)) _hook_param
129 
131  void _entry(uint32_t platform, uint32_t api);
132 
139  void _hook_init(uint32_t platform, uint32_t api);
140 
154  void _hook_process(const float *main_xn, float *main_yn,
155  const float *sub_xn, float *sub_yn,
156  uint32_t frames);
157 
163  void _hook_suspend(void);
164 
170  void _hook_resume(void);
171 
180  void _hook_param(uint8_t index, int32_t value);
181 
184 #ifdef __cplusplus
185 } // extern "C"
186 #endif
187 
188 #endif // __usermodfx_h
189 
_hook_init
void _hook_init(uint32_t platform, uint32_t api)
Initialization callback.
fx_api.h
Effects runtime API.
k_user_modfx_param_time
Time parameter.
Definition: usermodfx.h:70
_hook_resume
void _hook_resume(void)
Resume callback.
_hook_param
void _hook_param(uint8_t index, int32_t value)
Parameter change callback.
userprg.h
Common C interface header for custom user programs.
k_user_modfx_param_depth
Depth parameter.
Definition: usermodfx.h:72
_hook_process
void _hook_process(const float *main_xn, float *main_yn, const float *sub_xn, float *sub_yn, uint32_t frames)
Processing callback.
_hook_suspend
void _hook_suspend(void)
Suspend callback.
user_modfx_param_id_t
user_modfx_param_id_t
User facing parameters.
Definition: usermodfx.h:68