Changeset 2432:d84ffcebf730 in roaraudio
- Timestamp:
- 08/19/09 15:35:53 (15 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroardsp/synth.h
r2431 r2432 54 54 ROAR_SYNTH_FUNC_TYPE(func); 55 55 size_t pcmoffset; 56 float volume; 56 57 }; 57 58 … … 59 60 int roar_synth_set_offset(struct roar_synth_state * state, size_t offset); 60 61 int roar_synth_set_func (struct roar_synth_state * state, ROAR_SYNTH_FUNC_TYPE(func)); 62 int roar_synth_set_volume(struct roar_synth_state * state, float volume); 61 63 62 64 int roar_synth_pcmout_i16n(struct roar_synth_state * state, int16_t * out, size_t frames, int channels); -
libroardsp/synth.c
r2431 r2432 36 36 memset(state, 0, sizeof(struct roar_synth_state)); 37 37 38 state->note = note; // NULL is valid here! 39 state->rate = rate; 38 state->note = note; // NULL is valid here! 39 state->rate = rate; 40 state->volume = 1; 40 41 41 42 state->func = ROAR_SYNTH_SYNF_SINE; … … 59 60 60 61 state->func = func; 62 63 return 0; 64 } 65 66 int roar_synth_set_volume(struct roar_synth_state * state, float volume) { 67 _CHECK_BASIC(); 68 69 state->volume = volume; 61 70 62 71 return 0; … … 90 99 91 100 for (i = 0; i < frames; i++, t_cur += t_step) { 92 out[i] = 32767.0*state-> func(2.0*M_PI*freq*t_cur, state);101 out[i] = 32767.0*state->volume*state->func(2.0*M_PI*freq*t_cur, state); 93 102 } 94 103
Note: See TracChangeset
for help on using the changeset viewer.