This commit is contained in:
John Alanbrook 2022-07-11 00:29:52 +00:00
parent c52509a9d7
commit a892cb1180
4 changed files with 28 additions and 13 deletions

View file

@ -91,7 +91,7 @@ void ds_openvideo(struct datastream *ds, const char *video, const char *adriver)
fir->in = astream_filter; 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_video_decode_callback(ds->plm, render_frame, ds);
plm_set_audio_decode_callback(ds->plm, render_audio, ds); plm_set_audio_decode_callback(ds->plm, render_audio, ds);

View file

@ -54,6 +54,11 @@ void am_mod(struct dsp_ammod *mod, short *c, int n)
c[i] = (mod->abuf[i]*mod->bbuf[i])>>15; 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) { static struct wav make_wav(float freq, int sr, int ch) {
struct wav new; struct wav new;
new.ch = ch; new.ch = ch;
@ -185,13 +190,6 @@ float phasor_step(struct phasor *p)
p->cur += p->freq/p->sr; p->cur += p->freq/p->sr;
if (p->cur >= 1.f) p->cur = 0.f; if (p->cur >= 1.f) p->cur = 0.f;
return p->cur; return p->cur;
/*
float ret = p->cache[p->cstep++];
if (p->cstep ==p->clen) p->cstep = 0;
return ret;
*/
} }
float sin_phasor(float p) 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); adsr->rls_t = tau2pole(rls / 3000.f);
return make_dsp(adsr, dsp_adsr_fillbuf); return make_dsp(adsr, dsp_adsr_fillbuf);
}
struct dsp_filter make_reverb()
{
}
void dsp_reverb_fillbuf(struct dsp_reverb *r, short *out, int n)
{
} }

View file

@ -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); 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 #endif

View file

@ -143,9 +143,9 @@ void sound_init()
sin20.f = square_phasor; sin20.f = sin_phasor;
sin20.p.sr = SAMPLERATE; sin20.p.sr = SAMPLERATE;
sin20.p.freq = 4; sin20.p.freq = 250;
s600wav = gen_sine(0.6f, 600, SAMPLERATE, CHANNELS); 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); struct dsp_filter ad = make_adsr(50, 200, 500, 100);
dspammod.ina = s600; dspammod.ina = s600;
dspammod.inb = ad; dspammod.inb = s20;
first_free_bus(am_filter); // first_free_bus(am_filter);
struct dsp_filter wn; struct dsp_filter wn;
wn.filter = gen_pinknoise; wn.filter = gen_pinknoise;
@ -227,7 +227,7 @@ void sound_init()
play_song("", ""); //play_song("", "");
} }
void audio_open(const char *device) void audio_open(const char *device)