Exemple #1
0
        public App(IBluetooth bluetooth, IAudio audio, IAudioResource audioResource)
        {
            Bluetooth     = bluetooth;
            AudioRenderer = new AudioRenderer(audio, audioResource);

            bluetooth.ConnectedDevices.CollectionChanged += (object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) => {
                if (e.OldItems != null)
                {
                    foreach (BluetoothDevice oldItem in e.OldItems)
                    {
                        oldItem.BeatReceived -= BeatReceived;
                    }
                }

                if (e.NewItems != null)
                {
                    foreach (BluetoothDevice newItem in e.NewItems)
                    {
                        newItem.BeatReceived += BeatReceived;
                    }
                }
            };

            // The root page of your application
            MainPage = new ContentPage();

            OpenScanView();
        }
Exemple #2
0
        private async void ReorderTracks(IAudio track, int indexFrom, int indexTo)
        {
            Logger.Info($"Reorder: {track.Id} from {indexFrom} to {indexTo}");

            try
            {
                string afterTrackId  = "0";
                string beforeTrackId = "0";

                if (indexTo > 0)
                {
                    afterTrackId = _tracks[indexTo - 1].Id;
                }

                if (indexTo < _tracks.Count - 1)
                {
                    beforeTrackId = _tracks[indexTo + 1].Id;
                }

                await _tracksService.ReorderTracks(track, beforeTrackId, afterTrackId);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Unable to reorder tracks");
            }
        }
        /// <inheritdoc/>
        public void ReleaseAudioSource(IAudio audio)
        {
            var        audioUnity = audio as AudioSourceGameObjectAdaptor;
            GameObject gameObjectWithAudioSource = audioUnity?.GetGameObject();

            GameObject.Destroy(gameObjectWithAudioSource);
        }
 public ShellOperation(
     IActionCenter actionCenter,
     IAudio audio,
     INotificationInfo aboutInfo,
     INotificationController aboutController,
     ClientContext context,
     IKeyboard keyboard,
     ILogger logger,
     INotificationInfo logInfo,
     INotificationController logController,
     IPowerSupply powerSupply,
     ISystemInfo systemInfo,
     ITaskbar taskbar,
     ITaskview taskview,
     IText text,
     IUserInterfaceFactory uiFactory,
     IWirelessAdapter wirelessAdapter) : base(context)
 {
     this.aboutInfo       = aboutInfo;
     this.aboutController = aboutController;
     this.actionCenter    = actionCenter;
     this.audio           = audio;
     this.keyboard        = keyboard;
     this.logger          = logger;
     this.logInfo         = logInfo;
     this.logController   = logController;
     this.powerSupply     = powerSupply;
     this.systemInfo      = systemInfo;
     this.text            = text;
     this.taskbar         = taskbar;
     this.taskview        = taskview;
     this.uiFactory       = uiFactory;
     this.wirelessAdapter = wirelessAdapter;
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            RequestWindowFeature(Window.FEATURE_NO_TITLE);
            GetWindow().SetFlags(IWindowManager_LayoutParams.FLAG_FULLSCREEN,
                                 IWindowManager_LayoutParams.FLAG_FULLSCREEN);

            bool isPortrait = GetResources().GetConfiguration().Orientation == Configuration.ORIENTATION_PORTRAIT;
            int frameBufferWidth = isPortrait ? 480 : 800;
            int frameBufferHeight = isPortrait ? 800 : 480;
            Bitmap frameBuffer = Bitmap.CreateBitmap(frameBufferWidth,
                                                     frameBufferHeight, Bitmap.Config.RGB_565);

            float scaleX = (float)frameBufferWidth
                           / GetWindowManager().GetDefaultDisplay().GetWidth();
            float scaleY = (float)frameBufferHeight
                           / GetWindowManager().GetDefaultDisplay().GetHeight();

            renderView = new AndroidFastRenderView(this, frameBuffer);
            graphics = new AndroidGraphics(GetAssets(), GetAssetsPrefix(), frameBuffer);
            fileIO = new AndroidFileIO(this);
            audio = new AndroidAudio(this);
            input = new AndroidInput(this, renderView, scaleX, scaleY);
            screen = getInitScreen();
            SetContentView(renderView);

            PowerManager powerManager = (PowerManager)GetSystemService(Context.POWER_SERVICE);
            wakeLock = powerManager.NewWakeLock(PowerManager.FULL_WAKE_LOCK, "MyGame");
        }
Exemple #6
0
        internal AudioPlayable(IAudio audio, IAudioStorage storage, IWebDownloader downloader, Uri url)
        {
            __Audio = audio;
            __Storage = storage;
            __Downloader = downloader;
            __Url = url;

            __BassFileProcs = new BASS_FILEPROCS(user => { },
                                                 user => 
                                                     __CacheStream.AudioSize,
                                                 BassReadProc,
                                                 (offset, user) => true);

            __EndStreamProc = (handle, channel, data, user) =>
            {
                __RequestTasksStop = true;
                CleanActions();
                OnAudioNaturallyEnded();
            };

            if (storage.CheckCached(audio))
            {
                DownloadedFracion = 1.0;
            }
        }
Exemple #7
0
 void soundMenuBut_Loaded(object sender, RoutedEventArgs e)
 {
     if (!System.ComponentModel.DesignerProperties.IsInDesignTool)
     {
         Audio = ((GamePresenter)this.DataContext).CurrentGame.Audio;
     }
 }
Exemple #8
0
        /// <inheritdoc/>
        public void Play(AudioClip clip, float volumeScale)
        {
            IAudio currentAudio = audioSources[random.Next(audioSources.Count)];

            currentAudio.SetAudioPosition(position);
            currentAudio.Play(clip, volumeScale);
        }
        private static string AudioToSayString(IAudio audio, string json)
        {
            string s         = "Error converting prompt VoiceModel";
            Type   audioType = audio.GetType();

            if (audioType == typeof(TtsMessage))
            {
                s = ((TtsMessage)audio).message;
            }
            else if (audioType == typeof(TtsVariable))
            {
                char[] delims  = { '.' };
                string varName = ((TtsVariable)audio).varName.Split(delims)[1];
                var    values  = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);
                try
                {
                    s = values[varName];
                }
                catch
                {
                    s = "Could not find variable " + varName;
                };
            }
            else if (audioType == typeof(Audio))
            {
                s = "<?xml version='1.0'?><speak><audio src='" + ((Audio)audio).src + "'>" +
                    ((Audio)audio).message + "</audio></speak>";
            }
            else if (audioType == typeof(Silence))
            {
                s = "<?xml version='1.0'?><speak><break time='" + ((Silence)audio).msPause.ToString() + "ms' /></speak>";
            }
            return(s);
        }
 public LoggedAudio(IAudio wrapped)
 {
     if (wrapped == null)
         _wrapped = new NullAudio();
     else
         _wrapped = wrapped;
 }
