Esempio n. 1
0
        private void StudyPoly(object sender, RoutedEventArgs e, Piece piece)
        {
            var tag = piece.ID;
            MusicControls(piece); // Sets up the top part of the StudyTab: title, play/stop buttons, audio selection, etc.

            playpause.Click += delegate(object s, RoutedEventArgs r) { playpause_click(s, r, "poly"); };
            stop.Click += delegate(object s, RoutedEventArgs ev) { stop_Music(s, ev, "poly"); };

            OriginalText.Text = Search.getByTag(tag, SurfaceWindow1.xmlOldFr);
            switch (_currentTranslationLanguage)
            {
                case TranslationLanguage.English:
                    TranslationText.Text = "No English translated lyrics for this piece YET!";
                    break;
                case TranslationLanguage.modernFrench:
                    TranslationText.Text = piece.ModernFrench;
                    break;
            }

            motetParts = new StackPanel(); // StackPanel for the expandable parts to stack on top of eachother.
            motetParts.Orientation = Orientation.Vertical;

            fullExp = new MusicExpander("Full Score");

            // Motet score
            motetScore = new StackPanel();
            motetScore.Orientation = Orientation.Vertical;
            fullExp.Content = motetScore;
            fullExp.Header = "Full Score";
            fullExp.IsExpanded = true;

            // Score has several pages.
            // Create an object here called MotetPage and make one of these for each

            /**
             * GOAL FOR THIS SECTION:
             * 1. Get names of each .png file (page) for this piece of music
             * 2. Create a ScorePage object for each page - ScorePage implements Grid.
             * 3. Add each ScorePage to motetScore.
             * */

            ScorePage page = new ScorePage(tag);
            motetScore.Children.Add(page);

            /*
            String one = "2vMo2-1";
            String two = "2vMo2-2";
            String three = "2vMo2-3";

            List<String> pages = new List<String>(); // This List should be populated programmatically, i.e. by getting all file names in a folder
            pages.Add(one);
            pages.Add(two);
            pages.Add(three);

            foreach (String s in pages)
            {
                ScorePage newPage = new ScorePage(s);
                motetScore.Children.Add(newPage);
            }
            */

            /**
             * GOAL FOR THIS SECTION:
             * 1. Get names of each voice for this piece of music, using the tag.
             *    Audio files must be named exactly the same way as indicated in OriginalTextXML!
             *    NOTE: Very few motets have voice parts added in as of now, so "getVoiceParts" will not work!
             * 2. Create an expander for each voice.
             * 3. Add each expander to the motetParts StackPanel.
             * */

            allVoices = new List<MusicPartExpander>();
            motetParts.Children.Add(fullExp);

            foreach (String voicePartName in Study.getVoiceParts(tag))
            {
                MusicPartExpander newMPE = new MusicPartExpander(voicePartName, tag);
                newMPE.muteTB.Checked += delegate(object s, RoutedEventArgs r) { mute_Checked(s, r, newMPE); };
                newMPE.muteTB.Unchecked += delegate(object s, RoutedEventArgs r) { mute_Unchecked(s, r, newMPE); };
                newMPE.soloTB.Checked += delegate(object s, RoutedEventArgs r) { solo_Checked(s, r, newMPE); };
                newMPE.soloTB.Unchecked += delegate(object s, RoutedEventArgs r) { solo_Unchecked(s, r, newMPE); };
                newMPE.player.MediaEnded += delegate(object s, EventArgs r) { MediaEnded(s, r, "poly"); };
                allVoices.Add(newMPE);
                motetParts.Children.Add(newMPE);
            }

            foreach (MusicPartExpander mpe in allVoices)
                mpe.otherVoices = findOtherVoices(mpe, allVoices);

            notesCanvas.Width = 560;
            notesCanvas.Height = 4000;
            notesCanvas.Children.Add(motetParts);
        }
Esempio n. 2
0
        /**
         * Turns off solo mode for a voice in a polyphonic music object (i.e., enables/unmutes the other voices).
         * */
        void solo_Unchecked(object sender, RoutedEventArgs e, MusicPartExpander thisExp)
        {
            thisExp.BorderBrush = Brushes.Black;

            foreach (MusicPartExpander mpe in thisExp.otherVoices)
            {
                mpe.soloTB.IsEnabled = true;
                mpe.player.IsMuted = false;
            }
        }
Esempio n. 3
0
        /**
         * Mutes a particular voice of a polyphonic piece of music.
         * */
        void mute_Checked(object sender, RoutedEventArgs e, MusicPartExpander thisExp)
        {
            StudyTab selectedTab = mySideBar.tabBar.SelectedItem as StudyTab;

            thisExp.Opacity = 0.7;
            thisExp.soloTB.IsEnabled = false;

            Boolean allOtherExpsMuted = true;
            foreach (MusicPartExpander mpe in thisExp.otherVoices)
            {
                if (mpe.muteTB.IsChecked == false) // If any other voices are still audible
                    allOtherExpsMuted = false;
            }

            if (allOtherExpsMuted == true)
            {
                thisExp.player.Stop();
                foreach (MusicPartExpander mpe in thisExp.otherVoices)
                {
                    mpe.player.Stop();
                }
                selectedTab.playpause.IsEnabled = false;
                selectedTab.stop.IsEnabled = false;
                selectedTab.playpause.FontSize = 35;
                selectedTab.playpause.Content = "►";
            }

            thisExp.player.IsMuted = true;
        }
Esempio n. 4
0
        /**
         * Unmutes a particular voice of a polyphonic music object.
         * */
        void mute_Unchecked(object sender, RoutedEventArgs e, MusicPartExpander thisExp)
        {
            StudyTab selectedTab = mySideBar.tabBar.SelectedItem as StudyTab;

            thisExp.Opacity = 1.00;

            // If none of the other voices are soloing, then this one can enable soloing
            Boolean otherVoiceSoloing = false;
            foreach (MusicPartExpander mpe in thisExp.otherVoices)
            {
                if (mpe.soloTB.IsChecked == true)
                    otherVoiceSoloing = true;
            }

            if (otherVoiceSoloing == false)
                thisExp.soloTB.IsEnabled = true;

            selectedTab.playpause.IsEnabled = true;
            selectedTab.stop.IsEnabled = true;
            thisExp.player.IsMuted = false;
        }
Esempio n. 5
0
        /**
         * Creates a list of the other voices for a particular voice in polyphonic music.
         * Used in many action listeners; i.e., soloing one voice means you have to mute all the other ones.
         * Sets the List<MusicPartExpander> otherVoices value from the MusicPartExpander object.
         * */
        private List<MusicPartExpander> findOtherVoices(MusicPartExpander thisVoice, List<MusicPartExpander> allVoices)
        {
            List<MusicPartExpander> otherVoices = new List<MusicPartExpander>();
            foreach (MusicPartExpander mpe in allVoices)
            {
                if (mpe != thisVoice)
                    otherVoices.Add(mpe);
            }

            return otherVoices;
        }