Exemplo n.º 1
0
    public static void Abertura(int tempoPadrao)
    {
        NotaMusical[] notas =
        {
            Sol_0,    //00
            Sol_2,    //01
            La_1,     //02
            La_0,     //03
            Re_0,     //04
            Mi_0,     //05
            Do_3,     //06
            La_1,     //07
            Sol_2,    //08
            Sol_0     //09
        };

        int[] tempos =
        {
            tempoPadrao * 4,     //00
              tempoPadrao * 1,   //01
              tempoPadrao * 2,   //02
              tempoPadrao * 3,   //03
              tempoPadrao * 2,   //04
              tempoPadrao * 1,   //05
              tempoPadrao * 1,   //06
              tempoPadrao * 2,   //07
              tempoPadrao * 1,   //08
              tempoPadrao * 4    //09
        };
        Som.Play(notas, tempos);
    }
Exemplo n.º 2
0
        private void btnigual_Click(object sender, EventArgs e)
        { // Programando o botão de = com base nas classes criadas //
            segundo = double.Parse(tbxScreen.Text);

            double Som;
            double Su;
            double Mul;
            double Div;

            switch (operador)
            {
            case "+":
                Som            = obj.Somar((primeiro), (segundo));
                tbxScreen.Text = Som.ToString();
                break;

            case "-":
                Su             = obj2.subtracao((primeiro), (segundo));
                tbxScreen.Text = Su.ToString();
                break;

            case "*":
                Mul            = obj3.Multiplicao((primeiro), (segundo));
                tbxScreen.Text = Mul.ToString();
                break;

            case "/":
                Div            = obj4.Divisao((primeiro), (segundo));
                tbxScreen.Text = Div.ToString();
                break;
            }
        }
Exemplo n.º 3
0
    public static void Sequencia()
    {
        //Som.Play(
        //    80,
        //    new NotaMusical[]
        //    {
        //        Do_0,  Do_1,  Do_2,  Do_3,  Do_4,  Do_5,
        //        Re_0,  Re_1,  Re_2,  Re_3,  Re_4,  Re_5,
        //        Mi_0,  Mi_1,  Mi_2,  Mi_3,  Mi_4,  Mi_5,
        //        Fa_0,  Fa_1,  Fa_2,  Fa_3,  Fa_4,  Fa_5,
        //        Sol_0, Sol_1, Sol_2, Sol_3, Sol_4, Sol_5,
        //        La_0,  La_1,  La_2,  La_3,  La_4,  La_5,
        //        Si_0,  Si_1,  Si_2,  Si_3,  Si_4,  Si_5,
        //    }
        //);

        Som.Play(
            80,
            new NotaMusical[]
        {
            Do_0, Re_0, Mi_0, Fa_0, Sol_0, La_0, Si_0,
            Do_1, Re_1, Mi_1, Fa_1, Sol_1, La_1, Si_1,
            Do_2, Re_2, Mi_2, Fa_2, Sol_2, La_2, Si_2,
            Do_3, Re_3, Mi_3, Fa_3, Sol_3, La_3, Si_3,
            Do_4, Re_4, Mi_4, Fa_4, Sol_4, La_4, Si_4,
            Do_5, Re_5, Mi_5, Fa_5, Sol_5, La_5, Si_5,
        }
            );
    }
Exemplo n.º 4
0
        public IActionResult Agendar(IFormCollection form)
        {
            ViewData["Action"] = "Agendamento";

            Agendamento agendamento = new Agendamento();

            Cliente cliente = new Cliente()
            {
                Nome     = form["nome"],
                CpfCnpj  = form["cpf-cnpj"],
                Telefone = form["telefone"],
                Endereco = form["endereco"],
                Email    = form["email"]
            };

            Som som = new Som()
            {
                ServicoSelecionado = bool.Parse(form["som"])
            };

            Iluminacao iluminacao = new Iluminacao()
            {
                ServicoSelecionado = bool.Parse(form["iluminacao"])
            };

            Evento evento = new Evento()
            {
                NomeEvento      = form["nome-evento"],
                DescricaoEvento = form["descricao"],
                Iluminacao      = iluminacao,
                Som             = som
            };

            agendamento.Cliente         = cliente;
            agendamento.Evento          = evento;
            agendamento.DataAgendamento = DateTime.Parse(form["data-evento"]);

            if (agendamentoRepository.Inserir(agendamento))
            {
                return(View("Sucesso", new RespostaViewModel("AGENDAMENTO REALIZADO")
                {
                    NomeView = "Agendamento",
                    UsuarioEmail = ObterUsuarioSession(),
                    UsuarioNome = ObterUsuarioNomeSession()
                }));
            }
            else
            {
                return(View("Erro", new RespostaViewModel("OPS! ERRO NO AGENDAMENTO :)")
                {
                    NomeView = "Agendamento",
                    UsuarioEmail = ObterUsuarioSession(),
                    UsuarioNome = ObterUsuarioNomeSession()
                }));
            }
        }
