1 /*
2
3 C128 specific routines
4 YM PSG emulation - Stefano Bodrato, 2017
5
6 Set the envelope on a sound channel
7
8 $Id: psg_envelope.c, stefano Exp $
9 */
10
11 #include <psg.h>
12 #include <c128/sid.h>
13
psg_envelope(unsigned int waveform,int period,unsigned int channels)14 void psg_envelope(unsigned int waveform, int period, unsigned int channels)
15 {
16 // Voice, Attack, Decay, Sustain, Release
17 switch (waveform) {
18
19 case envUH:
20 case envUU:
21 if (channels & 1)
22 envelopesid(sidVoice1,period/13,0,period/13,0);
23 if (channels & 2)
24 envelopesid(sidVoice2,period/13,0,period/13,0);
25 if (channels & 4)
26 envelopesid(sidVoice3,period/13,0,period/13,0);
27 break;
28
29 // case envD:
30 // case envDD:
31 default:
32 if (channels & 1)
33 envelopesid(sidVoice1,0,period/13,0,period/13);
34 if (channels & 2)
35 envelopesid(sidVoice2,0,period/13,0,period/13);
36 if (channels & 4)
37 envelopesid(sidVoice3,0,period/13,0,period/13);
38 break;
39 }
40 }
41
42