Exemple #11
0
        internal Core(ISynchronizeInvoke syncInvoke)
        {
            var pluginLoadingHandler = new Action <string>(x => { RaisePartLoadingEvent($"Loading plugin {x}..."); });

            RaisePartLoadingEvent("Loading Settings...");
            _settingsManager = new Settings.SettingsManager(this);
            SettingsManager  = _settingsManager.GetSection("Core");

            RaisePartLoadingEvent("Loading SIP...");
            _sip = new SIP.SIP(this, syncInvoke);

            RaisePartLoadingEvent("Loading Audio...");
            _audio = new Audio.Audio(this);

            RaisePartLoadingEvent("Initializing Audio...");
            _sip.InitializeAudio();

            // Load core classes
            RaisePartLoadingEvent("Loading Calls core...");
            CallManager = new CallManager.CallManager(this);

            RaisePartLoadingEvent("Loading Plugins...");
            _pluginManager = new PluginManager.PluginManager(this);

            RaisePartLoadingEvent("Loading Contacts...");
            _contactsManager = new ContactsManager(this, syncInvoke);

            _pluginManager.PluginLoading += pluginLoadingHandler;
            _pluginManager.LoadPluginsFromDirectory(System.IO.Path.GetFullPath("plugins"));
            _pluginManager.PluginLoading -= pluginLoadingHandler;
            _pluginManager.Start();

            RaisePartLoadingEvent("Core loaded successfully. Starting...");
        }
        public void Deserialize(string json)
        {
            var o = JObject.Parse(json);

            if (o["shuffle"] != null)
            {
                _shuffle = o["shuffle"].Value <bool>();
            }

            if (o["repeat"] != null)
            {
                var x = o["repeat"].Value <int>();
                Repeat = (RepeatMode)x;
            }

            _originalItems = o["items"].ToObject <ObservableCollection <IAudio> >(JsonSerializer.CreateDefault(new JsonSerializerSettings()
            {
                TypeNameHandling = TypeNameHandling.Objects
            }));
            _items        = _originalItems;
            _currentIndex = o["currentIndex"].Value <int>();
            if (_currentIndex >= 0 && _currentIndex < _items.Count)
            {
                _currentItem = _items[_currentIndex];
            }
            else if (_items.Count > 0)
            {
                _currentItem = _items[0];
            }
        }
Exemple #13
0
        internal AudioPlayable(IAudio audio, IAudioStorage storage, IWebDownloader downloader, Uri url)
        {
            __Audio      = audio;
            __Storage    = storage;
            __Downloader = downloader;
            __Url        = url;

            __BassFileProcs = new BASS_FILEPROCS(user => { },
                                                 user =>
                                                 __CacheStream.AudioSize,
                                                 BassReadProc,
                                                 (offset, user) => true);

            __EndStreamProc = (handle, channel, data, user) =>
            {
                __RequestTasksStop = true;
                CleanActions();
                OnAudioNaturallyEnded();
            };

            if (storage.CheckCached(audio))
            {
                DownloadedFracion = 1.0;
            }
        }
Exemple #14
0
 private static void ExportWav(IAudio audio, Stream output, IProgressReport writingProgress = null)
 {
     using (Stream input = audio.GetPCMStream())
     {
         WAVFile.WAVFromPCM(input, output, (short)audio.GetChannels(), audio.GetSamplesPerSecond(), audio.GetBits(), (int)audio.GetSamplesCount(), writingProgress);
     }
 }
Exemple #15
0
    public void PlayOnHooverSFX()
    {
        IAudio audioPlayer = ObjectPoolManager.Spawn(audioPlayerPrefab, transform.position).GetComponent <IAudio>();

        audioPlayer.SetUpAudioSource(AudioManager.instance.GetSound("ButtonHoover"));
        audioPlayer.PlayAtRandomPitch();
    }
Exemple #16
0
 void soundMenuBut_Loaded(object sender, RoutedEventArgs e)
 {
     if (!System.ComponentModel.DesignerProperties.IsInDesignTool)
     {
         Audio = ((GamePresenter)this.DataContext).CurrentGame.Audio;
     }
 }
 public static void ProvideAudioService(IAudio audioService)
 {
     if (audioService == null)
         _audioService = _nullAudioService;
     else
         _audioService = audioService;
 }
Exemple #18
0
        public TimerViewModel()
        {
            _timerText  = "Башла";
            _timerColor = Constants.BlueColor;

            audioService = DependencyService.Get <IAudio>();
        }
Exemple #19
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
            bool isLandscape = this.Resources.Configuration.Orientation == Android.Content.Res.Orientation.Landscape;

            int frameBufferWidth  = isLandscape ? 960 : 540;
            int frameBufferHeight = isLandscape ? 540 : 960;

            Bitmap frameBuffer = Bitmap.CreateBitmap(frameBufferWidth, frameBufferHeight, Bitmap.Config.Rgb565);

            float scaleX = (float)frameBufferWidth / this.WindowManager.DefaultDisplay.Width;
            float scaleY = (float)frameBufferHeight / this.WindowManager.DefaultDisplay.Height;

            _renderView = new AndroidFastRenderView(this, frameBuffer);
            _graphics   = new AndroidGraphics(Assets, frameBuffer);
            _fileIO     = new AndroidFileIO(Assets);
            _audio      = new AndroidAudio(this);
            _input      = new AndroidInput(this, _renderView, scaleX, scaleY);
            _screen     = GetStartScreen();
            SetContentView(_renderView);

            PowerManager pw = (PowerManager)GetSystemService(Context.PowerService);

            _wl = pw.NewWakeLock(WakeLockFlags.Full, "GLGame");
            // Create your application here
        }
