summaryrefslogtreecommitdiff
path: root/src/audio/synth.h
blob: fe28e8dc577a73f61449544c6d97fc0ff71d1c1b (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
#pragma once

#include "dct.h"

#define MAX_SPECTROGRAMS 16
#define MAX_VOICES 16

struct Spectrogram {
  float *spectral_data_a;
  float *spectral_data_b;
  int num_frames;
};

void synth_init();
void synth_shutdown();

int synth_register_spectrogram(const Spectrogram *spec);
void synth_unregister_spectrogram(int spectrogram_id);

float *synth_begin_update(int spectrogram_id);
void synth_commit_update(int spectrogram_id);

void synth_trigger_voice(int spectrogram_id, float volume, float pan);
void synth_render(float *output_buffer, int num_frames);
int synth_get_active_voice_count();
float synth_get_output_peak();