32 lines
781 B
C
32 lines
781 B
C
/*
|
|
Tracker program to create awesome music!
|
|
Is supposed to only work on Linux, as it's where the development happens.
|
|
*/
|
|
|
|
#include "../../Common/Snd/oscs.h"
|
|
#include "../../Common/Std/libc.c"
|
|
#include "../../Common/Timer/posix.c"
|
|
#include "../../Common/fix.c"
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char **argv) {
|
|
struct com_snd_swave swave = com_snd_swave_init(COM_CFG_A4FIX, 0, UINT16_MAX);
|
|
|
|
FILE *f = fopen("test.raw", "w");
|
|
if (!f) {
|
|
printf("Can't open file %s\n", "test.raw");
|
|
return -1;
|
|
}
|
|
|
|
/* Generate 5 seconds of sinwave. */
|
|
int16_t frames[COM_CFG_SNDFRMRATE * 5];
|
|
for (int i = 0; i < COM_CFG_SNDFRMRATE * 5; ++i)
|
|
frames[i] = com_snd_swave_pump(&swave);
|
|
|
|
fwrite(frames, 2, COM_CFG_SNDFRMRATE * 5, f);
|
|
|
|
return 0;
|
|
}
|