示例#1
0
        public override int Deserialize(byte[] data)
        {
            var bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4));

                int numItems = reader.ReadByte();

                Variables = new AudVariable[numItems];

                for (int i = 0; i < numItems; i++)
                {
                    Variables[i] = new AudVariable
                    {
                        Name     = new audHashString(parent, reader.ReadUInt32()),
                        Value    = reader.ReadSingle(),
                        UnkFloat = reader.ReadSingle(),
                        Flags    = reader.ReadByte()
                    };
                }
            }

            return(data.Length);
        }
        public override int Deserialize(byte[] data)
        {
            int bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                UnkShort = reader.ReadUInt16();

                UnkShort1 = reader.ReadUInt16();

                UnkShort2 = reader.ReadUInt16();

                UnkShort3 = reader.ReadUInt16();

                ParameterHash = new audHashString(parent, reader.ReadUInt32());

                ParameterHash1 = new audHashString(parent, reader.ReadUInt32());

                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4));

                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4));

                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4));

                return((int)reader.BaseStream.Position);
            }
        }
示例#3
0
        public override int Deserialize(byte[] data)
        {
            int bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()), bytesRead + ((int)reader.BaseStream.Position - 4));

                FrameStartTime = reader.ReadInt32();

                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()), bytesRead + ((int)reader.BaseStream.Position - 4));

                FrameTimeInterval = reader.ReadInt16();

                int itemsCount = reader.ReadByte();

                Variables = new audHashString[itemsCount];

                for (int i = 0; i < itemsCount; i++)
                {
                    Variables[i] = new audHashString(parent, reader.ReadUInt32());
                }

                UnkByteData = new byte[itemsCount];

                for (int i = 0; i < itemsCount; i++)
                {
                    UnkByteData[i] = reader.ReadByte();
                }

                return((int)reader.BaseStream.Position);
            }
        }
示例#4
0
        public override int Deserialize(byte[] data)
        {
            int bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4));

                var itemsCount = reader.ReadByte();

                UnkData = new audMathOperationSoundData[itemsCount];

                for (int i = 0; i < itemsCount; i++)
                {
                    UnkData[i] = new audMathOperationSoundData
                    {
                        UnkByte        = reader.ReadByte(),
                        UnkInt         = reader.ReadInt32(),
                        UnkInt1        = reader.ReadInt32(),
                        UnkInt2        = reader.ReadInt32(),
                        UnkInt3        = reader.ReadInt32(),
                        UnkInt4        = reader.ReadInt32(),
                        ParameterHash  = new audHashString(parent, reader.ReadUInt32()),
                        ParameterHash1 = new audHashString(parent, reader.ReadUInt32())
                    };
                }

                return((int)reader.BaseStream.Position);
            }
        }
示例#5
0
        public override int Deserialize(byte[] data)
        {
            int bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                UnkByte = reader.ReadByte();

                DataStart = reader.ReadByte();

                reader.ReadBytes(DataStart);

                int numItems = reader.ReadByte();

                AudioTrackUnkFloats = new float[numItems];

                for (int i = 0; i < numItems; i++)
                {
                    AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                    bytesRead + ((int)reader.BaseStream.Position - 4));

                    AudioTrackUnkFloats[i] = reader.ReadSingle();
                }
            }

            return(data.Length);
        }
示例#6
0
        private void OnPeerDisconnected()
        {
            Logger.Log($"Peer disconnected.");

            //// Update the video source if needed
            //var selectedVideoTrack = LocalVideoTracks.SelectedItem;
            //if (selectedVideoTrack.IsRemote)
            //{

            //    _remoteVideoPlayer.Pause();
            //    _remoteVideoPlayer.Source = null;
            //    remoteVideo.SetMediaPlayer(null);
            //    _remoteVideoSource?.NotifyError(MediaStreamSourceErrorStatus.ConnectionToServerLost);
            //    _remoteMediaSource?.Dispose();
            //}

            ThreadHelper.RunOnMainThread(() =>
            {
                // Remove all remote tracks
                for (int i = AudioTracks.Count - 1; i >= 0; --i)
                {
                    if (AudioTracks[i].IsRemote)
                    {
                        AudioTracks.RemoveAt(i);
                    }
                }
                for (int i = VideoTracks.Count - 1; i >= 0; --i)
                {
                    if (VideoTracks[i].IsRemote)
                    {
                        VideoTracks.RemoveAt(i);
                    }
                }
            });
        }
