예제 #1
0
 internal Enumerator(FastDictionary <TKey, TValue> dictionary)
 {
     this.dictionary = dictionary;
     version         = dictionary.version;
     index           = 0;
     currentKey      = default(TKey);
 }
 public GroupedBarRenderer(Bar bar)
     : base(bar)
 {
     _preBeatGlyphs   = new FastList <Glyph>();
     _voiceContainers = new FastDictionary <int, VoiceContainerGlyph>();
     _postBeatGlyphs  = new FastList <Glyph>();
 }
예제 #3
0
 public BarLayoutingInfo()
 {
     PreBeatSizes = new FastDictionary<int, float>();
     OnBeatSizes = new FastDictionary<int, float>();
     VoiceSize = 0;
     Springs = new FastDictionary<int, Spring>();
 }
예제 #4
0
 internal Enumerator(FastDictionary <TKey, TValue> dictionary)
 {
     m_dictionary = dictionary;
     m_index      = 0;
     m_uncounted  = dictionary.m_count;
     m_current    = default;
 }
예제 #5
0
        public virtual void DoLayout()
        {
            _preBeatGlyphs           = new LeftToRightLayoutingGlyphGroup();
            _preBeatGlyphs.Renderer  = this;
            _voiceContainers         = new FastDictionary <int, VoiceContainerGlyph>();
            _postBeatGlyphs          = new LeftToRightLayoutingGlyphGroup();
            _postBeatGlyphs.Renderer = this;

            for (int i = 0; i < Bar.Voices.Count; i++)
            {
                var voice = Bar.Voices[i];
                if (HasVoiceContainer(voice))
                {
                    var c = new VoiceContainerGlyph(0, 0, voice);
                    c.Renderer = this;
                    _voiceContainers[Bar.Voices[i].Index] = c;
                }
            }

            if (Bar.SimileMark == SimileMark.SecondOfDouble)
            {
                CanWrap = false;
            }

            CreatePreBeatGlyphs();
            CreateBeatGlyphs();
            CreatePostBeatGlyphs();

            UpdateSizes();
        }
예제 #6
0
 public MidiFileSequencer(Synthesizer synthesizer)
 {
     _synthesizer = synthesizer;
     _firstProgramEventPerChannel = new FastDictionary <int, SynthEvent>();
     _tempoChanges = new FastList <MidiFileSequencerTempoChange>();
     PlaybackSpeed = 1;
 }
예제 #7
0
        private int FindStringForValue(Track track, Beat beat, int value)
        {
            // find strings which are already taken
            var takenStrings = new FastDictionary<int, bool>();
            for (int i = 0; i < beat.Notes.Count; i++)
            {
                var note = beat.Notes[i];
                takenStrings[note.String] = true;
            }

            // find a string where the note matches into 0 to <upperbound>

            // first try to find a string from 0-14 (more handy to play)
            // then try from 0-20 (guitars with high frets)
            // then unlimited 
            int[] steps = { 14, 20, int.MaxValue };
            for (int i = 0; i < steps.Length; i++)
            {
                for (int j = 0; j < track.Tuning.Length; j++)
                {
                    if (!takenStrings.ContainsKey(j))
                    {
                        var min = track.Tuning[j];
                        var max = track.Tuning[j] + steps[i];

                        if (value >= min && value <= max)
                        {
                            return track.Tuning.Length - j;
                        }
                    }
                }
            }
            // will not happen
            return 1;
        }
예제 #8
0
 public void Reset()
 {
     _bank = new FastDictionary<int, Patch.Patch[]>();
     _assets = new AssetManager();
     Name = "";
     Comments = "";
 }
예제 #9
0
        private int FindStringForValue(Track track, Beat beat, int value)
        {
            // find strings which are already taken
            var takenStrings = new FastDictionary<int, bool>();
            for (int i = 0; i < beat.Notes.Count; i++)
            {
                var note = beat.Notes[i];
                takenStrings[note.String] = true;
            }

            // find a string where the note matches into 0 to <upperbound>

            // first try to find a string from 0-14 (more handy to play)
            // then try from 0-20 (guitars with high frets)
            // then unlimited
            int[] steps = { 14, 20, int.MaxValue };
            for (int i = 0; i < steps.Length; i++)
            {
                for (int j = 0; j < track.Tuning.Length; j++)
                {
                    if (!takenStrings.ContainsKey(j))
                    {
                        var min = track.Tuning[j];
                        var max = track.Tuning[j] + steps[i];

                        if (value >= min && value <= max)
                        {
                            return track.Tuning.Length - j;
                        }
                    }
                }
            }
            // will not happen
            return 1;
        }
