Changeset 2426:122c29dbcd87 in roaraudio for include/libroardsp


Ignore:
Timestamp:
08/19/09 05:12:09 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added very basic code for synth

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/libroardsp/synth.h

    r2425 r2426  
    3838#include "libroardsp.h" 
    3939 
     40#define ROAR_SYNTH_FUNC_TYPE(name) float (*name)(float t, struct roar_synth_state * state) 
     41#define ROAR_SYNTH_FUNC_CAST(name) ((ROAR_SYNTH_FUNC_TYPE()) name) 
     42 
     43// SYNF -> Synthesis Function 
     44#define ROAR_SYNTH_SYNF_SINE ROAR_SYNTH_FUNC_CAST(sinf) 
     45 
     46struct roar_synth_state { 
     47 int rate; 
     48 struct roar_note_octave * note; 
     49 ROAR_SYNTH_FUNC_TYPE(func); 
     50 size_t pcmoffset; 
     51}; 
     52 
     53int roar_synth_init(struct roar_synth_state * state, struct roar_note_octave * note, int rate); 
     54int roar_synth_set_offset(struct roar_synth_state * state, size_t offset); 
     55int roar_synth_set_func  (struct roar_synth_state * state, ROAR_SYNTH_FUNC_TYPE(func)); 
     56 
     57int roar_synth_pcmout_i16n(struct roar_synth_state * state, int16_t * out, size_t frames, int channels); 
     58int roar_synth_pcmout_i161(struct roar_synth_state * state, int16_t * out, size_t frames); 
     59 
    4060#endif 
    4161 
Note: See TracChangeset for help on using the changeset viewer.