Exemple #20
0
    override protected void OnTriggerEnter2D(Collider2D other)
    {
        if (((1 << other.gameObject.layer) & collisionLayers) != 0)
        {
            if (!other.CompareTag("Enemy"))
            {
                IAudio audioPlayer = ObjectPoolManager.Spawn(audioPlayerPrefab, transform.position).GetComponent <IAudio>();
                audioPlayer.SetUpAudioSource(AudioManager.instance.GetSound(collisionSFX));
                audioPlayer.PlayAtRandomPitch();

                Vector2 backDir = rb.velocity.normalized * -1;
                Vector2 pos     = rb.position + backDir * 0.6f;
                ObjectPoolManager.Spawn(sparkPrefab, pos, transform.rotation);
                //SetupAndPlayBulletSound("BulletCollisionSFX");
                SpawnFragments();
                ObjectPoolManager.Recycle(gameObject);
            }
        }
        if (other.gameObject.CompareTag(targetTag) || other.gameObject.CompareTag("PhysicsObject"))
        {
            if (other.GetComponent <IHurtable>() != null)
            {
                other.GetComponent <IHurtable>().Damage(damage, rb.velocity.normalized, knockBack);
            }
            IAudio audioPlayer = ObjectPoolManager.Spawn(audioPlayerPrefab, transform.position).GetComponent <IAudio>();
            audioPlayer.SetUpAudioSource(AudioManager.instance.GetSound(collisionSFX));
            audioPlayer.PlayAtRandomPitch();

            ObjectPoolManager.Spawn(sparkPrefab, transform.position, transform.rotation);
            ObjectPoolManager.Spawn(triggerEnemyPrefab, transform.position, Quaternion.identity);

            SpawnFragments();
            ObjectPoolManager.Recycle(gameObject);
        }
    }
        /// <summary>
        /// See base class.
        /// </summary>
        /// <param name="server"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        protected override bool DoHandleRequest(IWebServer server, RequestReceivedEventArgs args)
        {
            bool result = false;

            if (!args.IsInternetRequest || _InternetClientCanRequestAudio)
            {
                if (args.PathAndFile.Equals("/Audio", StringComparison.OrdinalIgnoreCase))
                {
                    string command = (string)args.QueryString["cmd"];
                    if (command != null && command.Equals("say", StringComparison.OrdinalIgnoreCase))
                    {
                        var text = args.QueryString["line"];
                        if (text != null)
                        {
                            result = true;
                            IAudio audio = Factory.Singleton.Resolve <IAudio>();
                            Responder.SendAudio(args.Response, audio.SpeechToWavBytes(text), MimeType.WaveAudio);
                            args.Classification = ContentClassification.Audio;
                        }
                    }
                }
            }

            return(result);
        }
        AudioSource AttachAudioSource(GameObject targset, IAudio args)
        {
            AudioSource audio = targset.AddComponent <AudioSource>();

            SetAudioProperties(ref audio, args);
            return(audio);
        }
Exemple #23
0
    protected void Damage(float damage, Vector2 knockBackDir, float knockBack)
    {
        if (!isHurt)
        {
            if (canBeHurt)
            {
                if (navComp.enabled)
                {
                    navComp.Stop();
                    navComp.enabled = false;
                }
                rb.AddForce(knockBackDir * knockBack, ForceMode2D.Impulse);
                ObjectPoolManager.Spawn(deathVFX, transform.position, transform.rotation);
                IAudio player = ObjectPoolManager.Spawn(audioPlayerPrefab.gameObject, transform.position, transform.rotation).GetComponent <IAudio>();
                player.SetUpAudioSource(AudioManager.instance.GetSound("BugHurt"));
                player.PlayAtRandomPitch();
                canBeHurt = false;
                isHurt    = true;
                hurtVFX.BeginFlash();
                currentHealth -= damage;
                this.knockBack = knockBack * knockBackDir;
                DamageNumber dmgVFX = ObjectPoolManager.Spawn(hurtNumber, transform.position, Quaternion.identity).GetComponent <DamageNumber>();
                if (dmgVFX != false)
                {
                    dmgVFX.Init();
                    dmgVFX.SetTextValues(damage, settings.maxHealth, knockBackDir);
                }

                if (currentHealth <= 0)
                {
                    KillEnemy();
                }
            }
        }
    }
Exemple #24
0
        public async void Update(IAudio audio)
        {
            _currentAudio = audio;

            try
            {
                if (_currentAudio != null && _currentAudio.TrackData != null)
                {
                    AlbumCover.Source = await _currentAudio.GetAlbumCoverTaskAsync(_currentAudio.TrackData.AlbumCoverUrl);
                }
                else
                {
                    return;
                }
                Lyrics = await _currentAudio.GetLyricsTaskAsync(_currentAudio.TrackData.LyricsUrl);
            }
            catch (System.Exception)
            {
                return;
            }

            if (_currentAudio != null && Lyrics != null && !string.IsNullOrWhiteSpace(Lyrics))
            {
                LyricsPage.Update(Lyrics);
            }
            else
            {
                LyricsPage.Update("Couldn't find lyrics.");
            }

            MoreInfoPage.GetInstance().Update(_currentAudio);
        }
Exemple #25
0
 /// <summary>
 ///   Get track samples
 /// </summary>
 /// <param name = "track">Track from which to gather samples</param>
 /// <param name = "proxy">Proxy used in gathering samples</param>
 /// <param name = "sampleRate">Sample rate used in gathering samples</param>
 /// <param name = "milliseconds">Milliseconds to gather</param>
 /// <param name = "startmilliseconds">Starting millisecond</param>
 /// <returns></returns>
 public static float[] GetTrackSamples(Track track, IAudio proxy, int sampleRate, int milliseconds, int startmilliseconds)
 {
     if (track == null || track.Path == null)
         return null;
     //read 5512 Hz, Mono, PCM, with a specific proxy
     return proxy.ReadMonoFromFile(track.Path, sampleRate, milliseconds, startmilliseconds);
 }
        public void MountAudio(IAudio audio)
        {
            if (isDisposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }

            // Unmount audio.
            if (audio == null)
            {
                this.audio  = null;
                source.clip = null;
                return;
            }

            // Check if compatible type with this controller.
            if (!(audio is UnityAudio newAudio))
            {
                throw new ArgumentException($"Specified audio is not a type of ({nameof(UnityAudio)}). Given type: {audio.GetType().Name}");
            }

            // Mount the audio.
            this.audio  = newAudio;
            source.clip = newAudio.Clip;
            InvokeMounted(audio);
        }
        public IEnumerator TestPlayDelay()
        {
            IAudio audio = null;

            yield return(LoadAudio(a => audio = a));

            var controller = CreateController();

            controller.MountAudio(audio);
            controller.Play(2000);
            Assert.IsTrue(controller.IsPlaying);
            Assert.IsFalse(controller.IsPaused);
            Assert.IsFalse(controller.IsStopped);
            yield return(new WaitForSeconds(audio.Duration / 1000f));

            Assert.Less(controller.CurrentTime, audio.Duration);
            Assert.IsTrue(controller.IsPlaying);
            Assert.IsFalse(controller.IsPaused);
            Assert.IsFalse(controller.IsStopped);
            yield return(new WaitForSeconds(2f));

            Assert.AreEqual(0f, controller.CurrentTime, Delta);
            Assert.IsFalse(controller.IsPlaying);
            Assert.IsFalse(controller.IsPaused);
            Assert.IsTrue(controller.IsStopped);
        }
