Synth.cpp
 All Data Structures Namespaces Files Functions Variables Macros
Data Structures | Macros | Functions
synth.h File Reference

Synthesizer modules and supporting functions. More...

#include <stdlib.h>
#include <stdint.h>
Include dependency graph for synth.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  IVoice
 
class  ISynth
 
class  Queue
 
class  Synth
 
class  ADSR
 
class  Filter
 
class  Oscillator
 
class  Key
 

Macros

#define __ARM   1
 
#define SAMPLING_RATE   40000
 
#define DT   (1.0 / SAMPLING_RATE)
 
#define ASSERT(cond)   assertion(cond, #cond, __FILE__, __LINE__)
 
#define BUFSIZE   1024
 
#define MIN(x, y)   (((x) < (y)) ? (x) : (y))
 
#define MAX(x, y)   (((x) > (y)) ? (x) : (y))
 

Functions

void assertion (int cond, const char *strcond, const char *file, const int line)
 
float small_random ()
 
uint8_t play_tune (uint32_t *tune, uint32_t msecs)
 
int32_t clip (int32_t x)
 
void use_read_key (uint8_t(*rk)(uint32_t))
 
void use_synth_array (ISynth **s, uint8_t _num_synths)
 
ISynthget_synth (void)
 
void use_synth (uint8_t i)
 

Detailed Description

Synthesizer modules and supporting functions.

Values that would be voltages in an analog synthesizer are 12 bits in most cases. You can think of unsigned quantities (0 to 4095) as having voltages ranging from 0 volts to 1 volt, and signed quantities (-2048 to 2047) as a range of -0.5 volt to +0.5 volt.

Definition in file synth.h.

Macro Definition Documentation

#define __ARM   1

Definition at line 18 of file synth.h.

#define ASSERT (   cond)    assertion(cond, #cond, __FILE__, __LINE__)

Definition at line 27 of file synth.h.

Referenced by Synth::get_12_bit_value(), Synth::get_next_available_voice(), main(), and test1().

#define BUFSIZE   1024

Buffer for the Queue class. This MUST be a power of 2.

Definition at line 36 of file synth.h.

Referenced by Queue::full(), Queue::read(), Queue::size(), and Queue::write().

#define DT   (1.0 / SAMPLING_RATE)

Definition at line 25 of file synth.h.

Referenced by ADSR::rare_step(), Filter::setF(), and setup().

#define MAX (   x,
 
)    (((x) > (y)) ? (x) : (y))

Definition at line 39 of file synth.h.

Referenced by clip().

#define MIN (   x,
 
)    (((x) < (y)) ? (x) : (y))

Definition at line 38 of file synth.h.

Referenced by clip().

#define SAMPLING_RATE   40000

Definition at line 24 of file synth.h.

Referenced by main(), and Oscillator::setfreq().

Function Documentation

void assertion ( int  cond,
const char *  strcond,
const char *  file,
const int  line 
)

Definition at line 86 of file synth.cpp.

int32_t clip ( int32_t  x)
inline

Definition at line 41 of file synth.h.

Referenced by Filter::step().

Here is the caller graph for this function:

ISynth* get_synth ( void  )

Definition at line 34 of file synth.cpp.

Referenced by loop(), play_tune(), and timer_interrupt().

Here is the caller graph for this function:

uint8_t play_tune ( uint32_t *  tune,
uint32_t  msecs 
)

Definition at line 51 of file synth.cpp.

Referenced by loop(), and main().

Here is the call graph for this function:

Here is the caller graph for this function:

float small_random ( )

Definition at line 45 of file synth.cpp.

Referenced by NoisyVoice::setfreq().

Here is the caller graph for this function:

void use_read_key ( uint8_t(*)(uint32_t)  rk)

Definition at line 24 of file synth.cpp.

void use_synth ( uint8_t  i)

Definition at line 29 of file synth.cpp.

Referenced by FunctionKey::keydown(), main(), play_tune(), and setup().

Here is the caller graph for this function:

void use_synth_array ( ISynth **  s,
uint8_t  _num_synths 
)

Definition at line 39 of file synth.cpp.

Referenced by main(), and setup().

Here is the caller graph for this function: