Changeset 369:01c814f9b114 in roaraudio


Ignore:
Timestamp:
08/03/08 14:29:09 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support for diffrent types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroardsp/midi.c

    r367 r369  
    8989 float step = M_PI*2*note->freq/rate; 
    9090 int16_t s; 
     91 float (*op)(float x) = NULL; 
    9192 
    9293/* 
     
    9798*/ 
    9899 
     100 if ( type == ROAR_MIDI_TYPE_SINE ) { 
     101  op = sinf; 
     102 } else { 
     103  return -1; 
     104 } 
     105 
     106 if ( op == NULL ) 
     107  return -1; 
     108 
    99109 for (ct = 0, i = 0; ct <= t; ct += step, i += channels) { 
    100   s = 32767*sin(ct); 
     110  s = 32767*op(ct); 
    101111 
    102112  for (c = 0; c < channels; c++) 
Note: See TracChangeset for help on using the changeset viewer.