Mac OSX player and Single tick rendering

- Use SINGLE_TICK_RENDERING mode for rendering one tick per invocation of
 _4klang_render
- Example for running player on Mac OSX
This commit is contained in:
Peter Salomonsen
2018-12-02 16:44:50 +01:00
parent b06829eab1
commit ccecfc1898
6 changed files with 74 additions and 5 deletions

View File

@ -0,0 +1,33 @@
#include <stdio.h>
extern void _4klang_render(void*) __attribute__ ((stdcall));
extern int _4klang_current_tick;
#define SAMPLE_RATE 44100
#define MAX_INSTRUMENTS 9
#define MAX_VOICES 1
#define HLD 1 ; // can be adjusted to give crinkler some other possibilities
#define BPM 100
#define MAX_PATTERNS 62
#define PATTERN_SIZE_SHIFT 4
#define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
#define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
#define SAMPLES_PER_TICK (SAMPLE_RATE*4*60/(BPM*16))
#define DEF_LFO_NORMALIZE 0.000038
#define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
float buf[SAMPLES_PER_TICK * 2];
int main() {
FILE *fp;
_4klang_current_tick = 0;
fp = fdopen(fileno(stdout), "wb");
for(int n=0;n<MAX_TICKS;n++) {
fprintf(stderr,"\nRender %d %d\n",n,_4klang_current_tick);
_4klang_render(buf);
fwrite(buf, sizeof(buf), 1, fp);
}
fclose(fp);
}