public void ReadMixTableChange(Beat beat)
        {
            var tableChange = new MixTableChange();

            tableChange.Instrument = _data.ReadByte();
            if (_versionNumber >= 500)
            {
                _data.Skip(16); // Rse Info
            }
            tableChange.Volume  = _data.ReadSignedByte();
            tableChange.Balance = _data.ReadSignedByte();
            var chorus  = _data.ReadSignedByte();
            var reverb  = _data.ReadSignedByte();
            var phaser  = _data.ReadSignedByte();
            var tremolo = _data.ReadSignedByte();

            if (_versionNumber >= 500)
            {
                tableChange.TempoName = ReadStringIntByte();
            }
            tableChange.Tempo = ReadInt32();

            // durations
            if (tableChange.Volume >= 0)
            {
                _data.ReadByte();
            }

            if (tableChange.Balance >= 0)
            {
                _data.ReadByte();
            }

            if (chorus >= 0)
            {
                _data.ReadByte();
            }

            if (reverb >= 0)
            {
                _data.ReadByte();
            }

            if (phaser >= 0)
            {
                _data.ReadByte();
            }

            if (tremolo >= 0)
            {
                _data.ReadByte();
            }

            if (tableChange.Tempo >= 0)
            {
                tableChange.Duration = _data.ReadSignedByte();
                if (_versionNumber >= 510)
                {
                    _data.ReadByte(); // hideTempo (bool)
                }
            }

            if (_versionNumber >= 400)
            {
                _data.ReadByte(); // all tracks flag
            }

            // unknown
            if (_versionNumber >= 500)
            {
                _data.ReadByte();
            }
            // unknown
            if (_versionNumber >= 510)
            {
                ReadStringIntByte();
                ReadStringIntByte();
            }

            if (tableChange.Volume >= 0)
            {
                var volumeAutomation = new Automation();
                volumeAutomation.IsLinear = true;
                volumeAutomation.Type     = AutomationType.Volume;
                volumeAutomation.Value    = tableChange.Volume;
                beat.Automations.Add(volumeAutomation);
            }

            if (tableChange.Balance >= 0)
            {
                var balanceAutomation = new Automation();
                balanceAutomation.IsLinear = true;
                balanceAutomation.Type     = AutomationType.Balance;
                balanceAutomation.Value    = tableChange.Balance;
                beat.Automations.Add(balanceAutomation);
            }

            if (tableChange.Instrument >= 0)
            {
                var instrumentAutomation = new Automation();
                instrumentAutomation.IsLinear = true;
                instrumentAutomation.Type     = AutomationType.Instrument;
                instrumentAutomation.Value    = tableChange.Instrument;
                beat.Automations.Add(instrumentAutomation);
            }

            if (tableChange.Tempo >= 0)
            {
                var tempoAutomation = new Automation();
                tempoAutomation.IsLinear = true;
                tempoAutomation.Type     = AutomationType.Tempo;
                tempoAutomation.Value    = tableChange.Tempo;
                beat.Automations.Add(tempoAutomation);

                beat.Voice.Bar.MasterBar.TempoAutomation = tempoAutomation;
            }
        }
Exemple #2
0
        public void ReadMixTableChange(Beat beat)
        {
            var tableChange = new MixTableChange();
            tableChange.Instrument = Data.ReadByte();
            if (_versionNumber >= 500)
            {
                Data.Skip(16); // Rse Info
            }
            tableChange.Volume = Data.ReadSignedByte();
            tableChange.Balance = Data.ReadSignedByte();
            var chorus = Data.ReadSignedByte();
            var reverb = Data.ReadSignedByte();
            var phaser = Data.ReadSignedByte();
            var tremolo = Data.ReadSignedByte();
            if (_versionNumber >= 500)
            {
                tableChange.TempoName = ReadStringIntByte();
            }
            tableChange.Tempo = ReadInt32();

            // durations
            if (tableChange.Volume >= 0)
            {
                Data.ReadByte();
            }

            if (tableChange.Balance >= 0)
            {
                Data.ReadByte();
            }

            if (chorus >= 0)
            {
                Data.ReadByte();
            }

            if (reverb >= 0)
            {
                Data.ReadByte();
            }

            if (phaser >= 0)
            {
                Data.ReadByte();
            }

            if (tremolo >= 0)
            {
                Data.ReadByte();
            }

            if (tableChange.Tempo >= 0)
            {
                tableChange.Duration = Data.ReadSignedByte();
                if (_versionNumber >= 510)
                {
                    Data.ReadByte(); // hideTempo (bool)
                }
            }

            if (_versionNumber >= 400)
            {
                Data.ReadByte(); // all tracks flag
            }

            // unknown
            if (_versionNumber >= 500)
            {
                Data.ReadByte();
            }
            // unknown
            if (_versionNumber >= 510)
            {
                ReadStringIntByte();
                ReadStringIntByte();
            }

            if (tableChange.Volume >= 0)
            {
                var volumeAutomation = new Automation();
                volumeAutomation.IsLinear = true;
                volumeAutomation.Type = AutomationType.Volume;
                volumeAutomation.Value = tableChange.Volume;
                beat.Automations.Add(volumeAutomation);
            }

            if (tableChange.Balance >= 0)
            {
                var balanceAutomation = new Automation();
                balanceAutomation.IsLinear = true;
                balanceAutomation.Type = AutomationType.Balance;
                balanceAutomation.Value = tableChange.Balance;
                beat.Automations.Add(balanceAutomation);
            }

            if (tableChange.Instrument >= 0)
            {
                var instrumentAutomation = new Automation();
                instrumentAutomation.IsLinear = true;
                instrumentAutomation.Type = AutomationType.Instrument;
                instrumentAutomation.Value = tableChange.Instrument;
                beat.Automations.Add(instrumentAutomation);
            }

            if (tableChange.Tempo >= 0)
            {
                var tempoAutomation = new Automation();
                tempoAutomation.IsLinear = true;
                tempoAutomation.Type = AutomationType.Tempo;
                tempoAutomation.Value = tableChange.Tempo;
                beat.Automations.Add(tempoAutomation);

                beat.Voice.Bar.MasterBar.TempoAutomation = tempoAutomation;
            }
        }