PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)
Dependents: YATTT sd_map_test cPong SnowDemo ... more
PokittoLib
Library for programming Pokitto hardware
How to Use
- Import this library to online compiler (see button "import" on the right hand side
- DO NOT import mbed-src anymore, a better version is now included inside PokittoLib
- Change My_settings.h according to your project
- Start coding!
POKITTO_LIBS/Synth/Synth_osc.h@28:958b71c4b92a, 2018-01-05 (annotated)
- Committer:
- Pokitto
- Date:
- Fri Jan 05 02:19:51 2018 +0000
- Revision:
- 28:958b71c4b92a
- Parent:
- 0:e8b8f36b4505
Sound level stored in EEPROM, sound output improved
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pokitto | 0:e8b8f36b4505 | 1 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 2 | /*! |
Pokitto | 0:e8b8f36b4505 | 3 | @file Synth_osc.h |
Pokitto | 0:e8b8f36b4505 | 4 | @author Jonne Valola |
Pokitto | 0:e8b8f36b4505 | 5 | |
Pokitto | 0:e8b8f36b4505 | 6 | @section LICENSE |
Pokitto | 0:e8b8f36b4505 | 7 | |
Pokitto | 0:e8b8f36b4505 | 8 | Pokitto development stage library |
Pokitto | 0:e8b8f36b4505 | 9 | Software License Agreement |
Pokitto | 0:e8b8f36b4505 | 10 | |
Pokitto | 0:e8b8f36b4505 | 11 | Copyright (c) 2015, Jonne Valola ("Author") |
Pokitto | 0:e8b8f36b4505 | 12 | All rights reserved. |
Pokitto | 0:e8b8f36b4505 | 13 | |
Pokitto | 0:e8b8f36b4505 | 14 | This library is intended solely for the purpose of Pokitto development. |
Pokitto | 0:e8b8f36b4505 | 15 | |
Pokitto | 0:e8b8f36b4505 | 16 | Redistribution and use in source and binary forms, with or without |
Pokitto | 0:e8b8f36b4505 | 17 | modification requires written permission from Author. |
Pokitto | 0:e8b8f36b4505 | 18 | */ |
Pokitto | 0:e8b8f36b4505 | 19 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 20 | |
Pokitto | 0:e8b8f36b4505 | 21 | #ifndef SYNTH_OSC_H |
Pokitto | 0:e8b8f36b4505 | 22 | #define SYNTH_OSC_H |
Pokitto | 0:e8b8f36b4505 | 23 | |
Pokitto | 0:e8b8f36b4505 | 24 | #include "Pokitto.h" |
Pokitto | 0:e8b8f36b4505 | 25 | |
Pokitto | 0:e8b8f36b4505 | 26 | typedef uint8_t byte; |
Pokitto | 0:e8b8f36b4505 | 27 | |
Pokitto | 0:e8b8f36b4505 | 28 | struct OSC { |
Pokitto | 0:e8b8f36b4505 | 29 | byte on; |
Pokitto | 0:e8b8f36b4505 | 30 | byte wave; |
Pokitto | 0:e8b8f36b4505 | 31 | byte loop; |
Pokitto | 0:e8b8f36b4505 | 32 | byte echo; |
Pokitto | 0:e8b8f36b4505 | 33 | byte echodiv; |
Pokitto | 0:e8b8f36b4505 | 34 | byte adsr; |
Pokitto | 0:e8b8f36b4505 | 35 | byte tonic; |
Pokitto | 0:e8b8f36b4505 | 36 | |
Pokitto | 0:e8b8f36b4505 | 37 | uint16_t count; |
Pokitto | 0:e8b8f36b4505 | 38 | |
Pokitto | 0:e8b8f36b4505 | 39 | uint16_t vol; |
Pokitto | 0:e8b8f36b4505 | 40 | uint16_t cinc; // how much to add per cycle |
Pokitto | 0:e8b8f36b4505 | 41 | uint16_t output; // output is stored as 16 bit value and shifted before its put in OCR2B |
Pokitto | 0:e8b8f36b4505 | 42 | |
Pokitto | 0:e8b8f36b4505 | 43 | uint8_t adsrphase; |
Pokitto | 0:e8b8f36b4505 | 44 | uint16_t adsrvol; |
Pokitto | 0:e8b8f36b4505 | 45 | uint16_t attack; // Attack change |
Pokitto | 0:e8b8f36b4505 | 46 | uint16_t decay; // Attack change |
Pokitto | 0:e8b8f36b4505 | 47 | uint16_t sustain; // Attack change |
Pokitto | 0:e8b8f36b4505 | 48 | uint16_t release; // Attack change |
Pokitto | 0:e8b8f36b4505 | 49 | |
Pokitto | 0:e8b8f36b4505 | 50 | int16_t pitchbend; // bends cycle counter (more is higher pitch) |
Pokitto | 0:e8b8f36b4505 | 51 | int16_t maxbend; // maximum bend before stopping |
Pokitto | 0:e8b8f36b4505 | 52 | int16_t bendrate; // how much to bend by every cycle |
Pokitto | 0:e8b8f36b4505 | 53 | |
Pokitto | 0:e8b8f36b4505 | 54 | uint8_t vibrate; |
Pokitto | 0:e8b8f36b4505 | 55 | uint8_t arpmode; |
Pokitto | 0:e8b8f36b4505 | 56 | uint8_t arpspeed; |
Pokitto | 0:e8b8f36b4505 | 57 | uint8_t arpstep; |
Pokitto | 0:e8b8f36b4505 | 58 | uint8_t overdrive; |
Pokitto | 0:e8b8f36b4505 | 59 | uint8_t kick; |
Pokitto | 0:e8b8f36b4505 | 60 | |
Pokitto | 0:e8b8f36b4505 | 61 | uint32_t duration; |
Pokitto | 0:e8b8f36b4505 | 62 | }; |
Pokitto | 0:e8b8f36b4505 | 63 | |
Pokitto | 0:e8b8f36b4505 | 64 | |
Pokitto | 0:e8b8f36b4505 | 65 | |
Pokitto | 0:e8b8f36b4505 | 66 | #endif // SYNTH_OSC_H |
Pokitto | 0:e8b8f36b4505 | 67 |