示例#7
0
        public override int Deserialize(byte[] data)
        {
            int bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()), bytesRead + ((int)reader.BaseStream.Position - 4));

                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()), bytesRead + ((int)reader.BaseStream.Position - 4));

                UnkByte = reader.ReadByte();

                UnkFloat = reader.ReadSingle();

                UnkFloat1 = reader.ReadSingle();

                UnkInt2 = reader.ReadInt32();

                UnkCurvesHash = new audHashString(parent, reader.ReadUInt32());

                ParameterHash = new audHashString(parent, reader.ReadUInt32());

                ParameterHash1 = new audHashString(parent, reader.ReadUInt32());

                ParameterHash2 = new audHashString(parent, reader.ReadUInt32());

                ParameterHash3 = new audHashString(parent, reader.ReadUInt32());

                ParameterHash4 = new audHashString(parent, reader.ReadUInt32());

                return((int)reader.BaseStream.Position);
            }
        }
示例#8
0
        public override int Deserialize(byte[] data)
        {
            var bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                var itemsCount = reader.ReadInt32();

                Items = new audSoundSetItem[itemsCount];

                for (int i = 0; i < itemsCount; i++)
                {
                    Items[i] = new audSoundSetItem
                    {
                        ScriptName = new audHashString(parent, reader.ReadUInt32()),
                        SoundName  = new audHashString(parent, reader.ReadUInt32())
                    };

                    AudioTracks.Add(new audHashDesc(Items[i].SoundName,
                                                    bytesRead + ((int)reader.BaseStream.Position - 4)));
                }
            }

            return(data.Length);
        }
示例#9
0
        public override int Deserialize(byte[] data)
        {
            var bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                UnkShort = reader.ReadUInt16();

                UnkShort1 = reader.ReadUInt16();

                UnkShort2 = reader.ReadUInt16();

                UnkShort3 = reader.ReadUInt16();

                UnkHash = new audHashString(parent, reader.ReadUInt32());

                ParameterHash = new audHashString(parent, reader.ReadUInt32());

                ParameterHash1 = new audHashString(parent, reader.ReadUInt32());

                ParameterHash2 = new audHashString(parent, reader.ReadUInt32());

                ParameterHash3 = new audHashString(parent, reader.ReadUInt32());

                int numItems = reader.ReadByte();

                for (int i = 0; i < numItems; i++)
                {
                    AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                    bytesRead + ((int)reader.BaseStream.Position - 4));
                }
            }

            return(data.Length);
        }
示例#10
0
        public override int Deserialize(byte[] data)
        {
            var bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()), bytesRead + ((int)reader.BaseStream.Position - 4));

                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()), bytesRead + ((int)reader.BaseStream.Position - 4));

                UnkFloat = reader.ReadSingle();                                  //0x8

                UnkFloat1 = reader.ReadSingle();                                 //0xC

                ParameterHash = new audHashString(parent, reader.ReadUInt32());  //0x10

                ParameterHash1 = new audHashString(parent, reader.ReadUInt32()); //0x14

                ParameterHash2 = new audHashString(parent, reader.ReadUInt32()); //0x18

                ParameterHash3 = new audHashString(parent, reader.ReadUInt32()); //0x1C

                ParameterHash4 = new audHashString(parent, reader.ReadUInt32()); //0x20

                UnkInt = reader.ReadInt32();                                     //0x24-0x28

                ParameterHash5 = new audHashString(parent, reader.ReadUInt32()); //0x28-0x2C

                UnkByte = reader.ReadByte();                                     //0x2C-0x2D

                return((int)reader.BaseStream.Position);
            }
        }
