예제 #1
0
        public AudioStreamer(AudioSource source, AudioStream stream, int bufferSampleCount)
        {
            if (source == null)
                throw new ArgumentNullException("source");
            if (stream == null)
                throw new ArgumentNullException("stream");
            this.source = source;
            this.stream = stream;
            this.bufferSampleCount = bufferSampleCount;
            this.bufferSamples = new byte[stream.Format.SampleByteSize() * bufferSampleCount];

            buffers = new AudioBuffer[4];
            for (int index = 0; index < buffers.Length; index++)
            {
                buffers[index] = new AudioBuffer(Context);
                FillBuffer(buffers[index]);
            }

            source.Queue(buffers);

            lock (Context.streamers)
            {
                id = nextId++;
                Context.streamers[id] = this;
            }
        }
예제 #2
0
        public override void ReadPayload(ISerializationContext context, IValueReader reader)
        {
            AudioSource[] sourceInfos = new AudioSource[reader.ReadInt32()];
            for (int i = 0; i < sourceInfos.Length; ++i)
                sourceInfos[i] = new AudioSource (context, reader);

            this.Sources = sourceInfos;
        }
예제 #3
0
            public VolumeToAction(AudioSource _audioSource, float _desiredVolume, float _actionDuration)
            {
                mAudioSource = _audioSource;
                SetGraph(Graph.Linear);
                SetDesiredVolume(_desiredVolume);
                SetActionDuration(_actionDuration);

                SetupAction();
            }
예제 #4
0
        public RequestMuteSourceMessage(AudioSource source, bool mute)
            : this()
        {
            if (source == null)
                throw new ArgumentNullException ("source");

            TargetId = source.Id;
            Unmute = !mute;
        }
예제 #5
0
        public void Add(AudioSource source)
        {
            if (source == null)
                throw new ArgumentNullException ("source");

            var nsource = new AudioSource (source);

            OwnedSources.Add (source.OwnerId, nsource);
            Sources.Add (source.Id, nsource);
        }
예제 #6
0
 public static void AssertSourcesMatch(AudioSource expected, AudioSource actual)
 {
     Assert.AreEqual (expected.Name, actual.Name, "Source Name not matching");
     Assert.AreEqual (expected.OwnerId, actual.OwnerId, "Source OwnerId not matching");
     Assert.AreEqual (expected.CodecSettings.WaveEncoding, actual.CodecSettings.WaveEncoding, "Source WaveEncoding not matching");
     Assert.AreEqual (expected.CodecSettings.Channels, actual.CodecSettings.Channels, "Source Channels not matching");
     Assert.AreEqual (expected.CodecSettings.BitsPerSample, actual.CodecSettings.BitsPerSample, "Source BitsPerSample not matching");
     Assert.AreEqual (expected.CodecSettings.Bitrate, actual.CodecSettings.Bitrate, "Source Bitrate not matching");
     Assert.AreEqual (expected.CodecSettings.SampleRate, actual.CodecSettings.SampleRate, "Source Frequency not matching");
     Assert.AreEqual (expected.CodecSettings.FrameSize, actual.CodecSettings.FrameSize, "Source FrameSize not matching");
     Assert.AreEqual (expected.CodecSettings.Complexity, actual.CodecSettings.Complexity, "Source Complexity not matching.");
     Assert.AreEqual (expected.IsMuted, actual.IsMuted, "Source IsMuted not matching");
 }
예제 #7
0
        public AudioCaptureEntity(IAudioCaptureProvider audioCapture, AudioSource source, AudioEngineCaptureOptions options)
        {
            this.audioCapture = audioCapture;
            this.source = source;
            this.options = options;

            this.frameLength = (this.source.CodecSettings.FrameSize / source.CodecSettings.SampleRate) * 1000;

            if (options.Mode == AudioEngineCaptureMode.Activated)
            {
                activation = new VoiceActivation (source.CodecSettings, source.CodecSettings.FrameSize, options.StartVolume, options.ContinuationVolume, options.ContinueThreshold);
                //preprocessor = new SpeexPreprocessor (this.source.FrameSize, this.source.Frequency);
            }
        }
예제 #8
0
		private static void INTERNAL_CALL_Stop(AudioSource self){}
예제 #9
0
 public void QueuePlayback(AudioSource source, byte[] data)
 {
     throw new NotImplementedException ();
 }
예제 #10
0
 // Use this for initialization
 void Start()
 {
     //AudioSourceコンポーネントを入れる
     this.block = GetComponent <AudioSource>();
 }
