mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-14 11:04:23 -04:00
feat(go4k&sointu): Export .h C header files from the songs using go, also automatically during build for the tests.
The header files are automatically generated during build. No need to #define anything; everything is fixed by the .asm file. This adds go as a dependency to run the unit tests, but this is probably not a bad thing, as go is probably needed anyway if one wants to actually start developing Sointu.
This commit is contained in:
@ -2,24 +2,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sointu/sointu.h>
|
||||
#include "test_render_samples.h"
|
||||
|
||||
#if UINTPTR_MAX == 0xffffffff // are we 32-bit?
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#define CALLCONV __attribute__ ((stdcall))
|
||||
#elif defined(_WIN32)
|
||||
#define CALLCONV __stdcall // on 32-bit platforms, we just use stdcall, as all know it
|
||||
#endif
|
||||
#else // 64-bit
|
||||
#define CALLCONV // the asm will use honor honor correct x64 ABI on all 64-bit platforms
|
||||
#endif
|
||||
|
||||
#define BPM 100
|
||||
#define SAMPLE_RATE 44100
|
||||
#define TOTAL_ROWS 16
|
||||
#define SAMPLES_PER_ROW SAMPLE_RATE * 4 * 60 / (BPM * 16)
|
||||
const int su_max_samples = SAMPLES_PER_ROW * TOTAL_ROWS;
|
||||
|
||||
void CALLCONV su_render_song(float* buffer) {
|
||||
void SU_CALLCONV su_render_song(float* buffer) {
|
||||
Synth* synth;
|
||||
const unsigned char commands[] = { su_envelope_id, // MONO
|
||||
su_envelope_id, // MONO
|
||||
@ -41,12 +26,12 @@ void 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_MAX_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_MAX_SAMPLES;
|
||||
samples = SU_MAX_SAMPLES / 2;
|
||||
time = INT32_MAX;
|
||||
retval = su_render(synth, buffer, &samples, &time);
|
||||
free(synth);
|
||||
|
Reference in New Issue
Block a user