Nu:Tekt NTS-1 digital SDK  v1.1-0
userrevfx.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 __userrevfx_h
46 #define __userrevfx_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 
62 #define __sdram __attribute__((section(".sdram")))
63 
67  typedef enum {
72  k_user_revfx_param_reserved0,
75  k_num_user_revfx_param_id
77 
79  typedef void (*UserRevFXFuncEntry)(uint32_t platform, uint32_t api);
81  typedef void (*UserRevFXFuncInit)(uint32_t platform, uint32_t api);
83  typedef void (*UserRevFXFuncProcess)(float *xn, uint32_t frames);
85  typedef void (*UserRevFXSuspend)(void);
87  typedef void (*UserRevFXResume)(void);
89  typedef void (*UserRevFXFuncParam)(uint8_t index, int32_t value);
91  typedef void (*UserRevFXFuncDummy)(void);
92 
94 #pragma pack(push, 1)
95  typedef struct user_revfx_hook_table {
96  uint8_t magic[4];
97  uint32_t api;
98  uint8_t platform;
99  uint8_t reserved0[7];
100 
101  UserRevFXFuncInit func_entry;
102  UserRevFXFuncProcess func_process;
103  UserRevFXSuspend func_suspend;
104  UserRevFXResume func_resume;
105  UserRevFXFuncParam func_param;
106  UserRevFXFuncDummy reserved1[7];
107  } user_revfx_hook_table_t;
108 #pragma pack(pop)
109 
111 #pragma pack(push, 1)
112  typedef struct user_revfx_data {
113  user_prg_header_t header;
114  user_revfx_hook_table_t hooks;
115  // code bytes following
116  } user_revfx_data_t;
117 #pragma pack(pop)
118 
124 #define REVFX_INIT __attribute__((used)) _hook_init
125 #define REVFX_PROCESS __attribute__((used)) _hook_process
126 #define REVFX_SUSPEND __attribute__((used)) _hook_suspend
127 #define REVFX_RESUME __attribute__((used)) _hook_resume
128 #define REVFX_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 
153  void _hook_process(float *xn, uint32_t frames);
154 
160  void _hook_suspend(void);
161 
167  void _hook_resume(void);
168 
177  void _hook_param(uint8_t index, int32_t value);
178 
181 #ifdef __cplusplus
182 } // extern "C"
183 #endif
184 
185 #endif // __userrevfx_h
186 
_hook_param
void _hook_param(uint8_t index, int32_t value)
Parameter change callback.
_hook_resume
void _hook_resume(void)
Resume callback.
fx_api.h
Effects runtime API.
user_revfx_param_id_t
user_revfx_param_id_t
User facing parameters.
Definition: userrevfx.h:67
_hook_init
void _hook_init(uint32_t platform, uint32_t api)
Initialization callback.
_hook_process
void _hook_process(float *xn, uint32_t frames)
Processing callback.
_hook_suspend
void _hook_suspend(void)
Suspend callback.
userprg.h
Common C interface header for custom user programs.
k_user_revfx_param_depth
Depth parameter.
Definition: userrevfx.h:71
k_user_revfx_param_shift_depth
Alternative depth parameter, usually accessible via shift function.
Definition: userrevfx.h:74
k_user_revfx_param_time
Time parameter.
Definition: userrevfx.h:69