예제 #11
0
 public void Values()
 {
     var source = new AudioSource ("voice", 1, 1, new AudioFormat (WaveFormatEncoding.LPCM, 2, 8, 48000), 64000, 480, 10, true);
     Assert.AreEqual ("voice",					source.Name);
     Assert.AreEqual (1,							source.Id);
     Assert.AreEqual (1,							source.OwnerId);
     Assert.AreEqual (true,						source.IsMuted);
     Assert.AreEqual (WaveFormatEncoding.LPCM,	source.CodecSettings.WaveEncoding);
     Assert.AreEqual (2,							source.CodecSettings.Channels);
     Assert.AreEqual (8,							source.CodecSettings.BitsPerSample);
     Assert.AreEqual (64000,						source.CodecSettings.Bitrate);
     Assert.AreEqual (48000,						source.CodecSettings.SampleRate);
     Assert.AreEqual (480,						source.CodecSettings.FrameSize);
     Assert.AreEqual (10,						source.CodecSettings.Complexity);
 }
예제 #12
0
        public void Setup()
        {
            this.provider = new MockAudioCaptureProvider();
            this.source = AudioSourceTests.GetTestSource();

            var c = new MockConnectionProvider (GablarskiProtocol.Instance).GetClientConnection();

            var client = new MockClientContext (c);
            this.context = client;
            this.sender = new ClientSourceHandler (client, new ClientSourceManager (client));
            this.receiver = (IAudioReceiver)this.sender;
        }
예제 #13
0
        public void SetGain(AudioSource source, float gain)
        {
            if (this.isDisposed)
                throw new ObjectDisposedException ("OpenALPlaybackProvider");
            if (source == null)
                throw new ArgumentNullException ("source");

            var realGains = this.gains.ToDictionary (kvp => kvp.Key, kvp => kvp.Value.Item1);
            realGains[source] = gain;

            RecalculateGains (realGains);
        }
예제 #14
0
            //public static AudioSource playOnce;
            public static void initializeAudio()
            {
                audioplayer = new GameObject();
                markerAudio = new AudioSource();
                //playOnce = new AudioSource();

                if (GlobalVariables.Settings.enableDebugging) Debug.Log("NavUtilLib: InitializingAudio...");

                try
                {
                markerAudio = audioplayer.AddComponent<AudioSource>();
                markerAudio.volume = GameSettings.VOICE_VOLUME;
                markerAudio.pan = 0;
                markerAudio.dopplerLevel = 0;
                markerAudio.bypassEffects = true;
                markerAudio.loop = true;
                markerAudio.rolloffMode = AudioRolloffMode.Linear;
                markerAudio.transform.SetParent(FlightCamera.fetch.mainCamera.transform);

                //playOnce = audioplayer.AddComponent<AudioSource>();
                //playOnce.volume = GameSettings.VOICE_VOLUME;
                //playOnce.pan = 0;
                //playOnce.dopplerLevel = 0;
                //playOnce.bypassEffects = true;
                //playOnce.loop = false;
                //playOnce.rolloffMode = AudioRolloffMode.Linear;
                //playOnce.transform.SetParent(FlightCamera.fetch.mainCamera.transform);

                }
                catch (Exception)
                {
                    if (NavUtilLib.GlobalVariables.Settings.enableDebugging) Debug.Log("NavUtil: Error Loading Audio");

                    throw;
                }

                isLoaded = true;
            }
예제 #15
0
 public void AirdropTowerBehaviour_PlaySound()
 {
     AudioSource.PlayClipAtPoint(_airdropTowerAudioClip,
                                 PlayerClient.localPlayerClient.controllable.transform.position);
 }
예제 #16
0
 private void Awake()
 {
     _audio = GetComponent <AudioSource>();
 }
예제 #17
0
 private void PlayBlockDestroySFX()
 {
     FindObjectOfType<GameSession>().AddToScore();
     AudioSource.PlayClipAtPoint(breakSound, Camera.main.transform.position);
 }
 void Start()
 {
     source = GetComponent <AudioSource>();
     GetComponentInChildren <AudioListener>().enabled = true;
 }
예제 #19
0
 // Use this for initialization
 void Start()
 {
     WalkSnd = GetComponent <AudioSource> ();
     Moving  = GetComponent <InputState> ();
 }
