示例#1
0
 public void Play(SoundKind SoundKind)
 {
     if (_settings.Items.TryGetValue(SoundKind, out var value))
     {
         PlaySound(value);
     }
 }
示例#2
0
 public static void Play(SoundKind kind, bool one = false)
 {
     if (!Instance)
     {
         return;
     }
     Instance.PlaySound(kind, one);
 }
示例#3
0
        public SoundsViewModelItem(SoundKind SoundKind, IDialogService DialogService, SoundSettings Settings)
        {
            this.SoundKind = SoundKind;
            _settings      = Settings;

            ResetCommand = new DelegateCommand(() => FileName = null);

            SetCommand = new DelegateCommand(() =>
            {
                var folder = DialogService.PickFile(Path.GetDirectoryName(FileName), "");

                if (folder != null)
                {
                    FileName = folder;
                }
            });
        }
示例#4
0
    public void PlaySound(SoundKind kind, bool one)
    {
        int snd = (int)kind;

        if (snd >= sounds.Length)
        {
            return;
        }

        if (sounds[snd])
        {
            if (!one)
            {
                sounds[snd].Play();
            }
            else
            {
                sounds[snd].PlayOneShot(sounds[snd].clip);
            }
        }
    }
示例#5
0
        public GMSound(ProjectReader reader)
        {
            Name        = reader.ReadString();
            LastChanged = reader.ReadDate();
            Version     = reader.ReadInt32();
            if (Version != 800)
            {
                throw new InvalidDataException("This library only supports .gmk GM8.0 files.");
            }

            Kind     = (SoundKind)reader.ReadInt32();
            FileType = reader.ReadString();
            FileName = reader.ReadString();
            Data     = null;
            if (reader.ReadBoolean())
            {
                int size = reader.ReadInt32();
                Data = reader.ReadBytes(size);
            }

            int eff    = reader.ReadInt32();
            int efflen = (int)SoundEffects.__LENGTH;

            Effects = new bool[efflen];
            for (int i = 0; i < efflen; i++)
            {
                Effects[i] = (eff & 1) != 0;
                eff      >>= 1;
            }

            // to check for an effect you do:
            // if (Effects[(int)SoundEffects.CHORUS]) { }

            Volume  = reader.ReadDouble();
            Panning = reader.ReadDouble();
            Preload = reader.ReadBoolean();

            reader.Dispose();
        }
示例#6
0
 public SoundsViewModelItem(SoundKind SoundKind, IDialogService DialogService, SoundSettings Settings)
 {
     this.SoundKind = SoundKind;
     _settings      = Settings;
 }
示例#7
0
 public void Play(SoundKind soundKind)
 {
 }