예제 #1
0
        public void Copy(AudioObject _audio)
        {
            base.Copy(_audio);

            SetImpulseData(_audio);

            Enabled         = _audio.Enabled;
            Foldout         = _audio.Foldout;
            Loop            = _audio.Loop;
            Break           = _audio.Break;
            StopAtEnd       = _audio.StopAtEnd;
            MaxDistance     = _audio.MaxDistance;
            MinDistance     = _audio.MinDistance;
            DistanceMaximum = _audio.DistanceMaximum;
            MaxPitch        = _audio.MaxPitch;
            MinPitch        = _audio.MinPitch;
            PitchMaximum    = _audio.PitchMaximum;
            RolloffMode     = _audio.RolloffMode;
            Volume          = _audio.Volume;
            MixerGroup      = _audio.MixerGroup;

            Clips.Clear();
            foreach (AudioClip _clip in _audio.Clips)
            {
                Clips.Add(_clip);
            }
        }
예제 #2
0
 public void AddClip(AudioClip _clip)
 {
     if (_clip != null)
     {
         Clips.Add(_clip);
     }
 }
예제 #3
0
        private void LoadAsset(AVUrlAsset asset, string[] assetKeysToLoadandTest, DispatchGroup dispatchGroup)
        {
            dispatchGroup.Enter();
            asset.LoadValuesAsynchronously(assetKeysToLoadandTest, () => {
                foreach (string key in assetKeysToLoadandTest)
                {
                    NSError error;
                    if (asset.StatusOfValue(key, out error) == AVKeyValueStatus.Failed)
                    {
                        Console.Error.WriteLine("Key value loading failed for key" + key + " with error: " + error.ToString());
                        dispatchGroup.Leave();
                    }
                }

                if (!asset.Composable)
                {
                    Console.Error.WriteLine("Asset is not composable");
                    dispatchGroup.Leave();
                }

                Clips.Add(asset);
                CMTimeRange timeRange = new CMTimeRange()
                {
                    Start    = CMTime.FromSeconds(0, 1),
                    Duration = CMTime.FromSeconds(5, 1)
                };

                ClipTimeRanges.Add(NSValue.FromCMTimeRange(timeRange));
                dispatchGroup.Leave();
            });
        }
예제 #4
0
        public override void SetDefaults(VehicleController vc)
        {
            base.SetDefaults(vc);

            baseVolume = 0.8f;
            basePitch  = 1f;

            if (Clip == null || Clips.Count == 0)
            {
                AudioClip blinkerOn =
                    Resources.Load(VehicleController.DEFAULT_RESOURCES_PATH + "Sound/BlinkerOn") as AudioClip;
                if (blinkerOn == null)
                {
                    Debug.LogWarning(
                        $"Audio Clip for sound component {GetType().Name} could not be loaded from resources. Source will not play.");
                }
                else
                {
                    Clips.Add(blinkerOn);
                }

                AudioClip blinkerOff =
                    Resources.Load(VehicleController.DEFAULT_RESOURCES_PATH + "Sound/BlinkerOff") as AudioClip;
                if (blinkerOff == null)
                {
                    Debug.LogWarning(
                        $"Audio Clip for sound component {GetType().Name} could not be loaded from resources. Source will not play.");
                }
                else
                {
                    Clips.Add(blinkerOff);
                }
            }
        }
예제 #5
0
        public void Copy(FootstepAudioDataObject _audio)
        {
            if (_audio == null)
            {
                return;
            }

            Interval = _audio.Interval;

            Enabled         = _audio.Enabled;
            Foldout         = _audio.Foldout;
            MaxDistance     = _audio.MaxDistance;
            MinDistance     = _audio.MinDistance;
            DistanceMaximum = _audio.DistanceMaximum;
            MaxPitch        = _audio.MaxPitch;
            MinPitch        = _audio.MinPitch;
            PitchMaximum    = _audio.PitchMaximum;
            RolloffMode     = _audio.RolloffMode;
            Volume          = _audio.Volume;
            MixerGroup      = _audio.MixerGroup;

            Clips.Clear();
            foreach (AudioClip _clip in _audio.Clips)
            {
                Clips.Add(_clip);
            }
        }
예제 #6
0
        public bool AddClip(Clipboard.Clip clip)
        {
            // Check if a clip with the same content exists in the last clips.
            var equalClips = Clips.Take(10).Where(vm => vm.Clip.Content == clip.Content);

            if (equalClips.Count() > 0)
            {
                // If a clip with the same content already exists, just update the creation time.
                // TODO: Possibly refresh list view to push clip to top.
                equalClips.First().Clip.Created = DateTime.Now;
                return false;
            }

            var viewModel = new ClipViewModel(clip);

            viewModel.PropertyChanged += OnClipViewModelPropChanged;

            if (Clips.Count >= ClipLimit && ClipLimit > 0)
            {
                // If the limit is reached, throw out the oldest one.
                // Make sure it is not pinned.
                var first = Clips.Where((c) => !c.Pinned).First();
                Clips.Remove(first);
            }

            Clips.Add(viewModel);

            return true;
        }