예제 #20
0
 private void Spawn(AssetItem item, SceneGraphNode hit, ref Vector2 location, ref Vector3 hitLocation)
 {
     if (item is BinaryAssetItem binaryAssetItem)
     {
         if (binaryAssetItem.Type == typeof(ParticleSystem))
         {
             var particleSystem = FlaxEngine.Content.LoadAsync <ParticleSystem>(item.ID);
             var actor          = ParticleEffect.New();
             actor.Name           = item.ShortName;
             actor.ParticleSystem = particleSystem;
             actor.Position       = PostProcessSpawnedActorLocation(actor, ref hitLocation);
             Spawn(actor);
             return;
         }
         if (typeof(MaterialBase).IsAssignableFrom(binaryAssetItem.Type))
         {
             if (hit is StaticModelNode staticModelNode)
             {
                 var staticModel = (StaticModel)staticModelNode.Actor;
                 var ray         = ConvertMouseToRay(ref location);
                 if (staticModel.IntersectsEntry(ref ray, out _, out _, out var entryIndex))
                 {
                     var material = FlaxEngine.Content.LoadAsync <MaterialBase>(item.ID);
                     using (new UndoBlock(Undo, staticModel, "Change material"))
                         staticModel.SetMaterial(entryIndex, material);
                 }
             }
             return;
         }
         if (typeof(SkinnedModel).IsAssignableFrom(binaryAssetItem.Type))
         {
             var model = FlaxEngine.Content.LoadAsync <SkinnedModel>(item.ID);
             var actor = AnimatedModel.New();
             actor.Name         = item.ShortName;
             actor.SkinnedModel = model;
             actor.Position     = PostProcessSpawnedActorLocation(actor, ref hitLocation);
             Spawn(actor);
             return;
         }
         if (typeof(Model).IsAssignableFrom(binaryAssetItem.Type))
         {
             var model = FlaxEngine.Content.LoadAsync <Model>(item.ID);
             var actor = StaticModel.New();
             actor.Name     = item.ShortName;
             actor.Model    = model;
             actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
             Spawn(actor);
             return;
         }
         if (typeof(AudioClip).IsAssignableFrom(binaryAssetItem.Type))
         {
             var clip  = FlaxEngine.Content.LoadAsync <AudioClip>(item.ID);
             var actor = AudioSource.New();
             actor.Name     = item.ShortName;
             actor.Clip     = clip;
             actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
             Spawn(actor);
             return;
         }
         if (typeof(Prefab).IsAssignableFrom(binaryAssetItem.Type))
         {
             var prefab = FlaxEngine.Content.LoadAsync <Prefab>(item.ID);
             var actor  = PrefabManager.SpawnPrefab(prefab, null);
             actor.Name     = item.ShortName;
             actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
             Spawn(actor);
             return;
         }
     }
 }
예제 #21
0
 void Awake()
 {
     //Get a component reference to the AudioSource attached to the UI game object
     musicSource = GetComponent <AudioSource> ();
     //Call the PlayLevelMusic function to start playing music
 }
 //BlockLoader Specific method: When the player presses spacebar or the simulate/play button in the upper left corner
 protected override void OnSimulateStart()
 {
     //if the sound file we loaded in the LoadExampleBlock
         if (resources.ContainsKey("warHorn.ogg"))
         {
             hasSound = true;
             //set the audio source we'll be using to the respective component, but if we don't find one, add one.
             audioSource = gameObject.GetComponent<AudioSource>() ?? gameObject.AddComponent<AudioSource>();
             //set the clip the audio source will be playing to the one we loaded.
             audioSource.clip = resources["warHorn.ogg"].audioClip;
         }
         //This is mostly flair:
         //For all blocks in the machine we have during simulation
         foreach (Transform t in Machine.Active().SimulationMachine)
         {
             //get the ones that are a HornBlock
             if (t.GetComponent<HornBlock>())
             {
                 //and if they use the save keyboard button to play their sound
                 if (t.GetComponent<HornBlock>().activateKey.KeyCode[0] == activateKey.KeyCode[0])
                 {
                     //Add their volume to a coefficient we need for later
                     HornsWithMyKeyCoefficient += t.GetComponent<HornBlock>().volumeSlider.Value;
                 }
             }
         }
 }
예제 #23
0
        public void Remove(AudioSource source)
        {
            foreach (var connection in context.Connections)
                connection.SendAsync (new SourcesRemovedMessage (new[] { source }));

            manager.Remove (source);
        }
예제 #24
0
 public void PlayNukeSound()
 {
     AudioSource.PlayClipAtPoint(_nukeAudioClip,
                                 PlayerClient.localPlayerClient.controllable.transform.position);
 }
예제 #25
0
        public void FreeSource(AudioSource source)
        {
            if (this.isDisposed)
                throw new ObjectDisposedException ("OpenALPlaybackProvider");
            if (source == null)
                throw new ArgumentNullException ("source");

            OpenAL.DebugFormat ("Freeing source {0}", source);

            lock (this.gains)
                this.gains = this.gains.Where (kvp => kvp.Key != source).ToDictionary (kvp => kvp.Key, kvp => kvp.Value);

            buffers.Remove (source);
            pool.FreeSource (source);
        }
