Ejemplo n.º 1
0
        internal void Deserialize(GMAudioOptionsModel audioOptionsModel)
        {
            Id = audioOptionsModel.id;

            foreach (var modelAudioGroup in audioOptionsModel.audioGroups)
            {
                var audioGroup = new GMAudioGroup();
                audioGroup.Deserialize(modelAudioGroup);
                AudioGroups.Add(audioGroup);
            }
        }
Ejemplo n.º 2
0
        internal override void Create(string name)
        {
            Name            = Project.Resources.GenerateValidName(name ?? "sound");
            CompressionKind = GMSoundCompression.Uncompressed;
            Volume          = 1.0f;
            PreLoad         = false;
            BitRate         = 128;
            SampleRate      = 44100;
            Type            = GMSoundType.Mono;
            BitDepth        = GMSoundBitDepth.SixteenBit;
            AudioGroup      = Project.Resources.Get <GMMainOptions>().Audio.DefaultAudioGroup;

            AddResourceToFolder("GMSound");
        }
Ejemplo n.º 3
0
        internal override void FinalizeDeserialization(ModelBase model)
        {
            var soundModel   = (GMSoundModel)model;
            var audiogrpGuid = soundModel.audioGroundGuid;

            if (audiogrpGuid == Guid.Empty)
            {
                AudioGroup = null;
            }
            else
            {
                AudioGroup = Project.Resources.Get <GMMainOptions>().Audio.AudioGroups.Find(g => g.Id == audiogrpGuid);
            }
        }
Ejemplo n.º 4
0
        public GMAudioGroup CreateAudioGroup(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            // TODO Validate name

            var audioGroup = new GMAudioGroup
            {
                Id   = Guid.NewGuid(),
                Name = name
            };

            AudioGroups.Add(audioGroup);

            return(audioGroup);
        }