예제 #7
0
 public void AddClip(AtomAnimationClip clip)
 {
     clip.AnimationSettingsModified.AddListener(OnAnimationSettingsModified);
     clip.onAnimationKeyframesModified.AddListener(OnAnimationModified);
     clip.onTargetsListChanged.AddListener(OnAnimationModified);
     clip.onTargetsSelectionChanged.AddListener(OnTargetsSelectionChanged);
     Clips.Add(clip);
     ClipsListChanged.Invoke();
 }
예제 #8
0
        public virtual void InsertClip(Clip clip)
        {
            if (Clips.Any(c => c.Ordering == clip.Ordering))
            {
                throw new InvalidOperationException();
            }

            Clips.Add(clip);
        }
예제 #9
0
        public MockClipList()
        {
            AddClip(new Clipboard.Clip("AlternationCount=\"{Binding Items.Count, RelativeSource={RelativeSource Self}}\""));
            var pinnedClip = new Clipboard.Clip("rgba(255, 2, 50, .3)");
            var clipVM     = new ClipViewModel(pinnedClip);

            clipVM.Pinned = true;
            Clips.Add(clipVM);
            AddClip(new Clipboard.Clip("#0bb"));
        }
예제 #10
0
    private void InitializeAudioClips()
    {
        int maxWaveCount = PLESpawnManager.Instance.MaxWaveIndex + 1;
        int numHigh      = Mathf.FloorToInt((maxWaveCount + 2) / 3f);
        int numMed       = Mathf.FloorToInt((maxWaveCount + 1) / 3f);
        int numLow       = Mathf.FloorToInt((maxWaveCount) / 3f);

        Clips.Clear();
        Clips.Add(numLow, lo);
        Clips.Add(numMed, med);
        Clips.Add(numHigh, hi);
        if (true)
        {
        }
    }
예제 #11
0
        private void InitialiseClips()
        {
            Clip playerClip = Content.Load <Gnomic.Anim.Clip>("player");

            playerClip.Init(Content);
            Clips.Add("player", playerClip);

            // Excluding egg for now as it was exported with an old version of the Gnomic.Anim library
            //Clip eggClip = Content.Load<Gnomic.Anim.Clip>("egg");
            //eggClip.Init(Content);
            //Clips.Add("egg", eggClip);

            Clip enemyClip = Content.Load <Gnomic.Anim.Clip>("alien");

            enemyClip.Init(Content);
            Clips.Add("enemy", enemyClip);
        }
예제 #12
0
        private void InitialiseClips()
        {
            Clip playerClip = Content.Load <Gnomic.Anim.Clip>("player");

            playerClip.Init(Content);
            Clips.Add("player", playerClip);

            Clip eggClip = Content.Load <Gnomic.Anim.Clip>("egg");

            eggClip.Init(Content);
            Clips.Add("egg", eggClip);

            Clip enemyClip = Content.Load <Gnomic.Anim.Clip>("enemy");

            enemyClip.Init(Content);
            Clips.Add("enemy", enemyClip);
        }
예제 #13
0
        private async void getMoreClips()
        {
            List <Clip> remainingClipsList = await ServiceAccessor.GetAdditionalPlaylistClips(Parameter.playlist.playlistId, 100);

            foreach (Clip clip in remainingClipsList)
            {
                foreach (Angle angle in clip.angles)
                {
                    angle.angleType = AngleTypes.FirstOrDefault(angleType => angleType.Name.Equals(angle.angleName));
                }
            }
            foreach (Clip c in remainingClipsList)
            {
                Clips.Add(c);
                if (!FiltersList.Any())
                {
                    FilteredClips.Add(c);
                }
            }
        }
예제 #14
0
 public APCIntance(IMidiOutput output, IMidiInput input)
 {
     outdevice = output;
     indevice  = input;
     indevice.MessageReceived += Message_Received;
     for (int row = 0; row < 64; row++)
     {
         Seq64.Add(row, false);
         Clips.Add(row, false);
     }
     for (int row = 0; row < 8; row++)
     {
         Seq8a.Add(row, new Dictionary <int, bool>());
         Seq8b.Add(row, new Dictionary <int, bool>());
         Chords.Add(row, new List <int>());
         for (int col = 0; col < 8; col++)
         {
             Seq8a[row].Add(col, false);
             Seq8b[row].Add(col, false);
         }
     }
     DrawPage(true);
 }
예제 #15
0
        private IEnumerator <UnityWebRequestAsyncOperation> StreamFile(AudioMetaData file)
        {
            var path = file.Path.Replace('\\', '/');

            using (var www = UnityWebRequestMultimedia.GetAudioClip("file://" + path, GetAudioType(path)))
            {
                yield return(www.SendWebRequest());

                if (www.isNetworkError)
                {
                    InGameDebug.Log(www.error);
                }
                else
                {
                    var clip = DownloadHandlerAudioClip.GetContent(www);
                    InGameDebug.Log("\t\t<color=green>AudioLoader: '" + path + "' loaded.</color>");
                    Clips.Add(file, clip);
                    if (Clips.Count == _count)
                    {
                        OnLoadingDone?.Invoke();
                    }
                }
            }
        }
