disabled markov stuffs, switched to mono
parent
d6b6846669
commit
141636d742
4
ampler.c
4
ampler.c
|
@ -42,8 +42,8 @@ Ampler_state *init() {
|
|||
puts(SDL_GetError());
|
||||
|
||||
// TODO: iterate a directory to load samples
|
||||
//load_sample(state, "./mix.wav");
|
||||
load_sample(state, "./haunted.wav");
|
||||
load_sample(state, "./mix.wav");
|
||||
//load_sample(state, "./haunted.wav");
|
||||
//load_sample(state, "./loop2.wav");
|
||||
//load_sample(state, "./loop.wav");
|
||||
//load_sample(state, "./chord.wav");
|
||||
|
|
20
audio.c
20
audio.c
|
@ -95,24 +95,14 @@ int audio_frame(Ampler_state *state) {
|
|||
|
||||
// TODO: We should use CHANNELS here
|
||||
// static s8 mix_l[FRAME_SAMPLES] = { 0 }, mix_r[FRAME_SAMPLES] = { 0 };
|
||||
s8 *mix_l = state->frame_mix[0], *mix_r = state->frame_mix[1];
|
||||
s8 *mix_l = state->frame_mix[0]; // s8 *mix_l = state->frame_mix[0], *mix_r = state->frame_mix[1];
|
||||
SDL_memset(mix_l, 0, FRAME_SAMPLES / sizeof (s8));
|
||||
SDL_memset(mix_r, 0, FRAME_SAMPLES / sizeof (s8));
|
||||
//SDL_memset(mix_r, 0, FRAME_SAMPLES / sizeof (s8));
|
||||
|
||||
s8 *mix[] = { mix_l, mix_r };
|
||||
s8 *mix[] = { mix_l }; //s8 *mix[] = { mix_l, mix_r };
|
||||
foreach_ptr(Sound_src, snd, state -> sounds)
|
||||
sound_src_frame(snd, mix);
|
||||
|
||||
// MARKOV TEST
|
||||
SDL_memset(&(state->markov), 0, sizeof state->markov);
|
||||
markov_gen(&(state->markov), mix_l);
|
||||
markov_synth(&(state->markov), mix_l);
|
||||
for int i = 0; i < FRAME_SAMPLES; i += 1 do
|
||||
mix_r[i] = mix_l[i];
|
||||
// MARKOV TEST
|
||||
|
||||
|
||||
|
||||
const int vol = 100;
|
||||
static s16 frame[FRAME_SAMPLES * CHANNELS] = { 0 };
|
||||
for int i = 0; i < FRAME_SAMPLES; i += 1 do
|
||||
|
@ -178,8 +168,10 @@ void load_sample(Ampler_state *state, const char *file_name) {
|
|||
puts("fffuuuck");
|
||||
|
||||
for int i = 0; i < snd -> track_len; i += 1 do
|
||||
for int t = 0; t < chans; t += 1 do
|
||||
for int t = 0; t < chans; t += 1 do {
|
||||
if t >= CHANNELS do continue; // THIS GETS US MONO
|
||||
snd -> tracks[t][i] = (s8) (buffer[i * chans + t] >> 8);
|
||||
}
|
||||
|
||||
SDL_FreeWAV((void *) buffer);
|
||||
|
||||
|
|
8
draw.c
8
draw.c
|
@ -38,11 +38,12 @@ void draw_frame(SDL_Window *w, SDL_Renderer *r, Ampler_state *state) {
|
|||
// SDL_RenderClear(r);
|
||||
|
||||
//markov_draw(&(state->markov), r);
|
||||
SDL_memset(&(state->markov), 0, sizeof state->markov);
|
||||
markov_gen(&(state->markov), state->frame_mix[1]);
|
||||
markov_draw(&(state->markov), r);
|
||||
//SDL_memset(&(state->markov), 0, sizeof state->markov);
|
||||
//markov_gen(&(state->markov), state->frame_mix[1]);
|
||||
//markov_draw(&(state->markov), r);
|
||||
|
||||
SDL_RenderPresent(r);
|
||||
}
|
||||
|
||||
/*
|
||||
for int x = 0; x < 256; x += 1 do
|
||||
|
@ -96,4 +97,3 @@ void draw_frame(SDL_Window *w, SDL_Renderer *r, Ampler_state *state) {
|
|||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue