Beispiel #1
0
 public override void Play(ISoundable sound)
 {
     ///there is no sound splitting. It is just unofficial headset:)
     Output.WriteLine($"{nameof(UnofficialHeadset)} sound");
     Speaker1.Play(sound);
     Speaker2.Play(sound);
 }
Beispiel #2
0
 public static ISoundable[] SplitSound(ISoundable sound)
 {
     ISoundable[] res = new ISoundable[2];
     res[0] = sound;    /// It is dummy spliting In reality it is differ
     res[1] = sound;    /// It is dummy spliting In reality it is differ
     return(res);
 }
Beispiel #3
0
 public override void Play(ISoundable sound)
 {
     ///Sound should be splitted into 2 parts to make stereo effect.
     ///In reality spliited sound will be different, so just imagine that they diifers:)
     ISoundable[] sounds = SplitSound(sound);
     Output.WriteLine($"{nameof(SamsungHeadset)} sound");
     Speaker1.Play(sounds[0]);
     Speaker2.Play(sounds[1]);
 }
        private void SetSound(ISoundable currentSender)
        {
            string soundName = currentSender.SoundStatus.ToString().ToLower() + Suffix;

            if (!this.soundCollection.ContainsKey(soundName))
            {
                ISound newSound = this.GetSoundFromAssembly(soundName);
                this.soundCollection.Add(newSound.GetType().Name.ToLower(), newSound);
            }

            this.sound = this.soundCollection[soundName];
        }
 private void UnsubscribeForSoundEvents(ISoundable soundable)
 {
     soundable.OnEvent -= ScreenManager.Instance.SoundEffectManager.ExecuteQuery;
 }
Beispiel #6
0
 public abstract void Play(ISoundable sound);
Beispiel #7
0
 private void ReproduceSound(ISoundable sound)
 {
     Speaker.Play(sound);
 }
Beispiel #8
0
 public override void Play(ISoundable sound)
 {
     Output.WriteLine($"{nameof(MonauralSpeakerSystem)} sound");
     Speaker1.Play(sound);
 }
Beispiel #9
0
 public MainMenu()
 {
     this.sound = new Soundable();
     this.menu  = new Menu();
 }
Beispiel #10
0
 public override void Play(ISoundable sound)
 {
     Output.Write("Play sound in Mobile" + Environment.NewLine);
     PlaybackDevice.Play(sound);
 }
Beispiel #11
0
 public override void Play(ISoundable sound)
 {
     ///Some code to reproduce sound
 }
Beispiel #12
0
        static void Main(string[] args)
        {
            #region General_Typecast_Example
            i = 10;

            if (i != null)
            {
                f += (int)i;
            }

            i = (int)f;

            i = (b == true ? 1 : 0);

            #endregion

            #region Polymorphism_Example
            //Animal a = new Animal();
            Cat c = new Cat();
            Dog d = new Dog();

            Animal a1 = c;
            Animal a2 = d;

            //c.MakeASound();
            //a1.MakeASound();

            //d.MakeASound();
            //a2.MakeASound();

            #endregion

            #region Interface_Example

            Speaker s = new Speaker();

            ISoundable a = c,
                       e = new Radio();

            //a.MakeASound();
            //e.MakeASound();

            //s.MakeASound();
            //s.MakeASound("Yelling!");
            #endregion

            #region Encapsulation_Example

            //Radio r = new Radio();

            //r.ChangeStation();
            //r.MakeASound();
            //r.ChangeStation();
            //r.MakeASound();
            //r.ChangeStation();
            //r.MakeASound();

            #endregion

            #region Reference_Example

            //int[] integers = { 1, 2, 3, 4, 5};

            //foreach(int i in integers)
            //{
            //    Console.WriteLine(i);
            //}

            //func(integers);

            //Console.WriteLine();

            //foreach (int i in integers)
            //{
            //    Console.WriteLine(i);
            //}

            #endregion

            #region Enum_Example
            WeekDays w = 0;

            //for(int i = 0; i < 7; i++)
            //{
            //    Console.WriteLine(w++);
            //}

            //Console.WriteLine(w);
            #endregion


            #region Type_Typecast_Example
            //Console.WriteLine(i.GetType());
            //Console.WriteLine(w.GetType());

            //Console.WriteLine(default(int));
            //Console.WriteLine(default(WeekDays));

            Cat c2 = a1 as Cat;
            Console.WriteLine(c2.GetType());

            #endregion
        }
Beispiel #13
0
 public override void Play(ISoundable sound)
 {
     Output.Write($"{nameof(ExternalSpeaker)} sound");
     Speaker1.Play(sound);
 }
        public void ExecuteQuery(ISoundable currentSender)
        {
            this.SetSound(currentSender);

            this.sound.Play();
        }
Beispiel #15
0
 public void SetSoundability(ISoundable ISD)
 {
     Soundability = ISD;
 }