/*Copyright (C) 2014, Jeffrey Lim. All Rights Reserved. Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY ANDFITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORBE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, ORCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OFSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESSINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER INCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGE.*/ #include "it_struc.h" // temporary shit to make this work --GM it_engine *ITEngineNew(void){ int i; it_engine *ite = calloc(sizeof(it_engine), 1); // TODO: initialise properly for(i = 0; i < 200; i++) ite->pat[i] = NULL; for(i = 0; i < 100; i++) ite->SamplePointer[i] = NULL; ite->NumChannels = 256; // shifting this here so it doesn't try to use a real unpacked pattern --GM ite->CurrentEditPattern = 199; ite->PatternNumber = 199; ite->CmdLineNumChannels = -1; return ite;} it_drvdata *drv_oss_init(it_engine *ite);it_drvdata *drv_sdl_init(it_engine *ite); it_drvdata *DriverSys_GetByName(it_engine *ite, const char *fname){ printf("drv: %s\n", fname); if(!strcmp(fname, "oss")) return drv_oss_init(ite); if(!strcmp(fname, "sdl")) return drv_sdl_init(ite); return NULL;} it_pattern *PE_GetCurrentPattern(it_engine *ite, uint16_t *patnum, uint16_t *patrow){ *patnum = ite->PatternNumber; *patrow = ite->MaxRow + 1; return NULL; // actually meant to return UNPACKED pattern data area --GM} uint16_t PE_GetLastInstrument(it_engine *ite){ return ite->LastInstrument-1;} //// Functions for playing control// Music_PlaySong........ parameters, AX = order// Music_Stop............ parameters, None// Music_PlayPattern..... parameters, AX = pattern, BX = number of rows, CX = row// Music_ToggleChannel... parameters, AX = channel// Music_SoloChannel..... parameters, AX = channel// const int8_t FineSineData[] = { 0, 2, 3, 5, 6, 8, 9, 11, 12, 14, 16, 17, 19, 20, 22, 23, 24, 26, 27, 29, 30, 32, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 59, 60, 60, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 60, 60, 59, 59, 58, 57, 56, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 39, 38, 37, 36, 34, 33, 32, 30, 29, 27, 26, 24, 23, 22, 20, 19, 17, 16, 14, 12, 11, 9, 8, 6, 5, 3, 2, 0, -2, -3, -5, -6, -8, -9,-11,-12,-14,-16,-17,-19,-20,-22,-23, -24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42,-43,-44, -45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,-56,-57,-58,-59, -59,-60,-60,-61,-61,-62,-62,-62,-63,-63,-63,-64,-64,-64,-64,-64, -64,-64,-64,-64,-64,-64,-63,-63,-63,-62,-62,-62,-61,-61,-60,-60, -59,-59,-58,-57,-56,-56,-55,-54,-53,-52,-51,-50,-49,-48,-47,-46, -45,-44,-43,-42,-41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26, -24,-23,-22,-20,-19,-17,-16,-14,-12,-11, -9, -8, -6, -5, -3, -2,}; const int8_t FineRampDownData[] = { 64, 63, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 38, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 17, 17, 16, 16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6, -7, -7, -8, -8, -9, -9,-10,-10,-11,-11,-12,-12,-13,-13,-14,-14,-15,-15,-16, -16,-17,-17,-18,-18,-19,-19,-20,-20,-21,-21,-22,-22,-23,-23,-24, -24,-25,-25,-26,-26,-27,-27,-28,-28,-29,-29,-30,-30,-31,-31,-32, -32,-33,-33,-34,-34,-35,-35,-36,-36,-37,-37,-38,-38,-39,-39,-40, -40,-41,-41,-42,-42,-43,-43,-44,-44,-45,-45,-46,-46,-47,-47,-48, -48,-49,-49,-50,-50,-51,-51,-52,-52,-53,-53,-54,-54,-55,-55,-56, -56,-57,-57,-58,-58,-59,-59,-60,-60,-61,-61,-62,-62,-63,-63,-64,}; const int8_t FineSquareWave[] = { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; const uint8_t EmptyPattern[] = { 64, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; // Zero globals. const float PitchDepthConstant = 98304.0f; // TODO: Turn these two into proper structsuint8_t InstrumentHeader[] = { 'I', 'M', 'P', 'I', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 128, 32+128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, 25, 0, 26, 0, 27, 0, 28, 0, 29, 0, 30, 0, 31, 0, 32, 0, 33, 0, 34, 0, 35, 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, 45, 0, 46, 0, 47, 0, 48, 0, 49, 0, 50, 0, 51, 0, 52, 0, 53, 0, 54, 0, 55, 0, 56, 0, 57, 0, 58, 0, 59, 0, 60, 0, 61, 0, 62, 0, 63, 0, 64, 0, 65, 0, 66, 0, 67, 0, 68, 0, 69, 0, 70, 0, 71, 0, 72, 0, 73, 0, 74, 0, 75, 0, 76, 0, 77, 0, 78, 0, 79, 0, 80, 0, 81, 0, 82, 0, 83, 0, 84, 0, 85, 0, 86, 0, 87, 0, 88, 0, 89, 0, 90, 0, 91, 0, 92, 0, 93, 0, 94, 0, 95, 0, 96, 0, 97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0, 103, 0, 104, 0, 105, 0, 106, 0, 107, 0, 108, 0, 109, 0, 110, 0, 111, 0, 112, 0, 113, 0, 114, 0, 115, 0, 116, 0, 117, 0, 118, 0, 119, 0, 0, 2, 0, 0, 0, 0, 64, 0, 0, 64, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; uint8_t SampleHeader[80] = { 'I', 'M', 'P', 'S', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (8363&0xFF), (8363>>8), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; uint8_t MIDIPitchSendString[] = {0x65, 0x00, 0x64, 0x00, 0x06}; const char *PrepareSamplesMsg = "Preparing Samples";const char *ReverseMsg = "Left/right outputs reversed";const char *NoSoundCardMsg = " No sound card detected";const char *MIDIConfigFileName = "ITMIDI.CFG"; const char *OrderUpdateEnabledMsg = "Order list unlocked";const char *OrderUpdateDisabledMsg = "Order list locked"; const char *UnsoloMsg = "Solo disabled";const char *SoloSampleMsg = "Solo sample \375D";const char *SoloInstrumentMsg = "Solo instrument \375D"; #ifdef DEBUG const char *LoadDriverMessage = "Loading driver:";const char *UnableToReadFileMessage = "Unable to read file";const char *DetectingMessage = "Testing driver";//uint16_t ScreenOffset = 0; #endif const char *PleaseWaitMsg = "Please Wait..."; const char *PCSpeakerDriver = "ITPCSPKR.DRV";const char *SBDriver = "ITSB.DRV";const char *SB2Driver = "ITSB2.DRV";const char *SBProDriver = "ITSBPRO.DRV";const char *SB16Driver = "ITSB16.DRV";const char *AWE32Driver = "ITAWE32.DRV";const char *GUSDriver = "ITGUS.DRV";const char *InterwaveDriver = "ITIW.DRV";const char *PASDriver = "ITPAS.DRV";const char *PAS16Driver = "ITPAS16.DRV";const char *WSSDriver = "ITWSS.DRV";const char *ESSDriver = "ITES1868.DRV";const char *MIDIDriver = "ITMPU401.DRV";const char *EWSCodecDriver = "ITEWSCOD.DRV";const char *VIVOCodecDriver = "ITVIVO.DRV";const char *ST97PCICodecDriver = "ITSTCODE.DRV";const char *WAVDriver = "ITWAV.DRV";const char *MIDDriver = "ITMID.DRV";const char *VSoundMMXDriver = "ITVSOUND.MMX";const char *VSoundDriver = "ITVSOUND.DRV";const char *DefaultDriver = "ITSOUND.DRV"; #if 0const char *DriverNameTable[] = { NULL, "ITPAS16.DRV", "ITSB16.DRV", "ITIW.DRV", "ITGUS.DRV", "ITAWE32.DRV", "ITSBPRO.DRV", "ITSB.DRV", "ITPCSPKR.DRV", "ITSB2.DRV", "ITPAS.DRV", "ITWAV.DRV", "ITWSS.DRV", "ITES1868.DRV", "ITMPU401.DRV", "ITEWSCOD.DRV", "ITVIVO.DRV", "ITSTCODE.DRV", "ITMID.DRV", "ITSOUND.DRV", "ITVSOUND.MMX", "ITVSOUND.DRV", /* PAS16Driver, SB16Driver, InterwaveDriver, GUSDriver, AWE32Driver, SBProDriver, SBDriver, PCSpeakerDriver, SB2Driver, PASDriver, WAVDriver, WSSDriver, ESSDriver, MIDIDriver, EWSCodecDriver, VIVOCodecDriver, ST97PCICodecDriver, MIDDriver, DefaultDriver, VSoundMMXDriver, VSoundDriver, */}; const uint16_t DriverDetectionOrder[] = { 19, 20, 21, 17, 16, 15, 13, 1, 10, 2, 12, 3, 4, 5, 6, 9, 7, 8, 0xFFFF,}; const uint16_t DriverSoundCard[] = { 0, 8, 7, 9, 6, 2, 5, 4, 3, 10, 1, 12, 13, 15, 16, 0, 0, 0, 0, 14, 11, 18, 0xFFFF,};#elseconst char *DriverNameTable[] = { NULL, "oss", "sdl", // (DONE) I hope to get SDL audio working at some point. // Possibly also a winmm driver for Windows. // JACK will definitely be there, too! Will use ezjack for that.}; const uint16_t DriverDetectionOrder[] = { 2, 1, 0, 0xFFFF,}; const uint16_t DriverSoundCard[] = { 0, 0, 1, 0xFFFF,};#endif // TODO: translate this properly!const uint32_t PitchTable[] = {2048+((0)<<16), 2170+((0)<<16), 2299+((0)<<16), 2435+((0)<<16), 2580+((0)<<16), 2734+((0)<<16),2896+((0)<<16), 3069+((0)<<16), 3251+((0)<<16), 3444+((0)<<16), 3649+((0)<<16), 3866+((0)<<16), 4096+((0)<<16), 4340+((0)<<16), 4598+((0)<<16), 4871+((0)<<16), 5161+((0)<<16), 5468+((0)<<16),5793+((0)<<16), 6137+((0)<<16), 6502+((0)<<16), 6889+((0)<<16), 7298+((0)<<16), 7732+((0)<<16), 8192+((0)<<16), 8679+((0)<<16), 9195+((0)<<16), 9742+((0)<<16), 10321+((0)<<16), 10935+((0)<<16),11585+((0)<<16), 12274+((0)<<16), 13004+((0)<<16), 13777+((0)<<16), 14596+((0)<<16), 15464+((0)<<16), 16384+((0)<<16), 17358+((0)<<16), 18390+((0)<<16), 19484+((0)<<16), 20643+((0)<<16), 21870+((0)<<16),23170+((0)<<16), 24548+((0)<<16), 26008+((0)<<16), 27554+((0)<<16), 29193+((0)<<16), 30929+((0)<<16), 32768+((0)<<16), 34716+((0)<<16), 36781+((0)<<16), 38968+((0)<<16), 41285+((0)<<16), 43740+((0)<<16),46341+((0)<<16), 49097+((0)<<16), 52016+((0)<<16), 55109+((0)<<16), 58386+((0)<<16), 61858+((0)<<16), 0+((1)<<16), 3897+((1)<<16), 8026+((1)<<16), 12400+((1)<<16), 17034+((1)<<16), 21944+((1)<<16),27146+((1)<<16), 32657+((1)<<16), 38496+((1)<<16), 44682+((1)<<16), 51236+((1)<<16), 58179+((1)<<16), 0+((2)<<16), 7794+((2)<<16), 16051+((2)<<16), 24800+((2)<<16), 34068+((2)<<16), 43888+((2)<<16),54292+((2)<<16), 65314+((2)<<16), 11456+((3)<<16), 23828+((3)<<16), 36936+((3)<<16), 50823+((3)<<16), 0+((4)<<16), 15588+((4)<<16), 32103+((4)<<16), 49600+((4)<<16), 2601+((5)<<16), 22240+((5)<<16),43048+((5)<<16), 65092+((5)<<16), 22912+((6)<<16), 47656+((6)<<16), 8336+((7)<<16), 36110+((7)<<16), 0+((8)<<16), 31176+((8)<<16), 64205+((8)<<16), 33663+((9)<<16), 5201+((10)<<16), 44481+((10)<<16),20559+((11)<<16), 64648+((11)<<16), 45823+((12)<<16), 29776+((13)<<16), 16671+((14)<<16), 6684+((15)<<16), 0+((16)<<16), 62352+((16)<<16), 62875+((17)<<16), 1790+((19)<<16), 10403+((20)<<16), 23425+((21)<<16),41118+((22)<<16), 63761+((23)<<16), 26111+((25)<<16), 59552+((26)<<16), 33342+((28)<<16), 13368+((30)<<16), // Pitch extention for loading some XIs, 0+((32)<<16), 59167+((33)<<16), 60214+((35)<<16), 3580+((38)<<16), 20806+((40)<<16), 46850+((42)<<16),16701+((45)<<16), 61986+((47)<<16), 52221+((50)<<16), 53567+((53)<<16), 1148+((57)<<16), 26736+((60)<<16),}; #if USEFPUCODE uint8_t FPSave[128]; // note, init this to 0 const float Const_14317456 = 14317456.0;const float Const1_On_768 = 1.0/768.0; //Const1_On_768 DD 3AAAAAABhuint16_t SlideValue = 0;uint16_t NewControlWord = 0x7F; #else const uint16_t FineLinearSlideUpTable16[] = { 0, 1, 59, 1, 118, 1, 178, 1, 237, 1, // 0->4 296, 1, 356, 1, 415, 1, 475, 1, 535, 1, // 5->9 594, 1, 654, 1, 714, 1, 773, 1, 833, 1, // 10->14 893, 1, // 15};const uint32_t *FineLinearSlideUpTable = (const uint32_t *)FineLinearSlideUpTable16; const uint16_t LinearSlideUpTable16[] = { // Value = 2^(Val/192) 0, 1, 237, 1, 475, 1, 714, 1, 953, 1, // 0->4 1194, 1, 1435, 1, 1677, 1, 1920, 1, 2164, 1, // 5->9 2409, 1, 2655, 1, 2902, 1, 3149, 1, 3397, 1, // 10->14 3647, 1, 3897, 1, 4148, 1, 4400, 1, 4653, 1, // 15->19 4907, 1, 5157, 1, 5417, 1, 5674, 1, 5932, 1, // 20->24 6190, 1, 6449, 1, 6710, 1, 6971, 1, 7233, 1, // 25->29 7496, 1, 7761, 1, 8026, 1, 8292, 1, 8559, 1, // 30->34 8027, 1, 9096, 1, 9366, 1, 9636, 1, 9908, 1, // 35->39 10181, 1, 10455, 1, 10730, 1, 11006, 1, 11283,1, // 40->44 11560, 1, 11839, 1, 12119, 1, 12400, 1, 12682,1, // 45->49 12965, 1, 13249, 1, 13533, 1, 13819, 1, 14106,1, // 50->54 14394, 1, 14684, 1, 14974, 1, 15265, 1, 15557,1, // 55->59 15850, 1, 16145, 1, 16440, 1, 16737, 1, 17034,1, // 60->64 17333, 1, 17633, 1, 17933, 1, 18235, 1, 18538,1, // 65->69 18842, 1, 19147, 1, 19454, 1, 19761, 1, 20070,1, // 70->74 20379, 1, 20690, 1, 21002, 1, 21315, 1, 21629,1, // 75->79 21944, 1, 22260, 1, 22578, 1, 22897, 1, 23216,1, // 80->84 23537, 1, 23860, 1, 24183, 1, 24507, 1, 24833,1, // 85->89 25160, 1, 25488, 1, 25817, 1, 26148, 1, 26479,1, // 90->94 26812, 1, 27146, 1, 27481, 1, 27818, 1, 28155,1, // 95->99 28494, 1, 28834, 1, 29175, 1, 29518, 1, 29862,1, // 100->104 30207, 1, 30553, 1, 30900, 1, 31248, 1, 31599,1, // 105->109 31951, 1, 32303, 1, 32657, 1, 33012, 1, 33369,1, // 110->114 33726, 1, 34085, 1, 34446, 1, 34807, 1, 35170,1, // 115->119 35534, 1, 35900, 1, 36267, 1, 36635, 1, 37004,1, // 120->124 37375, 1, 37747, 1, 38121, 1, 38496, 1, 38872,1, // 125->129 39250, 1, 39629, 1, 40009, 1, 40391, 1, 40774,1, // 130->134 41158, 1, 41544, 1, 41932, 1, 42320, 1, 42710,1, // 135->139 43102, 1, 43495, 1, 43889, 1, 44285, 1, 44682,1, // 140->144 45081, 1, 45481, 1, 45882, 1, 46285, 1, 46690,1, // 145->149 47095, 1, 47503, 1, 47917, 1, 48322, 1, 48734,1, // 150->154 49147, 1, 49562, 1, 49978, 1, 50396, 1, 50815,1, // 155->159 51236, 1, 51658, 1, 52082, 1, 52507, 1, 52934,1, // 160->164 53363, 1, 53793, 1, 54224, 1, 54658, 1, 55092,1, // 165->169 55529, 1, 55966, 1, 56406, 1, 56847, 1, 57289,1, // 170->174 57734, 1, 58179, 1, 58627, 1, 59076, 1, 59527,1, // 175->179 59979, 1, 60433, 1, 60889, 1, 61346, 1, 61805,1, // 180->184 62265, 1, 62727, 1, 63191, 1, 63657, 1, 64124,1, // 185->189 64593, 1, 65064, 1, 0, 2, 474, 2, 950, 2, // 190->194 1427, 2, 1906, 2, 2387, 2, 2870, 2, 3355, 2, // 195->199 3841, 2, 4327, 2, 4818, 2, 5310, 2, 5803, 2, // 200->204 6298, 2, 6795, 2, 7294, 2, 7794, 2, 8296, 2, // 205->209 8800, 2, 9306, 2, 9814, 2, 10323, 2, 10835,2, // 210->214 11348, 2, 11863, 2, 12380, 2, 12899, 2, 13419,2, // 215->219 13942, 2, 14467, 2, 14993, 2, 15521, 2, 16051,2, // 220->224 16583, 2, 17117, 2, 17653, 2, 18191, 2, 18731,2, // 225->229 19273, 2, 19817, 2, 20362, 2, 20910, 2, 21460,2, // 230->234 22011, 2, 22565, 2, 23121, 2, 23678, 2, 24238,2, // 235->239 24800, 2, 25363, 2, 25929, 2, 25497, 2, 27067,2, // 240->244 27639, 2, 28213, 2, 28789, 2, 29367, 2, 29947,2, // 245->249 30530, 2, 31114, 2, 31701, 2, 32289, 2, 32880,2, // 250->254 33473, 2, 34068, 2, // 255->256};const uint32_t *LinearSlideUpTable = (const uint32_t *)LinearSlideUpTable16; const uint16_t FineLinearSlideDownTable[] = { 65535, 65477, 65418, 65359, 65300, 65241, 65182, 65359, // 0->7 65065, 65006, 64947, 64888, 64830, 64772, 64713, 64645, // 8->15}; const uint16_t LinearSlideDownTable[] = { 65535, 65300, 65065, 64830, 64596, 64364, 64132, 63901, // 0->7 63670, 63441, 63212, 62984, 62757, 62531, 62306, 62081, // 8->15 61858, 61635, 61413, 61191, 60971, 60751, 60532, 60314, // 16->23 60097, 59880, 59664, 59449, 59235, 59022, 58809, 58597, // 24->31 58386, 58176, 57966, 57757, 57549, 57341, 57135, 56929, // 32->39 56724, 56519, 56316, 56113, 55911, 55709, 55508, 55308, // 40->47 55109, 54910, 54713, 54515, 54319, 54123, 53928, 53734, // 48->55 53540, 53347, 53155, 52963, 52773, 52582, 52393, 52204, // 56->63 52016, 51829, 51642, 51456, 51270, 51085, 50901, 50718, // 64->71 50535, 50353, 50172, 49991, 49811, 49631, 49452, 49274, // 72->79 49097, 48920, 48743, 48568, 48393, 48128, 48044, 47871, // 80->87 47699, 47527, 47356, 47185, 47015, 46846, 46677, 46509, // 88->95 46341, 46174, 46008, 45842, 45677, 45512, 45348, 45185, // 96->103 45022, 44859, 44698, 44537, 44376, 44216, 44057, 43898, //104->111 43740, 43582, 43425, 43269, 43113, 42958, 42803, 42649, //112->119 42495, 42342, 42189, 42037, 41886, 41735, 41584, 41434, //120->127 41285, 41136, 40988, 40840, 40639, 40566, 40400, 40253, //128->135 40110, 39965, 39821, 39678, 39535, 39392, 39250, 39109, //136->143 38968, 38828, 38688, 38548, 38409, 38271, 38133, 37996, //144->151 37859, 37722, 37586, 37451, 37316, 37181, 37047, 36914, //152->159 36781, 36648, 36516, 36385, 36254, 36123, 35993, 35863, //160->167 35734, 35605, 35477, 35349, 35221, 35095, 34968, 34842, //168->175 34716, 34591, 34467, 34343, 34219, 34095, 33973, 33850, //176->183 33728, 33607, 33486, 33365, 33245, 33125, 33005, 32887, //184->191 32768, 32650, 32532, 32415, 32298, 32182, 32066, 31950, //192->199 31835, 31720, 31606, 31492, 31379, 31266, 31153, 31041, //200->207 30929, 30817, 30706, 30596, 30485, 30376, 30226, 30157, //208->215 30048, 29940, 29832, 29725, 29618, 29511, 29405, 29299, //216->223 29193, 29088, 28983, 28879, 28774, 28671, 28567, 28464, //224->231 28362, 28260, 28158, 28056, 27955, 27855, 27754, 27654, //232->239 27554, 27455, 27356, 27258, 27159, 27062, 26964, 26867, //240->247 26770, 26674, 26577, 26482, 26386, 26291, 26196, 26102, //248->255 26008, // 256}; #endif /* USEFPUCODE */ void (*InitCommandTable[])(it_engine *ite, it_host *chn) = { InitNoCommand, InitCommandA, InitCommandB, InitCommandC, InitCommandD, InitCommandE, InitCommandF, InitCommandG, InitCommandH, InitCommandI, InitCommandJ, InitCommandK, InitCommandL, InitCommandM, InitCommandN, InitCommandO, InitCommandP, InitCommandQ, InitCommandR, InitCommandS, InitCommandT, InitCommandU, InitCommandV, InitCommandW, InitCommandX, InitCommandY, InitCommandZ, InitNoCommand, InitNoCommand, InitNoCommand,Lines 1–500 of 4781. Load more
/* Copyright (C) 2014, Jeffrey Lim. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "it_struc.h" // temporary shit to make this work --GM it_engine *ITEngineNew(void) { int i; it_engine *ite = calloc(sizeof(it_engine), 1); // TODO: initialise properly for(i = 0; i < 200; i++) ite->pat[i] = NULL; for(i = 0; i < 100; i++) ite->SamplePointer[i] = NULL; ite->NumChannels = 256; // shifting this here so it doesn't try to use a real unpacked pattern --GM ite->CurrentEditPattern = 199; ite->PatternNumber = 199; ite->CmdLineNumChannels = -1; return ite; } it_drvdata *drv_oss_init(it_engine *ite); it_drvdata *drv_sdl_init(it_engine *ite); it_drvdata *DriverSys_GetByName(it_engine *ite, const char *fname) { printf("drv: %s\n", fname); if(!strcmp(fname, "oss")) return drv_oss_init(ite); if(!strcmp(fname, "sdl")) return drv_sdl_init(ite); return NULL; } it_pattern *PE_GetCurrentPattern(it_engine *ite, uint16_t *patnum, uint16_t *patrow) { *patnum = ite->PatternNumber; *patrow = ite->MaxRow + 1; return NULL; // actually meant to return UNPACKED pattern data area --GM } uint16_t PE_GetLastInstrument(it_engine *ite) { return ite->LastInstrument-1; } // // Functions for playing control // Music_PlaySong........ parameters, AX = order // Music_Stop............ parameters, None // Music_PlayPattern..... parameters, AX = pattern, BX = number of rows, CX = row // Music_ToggleChannel... parameters, AX = channel // Music_SoloChannel..... parameters, AX = channel // const int8_t FineSineData[] = { 0, 2, 3, 5, 6, 8, 9, 11, 12, 14, 16, 17, 19, 20, 22, 23, 24, 26, 27, 29, 30, 32, 33, 34, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 59, 60, 60, 61, 61, 62, 62, 62, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 63, 63, 62, 62, 62, 61, 61, 60, 60, 59, 59, 58, 57, 56, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 39, 38, 37, 36, 34, 33, 32, 30, 29, 27, 26, 24, 23, 22, 20, 19, 17, 16, 14, 12, 11, 9, 8, 6, 5, 3, 2, 0, -2, -3, -5, -6, -8, -9,-11,-12,-14,-16,-17,-19,-20,-22,-23, -24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42,-43,-44, -45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,-56,-57,-58,-59, -59,-60,-60,-61,-61,-62,-62,-62,-63,-63,-63,-64,-64,-64,-64,-64, -64,-64,-64,-64,-64,-64,-63,-63,-63,-62,-62,-62,-61,-61,-60,-60, -59,-59,-58,-57,-56,-56,-55,-54,-53,-52,-51,-50,-49,-48,-47,-46, -45,-44,-43,-42,-41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26, -24,-23,-22,-20,-19,-17,-16,-14,-12,-11, -9, -8, -6, -5, -3, -2, }; const int8_t FineRampDownData[] = { 64, 63, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 38, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 17, 17, 16, 16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6, -7, -7, -8, -8, -9, -9,-10,-10,-11,-11,-12,-12,-13,-13,-14,-14,-15,-15,-16, -16,-17,-17,-18,-18,-19,-19,-20,-20,-21,-21,-22,-22,-23,-23,-24, -24,-25,-25,-26,-26,-27,-27,-28,-28,-29,-29,-30,-30,-31,-31,-32, -32,-33,-33,-34,-34,-35,-35,-36,-36,-37,-37,-38,-38,-39,-39,-40, -40,-41,-41,-42,-42,-43,-43,-44,-44,-45,-45,-46,-46,-47,-47,-48, -48,-49,-49,-50,-50,-51,-51,-52,-52,-53,-53,-54,-54,-55,-55,-56, -56,-57,-57,-58,-58,-59,-59,-60,-60,-61,-61,-62,-62,-63,-63,-64, }; const int8_t FineSquareWave[] = { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; const uint8_t EmptyPattern[] = { 64, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; // Zero globals. const float PitchDepthConstant = 98304.0f; // TODO: Turn these two into proper structs uint8_t InstrumentHeader[] = { 'I', 'M', 'P', 'I', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 128, 32+128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, 25, 0, 26, 0, 27, 0, 28, 0, 29, 0, 30, 0, 31, 0, 32, 0, 33, 0, 34, 0, 35, 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, 45, 0, 46, 0, 47, 0, 48, 0, 49, 0, 50, 0, 51, 0, 52, 0, 53, 0, 54, 0, 55, 0, 56, 0, 57, 0, 58, 0, 59, 0, 60, 0, 61, 0, 62, 0, 63, 0, 64, 0, 65, 0, 66, 0, 67, 0, 68, 0, 69, 0, 70, 0, 71, 0, 72, 0, 73, 0, 74, 0, 75, 0, 76, 0, 77, 0, 78, 0, 79, 0, 80, 0, 81, 0, 82, 0, 83, 0, 84, 0, 85, 0, 86, 0, 87, 0, 88, 0, 89, 0, 90, 0, 91, 0, 92, 0, 93, 0, 94, 0, 95, 0, 96, 0, 97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0, 103, 0, 104, 0, 105, 0, 106, 0, 107, 0, 108, 0, 109, 0, 110, 0, 111, 0, 112, 0, 113, 0, 114, 0, 115, 0, 116, 0, 117, 0, 118, 0, 119, 0, 0, 2, 0, 0, 0, 0, 64, 0, 0, 64, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; uint8_t SampleHeader[80] = { 'I', 'M', 'P', 'S', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (8363&0xFF), (8363>>8), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; uint8_t MIDIPitchSendString[] = {0x65, 0x00, 0x64, 0x00, 0x06}; const char *PrepareSamplesMsg = "Preparing Samples"; const char *ReverseMsg = "Left/right outputs reversed"; const char *NoSoundCardMsg = " No sound card detected"; const char *MIDIConfigFileName = "ITMIDI.CFG"; const char *OrderUpdateEnabledMsg = "Order list unlocked"; const char *OrderUpdateDisabledMsg = "Order list locked"; const char *UnsoloMsg = "Solo disabled"; const char *SoloSampleMsg = "Solo sample \375D"; const char *SoloInstrumentMsg = "Solo instrument \375D"; #ifdef DEBUG const char *LoadDriverMessage = "Loading driver:"; const char *UnableToReadFileMessage = "Unable to read file"; const char *DetectingMessage = "Testing driver"; //uint16_t ScreenOffset = 0; #endif const char *PleaseWaitMsg = "Please Wait..."; const char *PCSpeakerDriver = "ITPCSPKR.DRV"; const char *SBDriver = "ITSB.DRV"; const char *SB2Driver = "ITSB2.DRV"; const char *SBProDriver = "ITSBPRO.DRV"; const char *SB16Driver = "ITSB16.DRV"; const char *AWE32Driver = "ITAWE32.DRV"; const char *GUSDriver = "ITGUS.DRV"; const char *InterwaveDriver = "ITIW.DRV"; const char *PASDriver = "ITPAS.DRV"; const char *PAS16Driver = "ITPAS16.DRV"; const char *WSSDriver = "ITWSS.DRV"; const char *ESSDriver = "ITES1868.DRV"; const char *MIDIDriver = "ITMPU401.DRV"; const char *EWSCodecDriver = "ITEWSCOD.DRV"; const char *VIVOCodecDriver = "ITVIVO.DRV"; const char *ST97PCICodecDriver = "ITSTCODE.DRV"; const char *WAVDriver = "ITWAV.DRV"; const char *MIDDriver = "ITMID.DRV"; const char *VSoundMMXDriver = "ITVSOUND.MMX"; const char *VSoundDriver = "ITVSOUND.DRV"; const char *DefaultDriver = "ITSOUND.DRV"; #if 0 const char *DriverNameTable[] = { NULL, "ITPAS16.DRV", "ITSB16.DRV", "ITIW.DRV", "ITGUS.DRV", "ITAWE32.DRV", "ITSBPRO.DRV", "ITSB.DRV", "ITPCSPKR.DRV", "ITSB2.DRV", "ITPAS.DRV", "ITWAV.DRV", "ITWSS.DRV", "ITES1868.DRV", "ITMPU401.DRV", "ITEWSCOD.DRV", "ITVIVO.DRV", "ITSTCODE.DRV", "ITMID.DRV", "ITSOUND.DRV", "ITVSOUND.MMX", "ITVSOUND.DRV", /* PAS16Driver, SB16Driver, InterwaveDriver, GUSDriver, AWE32Driver, SBProDriver, SBDriver, PCSpeakerDriver, SB2Driver, PASDriver, WAVDriver, WSSDriver, ESSDriver, MIDIDriver, EWSCodecDriver, VIVOCodecDriver, ST97PCICodecDriver, MIDDriver, DefaultDriver, VSoundMMXDriver, VSoundDriver, */ }; const uint16_t DriverDetectionOrder[] = { 19, 20, 21, 17, 16, 15, 13, 1, 10, 2, 12, 3, 4, 5, 6, 9, 7, 8, 0xFFFF, }; const uint16_t DriverSoundCard[] = { 0, 8, 7, 9, 6, 2, 5, 4, 3, 10, 1, 12, 13, 15, 16, 0, 0, 0, 0, 14, 11, 18, 0xFFFF, }; #else const char *DriverNameTable[] = { NULL, "oss", "sdl", // (DONE) I hope to get SDL audio working at some point. // Possibly also a winmm driver for Windows. // JACK will definitely be there, too! Will use ezjack for that. }; const uint16_t DriverDetectionOrder[] = { 2, 1, 0, 0xFFFF, }; const uint16_t DriverSoundCard[] = { 0, 0, 1, 0xFFFF, }; #endif // TODO: translate this properly! const uint32_t PitchTable[] = { 2048+((0)<<16), 2170+((0)<<16), 2299+((0)<<16), 2435+((0)<<16), 2580+((0)<<16), 2734+((0)<<16), 2896+((0)<<16), 3069+((0)<<16), 3251+((0)<<16), 3444+((0)<<16), 3649+((0)<<16), 3866+((0)<<16), 4096+((0)<<16), 4340+((0)<<16), 4598+((0)<<16), 4871+((0)<<16), 5161+((0)<<16), 5468+((0)<<16), 5793+((0)<<16), 6137+((0)<<16), 6502+((0)<<16), 6889+((0)<<16), 7298+((0)<<16), 7732+((0)<<16), 8192+((0)<<16), 8679+((0)<<16), 9195+((0)<<16), 9742+((0)<<16), 10321+((0)<<16), 10935+((0)<<16), 11585+((0)<<16), 12274+((0)<<16), 13004+((0)<<16), 13777+((0)<<16), 14596+((0)<<16), 15464+((0)<<16), 16384+((0)<<16), 17358+((0)<<16), 18390+((0)<<16), 19484+((0)<<16), 20643+((0)<<16), 21870+((0)<<16), 23170+((0)<<16), 24548+((0)<<16), 26008+((0)<<16), 27554+((0)<<16), 29193+((0)<<16), 30929+((0)<<16), 32768+((0)<<16), 34716+((0)<<16), 36781+((0)<<16), 38968+((0)<<16), 41285+((0)<<16), 43740+((0)<<16), 46341+((0)<<16), 49097+((0)<<16), 52016+((0)<<16), 55109+((0)<<16), 58386+((0)<<16), 61858+((0)<<16), 0+((1)<<16), 3897+((1)<<16), 8026+((1)<<16), 12400+((1)<<16), 17034+((1)<<16), 21944+((1)<<16), 27146+((1)<<16), 32657+((1)<<16), 38496+((1)<<16), 44682+((1)<<16), 51236+((1)<<16), 58179+((1)<<16), 0+((2)<<16), 7794+((2)<<16), 16051+((2)<<16), 24800+((2)<<16), 34068+((2)<<16), 43888+((2)<<16), 54292+((2)<<16), 65314+((2)<<16), 11456+((3)<<16), 23828+((3)<<16), 36936+((3)<<16), 50823+((3)<<16), 0+((4)<<16), 15588+((4)<<16), 32103+((4)<<16), 49600+((4)<<16), 2601+((5)<<16), 22240+((5)<<16), 43048+((5)<<16), 65092+((5)<<16), 22912+((6)<<16), 47656+((6)<<16), 8336+((7)<<16), 36110+((7)<<16), 0+((8)<<16), 31176+((8)<<16), 64205+((8)<<16), 33663+((9)<<16), 5201+((10)<<16), 44481+((10)<<16), 20559+((11)<<16), 64648+((11)<<16), 45823+((12)<<16), 29776+((13)<<16), 16671+((14)<<16), 6684+((15)<<16), 0+((16)<<16), 62352+((16)<<16), 62875+((17)<<16), 1790+((19)<<16), 10403+((20)<<16), 23425+((21)<<16), 41118+((22)<<16), 63761+((23)<<16), 26111+((25)<<16), 59552+((26)<<16), 33342+((28)<<16), 13368+((30)<<16), // Pitch extention for loading some XIs, 0+((32)<<16), 59167+((33)<<16), 60214+((35)<<16), 3580+((38)<<16), 20806+((40)<<16), 46850+((42)<<16), 16701+((45)<<16), 61986+((47)<<16), 52221+((50)<<16), 53567+((53)<<16), 1148+((57)<<16), 26736+((60)<<16), }; #if USEFPUCODE uint8_t FPSave[128]; // note, init this to 0 const float Const_14317456 = 14317456.0; const float Const1_On_768 = 1.0/768.0; //Const1_On_768 DD 3AAAAAABh uint16_t SlideValue = 0; uint16_t NewControlWord = 0x7F; #else const uint16_t FineLinearSlideUpTable16[] = { 0, 1, 59, 1, 118, 1, 178, 1, 237, 1, // 0->4 296, 1, 356, 1, 415, 1, 475, 1, 535, 1, // 5->9 594, 1, 654, 1, 714, 1, 773, 1, 833, 1, // 10->14 893, 1, // 15 }; const uint32_t *FineLinearSlideUpTable = (const uint32_t *)FineLinearSlideUpTable16; const uint16_t LinearSlideUpTable16[] = { // Value = 2^(Val/192) 0, 1, 237, 1, 475, 1, 714, 1, 953, 1, // 0->4 1194, 1, 1435, 1, 1677, 1, 1920, 1, 2164, 1, // 5->9 2409, 1, 2655, 1, 2902, 1, 3149, 1, 3397, 1, // 10->14 3647, 1, 3897, 1, 4148, 1, 4400, 1, 4653, 1, // 15->19 4907, 1, 5157, 1, 5417, 1, 5674, 1, 5932, 1, // 20->24 6190, 1, 6449, 1, 6710, 1, 6971, 1, 7233, 1, // 25->29 7496, 1, 7761, 1, 8026, 1, 8292, 1, 8559, 1, // 30->34 8027, 1, 9096, 1, 9366, 1, 9636, 1, 9908, 1, // 35->39 10181, 1, 10455, 1, 10730, 1, 11006, 1, 11283,1, // 40->44 11560, 1, 11839, 1, 12119, 1, 12400, 1, 12682,1, // 45->49 12965, 1, 13249, 1, 13533, 1, 13819, 1, 14106,1, // 50->54 14394, 1, 14684, 1, 14974, 1, 15265, 1, 15557,1, // 55->59 15850, 1, 16145, 1, 16440, 1, 16737, 1, 17034,1, // 60->64 17333, 1, 17633, 1, 17933, 1, 18235, 1, 18538,1, // 65->69 18842, 1, 19147, 1, 19454, 1, 19761, 1, 20070,1, // 70->74 20379, 1, 20690, 1, 21002, 1, 21315, 1, 21629,1, // 75->79 21944, 1, 22260, 1, 22578, 1, 22897, 1, 23216,1, // 80->84 23537, 1, 23860, 1, 24183, 1, 24507, 1, 24833,1, // 85->89 25160, 1, 25488, 1, 25817, 1, 26148, 1, 26479,1, // 90->94 26812, 1, 27146, 1, 27481, 1, 27818, 1, 28155,1, // 95->99 28494, 1, 28834, 1, 29175, 1, 29518, 1, 29862,1, // 100->104 30207, 1, 30553, 1, 30900, 1, 31248, 1, 31599,1, // 105->109 31951, 1, 32303, 1, 32657, 1, 33012, 1, 33369,1, // 110->114 33726, 1, 34085, 1, 34446, 1, 34807, 1, 35170,1, // 115->119 35534, 1, 35900, 1, 36267, 1, 36635, 1, 37004,1, // 120->124 37375, 1, 37747, 1, 38121, 1, 38496, 1, 38872,1, // 125->129 39250, 1, 39629, 1, 40009, 1, 40391, 1, 40774,1, // 130->134 41158, 1, 41544, 1, 41932, 1, 42320, 1, 42710,1, // 135->139 43102, 1, 43495, 1, 43889, 1, 44285, 1, 44682,1, // 140->144 45081, 1, 45481, 1, 45882, 1, 46285, 1, 46690,1, // 145->149 47095, 1, 47503, 1, 47917, 1, 48322, 1, 48734,1, // 150->154 49147, 1, 49562, 1, 49978, 1, 50396, 1, 50815,1, // 155->159 51236, 1, 51658, 1, 52082, 1, 52507, 1, 52934,1, // 160->164 53363, 1, 53793, 1, 54224, 1, 54658, 1, 55092,1, // 165->169 55529, 1, 55966, 1, 56406, 1, 56847, 1, 57289,1, // 170->174 57734, 1, 58179, 1, 58627, 1, 59076, 1, 59527,1, // 175->179 59979, 1, 60433, 1, 60889, 1, 61346, 1, 61805,1, // 180->184 62265, 1, 62727, 1, 63191, 1, 63657, 1, 64124,1, // 185->189 64593, 1, 65064, 1, 0, 2, 474, 2, 950, 2, // 190->194 1427, 2, 1906, 2, 2387, 2, 2870, 2, 3355, 2, // 195->199 3841, 2, 4327, 2, 4818, 2, 5310, 2, 5803, 2, // 200->204 6298, 2, 6795, 2, 7294, 2, 7794, 2, 8296, 2, // 205->209 8800, 2, 9306, 2, 9814, 2, 10323, 2, 10835,2, // 210->214 11348, 2, 11863, 2, 12380, 2, 12899, 2, 13419,2, // 215->219 13942, 2, 14467, 2, 14993, 2, 15521, 2, 16051,2, // 220->224 16583, 2, 17117, 2, 17653, 2, 18191, 2, 18731,2, // 225->229 19273, 2, 19817, 2, 20362, 2, 20910, 2, 21460,2, // 230->234 22011, 2, 22565, 2, 23121, 2, 23678, 2, 24238,2, // 235->239 24800, 2, 25363, 2, 25929, 2, 25497, 2, 27067,2, // 240->244 27639, 2, 28213, 2, 28789, 2, 29367, 2, 29947,2, // 245->249 30530, 2, 31114, 2, 31701, 2, 32289, 2, 32880,2, // 250->254 33473, 2, 34068, 2, // 255->256 }; const uint32_t *LinearSlideUpTable = (const uint32_t *)LinearSlideUpTable16; const uint16_t FineLinearSlideDownTable[] = { 65535, 65477, 65418, 65359, 65300, 65241, 65182, 65359, // 0->7 65065, 65006, 64947, 64888, 64830, 64772, 64713, 64645, // 8->15 }; const uint16_t LinearSlideDownTable[] = { 65535, 65300, 65065, 64830, 64596, 64364, 64132, 63901, // 0->7 63670, 63441, 63212, 62984, 62757, 62531, 62306, 62081, // 8->15 61858, 61635, 61413, 61191, 60971, 60751, 60532, 60314, // 16->23 60097, 59880, 59664, 59449, 59235, 59022, 58809, 58597, // 24->31 58386, 58176, 57966, 57757, 57549, 57341, 57135, 56929, // 32->39 56724, 56519, 56316, 56113, 55911, 55709, 55508, 55308, // 40->47 55109, 54910, 54713, 54515, 54319, 54123, 53928, 53734, // 48->55 53540, 53347, 53155, 52963, 52773, 52582, 52393, 52204, // 56->63 52016, 51829, 51642, 51456, 51270, 51085, 50901, 50718, // 64->71 50535, 50353, 50172, 49991, 49811, 49631, 49452, 49274, // 72->79 49097, 48920, 48743, 48568, 48393, 48128, 48044, 47871, // 80->87 47699, 47527, 47356, 47185, 47015, 46846, 46677, 46509, // 88->95 46341, 46174, 46008, 45842, 45677, 45512, 45348, 45185, // 96->103 45022, 44859, 44698, 44537, 44376, 44216, 44057, 43898, //104->111 43740, 43582, 43425, 43269, 43113, 42958, 42803, 42649, //112->119 42495, 42342, 42189, 42037, 41886, 41735, 41584, 41434, //120->127 41285, 41136, 40988, 40840, 40639, 40566, 40400, 40253, //128->135 40110, 39965, 39821, 39678, 39535, 39392, 39250, 39109, //136->143 38968, 38828, 38688, 38548, 38409, 38271, 38133, 37996, //144->151 37859, 37722, 37586, 37451, 37316, 37181, 37047, 36914, //152->159 36781, 36648, 36516, 36385, 36254, 36123, 35993, 35863, //160->167 35734, 35605, 35477, 35349, 35221, 35095, 34968, 34842, //168->175 34716, 34591, 34467, 34343, 34219, 34095, 33973, 33850, //176->183 33728, 33607, 33486, 33365, 33245, 33125, 33005, 32887, //184->191 32768, 32650, 32532, 32415, 32298, 32182, 32066, 31950, //192->199 31835, 31720, 31606, 31492, 31379, 31266, 31153, 31041, //200->207 30929, 30817, 30706, 30596, 30485, 30376, 30226, 30157, //208->215 30048, 29940, 29832, 29725, 29618, 29511, 29405, 29299, //216->223 29193, 29088, 28983, 28879, 28774, 28671, 28567, 28464, //224->231 28362, 28260, 28158, 28056, 27955, 27855, 27754, 27654, //232->239 27554, 27455, 27356, 27258, 27159, 27062, 26964, 26867, //240->247 26770, 26674, 26577, 26482, 26386, 26291, 26196, 26102, //248->255 26008, // 256 }; #endif /* USEFPUCODE */ void (*InitCommandTable[])(it_engine *ite, it_host *chn) = { InitNoCommand, InitCommandA, InitCommandB, InitCommandC, InitCommandD, InitCommandE, InitCommandF, InitCommandG, InitCommandH, InitCommandI, InitCommandJ, InitCommandK, InitCommandL, InitCommandM, InitCommandN, InitCommandO, InitCommandP, InitCommandQ, InitCommandR, InitCommandS, InitCommandT, InitCommandU, InitCommandV, InitCommandW, InitCommandX, InitCommandY, InitCommandZ, InitNoCommand, InitNoCommand, InitNoCommand,