예제 #26
0
	void OnCollisionEnter2D (Collision2D collision) {
		AudioSource.PlayClipAtPoint(crack, transform.position, 0.15f);
		if (isBreakable) {
			HandleHits();
		}
	}
예제 #27
0
        public void SourceResult()
        {
            const string name = "Name";
            var result = Messages.SourceResult.Succeeded;
            var source = new AudioSource (name, 1, 2, AudioCodecArgsTests.GetTestArgs());
            var msg = new SourceResultMessage (name, result, source);
            Assert.AreEqual (result, msg.SourceResult);
            Assert.AreEqual (name, msg.SourceName);
            msg.WritePayload (serverContext, writer);
            long length = stream.Position;
            stream.Position = 0;

            msg = new SourceResultMessage();
            msg.ReadPayload (clientContext, reader);
            Assert.AreEqual (length, stream.Position);
            Assert.AreEqual (result, msg.SourceResult);
            Assert.AreEqual (name, msg.SourceName);
        }
 /// <summary> Pauses the target AudioSource </summary>
 public void Pause()
 {
     AudioSource.Pause();
     IsPaused = true;
     if (DebugComponent) DDebug.Log("Pause '" + name + "' SoundyController", this);
 }
예제 #29
0
 public PlaySoundBehaviour(GameObject gameObject, AudioSource audioSource)
     : base(gameObject)
 {
     this.audioSource = audioSource;
 }
        private void Start()
        {
            if (GetComponent <VRTK_ControllerEvents>() == null)
            {
                Debug.LogError("VRTK_ControllerEvents_ListenerExample is required to be attached to a Controller that has the VRTK_ControllerEvents script attached to it");
                return;
            }

            audio = GetComponent <AudioSource> ();

            //Setup controller event listeners
            GetComponent <VRTK_ControllerEvents>().TriggerPressed  += new ControllerInteractionEventHandler(DoTriggerPressed);
            GetComponent <VRTK_ControllerEvents>().TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased);

            GetComponent <VRTK_ControllerEvents>().TriggerTouchStart += new ControllerInteractionEventHandler(DoTriggerTouchStart);
            GetComponent <VRTK_ControllerEvents>().TriggerTouchEnd   += new ControllerInteractionEventHandler(DoTriggerTouchEnd);

            GetComponent <VRTK_ControllerEvents>().TriggerHairlineStart += new ControllerInteractionEventHandler(DoTriggerHairlineStart);
            GetComponent <VRTK_ControllerEvents>().TriggerHairlineEnd   += new ControllerInteractionEventHandler(DoTriggerHairlineEnd);

            GetComponent <VRTK_ControllerEvents>().TriggerClicked   += new ControllerInteractionEventHandler(DoTriggerClicked);
            GetComponent <VRTK_ControllerEvents>().TriggerUnclicked += new ControllerInteractionEventHandler(DoTriggerUnclicked);

            GetComponent <VRTK_ControllerEvents>().TriggerAxisChanged += new ControllerInteractionEventHandler(DoTriggerAxisChanged);

            GetComponent <VRTK_ControllerEvents>().GripPressed  += new ControllerInteractionEventHandler(DoGripPressed);
            GetComponent <VRTK_ControllerEvents>().GripReleased += new ControllerInteractionEventHandler(DoGripReleased);

            GetComponent <VRTK_ControllerEvents>().GripTouchStart += new ControllerInteractionEventHandler(DoGripTouchStart);
            GetComponent <VRTK_ControllerEvents>().GripTouchEnd   += new ControllerInteractionEventHandler(DoGripTouchEnd);

            GetComponent <VRTK_ControllerEvents>().GripHairlineStart += new ControllerInteractionEventHandler(DoGripHairlineStart);
            GetComponent <VRTK_ControllerEvents>().GripHairlineEnd   += new ControllerInteractionEventHandler(DoGripHairlineEnd);

            GetComponent <VRTK_ControllerEvents>().GripClicked   += new ControllerInteractionEventHandler(DoGripClicked);
            GetComponent <VRTK_ControllerEvents>().GripUnclicked += new ControllerInteractionEventHandler(DoGripUnclicked);

            GetComponent <VRTK_ControllerEvents>().GripAxisChanged += new ControllerInteractionEventHandler(DoGripAxisChanged);

            GetComponent <VRTK_ControllerEvents>().TouchpadPressed  += new ControllerInteractionEventHandler(DoTouchpadPressed);
            GetComponent <VRTK_ControllerEvents>().TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased);

            GetComponent <VRTK_ControllerEvents>().TouchpadTouchStart += new ControllerInteractionEventHandler(DoTouchpadTouchStart);
            GetComponent <VRTK_ControllerEvents>().TouchpadTouchEnd   += new ControllerInteractionEventHandler(DoTouchpadTouchEnd);

            GetComponent <VRTK_ControllerEvents>().TouchpadAxisChanged += new ControllerInteractionEventHandler(DoTouchpadAxisChanged);

            GetComponent <VRTK_ControllerEvents>().ButtonOnePressed  += new ControllerInteractionEventHandler(DoButtonOnePressed);
            GetComponent <VRTK_ControllerEvents>().ButtonOneReleased += new ControllerInteractionEventHandler(DoButtonOneReleased);

            GetComponent <VRTK_ControllerEvents>().ButtonOneTouchStart += new ControllerInteractionEventHandler(DoButtonOneTouchStart);
            GetComponent <VRTK_ControllerEvents>().ButtonOneTouchEnd   += new ControllerInteractionEventHandler(DoButtonOneTouchEnd);

            GetComponent <VRTK_ControllerEvents>().ButtonTwoPressed  += new ControllerInteractionEventHandler(DoButtonTwoPressed);
            GetComponent <VRTK_ControllerEvents>().ButtonTwoReleased += new ControllerInteractionEventHandler(DoButtonTwoReleased);

            GetComponent <VRTK_ControllerEvents>().ButtonTwoTouchStart += new ControllerInteractionEventHandler(DoButtonTwoTouchStart);
            GetComponent <VRTK_ControllerEvents>().ButtonTwoTouchEnd   += new ControllerInteractionEventHandler(DoButtonTwoTouchEnd);

            GetComponent <VRTK_ControllerEvents>().StartMenuPressed  += new ControllerInteractionEventHandler(DoStartMenuPressed);
            GetComponent <VRTK_ControllerEvents>().StartMenuReleased += new ControllerInteractionEventHandler(DoStartMenuReleased);

            GetComponent <VRTK_ControllerEvents>().ControllerEnabled  += new ControllerInteractionEventHandler(DoControllerEnabled);
            GetComponent <VRTK_ControllerEvents>().ControllerDisabled += new ControllerInteractionEventHandler(DoControllerDisabled);

            GetComponent <VRTK_ControllerEvents>().ControllerIndexChanged += new ControllerInteractionEventHandler(DoControllerIndexChanged);
        }
