/[pidim]/src/pidim_common.h
ViewVC logotype

Diff of /src/pidim_common.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7 by ben, Thu Aug 26 16:46:46 2010 UTC revision 8 by ben, Thu Aug 26 19:26:02 2010 UTC
# Line 19  Line 19 
19  #ifndef PIDIM_COMMON  #ifndef PIDIM_COMMON
20  #define PIDIM_COMMON  #define PIDIM_COMMON
21  #include <alsa/asoundlib.h>  #include <alsa/asoundlib.h>
22    #include <stdlib.h>
23    
24  /* create a client handle */  /* create a client handle */
25  snd_seq_t* alsa_open_client (const char* name);  snd_seq_t* alsa_open_client (const char* name);
# Line 41  void alsa_clear_queue(snd_seq_t *handle, Line 42  void alsa_clear_queue(snd_seq_t *handle,
42  int alsa_get_fd(snd_seq_t *handle);  int alsa_get_fd(snd_seq_t *handle);
43  #endif  #endif
44    
45    /* return a random integer between 0 and 127 */
46    #define random127() (unsigned char)(random()%128)
47    
48    /* return a random integer between 0 and 15 */
49    #define random15() (unsigned char)(random()%16)
50    
51    #define scale(n, max, base) (((double)((n)*(base)))/(double)(max))
52    #define scale127(n, max) (scale((n),(max),127))
53    #define scale15(n, max) (scale((n),(max),15))
54    #define PI 3.1415926535897932384626434
55    #define scalePI(n, max) (scale((n),(max),PI))
56    #define scale2PI(n, max) (scale((n),(max),(2*PI)))
57    
58    /* return an arbitrary lenghted array containing values 0 to max (and < 255) */
59    unsigned char* midi_ramp (int size, unsigned char max);
60    
61    #define midi_ramp127(size) (midi_ramp ((size), 127))
62    #define midi_ramp15(size) (midi_ramp ((size), 15))
63    
64    /* return a sinewave of arbitrary length containing values < max (and < 255) */
65    unsigned char* midi_sine (int period, unsigned char max);
66    
67    #define midi_sine127(period) (midi_sine((period), 127))
68    #define midi_sine15(period) (midi_sine((period, 15))
69    
70    /* return a random line of arbitrary length containing values < max (and < 255) */
71    unsigned char* midi_rand (int length, unsigned char max);
72    
73  #endif  #endif

Legend:
Removed from v.7  
changed lines
  Added in v.8

  ViewVC Help
Powered by ViewVC 1.1.26