Exemplo n.º 5
0
    public void Ouvir(Som efeitoS)
    {
        GameObject novoSom       = Instantiate <GameObject>(SomPrefab, transform.position, Quaternion.identity);
        Som        novoSom_Compo = novoSom.GetComponent <Som>();

        int       numeroDoSom  = (int)efeitoS;
        AudioClip EfeitoSonoro = Sons[numeroDoSom];

        novoSom_Compo.arquivo = EfeitoSonoro;
    }
Exemplo n.º 6
0
        public BolaCanhao Disparar(ContentManager content, GameTime gameTime)
        {
            BolaCanhao b = new BolaCanhao(gameTime);

            b.Imagem         = content.Load <Texture2D>(@"images/bolacanhao");
            b.Posicao        = CalcularPosicaoBola(b);
            b.PosicaoInicial = b.Posicao;
            b.Radianos       = RadianosCorrigido;
            Som.Play();
            return(b);
        }
Exemplo n.º 7
0
        public static async Task <IActionResult> sum([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "sum/firstpost")] HttpRequest req, ILogger log)
        {
            string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            Som    model       = JsonConvert.DeserializeObject <Som>(requestBody);

            int          result = model.Getal1 + model.Getal2;
            SomResultaat som    = new SomResultaat();

            som.Resultaat = result;
            return(new OkObjectResult(som));
        }
    //Recebe o nome do Som/Música que deseja tocar (O nome precisa estar escrito IGUAL na janela do Inspector
    public void Play(string nome)
    {
        Som pointer = Array.Find(sons, som => som.nomeDoSom == nome);

        if (pointer == null)
        {
            Debug.LogError("Som " + nome + "não encontrado!!");
            return;
        }
        pointer.source.Play();
    }
Exemplo n.º 9
0
    public void Emitir(efeitosom efeito)
    {
        GameObject novaCaixa      = Instantiate <GameObject>(somPrefab, transform.position, Quaternion.identity);
        Som        novaCaixa_Conf = novaCaixa.GetComponent <Som>();

        int som_numero = (int)efeito;

        AudioClip somEfeitoSonoro = sons[som_numero];

        novaCaixa_Conf.clipesom = somEfeitoSonoro;
    }
Exemplo n.º 10
0
 public void ListaAlterada(object sender, AlteracaoListaEventArgs e)
 {
     if (e.TipoAlteracao == TipoAlteracaoLista.Adicao)
     {
         if (e.Objeto is CenaWinForm)
         {
             CenaWinForm c = (CenaWinForm)e.Objeto;
             TreeViewObjetos.Nodes.Add(c.ID, c.Nome);
         }
         else if (e.Objeto is Script)
         {
             Script s = (Script)e.Objeto;
             LstScript.Items.Add(s);
             CboUpdate.Items.Add(s);
         }
         else if (e.Objeto is Som)
         {
             Som s = (Som)e.Objeto;
             LstSons.Items.Add(s);
         }
         else if (e.Objeto is ConcentradorObjeto)
         {
             CenaWinForm        c = (CenaWinForm)sender;
             ConcentradorObjeto o = (ConcentradorObjeto)e.Objeto;
             TreeViewObjetos.Nodes[c.ID].Nodes.Add(o.ID, o.Nome);
         }
     }
     else if (e.TipoAlteracao == TipoAlteracaoLista.Remocao)
     {
         if (e.Objeto is CenaWinForm)
         {
             CenaWinForm c = (CenaWinForm)e.Objeto;
             TreeViewObjetos.Nodes.RemoveByKey(c.ID);
         }
         else if (e.Objeto is Script)
         {
             Script s = (Script)e.Objeto;
             LstScript.Items.Remove(s);
             CboUpdate.Items.Remove(s);
         }
         else if (e.Objeto is Som)
         {
             Som s = (Som)e.Objeto;
             LstSons.Items.Remove(s);
         }
         else if (e.Objeto is ConcentradorObjeto)
         {
             ConcentradorObjeto o    = (ConcentradorObjeto)e.Objeto;
             TreeNode           node = TreeViewObjetos.Nodes.Find(o.ID, true)[0];
             node.Remove();
         }
     }
 }
