/// <summary> /// /// </summary> /// <param name="path"></param> /// <returns>The module extension at path if found, null on failure</returns> public static OpenMpt.ModuleExt LoadModuleExt(string path) { try { var moduleExt = new OpenMpt.ModuleExt(path); // set render parameters // Volume ramping to avoid clicking. moduleExt.GetModule().SetRenderParam( OpenMpt.Module.RenderParam.eRenderVolumeRampingStrength, MusicConfig.c_renderVolumeRampingStrength ); return(moduleExt); } catch (System.ArgumentException) { return(null); } }
public static InstrumentInfo ParseInstrumentInfo(OpenMpt.ModuleExt moduleExt) { string name = OpenMptUtility.GetModuleExtTitle(moduleExt); string message = OpenMptUtility.GetModuleExtMessage(moduleExt); fsData data = fsJsonParser.Parse(message); object deserialised = null; fsResult result = s_serialiser.TryDeserialize(data, typeof(SerialisedInstrumentInfo), ref deserialised); if (!result.Failed) { var serialisedInstrumentInfo = (SerialisedInstrumentInfo)deserialised; return(new InstrumentInfo( name, ParseAllInstruments(serialisedInstrumentInfo), serialisedInstrumentInfo.Comment )); } return(null); }
public static MusicInfo ParseMusicInfo(OpenMpt.ModuleExt moduleExt) { string message = OpenMptUtility.GetModuleExtMessage(moduleExt); string author = OpenMptUtility.GetModuleExtAuthor(moduleExt); string title = OpenMptUtility.GetModuleExtTitle(moduleExt); fsData data = fsJsonParser.Parse(message); object deserialised = null; fsResult result = s_serialiser.TryDeserialize(data, typeof(SerialisedMusicInfo), ref deserialised); if (!result.Failed) { var serialisedMusicInfo = (SerialisedMusicInfo)deserialised; return(new MusicInfo( ParseAllMusicSections(serialisedMusicInfo), title, author, serialisedMusicInfo.Comment )); } return(null); }
public static string GetModuleExtTitle(OpenMpt.ModuleExt moduleExt) { return(moduleExt.GetModule().GetMetadata(OpenMpt.Module.c_keyTitle)); }
public static string GetModuleExtAuthor(OpenMpt.ModuleExt moduleExt) { return(moduleExt.GetModule().GetMetadata(OpenMpt.Module.c_keyAuthor)); }