Changeset 2426:122c29dbcd87 in roaraudio for libroardsp/synth.c
- Timestamp:
- 08/19/09 05:12:09 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroardsp/synth.c
r2425 r2426 25 25 #include "libroardsp.h" 26 26 27 #define _CHECK_BASIC() if ( state == NULL ) return -1 28 29 int roar_synth_init(struct roar_synth_state * state, struct roar_note_octave * note, int rate) { 30 _CHECK_BASIC(); 31 32 if ( rate <= 0 ) 33 return -1; 34 35 memset(state, 0, sizeof(struct roar_synth_state)); 36 37 state->note = note; // NULL is valid here! 38 state->rate = rate; 39 40 state->func = ROAR_SYNTH_SYNF_SINE; 41 42 return 0; 43 } 44 45 int roar_synth_set_offset(struct roar_synth_state * state, size_t offset) { 46 _CHECK_BASIC(); 47 48 state->pcmoffset = offset; 49 50 return 0; 51 } 52 53 int roar_synth_set_func (struct roar_synth_state * state, ROAR_SYNTH_FUNC_TYPE(func)) { 54 _CHECK_BASIC(); 55 56 state->func = func; 57 58 return 0; 59 } 60 61 int roar_synth_pcmout_i16n(struct roar_synth_state * state, int16_t * out, size_t frames, int channels) { 62 _CHECK_BASIC(); 63 64 if ( out == NULL ) 65 return -1; 66 67 if ( frames == 0 ) 68 return 0; 69 70 switch (channels) { 71 case 1: return roar_synth_pcmout_i161(state, out, frames); 72 default: 73 return -1; 74 } 75 76 return 0; 77 } 78 79 int roar_synth_pcmout_i161(struct roar_synth_state * state, int16_t * out, size_t frames) { 80 _CHECK_BASIC(); 81 82 return -1; 83 } 84 27 85 28 86 //ll
Note: See TracChangeset
for help on using the changeset viewer.