- abstracted Sync with callbacks

git-svn-id: http://moon:8086/svn/software/trunk/projects/JaySynth@719 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2020-08-11 06:48:49 +00:00
parent 7e3cdbc5ac
commit a3f8bb1e4e
2 changed files with 76 additions and 33 deletions
+10
View File
@@ -40,8 +40,16 @@ enum
LFO_NUM_PARAMS
};
typedef void (*SyncOnProcess)(void *pFuncObj);
typedef void (*SyncOnFreqUpdate)(void *pFuncObj, synth_float_t omega);
typedef synth_float_t (*SyncOnGetPhase)(void *pFuncObj);
typedef struct _ssync_t
{
void *pFuncObj;
SyncOnProcess funcSyncOnProcess;
SyncOnGetPhase funcSyncOnGetPhase;
SyncOnFreqUpdate funcSyncOnFreqUpdate;
synth_float_t phase;
synth_float_t phase_ref;
synth_float_t omega;
@@ -62,6 +70,8 @@ extern "C" {
// Exported functions
// --------------------------------------------------------------
void Sync_init(sync_t *pObj);
void Sync_set_callback(sync_t *pObj, void *pFuncObj, SyncOnProcess funcSyncOnProcess, SyncOnGetPhase funcSyncOnGetPhase, SyncOnFreqUpdate funcSyncOnFreqUpdate);
void Sync_phase_update(sync_t *pObj, synth_float_t phase_ref);
int Sync_process(sync_t *pObj);