示例#1
0
        public override string ToString()
        {
            string res = ModuleConst.GetNoteNameToIndex((int)noteIndex);

            res += ((period == 0 && noteIndex != 0) || (period != 0 && noteIndex == 0)) ? "!" : " ";
            res += (instrumentIndex != 0) ? ModuleUtils.GetAsHex(instrumentIndex, 2) : "..";
            res += " ";
            res += ((effekt != 0) || (effektOp != 0)) ? ModuleUtils.GetAsHex(effekt, 1) + ModuleUtils.GetAsHex(effektOp, 2) : "...";
            return(res);
        }
示例#2
0
        protected override void UpdateNote()
        {
            patternDelay = 0;
            for (int ch = 0; ch < module.numberOfChannels; ch++)
            {
                MOD_MixerChannel   mc = (MOD_MixerChannel)mixChannels[ch];
                MOD_PatternChannel pe = (MOD_PatternChannel)pattern.patternRows[(int)currentRow].patternChannels[ch];

                mc.patternChannel = pe;
                mc.effect         = pe.effekt;
                mc.effectArg      = pe.effektOp;
                mc.effectArgX     = (mc.effectArg & 0xF0) >> 4;
                mc.effectArgY     = mc.effectArg & 0x0F;

                if (pe.instrumentIndex > 0 && pe.period > 0)
                {
                    mc.instrumentLastIndex = mc.instrumentIndex;
                    mc.instrumentIndex     = pe.instrumentIndex;
                    ResetChannelInstrument(mc);
                    mc.channelVolume   = module.Instruments[(int)mc.instrumentIndex - 1].volume;
                    mc.portamentoStart = (int)mc.period;
                    mc.noteIndex       = ModuleConst.GetNoteIndexForPeriod((int)pe.period);
                    mc.period          = GetNoteFreq(mc.noteIndex, mc.currentFineTune);
                    mc.portamentoEnd   = (int)mc.period;
                    mc.periodInc       = CalcClampPeriodIncrement(mc);
                }

                if (pe.instrumentIndex > 0 && pe.period == 0 && pe.instrumentIndex != mc.instrumentLastIndex)
                {
                    mc.instrumentLastIndex = pe.instrumentIndex;
                    mc.instrumentIndex     = pe.instrumentIndex;
                    ResetChannelInstrument(mc);
                    mc.channelVolume = module.Instruments[(int)mc.instrumentIndex - 1].volume;
                }

                if (pe.instrumentIndex > 0 && pe.period == 0 && pe.instrumentIndex == mc.instrumentLastIndex)
                {
                    mc.channelVolume = module.Instruments[(int)mc.instrumentIndex - 1].volume;
                }

                if (pe.instrumentIndex == 0 && pe.period > 0)
                {
                    mc.portamentoStart = (int)mc.period;
                    mc.noteIndex       = ModuleConst.GetNoteIndexForPeriod((int)pe.period);
                    mc.period          = GetNoteFreq(mc.noteIndex, mc.currentFineTune);
                    mc.portamentoEnd   = (int)mc.period;
                    mc.periodInc       = CalcClampPeriodIncrement(mc);
                    ResetChannelInstrument(mc);
                }
            }

            NextRow();
        }
示例#3
0
        private MOD_PatternChannel CreateNewPatternChannel(Stream stream, uint numberOfSamples)
        {
            MOD_PatternChannel channel = new MOD_PatternChannel();
            uint b0 = (uint)stream.ReadByte();
            uint b1 = (uint)stream.ReadByte();
            uint b2 = (uint)stream.ReadByte();
            uint b3 = (uint)stream.ReadByte();

            channel.instrumentIndex = (byte)(((b0 & 0xF0) | ((b2 & 0xF0) >> 4)) & numberOfSamples);
            channel.period          = (uint)(((b0 & 0x0F) << 8) | b1);

            if (channel.period > 0)
            {
                channel.noteIndex = ModuleConst.GetNoteIndexForPeriod((int)channel.period);
            }

            channel.effekt   = b2 & 0x0F;
            channel.effektOp = b3;

            return(channel);
        }