示例#11
0
 public void AddAudioTrack(LocalAudioTrack track, string deviceName)
 {
     ThreadHelper.EnsureIsMainThread();
     AudioTracks.Add(new AudioTrackViewModel(track, deviceName));
     LocalTracks.Add(new LocalTrackViewModel(Symbol.Volume)
     {
         DisplayName = deviceName
     });
 }
示例#12
0
 // Use this for initialization
 void Start()
 {
     player      = GameObject.FindWithTag("Player");
     audioTracks = GameObject.FindWithTag("Audio").GetComponent <AudioTracks>();
     if (blastFrequency > 0)
     {
         InvokeRepeating("Shoot", blastFrequency, blastFrequency);
     }
 }
示例#13
0
 private void rbtracks_CheckedChanged(object sender, EventArgs e)
 {
     // Now defaults to starting with every track selected
     for (int i = 0; i < AudioTracks.Items.Count; i++)
     {
         AudioTracks.SetItemChecked(i, !demuxNoAudiotracks.Checked);
     }
     AudioTracks.Enabled = demuxTracks.Checked;
 }
示例#14
0
        public override int Deserialize(byte[] data)
        {
            int bytesRead = base.Deserialize(data);

            using (BinaryReader reader =
                       new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                UnkShortA = reader.ReadUInt16();                                 //0x0-0x2

                UnkShortA1 = reader.ReadUInt16();                                //0x2-0x4

                UnkShortB = reader.ReadUInt16();                                 //0x4-0x6

                UnkShortB1 = reader.ReadUInt16();                                //0x6-0x8

                UnkByteA = reader.ReadByte();                                    //0x8-0x9

                UnkByteA1 = reader.ReadByte();                                   //0x9-0xA

                UnkInt = reader.ReadInt32();                                     //0xA-0xE

                UnkShortC = reader.ReadUInt16();                                 //0xE-0x10

                UnkIntA = reader.ReadInt32();                                    //0x10-0x14

                UnkIntA1 = reader.ReadInt32();                                   //0x14-0x18

                CurvesUnkHash = new audHashString(parent, reader.ReadUInt32());  //0x18-0x1C

                CurvesUnkHash1 = new audHashString(parent, reader.ReadUInt32()); //0x1C-0x20

                CurvesUnkHash2 = new audHashString(parent, reader.ReadUInt32()); //0x20-0x24

                ParameterHash = new audHashString(parent, reader.ReadUInt32());  //0x24-0x28

                ParameterHash1 = new audHashString(parent, reader.ReadUInt32()); //0x28-0x2C

                ParameterHash2 = new audHashString(parent, reader.ReadUInt32()); //0x2C-0x30

                ParameterHash3 = new audHashString(parent, reader.ReadUInt32()); //0x30-0x34

                ParameterHash4 = new audHashString(parent, reader.ReadUInt32()); //0x34-0x38

                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4)); //0x38-0x3C

                UnkIntC = reader.ReadInt32();                                       //0x3C-0x40

                ParameterHash5 = new audHashString(parent, reader.ReadUInt32());    //0x40-0x44

                UnkFloat = reader.ReadSingle();                                     //0x44-0x48

                UnkFloat1 = reader.ReadSingle();                                    //0x48-0x4C

                return((int)reader.BaseStream.Position);
            }
        }
        public override int Deserialize(byte[] data)
        {
            var bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4)); //0x0-0x4

                var itemCount = reader.ReadInt32();                                 //0x4-0x8

                UnkArrayData = new audParameterTransformData[itemCount];

                for (int i = 0; i < itemCount; i++)
                {
                    UnkArrayData[i] = new audParameterTransformData
                    {
                        ParameterHash = new audHashString(parent, reader.ReadUInt32()),
                        UnkFloat      = reader.ReadSingle(),
                        UnkFloat1     = reader.ReadSingle()
                    };

                    var nestedItemCount = reader.ReadInt32();

                    UnkArrayData[i].NestedData = new audParameterTransformDataNested[nestedItemCount];

                    for (int x = 0; x < nestedItemCount; x++)
                    {
                        UnkArrayData[i].NestedData[x] = new audParameterTransformDataNested
                        {
                            UnkFloat      = reader.ReadSingle(),
                            UnkInt        = reader.ReadInt32(),
                            ParameterHash = new audHashString(parent, reader.ReadUInt32()),
                            UnkFloat1     = reader.ReadSingle(),
                            UnkFloat2     = reader.ReadSingle()
                        };

                        var pairItemCount = reader.ReadInt32();

                        UnkArrayData[i].NestedData[x].NestedItems = new Pair <float, float> [pairItemCount];

                        for (int y = 0; y < pairItemCount; y++)
                        {
                            UnkArrayData[i].NestedData[x].NestedItems[y] =
                                new Pair <float, float>(reader.ReadSingle(), reader.ReadSingle());
                        }
                    }
                }

                return((int)reader.BaseStream.Position);
            }
        }