예제 #31
0
 // Use this for initialization
 void Start()
 {
     time      = 0f;
     shotSound = GetComponent <AudioSource>();
 }
예제 #32
0
 void Awake()
 {
     bulletAudio = GetComponent <AudioSource> ();
 }
예제 #33
0
 void Start()
 {
     GameAudio = GetComponent <AudioSource>();
 }
예제 #34
0
	public void SetSource(AudioSource _source){
		source = _source;
		source.volume = volume;
		source.clip = clip;
		source.loop = loop;
	}
예제 #35
0
 public void FreeSource(AudioSource source)
 {
     throw new NotImplementedException ();
 }
 private void Awake()
 {
     audioSource = GetComponent <AudioSource>();
     shotSound   = AudioManager.current.assaultRifleShots;
     muzzleFlash = GetComponentInChildren <ParticleSystem>();
 }
예제 #37
0
		private static void INTERNAL_CALL_Pause(AudioSource self){}
예제 #38
0
 // Start is called before the first frame update
 void Start()
 {
     soundTitle = GetComponent <AudioSource>();
 }
예제 #39
0
 // Use this for initialization
 void Start()
 {
     burn = GetComponent <AudioSource> ();
 }
예제 #40
0
 void Start()
 {
     psn       = GameObject.Find("GameManager").GetComponent <PendantSystemNew>();
     pimSource = psn.GetComponentInChildren <AudioSource>();
     pSelector = GameObject.Find("PendantSelector");
 }
예제 #41
0
 void Awake()
 {
     if(audioSource == null)
         audioSource = gameObject.AddComponent<AudioSource>();
     if(!Application.isPlaying) return;
     if(audioIsValid && (clipType == ClipType.ClipFromSoundManager || clipType == ClipType.ClipFromGroup)) {
         if (playOnAwake)
             Play();
     }
     this.isVisible = false;
 }
예제 #42
0
 // Start is called before the first frame update
 void Start()
 {
     animator = GetComponent <Animator>();
     shoot    = GetComponent <AudioSource>();
     StartCoroutine(Waiting(time));
 }
예제 #43
0
 public void setSource(AudioSource _source)
 {
     source      = _source;
     source.clip = clip;
 }
예제 #44
0
 private void Start()
 {
     audioSource      = GetComponent <AudioSource>();
     abandonedBullets = GameObject.Find("AbandonBullets").transform;
 }