Exemple #28
0
    public void Damage(float damage, Vector3 knockBackDir, float knockBack)
    {
        if (!isHurt)
        {
            isHurt = true;
            hurtVFX.BeginFlash();
            currHealth -= damage;
            ObjectPoolManager.Spawn(deathVFX, transform.position, transform.rotation);
            IAudio player = ObjectPoolManager.Spawn(audioPlayerPrefab.gameObject, transform.position, transform.rotation).GetComponent <IAudio>();
            player.SetUpAudioSource(AudioManager.instance.GetSound("BugsSplat"));
            player.PlayAtRandomPitch();
            DamageNumber dmgVFX = ObjectPoolManager.Spawn(hurtNumber, transform.position, Quaternion.identity).GetComponent <DamageNumber>();
            if (dmgVFX != false)
            {
                dmgVFX.Init();
                dmgVFX.SetTextValuesAtScale(damage, maxHealth, knockBackDir, 2f);
            }
            if (currHealth <= 0.0f)
            {
                DisableBroodDelegate();
            }

            Invoke("ResetHurt", hurtTime);
        }
    }
Exemple #29
0
        public Breakout(IGameLoop gameLoop, IGraphics graphics, IAudio audio, IKeyboard keyboard, IFileSystem fileSystem) : base(nameof(Breakout), gameLoop, graphics, audio, keyboard, null, fileSystem)
        {
            Keyboard = new StatefulKeyboard(keyboard);

            // the state machine we'll be using to transition between various states
            // in our game instead of clumping them together in our update and draw
            // methods
            //
            // our current game state can be any of the following:
            // 1. 'start' (the beginning of the game, where we're told to press Enter)
            // 2. 'paddle-select' (where we get to choose the color of our paddle)
            // 3. 'serve' (waiting on a key press to serve the ball)
            // 4. 'play' (the ball is in play, bouncing between paddles)
            // 5. 'victory' (the current level is over, with a victory jingle)
            // 6. 'game-over' (the player has lost; display score and allow restart)
            StateMachine = new StateMachine(new Dictionary <string, State>
            {
                ["start"]            = new StartState(),
                ["play"]             = new PlayState(),
                ["serve"]            = new ServeState(),
                ["game-over"]        = new GameOverState(),
                ["victory"]          = new VictoryState(),
                ["high-scores"]      = new HighScoreState(),
                ["enter-high-score"] = new EnterHighScoreState(),
                ["paddle-select"]    = new PaddleSelectState(),
            });

            Instance = this;
        }
Exemple #30
0
        private async void InitSound()
        {
            await Task.Run(() =>
            {
                wins    = new IAudio[3];
                defeats = new IAudio[3];

                wins[0] = DependencyService.Get <IAudio>(DependencyFetchTarget.NewInstance);
                wins[1] = DependencyService.Get <IAudio>(DependencyFetchTarget.NewInstance);
                wins[2] = DependencyService.Get <IAudio>(DependencyFetchTarget.NewInstance);

                defeats[0] = DependencyService.Get <IAudio>(DependencyFetchTarget.NewInstance);
                defeats[1] = DependencyService.Get <IAudio>(DependencyFetchTarget.NewInstance);
                defeats[2] = DependencyService.Get <IAudio>(DependencyFetchTarget.NewInstance);


                wins[0].SetupAudioFile("win1.mp3", false, 1);
                wins[1].SetupAudioFile("win2.mp3", false, 1);
                wins[2].SetupAudioFile("win3.mp3", false, 1);

                defeats[0].SetupAudioFile("lose1.mp3", false, 1);
                defeats[1].SetupAudioFile("lose2.mp3", false, 1);
                defeats[2].SetupAudioFile("lose3.mp3", false, 1);
            });
        }
Exemple #31
0
    public void PlayHealthLoadedSFX()
    {
        IAudio audioPlayer = ObjectPoolManager.Spawn(audioPlayerPrefab, transform.position).GetComponent <IAudio>();

        audioPlayer.SetUpAudioSource(AudioManager.instance.GetSound(healthFinishedSFX));
        audioPlayer.Play();
    }
Exemple #32
0
        public GameState(Camera camera, Stage stage, IAssetLoader assetLoader, ISignal signal, IOverworld overworld, IAudio audio,
                         IRenderer renderer, SpriteBatch spriteBatch, GraphicsDevice graphicsDevice)
        {
            _signal         = signal;
            _overworld      = overworld;
            _audio          = audio;
            _renderer       = renderer;
            _spriteBatch    = spriteBatch;
            _graphicsDevice = graphicsDevice;
            Stage           = stage;
            Config          = Config.Load(assetLoader);
            Player          = new Player(Config, assetLoader);

            Stage.GameObjects.Add(Player);

            camera.Zoom = 1f;
            camera.Lerp = 0.1f;
            camera.Lead = 0;
            var s = 6f;

            camera.DeadZone = new RectangleF(
                (1f - (1f / s)) / 2f,
                (1f - (1f / s)) / 2f,
                (1f / s), (1f / s));

            //camera.Boundary = new Rectangle(8000, 5800, 800, 800);

            //Camera.SetZoom(canvasSize.DisplayHeight / canvasSize.Height)

            //SceneMachine = new SceneMachine(Player, renderer, CreateGlobalSystems(), CreateGlobalEntities());
        }
