Ejemplo n.º 1
0
        public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars)
        {
            string             path;
            ConditionVariables vars;

            FromString(userdata, out path, out vars);

            WaveConfigureDialog cfg = new WaveConfigureDialog();

            cfg.Init(cp.AudioQueueWave, false, "Select file, volume and effects", "Configure Play Command", path,
                     vars.Exists(waitname),
                     AudioQueue.GetPriority(vars.GetString(priorityname, "Normal")),
                     vars.GetString(startname, ""),
                     vars.GetString(finishname, ""),
                     vars.GetString(volumename, "Default"),
                     vars);

            if (cfg.ShowDialog(parent) == DialogResult.OK)
            {
                ConditionVariables cond = new ConditionVariables(cfg.Effects);// add on any effects variables (and may add in some previous variables, since we did not purge)
                cond.SetOrRemove(cfg.Wait, waitname, "1");
                cond.SetOrRemove(cfg.Priority != AudioQueue.Priority.Normal, priorityname, cfg.Priority.ToString());
                cond.SetOrRemove(cfg.StartEvent.Length > 0, startname, cfg.StartEvent);
                cond.SetOrRemove(cfg.StartEvent.Length > 0, finishname, cfg.FinishEvent);
                cond.SetOrRemove(!cfg.Volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase), volumename, cfg.Volume);
                userdata = ToString(cfg.Path, cond);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saving the decoded Packets to our active Buffer, if the Buffer is full queue it into the OutputQueue
        /// and wait until another buffer gets freed up
        /// </summary>
        private void AudioPacketDecoded(object sender, PacketReceivedEventArgs args)
        {
            if (BitRate == 0)
            {
                BitRate = ((AudioFileStream)sender).BitRate;
            }

            foreach (var p in args.PacketDescriptions)
            {
                _currentByteCount += p.DataByteSize;
                AudioStreamPacketDescription packetDescription = p;

                int left = BufferSize - _currentBuffer.CurrentOffset;
                if (left < packetDescription.DataByteSize)
                {
                    EnqueueBuffer();
                    WaitForBuffer();
                }

                AudioQueue.FillAudioData(_currentBuffer.Buffer, _currentBuffer.CurrentOffset, args.InputData, (int)packetDescription.StartOffset, packetDescription.DataByteSize);
                // Set new offset for this packet
                packetDescription.StartOffset = _currentBuffer.CurrentOffset;
                // Add the packet to our Buffer
                _currentBuffer.PacketDescriptions.Add(packetDescription);
                // Add the Size so that we know how much is in the buffer
                _currentBuffer.CurrentOffset += packetDescription.DataByteSize;
            }

            if ((_audioFileStream != null && _currentByteCount == _audioFileStream.DataByteCount) || _lastPacket)
            {
                _lastPacket = false;
                Console.WriteLine($"{nameof(AudioPacketDecoded)} This is the lastpacket");
                EnqueueBuffer();
            }
        }
Ejemplo n.º 3
0
    public void TakeDamage(int amount, Vector3 hitPoint)
    {
        if (isDead)
        {
            return;
        }

        //enemyAudio.clip = hurtClip;
        //enemyAudio.Play ();
        AudioQueue.PlayOneShot(enemyAudio, hurtClip);          // call custom method that prevents audio overlap.

        currentHealth -= amount;

        hitParticles.transform.position = hitPoint;
        hitParticles.Play();

        if (currentHealth <= 0)
        {
            Death();
        }
        else
        {
            BlinkEnemy();
        }
    }
Ejemplo n.º 4
0
 void Awake()
 {
     clips = new List <AudioClip> {
         blip1, blip2, blip3, blip4, blip5, blip6
     };
     audioQueue = GetComponent <AudioQueue>();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Saving the decoded Packets to our active Buffer, if the Buffer is full queue it into the OutputQueue
        /// and wait until another buffer gets freed up
        /// </summary>
        private void AudioPacketDecoded(object sender, PacketReceivedEventArgs args)
        {
            foreach (var p in args.PacketDescriptions)
            {
                currentByteCount += p.DataByteSize;

                AudioStreamPacketDescription pd = p;

                int left = bufferSize - currentBuffer.CurrentOffset;
                if (left < pd.DataByteSize)
                {
                    EnqueueBuffer();
                    WaitForBuffer();
                }

                AudioQueue.FillAudioData(currentBuffer.Buffer, currentBuffer.CurrentOffset, args.InputData, (int)pd.StartOffset, pd.DataByteSize);
                // Set new offset for this packet
                pd.StartOffset = currentBuffer.CurrentOffset;
                // Add the packet to our Buffer
                currentBuffer.PacketDescriptions.Add(pd);
                // Add the Size so that we know how much is in the buffer
                currentBuffer.CurrentOffset += pd.DataByteSize;
            }

            if ((fileStream != null && currentByteCount == fileStream.DataByteCount) || lastPacket)
            {
                EnqueueBuffer();
            }
        }
Ejemplo n.º 6
0
        unsafe static void HandleOutput(AudioFile audioFile, AudioQueue queue, AudioQueueBuffer *audioQueueBuffer, ref int packetsToRead, ref long currentPacket, ref bool done, ref bool flushed, ref AudioStreamPacketDescription[] packetDescriptions)
        {
            int bytes;
            int packets;

            if (done)
            {
                return;
            }

            packets = packetsToRead;
            bytes   = (int)audioQueueBuffer->AudioDataBytesCapacity;

            packetDescriptions = audioFile.ReadPacketData(false, currentPacket, ref packets, audioQueueBuffer->AudioData, ref bytes);

            if (packets > 0)
            {
                audioQueueBuffer->AudioDataByteSize = (uint)bytes;
                queue.EnqueueBuffer(audioQueueBuffer, packetDescriptions);
                currentPacket += packets;
            }
            else
            {
                if (!flushed)
                {
                    queue.Flush();
                    flushed = true;
                }

                queue.Stop(false);
                done = true;
            }
        }
        public void Init(bool defaultmode, AudioQueue qu,
                         string caption, Icon ic,
                         string defpath,
                         bool waitcomplete,
                         AudioQueue.Priority prio,
                         string startname, string endname,
                         string volume,
                         Variables ef)
        {
            comboBoxCustomPriority.Items.AddRange(Enum.GetNames(typeof(AudioQueue.Priority)));

            queue = qu;

            var enumlist = new Enum[] { CFIDs.WaveConfigureDialog, CFIDs.WaveConfigureDialog_buttonExtDevice, CFIDs.WaveConfigureDialog_labelStartTrigger, CFIDs.WaveConfigureDialog_labelEndTrigger, CFIDs.WaveConfigureDialog_labelTitle, CFIDs.WaveConfigureDialog_buttonExtBrowse, CFIDs.WaveConfigureDialog_checkBoxCustomComplete, CFIDs.WaveConfigureDialog_buttonExtEffects, CFIDs.WaveConfigureDialog_buttonExtTest, CFIDs.WaveConfigureDialog_checkBoxCustomV, CFIDs.WaveConfigureDialog_labelVolume };

            BaseUtils.Translator.Instance.TranslateControls(this, enumlist);

            if (caption != null)
            {
                this.Text = caption;
            }

            this.Icon = ic;
            textBoxBorderText.Text = defpath;

            if (defaultmode)
            {
                checkBoxCustomComplete.Visible        = comboBoxCustomPriority.Visible =
                    textBoxBorderStartTrigger.Visible = textBoxBorderEndTrigger.Visible = checkBoxCustomV.Visible = labelStartTrigger.Visible = labelEndTrigger.Visible = false;
            }
            else
            {
                checkBoxCustomComplete.Checked      = waitcomplete;
                comboBoxCustomPriority.SelectedItem = prio.ToString();
                textBoxBorderStartTrigger.Text      = startname;
                textBoxBorderEndTrigger.Text        = endname;
                buttonExtDevice.Visible             = false;
            }

            int i;

            if (!defaultmode && volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase))
            {
                checkBoxCustomV.Checked = false;
                trackBarVolume.Enabled  = false;
            }
            else
            {
                checkBoxCustomV.Checked = true;
                if (volume.InvariantParse(out i))
                {
                    trackBarVolume.Value = i;
                }
            }

            effects = ef;

            ExtendedControls.Theme.Current?.ApplyDialog(this);
        }
Ejemplo n.º 8
0
 public EasyAudio(AudioStream stream)
     : this()
 {
     AudioStreams.Add(stream);
     AudioQueue.Add(stream, 0, stream.Length);
     AudioSource = new AudioSource(stream.WaveFormat);
     AudioSource.SubmitAudioQueue(AudioQueue);
 }
Ejemplo n.º 9
0
 protected override void Run()
 {
     ServerVoiceConnections = new ConcurrentDictionary <ulong, VoiceConnection>();
     UserVoiceConnections   = new ConcurrentDictionary <ulong, AudioInStream>();
     AudioQueue             = new AudioQueue();
     AcaBoxTTS  = new AcaBoxTTS(Provider.GetService <HttpService>(), Provider.GetService <MathService>());
     SoundCloud = new SoundCloud(Provider.GetService <Config>().SoundCloudClientId, Provider.GetService <HttpService>());
     Youtube    = new YoutubeDownloader("youtube-dl", $"-f mp4 --playlist-end {Provider.GetService<Config>().YouTubePlaylistMaxItems.ToString()} --ignore-errors");
 }
Ejemplo n.º 10
0
 /// <inheritdoc />
 public override void Init(PlayerController pc)
 {
     Type            = PowerTypes.Dash;
     _inputRotation  = Resources.Load <ScriptableObjectQuartenion>("Player/InputRotation");
     AudioQueue      = Resources.Load <AudioQueue>("Managers/Audio/AudioQueue");
     _playerInfo     = Resources.Load <PlayerInfo>("Player/DefaultPlayerInfo");
     _particleSystem = Instantiate(ParticleSystem, pc.transform).GetComponent <ParticleSystem>();
     _particleSystem.transform.localPosition = Vector3.zero;
     _particleSystem.Stop();
 }
Ejemplo n.º 11
0
    private void PlayScene(AudioQueue queue)
    {
        if (activeQueue != null)
        {
            StopScene();
        }

        queue.Play(activeNarration);
        activeQueue = queue;
    }
        private static async Task PlayNextAfterRemove(AudioQueue audioQueue, LavalinkPlayer player)
        {
            if (audioQueue.Queue.ElementAtOrDefault(0) != null)
            {
                audioQueue.PlayingTrackIndex = 0;
                AudioQueues.SaveQueues();
                LavalinkTrack track = audioQueue.Queue.ElementAtOrDefault(0);
                await player.PlayAsync(track);
            }

            await Task.CompletedTask;
        }
Ejemplo n.º 13
0
    void Awake()
    {
        queue = new AudioQueue();

        client = new TcpClient("localhost", 3666);
        stream = client.GetStream();

        audioReader = new StreamReader(stream);
        //AudioClip myClip = AudioClip.Create("MySinoid", 44100, 1, 44100, false, true, OnAudioRead, OnAudioSetPosition);
        //sampleRate = AudioSettings.outputSampleRate;
        //audio.clip = myClip;
    }
Ejemplo n.º 14
0
        public ActionCoreController(AudioQueue speech, AudioQueue wave, SpeechSynthesizer synt, System.Windows.Forms.Form frm, System.Drawing.Icon ic)
        {
            Icon        = ic;
            audiospeech = speech;
            audiowave   = wave;
            synth       = synt;
            form        = frm;

            persistentglobalvariables = new ConditionVariables();
            globalvariables           = new ConditionVariables();
            programrunglobalvariables = new ConditionVariables();

            SetInternalGlobal("CurrentCulture", System.Threading.Thread.CurrentThread.CurrentCulture.Name);
            SetInternalGlobal("CurrentCultureInEnglish", System.Threading.Thread.CurrentThread.CurrentCulture.EnglishName);
            SetInternalGlobal("CurrentCultureISO", System.Threading.Thread.CurrentThread.CurrentCulture.ThreeLetterISOLanguageName);

            ActionBase.AddCommand("Break", typeof(ActionBreak), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Call", typeof(ActionCall), ActionBase.ActionType.Call);
            ActionBase.AddCommand("Dialog", typeof(ActionDialog), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("DialogControl", typeof(ActionDialogControl), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Do", typeof(ActionDo), ActionBase.ActionType.Do);
            ActionBase.AddCommand("DeleteVariable", typeof(ActionDeleteVariable), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Expr", typeof(ActionExpr), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Else", typeof(ActionElse), ActionBase.ActionType.Else);
            ActionBase.AddCommand("ElseIf", typeof(ActionElseIf), ActionBase.ActionType.ElseIf);
            ActionBase.AddCommand("End", typeof(ActionEnd), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("ErrorIf", typeof(ActionErrorIf), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("ForEach", typeof(ActionForEach), ActionBase.ActionType.ForEach);
            ActionBase.AddCommand("FileDialog", typeof(ActionFileDialog), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("GlobalLet", typeof(ActionGlobalLet), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Global", typeof(ActionGlobal), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("If", typeof(ActionIf), ActionBase.ActionType.If);
            ActionBase.AddCommand("InputBox", typeof(ActionInputBox), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("InfoBox", typeof(ActionInfoBox), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Key", typeof(ActionKey), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("MessageBox", typeof(ActionMessageBox), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("NonModalDialog", typeof(ActionNonModalDialog), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Return", typeof(ActionReturn), ActionBase.ActionType.Return);
            ActionBase.AddCommand("Pragma", typeof(ActionPragma), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Let", typeof(ActionLet), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Loop", typeof(ActionLoop), ActionBase.ActionType.Loop);
            ActionBase.AddCommand("Rem", typeof(ActionRem), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("PersistentGlobal", typeof(ActionPersistentGlobal), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Print", typeof(ActionPrint), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Say", typeof(ActionSay), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Set", typeof(ActionSet), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("StaticLet", typeof(ActionStaticLet), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Static", typeof(ActionStatic), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Sleep", typeof(ActionSleep), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("While", typeof(ActionWhile), ActionBase.ActionType.While);
            ActionBase.AddCommand("//", typeof(ActionFullLineComment), ActionBase.ActionType.Cmd);
            ActionBase.AddCommand("Else If", typeof(ActionElseIf), ActionBase.ActionType.ElseIf);
        }
Ejemplo n.º 15
0
    void Death()
    {
        isDead = true;

        capsuleCollider.isTrigger = true;

        anim.SetTrigger("Die");

        //enemyAudio.clip = deathClip;
        //enemyAudio.Play ();
        AudioQueue.PlayOneShot(enemyAudio, deathClip);          // call custom method that prevents audio overlap.
    }
Ejemplo n.º 16
0
        public void Init(AudioQueue qu,
                         bool defaultmode,
                         string title, string caption, Icon ic,
                         string defpath,
                         bool waitcomplete,
                         AudioQueue.Priority prio,
                         string startname, string endname,
                         string volume,
                         Variables ef)
        {
            comboBoxCustomPriority.Items.AddRange(Enum.GetNames(typeof(AudioQueue.Priority)));

            queue                  = qu;
            this.Text              = caption;
            labelTitle.Text        = title;
            this.Icon              = ic;
            textBoxBorderText.Text = defpath;

            if (defaultmode)
            {
                checkBoxCustomComplete.Visible        = comboBoxCustomPriority.Visible =
                    textBoxBorderStartTrigger.Visible = textBoxBorderEndTrigger.Visible = checkBoxCustomV.Visible = labelStartTrigger.Visible = labelEndTrigger.Visible = false;
            }
            else
            {
                checkBoxCustomComplete.Checked      = waitcomplete;
                comboBoxCustomPriority.SelectedItem = prio.ToString();
                textBoxBorderStartTrigger.Text      = startname;
                textBoxBorderEndTrigger.Text        = endname;
                buttonExtDevice.Visible             = false;
            }

            int i;

            if (!defaultmode && volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase))
            {
                checkBoxCustomV.Checked = false;
                trackBarVolume.Enabled  = false;
            }
            else
            {
                checkBoxCustomV.Checked = true;
                if (volume.InvariantParse(out i))
                {
                    trackBarVolume.Value = i;
                }
            }

            effects = ef;

            ExtendedControls.ThemeableFormsInstance.Instance?.ApplyDialog(this);
        }
Ejemplo n.º 17
0
        private void Audio_sampleEvent(AudioQueue sender, object tag)
        {
            AudioEvent af = tag as AudioEvent;

            if (af.eventname != null && af.eventname.Length > 0)
            {
                af.apr.actioncontroller.ActionRun(af.triggername, "ActionProgram", new ConditionVariables("EventName", af.eventname), now: false);    // queue at end an event
            }
            if (af.wait)
            {
                af.apr.ResumeAfterPause();
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Saving the decoded Packets to our active Buffer, if the Buffer is full queue it into the OutputQueue
        /// and wait until another buffer gets freed up
        /// </summary>
        void AudioPacketDecoded(object sender, PacketReceivedEventArgs args)
        {
            foreach (var p in args.PacketDescriptions)
            {
                currentByteCount += p.DataByteSize;

                AudioStreamPacketDescription pd = p;

                int left = bufferSize - currentBuffer.CurrentOffset;
                if (left < pd.DataByteSize)
                {
                    EnqueueBuffer();
                    WaitForBuffer();
                }

                AudioQueue.FillAudioData(currentBuffer.Buffer, currentBuffer.CurrentOffset, args.InputData, (int)pd.StartOffset, pd.DataByteSize);
#if true
                // Set new offset for this packet
                pd.StartOffset = currentBuffer.CurrentOffset;
                // Add the packet to our Buffer
                currentBuffer.PacketDescriptions.Add(pd);
                // Add the Size so that we know how much is in the buffer
                currentBuffer.CurrentOffset += pd.DataByteSize;
#else
                // Fill out the packet description
                pdesc [packetsFilled]             = pd;
                pdesc [packetsFilled].StartOffset = bytesFilled;
                bytesFilled += packetSize;
                packetsFilled++;

                var t = OutputQueue.CurrentTime;
                Console.WriteLine("Time:  {0}", t);

                // If we filled out all of our packet descriptions, enqueue the buffer
                if (pdesc.Length == packetsFilled)
                {
                    EnqueueBuffer();
                    WaitForBuffer();
                }
#endif
            }

            if ((fileStream != null && currentByteCount == fileStream.DataByteCount) || lastPacket)
            {
                EnqueueBuffer();
            }
        }
Ejemplo n.º 19
0
        private void WC(float size)
        {
            theme.FontSize = size;
            AudioDriverCSCore ad = new AudioDriverCSCore();
            AudioQueue        q  = new AudioQueue(ad);

            WaveConfigureDialog c = new WaveConfigureDialog();

            Variables ef = new Variables();

            c.Init(q, false, "Check SC", "Caption title", this.Icon,
                   @"c:\",
                   true, AudioQueue.Priority.High,
                   "sn", "en", "100", ef);

            c.ShowDialog(this);
        }
Ejemplo n.º 20
0
        public bool Write(Int16[] samples)
        {
            if (OutputQueue == null)
            {
                return(false);
            }

            int off = 0;

            while (samples.Length - off > 0)
            {
                int rem = (BufferSizeInByte - RawCur) / 2;

                if (rem < 1)
                {
                    var buff = Buffers[CurBuffIndex];
                    if (buff.IsInUse)
                    {
                        RawCur = 0;
                        return(false);
                    }
                    lock (buff)
                    {
                        buff.IsInUse = true;
                    }

                    AudioQueue.FillAudioData(buff.Data, 0, RawBuffer, 0, BufferSizeInByte);
                    OutputQueue.EnqueueBuffer(buff.Data, BufferSizeInByte, null);

                    Interlocked.Increment(ref BufReadyNum);
                    TryStart();

                    RawCur       = 0;
                    rem          = (BufferSizeInByte - RawCur) / 2;
                    CurBuffIndex = (CurBuffIndex + 1) % Buffers.Count;
                }

                int l = Math.Min(rem, samples.Length - off);
                Marshal.Copy(samples, off, RawBuffer + RawCur, l);
                off    += l;
                RawCur += l * 2;
            }

            return(true);
        }
Ejemplo n.º 21
0
        private void SC(float size, bool mode)
        {
            theme.FontSize = size;
            AudioDriverCSCore   ad  = new AudioDriverCSCore();
            AudioQueue          q   = new AudioQueue(ad);
            WindowsSpeechEngine wse = new WindowsSpeechEngine();
            SpeechSynthesizer   ss  = new SpeechSynthesizer(wse);

            SpeechConfigure c = new SpeechConfigure();

            Variables ef = new Variables();

            c.Init(q, ss, "Check SC", "Caption title", this.Icon, mode ? "Text to do" : null,
                   true, true, AudioQueue.Priority.High,
                   "sn", "en", "Sheila", "100", "Default", ef);

            c.ShowDialog(this);
        }
Ejemplo n.º 22
0
        void OnPacketDecoded(object sender, PacketReceivedEventArgs e)
        {
            IntPtr outBuffer;

            outputQueue.AllocateBuffer(e.Bytes, out outBuffer);
            AudioQueue.FillAudioData(outBuffer, 0, e.InputData, 0, e.Bytes);
            outputQueue.EnqueueBuffer(outBuffer, e.Bytes, e.PacketDescriptions);

            if (!outputQueueStarted)
            {
                var status = outputQueue.Start();
                if (status != AudioQueueStatus.Ok)
                {
                    Console.WriteLine("could not start audio queue");
                }
                outputQueueStarted = true;
            }
        }
Ejemplo n.º 23
0
        // another event handler never executed
        void OnPacketDecoded(object sender, PacketReceivedEventArgs e)
        {
            IntPtr outBuffer;

            oaq.AllocateBuffer(e.Bytes, out outBuffer);
            AudioQueue.FillAudioData(outBuffer, 0, e.InputData, 0, e.Bytes);
            oaq.EnqueueBuffer(outBuffer, e.Bytes, e.PacketDescriptions);

            // start playing if not already
            if (!outputStarted)
            {
                var status = oaq.Start();
                if (status != AudioQueueStatus.Ok)
                {
                    System.Diagnostics.Debug.WriteLine("Could not start audio queue");
                }
                outputStarted = true;
            }
        }
Ejemplo n.º 24
0
    void Awake()
    {
        anim            = GetComponent <Animator> ();
        hitParticles    = GetComponentInChildren <ParticleSystem> ();
        capsuleCollider = GetComponent <CapsuleCollider> ();
        meshRenderer    = GetComponentInChildren <SkinnedMeshRenderer> ();

        currentHealth = startingHealth;

        enemyAudio             = gameObject.AddComponent <AudioSource> ();
        enemyAudio.loop        = false;
        enemyAudio.playOnAwake = false;

        // Listen to annihilation command, which instantly destroys all enemies.
        NotificationCentre.AddObserver(this, "OnDestroyAllEnemies");

        // Initialize AudioQueue
        AudioQueue.AddData(hurtClip, 0.1f);
        AudioQueue.AddData(deathClip, 0.1f);
    }
Ejemplo n.º 25
0
 /// <summary>
 /// Checks that we dont interupt a main scene otherwise plays the scene
 /// </summary>
 /// <param name="queue">Scene to play</param>
 private void PlayPassiveScene(SCENE scene, AudioQueue queue)
 {
     if (activeQueue.narrationType == Narration.MAIN && !activeQueue.IsFinished)
     {
         //dont do anything
     }
     else if (queue.IsFinished)
     {
         //dont do anything
     }
     else if (passivePlayed.Contains((int)scene))
     {
     }
     else
     {
         passivePlayed.Add((int)scene);
         StopScene();
         queue.Play(activeNarration);
         activeQueue = queue;
     }
 }
Ejemplo n.º 26
0
        public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars)
        {
            string             saying;
            ConditionVariables vars;

            FromString(userdata, out saying, out vars);

            SpeechConfigure cfg = new SpeechConfigure();

            cfg.Init(cp.AudioQueueSpeech, cp.SpeechSynthesizer,
                     "Set Text to say (use ; to separate randomly selectable phrases and {} to group)", "Configure Say Command",
                     saying,
                     vars.Exists(waitname), vars.Exists(literalname),
                     AudioQueue.GetPriority(vars.GetString(priorityname, "Normal")),
                     vars.GetString(startname, ""),
                     vars.GetString(finishname, ""),
                     vars.GetString(voicename, "Default"),
                     vars.GetString(volumename, "Default"),
                     vars.GetString(ratename, "Default"),
                     vars
                     );

            if (cfg.ShowDialog(parent) == DialogResult.OK)
            {
                ConditionVariables cond = new ConditionVariables(cfg.Effects);// add on any effects variables (and may add in some previous variables, since we did not purge
                cond.SetOrRemove(cfg.Wait, waitname, "1");
                cond.SetOrRemove(cfg.Literal, literalname, "1");
                cond.SetOrRemove(cfg.Priority != AudioQueue.Priority.Normal, priorityname, cfg.Priority.ToString());
                cond.SetOrRemove(cfg.StartEvent.Length > 0, startname, cfg.StartEvent);
                cond.SetOrRemove(cfg.StartEvent.Length > 0, finishname, cfg.FinishEvent);
                cond.SetOrRemove(!cfg.VoiceName.Equals("Default", StringComparison.InvariantCultureIgnoreCase), voicename, cfg.VoiceName);
                cond.SetOrRemove(!cfg.Volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase), volumename, cfg.Volume);
                cond.SetOrRemove(!cfg.Rate.Equals("Default", StringComparison.InvariantCultureIgnoreCase), ratename, cfg.Rate);

                userdata = ToString(cfg.SayText, cond);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 27
0
        static public string Menu(Control parent, string userdata, ActionCoreController cp)
        {
            string    saying;
            Variables vars;

            FromString(userdata, out saying, out vars);

            ExtendedAudioForms.SpeechConfigure cfg = new ExtendedAudioForms.SpeechConfigure();
            cfg.Init(false, cp.AudioQueueSpeech, cp.SpeechSynthesizer,
                     null, cp.Icon,
                     saying,
                     vars.Exists(waitname), vars.Exists(literalname),
                     AudioQueue.GetPriority(vars.GetString(priorityname, "Normal")),
                     vars.GetString(startname, ""),
                     vars.GetString(finishname, ""),
                     vars.GetString(voicename, "Default"),
                     vars.GetString(volumename, "Default"),
                     vars.GetString(ratename, "Default"),
                     vars
                     );

            if (cfg.ShowDialog(parent.FindForm()) == DialogResult.OK)
            {
                Variables cond = new Variables(cfg.Effects);// add on any effects variables (and may add in some previous variables, since we did not purge
                cond.SetOrRemove(cfg.Wait, waitname, "1");
                cond.SetOrRemove(cfg.Literal, literalname, "1");
                cond.SetOrRemove(cfg.Priority != AudioQueue.Priority.Normal, priorityname, cfg.Priority.ToString());
                cond.SetOrRemove(cfg.StartEvent.Length > 0, startname, cfg.StartEvent);
                cond.SetOrRemove(cfg.StartEvent.Length > 0, finishname, cfg.FinishEvent);
                cond.SetOrRemove(!cfg.VoiceName.Equals("Default", StringComparison.InvariantCultureIgnoreCase), voicename, cfg.VoiceName);
                cond.SetOrRemove(!cfg.Volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase), volumename, cfg.Volume);
                cond.SetOrRemove(!cfg.Rate.Equals("Default", StringComparison.InvariantCultureIgnoreCase), ratename, cfg.Rate);

                return(ToString(cfg.SayText, cond));
            }

            return(null);
        }
Ejemplo n.º 28
0
        static void Main(string[] args)
        {
            GameSystems.Initialize(new GameStartInfo
            {
                Window = new WindowInfo()
                {
                    Name = "TestUnit",
                    Size = new Size(1920, 1080)
                }
            });


            var stream0 = new AudioStream(@"C:\Users\LinkC\source\love.mp3");
            var stream1 = new AudioStream(@"C:\Users\LinkC\source\free.wav");

            AudioQueue audioQueue0 = new AudioQueue();
            AudioQueue audioQueue1 = new AudioQueue();


            audioQueue0.Add(stream0, 0, stream0.Length);
            audioQueue1.Add(stream1, 0, stream1.Length);


            AudioSource audioSource0 = new AudioSource(stream0.WaveFormat);
            AudioSource audioSource1 = new AudioSource(stream1.WaveFormat);

            audioSource0.SubmitAudioQueue(audioQueue0);
            audioSource1.SubmitAudioQueue(audioQueue1);

            audioSource0.Start();
            audioSource1.Start();


            GameSystems.RunLoop();

            AudioDevice.Terminate();
        }
Ejemplo n.º 29
0
        private static async Task <bool> SongIsFirst(LavalinkPlayer player, AudioQueue audioQueue, LavalinkTrack track, YoutubeVideo video, SocketCommandContext context, string songAlert, int choose)
        {
            ISocketMessageChannel channel     = context.Channel;
            SocketUserMessage     message     = context.Message;
            LavalinkTrack         secondTrack = audioQueue.Queue.ElementAtOrDefault(1);

            if (secondTrack == null)
            {
                audioQueue.PlayingTrackIndex = 0;
                AudioQueues.SaveQueues();

                await player.PlayAsync(track);

                if (video != null)
                {
                    songAlert = "PLAY_PLAYED_SONG";
                    await SongInfo(channel, message, video, choose, songAlert);
                }

                return(true);
            }

            return(false);
        }
Ejemplo n.º 30
0
        void ReloadLevel()
        {
            if (scene != null)
            {
                SetLevelState();

                scene.UnloadContent();
                withChicks.UnloadContent();
            }
            //if (blank != null)
            {
                blank = null;
                LowerFlag(Jabber.Flags.FADE_OUT);
            }
            IsQuitting = false;
            Components.Clear();

            world = new FarWorld();
            world.Initialize(new Vector2(0, -15.0f));
            world.SimulationSpeedFactor = 1.0f;

            withChicks = new ChicksScene(this, world, Content);
            withChicks.DoWorldUpdateDraw = false;
               // withChicks.AddNode(cannon);

            scene = new ThisGamesScene(this, world, withChicks, Content);
            scene.DoWorldUpdateDraw = false;

            scene.AddTextureLoadInterceptor("textures\\Physical\\wood", "break", "break_frames", "wood");
            scene.AddTextureLoadInterceptor("textures\\Physical\\cement", "break", "break_frames", "cement");
            scene.AddTextureLoadInterceptor("textures\\Physical\\glass", "break", "break_frames", "glass");

            scene.AddTextureLoadInterceptor("textures\\Backgrounds\\Bavaria\\cowright", "textures/backgrounds/bavaria/bavaria", "textures/backgrounds/bavaria/bavaria_frames", "cowleft");
            scene.AddTextureLoadInterceptor("textures\\Backgrounds\\Bavaria\\cowleft", "textures/backgrounds/bavaria/bavaria", "textures/backgrounds/bavaria/bavaria_frames", "cowright");

            LevelDir = "Content/Levels/" + location + "/Level" + levelNum + ".xml";
            scene.LoadGScene(LevelDir);

            withChicks.startPos = scene.startPos;

            ChickenDrawer chickdrawer = new ChickenDrawer(withChicks, scene);
            chickdrawer.Initialize(Content);
            scene.AddNode(chickdrawer);

            ChickenBience bience = new ChickenBience(this);
            bience.Initialize(Content);
            bience.Position = scene.startPos;
            scene.AddNode(bience);

            cannon = new Cannon(this);
            cannon.Position = scene.startPos;
            cannon.Initialize(Content);
            scene.AddNode(cannon);
            //scene.AddNode(cannon);

            if (withChicks.GetRightMaxPos() > scene.GetRightMaxPos())
            {
                rightMostPos = withChicks.GetRightMaxPos() + 200.0f;
            }
            else
            {
                rightMostPos = scene.GetRightMaxPos() + 200.0f;
            }

            leftMostPos = scene.startPos.X - 500;
            /// rightMostPos = 10000000;
            world.SetCollisionForAll(Fox.FOX_NONE_COLLISION_GROUP, false);
            world.SetCollisionForAll(BreakableBody.BodyNoneCollisionGroup, false);

            string country = scene.countryName;
            //scene.ToFire.Clear();
            if (scene.ToFire.Count == 0)
                for (int i = 0; i < 4; i++)
                {
                    scene.ToFire.Add(0);
                }
            //GameScene worldLoc = new GameScene(world, Content);
            //WorldLocation.CreateVesuvius(scene, (int)leftMostPos, (int)rightMostPos);

               // WorldLocation.CreatePolar(scene, (int)leftMostPos, (int)rightMostPos);

            switch (scene.countryName)
            {
                case "bavaria":
                    WorldLocation.CreateBavaria(scene, (int)leftMostPos, (int)rightMostPos);
                    break;
                case "paris":
                    WorldLocation.CreateParis(scene, (int)leftMostPos, (int)rightMostPos);
                    break;
                case "australia":
                    WorldLocation.CreateAustralia(scene, (int)leftMostPos, (int)rightMostPos);
                    break;
                case "polar":
                    WorldLocation.CreatePolar(scene, (int)leftMostPos, (int)rightMostPos);
                    break;
                case "vesuvius":
                    WorldLocation.CreateVesuvius(scene, (int)leftMostPos, (int)rightMostPos);
                    break;
            }

            feathers.RaiseFlag(Jabber.Flags.FADE_OUT);
            Components.Add(scene);
            Components.Add(withChicks);

            MenuObj pause = new Button("ui/ui");
            pause.Initialize(Content);
            pause.Name = "pause";
            pause.CreateFramesFromXML("ui/ui_frames");
            pause.CurrentFrame = "pause";
            pause.ResetDimensions();
            pause.UniformScale = ScaleFactor;
            (pause as Button).RegularScale = ScaleFactor;
            (pause as Button).ScaleOnHover = (pause as Button).RegularScale * 1.4f;
            pause.PosX = -Jabber.BaseGame.Get.BackBufferWidth / 2.0f + pause.Width * pause.ScaleX;
            pause.PosY = Jabber.BaseGame.Get.BackBufferHeight / 2.0f - pause.Height * pause.ScaleY;
            Components.Add(pause);

            forceEndGame = new Button("ui/ui");
            forceEndGame.Initialize(Content);
            forceEndGame.UniformScale = 0.001f;
            forceEndGame.Name = "forceendgame";
            forceEndGame.CreateFramesFromXML("ui/ui_frames");
            forceEndGame.CurrentFrame = "doublearrow";
            forceEndGame.ResetDimensions();
            forceEndGame.RegularScale = 0.0f;// ScaleFactor * 0.35f;
            forceEndGame.ScaleOnHover = 0.0f;// ScaleFactor * 1.1f * 0.35f;
            forceEndGame.PosX = -Jabber.BaseGame.Get.BackBufferWidth / 2.0f + pause.Width * pause.ScaleX;
            forceEndGame.PosY = Jabber.BaseGame.Get.BackBufferHeight / 2.0f - pause.Height * pause.ScaleY * 2.3f;
            Components.Add(forceEndGame);
            forceEndGame.RaiseFlag(Flags.PASSRENDER);

            float widthHeightToUse = pause.Width;

            pause = new Button("ui/ui");
            pause.Initialize(Content);
            pause.Name = "restart";
            pause.Colour = Color.Green;
            pause.CreateFramesFromXML("ui/ui_frames");
            pause.CurrentFrame = "restart";
            (pause as Button).RegularScale = ScaleFactor;
            (pause as Button).ScaleOnHover = (pause as Button).RegularScale * 1.4f;
            pause.ResetDimensions();
            pause.UniformScale = ScaleFactor;
            pause.Width = pause.Height = widthHeightToUse;
            pause.PosX = -Jabber.BaseGame.Get.BackBufferWidth / 2.0f + pause.Width * pause.ScaleX * 2.5f;
            pause.PosY = Jabber.BaseGame.Get.BackBufferHeight / 2.0f - pause.Height * pause.ScaleY;
            Components.Add(pause);

            maxNumFox = 0;
            maxNumDonuts = 0;
            for (int i = 0; i < scene.Nodes.Count; i++)
            {
                if (scene.Nodes[i] is Fox)
                {
                    ++maxNumFox;
                }
                else if (scene.Nodes[i] is Donut)
                {
                    ++maxNumDonuts;
                }
                else if (scene.Nodes[i] is DonutCase)
                {
                    maxNumDonuts += 5;
                }
            }

            donutScore = new DonutScore();
            donutScore.Initialize(Content);
            scene.AddNode(donutScore);

            score = new Score(scene, this.location, levelNum);
            score.Initialize(Content);
            scene.AddNode(score);

            AudioQueue q = new AudioQueue(this);
            q.Initialize(Content);

            scene.AddNode(q);
        }
Ejemplo n.º 31
0
 void Start()
 {
     audioQueue = GameObject.Find("/Player/Hand Mount").GetComponent<AudioQueue>();
 }
Ejemplo n.º 32
0
		unsafe static void HandleOutput (AudioFile audioFile, AudioQueue queue, AudioQueueBuffer *audioQueueBuffer, ref int packetsToRead, ref long currentPacket, ref bool done, ref bool flushed, ref AudioStreamPacketDescription [] packetDescriptions)
		{
			int bytes;
			int packets;
			
			if (done)
				return;
			
			packets = packetsToRead;
			bytes = (int) audioQueueBuffer->AudioDataBytesCapacity;

			packetDescriptions = audioFile.ReadPacketData (false, currentPacket, ref packets, audioQueueBuffer->AudioData, ref bytes);
			
			if (packets > 0) {
				audioQueueBuffer->AudioDataByteSize = (uint) bytes;
				queue.EnqueueBuffer (audioQueueBuffer, packetDescriptions);
				currentPacket += packets;
			} else {
				if (!flushed) {
					queue.Flush ();
					flushed = true;
				}
				
				queue.Stop (false);
				done = true;
			}
		}
 private static void RemoveTrack(AudioQueue audioQueue, LavalinkTrack track)
 {
     audioQueue.Queue.Remove(audioQueue.Queue[audioQueue.PlayingTrackIndex]);
     AudioQueues.SaveQueues();
     return;
 }