예제 #10
0
 public void Reset()
 {
     _bank    = new FastDictionary <int, Patch.Patch[]>();
     _assets  = new AssetManager();
     Name     = "";
     Comments = "";
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Staff"/> class.
 /// </summary>
 public Staff()
 {
     Bars      = new FastList <Bar>();
     Tuning    = new int[0];
     Chords    = new FastDictionary <string, Chord>();
     StaffKind = StaffKind.Mixed;
 }
        public void SetFixedCollection(Action <World, CollectionBuilder <CommandProcessSystemBase> > build)
        {
            var cb = new CollectionBuilder <CommandProcessSystemBase>();

            build(World, cb);
            SystemProcessors = cb.Build();
        }
예제 #13
0
 public BarLayoutingInfo()
 {
     PreBeatSizes = new FastDictionary <int, float>();
     OnBeatSizes  = new FastDictionary <int, float>();
     VoiceSize    = 0;
     Springs      = new FastDictionary <int, Spring>();
 }
예제 #14
0
        public FastDictionary <int, float> BuildOnTimePositions(float force)
        {
            if (Math.Abs(_onTimePositionsForce - force) < 0.00001 && _onTimePositions != null)
            {
                return(_onTimePositions);
            }

            var positions = _onTimePositions = new FastDictionary <int, float>();

            var sortedSprings = _timeSortedSprings;

            if (sortedSprings.Count == 0)
            {
                return(positions);
            }

            var springX = sortedSprings[0].PreSpringWidth;

            for (int i = 0; i < sortedSprings.Count; i++)
            {
                positions[sortedSprings[i].TimePosition] = springX;
                springX += CalculateWidth(force, sortedSprings[i].SpringConstant);
            }

            return(positions);
        }
예제 #15
0
        protected override void CreateBeatGlyphs()
        {
            _bands      = new FastList <EffectBand>();
            _bandLookup = new FastDictionary <string, EffectBand>();
            foreach (var voice in Bar.Voices)
            {
                if (HasVoiceContainer(voice))
                {
                    foreach (var info in _infos)
                    {
                        var band = new EffectBand(voice, info);
                        band.Renderer = this;
                        band.DoLayout();
                        _bands.Add(band);
                        _bandLookup[voice.Index + "." + info.EffectId] = band;
                    }
                }
            }

            foreach (var voice in Bar.Voices)
            {
                if (HasVoiceContainer(voice))
                {
                    CreateVoiceGlyphs(voice);
                }
            }

            foreach (var effectBand in _bands)
            {
                if (effectBand.IsLinkedToPrevious)
                {
                    IsLinkedToPrevious = true;
                }
            }
        }
예제 #16
0
 public GroupedBarRenderer(Bar bar)
     : base(bar)
 {
     _preBeatGlyphs = new FastList<Glyph>();
     _voiceContainers = new FastDictionary<int, VoiceContainerGlyph>();
     _postBeatGlyphs = new FastList<Glyph>();
 }
예제 #17
0
 public ScoreNoteChordGlyph()
     : base(0, 0)
 {
     _infos      = new FastList <ScoreNoteGlyphInfo>();
     BeatEffects = new FastDictionary <string, Glyph>();
     _noteLookup = new FastDictionary <int, Glyph>();
 }
예제 #18
0
 public ScoreNoteChordGlyph()
     : base(0, 0)
 {
     _infos = new FastList<ScoreNoteGlyphInfo>();
     BeatEffects = new FastDictionary<string, Glyph>();
     _noteLookup = new FastDictionary<int, Glyph>();
 }
예제 #19
0
        protected override void CreateBeatGlyphs()
        {
            _bands     = new EffectBand[_infos.Length];
            BandLookup = new FastDictionary <string, EffectBand>();
            for (int i = 0; i < _infos.Length; i++)
            {
                _bands[i]          = new EffectBand(_infos[i]);
                _bands[i].Renderer = this;
                _bands[i].DoLayout();
                BandLookup[_infos[i].EffectId] = _bands[i];
            }

            foreach (var voice in Bar.Voices)
            {
                if (HasVoiceContainer(voice))
                {
                    CreateVoiceGlyphs(voice);
                }
            }

            foreach (var effectBand in _bands)
            {
                if (effectBand.IsLinkedToPrevious)
                {
                    IsLinkedToPrevious = true;
                }
            }
        }
예제 #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Beat"/> class.
 /// </summary>
 public Beat()
 {
     Id                  = GlobalBeatId++;
     WhammyBarType       = WhammyType.None;
     WhammyBarPoints     = new FastList <BendPoint>();
     Notes               = new FastList <Note>();
     BrushType           = BrushType.None;
     Vibrato             = VibratoType.None;
     GraceType           = GraceType.None;
     PickStroke          = PickStroke.None;
     Duration            = Duration.Quarter;
     TremoloSpeed        = null;
     Automations         = new FastList <Automation>();
     Dots                = 0;
     DisplayStart        = 0;
     DisplayDuration     = 0;
     PlaybackStart       = 0;
     PlaybackDuration    = 0;
     TupletDenominator   = -1;
     TupletNumerator     = -1;
     Dynamic             = DynamicValue.F;
     Crescendo           = CrescendoType.None;
     InvertBeamDirection = false;
     Ottava              = Ottavia.Regular;
     NoteStringLookup    = new FastDictionary <int, Note>();
     WhammyStyle         = BendStyle.Default;
     IsSlurOrigin        = false;
 }
예제 #21
0
        public SnapshotWindowTumblingPipe(
            SnapshotWindowStreamable <TKey, TInput, TState, TOutput> stream,
            IStreamObserver <TKey, TOutput> observer, long hop)
            : base(stream, observer)
        {
            this.aggregate         = stream.Aggregate;
            this.initialStateExpr  = this.aggregate.InitialState();
            this.initialState      = this.initialStateExpr.Compile();
            this.accumulateExpr    = this.aggregate.Accumulate();
            this.accumulate        = this.accumulateExpr.Compile();
            this.computeResultExpr = this.aggregate.ComputeResult();
            this.computeResult     = this.computeResultExpr.Compile();

            var comparer = stream.Properties.KeyEqualityComparer;

            this.keyComparerEqualsExpr = comparer.GetEqualsExpr();
            this.keyComparerEquals     = this.keyComparerEqualsExpr.Compile();

            this.errorMessages = stream.ErrorMessages;
            this.pool          = MemoryManager.GetMemoryPool <TKey, TOutput>(false);
            this.pool.Get(out this.batch);
            this.batch.Allocate();
            var getHashCode = comparer.GetGetHashCodeExpr().Compile();

            this.heldAggregates = comparer.CreateFastDictionaryGenerator <TKey, TState>(1, this.keyComparerEquals, getHashCode, stream.Properties.QueryContainer).Invoke();

            this.hop = hop;
        }
예제 #22
0
        public void TestFastDictionary()
        {
            var facit = new Dictionary <int, string>();
            var fast  = new FastDictionary <int, string>();

            for (int r = 0; r < 1000000; r++)
            {
                var rnd = PRNG.Next(0, 13);
                switch (rnd)
                {
                case 0:
                    facit.Clear();
                    fast.Clear();
                    break;

                case 1:
                case 2:
                {
                    // add/change using indexer
                    int key;
                    if (facit.Count > 2 && PRNG.Next(0, 100) < 20)
                    {
                        key = GetRandomKey(facit);
                    }
                    else
                    {
                        key = PRNG.Next(1, 1000);
                    }
                    facit[key] = key.ToString();
                    fast[key]  = key.ToString();
                    break;
                }

                case 3:
                case 4:
                    // add using Add()
                    int b = PRNG.Next(1, 1000);
                    if (facit.ContainsKey(b) == false)
                    {
                        facit.Add(b, b.ToString());
                        fast.Add(b, b.ToString());
                    }
                    break;

                case 5:
                case 6:
                {
                    // add using GetOrInit()
                    int     c      = PRNG.Next(0, 1000);
                    bool    exists = facit.ContainsKey(c);
                    ref var str    = ref fast.GetOrInit(c, out bool wasCreated);
                    Assert.AreEqual(exists, !wasCreated);
                    str = c.ToString();
                    if (!exists)
                    {
                        facit[c] = c.ToString();
                    }
                    break;
                }
예제 #23
0
 public BarSizeInfo()
 {
     Sizes         = new FastDictionary <string, float>();
     PreNoteSizes  = new FastDictionary <int, float>();
     OnNoteSizes   = new FastDictionary <int, float>();
     PostNoteSizes = new FastDictionary <int, float>();
     FullWidth     = 0;
 }
예제 #24
0
 public void RegisterBarRenderer(string key, BarRendererBase renderer)
 {
     if (!_barRendererLookup.ContainsKey(key))
     {
         _barRendererLookup[key] = new FastDictionary <string, BarRendererBase>();
     }
     _barRendererLookup[key][GetBarRendererId(renderer.Bar.Staff.Track.Index, renderer.Bar.Index)] = renderer;
 }
예제 #25
0
        public BeamingHelper(Track track)
        {
            _track = track;

            Beats = new FastList<Beat>();
            _beatLineXPositions = new FastDictionary<int, BeatLinePositions>();
            ShortestDuration = Duration.QuadrupleWhole;
        }
예제 #26
0
 internal Enumerator(FastDictionary <TKey, TValue> dictionary, int getEnumeratorRetType)
 {
     this.dictionary           = dictionary;
     version                   = dictionary.version;
     index                     = 0;
     this.getEnumeratorRetType = getEnumeratorRetType;
     current                   = new KeyValuePair <TKey, TValue>();
 }
예제 #27
0
 public BarSizeInfo()
 {
     Sizes = new FastDictionary<string, float>();
     PreNoteSizes = new FastDictionary<int, float>();
     OnNoteSizes = new FastDictionary<int, float>();
     PostNoteSizes = new FastDictionary<int, float>();
     FullWidth = 0;
 }
        public BeamingHelper(Track track)
        {
            _track = track;

            Beats = new FastList <Beat>();
            _beatLineXPositions = new FastDictionary <int, BeatLinePositions>();
            MaxDuration         = Duration.Whole;
        }
예제 #29
0
 public TabNoteChordGlyph(float x, float y, bool isGrace)
     : base(x, y)
 {
     _isGrace = isGrace;
     _notes = new FastList<NoteNumberGlyph>();
     BeatEffects = new FastDictionary<string, Glyph>();
     _noteLookup = new FastDictionary<int, NoteNumberGlyph>();
 }
예제 #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Staff"/> class.
 /// </summary>
 public Staff()
 {
     Bars   = new FastList <Bar>();
     Tuning = new int[0];
     Chords = new FastDictionary <string, Chord>();
     ShowStandardNotation = true;
     ShowTablature        = true;
 }
예제 #31
0
 public TabNoteChordGlyph(float x, float y, bool isGrace)
     : base(x, y)
 {
     _isGrace    = isGrace;
     _notes      = new FastList <NoteNumberGlyph>();
     BeatEffects = new FastDictionary <string, Glyph>();
     _noteLookup = new FastDictionary <int, NoteNumberGlyph>();
 }
 public void RegisterBarRenderer(string key, int index, BarRendererBase renderer)
 {
     if (!_barRendererLookup.ContainsKey(key))
     {
         _barRendererLookup[key] = new FastDictionary <int, BarRendererBase>();
     }
     _barRendererLookup[key][index] = renderer;
 }
예제 #33
0
        // -------- -------- -------- -------- -------- -------- -------- -------- -------- /.
        // Base Methods
        // -------- -------- -------- -------- -------- -------- -------- -------- -------- /.
        protected override void OnCreateManager(int capacity)
        {
            m_Archetype = EntityManager.CreateArchetype(typeof(EntityGroup));
            m_ApplyGroupIdFromSceneGroupIds = new FastDictionary <int, int>();
            m_Groups       = new FastDictionary <int, EntityGroup>();
            m_PooledGroups = new NativeQueue <EntityGroup>(Allocator.Persistent);

            m_CachedDictionaryEventKeepIds = new FastDictionary <int, bool>();
        }
예제 #34
0
        protected override void OnDestroyManager()
        {
            m_ApplyGroupIdFromSceneGroupIds.Clear();
            m_Groups.Clear();
            m_PooledGroups.Clear();

            m_ApplyGroupIdFromSceneGroupIds = null;
            m_Groups = null;
        }
예제 #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MasterBar"/> class.
 /// </summary>
 public MasterBar()
 {
     TimeSignatureDenominator = 4;
     TimeSignatureNumerator   = 4;
     TripletFeel         = TripletFeel.NoTripletFeel;
     KeySignatureType    = KeySignatureType.Major;
     TimeSignatureCommon = false;
     Fermata             = new FastDictionary <int, Fermata>();
 }
예제 #36
0
 static XmlParser()
 {
     Escapes         = new FastDictionary <string, string>();
     Escapes["lt"]   = "<";
     Escapes["gt"]   = ">";
     Escapes["amp"]  = "&";
     Escapes["quot"] = "\"";
     Escapes["apos"] = "'";
 }
예제 #37
0
        private FastDictionary <string, object> GetDataAttributes()
        {
            var dataAttributes = new FastDictionary <string, object>();

            if (Element.dataset.As <bool>())
            {
                foreach (var key in Element.dataset.As <JsObject>())
                {
                    object value = Element.dataset.Member(key);
                    try
                    {
                        value = JSON.parse(value.As <string>());
                    }
                    catch
                    {
                        if (value == "")
                        {
                            value = null;
                        }
                    }
                    dataAttributes[key] = value;
                }
            }
            else
            {
                for (var i = 0; i < Element.attributes.length; i++)
                {
                    var attr = Element.attributes[i];
                    if (attr.nodeName.As <string>().StartsWith("data-"))
                    {
                        var keyParts = attr.nodeName.substr(5).split("-");
                        var key      = keyParts[0];
                        for (int j = 1; j < keyParts.length; j++)
                        {
                            key += keyParts[j].substr(0, 1).toUpperCase() + keyParts[j].substr(1);
                        }

                        object value = attr.nodeValue;
                        try
                        {
                            value = JSON.parse(value.As <string>());
                        }
                        catch
                        {
                            if (value == "")
                            {
                                value = null;
                            }
                        }
                        dataAttributes[key] = value;
                    }
                }
            }

            return(dataAttributes);
        }
예제 #38
0
파일: Track.cs 프로젝트: eriser/alphaTab
 public Track()
 {
     Name = "";
     ShortName = "";
     Tuning = new int[0];
     Bars = new FastList<Bar>();
     Chords = new FastDictionary<string, Chord>();
     PlaybackInfo = new PlaybackInformation();
     Color = new Color(200, 0, 0);
 }
예제 #39
0
 public Track()
 {
     Name         = "";
     ShortName    = "";
     Tuning       = new int[0];
     Bars         = new FastList <Bar>();
     Chords       = new FastDictionary <string, Chord>();
     PlaybackInfo = new PlaybackInformation();
     Color        = new Color(200, 0, 0);
 }
예제 #40
0
        public override Score ReadScore()
        {
            _trackById = new FastDictionary<string, Track>();

            var xml = Std.ToString(_data.ReadAll());
            var dom = Std.LoadXml(xml);

            _score = new Score();
            _score.Tempo = 120;
            ParseDom(dom);
            _score.Finish();
            return _score;
        }
        public AlphaSynthWebWorkerApiBase(ISynthOutput player, string alphaSynthScriptFile)
        {
            _player = player;
            _player.ReadyChanged += PlayerReadyChanged;
            _player.PositionChanged += PlayerPositionChanged;
            _player.SampleRequest += PlayerSampleRequest;
            _player.Finished += PlayerFinished;

            _events = new FastDictionary<string, FastList<JsFunction>>();

            _alphaSynthScriptFile = alphaSynthScriptFile;

            // create web worker
            _synth = new Worker(CreateWorkerUrl());
        }
예제 #42
0
 static ScoreBeatGlyph()
 {
     // ReSharper disable ForCanBeConvertedToForeach
     NormalKeys = new FastDictionary<int, bool>();
     var normalKeyNotes = new[] { 32, 34, 35, 36, 38, 39, 40, 41, 43, 45, 47, 48, 50, 55, 56, 58, 60, 61 };
     for (int i = 0; i < normalKeyNotes.Length; i++)
     {
         NormalKeys[normalKeyNotes[i]] = true;
     }
     XKeys = new FastDictionary<int, bool>();
     var xKeyNotes = new[] { 31, 33, 37, 42, 44, 54, 62, 63, 64, 65, 66 };
     for (int i = 0; i < xKeyNotes.Length; i++)
     {
         XKeys[xKeyNotes[i]] = true;
     }
     // ReSharper restore ForCanBeConvertedToForeach
 }
예제 #43
0
        public void ParseXml(string xml)
        {
            _automations = new FastDictionary<string, FastList<Automation>>();
            _tracksMapping = new string[0];
            _tracksById = new FastDictionary<string, Track>();
            _masterBars = new FastList<MasterBar>();
            _barsOfMasterBar = new FastList<string[]>();
            _voicesOfBar = new FastDictionary<string, string[]>();
            _barsById = new FastDictionary<string, Bar>();
            _voiceById = new FastDictionary<string, Voice>();
            _beatsOfVoice = new FastDictionary<string, string[]>();
            _beatById = new FastDictionary<string, Beat>();
            _rhythmOfBeat = new FastDictionary<string, string>();
            _rhythmById = new FastDictionary<string, GpxRhythm>();
            _notesOfBeat = new FastDictionary<string, string[]>();
            _noteById = new FastDictionary<string, Note>();
            _tappedNotes = new FastDictionary<string, bool>();

            ParseDom(Std.LoadXml(xml));
        }
        public AlphaSynthWebWorkerApiBase(ISynthOutput player, string asRoot)
        {
            _asRoot = asRoot;
            _player = player;
            _player.ReadyChanged += PlayerReadyChanged;
            _player.PositionChanged += PlayerPositionChanged;
            _player.SampleRequest += PlayerSampleRequest;
            _player.Finished += PlayerFinished;

            _events = new FastDictionary<string, FastList<JsFunction>>();

            if (asRoot != "" && !asRoot.EndsWith("/"))
            {
                asRoot += "/";
            }
            _asRoot = asRoot;

            // create web worker
            _synth = new Worker(asRoot + "AlphaSynth.worker.js");
        }
예제 #45
0
        static Environment()
        {
            RenderEngines = new FastDictionary<string, Func<object, ICanvas>>();
            FileLoaders = new FastDictionary<string, Func<IFileLoader>>();
            LayoutEngines = new FastDictionary<string, Func<ScoreRenderer, ScoreLayout>>();
            StaveFactories = new FastDictionary<string, Func<ScoreLayout, BarRendererFactory>>();

            PlatformInit();

            RenderEngines["svg"] = d => new SvgCanvas();


            // default layout engines
            LayoutEngines["default"] = r => new PageViewLayout(r);
            LayoutEngines["page"] = r => new PageViewLayout(r);
            LayoutEngines["horizontal"] = r => new HorizontalScreenLayout(r);

            // default staves 
            StaveFactories["marker"] = l => new EffectBarRendererFactory(new MarkerEffectInfo());
            //staveFactories.set("triplet-feel", functionl { return new EffectBarRendererFactory(new TripletFeelEffectInfo()); });
            StaveFactories["tempo"] = l => new EffectBarRendererFactory(new TempoEffectInfo());
            StaveFactories["text"] = l => new EffectBarRendererFactory(new TextEffectInfo());
            StaveFactories["chords"] = l => new EffectBarRendererFactory(new ChordsEffectInfo());
            StaveFactories["trill"] = l => new EffectBarRendererFactory(new TrillEffectInfo());
            StaveFactories["beat-vibrato"] = l => new EffectBarRendererFactory(new BeatVibratoEffectInfo());
            StaveFactories["note-vibrato"] = l => new EffectBarRendererFactory(new NoteVibratoEffectInfo());
            StaveFactories["alternate-endings"] = l => new AlternateEndingsBarRendererFactory();
            StaveFactories["score"] = l => new ScoreBarRendererFactory();
            StaveFactories["crescendo"] = l => new EffectBarRendererFactory(new CrescendoEffectInfo());
            StaveFactories["dynamics"] = l => new EffectBarRendererFactory(new DynamicsEffectInfo());
            StaveFactories["tap"] = l => new EffectBarRendererFactory(new TapEffectInfo());
            StaveFactories["fade-in"] = l => new EffectBarRendererFactory(new FadeInEffectInfo());
            StaveFactories["harmonics"] = l => new EffectBarRendererFactory(new HarmonicsEffectInfo());
            StaveFactories["let-ring"] = l => new EffectBarRendererFactory(new LetRingEffectInfo());
            StaveFactories["palm-mute"] = l => new EffectBarRendererFactory(new PalmMuteEffectInfo());
            StaveFactories["tab"] = l => new TabBarRendererFactory();
            StaveFactories["pick-stroke"] = l => new EffectBarRendererFactory(new PickStrokeEffectInfo());
            StaveFactories["rhythm-up"] = l => new RhythmBarRendererFactory(BeamDirection.Down);
            StaveFactories["rhythm-down"] = l => new RhythmBarRendererFactory(BeamDirection.Up);
            // staveFactories.set("fingering", functionl { return new EffectBarRendererFactory(new FingeringEffectInfo()); });   
        }
예제 #46
0
        public override Score ReadScore()
        {
            _trackById = new FastDictionary<string, Track>();

            var xml = Std.ToString(Data.ReadAll());
            IXmlDocument dom ;
            try
            {
                dom = Std.LoadXml(xml);
            }
            catch (Exception)
            {
                throw new UnsupportedFormatException();
            }

            _score = new Score();
            _score.Tempo = 120;
            ParseDom(dom);
            _score.Finish();
            return _score;
        }
예제 #47
0
 static MusicFont()
 {
     SymbolLookup = new FastDictionary<MusicFontSymbol, LazySvg>();
     SymbolLookup[MusicFontSymbol.ClefF] = ClefF;
     SymbolLookup[MusicFontSymbol.ClefC] = ClefC;
     SymbolLookup[MusicFontSymbol.RestThirtySecond] = RestThirtySecond;
     SymbolLookup[MusicFontSymbol.RestQuarter] = RestQuarter;
     SymbolLookup[MusicFontSymbol.GraceUp] = GraceUp;
     SymbolLookup[MusicFontSymbol.GraceDown] = GraceDown;
     SymbolLookup[MusicFontSymbol.Trill] = Trill;
     SymbolLookup[MusicFontSymbol.ClefG] = ClefG;
     SymbolLookup[MusicFontSymbol.Num0] = Num0;
     SymbolLookup[MusicFontSymbol.Num1] = Num1;
     SymbolLookup[MusicFontSymbol.Num2] = Num2;
     SymbolLookup[MusicFontSymbol.Num3] = Num3;
     SymbolLookup[MusicFontSymbol.Num4] = Num4;
     SymbolLookup[MusicFontSymbol.Num5] = Num5;
     SymbolLookup[MusicFontSymbol.Num6] = Num6;
     SymbolLookup[MusicFontSymbol.Num7] = Num7;
     SymbolLookup[MusicFontSymbol.Num8] = Num8;
     SymbolLookup[MusicFontSymbol.Num9] = Num9;
     SymbolLookup[MusicFontSymbol.RestSixteenth] = RestSixteenth;
     SymbolLookup[MusicFontSymbol.RestEighth] = RestEighth;
     SymbolLookup[MusicFontSymbol.RestWhole] = RestWhole;
     SymbolLookup[MusicFontSymbol.NoteWhole] = NoteWhole;
     SymbolLookup[MusicFontSymbol.NoteQuarter] = NoteQuarter;
     SymbolLookup[MusicFontSymbol.NoteHalf] = NoteHalf;
     SymbolLookup[MusicFontSymbol.NoteDead] = NoteDead;
     SymbolLookup[MusicFontSymbol.NoteHarmonic] = NoteHarmonic;
     SymbolLookup[MusicFontSymbol.NoteRideCymbal] = NoteRideCymbal;
     SymbolLookup[MusicFontSymbol.NoteHiHat] = NoteHiHat;
     SymbolLookup[MusicFontSymbol.NoteSideStick] = NoteSideStick;
     SymbolLookup[MusicFontSymbol.NoteHiHatHalf] = NoteHiHatHalf;
     SymbolLookup[MusicFontSymbol.NoteChineseCymbal] = NoteChineseCymbal;
     SymbolLookup[MusicFontSymbol.FooterUpEighth] = FooterUpEighth;
     SymbolLookup[MusicFontSymbol.FooterUpSixteenth] = FooterUpSixteenth;
     SymbolLookup[MusicFontSymbol.FooterUpThirtySecond] = FooterUpThirtySecond;
     SymbolLookup[MusicFontSymbol.FooterUpSixtyFourth] = FooterUpSixtyFourth;
     SymbolLookup[MusicFontSymbol.FooterDownEighth] = FooterDownEighth;
     SymbolLookup[MusicFontSymbol.FooterDownSixteenth] = FooterDownSixteenth;
     SymbolLookup[MusicFontSymbol.FooterDownThirtySecond] = FooterDownThirtySecond;
     SymbolLookup[MusicFontSymbol.FooterDownSixtyFourth] = FooterDownSixtyFourth;
     SymbolLookup[MusicFontSymbol.SimileMark] = SimileMark;
     SymbolLookup[MusicFontSymbol.SimileMark2] = SimileMark2;
     SymbolLookup[MusicFontSymbol.Coda] = Coda;
     SymbolLookup[MusicFontSymbol.Segno] = Segno;
     SymbolLookup[MusicFontSymbol.OttavaAbove] = OttavaAbove;
     SymbolLookup[MusicFontSymbol.OttavaBelow] = OttavaBelow;
     SymbolLookup[MusicFontSymbol.QuindicesimaAbove] = QuindicesimaAbove;
     SymbolLookup[MusicFontSymbol.QuindicesimaBelow] = QuindicesimaBelow;
     SymbolLookup[MusicFontSymbol.FermataShort] = FermataShort;
     SymbolLookup[MusicFontSymbol.FermataNormal] = FermataNormal;
     SymbolLookup[MusicFontSymbol.FermataLong] = FermataLong;
     SymbolLookup[MusicFontSymbol.DynamicP] = DynamicP;
     SymbolLookup[MusicFontSymbol.DynamicF] = DynamicF;
     SymbolLookup[MusicFontSymbol.DynamicM] = DynamicM;
     SymbolLookup[MusicFontSymbol.Accentuation] = Accentuation;
     SymbolLookup[MusicFontSymbol.HeavyAccentuation] = HeavyAccentuation;
     SymbolLookup[MusicFontSymbol.WaveHorizontal] = WaveHorizontal;
     SymbolLookup[MusicFontSymbol.WaveVertical] = WaveVertical;
     SymbolLookup[MusicFontSymbol.PickStrokeDown] = PickStrokeDown;
     SymbolLookup[MusicFontSymbol.PickStrokeUp] = PickStrokeUp;
     SymbolLookup[MusicFontSymbol.TremoloPickingThirtySecond] = TremoloPickingThirtySecond;
     SymbolLookup[MusicFontSymbol.TremoloPickingSixteenth] = TremoloPickingSixteenth;
     SymbolLookup[MusicFontSymbol.TremoloPickingEighth] = TremoloPickingEighth;
     SymbolLookup[MusicFontSymbol.UpperMordent] = UpperMordent;
     SymbolLookup[MusicFontSymbol.LowerMordent] = LowerMordent;
     SymbolLookup[MusicFontSymbol.Turn] = Turn;
     SymbolLookup[MusicFontSymbol.OpenNote] = OpenNote;
     SymbolLookup[MusicFontSymbol.StoppedNote] = StoppedNote;
     SymbolLookup[MusicFontSymbol.Tempo] = Tempo;
     SymbolLookup[MusicFontSymbol.AccidentalSharp] = AccidentalSharp;
     SymbolLookup[MusicFontSymbol.AccidentalFlat] = AccidentalFlat;
     SymbolLookup[MusicFontSymbol.AccidentalNatural] = AccidentalNatural;
     SymbolLookup[MusicFontSymbol.ClefNeutral] = ClefNeutral;
     SymbolLookup[MusicFontSymbol.RestSixtyFourth] = RestSixtyFourth;
     SymbolLookup[MusicFontSymbol.AccidentalDoubleFlat] = AccidentalDoubleFlat;
     SymbolLookup[MusicFontSymbol.AccidentalDoubleSharp] = AccidentalDoubleSharp;
 }
예제 #48
0
 public AccidentalHelper()
 {
     _registeredAccidentals = new FastDictionary<int, AccidentalType>();
     _appliedScoreLines = new FastDictionary<string, int>();
 }
예제 #49
0
 static AlphaSynthFlashOutput()
 {
     Lookup = new FastDictionary<string, AlphaSynthFlashOutput>();
 }
예제 #50
0
        public BarRendererBase(Bar bar)
        {
            Bar = bar;
            IsEmpty = true;

            _preBeatGlyphs = new LeftToRightLayoutingGlyphGroup();
            _preBeatGlyphs.Renderer = this;
            _voiceContainers = new FastDictionary<int, VoiceContainerGlyph>();
            _postBeatGlyphs = new LeftToRightLayoutingGlyphGroup();
            _postBeatGlyphs.Renderer = this;
        }
예제 #51
0
 public void RegisterBarRenderer(string key, int index, BarRendererBase renderer)
 {
     if (!_barRendererLookup.ContainsKey(key))
     {
         _barRendererLookup[key] = new FastDictionary<int, BarRendererBase>();
     }
     _barRendererLookup[key][index] = renderer;
 }
예제 #52
0
        private static void Initialize()
        {
            _sevenStrings = new FastList<Tuning>();
            _sixStrings = new FastList<Tuning>();
            _fiveStrings = new FastList<Tuning>();
            _fourStrings = new FastList<Tuning>();
            _defaultTunings = new FastDictionary<int, Tuning>();

            _defaultTunings[7] = new Tuning("Guitar 7 strings", new[] {64, 59, 55, 50, 45, 40, 35}, true);
            _sevenStrings.Add(_defaultTunings[7]);

            _defaultTunings[6] = new Tuning("Guitar Standard Tuning", new[] { 64, 59, 55, 50, 45, 40 }, true);
            _sixStrings.Add(_defaultTunings[6]);

            _sixStrings.Add(new Tuning("Guitar Tune down ½ step", new[] { 63, 58, 54, 49, 44, 39 }, false));
            _sixStrings.Add(new Tuning("Guitar Tune down 1 step", new[] { 62, 57, 53, 48, 43, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Tune down 2 step", new[] { 60, 55, 51, 46, 41, 36 }, false));
            _sixStrings.Add(new Tuning("Guitar Dropped D Tuning", new[] { 64, 59, 55, 50, 45, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Dropped D Tuning variant", new[] { 64, 57, 55, 50, 45, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Double Dropped D Tuning", new[] { 62, 59, 55, 50, 45, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Dropped E Tuning", new[] { 66, 61, 57, 52, 47, 40 }, false));
            _sixStrings.Add(new Tuning("Guitar Dropped C Tuning", new[] { 62, 57, 53, 48, 43, 36 }, false));

            _sixStrings.Add(new Tuning("Guitar Open C Tuning", new[] { 64, 60, 55, 48, 43, 36 }, false));
            _sixStrings.Add(new Tuning("Guitar Open Cm Tuning", new[] { 63, 60, 55, 48, 43, 36 }, false));
            _sixStrings.Add(new Tuning("Guitar Open C6 Tuning", new[] { 64, 57, 55, 48, 43, 36 }, false));
            _sixStrings.Add(new Tuning("Guitar Open Cmaj7 Tuning", new[] { 64, 59, 55, 52, 43, 36 }, false));
            _sixStrings.Add(new Tuning("Guitar Open D Tuning", new[] { 62, 57, 54, 50, 45, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Open Dm Tuning", new[] { 62, 57, 53, 50, 45, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Open D5 Tuning", new[] { 62, 57, 50, 50, 45, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Open D6 Tuning", new[] { 62, 59, 54, 50, 45, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Open Dsus4 Tuning", new[] { 62, 57, 55, 50, 45, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Open E Tuning", new[] { 64, 59, 56, 52, 47, 40 }, false));
            _sixStrings.Add(new Tuning("Guitar Open Em Tuning", new[] { 64, 59, 55, 52, 47, 40 }, false));
            _sixStrings.Add(new Tuning("Guitar Open Esus11 Tuning", new[] { 64, 59, 55, 52, 45, 40 }, false));
            _sixStrings.Add(new Tuning("Guitar Open F Tuning", new[] { 65, 60, 53, 48, 45, 41 }, false));
            _sixStrings.Add(new Tuning("Guitar Open G Tuning", new[] { 62, 59, 55, 50, 43, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Open Gm Tuning", new[] { 62, 58, 55, 50, 43, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Open G6 Tuning", new[] { 64, 59, 55, 50, 43, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Open Gsus4 Tuning", new[] { 62, 60, 55, 50, 43, 38 }, false));
            _sixStrings.Add(new Tuning("Guitar Open A Tuning", new[] { 64, 61, 57, 52, 45, 40 }, false));
            _sixStrings.Add(new Tuning("Guitar Open Am Tuning", new[] { 64, 60, 57, 52, 45, 40 }, false));
            _sixStrings.Add(new Tuning("Guitar Nashville Tuning", new[] { 64, 59, 67, 62, 57, 52 }, false));
            _sixStrings.Add(new Tuning("Bass 6 Strings Tuning", new[] { 48, 43, 38, 33, 28, 23 }, false));
            _sixStrings.Add(new Tuning("Lute or Vihuela Tuning", new[] { 64, 59, 54, 50, 45, 40 }, false));

            _defaultTunings[5] = new Tuning("Bass 5 Strings Tuning", new[] { 43, 38, 33, 28, 23 }, true);
            _fiveStrings.Add(_defaultTunings[5]);
            _fiveStrings.Add(new Tuning("Banjo Dropped C Tuning", new[] { 62, 59, 55, 48, 67 }, false));
            _fiveStrings.Add(new Tuning("Banjo Open D Tuning", new[] { 62, 57, 54, 50, 69 }, false));
            _fiveStrings.Add(new Tuning("Banjo Open G Tuning", new[] { 62, 59, 55, 50, 67 }, false));
            _fiveStrings.Add(new Tuning("Banjo G Minor Tuning", new[] { 62, 58, 55, 50, 67 }, false));
            _fiveStrings.Add(new Tuning("Banjo G Modal Tuning", new[] { 62, 57, 55, 50, 67 }, false));

            _defaultTunings[4] = new Tuning("Bass Standard Tuning", new[] { 43, 38, 33, 28 }, true);
            _fourStrings.Add(_defaultTunings[4]);
            _fourStrings.Add(new Tuning("Bass Tune down ½ step", new[] { 42, 37, 32, 27 }, false));
            _fourStrings.Add(new Tuning("Bass Tune down 1 step", new[] { 41, 36, 31, 26 }, false));
            _fourStrings.Add(new Tuning("Bass Tune down 2 step", new[] { 39, 34, 29, 24 }, false));
            _fourStrings.Add(new Tuning("Bass Dropped D Tuning", new[] { 43, 38, 33, 26 }, false));
            _fourStrings.Add(new Tuning("Ukulele C Tuning", new[] { 45, 40, 36, 43 }, false));
            _fourStrings.Add(new Tuning("Ukulele G Tuning", new[] { 52, 47, 43, 38 }, false));
            _fourStrings.Add(new Tuning("Mandolin Standard Tuning", new[] { 64, 57, 50, 43 }, false));
            _fourStrings.Add(new Tuning("Mandolin or Violin Tuning", new[] { 76, 69, 62, 55 }, false));
            _fourStrings.Add(new Tuning("Viola Tuning", new[] { 69, 62, 55, 48 }, false));
            _fourStrings.Add(new Tuning("Cello Tuning", new[] { 57, 50, 43, 36 }, false));
        }
예제 #53
0
 public BarHelpersGroup()
 {
     Helpers = new FastDictionary<int, FastDictionary<int, BarHelpers>>();
 }
예제 #54
0
 public MidiTickLookup()
 {
     MasterBars = new FastList<MasterBarTickLookup>();
     MasterBarLookup = new FastDictionary<int, MasterBarTickLookup>();
 }
예제 #55
0
        public FastDictionary<int, float> BuildOnTimePositions(float force)
        {
            if (Math.Abs(_onTimePositionsForce - force) < 0.00001 && _onTimePositions != null)
            {
                return _onTimePositions;
            }
            _onTimePositionsForce = force;

            var positions = _onTimePositions = new FastDictionary<int, float>();

            var sortedSprings = _timeSortedSprings;
            if (sortedSprings.Count == 0)
            {
                return positions;
            }

            var springX = sortedSprings[0].PreSpringWidth;
            for (int i = 0; i < sortedSprings.Count; i++)
            {
                positions[sortedSprings[i].TimePosition] = springX;
                springX += CalculateWidth(force, sortedSprings[i].SpringConstant);
            }

            return positions;
        }
예제 #56
0
 protected ScoreLayout(ScoreRenderer renderer)
 {
     Renderer = renderer;
     _barRendererLookup = new FastDictionary<string, FastDictionary<int, BarRendererBase>>();
 }
예제 #57
0
        public void BuildHelpers(Track[] tracks, int barIndex)
        {
            for (int i = 0; i < tracks.Length; i++)
            {
                var t = tracks[i];
                FastDictionary<int, BarHelpers> h;
                if (!Helpers.ContainsKey(t.Index))
                {
                    h = new FastDictionary<int, BarHelpers>();
                    Helpers[t.Index] = h;
                }
                else
                {
                    h = Helpers[t.Index];
                }

                if (!h.ContainsKey(barIndex))
                {
                    h[barIndex] = new BarHelpers(t.Bars[barIndex]);
                }
            }
        }
예제 #58
0
 public MidiTickLookup()
 {
     Bars = new FastList<BarTickLookup>();
     BarLookup = new FastDictionary<int, BarTickLookup>();
 }
예제 #59
0
 public MasterBarTickLookup()
 {
     BeatsPerTrack = new FastDictionary<int, FastList<BeatTickLookup>>();
 }
예제 #60
0
 public static int GetValue(string name)
 {
     if (_values == null)
     {
         _values = new FastDictionary<string, int>();
         _values["acousticgrandpiano"] = 0;
         _values["brightacousticpiano"] = 1;
         _values["electricgrandpiano"] = 2;
         _values["honkytonkpiano"] = 3;
         _values["electricpiano1"] = 4;
         _values["electricpiano2"] = 5;
         _values["harpsichord"] = 6;
         _values["clavinet"] = 7;
         _values["celesta"] = 8;
         _values["glockenspiel"] = 9;
         _values["musicbox"] = 10;
         _values["vibraphone"] = 11;
         _values["marimba"] = 12;
         _values["xylophone"] = 13;
         _values["tubularbells"] = 14;
         _values["dulcimer"] = 15;
         _values["drawbarorgan"] = 16;
         _values["percussiveorgan"] = 17;
         _values["rockorgan"] = 18;
         _values["churchorgan"] = 19;
         _values["reedorgan"] = 20;
         _values["accordion"] = 21;
         _values["harmonica"] = 22;
         _values["tangoaccordion"] = 23;
         _values["acousticguitarnylon"] = 24;
         _values["acousticguitarsteel"] = 25;
         _values["electricguitarjazz"] = 26;
         _values["electricguitarclean"] = 27;
         _values["electricguitarmuted"] = 28;
         _values["overdrivenguitar"] = 29;
         _values["distortionguitar"] = 30;
         _values["guitarharmonics"] = 31;
         _values["acousticbass"] = 32;
         _values["electricbassfinger"] = 33;
         _values["electricbasspick"] = 34;
         _values["fretlessbass"] = 35;
         _values["slapbass1"] = 36;
         _values["slapbass2"] = 37;
         _values["synthbass1"] = 38;
         _values["synthbass2"] = 39;
         _values["violin"] = 40;
         _values["viola"] = 41;
         _values["cello"] = 42;
         _values["contrabass"] = 43;
         _values["tremolostrings"] = 44;
         _values["pizzicatostrings"] = 45;
         _values["orchestralharp"] = 46;
         _values["timpani"] = 47;
         _values["stringensemble1"] = 48;
         _values["stringensemble2"] = 49;
         _values["synthstrings1"] = 50;
         _values["synthstrings2"] = 51;
         _values["choiraahs"] = 52;
         _values["voiceoohs"] = 53;
         _values["synthvoice"] = 54;
         _values["orchestrahit"] = 55;
         _values["trumpet"] = 56;
         _values["trombone"] = 57;
         _values["tuba"] = 58;
         _values["mutedtrumpet"] = 59;
         _values["frenchhorn"] = 60;
         _values["brasssection"] = 61;
         _values["synthbrass1"] = 62;
         _values["synthbrass2"] = 63;
         _values["sopranosax"] = 64;
         _values["altosax"] = 65;
         _values["tenorsax"] = 66;
         _values["baritonesax"] = 67;
         _values["oboe"] = 68;
         _values["englishhorn"] = 69;
         _values["bassoon"] = 70;
         _values["clarinet"] = 71;
         _values["piccolo"] = 72;
         _values["flute"] = 73;
         _values["recorder"] = 74;
         _values["panflute"] = 75;
         _values["blownbottle"] = 76;
         _values["shakuhachi"] = 77;
         _values["whistle"] = 78;
         _values["ocarina"] = 79;
         _values["lead1square"] = 80;
         _values["lead2sawtooth"] = 81;
         _values["lead3calliope"] = 82;
         _values["lead4chiff"] = 83;
         _values["lead5charang"] = 84;
         _values["lead6voice"] = 85;
         _values["lead7fifths"] = 86;
         _values["lead8bassandlead"] = 87;
         _values["pad1newage"] = 88;
         _values["pad2warm"] = 89;
         _values["pad3polysynth"] = 90;
         _values["pad4choir"] = 91;
         _values["pad5bowed"] = 92;
         _values["pad6metallic"] = 93;
         _values["pad7halo"] = 94;
         _values["pad8sweep"] = 95;
         _values["fx1rain"] = 96;
         _values["fx2soundtrack"] = 97;
         _values["fx3crystal"] = 98;
         _values["fx4atmosphere"] = 99;
         _values["fx5brightness"] = 100;
         _values["fx6goblins"] = 101;
         _values["fx7echoes"] = 102;
         _values["fx8scifi"] = 103;
         _values["sitar"] = 104;
         _values["banjo"] = 105;
         _values["shamisen"] = 106;
         _values["koto"] = 107;
         _values["kalimba"] = 108;
         _values["bagpipe"] = 109;
         _values["fiddle"] = 110;
         _values["shanai"] = 111;
         _values["tinklebell"] = 112;
         _values["agogo"] = 113;
         _values["steeldrums"] = 114;
         _values["woodblock"] = 115;
         _values["taikodrum"] = 116;
         _values["melodictom"] = 117;
         _values["synthdrum"] = 118;
         _values["reversecymbal"] = 119;
         _values["guitarfretnoise"] = 120;
         _values["breathnoise"] = 121;
         _values["seashore"] = 122;
         _values["birdtweet"] = 123;
         _values["telephonering"] = 124;
         _values["helicopter"] = 125;
         _values["applause"] = 126;
         _values["gunshot"] = 127;
     }
     name = name.ToLower().Replace(" ", "");
     return _values.ContainsKey(name) ? _values[name] : 0;
 }