Ejemplo n.º 1
0
        public void decode(Default317Buffer stream)
        {
            pitchEnvelope = new Envelope();
            pitchEnvelope.decode(stream);
            volumeEnvelope = new Envelope();
            volumeEnvelope.decode(stream);
            int option = stream.getUnsignedByte();

            if (option != 0)
            {
                stream.position--;
                pitchModulationEnvelope = new Envelope();
                pitchModulationEnvelope.decode(stream);
                pitchModulationAmplitudeEnvelope = new Envelope();
                pitchModulationAmplitudeEnvelope.decode(stream);
            }

            option = stream.getUnsignedByte();
            if (option != 0)
            {
                stream.position--;
                volumeModulationEnvelope = new Envelope();
                volumeModulationEnvelope.decode(stream);
                volumeModulationAmplitude = new Envelope();
                volumeModulationAmplitude.decode(stream);
            }

            option = stream.getUnsignedByte();
            if (option != 0)
            {
                stream.position--;
                gatingReleaseEnvelope = new Envelope();
                gatingReleaseEnvelope.decode(stream);
                gatingAttackEnvelope = new Envelope();
                gatingAttackEnvelope.decode(stream);
            }

            for (int oscillationId = 0; oscillationId < 10; oscillationId++)
            {
                int volume = stream.getSmartB();
                if (volume == 0)
                {
                    break;
                }
                oscillationVolume[oscillationId] = volume;
                oscillationPitch[oscillationId]  = stream.getSmartA();
                oscillationDelay[oscillationId]  = stream.getSmartB();
            }

            delayTime      = stream.getSmartB();
            delayFeedback  = stream.getSmartB();
            duration       = stream.getUnsignedLEShort();
            begin          = stream.getUnsignedLEShort();
            filter         = new SoundFilter();
            filterEnvelope = new Envelope();
            filter.decode(stream, filterEnvelope);
        }