Beispiel #1
0
 private void BindingCurrentTrack(IEnumerable <Track> checkin)
 {
     CurrentTracks = checkin.Select(s => new ObsTrack {
         IsPlay = false, Track = s
     }).ToList();
     NoCurrentTracksVisibility = !CurrentTracks.Any();
 }
Beispiel #2
0
        private static void DrawTrackTrunkSelectionWindow()
        {
            if (CurrentTracks?.Any() == true)
            {
                ImGui.Separator();
                if (ImGui.BeginChild("TrackTrunkSelection", new Vector2(-1, Math.Min(5, CurrentTracks.Count) * ImGui.GetFrameHeightWithSpacing()), false))
                {
                    for (var i = 0; i < CurrentTracks.Count; i++)
                    {
                        if (ImGui.Checkbox($"[{i + 1:00}] {CurrentTracks[i].Item2}", ref config.EnabledTracks[i]))
                        {
                            try
                            {
                                //var progress = currentPlayback.GetCurrentTime<MidiTimeSpan>();
                                //var wasplaying = IsPlaying;

                                currentPlayback?.Dispose();
                                //if (wasplaying)
                                //{

                                //}
                            }
                            catch (Exception e)
                            {
                                PluginLog.Error(e, "error when disposing current playback while changing track selection");
                            }
                            finally
                            {
                                currentPlayback = null;
                            }
                        }
                        if (ImGui.IsItemHovered())
                        {
                            if (ImGui.IsMouseReleased(ImGuiMouseButton.Right))
                            {
                                ImGui.SetClipboardText(CurrentTracks[i].Item2);
                            }
                        }
                        ToolTip(
                            "Track Selection. \r\nMidiBard will only perform tracks been selected, which is useful in ensemble.\r\nChange on this will interrupt ongoing performance."
                            .Localize());
                    }
                    ImGui.EndChild();
                }
            }
        }
Beispiel #3
0
		private static unsafe void DrawTrackTrunkSelectionWindow()
		{
			if (CurrentTracks?.Any() == true)
			{
				ImGui.Separator();
				ImGui.PushStyleColor(ImGuiCol.Separator, 0);
				//ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(-10,-10));
				//ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(-10, -10));
				//ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(-10, -10));
				if (ImGui.BeginChild("TrackTrunkSelection",
					new Vector2(ImGui.GetWindowWidth(), Math.Min(CurrentTracks.Count, 6.6f) * ImGui.GetFrameHeightWithSpacing() - ImGui.GetStyle().ItemSpacing.Y),
					false, ImGuiWindowFlags.NoDecoration))
				{

					ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 2f);
					ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(2, ImGui.GetStyle().ItemSpacing.Y));
					ImGui.PushStyleVar(ImGuiStyleVar.ButtonTextAlign, new Vector2(0.6f, 0));
					if (PlayingGuitar && config.OverrideGuitarTones)
					{
						ImGui.Columns(2);
						ImGui.SetColumnWidth(0, ImGui.GetWindowContentRegionWidth() - 4 * ImGui.GetCursorPosX() - ImGui.GetFontSize() * 5.5f - 10);
					}
					for (var i = 0; i < CurrentTracks.Count; i++)
					{
						ImGui.SetCursorPosX(0);
						var configEnabledTrack = !config.EnabledTracks[i];
						if (configEnabledTrack)
						{
							ImGui.PushStyleColor(ImGuiCol.Text, *ImGui.GetStyleColorVec4(ImGuiCol.TextDisabled));
						}

						if (ImGui.Checkbox($"[{i + 1:00}] {CurrentTracks[i].Item2}", ref config.EnabledTracks[i]))
						{
							//try
							//{
							//	//var progress = currentPlayback.GetCurrentTime<MidiTimeSpan>();
							//	//var wasplaying = IsPlaying;

							//	currentPlayback?.Dispose();
							//	//if (wasplaying)
							//	//{

							//	//}
							//}
							//catch (Exception e)
							//{
							//	PluginLog.Error(e, "error when disposing current playback while changing track selection");
							//}
							//finally
							//{
							//	currentPlayback = null;
							//}
						}

						if (configEnabledTrack)
						{
							ImGui.PopStyleColor();
						}

						if (ImGui.IsItemHovered())
						{
							if (ImGui.IsMouseReleased(ImGuiMouseButton.Right))
							{
								ImGui.SetClipboardText(CurrentTracks[i].Item2.ToString());
							}
							ImGui.BeginTooltip();
							ImGui.TextUnformatted(CurrentTracks[i].Item2.ToLongString());
							ImGui.EndTooltip();
						}
						//ToolTip(CurrentTracks[i].Item2.ToLongString()
						//	//+ "\n" +
						//	//("Track Selection. MidiBard will only perform tracks been selected, which is useful in ensemble.\r\nChange on this will interrupt ongoing performance."
						//	//	.Localize())
						//	);

						if (PlayingGuitar && config.OverrideGuitarTones)
						{
							ImGui.NextColumn();
							var width = ImGui.GetWindowContentRegionWidth();
							//var spacing = ImGui.GetStyle().ItemSpacing.X;
							var buttonSize = new Vector2(ImGui.GetFontSize() * 1.1f, ImGui.GetFrameHeight());
							const uint colorRed = 0xee_6666bb;
							const uint colorCyan = 0xee_bbbb66;
							const uint colorGreen = 0xee_66bb66;
							const uint colorYellow = 0xee_66bbbb;
							const uint colorBlue = 0xee_bb6666;
							void drawButton(int toneID, uint color, string toneName, int track)
							{
								//ImGui.SameLine(width - (4.85f - toneID) * 3 * spacing);
								var DrawColor = config.TracksTone[track] == toneID;
								if (DrawColor)
								{
									ImGui.PushStyleColor(ImGuiCol.Button, color);
									ImGui.PushStyleColor(ImGuiCol.ButtonHovered, color);
									ImGui.PushStyleColor(ImGuiCol.ButtonActive, color);
								}

								if (ImGui.Button($"{toneName}##toneSwitchButton{i}", buttonSize))
								{
									config.TracksTone[track] = toneID;
								}

								if (DrawColor)
								{
									ImGui.PopStyleColor(3);
								}
							}


							drawButton(0, colorRed, " I ", i);
							ImGui.SameLine();
							drawButton(1, colorCyan, " II ", i);
							ImGui.SameLine();
							drawButton(2, colorGreen, "III", i);
							ImGui.SameLine();
							drawButton(3, colorYellow, "IV", i);
							ImGui.SameLine();
							drawButton(4, colorBlue, "V", i);
							ImGui.NextColumn();
						}
					}

					ImGui.PopStyleVar(3);
					ImGui.EndChild();
				}
				//ImGui.PopStyleVar(3);
				ImGui.PopStyleColor();
			}
		}