From a892cb1180d5b927669f844e364deb258b9217bd Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Mon, 11 Jul 2022 00:29:52 +0000 Subject: [PATCH] ??? --- source/engine/datastream.c | 2 +- source/engine/dsp.c | 22 +++++++++++++++------- source/engine/dsp.h | 7 +++++++ source/engine/sound.c | 10 +++++----- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/source/engine/datastream.c b/source/engine/datastream.c index cea9a5f..95beabc 100755 --- a/source/engine/datastream.c +++ b/source/engine/datastream.c @@ -91,7 +91,7 @@ void ds_openvideo(struct datastream *ds, const char *video, const char *adriver) fir->in = astream_filter; */ - //first_free_bus(astream_filter); + first_free_bus(astream_filter); plm_set_video_decode_callback(ds->plm, render_frame, ds); plm_set_audio_decode_callback(ds->plm, render_audio, ds); diff --git a/source/engine/dsp.c b/source/engine/dsp.c index 9c51135..504cf80 100644 --- a/source/engine/dsp.c +++ b/source/engine/dsp.c @@ -54,6 +54,11 @@ void am_mod(struct dsp_ammod *mod, short *c, int n) c[i] = (mod->abuf[i]*mod->bbuf[i])>>15; } +void fm_mod(float *in1, float *in2, float *out, int n) +{ + +} + static struct wav make_wav(float freq, int sr, int ch) { struct wav new; new.ch = ch; @@ -185,13 +190,6 @@ float phasor_step(struct phasor *p) p->cur += p->freq/p->sr; if (p->cur >= 1.f) p->cur = 0.f; return p->cur; - -/* - float ret = p->cache[p->cstep++]; - if (p->cstep ==p->clen) p->cstep = 0; - - return ret; - */ } float sin_phasor(float p) @@ -517,4 +515,14 @@ struct dsp_filter make_adsr(unsigned int atk, unsigned int dec, unsigned int sus adsr->rls_t = tau2pole(rls / 3000.f); return make_dsp(adsr, dsp_adsr_fillbuf); +} + +struct dsp_filter make_reverb() +{ + +} + +void dsp_reverb_fillbuf(struct dsp_reverb *r, short *out, int n) +{ + } \ No newline at end of file diff --git a/source/engine/dsp.h b/source/engine/dsp.h index 79dbcee..f388938 100644 --- a/source/engine/dsp.h +++ b/source/engine/dsp.h @@ -130,4 +130,11 @@ void osc_fillbuf(struct osc *osc, short *buf, int n); void am_mod(struct dsp_ammod *mod, short *c, int n); +struct dsp_reverb { + unsigned int time; /* Time in miliseconds for the sound to decay out */ +}; + +struct dsp_filter make_reverb(); +void dsp_reverb_fillbuf(struct dsp_reverb *r, short *out, int n); + #endif \ No newline at end of file diff --git a/source/engine/sound.c b/source/engine/sound.c index b917453..6a9ff80 100755 --- a/source/engine/sound.c +++ b/source/engine/sound.c @@ -143,9 +143,9 @@ void sound_init() - sin20.f = square_phasor; + sin20.f = sin_phasor; sin20.p.sr = SAMPLERATE; - sin20.p.freq = 4; + sin20.p.freq = 250; s600wav = gen_sine(0.6f, 600, SAMPLERATE, CHANNELS); @@ -178,9 +178,9 @@ void sound_init() struct dsp_filter ad = make_adsr(50, 200, 500, 100); dspammod.ina = s600; - dspammod.inb = ad; + dspammod.inb = s20; - first_free_bus(am_filter); + // first_free_bus(am_filter); struct dsp_filter wn; wn.filter = gen_pinknoise; @@ -227,7 +227,7 @@ void sound_init() - play_song("", ""); + //play_song("", ""); } void audio_open(const char *device)