Exemple #33
0
        public async void Update(IAudio audio)
        {
            _currentAudio = audio;

            if (_currentAudio != null && _currentAudio.TrackData != null)
            {
                string Id = _currentAudio.TrackData.Artist.Id;
                _currentAudio.TrackData.Artist = await _currentAudio.GetArtistAsync(Id);

                Description.Text = _currentAudio.TrackData.Artist.Description;
                Name.Text        = _currentAudio.Artist;
                var imageUrl = _currentAudio.TrackData.Artist.ImageUrl;
                try
                {
                    ArtistImage.Source = await _currentAudio.GetImageTaskAsync(imageUrl);
                }
                catch (Exception)
                {
                    ArtistImage.Source = new BitmapImage(new Uri("pack://application:,,,/Icons/music-record-big.png"));
                }
            }
            else
            {
                return;
            }
        }
Exemple #34
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            RequestWindowFeature(Window.FEATURE_NO_TITLE);
            GetWindow().SetFlags(IWindowManager_LayoutParams.FLAG_FULLSCREEN,
                                 IWindowManager_LayoutParams.FLAG_FULLSCREEN);

            bool   isPortrait        = GetResources().GetConfiguration().Orientation == Configuration.ORIENTATION_PORTRAIT;
            int    frameBufferWidth  = isPortrait ? 480 : 800;
            int    frameBufferHeight = isPortrait ? 800 : 480;
            Bitmap frameBuffer       = Bitmap.CreateBitmap(frameBufferWidth,
                                                           frameBufferHeight, Bitmap.Config.RGB_565);

            float scaleX = (float)frameBufferWidth
                           / GetWindowManager().GetDefaultDisplay().GetWidth();
            float scaleY = (float)frameBufferHeight
                           / GetWindowManager().GetDefaultDisplay().GetHeight();

            renderView = new AndroidFastRenderView(this, frameBuffer);
            graphics   = new AndroidGraphics(GetAssets(), GetAssetsPrefix(), frameBuffer);
            fileIO     = new AndroidFileIO(this);
            audio      = new AndroidAudio(this);
            input      = new AndroidInput(this, renderView, scaleX, scaleY);
            screen     = getInitScreen();
            SetContentView(renderView);

            PowerManager powerManager = (PowerManager)GetSystemService(Context.POWER_SERVICE);

            wakeLock = powerManager.NewWakeLock(PowerManager.FULL_WAKE_LOCK, "MyGame");
        }
Exemple #35
0
    public void Damage(float damage, Vector3 knockBackDir, float knockBack)
    {
        if (currentStage != BossStage.Transition)
        {
            if (!isHurt && !isDead)
            {
                hurtVFX.BeginFlash();
                ObjectPoolManager.Spawn(deathVFX, transform.position, transform.rotation);
                IAudio player = ObjectPoolManager.Spawn(audioPlayerPrefab.gameObject, transform.position, transform.rotation).GetComponent <IAudio>();
                player.SetUpAudioSource(AudioManager.instance.GetSound("BugsSplat"));
                player.PlayAtRandomPitch();
                isHurt      = true;
                currHealth -= damage;
                if (currHealth < 0f)
                {
                    currHealth = 0f;
                }
                DamageNumber dmgVFX = ObjectPoolManager.Spawn(hurtNumber, transform.position, Quaternion.identity).GetComponent <DamageNumber>();
                if (dmgVFX != false)
                {
                    dmgVFX.Init();
                    dmgVFX.SetTextValuesAtScale(damage, MaxHealth, knockBackDir, 10);
                }

                if (currHealth / MaxHealth <= currentStageTrigger)
                {
                    currHealth = MaxHealth * currentStageTrigger;
                    EnterTransition();
                }
                healthBar.UpdateValue(currHealth);
                Invoke("ResetHurt", hurtTime);
            }
        }
    }
Exemple #36
0
    public void BossDefeated()
    {
        foreach (BaseAttackPattern baseAttack in currentAttackCycle)
        {
            baseAttack.DisableAttack();
            baseAttack.AttackEnded -= NextAttackPattern;
            baseAttack.gameObject.SetActive(false);
        }
        hiveShield.ResetShield();
        foreach (BroodNestDelegate nest in broodDelegates)
        {
            if (nest.GetAlive())
            {
                nest.Died -= DecrementBroodDelegateCount;
            }
            nest.ResetBroodDelegate();
        }
        ObjectPoolManager.Spawn(deathVFX, transform.position, transform.rotation);
        IAudio player = ObjectPoolManager.Spawn(audioPlayerPrefab.gameObject, transform.position, transform.rotation).GetComponent <IAudio>();

        player.SetUpAudioSource(AudioManager.instance.GetSound("BugsSplat"));
        player.PlayAtRandomPitch();

        GameStateManager.instance.BeginNewGameState(GameStates.LevelClear);
        hurtVFX.EndFlash();
        anim.enabled = false;
        healthBarAnim.PlayAnim("BossHealthColapse");

        MusicManager.instance.BeginFadeOut();
        isDead = true;
        deathHandler.InitDeathState();
    }
        public void TestInitialise()
        {
            _FactorySnapshot = Factory.TakeSnapshot();

            _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>();
            _RuntimeEnvironment.Setup(e => e.IsMono).Returns(false);
            _Audio = Factory.Singleton.Resolve<IAudio>();
        }
        public static void Initialize()
        {
            // makes sure there is always an object to return
            // in this case, the null object does nothing but prints out a small debug text

            _nullAudioService = new NullAudio();
            _audioService = _nullAudioService;
        }
        internal AudioPlayableMediator(IAudioStorage storage, IWebDownloader downloader, IAudio audio, Uri url)
        {
            __InternalPlayable = new AudioPlayable(audio, storage, downloader, url);
            __InternalPlayable.DownloadedFracionChanged += OnPercentsDownloadedChanged;
            __InternalPlayable.AudioNaturallyEnded += WhenStop;

            __Duration = audio.Duration;
            __PlaybackTimer.Elapsed += (sender, args) => OnSecondsPlayedChanged();
            __PlaybackTimer.AutoReset = true;
        }
Exemple #40
0
        public override void Intro( params object [] args )
        {
            contentManager = new ContentManager ( FileSystemManager.GetFileSystem ( "ManifestFileSystem" ) );
            contentManager.AddDefaultContentLoader ();

            audio1 = contentManager.Load<IAudio> ( "Test.Game.PlaySound.Resources.test1.ogg" );
            audio2 = contentManager.Load<IAudio> ( "Test.Game.PlaySound.Resources.test2.ogg" );

            font = contentManager.Load<TrueTypeFont> ( "Test.Game.PlaySound.Resources.GameFont.ttf", 20 );

            Add ( InputHelper.CreateInstance () );

            base.Intro ( args );
        }
