| 
									
										
										
										
											2022-02-14 22:12:20 -05:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * Furnace Tracker - multi-system chiptune tracker | 
					
						
							| 
									
										
										
										
											2024-01-16 21:26:57 -05:00
										 |  |  |  * Copyright (C) 2021-2024 tildearrow and contributors | 
					
						
							| 
									
										
										
										
											2022-02-14 22:12:20 -05:00
										 |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |  * the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License along | 
					
						
							|  |  |  |  * with this program; if not, write to the Free Software Foundation, Inc., | 
					
						
							|  |  |  |  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | #include "saa.h"
 | 
					
						
							|  |  |  | #include "../engine.h"
 | 
					
						
							|  |  |  | #include "sound/saa1099.h"
 | 
					
						
							|  |  |  | #include <string.h>
 | 
					
						
							|  |  |  | #include <math.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-13 05:09:20 -04:00
										 |  |  | #define rWrite(a,v) if (!skipRegisterWrites) {writes.push(QueuedWrite(a,v)); if (dumpWrites) {addWrite(a,v);} }
 | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-28 00:55:51 -05:00
										 |  |  | #define CHIP_DIVIDER 2
 | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-02 02:14:42 -05:00
										 |  |  | const char* regCheatSheetSAA[]={ | 
					
						
							|  |  |  |   "Vol0", "00", | 
					
						
							|  |  |  |   "Vol1", "01", | 
					
						
							|  |  |  |   "Vol2", "02", | 
					
						
							|  |  |  |   "Vol3", "03", | 
					
						
							|  |  |  |   "Vol4", "04", | 
					
						
							|  |  |  |   "Vol5", "05", | 
					
						
							|  |  |  |   "Freq0", "08", | 
					
						
							|  |  |  |   "Freq1", "09", | 
					
						
							|  |  |  |   "Freq2", "0A", | 
					
						
							|  |  |  |   "Freq3", "0B", | 
					
						
							|  |  |  |   "Freq4", "0C", | 
					
						
							|  |  |  |   "Freq5", "0D", | 
					
						
							|  |  |  |   "Octave10", "10", | 
					
						
							|  |  |  |   "Octave32", "11", | 
					
						
							|  |  |  |   "Octave54", "12", | 
					
						
							|  |  |  |   "ToneOn", "14", | 
					
						
							|  |  |  |   "NoiseOn", "15", | 
					
						
							|  |  |  |   "NoiseCtl", "16", | 
					
						
							|  |  |  |   "EnvCtl0", "18", | 
					
						
							|  |  |  |   "EnvCtl1", "19", | 
					
						
							|  |  |  |   "Power", "1C", | 
					
						
							|  |  |  |   NULL | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-03 18:38:57 -05:00
										 |  |  | const char** DivPlatformSAA1099::getRegisterSheet() { | 
					
						
							|  |  |  |   return regCheatSheetSAA; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-03 01:09:46 -05:00
										 |  |  | void DivPlatformSAA1099::acquire_saaSound(short** buf, size_t len) { | 
					
						
							| 
									
										
										
										
											2022-02-13 17:49:24 -05:00
										 |  |  |   if (saaBufLen<len*2) { | 
					
						
							|  |  |  |     saaBufLen=len*2; | 
					
						
							|  |  |  |     for (int i=0; i<2; i++) { | 
					
						
							|  |  |  |       delete[] saaBuf[i]; | 
					
						
							|  |  |  |       saaBuf[i]=new short[saaBufLen]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   while (!writes.empty()) { | 
					
						
							|  |  |  |     QueuedWrite w=writes.front(); | 
					
						
							|  |  |  |     saa_saaSound->WriteAddressData(w.addr,w.val); | 
					
						
							| 
									
										
										
										
											2022-02-21 22:31:27 -05:00
										 |  |  |     regPool[w.addr&0x1f]=w.val; | 
					
						
							| 
									
										
										
										
											2022-02-13 17:49:24 -05:00
										 |  |  |     writes.pop(); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
											
												per-channel oscilloscope, part 5
SAA1099 (SAASound and MAME), Lynx, MMC5, N163, PC Engine, PC Speaker,
PET, QSound, WonderSwan, VERA, VIC-20, VRC6 and X1-010!
											
										 
											2022-05-01 03:40:03 -04:00
										 |  |  |   saa_saaSound->GenerateMany((unsigned char*)saaBuf[0],len,oscBuf); | 
					
						
							| 
									
										
										
										
											2022-11-15 22:25:05 -05:00
										 |  |  | #ifdef TA_BIG_ENDIAN
 | 
					
						
							|  |  |  |   for (size_t i=0; i<len; i++) { | 
					
						
							| 
									
										
										
										
											2023-02-06 14:23:44 -05:00
										 |  |  |     buf[0][i]=(short)((((unsigned short)saaBuf[0][i<<1])<<8)|(((unsigned short)saaBuf[0][i<<1])>>8)); | 
					
						
							|  |  |  |     buf[1][i]=(short)((((unsigned short)saaBuf[0][1+(i<<1)])<<8)|(((unsigned short)saaBuf[0][1+(i<<1)])>>8)); | 
					
						
							| 
									
										
										
										
											2022-11-15 22:25:05 -05:00
										 |  |  |   } | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2022-02-13 17:49:24 -05:00
										 |  |  |   for (size_t i=0; i<len; i++) { | 
					
						
							| 
									
										
										
										
											2023-01-03 01:09:46 -05:00
										 |  |  |     buf[0][i]=saaBuf[0][i<<1]; | 
					
						
							|  |  |  |     buf[1][i]=saaBuf[0][1+(i<<1)]; | 
					
						
							| 
									
										
										
										
											2022-02-13 17:49:24 -05:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-11-15 22:25:05 -05:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2022-02-13 17:49:24 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-02 04:53:37 -05:00
										 |  |  | void DivPlatformSAA1099::acquire(short** buf, size_t len) { | 
					
						
							| 
									
										
										
										
											2023-01-03 01:09:46 -05:00
										 |  |  |   acquire_saaSound(buf,len); | 
					
						
							| 
									
										
										
										
											2022-02-13 17:49:24 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  | inline unsigned char applyPan(unsigned char vol, unsigned char pan) { | 
					
						
							| 
									
										
										
										
											2022-01-14 23:37:03 -05:00
										 |  |  |   return ((vol*(pan>>4))/15)|(((vol*(pan&15))/15)<<4); | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-15 16:01:11 -04:00
										 |  |  | void DivPlatformSAA1099::tick(bool sysTick) { | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |   for (int i=0; i<6; i++) { | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     chan[i].std.next(); | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |     if (chan[i].std.vol.had) { | 
					
						
							| 
									
										
										
										
											2022-06-01 19:27:06 -04:00
										 |  |  |       chan[i].outVol=VOL_SCALE_LINEAR_BROKEN(chan[i].vol&15,MIN(15,chan[i].std.vol.val),15); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       if (chan[i].outVol<0) chan[i].outVol=0; | 
					
						
							|  |  |  |       if (isMuted[i]) { | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |         rWrite(i,0); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       } else { | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |         rWrite(i,applyPan(chan[i].outVol&15,chan[i].pan)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-12-17 01:21:08 -05:00
										 |  |  |     if (NEW_ARP_STRAT) { | 
					
						
							|  |  |  |       chan[i].handleArp(); | 
					
						
							|  |  |  |     } else if (chan[i].std.arp.had) { | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       if (!chan[i].inPorta) { | 
					
						
							| 
									
										
										
										
											2022-08-22 16:59:45 -04:00
										 |  |  |         chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       } | 
					
						
							|  |  |  |       chan[i].freqChanged=true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |     if (chan[i].std.duty.had) { | 
					
						
							|  |  |  |       saaNoise[i/3]=chan[i].std.duty.val&3; | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |       rWrite(0x16,saaNoise[0]|(saaNoise[1]<<4)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |     if (chan[i].std.wave.had) { | 
					
						
							|  |  |  |       chan[i].psgMode=chan[i].std.wave.val&3; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-17 15:15:57 -04:00
										 |  |  |     if (chan[i].std.panL.had) { | 
					
						
							|  |  |  |       chan[i].pan&=0x0f; | 
					
						
							|  |  |  |       chan[i].pan|=(chan[i].std.panL.val&15)<<4; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (chan[i].std.panR.had) { | 
					
						
							|  |  |  |       chan[i].pan&=0xf0; | 
					
						
							|  |  |  |       chan[i].pan|=chan[i].std.panR.val&15; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (chan[i].std.panL.had || chan[i].std.panR.had) { | 
					
						
							|  |  |  |       if (isMuted[i]) { | 
					
						
							|  |  |  |         rWrite(i,0); | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         if (chan[i].std.vol.had) { | 
					
						
							|  |  |  |           if (chan[i].active) rWrite(i,applyPan(chan[i].outVol&15,chan[i].pan)); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |           if (chan[i].active) rWrite(i,applyPan(chan[i].vol&15,chan[i].pan)); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-16 02:39:40 -04:00
										 |  |  |     if (chan[i].std.pitch.had) { | 
					
						
							| 
									
										
										
										
											2022-04-28 02:31:16 -04:00
										 |  |  |       if (chan[i].std.pitch.mode) { | 
					
						
							|  |  |  |         chan[i].pitch2+=chan[i].std.pitch.val; | 
					
						
							| 
									
										
										
										
											2022-05-22 23:47:40 -04:00
										 |  |  |         CLAMP_VAR(chan[i].pitch2,-32768,32767); | 
					
						
							| 
									
										
										
										
											2022-04-28 02:31:16 -04:00
										 |  |  |       } else { | 
					
						
							|  |  |  |         chan[i].pitch2=chan[i].std.pitch.val; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-04-16 02:39:40 -04:00
										 |  |  |       chan[i].freqChanged=true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |     if (chan[i].std.ex1.had) { | 
					
						
							|  |  |  |       saaEnv[i/3]=chan[i].std.ex1.val; | 
					
						
							| 
									
										
										
										
											2022-02-01 03:44:02 -05:00
										 |  |  |       rWrite(0x18+(i/3),saaEnv[i/3]); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) { | 
					
						
							| 
									
										
										
										
											2022-12-17 02:07:24 -05:00
										 |  |  |       chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,true,0,chan[i].pitch2,chipClock,CHIP_DIVIDER); | 
					
						
							| 
									
										
										
										
											2022-02-03 02:46:49 -05:00
										 |  |  |       if (chan[i].freq>65535) chan[i].freq=65535; | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |       if (chan[i].freq>=32768) { | 
					
						
							|  |  |  |         chan[i].freqH=7; | 
					
						
							|  |  |  |       } else if (chan[i].freq>=16384) { | 
					
						
							|  |  |  |         chan[i].freqH=6; | 
					
						
							|  |  |  |       } else if (chan[i].freq>=8192) { | 
					
						
							|  |  |  |         chan[i].freqH=5; | 
					
						
							|  |  |  |       } else if (chan[i].freq>=4096) { | 
					
						
							|  |  |  |         chan[i].freqH=4; | 
					
						
							|  |  |  |       } else if (chan[i].freq>=2048) { | 
					
						
							|  |  |  |         chan[i].freqH=3; | 
					
						
							|  |  |  |       } else if (chan[i].freq>=1024) { | 
					
						
							|  |  |  |         chan[i].freqH=2; | 
					
						
							|  |  |  |       } else if (chan[i].freq>=512) { | 
					
						
							|  |  |  |         chan[i].freqH=1; | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         chan[i].freqH=0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       chan[i].freqL=0xff-(chan[i].freq>>chan[i].freqH); | 
					
						
							|  |  |  |       chan[i].freqH=7-chan[i].freqH; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       if (chan[i].freq>4095) chan[i].freq=4095; | 
					
						
							|  |  |  |       if (chan[i].keyOn) { | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       if (chan[i].keyOff) { | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |         rWrite(i,0); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |       rWrite(0x08+i,chan[i].freqL); | 
					
						
							| 
									
										
										
										
											2022-01-16 01:55:54 -05:00
										 |  |  |       rWrite(0x10+(i>>1),chan[i&6].freqH|(chan[1+(i&6)].freqH<<4)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       if (chan[i].keyOn) chan[i].keyOn=false; | 
					
						
							|  |  |  |       if (chan[i].keyOff) chan[i].keyOff=false; | 
					
						
							|  |  |  |       chan[i].freqChanged=false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |   rWrite(0x14,(chan[0].psgMode&1)| | 
					
						
							|  |  |  |               ((chan[1].psgMode&1)<<1)| | 
					
						
							|  |  |  |               ((chan[2].psgMode&1)<<2)| | 
					
						
							|  |  |  |               ((chan[3].psgMode&1)<<3)| | 
					
						
							|  |  |  |               ((chan[4].psgMode&1)<<4)| | 
					
						
							|  |  |  |               ((chan[5].psgMode&1)<<5) | 
					
						
							|  |  |  |   ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   rWrite(0x15,((chan[0].psgMode&2)>>1)| | 
					
						
							|  |  |  |               (chan[1].psgMode&2)| | 
					
						
							|  |  |  |               ((chan[2].psgMode&2)<<1)| | 
					
						
							|  |  |  |               ((chan[3].psgMode&2)<<2)| | 
					
						
							|  |  |  |               ((chan[4].psgMode&2)<<3)| | 
					
						
							|  |  |  |               ((chan[5].psgMode&2)<<4) | 
					
						
							|  |  |  |   ); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivPlatformSAA1099::dispatch(DivCommand c) { | 
					
						
							|  |  |  |   switch (c.cmd) { | 
					
						
							|  |  |  |     case DIV_CMD_NOTE_ON: { | 
					
						
							| 
									
										
										
										
											2022-04-21 03:24:06 -04:00
										 |  |  |       DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_SAA1099); | 
					
						
							| 
									
										
										
										
											2022-01-19 00:01:34 -05:00
										 |  |  |       if (c.value!=DIV_NOTE_NULL) { | 
					
						
							| 
									
										
										
										
											2022-01-28 00:55:51 -05:00
										 |  |  |         chan[c.chan].baseFreq=NOTE_PERIODIC(c.value); | 
					
						
							| 
									
										
										
										
											2022-01-19 00:01:34 -05:00
										 |  |  |         chan[c.chan].freqChanged=true; | 
					
						
							|  |  |  |         chan[c.chan].note=c.value; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       chan[c.chan].active=true; | 
					
						
							|  |  |  |       chan[c.chan].keyOn=true; | 
					
						
							| 
									
										
										
										
											2022-04-28 02:31:16 -04:00
										 |  |  |       chan[c.chan].macroInit(ins); | 
					
						
							| 
									
										
										
										
											2022-05-31 20:03:31 -04:00
										 |  |  |       if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) { | 
					
						
							|  |  |  |         chan[c.chan].outVol=chan[c.chan].vol; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       if (isMuted[c.chan]) { | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |         rWrite(c.chan,0); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       } else { | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |         rWrite(c.chan,applyPan(chan[c.chan].vol&15,chan[c.chan].pan)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     case DIV_CMD_NOTE_OFF: | 
					
						
							|  |  |  |       chan[c.chan].keyOff=true; | 
					
						
							|  |  |  |       chan[c.chan].active=false; | 
					
						
							| 
									
										
										
										
											2022-04-28 02:31:16 -04:00
										 |  |  |       chan[c.chan].macroInit(NULL); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       break; | 
					
						
							| 
									
										
										
										
											2022-02-08 13:11:04 -05:00
										 |  |  |     case DIV_CMD_NOTE_OFF_ENV: | 
					
						
							|  |  |  |     case DIV_CMD_ENV_RELEASE: | 
					
						
							|  |  |  |       chan[c.chan].std.release(); | 
					
						
							|  |  |  |       break; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     case DIV_CMD_VOLUME: { | 
					
						
							|  |  |  |       chan[c.chan].vol=c.value; | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |       if (!chan[c.chan].std.vol.has) { | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |         chan[c.chan].outVol=c.value; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       if (isMuted[c.chan]) { | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |         rWrite(c.chan,0); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       } else { | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |         if (chan[c.chan].active) rWrite(c.chan,applyPan(chan[c.chan].vol&15,chan[c.chan].pan)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     case DIV_CMD_GET_VOLUME: { | 
					
						
							|  |  |  |       return chan[c.chan].vol; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     case DIV_CMD_INSTRUMENT: | 
					
						
							| 
									
										
										
										
											2022-01-17 18:01:40 -05:00
										 |  |  |       if (chan[c.chan].ins!=c.value || c.value2==1) { | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |         chan[c.chan].insChanged=true; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       chan[c.chan].ins=c.value; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_PITCH: { | 
					
						
							|  |  |  |       chan[c.chan].pitch=c.value; | 
					
						
							|  |  |  |       chan[c.chan].freqChanged=true; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     case DIV_CMD_NOTE_PORTA: { | 
					
						
							| 
									
										
										
										
											2022-01-28 00:55:51 -05:00
										 |  |  |       int destFreq=NOTE_PERIODIC(c.value2); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       bool return2=false; | 
					
						
							|  |  |  |       if (destFreq>chan[c.chan].baseFreq) { | 
					
						
							| 
									
										
										
										
											2022-05-11 01:26:28 -04:00
										 |  |  |         chan[c.chan].baseFreq+=c.value*((parent->song.linearPitch==2)?1:(8-chan[c.chan].freqH)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |         if (chan[c.chan].baseFreq>=destFreq) { | 
					
						
							|  |  |  |           chan[c.chan].baseFreq=destFreq; | 
					
						
							|  |  |  |           return2=true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } else { | 
					
						
							| 
									
										
										
										
											2022-05-11 01:26:28 -04:00
										 |  |  |         chan[c.chan].baseFreq-=c.value*((parent->song.linearPitch==2)?1:(8-chan[c.chan].freqH)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |         if (chan[c.chan].baseFreq<=destFreq) { | 
					
						
							|  |  |  |           chan[c.chan].baseFreq=destFreq; | 
					
						
							|  |  |  |           return2=true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       chan[c.chan].freqChanged=true; | 
					
						
							|  |  |  |       if (return2) { | 
					
						
							|  |  |  |         chan[c.chan].inPorta=false; | 
					
						
							|  |  |  |         return 2; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-01-14 23:37:03 -05:00
										 |  |  |     case DIV_CMD_PANNING: | 
					
						
							| 
									
										
										
										
											2022-04-30 00:41:14 -04:00
										 |  |  |       chan[c.chan].pan=(c.value&0xf0)|(c.value2>>4); | 
					
						
							| 
									
										
										
										
											2022-01-14 23:37:03 -05:00
										 |  |  |       if (isMuted[c.chan]) { | 
					
						
							|  |  |  |         rWrite(c.chan,0); | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         if (chan[c.chan].active) rWrite(c.chan,applyPan(chan[c.chan].vol&15,chan[c.chan].pan)); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     case DIV_CMD_LEGATO: { | 
					
						
							| 
									
										
										
										
											2022-01-28 00:55:51 -05:00
										 |  |  |       chan[c.chan].baseFreq=NOTE_PERIODIC(c.value); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       chan[c.chan].freqChanged=true; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |     case DIV_CMD_STD_NOISE_MODE: | 
					
						
							|  |  |  |       chan[c.chan].psgMode=(c.value&1)|((c.value&16)>>3); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       break; | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |     case DIV_CMD_STD_NOISE_FREQ: | 
					
						
							|  |  |  |       saaNoise[c.chan/3]=(c.value&1)|((c.value&16)>>3); | 
					
						
							|  |  |  |       rWrite(0x16,saaNoise[0]|(saaNoise[1]<<4)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       break; | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |     case DIV_CMD_SAA_ENVELOPE: | 
					
						
							| 
									
										
										
										
											2022-01-14 23:37:03 -05:00
										 |  |  |       saaEnv[c.chan/3]=c.value; | 
					
						
							|  |  |  |       rWrite(0x18+(c.chan/3),c.value); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       break; | 
					
						
							| 
									
										
										
										
											2022-12-17 00:09:56 -05:00
										 |  |  |     case DIV_CMD_MACRO_OFF: | 
					
						
							|  |  |  |       chan[c.chan].std.mask(c.value,true); | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_MACRO_ON: | 
					
						
							|  |  |  |       chan[c.chan].std.mask(c.value,false); | 
					
						
							|  |  |  |       break; | 
					
						
							| 
									
										
										
										
											2024-01-17 14:48:47 -05:00
										 |  |  |     case DIV_CMD_MACRO_RESTART: | 
					
						
							|  |  |  |       chan[c.chan].std.restart(c.value); | 
					
						
							| 
									
										
										
										
											2024-01-17 07:28:29 -05:00
										 |  |  |       break; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     case DIV_CMD_GET_VOLMAX: | 
					
						
							|  |  |  |       return 15; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_PRE_PORTA: | 
					
						
							| 
									
										
										
										
											2022-02-08 22:49:52 -05:00
										 |  |  |       if (chan[c.chan].active && c.value2) { | 
					
						
							| 
									
										
										
										
											2022-04-28 02:31:16 -04:00
										 |  |  |         if (parent->song.resetMacroOnPorta) chan[c.chan].macroInit(parent->getIns(chan[c.chan].ins,DIV_INS_SAA1099)); | 
					
						
							| 
									
										
										
										
											2022-02-08 22:46:58 -05:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-12-17 02:10:20 -05:00
										 |  |  |       if (!chan[c.chan].inPorta && c.value && !parent->song.brokenPortaArp && chan[c.chan].std.arp.will && !NEW_ARP_STRAT) chan[c.chan].baseFreq=NOTE_PERIODIC(chan[c.chan].note); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |       chan[c.chan].inPorta=c.value; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_PRE_NOTE: | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     default: | 
					
						
							|  |  |  |       //printf("WARNING: unimplemented command %d\n",c.cmd);
 | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return 1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformSAA1099::muteChannel(int ch, bool mute) { | 
					
						
							|  |  |  |   isMuted[ch]=mute; | 
					
						
							|  |  |  |   if (isMuted[ch]) { | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |     rWrite(ch,0); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |   } else { | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |     if (chan[ch].active) rWrite(ch,applyPan(chan[ch].outVol&15,chan[ch].pan)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformSAA1099::forceIns() { | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |   for (int i=0; i<6; i++) { | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     chan[i].insChanged=true; | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |     chan[i].freqChanged=true; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |   rWrite(0x18,saaEnv[0]); | 
					
						
							|  |  |  |   rWrite(0x19,saaEnv[1]); | 
					
						
							|  |  |  |   rWrite(0x16,saaNoise[0]|(saaNoise[1]<<4)); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-27 00:29:16 -05:00
										 |  |  | void* DivPlatformSAA1099::getChanState(int ch) { | 
					
						
							|  |  |  |   return &chan[ch]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-05 19:17:00 -04:00
										 |  |  | DivMacroInt* DivPlatformSAA1099::getChanMacroInt(int ch) { | 
					
						
							|  |  |  |   return &chan[ch].std; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-23 18:25:05 -04:00
										 |  |  | unsigned short DivPlatformSAA1099::getPan(int ch) { | 
					
						
							|  |  |  |   return ((chan[ch].pan&0xf0)<<4)|(chan[ch].pan&15); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												per-channel oscilloscope, part 5
SAA1099 (SAASound and MAME), Lynx, MMC5, N163, PC Engine, PC Speaker,
PET, QSound, WonderSwan, VERA, VIC-20, VRC6 and X1-010!
											
										 
											2022-05-01 03:40:03 -04:00
										 |  |  | DivDispatchOscBuffer* DivPlatformSAA1099::getOscBuffer(int ch) { | 
					
						
							|  |  |  |   return oscBuf[ch]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-21 22:31:27 -05:00
										 |  |  | unsigned char* DivPlatformSAA1099::getRegisterPool() { | 
					
						
							|  |  |  |   return regPool; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivPlatformSAA1099::getRegisterPoolSize() { | 
					
						
							|  |  |  |   return 32; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | void DivPlatformSAA1099::reset() { | 
					
						
							|  |  |  |   while (!writes.empty()) writes.pop(); | 
					
						
							| 
									
										
										
										
											2022-02-21 22:31:27 -05:00
										 |  |  |   memset(regPool,0,32); | 
					
						
							| 
									
										
										
										
											2022-06-06 16:05:08 -04:00
										 |  |  |   saa_saaSound->Clear(); | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |   for (int i=0; i<6; i++) { | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     chan[i]=DivPlatformSAA1099::Channel(); | 
					
						
							| 
									
										
										
										
											2022-04-15 06:37:23 -04:00
										 |  |  |     chan[i].std.setEngine(parent); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     chan[i].vol=0x0f; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-01-25 18:46:27 -05:00
										 |  |  |   if (dumpWrites) { | 
					
						
							|  |  |  |     addWrite(0xffffffff,0); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   lastBusy=60; | 
					
						
							|  |  |  |   dacMode=0; | 
					
						
							|  |  |  |   dacPeriod=0; | 
					
						
							|  |  |  |   dacPos=0; | 
					
						
							|  |  |  |   dacRate=0; | 
					
						
							|  |  |  |   dacSample=-1; | 
					
						
							|  |  |  |   sampleBank=0; | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |   saaEnv[0]=0; | 
					
						
							|  |  |  |   saaEnv[1]=0; | 
					
						
							|  |  |  |   saaNoise[0]=0; | 
					
						
							|  |  |  |   saaNoise[1]=0; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   delay=0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   extMode=false; | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-09 19:25:25 -04:00
										 |  |  |   rWrite(8,255); | 
					
						
							|  |  |  |   rWrite(9,255); | 
					
						
							|  |  |  |   rWrite(10,255); | 
					
						
							|  |  |  |   rWrite(11,255); | 
					
						
							|  |  |  |   rWrite(12,255); | 
					
						
							|  |  |  |   rWrite(13,255); | 
					
						
							|  |  |  |   rWrite(16,0x77); | 
					
						
							|  |  |  |   rWrite(17,0x77); | 
					
						
							|  |  |  |   rWrite(18,0x77); | 
					
						
							|  |  |  |   rWrite(0x1c,2); | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |   rWrite(0x1c,1); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-01 19:46:08 -05:00
										 |  |  | int DivPlatformSAA1099::getOutputCount() { | 
					
						
							|  |  |  |   return 2; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  | int DivPlatformSAA1099::getPortaFloor(int ch) { | 
					
						
							|  |  |  |   return 12; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | bool DivPlatformSAA1099::keyOffAffectsArp(int ch) { | 
					
						
							|  |  |  |   return true; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-16 23:54:32 -05:00
										 |  |  | bool DivPlatformSAA1099::getLegacyAlwaysSetVolume() { | 
					
						
							|  |  |  |   return false; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | void DivPlatformSAA1099::notifyInsDeletion(void* ins) { | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |   for (int i=0; i<6; i++) { | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     chan[i].std.notifyInsDeletion((DivInstrument*)ins); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-29 21:13:40 -04:00
										 |  |  | void DivPlatformSAA1099::setFlags(const DivConfig& flags) { | 
					
						
							|  |  |  |   int clockSel=flags.getInt("clockSel",0); | 
					
						
							|  |  |  |   if (clockSel==2) { | 
					
						
							| 
									
										
										
										
											2022-01-29 00:20:27 -05:00
										 |  |  |     chipClock=COLOR_PAL*8.0/5.0; | 
					
						
							| 
									
										
										
										
											2022-09-29 21:13:40 -04:00
										 |  |  |   } else if (clockSel==1) { | 
					
						
							| 
									
										
										
										
											2022-01-29 00:20:27 -05:00
										 |  |  |     chipClock=COLOR_NTSC*2.0; | 
					
						
							|  |  |  |   } else { | 
					
						
							|  |  |  |     chipClock=8000000; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-12-04 02:04:42 -05:00
										 |  |  |   CHECK_CUSTOM_CLOCK; | 
					
						
							| 
									
										
										
										
											2022-01-28 00:55:51 -05:00
										 |  |  |   rate=chipClock/32; | 
					
						
							| 
									
										
										
										
											2022-02-13 17:49:24 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												per-channel oscilloscope, part 5
SAA1099 (SAASound and MAME), Lynx, MMC5, N163, PC Engine, PC Speaker,
PET, QSound, WonderSwan, VERA, VIC-20, VRC6 and X1-010!
											
										 
											2022-05-01 03:40:03 -04:00
										 |  |  |   for (int i=0; i<6; i++) { | 
					
						
							|  |  |  |     oscBuf[i]->rate=rate; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-06 16:05:08 -04:00
										 |  |  |   saa_saaSound->SetClockRate(chipClock); | 
					
						
							|  |  |  |   saa_saaSound->SetSampleRate(rate); | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-01 18:08:19 -05:00
										 |  |  | void DivPlatformSAA1099::poke(unsigned int addr, unsigned short val) { | 
					
						
							|  |  |  |   rWrite(addr,val); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformSAA1099::poke(std::vector<DivRegWrite>& wlist) { | 
					
						
							|  |  |  |   for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-29 21:13:40 -04:00
										 |  |  | int DivPlatformSAA1099::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |   parent=p; | 
					
						
							| 
									
										
										
										
											2022-01-16 23:21:27 -05:00
										 |  |  |   dumpWrites=false; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |   skipRegisterWrites=false; | 
					
						
							| 
									
										
										
										
											2022-02-13 17:49:24 -05:00
										 |  |  |   saa_saaSound=NULL; | 
					
						
							| 
									
										
										
										
											2022-01-14 18:19:52 -05:00
										 |  |  |   for (int i=0; i<6; i++) { | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |     isMuted[i]=false; | 
					
						
							| 
									
										
										
											
												per-channel oscilloscope, part 5
SAA1099 (SAASound and MAME), Lynx, MMC5, N163, PC Engine, PC Speaker,
PET, QSound, WonderSwan, VERA, VIC-20, VRC6 and X1-010!
											
										 
											2022-05-01 03:40:03 -04:00
										 |  |  |     oscBuf[i]=new DivDispatchOscBuffer; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-06-06 16:05:08 -04:00
										 |  |  |   saa_saaSound=CreateCSAASound(); | 
					
						
							|  |  |  |   saa_saaSound->SetOversample(1); | 
					
						
							|  |  |  |   saa_saaSound->SetSoundParameters(SAAP_NOFILTER|SAAP_16BIT|SAAP_STEREO); | 
					
						
							| 
									
										
										
										
											2022-01-28 12:59:53 -05:00
										 |  |  |   setFlags(flags); | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |   saaBufLen=65536; | 
					
						
							|  |  |  |   for (int i=0; i<2; i++) saaBuf[i]=new short[saaBufLen]; | 
					
						
							| 
									
										
										
										
											2022-01-14 16:29:27 -05:00
										 |  |  |   reset(); | 
					
						
							|  |  |  |   return 3; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformSAA1099::quit() { | 
					
						
							| 
									
										
										
											
												per-channel oscilloscope, part 5
SAA1099 (SAASound and MAME), Lynx, MMC5, N163, PC Engine, PC Speaker,
PET, QSound, WonderSwan, VERA, VIC-20, VRC6 and X1-010!
											
										 
											2022-05-01 03:40:03 -04:00
										 |  |  |   for (int i=0; i<6; i++) { | 
					
						
							|  |  |  |     delete oscBuf[i]; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-02-13 17:49:24 -05:00
										 |  |  |   if (saa_saaSound!=NULL) { | 
					
						
							|  |  |  |     DestroyCSAASound(saa_saaSound); | 
					
						
							|  |  |  |     saa_saaSound=NULL; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-01-14 23:26:22 -05:00
										 |  |  |   for (int i=0; i<2; i++) delete[] saaBuf[i]; | 
					
						
							| 
									
										
										
										
											2022-01-17 13:29:35 -05:00
										 |  |  | } |