Ejemplo n.º 1
0
 public nes_n106()
 {
     option[(int)OPT.SERIAL] = 0;
     SetClock(DEFAULT_CLOCK);
     SetRate(DEFAULT_RATE);
     for (int i = 0; i < 8; ++i)
     {
         sm[0][i]   = 128;
         sm[1][i]   = 128;
         trkinfo[i] = new TrackInfoN106();
     }
     Reset();
 }
Ejemplo n.º 2
0
        public new IDeviceInfo Clone()
        {
            TrackInfoN106 ti = new TrackInfoN106();

            ti.output     = output;
            ti.volume     = volume;
            ti.max_volume = max_volume;
            ti._freq      = _freq;
            ti.freq       = freq;
            ti.key        = key;
            ti.tone       = tone;
            ti.wavelen    = wavelen;
            ti.wave       = new Int16[256];
            for (int i = 0; i < ti.wave.Length; i++)
            {
                ti.wave[i] = wave[i];
            }
            return(ti);
        }
Ejemplo n.º 3
0
        public ITrackInfo GetTrackInfo(Int32 trk)
        {
            Int32 channels = get_channels();
            Int32 channel  = 7 - trk; // invert the track display

            TrackInfoN106 t = trkinfo[channel];

            if (trk >= channels)
            {
                t.max_volume = 15;
                t.volume     = 0;
                t._freq      = 0;
                t.wavelen    = 0;
                t.tone       = -1;
                t.output     = 0;
                t.key        = false;
                t.freq       = 0;
            }
            else
            {
                t.max_volume = 15;
                t.volume     = get_vol(channel);
                t._freq      = get_freq(channel);
                t.wavelen    = (Int32)get_len(channel);
                t.tone       = (Int32)get_off(channel);
                t.output     = fout[channel];

                t.key  = (t.volume > 0) && (t._freq > 0);
                t.freq = ((double)(t._freq) * clock) / (double)(15 * 65536 * channels * t.wavelen);

                for (int i = 0; i < t.wavelen; ++i)
                {
                    t.wave[i] = (Int16)get_sample((UInt32)((i + t.tone) & 0xFF));
                }
            }

            return(t);
        }