Exemplo n.º 11
0
    void Awake()
    {
        if (_instancia != null && _instancia != this)
        {
            DestroyImmediate(gameObject);
        }
        _instancia = this;
        DontDestroyOnLoad(gameObject);

        sons = _sons;

        som = GetComponent<AudioSource>();
        Verificar();
    }
Exemplo n.º 12
0
        public static void Exibir(int tempoMili, NotaMusical somChar, Object mensagem)
        {
            ForegroundColor = White;
            BackgroundColor = Black;

            char[] arrayChar = mensagem.ToString().ToCharArray();

            for (int cont = 0; cont < arrayChar.Length; cont++)
            {
                Som.Play(tempoMili, somChar);
                Write(arrayChar[cont]);
                Thread.Sleep(tempoMili);
            }
        }
Exemplo n.º 13
0
    void Awake()
    {
        if (instance != null && instance != this)

        {
            Destroy(this.gameObject);
            return;
        }

        else
        {
            instance = this;
        }

        DontDestroyOnLoad(this.gameObject);
    }
Exemplo n.º 14
0
        public static void Exibir(int tempoMili, NotaMusical somNota, ConsoleColor corFundo, ConsoleColor corTexto, Object mensagem)
        {
            BackgroundColor = corFundo;
            ForegroundColor = corTexto;

            char[] arrayChar = mensagem.ToString().ToCharArray();

            for (int cont = 0; cont < arrayChar.Length; cont++)
            {
                Som.Play(tempoMili, somNota);
                Write(arrayChar[cont]);
                Thread.Sleep(tempoMili);
            }

            BackgroundColor = Black;
            ForegroundColor = White;
        }
Exemplo n.º 15
0
    /// <summary>
    /// Play an Audio Clip defined in the inspector
    /// </summary>
    /// <param name="sound"></param>
    public void Play(Som som)
    {
        string sound = som.ToString();

        EasyAudioUtility_Helper h = Array.Find(helper, item => item.name == sound);

        if (h != null)
        {
            //randomizing volume by variation
            h.source.volume = h.volume;
            //randomizing pitch by variation
            h.source.pitch = h.pitch;

            //playing it after setting all variations
            if (h.source.enabled)
            {
                h.source.Play();
            }
        }
    }
Exemplo n.º 16
0
    }//fim da classe Som

    //executa quando o script eh chamado (antes de ser iniciado)
    private void Awake()
    {
        if (instancia == null) //garante uma unica instancia
        //lista todas as musicas(na ordem que aparece no projeto) no caminho especificado dentro da pasta "Resources"
        //se a pasta "resources nao existir, deve ser criada.
        {
            resourceRaceMusic = Resources.LoadAll <AudioClip>("Audio/Race/Background");
            resourceMenuMusic = Resources.LoadAll <AudioClip>("Audio/Menu");
            //lista todos os efeitos sonoros no caminho especificado (na ordem que aparece no projeto)
            resourceFx = Resources.LoadAll <AudioClip>("Audio/Race/SFX");

            musicas = new Som(resourceMenuMusic.Length, resourceRaceMusic.Length, resourceFx.Length); //instancia um objeto musica do tipo Som
                                                                                                      //*
            int i = 0;
            //popula a lista de musicas
            foreach (AudioClip clip in resourceMenuMusic)
            {
                musicas.addMusica(clip, i, "Menu");
                i++;
            }
            i = 0;
            foreach (AudioClip clip in resourceRaceMusic)
            {
                musicas.addMusica(clip, i, "Race");
                i++;
            }
            //Debug.Log (string.Format ("Musicas: {0}", musicas.getTotalMusic("Race")));
            //popula a lista de efeitos especiais
            i = 0;
            foreach (AudioClip clip in resourceFx)
            {
                musicas.addFx(clip, i);
                i++;
            }
            DontDestroyOnLoad(this); //mantem ativo entre as cenas
            //*/
            instancia = this;        //atribui na primeira vez que instanciar
        }
    } //fim de Awake()
