Exemplo n.º 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();
        }
Exemplo n.º 2
0
 public SampleBeat(IAudioResource audioResource, Beat beat, Dictionary <string, string> beatMap)
 {
     Name      = beat.Name;
     Time      = beat.Time;
     Intensity = (float)beat.Intensity;
     Audio     = audioResource.GetAudioResource(beatMap[beat.Name]);
 }
Exemplo n.º 3
0
        public static void PlayAudioFile(string fileName)
        {
            if (_audioResource == null)
            {
                _audioResource = DependencyService.Get <IAudioResource>();
            }

            if (FileResource.IsExists(fileName) == false)
            {
                var audio = EmbadedResource.GetAudio(fileName);
                FileResource.Save(fileName, audio);
            }

            _audioResource.PlayAudioFile(fileName);
        }
Exemplo n.º 4
0
        public AudioRenderer(IAudio audio, IAudioResource audioResource)
        {
            _audio         = audio;
            _audioResource = audioResource;

            _beatList     = new LinkedList <SampleBeat> ();
            _lastBeatTime = new Dictionary <string, DateTime> ();

            BeatMap = new Dictionary <string, string> ()
            {
                { "foot", "psycho_boomer.raw" },
                { "pad1", "drum.raw" },
                { "pad2", "hi_hat.raw" },
                { "pad3", "hi_hat_2.raw" },
                { "pad4", "kick.raw" },
                { "pad5", "plunk.raw" },
                { "pad6", "snare.raw" },
                { "pad7", "stick.raw" },
                { "pad8", "inception.raw" },
            };

            audio.ProcessBlockEventHandler += ProcessBlock;
            audio.Start();
        }
Exemplo n.º 5
0
 //------------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------------
 public PlayerController()
 {
     /*load walking sound*/
     this._walkSound = (IAudioResource) SystemCore.ResourceManager.GetResource("/Data/Audio/mech_walk.mp3", null).Data;
 }