public ScoreControl(IUnityContainer container, IOutput output, IMidiInput midiInput, IInputEvents inputEvents, IMediaServiceHost mediaServiceHost, IVirtualKeyBoard virtualKeyboard, ILogger logger, XScore musicScore) : this() { _container = container; _output = output; _intputEvents = inputEvents; _midiInput = midiInput; _virtualKeyboard = virtualKeyboard; _musicScore = musicScore; _mediaServiceHost = mediaServiceHost; _logger = logger; _updateScrollTimer = new Timer(ScrollTimerHandler, null, Timeout.Infinite, _scrollTimingPerdiod); _scoreParser = new ScoreParser(_musicScore, ScoreGrid); _scoreParser.Render(); ScoreGrid.Width = _scoreParser.GetMaxHorizontalPosition(); nextBarDetails = new BarDetails(); nextBarDetails.NoteTime = 0; nextBarDetails.XCoord = 0; _intputEvents.MessageReceived += HandleInputEvent; _midiInput.StartRecording(); ConfigureSongEventController(); }
public IScore FromXml(MindTouch.Xml.XDoc aXml) { XScore xscore = new XScore(aXml); JScore js = new JScore(); js["codageParIntervalle"] = xscore.GetCodageParIntervalle(); js["codageMelodiqueRISM"] = xscore.GetCodageMelodiqueRISM(); js["verses"] = xscore.GetText(); js["title"] = xscore.MovementTitle; js["composer"] = xscore.Identification.Composer; return js; }
public BasicTestControl(IUnityContainer container, IOutput output) { //XScore testMusicScore = new XScore(@".\ScoreRenderer\Examples\Dichterliebe01.xml"); //XScore testMusicScore = new XScore(@".\ScoreRenderer\Examples\LedgerTest.xml"); //XScore testMusicScore = new XScore(@".\ScoreRenderer\Examples\Scales-C-2-Hands.xml"); //XScore testMusicScore = new XScore(@".\ScoreRenderer\Examples\Promenade_Example.xml"); //XScore testMusicScore = new XScore(@".\ScoreRenderer\Examples\Simple2NoteTest.xml"); XScore testMusicScore = new XScore(@".\ScoreRenderer\Examples\Nocturne Op. 9, No. 2.xml"); //Don't like the param overrides approach... Maybe allow only 1 active score and register the instance?? _control = container.Resolve<ScoreControl>(new ParameterOverrides { { "musicScore", testMusicScore } }); }
public static void Main() { XScore xcTest = new XScore(@"C:\Users\Alex\MrKeys\ThirdParty\MusicXML.Net\Promenade_Example.xml"); foreach (Part part in xcTest.Parts) foreach (Measure measure in part.Measures) foreach (Note note in measure.Notes) { Console.WriteLine(note); } Console.ReadLine(); }
public static Part SelectPianoPart(XScore score) { return score.Parts.Last(); }
public MusicParser(XScore score) { this._score = score; }
public void ConvertLilyToCodeMustBeOk() { XDoc doc = XDocFactory.From(File.OpenRead(@"G:\test.xml"), MimeType.XML); string lily = "c' d' e' f' dis'"; XScore score = new XScore(doc); string codage = score.GetCodageMelodiqueRISM(); string codage2 = score.GetCodageParIntervalle(); string code = Context.Current.Instance.IndexController.LilyToCodageMelodiqueRISM(lily); string code2 = Context.Current.Instance.IndexController.LilyToCodageParIntervalles(lily); }
private Yield AttachMusicXmlHelper(IScore aScore, XDoc aMusicXmlDoc, bool overwriteMusicXmlValues, Result<IScore> aResult) { XScore musicXml = new XScore(aMusicXmlDoc); bool hasNotes = false; foreach (var p in musicXml.Parts) { foreach (var m in p.Measures) { if (m.Notes.Count() > 0) { hasNotes = true; break; } } if(hasNotes) break; } if(!hasNotes) { aResult.Return(aScore); yield break; } if (overwriteMusicXmlValues) { aScore.CodageMelodiqueRISM = musicXml.GetCodageMelodiqueRISM(); aScore.CodageParIntervalles = musicXml.GetCodageParIntervalle(); //aScore.Title = musicXml.MovementTitle; //aScore.Composer = musicXml.Identification.Composer; aScore.Verses = musicXml.GetText(); } Result<IScore> result = new Result<IScore>(); if (aScore.Id != null) { yield return Update(aScore.Id, aScore.Rev, aScore, result); } else { yield return Insert(aScore, result); } using(TemporaryFile inputFile = new TemporaryFile(".xml",false)) using(TemporaryFile outputFile = new TemporaryFile(".png",false)) { theLogger.Info("Saving xdoc to " + inputFile.Path); File.Delete(inputFile.Path); aMusicXmlDoc.Save(inputFile.Path); theLogger.Info("XDoc saved"); theLogger.Info("Getting Converter and converting"); //yield return Context.Current.Instance.SourceController.Exists("bla", new Result<bool>()); IList<string> pngsFilePath = Context.Current.Instance.ConverterFactory.GetConverter(MimeType.PNG).Convert(inputFile.Path, outputFile.Path); int i = 1; foreach (string pngFile in pngsFilePath) { using(Stream pngStream = File.OpenRead(pngFile)) { yield return AddAttachment(result.Value.Id, pngStream,pngStream.Length, "$partition" + i + ".png", new Result<bool>()); } File.Delete(pngFile); i++; } } //attach music xml to the created /updated score using(Stream stream = new MemoryStream(aMusicXmlDoc.ToBytes())) { yield return AddAttachment(result.Value.Id, stream,stream.Length, "$musicxml.xml", new Result<bool>()); } aResult.Return(result.Value); }
public XScoreNoteEventParser(XScore score) { this._score = score; }
public ScoreRenderer(XScore score, Grid scorePanel) { this.score = score; this.scorePanel = scorePanel; }
public BasicTestControl(IUnityContainer container) { XScore testMusicScore = new XScore(@".\..\..\ThirdParty\MusicXML.Net\Promenade_Example.xml"); //XScore testMusicScore = new XScore(@"C:\Users\Alex\Desktop\elite.xml"); _control = new ScoreControl(container, testMusicScore); }
public Result<IScore> AttachMusicXml(IScore aScore, MindTouch.Xml.XDoc aMusicXmlDoc, bool overwriteMusicXmlValues, Result<IScore> aResult) { if (!overwriteMusicXmlValues) { XScore musicXml = new XScore(aMusicXmlDoc); aScore.CodageMelodiqueRISM = musicXml.GetCodageMelodiqueRISM(); aScore.CodageParIntervalles = musicXml.GetCodageParIntervalle(); aScore.Title = musicXml.MovementTitle; aScore.Composer = musicXml.Identification.Composer; aScore.Verses = musicXml.GetText(); } score = aScore; attachment = new MemoryStream(aMusicXmlDoc.ToBytes()); aResult.Return(score); return aResult; }