Exemple #41
0
        public AudioModel(IAudio internalAudio)
        {
            __InternalAudio = internalAudio;
            __Playable = __InternalAudio.Playable;

            __InternalAudio.Playable.PlayingStateChanged += sender => AudioState = sender.State;
            __InternalAudio.Playable.PercentsDownloadedChanged +=
                sender =>
                {
                    OnPropertyChanged("IsCached");
                    OnPropertyChanged("Downloaded");
                };
            __InternalAudio.Playable.SecondsPlayedChanged += sender => OnPropertyChanged("TimePlayed");

            Downloaded = __InternalAudio.Playable.PercentsDownloaded;
        }
        public static Dictionary<Int32, QueryStats> QueryOneSongMinHashFast(string pathToSong, IStride queryStride, IAudio proxy, DaoGateway dalManager,
                                                                            int seconds, int lHashTables, int lGroupsPerKey, int thresholdTables, int topWavelets, ref long queryTime)
        {
            ///*Fingerprint manager*/
            //FingerprintManager manager = new FingerprintManager {TopWavelets = topWavelets};
            //Stopwatch stopWatch = new Stopwatch();
            //stopWatch.Start();
            //int startIndex = -1;
            //Dictionary<Int32, QueryStats> stats = new Dictionary<Int32, QueryStats>();
            //int lenOfQuery = manager.SampleRate*seconds;
            //double[] samples = manager.GetSamplesFromSong(proxy, pathToSong);
            //int startOfQuery =  Random.Next(0, samples.Length - lenOfQuery);
            //double[] querySamples = new double[lenOfQuery];
            //Array.Copy(samples, startOfQuery, querySamples, 0, lenOfQuery);
            //startIndex = startOfQuery/manager.SampleRate;
            //MinHash minHash = new MinHash(dalManager);

            //IStride stride = queryStride;
            //int index = stride.GetFirstStride();
            //while (index + manager.SamplesPerFingerprint < querySamples.Length)
            //{
            //    Fingerprint f = manager.CreateFingerprintFromSamplesArray(querySamples, index);
            //    if (f == null) continue;
            //    index += manager.SamplesPerFingerprint + stride.GetStride();
            //    int[] bin = minHash.ComputeMinHashSignature(f); /*Compute Min Hash on randomly selected fingerprints*/
            //    Dictionary<int, long> hashes = minHash.GroupMinHashToLSHBuckets(bin, lHashTables, lGroupsPerKey); /*Find all candidates by querying the database*/
            //    long[] hashbuckets = hashes.Values.ToArray();
            //    var candidates = dalManager.ReadFingerprintsByHashBucketLSH(hashbuckets, thresholdTables);
            //    if (candidates != null && candidates.Count > 0)
            //    {               
            //        var query = (from candidate in candidates
            //                    select candidate.Value.Item1).Distinct();

            //        foreach (var item in query)
            //        {
            //            stats.Add(item, new QueryStats(0, 0, 0, startIndex, startIndex + seconds, 0));
            //        }

            //        break;
            //    }
            //}
            //stopWatch.Stop();
            //queryTime = stopWatch.ElapsedMilliseconds; /*Set the query Time parameter*/
            return null;
        }
		public MainPageVM ()
		{
			_sound = DependencyService.Get<IAudio> ();
			_server = DependencyService.Get<IServer> ();

			var beaconReceiver = DependencyService.Get<IBeaconReceiver> ();
			_userId = beaconReceiver.UserId;

			beaconReceiver.BeaconsUpdated += (sender, e) => BeaconsStatus = UpdateStatus(e);
				
			_beaconsStatus = new List<BeaconStatus> ();
			for (int i = 0; i < 10; ++i)
				_beaconsStatus.Add (new BeaconStatus { Name = string.Format("T{0}", i)});

			_timer = "00:00";
			_positionStatus = "";
			_name = "";

			_server.PositionsUpdated += UpdateUsersFromServer;
			UpdateServer ();
		}
Exemple #44
0
            public AudioInfo Create(long userId,
                int index,
                IAudio audio,
                Uri url,
                PlayingStateChangedEventHandler handler = null)
            {
                var info = new AudioInfo(__Storage,
                    __Downloader,
                    audio.AudioId,
                    userId,
                    audio.Title,
                    audio.Artist,
                    audio.Duration,
                    index,
                    url);

                if (handler != null)
                {
                    info.Playable.PlayingStateChanged += handler;
                }
                return info;
            }
