1 // license:BSD-3-Clause 2 // copyright-holders:Derrick Renaud 3 /************************************************************************* 4 5 audio\triplhnt.cpp 6 7 *************************************************************************/ 8 #include "emu.h" 9 #include "includes/triplhnt.h" 10 #include "sound/discrete.h" 11 12 13 const char *const triplhnt_sample_names[] = 14 { 15 "*triplhnt", 16 "bear_rac", 17 "witch", 18 nullptr 19 }; 20 21 /************************************************************************/ 22 /* triplhnt Sound System Analog emulation */ 23 /* Feb 2004, Derrick Renaud */ 24 /************************************************************************/ 25 static const discrete_lfsr_desc triplhnt_lfsr = 26 { 27 DISC_CLK_IS_FREQ, 28 16, /* Bit Length */ 29 0, /* Reset Value */ 30 0, /* Use Bit 0 as XOR input 0 */ 31 14, /* Use Bit 14 as XOR input 1 */ 32 DISC_LFSR_XNOR, /* Feedback stage1 is XNOR */ 33 DISC_LFSR_OR, /* Feedback stage2 is just stage 1 output OR with external feed */ 34 DISC_LFSR_REPLACE, /* Feedback stage3 replaces the shifted register contents */ 35 0x000001, /* Everything is shifted into the first bit only */ 36 0, /* Output not inverted */ 37 15 /* Output bit */ 38 }; 39 40 static const discrete_dac_r1_ladder triplhnt_bear_roar_v_dac = 41 { 42 4, // size of ladder 43 {1000000, 470000, 220000, 2200000}, // R47, R50, R48, R51 44 5, // vBias 45 68000, // R44 46 0, // no rGnd 47 0 // no smoothing cap 48 }; 49 50 static const discrete_dac_r1_ladder triplhnt_bear_roar_out_dac = 51 { 52 3, // size of ladder 53 {100000, 33000, 100000}, // R56, R58, R57 54 0, // no vBias 55 0, // no rBias 56 0, // no rGnd 57 0 // no smoothing cap 58 }; 59 60 static const discrete_dac_r1_ladder triplhnt_shot_dac = 61 { 62 4, // size of ladder 63 {8200, 3900, 2200, 1000}, // R53, R54, R55, R52 64 0, // no vBias 65 0, // no rBias 66 0, // no rGnd 67 0 // no smoothing cap 68 }; 69 70 static const discrete_555_cc_desc triplhnt_bear_roar_vco = 71 { 72 DISC_555_OUT_DC | DISC_555_OUT_SQW, 73 5, // B+ voltage of 555 74 DEFAULT_555_VALUES, 75 0.7 // Q2 junction voltage 76 }; 77 78 static const discrete_schmitt_osc_desc triplhnt_screech_osc = 79 { 80 2200, // R84 81 330, // R85 82 1.e-6, // C59 83 DEFAULT_7414_VALUES, 84 1 // invert output using 7400 gate E7 85 }; 86 87 static const discrete_mixer_desc triplhnt_mixer = 88 { 89 DISC_MIXER_IS_RESISTOR, 90 {3300 + 19879.5, 47000, 27000 + 545.6}, // R59 + (R56||R57||R58), R60 + (R52||R53||R54||R55), R61 91 {0}, // No variable resistor nodes 92 {0}, // No caps 93 0, // No rI 94 1000, // R78 95 1e-7, // C72 96 1e-7, // C44 97 0, // vBias not used for resistor network 98 245000 99 }; 100 101 /* Nodes - Sounds */ 102 #define TRIPLHNT_NOISE NODE_10 103 #define TRIPLHNT_BEAR_ROAR_SND NODE_11 104 #define TRIPLHNT_SHOT_SND NODE_12 105 #define TRIPLHNT_SCREECH_SND NODE_13 106 #define POOLSHRK_SCORE_SND NODE_14 107 108 DISCRETE_SOUND_START(triplhnt_discrete) 109 /************************************************/ 110 /* Input register mapping for triplhnt */ 111 /************************************************/ 112 /* NODE GAIN OFFSET INIT */ 113 DISCRETE_INPUTX_DATA(TRIPLHNT_BEAR_ROAR_DATA, -1, 0x0f, 0) 114 DISCRETE_INPUT_NOT (TRIPLHNT_BEAR_EN) 115 DISCRETE_INPUT_DATA (TRIPLHNT_SHOT_DATA) 116 DISCRETE_INPUT_LOGIC(TRIPLHNT_SCREECH_EN) 117 DISCRETE_INPUT_NOT (TRIPLHNT_LAMP_EN) 118 /************************************************/ 119 120 DISCRETE_LFSR_NOISE(TRIPLHNT_NOISE, // Output A7 pin 13 121 TRIPLHNT_LAMP_EN, TRIPLHNT_LAMP_EN, // From gate A8 pin 10 122 12096000.0/2/256, // 256H signal 123 DEFAULT_TTL_V_LOGIC_1, 0, DEFAULT_TTL_V_LOGIC_1/2, &triplhnt_lfsr) 124 125 /************************************************/ 126 /* Bear Roar is a VCO with noise mixed in. */ 127 /************************************************/ 128 DISCRETE_ADJUSTMENT(NODE_20, 129 10000, // R86 + R88 @ 0 130 260000, // R86 + R88 @ max 131 DISC_LOGADJ, "BEAR") 132 DISCRETE_DAC_R1(NODE_21, // base of Q2 133 TRIPLHNT_BEAR_ROAR_DATA, // IC B10, Q0-Q3 134 DEFAULT_TTL_V_LOGIC_1, // TTL ON level 135 &triplhnt_bear_roar_v_dac) 136 DISCRETE_555_CC(NODE_22, 1, // IC C11 pin 3, always enabled 137 NODE_21, // vIn 138 NODE_20, // current adjust 139 1.e-8, // C58 140 0, 390000, 0, // no rBias, R87, no rDis 141 &triplhnt_bear_roar_vco) 142 DISCRETE_COUNTER(NODE_23, 1, TRIPLHNT_BEAR_EN, // IC B6, QB-QD 143 NODE_22, // from IC C11, pin 3 144 0, 5, 1, 0, DISC_CLK_ON_R_EDGE) // /6 counter on rising edge 145 DISCRETE_TRANSFORM2(NODE_24, NODE_23, 2, "01>") // IC B6, pin 8 146 DISCRETE_LOGIC_INVERT(NODE_25, NODE_22) // IC D9, pin 3 147 DISCRETE_LOGIC_NAND(NODE_26, NODE_25, TRIPLHNT_NOISE) // IC D9, pin 11 148 DISCRETE_LOGIC_XOR(NODE_27, NODE_24, NODE_26) // IC B8, pin 6 149 DISCRETE_COUNTER(NODE_28, 1, TRIPLHNT_BEAR_EN, // IC B6, pin 12 150 NODE_27, // from IC B8, pin 6 151 0, 1, 1, 0, DISC_CLK_ON_R_EDGE) // /2 counter on rising edge 152 DISCRETE_TRANSFORM5(NODE_29, NODE_24, NODE_28, NODE_26, 2, 4, "13*24*+0+") // Mix the mess together in binary 153 DISCRETE_DAC_R1(TRIPLHNT_BEAR_ROAR_SND, NODE_29, 154 DEFAULT_TTL_V_LOGIC_1, 155 &triplhnt_bear_roar_out_dac) 156 157 /************************************************/ 158 /* Shot is just the noise amplitude modulated */ 159 /* by an R1 DAC. */ 160 /************************************************/ 161 DISCRETE_SWITCH(NODE_40, 1, // Gate A9, pins 6, 8, 11, 3 162 TRIPLHNT_NOISE, // noise enables the data which is then inverted 163 1, TRIPLHNT_SHOT_DATA) 164 DISCRETE_DAC_R1(TRIPLHNT_SHOT_SND, 165 NODE_40, 166 DEFAULT_TTL_V_LOGIC_1, 167 &triplhnt_shot_dac) 168 169 /************************************************/ 170 /* Screech is just the noise modulating a */ 171 /* Schmitt VCO. */ 172 /************************************************/ 173 DISCRETE_SCHMITT_OSCILLATOR(TRIPLHNT_SCREECH_SND, TRIPLHNT_SCREECH_EN, TRIPLHNT_NOISE, 3.4, &triplhnt_screech_osc) 174 175 /************************************************/ 176 /* Final mix and output. */ 177 /************************************************/ 178 DISCRETE_MIXER3(NODE_90, 1, TRIPLHNT_BEAR_ROAR_SND, TRIPLHNT_SHOT_SND, TRIPLHNT_SCREECH_SND, &triplhnt_mixer) 179 DISCRETE_OUTPUT(NODE_90, 1) 180 DISCRETE_SOUND_END 181