예제 #45
0
        public void QueuePlayback(AudioSource audioSource, byte[] data)
        {
            if (this.isDisposed)
                throw new ObjectDisposedException ("OpenALPlaybackProvider");
            if (audioSource == null)
                throw new ArgumentNullException ("audioSource");

            Stack<SourceBuffer> bufferStack;
            if (!this.buffers.TryGetValue (audioSource, out bufferStack))
                this.buffers[audioSource] = bufferStack = new Stack<SourceBuffer>();

            lock (this.pool.SyncRoot)
            {
                Source source = this.pool.RequestSource (audioSource);

                Tuple<float, float> gain;
                if (this.gains.TryGetValue (audioSource, out gain))
                    source.Gain = gain.Item2;
                else
                    source.Gain = this.normalGain;

                const int bufferLen = 4;

                if (data.Length == 0)
                    return;

                if (!source.IsPlaying)
                {
                    OpenAL.DebugFormat ("{0} bound to {1} isn't playing, inserting silent buffers", audioSource, source);

                    RequireBuffers (bufferStack, source, bufferLen);
                    for (int i = 0; i < bufferLen; ++i)
                    {
                        OpenALAudioFormat format = audioSource.CodecSettings.ToOpenALFormat();
                        SourceBuffer wait = bufferStack.Pop();
                        wait.Buffer (new byte[format.GetBytes ((uint)audioSource.CodecSettings.FrameSize)], format, (uint)audioSource.CodecSettings.SampleRate);
                        source.QueueAndPlay (wait);
                    }
                }

                RequireBuffers (bufferStack, source, 1);
                SourceBuffer buffer = bufferStack.Pop();

                buffer.Buffer (data, audioSource.CodecSettings.ToOpenALFormat(), (uint)audioSource.CodecSettings.SampleRate);
                source.QueueAndPlay (buffer);
            }
        }
예제 #46
0
 void Start()
 {
     sound = GetComponent <AudioSource>();
     plane = GameObject.FindGameObjectWithTag("GamePlane");
     InvokeRepeating("Shoot", 1.0f, 0.5f);
 }
        private void SetAudio(AudioSource audio)
        {
            MCI_DGV_SETAUDIO_PARMS s = new MCI_DGV_SETAUDIO_PARMS();
            int err;
            StringBuilder buf = new StringBuilder(1000);
            if (deviceID > 0)
            {
                err = mciSendCommandA(deviceID, MCI_SETAUDIO, MCI_WAIT | MCI_SET_OFF, ref s);
                if (err != 0)
                {
                    mciGetErrorStringA(err, buf, 1000);
                    //throw new ApplicationException("设置声道出错," + buf.ToString());
                }
                else
                {
                    switch (audio)
                    {
                        case AudioSource.Left:
                            s.dwValue = MCI_DGV_SETAUDIO_SOURCE_LEFT;
                            break;
                        case AudioSource.Stereo:
                            s.dwValue = MCI_DGV_SETAUDIO_SOURCE_STEREO;
                            break;
                        case AudioSource.Right:
                            s.dwValue = MCI_DGV_SETAUDIO_SOURCE_RIGHT;
                            break;
                    }
                    s.dwItem = MCI_DGV_SETAUDIO_SOURCE;
                    err = mciSendCommandA(deviceID, MCI_SETAUDIO, MCI_DGV_SETAUDIO_VALUE | MCI_DGV_SETAUDIO_ITEM, ref s);
                    if (err != 0)
                    {
                        mciGetErrorStringA(err, buf, 1000);
                        //throw new ApplicationException("设置声道出错," + buf.ToString());
                    }
                    else
                    {
                        s.dwValue = MCI_DGV_SETAUDIO_SOURCE_AVERAGE;
                        s.dwItem = MCI_DGV_SETAUDIO_SOURCE;
                        err = mciSendCommandA(deviceID, MCI_SETAUDIO, MCI_DGV_SETAUDIO_VALUE | MCI_DGV_SETAUDIO_ITEM, ref s);

                        if (err != 0)
                        {
                            mciGetErrorStringA(err, buf, 1000);
                            //throw new ApplicationException("设置声道出错," + buf.ToString());
                        }
                        else
                        {
                            err = mciSendCommandA(deviceID, MCI_SETAUDIO, MCI_WAIT | MCI_SET_ON, ref s);
                            if (err != 0)
                            {
                                mciGetErrorStringA(err, buf, 1000);
                                //throw new ApplicationException("设置声道出错," + buf.ToString());
                            }
                        }
                    }
                }
            }
        }
