public Soundtrack(psai.ProtoBuf_PsaiCoreSoundtrack pbSoundtrack) : this() { for (int i = 0; i < pbSoundtrack.themes.Count; i++) { psai.ProtoBuf_Theme pbTheme = pbSoundtrack.themes[i]; Theme tempTheme = new Theme(pbTheme); m_themes[tempTheme.id] = tempTheme; } for (int i = 0; i < pbSoundtrack.snippets.Count; i++) { psai.ProtoBuf_Snippet pbSnippet = pbSoundtrack.snippets[i]; Segment tempSnippet = new Segment(pbSnippet); m_snippets[tempSnippet.Id] = tempSnippet; Theme tmpTheme = m_themes[tempSnippet.ThemeId]; if (tmpTheme != null) { tmpTheme.m_segments.Add(tempSnippet); } else { #if !(PSAI_NOLOG) { if (LogLevel.errors <= Logger.Instance.LogLevel) { string s = "INTERNAL ERROR! could not find Theme for Theme id " + tempSnippet.ThemeId + " of snippet" + tempSnippet.Id; Logger.Instance.Log(s, LogLevel.errors); } } #endif } } }
public AudioData(psai.ProtoBuf_AudioData pbAudioData) { this.filePathRelativeToProjectDir = pbAudioData.filename; this.sampleRateHz = pbAudioData.sampleRate; this.sampleCountTotal = pbAudioData.sampleCountTotal; this.sampleCountPreBeat = pbAudioData.sampleCountPrebeat; this.sampleCountPostBeat = pbAudioData.sampleCountPostbeat; this.bpm = pbAudioData.bpm; }
public void AddLoggerOutput(psai.net.LoggerOutput loggerOutput) { m_logik.AddLoggerOutput(loggerOutput); }
public PsaiResult LoadSoundtrackByPsaiProject(psai.Editor.PsaiProject project, string fullPathToProjectFile) { return m_logik.LoadSoundtrackByPsaiProject(project, fullPathToProjectFile); }
internal void AddLoggerOutput(psai.net.LoggerOutput loggerOutput) { if (!Logger.Instance.LoggerOutputs.Contains(loggerOutput)) { Logger.Instance.LoggerOutputs.Add(loggerOutput); } }
public PsaiResult LoadSoundtrackByPsaiProject(psai.Editor.PsaiProject psaiProject, string fullProjectPath) { m_soundtrack = psaiProject.BuildPsaiDotNetSoundtrackFromProject(); m_psaiCoreBinaryFilepath = fullProjectPath; m_psaiCoreBinaryDirectoryName = Path.GetDirectoryName(fullProjectPath); InitMembersAfterSoundtrackHasLoaded(); #if !(PSAI_NOLOG) { if (LogLevel.info <= Logger.Instance.LogLevel) { Logger.Instance.Log("Soundtrack deserialization succeeded", LogLevel.info); } } #endif return PsaiResult.OK; }
/*internal psai.ProtoBuf_Theme CreateProtoBufTheme() { psai.ProtoBuf_Theme pbTheme = new psai.ProtoBuf_Theme(); pbTheme.id = id; pbTheme.name = Name; pbTheme.themeType = (int)(this.themeType); pbTheme.intensityAfterRest = this.intensityAfterRest; pbTheme.musicPhaseSecondsGeneral = this.musicDurationGeneral; pbTheme.musicPhaseSecondsAfterRest = this.musicDurationAfterRest; pbTheme.restSecondsMin = this.restSecondsMin; pbTheme.restSecondsMax = this.restSecondsMax; return pbTheme; }*/ #endregion Other #if (PSAI_BUILT_BY_VS || PSAI_STANDALONE || PSAI_EDITOR_STANDALONE) internal Theme(psai.ProtoBuf_Theme pbTheme) : this() { this.id = pbTheme.id; this.intensityAfterRest = pbTheme.intensityAfterRest; this.musicDurationAfterRest = pbTheme.musicPhaseSecondsAfterRest; this.musicDurationGeneral = pbTheme.musicPhaseSecondsGeneral; this.Name = pbTheme.name; this.priority = pbTheme.priority; this.restSecondsMin = pbTheme.restSecondsMin; this.restSecondsMax = pbTheme.restSecondsMax; this.themeType = (ThemeType)(pbTheme.themeType); this.weightings.intensityVsVariety = pbTheme.weightingIntensityVsVariety; this.weightings.lowPlaycountVsRandom = pbTheme.weightingPlaycountVsRandom; this.weightings.switchGroups = pbTheme.weightingSwitchGroups; }
public Segment(psai.ProtoBuf_Snippet pbSnippet) : this() { this.Id = pbSnippet.id; this.ThemeId = pbSnippet.theme_id; this.Intensity = pbSnippet.intensity; this.SnippetTypeBitfield = pbSnippet.snippet_type; this.Name = pbSnippet.name; this.audioData = new AudioData(pbSnippet.audio_data); for (int i=0; i<pbSnippet.follower_id.Count; i++) { Follower follower = new Follower(pbSnippet.follower_id[i], pbSnippet.follower_compatibility[i]); this.Followers.Add(follower); } }