Changeset 888:518573ceb8cc in roaraudio


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

added trapece signal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarsin.c

    r887 r888  
    5454} 
    5555 
     56double trap (double x) { 
     57 x /= 2*M_PI; 
     58 x -= (int)x; 
     59 
     60 if ( x < 0.125 || x > 0.875 ) { 
     61  return -1; 
     62 } else if ( x < 0.625 && x > 0.375 ) { 
     63  return  1; 
     64 } else if ( x < 0.5 ) { 
     65  return  8*(x-0.375) + 1; 
     66 } else { 
     67  return -8*(x-0.625) + 1; 
     68 } 
     69} 
     70 
    5671int main (int argc, char * argv[]) { 
    5772 int rate     = ROAR_RATE_DEFAULT; 
     
    7590  } else if ( !strcmp(argv[i], "--sin") ) { 
    7691   func   = sin; 
     92  } else if ( !strcmp(argv[i], "--rect") ) { 
     93   func   = rect; 
    7794  } else if ( !strcmp(argv[i], "--saw") ) { 
    7895   func   = saw; 
    7996  } else if ( !strcmp(argv[i], "--tri") ) { 
    8097   func   = tri; 
     98  } else if ( !strcmp(argv[i], "--trap") ) { 
     99   func   = trap; 
    81100  } else { 
    82101   return 2; 
Note: See TracChangeset for help on using the changeset viewer.