예제 #48
0
    public IEnumerator startIntroduction()
    {
        yield return(new WaitForSeconds(fadeTime));

        Dialogue dialogue1 = new Dialogue();

        dialogue1.sentences.Add("Bonjour Wilson, je suis désolé de cette mutation imprévue. Nous avions besoin d'un remplaçant capable et disponible, ce que vous êtes je n'en doute pas.");
        dialogue1.sentences.Add("Oscar Sostiene, votre prédécesseur, a disparu ce matin et nous sommes actuellement à sa recherche. Nous craignons que certaines personnes en aient voulu à son bonheur.");
        dialogue1.sentences.Add("La plupart de ses affaires sont toujours dans le bureau, n'en soyez pas dérangé une équipe passera d'ici peu.");
        dialogue1.sentences.Add("Enfin, ce n'est pas votre problème, vous êtes gradé désormais, chose assez rare pour quelqu'un de votre classe, soyez-en fier !");
        FindObjectOfType <DialogSystem>().StartDialogue(dialogue1);

        AudioManager.instance.PlayMusic("introDialog01");

        yield return(new WaitForSeconds(timeInElevator - 3f));


        AudioManager.instance.PlaySound("liftEnd");

        AudioSource sound = liftLoopObj.GetComponent <AudioSource>();

        sound.volume = 0;

        Destroy(tutoRotateObject);

        yield return(new WaitForSeconds(3f));


        elevatorDoorAnim.SetBool("Open", true);
        AudioManager.instance.PlaySound("elevatorDoor");

        yield return(new WaitForSeconds(.5f));

        tutoMoveObject.SetActive(true);

        while (!goToNextStep)
        {
            if (!isInElevator)
            {
                goToNextStep = true;
            }
            yield return(null);
        }

        Destroy(tutoMoveObject);

        yield return(new WaitForSeconds(3f));

        Dialogue dialogue2 = new Dialogue();

        dialogue2.sentences.Add("Ne vous laissez pas impressionner par cette théâtralité, vous vous y habituerez vite.");
        dialogue2.sentences.Add("Soyez le bienvenue Wilson, vous êtes ici chez vous.");

        FindObjectOfType <DialogSystem>().StartDialogue(dialogue2);

        AudioManager.instance.StopMusic();
        AudioManager.instance.PlayMusic("introDialog02");


        yield return(new WaitForSeconds(10f));

        Dialogue dialogueOrdre = new Dialogue();

        dialogueOrdre.sentences.Add("Allez y je vous prie.");

        hallDoorAnim.SetBool("Open", true);
        AudioManager.instance.PlaySound("doorOpen");

        yield return(new WaitForSeconds(1f));


        while (goToNextStep)
        {
            if (!isInHall)
            {
                goToNextStep = false;
            }
            yield return(null);
        }

        //intro3
        Dialogue dialogue3 = new Dialogue();

        dialogue3.sentences.Add("Vous êtes des nôtres désormais Wilson, dans une relation de confiance. Si jamais vous trouvez des informations sur Oscar, n'y prettez pas attention.");
        dialogue3.sentences.Add("Il sera très bientôt retrouvé ! Écoutez moi simplement et tout ira pour le mieux.");
        FindObjectOfType <DialogSystem>().StartDialogue(dialogue3);

        AudioManager.instance.StopMusic();
        AudioManager.instance.PlayMusic("introDialog03");

        yield return(new WaitForSeconds(5f));

        while (!goToNextStep)
        {
            if (enterInRoom)
            {
                goToNextStep = true;
            }
            yield return(null);
        }

        while (goToNextStep)
        {
            if (closeDoor)
            {
                goToNextStep = false;
            }
            yield return(null);
        }

        doorRoomAnim.SetBool("Open", false);
        AudioManager.instance.PlaySound("doorClose");

        yield return(new WaitForSeconds(.5f));

        //intro4
        Dialogue dialogue4 = new Dialogue();

        dialogue4.sentences.Add("Suite à l’incident de ce matin, les portes restent fermées durant les heures de travail.");
        dialogue4.sentences.Add("Ne vous en faites pas je vous accompagnerai le temps de vous apprendre le métier. Commencez par vous placer devant le panneau de commande.");

        FindObjectOfType <DialogSystem>().StartDialogue(dialogue4);

        AudioManager.instance.StopMusic();
        AudioManager.instance.PlayMusic("introDialog04");

        yield return(new WaitForSeconds(7f));

        while (!goToNextStep)
        {
            if (isAtDesk)
            {
                goToNextStep = true;
            }
            yield return(null);
        }

        StartCoroutine(startMission());
    }
예제 #49
0
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     m_AudioSource = GetComponent<AudioSource>();
 }
예제 #50
0
 public ReceivedAudioEventArgs(AudioSource source, byte[][] data)
     : base(source)
 {
     AudioData = data;
 }
예제 #51
0
 public void TearDown()
 {
     this.provider = null;
     this.source = null;
     this.receiver = null;
     this.sender = null;
     this.context = null;
 }
