Exemple #1
0
 public void Kill()
 {
     if (fscMode)
     {
         HITVM.Get().StopFSC(fsc);
     }
     else
     {
         inst.Stop();
         inst.Dispose();
         sfx.Dispose();
     }
 }
Exemple #2
0
        public HITThread(uint TrackID, HITVM VM, HITResourceGroup Src)
        {
            this.VM        = VM;
            ResGroup       = Src;
            Owners         = new List <int>();
            Notes          = new List <HITNoteEntry>();
            NotesByChannel = new Dictionary <SoundEffectInstance, HITNoteEntry>();

            audContent = Content.Content.Get().Audio;
            SetTrack(TrackID);

            SimpleMode = true;
            PlaySimple = true; //play next frame, so we have time to set volumes.
        }
Exemple #3
0
 public void Kill()
 {
     if (fscMode)
     {
         HITVM.Get().StopFSC(fsc);
     }
     else
     {
         inst.Stop();
         inst.Dispose();
         HITVM.Get().AmbLoops.Remove(inst);
         sfx.Dispose();
     }
 }
Exemple #4
0
        private bool SimpleMode; //certain sounds play with no HIT.

        #endregion Fields

        #region Constructors

        public HITThread(HITFile Src, HITVM VM)
        {
            this.Src = Src;
            this.VM = VM;
            Registers = new int[16];
            Registers[1] = 12; //gender (offset into object var table)
            LocalVar = new int[54];
            ObjectVar = new int[29];

            Notes = new List<HITNoteEntry>();
            NotesByChannel = new Dictionary<SoundEffectInstance, HITNoteEntry>();
            Owners = new List<int>();

            Stack = new Stack<int>();
            audContent = Content.Content.Get().Audio;
        }
Exemple #5
0
        public HITThread(HITFile Src, HITVM VM)
        {
            this.Src     = Src;
            this.VM      = VM;
            Registers    = new int[16];
            Registers[1] = 12; //gender (offset into object var table)
            LocalVar     = new int[54];
            ObjectVar    = new int[29];

            Notes          = new List <HITNoteEntry>();
            NotesByChannel = new Dictionary <SoundEffectInstance, HITNoteEntry>();
            Owners         = new List <int>();

            Stack      = new Stack <int>();
            audContent = Content.Content.Get().Audio;
        }
Exemple #6
0
        public AmbiencePlayer(Ambience amb)
        {
            if (amb.Loop)
            {
                byte[] data   = new XAFile(FSO.Content.Content.Get().GetPath(amb.Path)).DecompressedData;
                var    stream = new MemoryStream(data);
                sfx = SoundEffect.FromStream(stream);
                stream.Close();

                inst          = sfx.CreateInstance();
                inst.IsLooped = true;
                inst.Play();
                fscMode = false;
            }
            else
            {
                fsc = HITVM.Get().PlayFSC(FSO.Content.Content.Get().GetPath(amb.Path));
                fsc.SetVolume(0.33f); //may need tweaking
                fscMode = true;
            }
        }
Exemple #7
0
 public static void Init()
 {
     INSTANCE = new HITVM();
 }
Exemple #8
0
 public static void Init()
 {
     INSTANCE = new HITVM();
 }
Exemple #9
0
 public static void Init()
 {
     DISABLE_SOUND = FSOEnvironment.NoSound;
     INSTANCE      = new HITVM();
 }
Exemple #10
0
        private void NextNote()
        {
            if (LoopCount == -1)
            {
                var note = fsc.Notes[CurrentPosition++];
                if (note.Rand || CurrentPosition >= fsc.Notes.Count)
                {
                    RestartFSC(); //current random segment ended. jump to another.
                    note = fsc.Notes[CurrentPosition];
                }
                if (note.Filename != "NONE")
                {
                    bool play;
                    if (note.Prob > 0)
                    {
                        play = (new Random().Next(16) < note.Prob);
                    }
                    else
                    {
                        play = true;
                    }

                    if (play)
                    {
                        float volume = (note.Volume / 1024.0f) * (fsc.MasterVolume / 1024.0f) * Volume * HITVM.Get().GetMasterVolume(Model.HITVolumeGroup.AMBIENCE);
                        var   sound  = LoadSound(note.Filename);

                        if (sound != null)
                        {
                            var instance = sound.CreateInstance();
                            instance.Volume = volume;
                            instance.Pan    = (note.LRPan / 512.0f) - 1;
                            instance.Play();

                            SoundEffects.Add(instance);
                        }
                    }
                    LoopCount = (short)(note.Loop - 1);
                }
            }
            else
            {
                LoopCount--;
            }
        }