/
SongMgrObj.rbbas
455 lines (393 loc) · 10.7 KB
/
SongMgrObj.rbbas
1
#tag ClassProtected Class SongMgrObjInherits ManagerObj #tag Method, Flags = &h0 Sub Constructor() //We have to have at leat one key in the song. This is C Major dim NewKey as KeyObj = new KeyObj NewKey.Song = me NewKey.Tonic = 0 NewKey.Key = MusicLib.kKeyMajor NewKey.CalculatePitches Keys.Append NewKey //set up the remaining default parameters for the song CreateColors Tempo = 120 TimeSignatureBeatsPerMeasure = 4 TimeSignatureBasicBeat = MIDILib.kNoteLength_04 TotalBeats = TimeSignatureBeatsPerMeasure * TimeSignatureBasicBeat * 16 //the last multiplier being the initial number of measures. End Sub #tag EndMethod #tag Method, Flags = &h0 Sub CreateColors() //this method is here to lay the foundation for custom color themes //Need to create an image reader to make a pallete that will automatically be read //and easier to create. //Basic Colors Colors.Append &CF37820 Colors.Append &C5C893F Colors.Append &C921D59 Colors.Append &c73672a Colors.Append &c0453a2 Colors.Append &c991b1f Colors.Append &cd5de27 Colors.Append &c483784 Colors.Append &CC26F29 Colors.Append &C91B85F Colors.Append &C7B1235 Colors.Append &CFCB631 Colors.Append &C1F3F79 Colors.Append &CEE4623 Colors.Append &C90B53E Colors.Append &C6961AA ColorWhiteKey = ParentWindow.SongMgr.kColorWhite ColorBlackKey = DarkenColor(ColorWhiteKey, 10) ColorMeasure = &cCC3333 ColorOctave = &c3333CC ColorXGrid = ParentWindow.SongMgr.kColorWhite ColorYGrid = ParentWindow.SongMgr.kColorWhite ColorShadow = DarkenColor(ColorWhiteKey, 50) ColorGuideWhiteKey = &cFFFFFF ColorGuideWhiteShadowKey = DarkenColor(ColorGuideWhiteKey, 50) ColorGuideBlackKey = &c7F7F7F ColorGuideBlackShadowKey = DarkenColor(ColorGuideBlackKey, 50) ColorGuideNoteInKey = &c6673C3 ColorGuideNoteInKeyTonic = &cCC6633 ColorGuideRuler = ParentWindow.SongMgr.kColorWhite ColorEditorBasicBeat = &cA2A3CA ColorEditorNewNoteLength = ParentWindow.SongMgr.kColorWhite ColorEditorBorderLine = &c3F3F3F ColorStartCursor = &c99CC00 ColorLoopStartCursor = &cCC9900 ColorLoopStopCursor = &cCC9900 ColorStopCursor = &cCC0000 ColorEditCursor = &c0099CC End Sub #tag EndMethod #tag Method, Flags = &h21 Private Function DarkenColor(TheColor as Color, TheAmount as Integer) As Color dim mColor as color dim ColorR as Integer = TheColor.Red dim ColorG as Integer = TheColor.Green dim ColorB as Integer = TheColor.Blue mColor = RGB(max((ColorR - TheAmount), 0), max((ColorG - TheAmount), 0), max((ColorB - TheAmount), 0)) Return mColor End Function #tag EndMethod #tag Property, Flags = &h0 ColorBlackKey As Color #tag EndProperty #tag Property, Flags = &h0 ColorEditCursor As Color #tag EndProperty #tag Property, Flags = &h0 ColorEditorBasicBeat As Color #tag EndProperty #tag Property, Flags = &h0 ColorEditorBorderLine As Color #tag EndProperty #tag Property, Flags = &h0 ColorEditorNewNoteLength As Color #tag EndProperty #tag Property, Flags = &h0 ColorGuideBlackKey As Color #tag EndProperty #tag Property, Flags = &h0 ColorGuideBlackShadowKey As Color #tag EndProperty #tag Property, Flags = &h0 ColorGuideNoteInKey As Color #tag EndProperty #tag Property, Flags = &h0 ColorGuideNoteInKeyTonic As Color #tag EndProperty #tag Property, Flags = &h0 ColorGuideRuler As Color #tag EndProperty #tag Property, Flags = &h0 ColorGuideWhiteKey As Color #tag EndProperty #tag Property, Flags = &h0 ColorGuideWhiteShadowKey As Color #tag EndProperty #tag Property, Flags = &h0 ColorLoopStartCursor As Color #tag EndProperty #tag Property, Flags = &h0 ColorLoopStopCursor As Color #tag EndProperty #tag Property, Flags = &h0 ColorMeasure As Color #tag EndProperty #tag Property, Flags = &h0 ColorOctave As Color #tag EndProperty #tag Property, Flags = &h0 Colors(-1) As Color #tag EndProperty #tag Property, Flags = &h0 ColorShadow As Color #tag EndProperty #tag Property, Flags = &h0 ColorStartCursor As Color #tag EndProperty #tag Property, Flags = &h0 ColorStopCursor As Color #tag EndProperty #tag Property, Flags = &h0 ColorWhiteKey As Color #tag EndProperty #tag Property, Flags = &h0 ColorXGrid As Color #tag EndProperty #tag Property, Flags = &h0 ColorYGrid As Color #tag EndProperty #tag Property, Flags = &h0 Keys(-1) As KeyObj #tag EndProperty #tag Property, Flags = &h21 Private mTotalbeats As Integer #tag EndProperty #tag Property, Flags = &h0 Tempo As Integer = 120 #tag EndProperty #tag Property, Flags = &h0 TimeSignatureBasicBeat As Integer #tag EndProperty #tag Property, Flags = &h0 TimeSignatureBeatsPerMeasure As Integer #tag EndProperty #tag ComputedProperty, Flags = &h0 #tag Getter Get //this is basically a redirect to the real method that sorts this out. mTotalbeats = ParentWindow.NoteMgr.GetTotalBeats return mTotalbeats End Get #tag EndGetter #tag Setter Set //this is basically a redirect to the real method that sorts this out. if ParentWindow <> nil then if ParentWindow.NoteMgr <> nil then mTotalbeats = ParentWindow.NoteMgr.GetTotalBeats else mTotalbeats = value end if end if End Set #tag EndSetter TotalBeats As Integer #tag EndComputedProperty #tag Constant, Name = kColorBlack, Type = Color, Dynamic = False, Default = \"&c000000", Scope = Public #tag EndConstant #tag Constant, Name = kColorMaskTransparent_000, Type = Color, Dynamic = False, Default = \"&c000000\r", Scope = Public #tag EndConstant #tag Constant, Name = kColorMaskTransparent_020, Type = Color, Dynamic = False, Default = \"&c333333", Scope = Public #tag EndConstant #tag Constant, Name = kColorMaskTransparent_040, Type = Color, Dynamic = False, Default = \"&c666666\r\r", Scope = Public #tag EndConstant #tag Constant, Name = kColorMaskTransparent_060, Type = Color, Dynamic = False, Default = \"&c999999", Scope = Public #tag EndConstant #tag Constant, Name = kColorMaskTransparent_080, Type = Color, Dynamic = False, Default = \"&cCCCCCC", Scope = Public #tag EndConstant #tag Constant, Name = kColorMaskTransparent_090, Type = Color, Dynamic = False, Default = \"&cE5E5E5", Scope = Public #tag EndConstant #tag Constant, Name = kColorMaskTransparent_100, Type = Color, Dynamic = False, Default = \"&cFFFFFF", Scope = Public #tag EndConstant #tag Constant, Name = kColorWhite, Type = Color, Dynamic = False, Default = \"&cFFFFFF", Scope = Public #tag EndConstant #tag ViewBehavior #tag ViewProperty Name="ColorBlackKey" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorEditCursor" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorEditorBasicBeat" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorEditorBorderLine" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorEditorNewNoteLength" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorGuideBlackKey" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorGuideBlackShadowKey" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorGuideNoteInKey" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorGuideNoteInKeyTonic" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorGuideRuler" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorGuideWhiteKey" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorGuideWhiteShadowKey" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorLoopStartCursor" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorLoopStopCursor" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorMeasure" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorOctave" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorShadow" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorStartCursor" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorStopCursor" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorWhiteKey" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorXGrid" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="ColorYGrid" Group="Behavior" InitialValue="&h000000" Type="Color" #tag EndViewProperty #tag ViewProperty Name="Index" Visible=true Group="ID" InitialValue="-2147483648" InheritedFrom="Object" #tag EndViewProperty #tag ViewProperty Name="Left" Visible=true Group="Position" InitialValue="0" InheritedFrom="Object" #tag EndViewProperty #tag ViewProperty Name="Name" Visible=true Group="ID" InheritedFrom="Object" #tag EndViewProperty #tag ViewProperty Name="Super" Visible=true Group="ID" InheritedFrom="Object" #tag EndViewProperty #tag ViewProperty Name="Tempo" Group="Behavior" InitialValue="120" Type="Integer" #tag EndViewProperty #tag ViewProperty Name="TimeSignatureBasicBeat" Group="Behavior" InitialValue="0" Type="Integer" #tag EndViewProperty #tag ViewProperty Name="TimeSignatureBeatsPerMeasure" Group="Behavior" InitialValue="0" Type="Integer" #tag EndViewProperty #tag ViewProperty Name="Top" Visible=true Group="Position" InitialValue="0" InheritedFrom="Object" #tag EndViewProperty #tag ViewProperty Name="TotalBeats" Group="Behavior" InitialValue="0" Type="Integer" #tag EndViewProperty #tag EndViewBehaviorEnd Class#tag EndClass