PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)

Dependents:   Sensitive

Fork of PokittoLib by Jonne Valola

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Synth.h Source File

Synth.h

Go to the documentation of this file.
00001 /**************************************************************************/
00002 /*!
00003     @file     Synth.h
00004     @author   Jonne Valola
00005 
00006     @section LICENSE
00007 
00008     Pokitto development stage library
00009     Software License Agreement
00010 
00011     Copyright (c) 2015, Jonne Valola ("Author")
00012     All rights reserved.
00013 
00014     This library is intended solely for the purpose of Pokitto development.
00015 
00016     Redistribution and use in source and binary forms, with or without
00017     modification requires written permission from Author.
00018 */
00019 /**************************************************************************/
00020 
00021 #ifndef SYNTH_H
00022 #define SYNTH_H
00023 
00024 #include "Synth_osc.h "
00025 #include "Synth_song.h "
00026 
00027 /* PROPER WAY
00028 void f() {}
00029 
00030 int main()
00031 {
00032     using FunctionPtr = void (*)();
00033 
00034     FunctionPtr ptr = f;
00035 }
00036 */
00037 
00038 #ifndef boolean
00039 typedef bool boolean;
00040 #endif
00041 
00042 //extern void fakeISR(); // was defined in Rboy_soundsim.h
00043 
00044 typedef void (*waveFunction)(OSC*);
00045 typedef void (*envFunction)(OSC*);
00046 typedef void (*mixFunction)();
00047 
00048 extern waveFunction Farr [];
00049 extern envFunction Earr [];
00050 extern mixFunction Marr []; // counts down
00051 extern mixFunction HWMarr []; // counts down
00052 /** COMMON TO BOTH HW AND SIM SOUND OUTPUT **/
00053 
00054 #define RBTRACKER_VERSION 0.03f
00055 
00056 #define WOFF     0
00057 #define WSQUARE  1
00058 #define WSAW     2
00059 #define WTRI     3
00060 #define WNOISE   4
00061 #define WSAMPLE  5
00062 #define WPNOISE  5
00063 
00064 #define OVERDRIVE 4
00065 
00066 #define ARPSTEPMAX 4 // was 5
00067 #define PATTERNLENGTH 64
00068 #define MAXPATTERNS 10
00069 #define MAXBLOCKS 30 // 10 *3
00070 
00071 #define VOLTICK 5
00072 #define ARPTICK 50 // 150 // was 200
00073 
00074 #define NUMWAVES 5
00075 #define NUMENVELOPES 3
00076 #define NUMMIXES 4
00077 
00078 extern void getNoteString(char *, uint8_t);
00079 
00080 extern void playNote(uint8_t,uint8_t,uint8_t);
00081 extern void makeSampleInstruments();
00082 
00083 extern void setPitch(int);
00084 extern void setWave(int);
00085 extern void setVolume(int);
00086 extern void initAudio();
00087 extern void testOsc();
00088 extern void terminateSound();
00089 extern void killSound();
00090 extern void startSound();
00091 extern void stopSound();
00092 extern void updatePlayback(); // from flash
00093 extern void updatePlaybackSD(uint8_t); // from SD
00094 extern void initStreams(uint8_t);
00095 extern void emptyOscillators();
00096 extern void emptyPatches();
00097 extern void emptyBlocks();
00098 extern void emptySong();
00099 extern int openSongFromSD(char *);
00100 extern void writeChunkToSD(uint8_t *);
00101 extern void readChunkFromSD(uint8_t *);
00102 
00103 
00104 extern boolean playing, track1on, track2on, track3on, tableRefresh;
00105 extern uint16_t playerpos;
00106 extern uint16_t samplespertick, notetick;
00107 extern long samplesperpattern;
00108 
00109 extern long readindex, writeindex;
00110 extern uint8_t tick, sequencepos;
00111 
00112 extern SONG song;
00113 extern OSC osc1,osc2,osc3;
00114 extern OSC patch[];
00115 extern BLOCK block[]; // array of blocks
00116 
00117 #define MAX_ARPMODE 16
00118 
00119 extern int8_t arptable[][5];
00120 
00121 extern uint16_t freqs[];
00122 extern uint16_t cincs[];
00123 
00124 extern uint8_t xorshift8();
00125 extern uint16_t xorshift16();
00126 
00127 extern uint16_t noiseval;
00128 
00129 extern void setOSC(OSC*,byte, byte, byte, byte, byte,
00130             uint8_t, uint8_t,
00131             uint16_t, uint16_t, uint16_t, uint16_t,
00132             int16_t, int16_t, uint8_t, uint8_t, uint8_t);
00133 
00134 extern void setOSC(OSC*,byte,byte,uint16_t, uint8_t, uint32_t);
00135 
00136 extern void waveoff(OSC*);
00137 #endif // SYNTH_H
00138