The Tooba
 All Data Structures Namespaces Files Functions Variables Macros Pages
common.h
Go to the documentation of this file.
1 /*
2 We have a 40 kHz or 50 kHz timer interrupt that handles sound
3 samples. First it writes the previously computed sample to the serial DAC.
4 Then it computes the sample for the next time.
5 */
6 
7 #ifndef COMMON_H_INCLUDED
8 #define COMMON_H_INCLUDED 1
9 
10 #ifndef __STDINT
11 #include <stdint.h>
12 #define __STDINT 1
13 #endif
14 
15 #ifndef __ARDUINO
16 #define __ARDUINO 1
17 #endif
18 
19 #ifndef ASSERT
20 #define ASSERT(cond) ((void*) 0)
21 #endif
22 
23 #ifndef NULL
24 #define NULL 0
25 #endif
26 
27 #define SAMPLING_RATE 40000
28 #define DT (1.0 / SAMPLING_RATE)
29 
30 #define NUM_KEYS 16 // 17? 34? 40?
31 #define NUM_VOICE_BITS 3
32 #define NUM_VOICES (1 << NUM_VOICE_BITS)
33 
34 // This is for a 330K resistor.
35 #define THRESHOLD 12
36 
37 #define KEYDOWN_COUNT 5
38 
39 class Key;
40 extern Key *keyboard[NUM_KEYS];
41 class Voice;
42 extern Voice v[NUM_VOICES];
43 
44 extern int32_t mult_signed(int32_t x, int32_t y);
45 extern int32_t mult_unsigned(uint32_t x, uint32_t y);
46 extern int32_t mult_unsigned_signed(uint32_t x, int32_t y);
47 
48 #endif // COMMON_H_INCLUDED
Definition: voice.h:132
#define NUM_KEYS
Definition: common.h:30
int32_t mult_unsigned_signed(uint32_t x, int32_t y)
Definition: common.cpp:13
#define NUM_VOICES
Definition: common.h:32
int32_t mult_signed(int32_t x, int32_t y)
Definition: common.cpp:3
Definition: key.h:11
Key * keyboard[NUM_KEYS]
Definition: stub.cpp:7
tuple x
Definition: testit.py:14
Voice v[NUM_VOICES]
Definition: stub.cpp:6
int32_t mult_unsigned(uint32_t x, uint32_t y)
Definition: common.cpp:8