Changeset 2424:ebf8be51199e in roaraudio


Ignore:
Timestamp:
08/19/09 04:55:29 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

got it... something simular to working at least may completly be replaced by synth

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroardsp/midi.c

    r1880 r2424  
    146146 int i, c; 
    147147 float ct; 
    148  float step = M_PI*2*note->freq/rate; 
     148 float step = 1.0/rate; 
    149149 int16_t s; 
    150150 float (*op)(float x) = NULL; 
     
    166166  return -1; 
    167167 
     168 ROAR_DBG("roar_midi_gen_tone(*): t=%f", t); 
     169 
    168170 for (ct = 0, i = 0; ct <= t; ct += step, i += channels) { 
    169   s = 32767*op(ct); 
     171  s = 32767*op(2.0*M_PI*note->freq*ct); 
     172 
     173//  ROAR_DBG("roar_midi_gen_tone(*): t=%f, ct=%f, i=%i", t, ct, i); 
    170174 
    171175  for (c = 0; c < channels; c++) 
    172176   samples[i+c] = s; 
    173177 } 
     178 
     179 ROAR_DBG("roar_midi_gen_tone(*): t=%f, ct=%f, i=%i", t, ct, i); 
    174180 
    175181 return 0; 
Note: See TracChangeset for help on using the changeset viewer.