Esempio n. 1
0
 /// <summary>
 /// Split the current asset at the current position. The first part keeps the same name and the second part is renamed.
 /// Ask for confirmation before splitting.
 /// For the moment split is only permitted while the asset is playing.
 /// TODO: play from the splitting point to test if the position is fine; fine tune the position.
 /// </summary>
 private void splitAssetToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (mAssetBox.SelectedIndex >= 0 && mPlayer.State == AudioPlayerState.paused)
     {
         int             selected = mAssetBox.SelectedIndex;
         AudioMediaAsset asset    = mPlayList[selected];
         SplitForm       dialog   = new SplitForm(asset, mPlayer);
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             ArrayList assets = asset.Split(mPlayer.CurrentTimePosition);
             mPlayer.Stop();
             mManager.DeleteAsset(asset);
             mPlayList.RemoveAt(selected);
             mAssetBox.Items.RemoveAt(selected);
             AudioMediaAsset before = (AudioMediaAsset)assets[0];
             mManager.AddAsset(before);
             mPlayList.Insert(selected, before);
             mManager.RenameAsset(before, asset.Name);
             mAssetBox.Items.Insert(selected, before.Name);
             AudioMediaAsset after = (AudioMediaAsset)assets[1];
             mManager.AddAsset(after);
             mPlayList.Insert(selected + 1, after);
             mManager.RenameAsset(after, GetAfterName(asset.Name));
             mAssetBox.Items.Insert(selected + 1, after.Name);
             mAssetBox.SelectedIndex = selected + 1;
             UpdateButtons();
         }
     }
 }
Esempio n. 2
0
        public IActionResult PostAssetType([FromBody] Asset assetType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var response = _assetManager.AddAsset(assetType);

            return(Ok(response));
        }
Esempio n. 3
0
 public IActionResult Create(Asset asset)
 {
     try
     {
         AssetManager.AddAsset(asset);
         return(RedirectToAction("Search"));
     }
     catch
     {
         return(View());
     }
 }