示例#16
0
        /// <summary>
        /// Callback on remote audio track added.
        ///
        /// For simplicity this grabs the first remote audio track found. However currently the user has no
        /// control over audio output, so this is only used for audio statistics.
        /// </summary>
        /// <param name="track">The audio track added.</param>
        /// <seealso cref="RemoteAudioTrack_FrameReady"/>
        private void OnRemoteAudioTrackAdded(RemoteAudioTrack track)
        {
            Logger.Log($"Added remote audio track {track.Name} of transceiver {track.Transceiver.Name}.");

            ThreadHelper.RunOnMainThread(() =>
            {
                var trvm = Transceivers.SingleOrDefault(tr => tr.Transceiver == track.Transceiver);
                Debug.Assert(trvm.Transceiver.RemoteAudioTrack == track);
                trvm.NotifyReceiverChanged(); // this is thread-aware
                // This raises property changed events in current thread, needs to be main one
                AudioTracks.Add(new AudioTrackViewModel(track));
            });
        }
示例#17
0
        /// <summary>
        /// Builds an argument string from the settings
        /// </summary>
        /// <returns>A string to be used as argument to Handbrake CLI</returns>
        public string Build()
        {
            var sb = new StringBuilder();

            sb.Append($"--format {Format} ");
            if (MaxHeight > 0)
            {
                sb.Append($"--maxHeight {MaxHeight} ");
            }
            if (MaxWidth > 0)
            {
                sb.Append($"--maxWidth {MaxWidth} ");
            }
            if (WebOptimize)
            {
                sb.Append("--optimize ");
            }

            sb.Append($"--modulus {Modulus} ");
            sb.Append($"--{Anamorphic.Formatted()} ");
            sb.Append($"--encoder {Encoder} ");
            sb.Append($"--quality {VideoQuality} ");
            sb.Append($"--{FrameRateSetting} ");
            sb.Append($"--rate {FrameRate} ");
            sb.Append($"--aencoder {AudioEncoder.Formatted()} ");
            if (AudioEncoder == AudioEncoder.copy)
            {
                sb.Append($"--audio-copy-mask {AudioCopyMask.Formatted()} ");
            }
            if (AudioEncoder.ToString().StartsWith("copy"))
            {
                sb.Append($"--audio-fallback {AudioEncoderFallback.Formatted()} ");
            }
            sb.Append($"--mixdown {Mixdown.Formatted()} ");
            sb.Append($"--arate {AudioSampleRate.Formatted()} ");
            sb.Append($"--ab {AudioBitrate} ");
            sb.Append($"--{AudioTracks.Formatted()} ");
            sb.Append($"--gain {AudioGain} ");
            sb.Append($"--subtitle none ");
            if (TwoPass)
            {
                sb.Append("--two-pass ");
                if (TurboTwoPass && (Encoder == Encoder.x264 || Encoder == Encoder.x265))
                {
                    sb.Append("--turbo ");
                }
            }
            sb.Append($"--encoder-level {EncoderLevel.Formatted()} ");
            sb.Append("--verbose 0 ");
            return(sb.ToString());
        }
