Ejemplo n.º 1
0
    /// <summary>
    /// Get the DB attenuation of the channel.
    /// </summary>
    /// <param name="channeltype">Channeltype.</param>
    public float GetChannelLevel(ChannelType channeltype)
    {
        ChannelInfo chInfo = null;
        channelInfos.TryGetValue(channeltype.ToString(), out chInfo);

        if(chInfo != null)
        {
            // !!! check with Andrea whether to return defaultDBLevel OR settedDBLevel
            return (chInfo.settedDBLevel);
        }
        else
        {
            Debug.LogError("Channelinfo not found");
            return 0.0f;
        }
    }
Ejemplo n.º 2
0
        public static string BuildRecordingBaseFilePath(string format, string channelDisplayName, ChannelType channelType, string scheduleName,
            string title, string programTitle, string subTitle, string episodeNumberDisplay, int? episodeNumber, int? seriesNumber, DateTime startTime, string category)
        {
            LimitLength(ref title, 80);
            LimitLength(ref programTitle, 80);
            LimitLength(ref scheduleName, 80);
            LimitLength(ref subTitle, 80);

            format = MakeValidPath(format).Replace(":", String.Empty).TrimStart('\\').TrimStart('/').TrimEnd('\\').TrimEnd('/');
            StringBuilder result = new StringBuilder(format);
            ReplaceFormatVariable(result, "%%CHANNEL%%", channelDisplayName);
            ReplaceFormatVariable(result, "%%CHANNELTYPE%%", channelType.ToString());
            ReplaceFormatVariable(result, "%%TVCHANNEL%%", channelDisplayName); // For backwards compatibility.
            ReplaceFormatVariable(result, "%%SCHEDULE%%", scheduleName);
            ReplaceFormatVariable(result, "%%TITLE%%", title);
            ReplaceFormatVariable(result, "%%LONGTITLE%%", programTitle);
            ReplaceFormatVariable(result, "%%EPISODETITLE%%", String.IsNullOrEmpty(subTitle) ? "#" : subTitle);
            ReplaceFormatVariable(result, "%%EPISODENUMBERDISPLAY%%", String.IsNullOrEmpty(episodeNumberDisplay) ? "#" : episodeNumberDisplay);
            ReplaceFormatVariable(result, "%%EPISODENUMBER%%", episodeNumber.HasValue ? episodeNumber.ToString() : "#");
            ReplaceFormatVariable(result, "%%EPISODENUMBER2%%", episodeNumber.HasValue ? episodeNumber.Value.ToString("00") : "00");
            ReplaceFormatVariable(result, "%%EPISODENUMBER3%%", episodeNumber.HasValue ? episodeNumber.Value.ToString("000") : "000");
            ReplaceFormatVariable(result, "%%SERIES%%", seriesNumber.HasValue ? seriesNumber.ToString() : "#");
            ReplaceFormatVariable(result, "%%SERIES2%%", seriesNumber.HasValue ? seriesNumber.Value.ToString("00") : "00");
            ReplaceFormatVariable(result, "%%DATE%%", startTime.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
            ReplaceFormatVariable(result, "%%YEAR%%", startTime.ToString("yyyy", CultureInfo.InvariantCulture));
            ReplaceFormatVariable(result, "%%MONTH%%", startTime.ToString("MM", CultureInfo.InvariantCulture));
            ReplaceFormatVariable(result, "%%DAY%%", startTime.ToString("dd", CultureInfo.InvariantCulture));
            ReplaceFormatVariable(result, "%%DAYOFWEEK%%", startTime.ToString("ddd", CultureInfo.CurrentCulture));
            ReplaceFormatVariable(result, "%%HOURS%%", startTime.ToString("HH", CultureInfo.InvariantCulture));
            ReplaceFormatVariable(result, "%%HOURS12%%", startTime.ToString("hhtt", CultureInfo.InvariantCulture));
            ReplaceFormatVariable(result, "%%MINUTES%%", startTime.ToString("mm", CultureInfo.InvariantCulture));
            ReplaceFormatVariable(result, "%%CATEGORY%%", String.IsNullOrEmpty(category) ? "#" : category);
            return result.ToString().Replace(".\\", "\\").Replace("./", "/");
        }
Ejemplo n.º 3
0
    /// <summary>
    /// Play the specified audioClip on specified channel type. This function is meant to be used for single sound occurences.
    /// Use default level will set the attenuation to its default level.
    /// </summary>
    /// <param name="audioClip">Audio clip.</param>
    /// <param name="clipName">Clip name.</param>
    /// <param name="channeltype">Channeltype.</param>
    public void Play(AudioClip audioClip, ChannelType channeltype, AudioClipInfo clipInfo)
    {
        GameObject go = new GameObject("GameSound");
        go.tag = channeltype.ToString();
        go.transform.SetParent(gameObject.transform, false);
        AudioSource source = go.AddComponent<AudioSource>();
        source.playOnAwake = false;

        source.clip = audioClip;

        float lvl = 0.0f;
        ChannelInfo chInfo = null;
        channelInfos.TryGetValue(channeltype.ToString(), out chInfo);

        if(chInfo != null)
        {
            lvl = clipInfo.useDefaultDBLevel ? chInfo.defaultDBLevel : chInfo.settedDBLevel;
        }
        else
        {
            Debug.LogError("Channel info not found");
        }

        audioMixer.SetFloat(channeltype.ToString(),lvl);
        source.outputAudioMixerGroup = chInfo.audioMixerGroup;

        source.loop = clipInfo.isLoop;

        source.PlayDelayed(clipInfo.delayAtStart);
        playingList.Add(go);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Stop all the clips being played in a particular channel.
    /// </summary>
    /// <param name="channel">Channel.</param>
    public void Stop(ChannelType channel)
    {
        GameObject[] soundsInChannel = GameObject.FindGameObjectsWithTag(channel.ToString());

        for (int i = 0; i < soundsInChannel.Length; i++) {
            if(soundsInChannel[i].GetComponent<AudioSource>().isPlaying)
            {
                soundsInChannel[i].GetComponent<AudioSource>().Stop();
            }
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Sets the DB attenuation of the channel.
    /// </summary>
    /// <param name="channeltype">Channeltype.</param>
    /// <param name="value">Value.</param>
    public void SetChannelLevel(ChannelType channeltype, float value)
    {
        ChannelInfo chInfo = null;
        channelInfos.TryGetValue(channeltype.ToString(), out chInfo);

        if(chInfo != null)
        {
            chInfo.settedDBLevel = value;
        }
        else
        {
            Debug.LogError("Channelinfo not found");
        }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Play the specified clip inside specified folder on given channel type. This is meant to be used for sounds played often as the clips created are saved into a dictionary.
    /// Clip name must be unique. Use default level will set the attenuation to its default level.
    /// </summary>
    /// <param name="folderPath">Folder path.</param>
    /// <param name="clipname">Clipname.</param>
    /// <param name="channeltype">Channeltype.</param>
    public void Play(string folderPath, string clipname, ChannelType channeltype, AudioClipInfo clipInfo)
    {
        AudioClip clip = null;
        GameObject go = new GameObject("GameSound");
        go.transform.SetParent(gameObject.transform, false);
        AudioSource source = go.AddComponent<AudioSource>();
        source.playOnAwake = false;

        if(playedSounds.ContainsKey(clipname))
        {
            playedSounds.TryGetValue(clipname, out clip);
        }
        else
        {
            clip = Resources.Load(folderPath + "/" + clipname) as AudioClip;
            playedSounds.Add(clipname,clip);
        }

        float lvl = 0.0f;
        ChannelInfo chInfo = null;
        channelInfos.TryGetValue(channeltype.ToString(), out chInfo);

        if(chInfo != null)
        {
            lvl = clipInfo.useDefaultDBLevel ? chInfo.defaultDBLevel : chInfo.settedDBLevel;
        }
        else
        {
            Debug.LogError("Channelinfo not found");
        }

        audioMixer.SetFloat(channeltype.ToString(),lvl);
        source.outputAudioMixerGroup = chInfo.audioMixerGroup;

        source.loop = clipInfo.isLoop;

        source.PlayDelayed(clipInfo.delayAtStart);
        playingList.Add(go);
    }
Ejemplo n.º 7
0
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (FriendlyName != null)
            {
                p.Add(new KeyValuePair <string, string>("FriendlyName", FriendlyName));
            }

            if (ChatServiceSid != null)
            {
                p.Add(new KeyValuePair <string, string>("ChatServiceSid", ChatServiceSid.ToString()));
            }

            if (ChannelType != null)
            {
                p.Add(new KeyValuePair <string, string>("ChannelType", ChannelType.ToString()));
            }

            if (ContactIdentity != null)
            {
                p.Add(new KeyValuePair <string, string>("ContactIdentity", ContactIdentity));
            }

            if (Enabled != null)
            {
                p.Add(new KeyValuePair <string, string>("Enabled", Enabled.Value.ToString().ToLower()));
            }

            if (IntegrationType != null)
            {
                p.Add(new KeyValuePair <string, string>("IntegrationType", IntegrationType.ToString()));
            }

            if (IntegrationFlowSid != null)
            {
                p.Add(new KeyValuePair <string, string>("Integration.FlowSid", IntegrationFlowSid.ToString()));
            }

            if (IntegrationUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("Integration.Url", Serializers.Url(IntegrationUrl)));
            }

            if (IntegrationWorkspaceSid != null)
            {
                p.Add(new KeyValuePair <string, string>("Integration.WorkspaceSid", IntegrationWorkspaceSid.ToString()));
            }

            if (IntegrationWorkflowSid != null)
            {
                p.Add(new KeyValuePair <string, string>("Integration.WorkflowSid", IntegrationWorkflowSid.ToString()));
            }

            if (IntegrationChannel != null)
            {
                p.Add(new KeyValuePair <string, string>("Integration.Channel", IntegrationChannel));
            }

            if (IntegrationTimeout != null)
            {
                p.Add(new KeyValuePair <string, string>("Integration.Timeout", IntegrationTimeout.ToString()));
            }

            if (IntegrationPriority != null)
            {
                p.Add(new KeyValuePair <string, string>("Integration.Priority", IntegrationPriority.ToString()));
            }

            if (IntegrationCreationOnMessage != null)
            {
                p.Add(new KeyValuePair <string, string>("Integration.CreationOnMessage", IntegrationCreationOnMessage.Value.ToString().ToLower()));
            }

            if (LongLived != null)
            {
                p.Add(new KeyValuePair <string, string>("LongLived", LongLived.Value.ToString().ToLower()));
            }

            return(p);
        }
Ejemplo n.º 8
0
 public static void SaveCurSelectedChannel(ChannelType channelType)
 {
     EditorPrefs.SetString("ChannelName", channelType.ToString());
 }
Ejemplo n.º 9
0
        public override Channel GetChannel(ChannelType type)
        {
            int channelCode           = (int)type % 10;
            int desiredColorModelCode = (int)type / 10;
            int currentColorModelCode = (int)GetColorModel();

            if (desiredColorModelCode == currentColorModelCode)
            {
                switch (GetColorModel())
                {
                case ColorModel.RGB:
                    switch (channelCode)
                    {
                    case 0: return(((ImageRGB <T>) this).R);

                    case 1: return(((ImageRGB <T>) this).G);

                    case 2: return(((ImageRGB <T>) this).B);

                    default: throw new InvalidOperationException();
                    }

                case ColorModel.HSV:
                    switch (channelCode)
                    {
                    case 0: return(((ImageHSV <T>) this).H);

                    case 1: return(((ImageHSV <T>) this).S);

                    case 2: return(((ImageHSV <T>) this).V);

                    default: throw new InvalidOperationException();
                    }

                case ColorModel.CMYK:
                    switch (channelCode)
                    {
                    case 0: return(((ImageCMYK <T>) this).C);

                    case 1: return(((ImageCMYK <T>) this).M);

                    case 2: return(((ImageCMYK <T>) this).Y);

                    case 3: return(((ImageCMYK <T>) this).K);

                    default: throw new InvalidOperationException();
                    }

                case ColorModel.GRAY:
                    if (channelCode == 0)
                    {
                        return(((ImageGray <T>) this).Gray);
                    }
                    else
                    {
                        throw new InvalidOperationException();
                    }
                }
                throw new InvalidOperationException();
            }
            else
            {
                string channelName           = type.ToString("g");
                string currentColorModelName = GetColorModel().ToString("g");
                string desiredColorModelName = ((ColorModel)desiredColorModelCode).ToString("g");
                throw new InvalidOperationException(
                          $"Cannot get desired channel \"{channelName}\" because color model of the image is {currentColorModelName}.\n" +
                          $"Convert the image to {desiredColorModelName} first, using: To{desiredColorModelName}()."
                          );
            }
        }
Ejemplo n.º 10
0
    public static string ReadVersionFile(BuildTarget target, ChannelType channel)
    {
        string rootPath = PackageUtils.GetBuildPlatformOutputPath(target, channel.ToString());

        return(GameUtility.SafeReadAllText(Path.Combine(rootPath, BuildUtils.ResVersionFileName)));
    }
Ejemplo n.º 11
0
        public async Task <List <ConnectorCredentialAssignment> > ListCredentialAssignmentsByAccountAsync(string engagementAccount, ChannelType channelType, bool activeOnly)
        {
            using (var ctx = new SmsServiceDbEntities(this.connectionString))
            {
                var entities = await ctx.ConnectorCredentialAssignments.Where(
                    c => c.EngagementAccount == engagementAccount &&
                    (channelType == ChannelType.Both || c.ChannelType == ChannelType.Both.ToString() || c.ChannelType == channelType.ToString()) &&
                    (!activeOnly || c.Active)).ToListAsync();

                return(entities?.Select(e => e.ToModel()).ToList());
            }
        }