/// <summary> /// Constructor for the Bass Wrapper Class /// </summary> /// <param name="handle">Window Handle</param> public BassWrapper(IntPtr handle) { //############### BASS - REGISTRATION ##################### //BassNet.Registration("*****@*****.**", "key"); //############### BASS - INITIATION ####################### Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, handle, null); //############### BASS - VISUAL INITIATION ################ this.vis = new Visuals(); //############### BASS - SYNCPROC INITIATION (End of Song Procedure) mySync = new SYNCPROC(EndSync); }
public void startDSP() { // Try to start the DSP // possible errors may include faulty audio drives/hardware, or restricted hardware access // or maybe the library just isn't there, or isn't working try { _isItLoaded = Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero); } catch (Exception E) { Console.WriteLine(E.ToString()); } if (running()) { // the basic functionality here for construction of the mixer // try to use floating point sampling (if hardware can even do it) _mixer = BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT); _vis = new Visuals(); Bass.BASS_ChannelPlay(_mixer, false); } }
/// <summary> /// Initializes the engine; all libraries should be located in a typed folder. /// </summary> /// <param name="handle_Count">Number of streams you want to handle</param> /// <param name="LibPath">Library folder for DLL's</param> public static void Init(int handle_Count, string LibPath) { try { handleCount = handle_Count; BassNet.Registration("*****@*****.**", "2X1652019342222"); if (Bass.LoadMe(LibPath)) { if (!Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT | BASSInit.BASS_DEVICE_LATENCY | BASSInit.BASS_DEVICE_3D | BASSInit.BASS_DEVICE_CPSPEAKERS, IntPtr.Zero)) { throw new Exception(Bass.BASS_ErrorGetCode().ToString()); } handleBlock = new int[handleCount]; vis = new Visuals[handleCount]; for (int i = 0; i < handleCount; ++i) { if (vis[i] == null) { vis[i] = new Visuals(); } } } else { throw new Exception("Audio Library Not Found!"); } BassAac.LoadMe(LibPath); BassWma.LoadMe(LibPath); BassAc3.LoadMe(LibPath); BassApe.LoadMe(LibPath); BassMpc.LoadMe(LibPath); BassFlac.LoadMe(LibPath); Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 2000); Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_FLOATDSP, true); Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_NET_PLAYLIST, 2); } catch (Exception Ex) { MBoxHelper.ShowErrorMsg(Bass.BASS_ErrorGetCode() + ": " + Ex.Message, "BASS Init Error!"); } }
private static void BaseInit() { vs = new Visuals(); _timer = new BASSTimer(); _timer.Enabled = false; _isReady = true; }
void Start() { GetComponent <Text>().color = Visuals.GetColorFromString(Colors.COLOR_NEGATIVE); }
Color GetGradientColor() { return(Visuals.GetGradientColor(minValue, maxValue, value, reversed)); }
/* * long SumLong() * { * long sum = 0; * * foreach (var bonus in bonusDescriptions) * { * if (bonus.BonusType == BonusType.Multiplicative) * { * //sum *= (long)(object)bonus.Value; * sum *= System.Convert.ToInt64(bonus.Value); * } * else * { * try * { * //sum += (long)(object)bonus.Value; * sum += System.Convert.ToInt64(bonus.Value); * } * catch (System.Exception ex) * { * Debug.LogError($"Exception in bonus {parameter}: " + ex); * Debug.LogError($"Bad parameter {bonus.Name}: " + bonus.Value); * * //Debug.Log("Parameters: " + string.Join(",", bonusDescriptions.Select(b => $"{b.Name}: {b.Value}... {b.Value.GetType()}"))); * * } * } * } * * if (isCapped) * { * return (long)Mathf.Clamp(sum, capMin, capMax); * } * * return sum; * } */ public string ToString(bool positiveIsNegative = false) { StringBuilder str = new StringBuilder(); dynamic val = Sum(); if (renderTitle) { str.AppendFormat("{0} is {1}{2}", parameter, Format.Sign(val), dimension); } if (renderSubTitle) { str.AppendLine("\n** Based on **\n"); } foreach (var bonus in bonusDescriptions) { //long value = (long)(object)bonus.Value; //long value = System.Convert.ToInt64(bonus.Value); dynamic value = bonus.Value; if (bonus.HideIfZero || hideZeroes) { if (bonus.BonusType == BonusType.Additive && value == 0) { continue; } if (bonus.BonusType == BonusType.Multiplicative && value == 1) { continue; } } string text; float f; if (value is float) { // float.TryParse(bonus.Value.ToString(), out f); text = Visuals.RenderFloatBonus(bonus.Name, value, bonus.Dimension + dimension, positiveIsNegative, bonus.BonusType, false); // minifyValues } else if (value is int || value is long) { text = Visuals.RenderBonus(bonus.Name, value, bonus.Dimension + dimension, positiveIsNegative, bonus.BonusType, minifyValues); } else { text = bonus.Name + ": " + value.ToString(); } // if (float.TryParse(bonus.Value.ToString(), out f)) // { // text = Visuals.RenderFloatBonus(bonus.Name, f, bonus.Dimension + dimension, positiveIsNegative, bonus.BonusType, false); // minifyValues // } // else // { // text = Visuals.RenderBonus(bonus.Name, value, bonus.Dimension + dimension, positiveIsNegative, bonus.BonusType, minifyValues); // } str.AppendLine(text); } if (isCapped) { if (val == capMin || val == capMax) { str.AppendLine("Value capped at " + val); } } return(str.ToString()); }
public void DeselectSegment() { BorderImage.color = Visuals.GetColorFromString(Colors.COLOR_NEUTRAL); Title.color = Visuals.GetColorFromString(Colors.COLOR_NEUTRAL); }
public void SetEntity(ProductPositioning positioning) { var company = Flagship; PositioningID = positioning.ID; var positionings = Marketing.GetNichePositionings(company); SegmentId = Marketing.GetCoreAudienceId(company); var infos = Marketing.GetAudienceInfos(); var info = infos[SegmentId]; var actualPositioning = Marketing.GetPositioning(Flagship); var selectedPositioning = FindObjectOfType <PositioningManagerView>().Positioning; BorderImage.color = Visuals.GetColorFromString(selectedPositioning.ID == positioning.ID ? Colors.COLOR_CONTROL : Colors.COLOR_NEUTRAL); var worth = Marketing.GetPositioningWorth(company, positioning); bool isOurPositioning = company.productPositioning.Positioning == positioning.ID; var positioningColor = isOurPositioning ? Colors.COLOR_CONTROL : Colors.COLOR_WHITE; Title.text = $"{positioning.name}\nWorth <size=40><b>{Format.Money(worth, true)}</b></size>"; Title.color = Visuals.GetColorFromString(positioningColor); bool ourPositioning = positioning.ID == actualPositioning.ID; if (ourPositioning) { Title.text += $"\n{Visuals.Colorize("(Our positioning)", Colors.COLOR_CONTROL)}"; } //Title.text = Visuals.Colorize($"{positioning.name}\nWorth <size=40><b>{Format.MinifyMoney(worth)}</b></size>", positioningColor); //Title.text = Visuals.Colorize($"{positioning.name} \n<b>{Format.MinifyMoney(worth)}</b>", positioningColor); var competition = Companies.GetCompetitionInSegment(Flagship, Q, positioning.ID); if (!ourPositioning) { var competitors = competition.Count(); var comeptitionColor = Visuals.GetGradientColor(0, 5, competitors, true); if (competitors == 0) { Title.text += "\n" + Visuals.Positive("NO COMPETITION"); } else { Title.text += "\n" + Visuals.Colorize($"{competitors} companies", comeptitionColor); } } Icon.texture = Resources.Load <Texture2D>($"Audiences/{info.Icon}"); if (SegmentAudiencesListView != null) { SegmentAudiencesListView.SetAudiences(positioning); } //AudienceListView.SetAudiences(positioning.Loyalties.Select((l, i) => new { l, i, asda = infos[i] }).Where(pp => ) //bool isTargetAudience = Marketing.IsTargetAudience(company, segmentId); //var audienceColor = Visuals.GetColorFromString(isTargetAudience ? Colors.COLOR_GOLD : Colors.COLOR_WHITE); //if (isTargetAudience) // PanelImage.color = audienceColor; HideChanges(); }
public void ChooseSegment() { BorderImage.color = Visuals.GetColorFromString(Colors.COLOR_CONTROL); Title.color = Visuals.GetColorFromString(Colors.COLOR_CONTROL); }
public void SetController(GameObject gameObject, InputController inputController, Visuals visualsSettings, Layer layerObject, ControllerEventHandling eventHandling) { input = inputController; visuals = visualsSettings; sliceLayer = layerObject; eventHandler = eventHandling; visuals.SetGameObject(gameObject); }