Exemplo n.º 17
0
        static void Main(string[] args)
        {
            var som    = new Som(5, 80.54m);
            var rouble = new Rouble(3, 77);
            var dollar = new Dollar(12);

            var money = new Money[] { som, rouble, dollar };

            foreach (var m in money)
            {
                Console.WriteLine(m.Print());
            }

            // Код должен вывести следующие строки на экран:
            // 5 сом
            // 3Р
            // $12

            foreach (var m in new IRate[] { som, rouble })
            {
                Console.WriteLine(m.Convert(10));
            }
        }
Exemplo n.º 18
0
        private static void SOMPattern()
        {
            WriteLine("\n-- SOM init");

            var som = new Som(12, 12, 10, 3);

            // training patterns
            var data = new double[][] {
                new double[] { 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0 },
                new double[] { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 },
                new double[] { 0.1, 0.2, 0.3, 0.4, 0.5, 0.5, 0.4, 0.3, 0.2, 0.1 },
            };

            var result = new double[][] {
                new double[] { 1.0, 0.0, 0.0 },
                new double[] { 0.0, 1.0, 0.0 },
                new double[] { 0.0, 0.0, 1.0 },
            };

            var test = new double[][] {
                new double[] { 0.9, 0.8, 0.3, 0.4, 0.4, 0.5, 0.4, 0.3, 0.2, 0.4 },
                new double[] { 0.1, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.8 },
                new double[] { 0.1, 0.2, 0.3, 0.4, 0.6, 0.6, 0.4, 0.3, 0.2, 0.1 },
            };

            WriteLine("Training...");
            som.Train(5000, data, result);

            // test
            var expected = som.PredictInt(test[0]);

            if (expected[0] < 85)
            {
                throw new Exception($"expected [0] to be above 85% got {expected[0]}");
            }

            expected = som.PredictInt(test[1]);
            if (expected[1] < 85)
            {
                throw new Exception($"expected [1] to be above 85% got {expected[1]}");
            }

            expected = som.PredictInt(test[2]);
            if (expected[2] < 85)
            {
                throw new Exception($"expected [2] to be above 85% got {expected[2]}");
            }

            // simple parser array to string
            Func <double[], string> p1 = (e => string.Join(",", e));
            Func <int[], string>    p2 = (e => string.Join(",", e));

            // show results
            WriteLine($"{p1( data[0] )}, {p2(som.PredictInt(data[0]) )}");
            WriteLine($"{p1( data[1] )}, {p2(som.PredictInt(data[1]) )}");
            WriteLine($"{p1( data[2] )}, {p2(som.PredictInt(data[2]) )}");

            WriteLine("Running predictions...");
            WriteLine($"{p1( test[0] )}, {p2( som.PredictInt(test[0]) )}");
            WriteLine($"{p1( test[1] )}, {p2( som.PredictInt(test[1]) )}");
            WriteLine($"{p1( test[2] )}, {p2( som.PredictInt(test[2]) )}");
        }
Exemplo n.º 19
0
    //Função universal para tocar Soms
    public void TocarSom(string Nome)
    {
        Som s = Array.Find(Soms, som => som.Nome == Nome); //o Som s recebe o Som cujo nome é igual ao nome pedido

        s.FonteAudio.Play();
    }
Exemplo n.º 20
0
    //Função universal para tocar um clipe de áudio do jogo
    //OBS: Essa função deve ser usada apenas para soms que sempre devem ser ouvidos em seu volume máximo
    public void TocarSom(string Nome)                      //O parâmetro Nome identifica o nome do Som a ser tocado
    {
        Som s = Array.Find(Soms, som => som.Nome == Nome); //Encontra o objeto dentro do vetor Soms cujo nome é igual ao parâmetro passado

        s.Fonte.Play();                                    //Toca o clipe desse objeto Som
    }