예제 #52
0
        public static void BeginCapture(this IAudioEngine self, AudioSource source, IChannelInfo channel)
        {
            if (self == null)
                throw new ArgumentNullException ("self");
            if (channel == null)
                throw new ArgumentNullException ("channel");

            self.BeginCapture (source, new[] { channel });
        }
예제 #53
0
        public void SerializeDeserialize()
        {
            var stream = new MemoryStream (new byte[20480], true);
            var writer = new StreamValueWriter (stream);
            var reader = new StreamValueReader (stream);

            var source = GetTestSource();
            source.Serialize (null, writer);
            long length = stream.Position;
            stream.Position = 0;

            source = new AudioSource (null, reader);
            AssertSourcesMatch (GetTestSource(), source);
            Assert.AreEqual (length, stream.Position);
        }
 // Start is called before the first frame update
 void Start()
 {
     audioSource             = GetComponent <AudioSource>();
     playerMovementComponent = gameObject.GetComponent <PlayerMovementScript>();
 }
예제 #55
0
    private AudioSource playerAudio; // 사용할 오디오 소스 컴포넌트

    private void Start() {
        // 게임 오브젝트로부터 사용할 컴포넌트들을 가져와 변수에 할당
        playerRigidbody = GetComponent<Rigidbody2D>();
        animator = GetComponent<Animator>();
        playerAudio = GetComponent<AudioSource>();
    }
 private void Awake()
 {
     audioSource = GetComponent<AudioSource>();
     EventCoordinator.RegisterListener<EnemyDiedEvent>(OnEnemyDeath);
 }
예제 #57
0
 public AudioSourceEventArgs(AudioSource source)
 {
     Source = source;
 }
예제 #58
0
 void Start()
 {
     _audioSource = GetComponent <AudioSource>();
 }
예제 #59
0
        public static void BeginCapture(this IAudioEngine self, AudioSource source, IUserInfo user)
        {
            if (self == null)
                throw new ArgumentNullException ("self");
            if (user == null)
                throw new ArgumentNullException ("user");

            self.BeginCapture (source, new[] { user });
        }
예제 #60
0
    // Use this for initialization
    void Start()
    {
        //Get the number of points
        int numPoints = locationPoints.Length;

        //If there is at least one, create the interest points
        if (numPoints >= 1)
        {
            interPoints = new interestPoint[numPoints];

            for (int i = 0; i < numPoints; i++)
            {
                interPoints[i].point = locationPoints[i];

                //Set the y values to the height of the terrain at that point + enemy max height
                interPoints[i].point.y = tData.GetHeight((int)locationPoints[i].x, (int)locationPoints[i].z);

                if (i < dRads.Length)
                {
                    interPoints[i].detectRadius = dRads[i];
                }
                else
                {
                    interPoints[i].detectRadius = DEFAULT_DRAD;
                }

                if (i < sRads.Length)
                {
                    interPoints[i].spawnRadius = sRads[i];
                }
                else
                {
                    interPoints[i].spawnRadius = DEFAULT_SRAD;
                }

                interPoints[i].inRange = false;
            }
        }
        //Otherwise create a default interest point
        else
        {
            interPoints = new interestPoint[1];

            interPoints[0].point        = new Vector3(0.0f, 0.0f, 0.0f);
            interPoints[0].detectRadius = DEFAULT_DRAD;
            interPoints[0].spawnRadius  = DEFAULT_SRAD;
            interPoints[0].inRange      = false;
        }

        //for(int i = 0; i < interPoints.Length; i++)
        //{
        //    GameObject.Instantiate(markerPrefab, interPoints[i].point, Quaternion.identity);
        //}

        //Safe point setup
        if (safeDistance <= 0)
        {
            safeDistance = DEFAULT_SAFE_DISTANCE;
        }

        sPoints = new interestPoint[safePoints.Length];

        for (int i = 0; i < safePoints.Length; i++)
        {
            sPoints[i].detectRadius = safeDistance;
            sPoints[i].inRange      = false;
            sPoints[i].point        = safePoints[i];
        }

        playerIsSafe = false;

        //Get the player object
        playerObj    = GameObject.FindGameObjectWithTag("Player");
        playerSource = playerObj.GetComponents <AudioSource>()[1];  //The second audio source

        //Get the enemy object
        enemyObj = GameObject.FindGameObjectWithTag("Enemy");
        //Get the enemy's script
        eScript = enemyObj.GetComponent <Enemy>();

        collectables        = GameObject.FindGameObjectsWithTag("Collectable");
        canvasTexts         = playerCanvas.GetComponentsInChildren <Text>();
        canvasTexts[0].text = "Collected Items:  " + collectedItems + " / " + collectables.Length;
        isPaused            = false;
    }