mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
refactor(templates, tests): rename C-header defines consistently with Score.go
This commit is contained in:
parent
048b36324c
commit
3e7064e166
@ -2,16 +2,16 @@
|
||||
#ifndef SU_RENDER_H
|
||||
#define SU_RENDER_H
|
||||
|
||||
#define SU_MAX_SAMPLES {{.MaxSamples}}
|
||||
#define SU_BUFFER_LENGTH (SU_MAX_SAMPLES*2)
|
||||
#define SU_LENGTH_IN_SAMPLES {{.MaxSamples}}
|
||||
#define SU_BUFFER_LENGTH (SU_LENGTH_IN_SAMPLES*2)
|
||||
|
||||
#define SU_SAMPLE_RATE 44100
|
||||
#define SU_BPM {{.Song.BPM}}
|
||||
#define SU_ROWS_PER_BEAT {{.Song.RowsPerBeat}}
|
||||
#define SU_PATTERN_SIZE {{.Song.Score.RowsPerPattern}}
|
||||
#define SU_MAX_PATTERNS {{.Song.Score.Length}}
|
||||
#define SU_TOTAL_ROWS (SU_MAX_PATTERNS*SU_PATTERN_SIZE)
|
||||
#define SU_SAMPLES_PER_ROW (SU_SAMPLE_RATE*60/(SU_BPM*SU_ROWS_PER_BEAT))
|
||||
#define SU_SAMPLE_RATE 44100
|
||||
#define SU_BPM {{.Song.BPM}}
|
||||
#define SU_ROWS_PER_BEAT {{.Song.RowsPerBeat}}
|
||||
#define SU_ROWS_PER_PATTERN {{.Song.Score.RowsPerPattern}}
|
||||
#define SU_LENGTH_IN_PATTERNS {{.Song.Score.Length}}
|
||||
#define SU_LENGTH_IN_ROWS (SU_LENGTH_IN_PATTERNS*SU_PATTERN_SIZE)
|
||||
#define SU_SAMPLES_PER_ROW (SU_SAMPLE_RATE*60/(SU_BPM*SU_ROWS_PER_BEAT))
|
||||
|
||||
#include <stdint.h>
|
||||
#if UINTPTR_MAX == 0xffffffff
|
||||
|
@ -26,12 +26,12 @@ void SU_CALLCONV su_render_song(float* buffer) {
|
||||
synth->RandSeed = 1;
|
||||
// triger first voice
|
||||
synth->SynthWrk.Voices[0].Note = 64;
|
||||
samples = SU_MAX_SAMPLES / 2;
|
||||
samples = SU_LENGTH_IN_SAMPLES / 2;
|
||||
time = INT32_MAX;
|
||||
retval = su_render(synth, buffer, &samples, &time);
|
||||
synth->SynthWrk.Voices[0].Release++;
|
||||
buffer = buffer + SU_MAX_SAMPLES;
|
||||
samples = SU_MAX_SAMPLES / 2;
|
||||
buffer = buffer + SU_LENGTH_IN_SAMPLES;
|
||||
samples = SU_LENGTH_IN_SAMPLES / 2;
|
||||
time = INT32_MAX;
|
||||
retval = su_render(synth, buffer, &samples, &time);
|
||||
free(synth);
|
||||
|
@ -1,15 +1,15 @@
|
||||
#ifndef SU_RENDER_H
|
||||
#define SU_RENDER_H
|
||||
|
||||
#define SU_MAX_SAMPLES 105840
|
||||
#define SU_BUFFER_LENGTH (SU_MAX_SAMPLES*2)
|
||||
#define SU_LENGTH_IN_SAMPLES 105840
|
||||
#define SU_BUFFER_LENGTH (SU_LENGTH_IN_SAMPLES*2)
|
||||
|
||||
#define SU_SAMPLE_RATE 44100
|
||||
#define SU_BPM 100
|
||||
#define SU_PATTERN_SIZE 16
|
||||
#define SU_MAX_PATTERNS 1
|
||||
#define SU_TOTAL_ROWS (SU_MAX_PATTERNS*SU_PATTERN_SIZE)
|
||||
#define SU_SAMPLES_PER_ROW (SU_SAMPLE_RATE*4*60/(BPM*16))
|
||||
#define SU_SAMPLE_RATE 44100
|
||||
#define SU_BPM 100
|
||||
#define SU_ROWS_PER_PATTERN 16
|
||||
#define SU_LENGTH_IN_PATTERNS 1
|
||||
#define SU_LENGTH_IN_ROWS (SU_LENGTH_IN_PATTERNS*SU_ROWS_PER_PATTERN)
|
||||
#define SU_SAMPLES_PER_ROW (SU_SAMPLE_RATE*4*60/(BPM*16))
|
||||
|
||||
#include <stdint.h>
|
||||
#if UINTPTR_MAX == 0xffffffff
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
#define BPM 100
|
||||
#define SAMPLE_RATE 44100
|
||||
#define TOTAL_ROWS 16
|
||||
#define LENGTH_IN_ROWS 16
|
||||
#define SAMPLES_PER_ROW SAMPLE_RATE * 4 * 60 / (BPM * 16)
|
||||
const int su_max_samples = SAMPLES_PER_ROW * TOTAL_ROWS;
|
||||
const int su_max_samples = SAMPLES_PER_ROW * LENGTH_IN_ROWS;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
Synth* synth;
|
||||
|
Loading…
Reference in New Issue
Block a user