Esempio n. 4
0
 public ActionResult Create(Asset asset)
 {
     try
     {
         // Add new asset into database
         AssetManager.AddAsset(asset);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
Esempio n. 5
0
        public ActionResult Add(Asset asset)
        {
            AddResult result = AssetManager.AddAsset(asset);

            switch (result)
            {
            case AddResult.ExistGUID: return(BadRequest("Asset already exist"));

            case AddResult.Success: return(Ok("Success"));

            default: return(BadRequest($"{result} is Notsupported"));
            }
        }
Esempio n. 6
0
File: Form1.cs Progetto: daisy/obi
        private void btnStart_Click(object sender, System.EventArgs e)
        {
            AudioClip ob_Clip  = new AudioClip("c:\\atest\\a\\Num.wav", 100, 3000);
            AudioClip ob_Clip1 = new AudioClip("c:\\atest\\a\\Alpha.wav", 100, 3000);
            ArrayList al       = new ArrayList();

            al.Add(ob_Clip);
            al.Add(ob_Clip1);
            am.NewAudioMediaAsset(2, 8, 22050);
            am.NewAudioMediaAsset(al);
            am.NewAudioMediaAsset(2, 8, 22050);
            MessageBox.Show(" ");
            AudioMediaAsset Asset = new AudioMediaAsset(1, 16, 44100);

//Asset.Name = "Added" ;
            am.AddAsset(Asset);

            AddList(am.Assets, am.m_htExists);
            MessageBox.Show("Done");
        }
Esempio n. 7
0
File: Form1.cs Progetto: daisy/obi
        private void btnDetectPhrases_Click(object sender, System.EventArgs e)
        {
            AudioClip       ob_AudioClip = new AudioClip("c:\\s\\sil22-8-2.wav", 0, 2000);
            AudioMediaAsset am           = new AudioMediaAsset(ob_AudioClip.Channels, ob_AudioClip.BitDepth, ob_AudioClip.SampleRate);

            am.AddClip(ob_AudioClip);
            long Sil = am.GetSilenceAmplitude(am);

            Sil = Sil + 3;
            MessageBox.Show(Sil.ToString());

            ArrayList al = new ArrayList();
//AudioClip ob_AudioClip1 = new AudioClip ("c:\\s\\Detect22-8-2-new.wav" ) ;
//al.Add (ob_AudioClip1 ) ;

            //al.Add(ob_AudioClip) ;
            AudioClip ob_AudioClip2 = new AudioClip("c:\\s\\Detect22-8-2.wav");

            al.Add(ob_AudioClip2);
            AudioMediaAsset amd = new AudioMediaAsset(al);

            a.AddAsset(amd);
            double dLength = 500;
            double dBefore = 100;
//ArrayList alAsset =  amd.ApplyPhraseDetection (Sil , dLength , dBefore) ;
            PhraseDetectionCommand ob_PhraseDetectionCommand = new PhraseDetectionCommand(amd, Sil, dLength, dBefore);

            ob_PhraseDetectionCommand.Do();
            ArrayList alAsset = ob_PhraseDetectionCommand.AssetList;

            am0 = alAsset   [1] as AudioMediaAsset;
//MessageBox.Show (alAsset.Count.ToString ()) ;
            MessageBox.Show("Done");
            AudioMediaAsset DisplayAsset;

            for (int i = 0; i < alAsset.Count; i++)
            {
                DisplayAsset = alAsset  [i] as AudioMediaAsset;
                MessageBox.Show(DisplayAsset.LengthInMilliseconds.ToString());
            }
        }
        public ActionResult ProcessData(FormCollection formData)
        {
            try
            {
                AssetManager manager = new AssetManager();
                Asset        _asset  = new Asset();

                _asset.AssetTypeId    = int.Parse(formData["AssetTypes"]);
                _asset.ManufacturerId = int.Parse(formData["Manufacturer"]);
                _asset.ModelId        = int.Parse(formData["Model"]);
                _asset.AssignedTo     = formData["Employee"];

                manager.AddAsset(_asset);

                return(RedirectToAction("Index", "Home"));
            }
            catch
            {
                return(RedirectToAction("Error", "Home"));
            }
        }
Esempio n. 9
0
 private void btnRecord_Click(object sender, System.EventArgs e)
 {
     ob_VuMeter.ScaleFactor      = 2;
     ob_VuMeter.SampleTimeLength = 2000;
     ob_VuMeter.UpperThreshold   = 120;
     ob_VuMeter.LowerThreshold   = 100;
     // Displays the VuMeter form
     ob_VuMeter.ShowForm();
     // assigns the VuMeter object to AudioPlayer property as it is routed through AudioPlayer for integrating it with AudioPlayer
     ar.VuMeterObject = ob_VuMeter;
     try
     {
         AssetManager    aManager = new AssetManager("C:\\Project");
         AudioMediaAsset am       = new AudioMediaAsset(2, 16, 44100);
         aManager.AddAsset(am);
         ar.StartRecording(am);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 10
0
        static void Main()
        {
            /* -------------------------------------------------------------------------------------------------
             * INITIAL ENGINE CONFIG
             * -------------------------------------------------------------------------------------------------
             * Here we will instantiate the concrete implementations that the engine needs in order to function.
             * This will also be where we will configure them and hook everything up.
             * -------------------------------------------------------------------------------------------------
             * Implementations of the following interfaces are needed:
             * - IAssetManager
             * - IInputManager
             * - IScreenManager
             * - ITimeManager
             * - ISceneManager
             * - IRenderManager
             * - IDebugManager
             *
             * TODO: IN THE FUTURE, THESE CONFIGURATIONS COULD COME FROM A FILE OR AN EDITOR !
             */

            // Instantiate the managers
            IAssetManager  assetManager  = new AssetManager();
            IInputManager  inputManager  = new InputManager();
            IScreenManager screenManager = new ScreenManager();
            ITimeManager   timeManager   = new TimeManager();
            ISceneManager  sceneManager  = new SceneManager();
            IRenderManager renderManager = new RenderManager();
            IDebugManager  debugManager  = new DebugManager();

            // Setup the asset manager
            assetManager.RootDirectory = "Content";
            assetManager.AddAsset <Texture2D>("ship.png");
            assetManager.AddAsset <Texture2D>("ship_explosion.png");
            assetManager.AddAsset <Texture2D>("Planet1.png");
            assetManager.AddAsset <Texture2D>("Planet2.png");
            assetManager.AddAsset <Texture2D>("Planet3.png");
            assetManager.AddAsset <Texture2D>("Sentry1.png");
            assetManager.AddAsset <Texture2D>("Sentry2.png");
            assetManager.AddAsset <Texture2D>("Sentry3.png");
            assetManager.AddAsset <Texture2D>("bullet.png");
            assetManager.AddAsset <Texture2D>("outline.png");
            assetManager.AddAsset <Texture2D>("range.png");
            assetManager.AddAsset <Texture2D>("cursor_25.png");
            assetManager.AddAsset <Texture2D>("cursor_50.png");
            assetManager.AddAsset <Texture2D>("cursor_75.png");
            assetManager.AddAsset <Texture2D>("cursor_100.png");
            assetManager.AddAsset <AudioClip>("AttackCommand.wav");
            assetManager.AddAsset <AudioClip>("PlanetConquered.wav");
            assetManager.AddAsset <AudioClip>("PlanetSelect.wav");
            assetManager.AddAsset <AudioClip>("PlanetUpgrade.wav");
            assetManager.AddAsset <AudioClip>("ShipShotDown.wav");
            assetManager.AddAsset <Font>("main_font.spritefont");
            assetManager.AddAsset <Font>("debug.spritefont");

            // Setup the input manager
            inputManager.AddActionBinding("PrimaryAction", "MouseLeft");
            inputManager.AddActionBinding("SecondaryAction", "MouseRight");
            inputManager.AddActionBinding("ToggleFullScreen", "F11");
            inputManager.AddActionBinding("ToggleDebugConsole", "F12");
            inputManager.AddActionBinding("ToggleSeek", "F1");
            inputManager.AddActionBinding("TogglePursuit", "F2");
            inputManager.AddActionBinding("UpgradePlanet", "W");
            inputManager.AddActionBinding("ChangePlanetToColony", "A");
            inputManager.AddActionBinding("ChangePlanetToSentry", "D");
            inputManager.AddActionBinding("Restart", "R");

            // Setup the screen manager
            screenManager.AddSupportedResolution(1920, 1080);
            screenManager.AddSupportedResolution(1280, 720);
            screenManager.SetResolution(1);
            screenManager.IsFullScreen = false;

            // Setup the time manager
            timeManager.TimeScale = 1;

            // Setup the scenes that will be usable in the game
            IScene myScene = SetupScene(assetManager);

            sceneManager.AddScene(myScene);

            // Setup the debug manager
            debugManager.ConsoleFont = assetManager.GetAsset <Font>("debug");

            // Instantiate the engine with the settings created above
            IEngine engine = new Engine(assetManager, inputManager, screenManager, timeManager, sceneManager, renderManager, debugManager);

            // Start MonoGame
            // MonoGame will load the resources and call the engine's update method
            using (var game = new Game1(engine))
                game.Run();
        }