示例#18
0
 private async void Playback_MediaStopped()
 {
     await DispatchHelper.InvokeInUIThread(CoreDispatcherPriority.Normal, async() =>
     {
         AudioTracks.Clear();
         Subtitles.Clear();
         OnPropertyChanged(nameof(AudioTracks));
         OnPropertyChanged(nameof(Subtitles));
         OnPropertyChanged(nameof(CurrentAudioTrack));
         OnPropertyChanged(nameof(CurrentSubtitle));
         OnPropertyChanged(nameof(IsPlaying));
         await ClearMediaTransportControls();
     });
 }
示例#19
0
        /// <summary>
        /// Callback on remote audio track removed.
        /// </summary>
        /// <param name="track">The audio track removed.</param>
        private void OnRemoteAudioTrackRemoved(Transceiver transceiver, RemoteAudioTrack track)
        {
            Logger.Log($"Removed remote audio track {track.Name} from transceiver {transceiver.Name}.");

            var atvm = AudioTracks.Single(vm => vm.TrackImpl == track);

            AudioTracks.Remove(atvm);

            //IAudioTrack newPlaybackAudioTrack = null;
            //if (LocalAudioTracks.Count > 0)
            //{
            //    newPlaybackAudioTrack = LocalAudioTracks[0].Track;
            //}
            //SwitchMediaPlayerSource(newPlaybackAudioTrack, _playbackVideoTrack);
        }
示例#20
0
    public void PlayTrack(AudioTracks track)
    {
        if (track != _queuedTracks[flip])
        {
            _queuedTracks[1 - flip] = track;

            nextEventTime = AudioSettings.dspTime + 2.0f;

            audioSources[1 - flip].clip = _clips[(int)track];
            audioSources[1 - flip].PlayScheduled(nextEventTime);

            StartFadeOut();
            StartCoroutine(InvokeRealtimeCoroutine(StartFadeIn, 2f));
        }
    }
示例#21
0
 public void StopAudio(AudioTracks pTrack)
 {
     if (_audioClips.Count > (int)pTrack)
     {
         for (int i = 0; i != _audioSources.Count; i++)
         {
             if (_audioSources[i].clip != null)
             {
                 if (_audioSources[i].clip.name == _audioClips[(int)pTrack].name)
                 {
                     _audioSources[i].Stop();
                 }
             }
         }
     }
 }
示例#22
0
 private async void OnMediaTrackAdded(TrackType type, int trackId, string name)
 {
     var item = new DictionaryKeyValue
     {
         Id   = trackId,
         Name = name
     };
     await DispatchHelper.InvokeInUIThread(CoreDispatcherPriority.Normal, () =>
     {
         if (type == TrackType.Audio)
         {
             if (AudioTracks.Count == 0)
             {
                 AudioTracks.Add(new DictionaryKeyValue {
                     Id = -1, Name = "Disabled"
                 });
             }
             AudioTracks.Add(item);
             if (_currentAudioTrack == null)
             {
                 _currentAudioTrack = item;
             }
             OnPropertyChanged(nameof(AudioTracks));
             OnPropertyChanged(nameof(CurrentAudioTrack));
         }
         else if (type == TrackType.Subtitle)
         {
             if (Subtitles.Count == 0)
             {
                 Subtitles.Add(new DictionaryKeyValue {
                     Id = -1, Name = "Disabled"
                 });
             }
             Subtitles.Add(item);
             if (_currentSubtitle == null)
             {
                 _currentSubtitle = item;
             }
             OnPropertyChanged(nameof(Subtitles));
             OnPropertyChanged(nameof(CurrentSubtitle));
         }
         else
         {
             Locator.NavigationService.Go(VLCPage.VideoPlayerPage);
         }
     });
 }
示例#23
0
        public override int Deserialize(byte[] data)
        {
            int bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4));

                UnkFloat = reader.ReadSingle();

                UnkFloat1 = reader.ReadSingle();

                UnkFloat2 = reader.ReadSingle();
            }

            return(data.Length);
        }
