PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)
Dependents: YATTT sd_map_test cPong SnowDemo ... more
Synth.h
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 00028 /* PROPER WAY 00029 void f() {} 00030 00031 int main() 00032 { 00033 using FunctionPtr = void (*)(); 00034 00035 FunctionPtr ptr = f; 00036 } 00037 */ 00038 00039 #define OPT_ADSR 1 00040 #define OPT_LOOP 2 00041 #define OPT_ECHO 4 00042 #define OPT_OVERDRIVE 8 00043 #define OPT_NORMALIZE 0x10 00044 00045 #define OVERDRIVE 4 00046 00047 //extern void fakeISR(); // was defined in Rboy_soundsim.h 00048 00049 typedef void (*waveFunction)(OSC*); 00050 typedef void (*envFunction)(OSC*); 00051 typedef void (*mixFunction)(); 00052 typedef void (*streamsFunction)(); 00053 00054 extern waveFunction Farr []; 00055 extern envFunction Earr []; 00056 extern mixFunction Marr []; // counts down 00057 extern mixFunction HWMarr []; // counts down 00058 /** COMMON TO BOTH HW AND SIM SOUND OUTPUT **/ 00059 00060 #define RBTRACKER_VERSION 0.03f 00061 00062 #define WOFF 0 00063 #define WSQUARE 1 00064 #define WSAW 2 00065 #define WTRI 3 00066 #define WNOISE 4 00067 #define WSAMPLE 5 00068 #define WPNOISE 5 00069 00070 #define OVERDRIVE 4 00071 00072 #define ARPSTEPMAX 4 // was 5 00073 #define PATTERNLENGTH 64 00074 #define MAXPATTERNS 10 00075 00076 #ifdef PROJ_SYNTH_MAXBLOCKS 00077 #define MAXBLOCKS PROJ_SYNTH_MAXBLOCKS 00078 #else 00079 #define MAXBLOCKS 30 // 10 *3 00080 #endif 00081 00082 #ifdef PROJ_SYNTH_MAXPATCHES 00083 #define MAXPATCHES PROJ_SYNTH_MAXPATCHES 00084 #else 00085 #define MAXPATCHES 15 00086 #endif 00087 00088 #define VOLTICK POK_AUD_FREQ/8820 //was 5 00089 #define ARPTICK POK_AUD_FREQ/441 // 150 // was 200 00090 00091 #define NUMWAVES 5 00092 #define NUMENVELOPES 3 00093 #define NUMMIXES 4 00094 00095 extern void getNoteString(char *, uint8_t); 00096 00097 extern void playNote(uint8_t,uint8_t,uint8_t); 00098 extern void makeSampleInstruments(); 00099 00100 extern void setPitch(int); 00101 extern void setWave(int); 00102 extern void setVolume(int); 00103 extern void initAudio(); 00104 extern void testOsc(); 00105 extern void terminateSound(); 00106 extern void killSound(); 00107 extern void startSound(); 00108 extern void stopSound(); 00109 extern void updatePlayback(); // from flash 00110 extern void updatePlaybackSD(uint8_t); // from SD 00111 extern void initStreams(uint8_t); 00112 extern void emptyOscillators(); 00113 extern void emptyPatches(); 00114 extern void emptyBlocks(); 00115 extern void emptySong(); 00116 extern int openSongFromSD(char *); 00117 extern void writeChunkToSD(uint8_t *); 00118 extern void readChunkFromSD(uint8_t *); 00119 extern void registerStreamsCallback(streamsFunction); 00120 extern streamsFunction streamCallbackPtr; 00121 00122 extern bool playing, track1on, track2on, track3on, tableRefresh; 00123 extern uint16_t playerpos; 00124 extern uint16_t samplespertick, notetick; 00125 extern long samplesperpattern; 00126 00127 extern long readindex, writeindex; 00128 extern uint8_t tick, sequencepos; 00129 00130 extern SONG song; 00131 extern OSC osc1,osc2,osc3; 00132 extern OSC patch[]; 00133 extern BLOCK block[]; // array of blocks 00134 00135 #define MAX_ARPMODE 16 00136 #define MAX_WAVETYPES 6 00137 00138 extern int8_t arptable[][5]; 00139 00140 extern uint16_t freqs[]; 00141 //extern uint16_t cincs[]; 00142 extern uint32_t cincs[]; 00143 00144 extern uint8_t xorshift8(); 00145 extern uint16_t xorshift16(); 00146 00147 extern uint16_t noiseval; 00148 00149 extern void setOSC(OSC*,byte, byte, byte, byte, byte, 00150 uint8_t, uint16_t, 00151 uint16_t, uint16_t, uint16_t, uint16_t, 00152 int16_t, int16_t, uint8_t, uint8_t, uint8_t); 00153 00154 extern void setOSC(OSC*,byte,byte,uint16_t, uint8_t, uint32_t); 00155 00156 extern void waveoff(OSC*); 00157 #endif // SYNTH_H 00158 00159
Generated on Tue Jul 12 2022 11:20:40 by 1.7.2