예제 #16
0
 public void AddClip()
 {
     Clips.Add(new AudioClip());
 }
예제 #17
0
 public void AddMusicTransitionEvent(string eventName, AudioClip clip)
 {
     musicEventsList.Add(eventName);
     Clips.Add(clip);
 }
예제 #18
0
        private async Task LoadFile(StorageFile file)
        {
            fileName = Path.GetFileNameWithoutExtension(file.Name);
            Debug.WriteLine("Picked video: " + fileName + " with full name: " + file.Name);

            if (handledExtensions.Contains(Path.GetExtension(file.Path)))
            {
                MediaClip newClip;

                if (imageExtensions.Contains(Path.GetExtension(file.Path)))
                {
                    newClip = await MediaClip.CreateFromImageFileAsync(file, TimeSpan.FromSeconds(DEFAULT_DURATION));
                }
                else // if (videoExtensions.Contains(Path.GetExtension(file.Path)))
                {
                    newClip = await MediaClip.CreateFromFileAsync(file);
                }

                m_composition.Clips.Add(newClip);

                // Render a thumbnail from the center of the clip's duration
                ImageStream x = await m_composition.GetThumbnailAsync(TimeSpan.FromMilliseconds(newClip.StartTimeInComposition.TotalMilliseconds + newClip.TrimmedDuration.TotalMilliseconds / 2d), HEIGHT, 0, VideoFramePrecision.NearestKeyFrame);


                StorageFolder localFolder = ApplicationData.Current.LocalFolder;
                // Write data to a file
                StorageFile imageFile = await localFolder.CreateFileAsync(newClip.GetHashCode() + imageExtensions[0], CreationCollisionOption.ReplaceExisting);

                //BitmapImage bitmap = new BitmapImage();
                //bitmap.SetSource(x);


                //wBitmap.SetSource(x);



                BitmapDecoder decoder = await BitmapDecoder.CreateAsync(x);

                WriteableBitmap wBitmap = new WriteableBitmap((int)decoder.PixelWidth, (int)decoder.PixelHeight);
                // Scale image to appropriate size
                BitmapTransform transform = new BitmapTransform()
                {
                    ScaledWidth  = Convert.ToUInt32(decoder.PixelWidth),
                    ScaledHeight = Convert.ToUInt32(decoder.PixelHeight)
                };
                PixelDataProvider pixelData = await decoder.GetPixelDataAsync(
                    BitmapPixelFormat.Bgra8, // WriteableBitmap uses BGRA format
                    BitmapAlphaMode.Straight,
                    transform,
                    ExifOrientationMode.IgnoreExifOrientation, // This sample ignores Exif orientation
                    ColorManagementMode.DoNotColorManage
                    );

                // An array containing the decoded image data, which could be modified before being displayed
                byte[] sourcePixels = pixelData.DetachPixelData();

                // Open a stream to copy the image contents to the WriteableBitmap's pixel buffer
                using (Stream stream = wBitmap.PixelBuffer.AsStream())
                {
                    await stream.WriteAsync(sourcePixels, 0, sourcePixels.Length);
                }

                await wBitmap.SaveToFile(imageFile, BitmapEncoder.JpegEncoderId);

                //var fs = await imageFile.OpenAsync(FileAccessMode.ReadWrite);
                //DataWriter writer = new DataWriter(fs.GetOutputStreamAt(0));
                //writer.WriteBytes(await x.ReadAsync());
                //await writer.StoreAsync();
                //writer.DetachStream();
                //await fs.FlushAsync();

                //StorageFile imgFile = await ApplicationData.Current.LocalFolder.CreateFileAsync(newClip.GetHashCode() + imageExtensions[0], CreationCollisionOption.ReplaceExisting);


                //byte[] pixels = new byte[4 * bitmap.PixelWidth * bitmap.PixelHeight];

                //Stream pixelStream = wBitmap.PixelBuffer.AsStream();
                //pixelStream.Seek(0, SeekOrigin.Begin);
                //pixelStream.Write(pixels, 0, pixels.Length);

                ////BitmapToWriteableBitmap(imgFile);
                //await Utilities.SaveToFile(wBitmap, imgFile, new Guid());

                ////using (var stream = await file.OpenAsync(FileAccessMode.ReadWrite))
                ////{
                ////    var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, stream);
                ////    encoder.SetPixelData(
                ////        BitmapPixelFormat.Bgra8,
                ////        BitmapAlphaMode.Ignore,
                ////        (uint)bitmap.PixelWidth,
                ////        (uint)bitmap.PixelHeight,
                ////        96d,
                ////        96d,
                ////        bitmap.
                ////    );

                //////    await encoder.FlushAsync();
                //////}
                ////if (bitmap != null)
                ////{
                ////    IRandomAccessStream stream = await bitmap.OpenAsync(FileAccessMode.Read);
                ////    bmp.SetSource(stream);
                ////    imageGrid.Source = bmp;
                ////}


                newClip.UserData.Add("thumb", imageFile.Path);
                Clips.Add(newClip);
                RaisePropertyChanged(Utilities.GetMemberName(() => Clips));
                MyUri = new Uri(imageFile.Path);
            }
        }