Mercurial > repos > blastem
comparison ym2612.c @ 379:3218e2f8d685
Make shift value of operator output to modulation input a define
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 02 Jun 2013 22:37:48 -0700 |
parents | 92947faa258a |
children | 1c8d74f2ab0b |
comparison
equal
deleted
inserted
replaced
378:92947faa258a | 379:3218e2f8d685 |
---|---|
154 } | 154 } |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 #define YM_VOLUME_DIVIDER 2 | 158 #define YM_VOLUME_DIVIDER 2 |
159 #define YM_MOD_SHIFT 4 | |
159 | 160 |
160 void ym_run(ym2612_context * context, uint32_t to_cycle) | 161 void ym_run(ym2612_context * context, uint32_t to_cycle) |
161 { | 162 { |
162 //printf("Running YM2612 from cycle %d to cycle %d\n", context->current_cycle, to_cycle); | 163 //printf("Running YM2612 from cycle %d to cycle %d\n", context->current_cycle, to_cycle); |
163 //TODO: Fix channel update order OR remap channels in register write | 164 //TODO: Fix channel update order OR remap channels in register write |
275 switch(chan->algorithm) | 276 switch(chan->algorithm) |
276 { | 277 { |
277 case 0: | 278 case 0: |
278 case 2: | 279 case 2: |
279 //modulate by operator 2 | 280 //modulate by operator 2 |
280 mod = context->operators[op+1].output >> 4; | 281 mod = context->operators[op+1].output >> YM_MOD_SHIFT; |
281 break; | 282 break; |
282 case 1: | 283 case 1: |
283 //modulate by operator 1+2 | 284 //modulate by operator 1+2 |
284 mod = (context->operators[op-1].output + context->operators[op+1].output) >> 4; | 285 mod = (context->operators[op-1].output + context->operators[op+1].output) >> YM_MOD_SHIFT; |
285 break; | 286 break; |
286 case 5: | 287 case 5: |
287 //modulate by operator 1 | 288 //modulate by operator 1 |
288 mod = context->operators[op-1].output >> 4; | 289 mod = context->operators[op-1].output >> YM_MOD_SHIFT; |
289 } | 290 } |
290 break; | 291 break; |
291 case 2://Operator 2 | 292 case 2://Operator 2 |
292 if (chan->algorithm != 1 && chan->algorithm != 2 || chan->algorithm != 7) { | 293 if (chan->algorithm != 1 && chan->algorithm != 2 || chan->algorithm != 7) { |
293 //modulate by Operator 1 | 294 //modulate by Operator 1 |
294 mod = context->operators[op-2].output >> 4; | 295 mod = context->operators[op-2].output >> YM_MOD_SHIFT; |
295 } | 296 } |
296 break; | 297 break; |
297 case 3://Operator 4 | 298 case 3://Operator 4 |
298 switch(chan->algorithm) | 299 switch(chan->algorithm) |
299 { | 300 { |
300 case 0: | 301 case 0: |
301 case 1: | 302 case 1: |
302 case 4: | 303 case 4: |
303 //modulate by operator 3 | 304 //modulate by operator 3 |
304 mod = context->operators[op-2].output >> 4; | 305 mod = context->operators[op-2].output >> YM_MOD_SHIFT; |
305 break; | 306 break; |
306 case 2: | 307 case 2: |
307 //modulate by operator 1+3 | 308 //modulate by operator 1+3 |
308 mod = (context->operators[op-3].output + context->operators[op-2].output) >> 4; | 309 mod = (context->operators[op-3].output + context->operators[op-2].output) >> YM_MOD_SHIFT; |
309 break; | 310 break; |
310 case 3: | 311 case 3: |
311 //modulate by operator 2+3 | 312 //modulate by operator 2+3 |
312 mod = (context->operators[op-1].output + context->operators[op-2].output) >> 4; | 313 mod = (context->operators[op-1].output + context->operators[op-2].output) >> YM_MOD_SHIFT; |
313 break; | 314 break; |
314 case 5: | 315 case 5: |
315 //modulate by operator 1 | 316 //modulate by operator 1 |
316 mod = context->operators[op-3].output >> 4; | 317 mod = context->operators[op-3].output >> YM_MOD_SHIFT; |
317 break; | 318 break; |
318 } | 319 } |
319 break; | 320 break; |
320 } | 321 } |
321 uint16_t env = operator->envelope + operator->total_level; | 322 uint16_t env = operator->envelope + operator->total_level; |