示例#24
0
        private async void LoadDetails()
        {
            if (!string.IsNullOrEmpty(_playableItemVm.Path))
            {
                var fileInfo =
                    await _appContext.XBMC.Files.GetFileDetails(_playableItemVm.Path, Media.video, Files.AllFields());

                var videodetails = fileInfo.filedetails.AsVideoDetailsFile;
                Details = fileInfo.filedetails.mimetype;
                if (videodetails.streamdetails.video.Count != 0)
                {
                    Details += " (" + videodetails.streamdetails.video[0].codec + ")";
                }
                AudioTracks.AddRange(
                    videodetails.streamdetails.audio.Select((a, i) => new AudioTrackVm(a, i, _appContext)));
                Subtitles.AddRange(
                    videodetails.streamdetails.subtitle.Select((a, i) => new SubtitleTrackVm(a, i, _appContext)));
            }
        }
示例#25
0
        public override int Deserialize(byte[] data)
        {
            var bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                var itemsCount = reader.ReadByte();

                UnkData = new audUnknownSoundData[itemsCount];

                for (int i = 0; i < itemsCount; i++)
                {
                    UnkData[i] = new audUnknownSoundData(reader.ReadByte(), reader.ReadByte(), reader.ReadByte());

                    AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                    bytesRead + ((int)reader.BaseStream.Position - 4));
                }

                return((int)reader.BaseStream.Position);
            }
        }
示例#26
0
    public void PlayAudio(AudioTracks pTrack, bool pLoop = false, bool pSingle = false, float pVolume = 1)
    {
        if (_audioClips.Count > (int)pTrack)
        {
            AudioSource selectedAudioSource = _audioSources[(int)pTrack];

            if (pSingle)
            {
                for (int i = 0; i != _audioSources.Count; i++)
                {
                    if (_audioSources[i].clip != null && _audioSources[i].clip == _audioClips[(int)pTrack])
                    {
                        if (!_audioSources[i].isPlaying)
                        {
                            _audioSources[i].loop = pLoop;
                            _audioSources[i].Play();
                            _audioSources[i].volume = pVolume;
                        }
                        return;
                    }
                }
            }

            selectedAudioSource.loop   = pLoop;
            selectedAudioSource.volume = pVolume;
            selectedAudioSource.clip   = _audioClips[(int)pTrack];
            if (pLoop)
            {
                selectedAudioSource.Play();
            }
            else
            {
                selectedAudioSource.PlayOneShot(selectedAudioSource.clip);
            }
        }
        else
        {
            Debug.LogWarning("The selected audio is not included on the audio manager");
        }
    }
        public override int Deserialize(byte[] data)
        {
            int bytesRead = base.Deserialize(data);

            using (BinaryReader reader =
                       new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4));

                var itemCount = reader.ReadInt32();

                UnkArrayData = new audFluctuatorSoundData[itemCount];

                for (int i = 0; i < itemCount; i++)
                {
                    UnkArrayData[i] = new audFluctuatorSoundData
                    {
                        UnkByte       = reader.ReadByte(),
                        UnkByte1      = reader.ReadByte(),
                        ParameterHash = new audHashString(parent, reader.ReadUInt32()),
                        UnkFloat      = reader.ReadSingle(),
                        UnkFloat1     = reader.ReadSingle(),
                        UnkFloat2     = reader.ReadSingle(),
                        UnkFloat3     = reader.ReadSingle(),
                        UnkFloat4     = reader.ReadSingle(),
                        UnkFloat5     = reader.ReadSingle(),
                        UnkFloat6     = reader.ReadSingle(),
                        UnkFloat7     = reader.ReadSingle(),
                        UnkFloat8     = reader.ReadSingle(),
                        UnkFloat9     = reader.ReadSingle(),
                        UnkFloat10    = reader.ReadSingle()
                    };
                }
            }

            return(data.Length);
        }
        public override int Deserialize(byte[] data)
        {
            var bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                OptAmpUnkHash = new audHashString(parent, reader.ReadUInt32()); //0x0-0x4

                UnkHash1 = new audHashString(parent, reader.ReadUInt32());      //0x4-0x8

                UnkFloat = reader.ReadSingle();                                 //0x8-0xC

                UnkInt2 = reader.ReadInt32();                                   //0xC-0x10

                trackCount = reader.ReadInt32();                                //0x10-0x14

                for (int i = 0; i < 4; i++)
                {
                    AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                    bytesRead + ((int)reader.BaseStream.Position - 4));
                }

                var itemCount = reader.ReadInt32();

                UnkArrayData = new audModularSynthSoundData[itemCount];

                for (int i = 0; i < itemCount; i++)
                {
                    UnkArrayData[i] = new audModularSynthSoundData(
                        new audHashString(parent, reader.ReadUInt32()),
                        new audHashString(parent, reader.ReadUInt32()),
                        reader.ReadSingle());
                }

                return((int)reader.BaseStream.Position);
            }
        }