Exemple #45
0
        public GameManager(IAudio audio, int startLevel)
        {
            status = GameManagerStatus.None;
            random = new Random();
            title = null;
            game = null;
            gameOver = null;
            ranking = null;
            level = 0;
            currentScore = 0;
            playerLeft = 0;
            bossEndCount = 0;
            top10Players = new TopPlayerInfo[10];

            this.startLevel = startLevel;

            for (int i = 0; i < 10; i++)
            {
                top10Players[i] = new TopPlayerInfo((10 - i) * 1000, 10 - i, "_NONAME_");
            }
            exiting = false;

            this.audio = audio;
        }
        private void Play(string filePath)
        {
            // return if play is auto play is disabled
            if (!autoPlayCheckBox.Checked) return;

            player = BassProxy.Instance;
            if (player != null) {
                player.Stop();
                player.OpenFile(filePath);
                if (player.CanPlay) {
                    player.Play();
                } else {
                    Debug.WriteLine("Failed playing using Un4Seen Bass, trying to use mplayer ...");

                    float[] audioData = Mirage.AudioFileReader.Decode(filePath, Analyzer.SAMPLING_RATE, Analyzer.SECONDS_TO_ANALYZE);
                    if (audioData != null && audioData.Length > 0) {
                        player = NAudioProxy.GetWaveOutInstance();
                        if (player != null) {
                            NAudioFloatArrayProvider provicer = new NAudioFloatArrayProvider(Analyzer.SAMPLING_RATE, audioData, 2);
                            ((NAudioProxy) player).OpenSampleProvider(provicer);
                            if (player.CanPlay) {
                                player.Play();
                            } else {
                                MessageBox.Show("Could not play file!", "Error playing file", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                }
            }
        }
Exemple #47
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            //Hides the titlebar and sets the window to fullscreen
            RequestWindowFeature (WindowFeatures.NoTitle);
            Window.SetFlags (WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

            //Create a frameBuffer for the background
            var rotation = WindowManager.DefaultDisplay.Rotation;
            bool isPortrait = rotation == SurfaceOrientation.Rotation0 || rotation == SurfaceOrientation.Rotation180;
            int frameBufferWidth = isPortrait ? 480 : 800;
            int frameBufferHeight = isPortrait ? 800 : 480;
            Bitmap frameBuffer = Bitmap.CreateBitmap (frameBufferWidth, frameBufferHeight, Bitmap.Config.Rgb565);

            //Find screen size to calculate relative size
            var screenSize = new Point();
            WindowManager.DefaultDisplay.GetSize(screenSize);
            float scaleX = (float)frameBufferWidth / screenSize.X;
            float scaleY = (float) frameBufferHeight / screenSize.Y;

            //Generate classes and start-up the first screen
            renderView = new AndroidFastRenderView (this, frameBuffer);
            graphics = new AndroidGraphics (Assets, frameBuffer);
            fileIO = new AndroidFileIO (this);
            audio = new AndroidAudio (this);
            input = new AndroidInput (this, renderView, scaleX, scaleY);
            SetContentView (renderView);
            CurrentScreen = this.InitScreen;

            //Add a WakeLock to avoid the screen from going out
            PowerManager powerManager = (PowerManager)GetSystemService (Context.PowerService);
            wakeLock = powerManager.NewWakeLock (WakeLockFlags.Full, "BeerRun");
        }
 public void Stop( IAudio audio )
 {
     ( audio as Audio ).isPlaying = false;
     AL.SourceStop ( ( int ) audio.Handle );
 }
 void Start()
 {
     myAudio = ServiceLocator.getService<IAudio>();
 }
Exemple #50
0
 public static void UnRegister()
 {
     _instance.Shutdown();
     _instance = null;
 }
Exemple #51
0
 public ControlClient(SwarmScreenBase swarmscreen, IAudio audio)
 {
     swarmScreen = swarmscreen;
     audioScreen = audio;
 }
Exemple #52
0
        /// <summary>
        /// Construct from file info; parse ID3 tags from stream and calculate where the audio must be
        /// </summary>
        /// <param name="fileinfo"></param>
        public Mp3FileData(FileInfo fileinfo)
        {
            _sourceFileInfo = fileinfo;

            // create an empty frame model, to use if we don't parse anything better
            TagModel tagModel = new TagModel();

            // don't know how big the audio is until we've parsed the tags
            UInt32 audioNumBytes;

            using( FileStream sourceStream = fileinfo.Open( FileMode.Open, FileAccess.Read, FileShare.Read ) )
            {
                // all the header calculations use UInt32;
                // this guarantees all the file offsets we have to deal with fit in a UInt32
                if( sourceStream.Length > UInt32.MaxValue )
                    throw new InvalidAudioFrameException( "MP3 file can't be bigger than 4gb" );

                // in the absence of any recognised tags,
                // audio starts at the start
                _audioStart = 0;
                // audio is entire file length
                audioNumBytes = (UInt32)sourceStream.Length;

                // try to read an ID3v1 block.
                // If ID3v2 block exists, its values overwrite these
                // Otherwise, if ID3V1 block exists, its values are used
                // The audio is anything that's left after all the tags are excluded.
                try
                {
                    ID3v1 id3v1 = new ID3v1();
                    id3v1.Deserialize( sourceStream );

                    // fill in ID3v2 block from the ID3v1 data
                    tagModel = id3v1.FrameModel;

                    // audio is shorter by the length of the id3v1 tag
                    audioNumBytes -= ID3v1.TagLength;
                }
                catch( TagNotFoundException )
                {
                    // ignore "no ID3v1 block"
                    // everything else isn't caught here, and throws out to the caller
                }

                try
                {
                    sourceStream.Seek( 0, SeekOrigin.Begin );
                    tagModel = TagManager.Deserialize( sourceStream );

                    // audio starts after the tag
                    _audioStart = (uint)sourceStream.Position;
                    // audio is shorter by the length of the id3v2 tag
                    audioNumBytes -= _audioStart;
                }
                catch( TagNotFoundException )
                {
                    // ignore "no ID3v2 block"
                    // everything else isn't caught here, and throws out to the caller
                }

                // create a taghandler to hold the tagmodel we've parsed, if any
                _tagHandler = new TagHandler( tagModel );

            } // closes sourceStream

            // save the location of the audio in the original file
            // passing in audio size and id3 length tag (if any) to help with bitrate calculations
            _audio = new AudioFile( fileinfo, _audioStart, audioNumBytes, _tagHandler.Length );
            _audioReplaced = false;
        }
 void Start()
 {
     deathReport = ServiceLocator.getService<IDeathReporting>();
     myAudio = ServiceLocator.getService<IAudio>();
 }
Exemple #54
0
        public void Create(bool fullscreen, int width, int height, bool audio)
        {
            Root.Instance.UserInterface = this;
            window = new GameWindow(width, height, GraphicsMode.Default, "OpenTK Window", fullscreen ? GameWindowFlags.Fullscreen : GameWindowFlags.Default);
            gl = new OpenGL(width, height);
            m = new Mouse(window.Mouse);
            kb = new Keyboard(window);
            if (audio)
                this.audio = new FmodAudio();
                //this.audio = new OpenTkAudio();
            else
                this.audio = new DummyAudio();

            window.Visible = true;

            Config c = (Config)Root.Instance.ResourceManager.Load("config/global.config", typeof(Config));
            if(c.Table.ContainsKey("video.vsync"))
            {
                string vsync = c.GetString("video.vsync");
                if(vsync=="on"||vsync=="true")
                {
                    window.VSync=VSyncMode.On;
                }
                else if(vsync=="off"||vsync=="false")
                {
                    window.VSync=VSyncMode.Off;
                }
                else
                {
                    window.VSync=VSyncMode.Adaptive;
                }
            }
            else
            {
                window.VSync=VSyncMode.Adaptive;
            }
        }
Exemple #55
0
        /// <summary>
        ///   Get fingerprint similarity between 2 different songs.
        /// </summary>
        /// <param name = "manager">Fingerprint manager used in file decomposition</param>
        /// <param name = "stride">Stride object parameter</param>
        /// <param name = "proxy">Proxy to the audio object</param>
        /// <param name = "path">Path to first file</param>
        /// <param name = "differentPath">Path to different file</param>
        /// <param name = "results">Results object to be filled with the corresponding data</param>
        private static void GetFingerprintSimilarity(FingerprintManager manager, IStride stride, IAudio proxy, string path, string differentPath, DumpResults results)
        {
            int startindex = 0;
            int count = 0;
            double sum = 0;

            List<bool[]> imglista = manager.CreateFingerprints(proxy, path, stride);
            List<bool[]> imglistb = manager.CreateFingerprints(proxy, differentPath, stride);


            count = imglista.Count > imglistb.Count ? imglistb.Count : imglista.Count;
            double max = double.MinValue;
            for (int i = 0; i < count; i++)
            {
                int j = i;
                double value = MinHash.CalculateSimilarity(imglista[i], imglistb[j]);
                if (value > max)
                    max = value;
                sum += value;
            }

            results.SumJaqFingerprintSimilarityBetweenDiffertSongs = sum;
            results.AverageJaqFingerprintsSimilarityBetweenDifferentSongs = sum/count;
            results.MaxJaqFingerprintsSimilarityBetweenDifferentSongs = max;
        }
Exemple #56
0
        /// <summary>
        ///   Get fingerprint similarity of one song
        /// </summary>
        /// <param name = "manager">Fingerprint manager used in file decomposition</param>
        /// <param name = "dbstride">Database creation stride</param>
        /// <param name = "queryStride">Query stride</param>
        /// <param name = "numberOfItemsToCompare">Number of subsequent elements to compare with</param>
        /// <param name = "proxy">Proxy</param>
        /// <param name = "path">Path to first file</param>
        /// <param name = "results">Results object to be filled with the corresponding data</param>
        private static void GetFingerprintSimilarity(FingerprintManager manager, IStride dbstride, IStride queryStride, int numberOfItemsToCompare, IAudio proxy, string path, DumpResults results)
        {
            int startindex = 0;
            int count = 0;
            double sum = 0;

            List<bool[]> list = manager.CreateFingerprints(proxy, path, dbstride);
            List<bool[]> listToCompare = manager.CreateFingerprints(proxy, path, queryStride);

            count = list.Count;
            int toCompare = listToCompare.Count;

            double max = double.MinValue;

            for (int i = 0; i < count; i++)
            {
                for (int j = 0; j < toCompare; j++)
                {
                    double value = MinHash.CalculateSimilarity(list[i], listToCompare[j]);
                    if (value > max)
                        max = value;
                    sum += value;
                }
            }

            results.Results.SumJaqFingerprintsSimilarity = sum;
            results.Results.AverageJaqFingerprintSimilarity = sum/(count*toCompare);
            results.Results.MaxJaqFingerprintSimilarity = max;
        }
Exemple #57
0
 public static IAudio Register(IAudio audio)
 {
     _instance = audio;
     return Instance;
 }
 public void Pause( IAudio audio )
 {
     ( audio as Audio ).isPlaying = false;
     AL.SourcePause ( ( int ) audio.Handle );
 }
 public void Play( IAudio audio )
 {
     ( audio as Audio ).isPlaying = true;
     AL.SourcePlay ( ( int ) audio.Handle );
 }
Exemple #60
0
        /// <summary>
        ///   Get hash similarity of one song
        /// </summary>
        /// <param name = "manager">Fingerprint manager</param>
        /// <param name = "dbstride">Database stride between fingerprints</param>
        /// <param name = "queryStride">Query stride between fingerprints</param>
        /// <param name = "numberOfFingerprintsToAnalyze">Number of fingerprints to analyze</param>
        /// <param name = "hashTables">Number of hash tables in the LSH transformation</param>
        /// <param name = "hashKeys">Number of hash keys per table in the LSH transformation</param>
        /// <param name = "proxy">Audio proxy</param>
        /// <param name = "path">Path to analyzed file</param>
        /// <param name = "results">Results object to be filled with the appropriate data</param>
        private static void GetHashSimilarity(FingerprintManager manager, IStride dbstride, IStride queryStride, int numberOfFingerprintsToAnalyze, int hashTables, int hashKeys, IAudio proxy, string path, DumpResults results)
        {
            double sum = 0;
            int hashesCount = 0;
            int startindex = 0;

            List<bool[]> listDb = manager.CreateFingerprints(proxy, path, dbstride);
            List<bool[]> listQuery = manager.CreateFingerprints(proxy, path, queryStride);
            IPermutations perms = new DbPermutations(ConfigurationManager.ConnectionStrings["FingerprintConnectionString"].ConnectionString);
            MinHash minHash = new MinHash(perms);
            List<int[]> minHashDb = listDb.Select(minHash.ComputeMinHashSignature).ToList();
            List<int[]> minHashQuery = listQuery.Select(minHash.ComputeMinHashSignature).ToList();

            /*Calculate Min Hash signature similarity by comparing 2 consecutive signatures*/
            int countDb = minHashDb.Count;
            int countQuery = minHashQuery.Count;
            int minHashSignatureLen = minHashDb[0].Length;
            int similarMinHashValues = 0;
            for (int i = 0; i < countDb; i++)
            {
                for (int j = 0; j < countQuery; j++)
                {
                    for (int k = 0; k < minHashSignatureLen; k++)
                        if (minHashDb[i][k] == minHashQuery[j][k])
                            similarMinHashValues++;
                }
            }
            results.Results.SumIdenticalMinHash = similarMinHashValues;
            results.Results.AverageIdenticalMinHash = (double) similarMinHashValues/(countDb*countQuery*minHashSignatureLen);

            /*Group min hash signatures into LSH Buckets*/
            List<Dictionary<int, long>> lshBucketsDb =
                minHashDb.Select(item => minHash.GroupMinHashToLSHBuckets(item, hashTables, hashKeys)).ToList();

            List<Dictionary<int, long>> lshBucketsQuery =
                minHashQuery.Select(item => minHash.GroupMinHashToLSHBuckets(item, hashTables, hashKeys)).ToList();

            int countSignatures = lshBucketsDb.Count;
            sum = 0;
            foreach (Dictionary<int, long> a in lshBucketsDb)
            {
                Dictionary<int, long>.ValueCollection aValues = a.Values;
                foreach (Dictionary<int, long> b in lshBucketsQuery)
                {
                    Dictionary<int, long>.ValueCollection bValues = b.Values;
                    hashesCount += aValues.Intersect(bValues).Count();
                }
            }

            results.Results.SumJaqLSHBucketSimilarity = -1;
            results.Results.AverageJaqLSHBucketSimilarity = -1;
            results.Results.TotalIdenticalLSHBuckets = hashesCount;
        }