PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)
POKITTO_LIBS/Synth/Synth_osc.h@31:f4b9b85c7b62, 2018-01-30 (annotated)
- Committer:
- Pokitto
- Date:
- Tue Jan 30 10:41:47 2018 +0000
- Revision:
- 31:f4b9b85c7b62
Sound output improvements added: louder, clearer, faster!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pokitto | 31:f4b9b85c7b62 | 1 | /**************************************************************************/ |
Pokitto | 31:f4b9b85c7b62 | 2 | /*! |
Pokitto | 31:f4b9b85c7b62 | 3 | @file Synth_osc.h |
Pokitto | 31:f4b9b85c7b62 | 4 | @author Jonne Valola |
Pokitto | 31:f4b9b85c7b62 | 5 | |
Pokitto | 31:f4b9b85c7b62 | 6 | @section LICENSE |
Pokitto | 31:f4b9b85c7b62 | 7 | |
Pokitto | 31:f4b9b85c7b62 | 8 | Pokitto development stage library |
Pokitto | 31:f4b9b85c7b62 | 9 | Software License Agreement |
Pokitto | 31:f4b9b85c7b62 | 10 | |
Pokitto | 31:f4b9b85c7b62 | 11 | Copyright (c) 2015, Jonne Valola ("Author") |
Pokitto | 31:f4b9b85c7b62 | 12 | All rights reserved. |
Pokitto | 31:f4b9b85c7b62 | 13 | |
Pokitto | 31:f4b9b85c7b62 | 14 | This library is intended solely for the purpose of Pokitto development. |
Pokitto | 31:f4b9b85c7b62 | 15 | |
Pokitto | 31:f4b9b85c7b62 | 16 | Redistribution and use in source and binary forms, with or without |
Pokitto | 31:f4b9b85c7b62 | 17 | modification requires written permission from Author. |
Pokitto | 31:f4b9b85c7b62 | 18 | */ |
Pokitto | 31:f4b9b85c7b62 | 19 | /**************************************************************************/ |
Pokitto | 31:f4b9b85c7b62 | 20 | |
Pokitto | 31:f4b9b85c7b62 | 21 | #ifndef SYNTH_OSC_H |
Pokitto | 31:f4b9b85c7b62 | 22 | #define SYNTH_OSC_H |
Pokitto | 31:f4b9b85c7b62 | 23 | |
Pokitto | 31:f4b9b85c7b62 | 24 | #include "Pokitto.h" |
Pokitto | 31:f4b9b85c7b62 | 25 | |
Pokitto | 31:f4b9b85c7b62 | 26 | typedef uint8_t byte; |
Pokitto | 31:f4b9b85c7b62 | 27 | |
Pokitto | 31:f4b9b85c7b62 | 28 | struct OSC { |
Pokitto | 31:f4b9b85c7b62 | 29 | byte on; |
Pokitto | 31:f4b9b85c7b62 | 30 | byte wave; |
Pokitto | 31:f4b9b85c7b62 | 31 | byte loop; |
Pokitto | 31:f4b9b85c7b62 | 32 | byte echo; |
Pokitto | 31:f4b9b85c7b62 | 33 | byte echodiv; |
Pokitto | 31:f4b9b85c7b62 | 34 | byte adsr; |
Pokitto | 31:f4b9b85c7b62 | 35 | byte tonic; |
Pokitto | 31:f4b9b85c7b62 | 36 | |
Pokitto | 31:f4b9b85c7b62 | 37 | //uint16_t count; |
Pokitto | 31:f4b9b85c7b62 | 38 | uint32_t count; |
Pokitto | 31:f4b9b85c7b62 | 39 | |
Pokitto | 31:f4b9b85c7b62 | 40 | uint16_t vol; |
Pokitto | 31:f4b9b85c7b62 | 41 | //uint16_t cinc; // how much to add per cycle |
Pokitto | 31:f4b9b85c7b62 | 42 | uint32_t cinc; // how much to add per cycle |
Pokitto | 31:f4b9b85c7b62 | 43 | uint16_t output; // output is stored as 16 bit value and shifted before its put in OCR2B |
Pokitto | 31:f4b9b85c7b62 | 44 | |
Pokitto | 31:f4b9b85c7b62 | 45 | uint8_t adsrphase; |
Pokitto | 31:f4b9b85c7b62 | 46 | uint16_t adsrvol; |
Pokitto | 31:f4b9b85c7b62 | 47 | uint16_t attack; // Attack change |
Pokitto | 31:f4b9b85c7b62 | 48 | uint16_t decay; // Attack change |
Pokitto | 31:f4b9b85c7b62 | 49 | uint16_t sustain; // Attack change |
Pokitto | 31:f4b9b85c7b62 | 50 | uint16_t release; // Attack change |
Pokitto | 31:f4b9b85c7b62 | 51 | |
Pokitto | 31:f4b9b85c7b62 | 52 | int16_t pitchbend; // bends cycle counter (more is higher pitch) |
Pokitto | 31:f4b9b85c7b62 | 53 | int16_t maxbend; // maximum bend before stopping |
Pokitto | 31:f4b9b85c7b62 | 54 | int16_t bendrate; // how much to bend by every cycle |
Pokitto | 31:f4b9b85c7b62 | 55 | |
Pokitto | 31:f4b9b85c7b62 | 56 | uint8_t vibrate; |
Pokitto | 31:f4b9b85c7b62 | 57 | uint8_t arpmode; |
Pokitto | 31:f4b9b85c7b62 | 58 | uint8_t arpspeed; |
Pokitto | 31:f4b9b85c7b62 | 59 | uint8_t arpstep; |
Pokitto | 31:f4b9b85c7b62 | 60 | uint8_t overdrive; |
Pokitto | 31:f4b9b85c7b62 | 61 | uint8_t kick; |
Pokitto | 31:f4b9b85c7b62 | 62 | |
Pokitto | 31:f4b9b85c7b62 | 63 | uint32_t duration; |
Pokitto | 31:f4b9b85c7b62 | 64 | }; |
Pokitto | 31:f4b9b85c7b62 | 65 | |
Pokitto | 31:f4b9b85c7b62 | 66 | |
Pokitto | 31:f4b9b85c7b62 | 67 | |
Pokitto | 31:f4b9b85c7b62 | 68 | #endif // SYNTH_OSC_H |
Pokitto | 31:f4b9b85c7b62 | 69 | |
Pokitto | 31:f4b9b85c7b62 | 70 |