コード例 #1
0
ファイル: KrystalPaletteScore.cs プロジェクト: notator/Moritz
        public KrystalPaletteScore(string scoreTitleName, CompositionAlgorithm algorithm, PageFormat pageFormat,
            List<Krystal> krystals, List<Palette> palettes, string folder,
            string keywords, string comment)
            : base(folder, scoreTitleName, algorithm, keywords, comment, pageFormat)
        {
            Notator = new Notator(pageFormat);

            bool success = CreateScore(krystals, palettes);

            if(success == false)
            {
                this.Systems.Clear();
            }
        }
コード例 #2
0
        public AssistantComposerForm(string settingsPath, IMoritzForm1 moritzForm1)
        {
            InitializeComponent();

            _allTextBoxes = GetAllTextBoxes();

            _moritzForm1 = moritzForm1;
            _fsf = new FormStateFunctions();

            SetDefaultValues();
            DeselectAll();

            Debug.Assert(File.Exists(settingsPath));

            _settingsPath = settingsPath;
            _settingsFolderPath = Path.GetDirectoryName(settingsPath);
            _scoreTitle = Path.GetFileNameWithoutExtension(settingsPath);

            this.Text = _settingsFolderPath.Substring(_settingsFolderPath.LastIndexOf('\\') + 1);
            this.QuitAssistantComposerButton.Text = "Quit algorithm:  " + _scoreTitle;

            _dimensionsAndMetadataForm = new DimensionsAndMetadataForm(this, _settingsPath, _fsf);

            _algorithm = ComposableSvgScore.Algorithm(_scoreTitle);

            Debug.Assert(_algorithm != null);

            _outputVoiceIndices = GetOutputVoiceIndices(_algorithm.MidiChannelIndexPerOutputVoice.Count);

            GetSelectedSettings();

            if(VoiceIndicesPerStaffTextBox.Text == "")
            {
                SetDefaultVoiceIndicesPerStaff(_algorithm.MidiChannelIndexPerOutputVoice.Count);
            }
        }
コード例 #3
0
ファイル: ComposableScore.cs プロジェクト: notator/Moritz
 public ComposableScore(string folder, string scoreTitleName, CompositionAlgorithm algorithm, string keywords, string comment, PageFormat pageFormat)
     : base(folder, scoreTitleName, keywords, comment, pageFormat)
 {
     _algorithm = algorithm;
 }
コード例 #4
0
ファイル: ComposableScore.cs プロジェクト: notator/Moritz
 /// <summary>
 /// This function should be called before running the algorithm.
 /// </summary>
 private void CheckOutputVoiceChannelsAndMasterVolumes(CompositionAlgorithm algorithm)
 {
     string errorString = null;
     IReadOnlyList<int> masterVolumePerOutputVoice = algorithm.MasterVolumePerOutputVoice;
     IReadOnlyList<int> midiChannelIndexPerOutputVoice = algorithm.MidiChannelIndexPerOutputVoice;
     if(masterVolumePerOutputVoice.Count != midiChannelIndexPerOutputVoice.Count)
     {
         errorString = "There must be the same number of master volumes and midi channel indices.";
     }
     if(string.IsNullOrEmpty(errorString))
     {
         for(int i = 0; i < masterVolumePerOutputVoice.Count; ++i)
         {
             if(masterVolumePerOutputVoice[i] <= 0)
             {
                 errorString = "All master volumes must be > 0.";
                 break;
             }
             if(masterVolumePerOutputVoice[i] > 127)
             {
                 errorString = "All master volumes must be < 128.";
                 break;
             }
             if(midiChannelIndexPerOutputVoice[i] < 0)
             {
                 errorString = "All midi channel indices must be >= 0.";
                 break;
             }
             if(midiChannelIndexPerOutputVoice[i] > 15)
             {
                 errorString = "All midi channel indices must be < 16.";
                 break;
             }
         }
     }
     Debug.Assert(string.IsNullOrEmpty(errorString), "Error in algorithm definition: \n\n" + errorString);
 }