示例#29
0
        private SessionModel()
        {
            _peerConnection.Connected                += OnPeerConnected;
            _peerConnection.LocalSdpReadytoSend      += OnLocalSdpReadyToSend;
            _peerConnection.IceCandidateReadytoSend  += OnIceCandidateReadyToSend;
            _peerConnection.IceStateChanged          += OnIceStateChanged;
            _peerConnection.IceGatheringStateChanged += OnIceGatheringStateChanged;
            _peerConnection.RenegotiationNeeded      += OnRenegotiationNeeded;
            _peerConnection.TransceiverAdded         += OnTransceiverAdded;
            _peerConnection.AudioTrackAdded          += OnRemoteAudioTrackAdded;
            _peerConnection.AudioTrackRemoved        += OnRemoteAudioTrackRemoved;
            _peerConnection.VideoTrackAdded          += OnRemoteVideoTrackAdded;
            _peerConnection.VideoTrackRemoved        += OnRemoteVideoTrackRemoved;
            _peerConnection.DataChannelAdded         += OnDataChannelAdded;
            _peerConnection.DataChannelRemoved       += OnDataChannelRemoved;

            NodeDssSignaler.OnConnect     += DssSignaler_OnConnected;
            NodeDssSignaler.OnDisconnect  += DssSignaler_OnDisconnected;
            NodeDssSignaler.OnMessage     += DssSignaler_OnMessage;
            NodeDssSignaler.OnFailure     += DssSignaler_OnFailure;
            NodeDssSignaler.OnPollingDone += DssSignaler_OnPollingDone;

            AudioTracks.Add(NullAudioTrack);
            VideoTracks.Add(NullVideoTrack);

            AudioTracks.CollectionChanged += LocalAudioTrackCollectionChanged;
            VideoTracks.CollectionChanged += LocalVideoTrackCollectionChanged;

            LocalTracks.Add(new AddNewTrackViewModel()
            {
                DisplayName = "Add audio track", PageType = typeof(AddAudioTrackPage)
            });
            LocalTracks.Add(new AddNewTrackViewModel()
            {
                DisplayName = "Add video track", PageType = typeof(AddVideoTrackPage)
            });
        }
示例#30
0
        public override int Deserialize(byte[] data)
        {
            int bytesRead = base.Deserialize(data);

            using (BinaryReader reader = new BinaryReader(new MemoryStream(data, bytesRead, data.Length - bytesRead)))
            {
                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4));

                UnkFloat = reader.ReadSingle();

                UnkFloat1 = reader.ReadSingle();

                ParameterHash = new audHashString(parent, reader.ReadUInt32());

                AudioTracks.Add(new audHashString(parent, reader.ReadUInt32()),
                                bytesRead + ((int)reader.BaseStream.Position - 4));

                WaveSlotId = reader.ReadInt32();

                UnkHash1 = new audHashString(parent, reader.ReadUInt32());

                var itemCount = reader.ReadInt32();

                UnkArrayData = new Pair <int, audHashString> [itemCount];

                for (int i = 0; i < itemCount; i++)
                {
                    UnkArrayData[i] = new Pair <int, audHashString>(
                        reader.ReadInt32(),
                        new audHashString(parent, reader.ReadUInt32()));
                }

                return((int)reader.BaseStream.Position);
            }
        }