/// <summary> /// Creates an object to access the BNK file /// </summary> /// <param name="soundBankName">The name of the soundbank</param> /// <param name="folderWrapper">The file/archive wrapper that can access /// the sound bank information</param> /// <param name="stream">Stream with the sound bank file</param> /// <param name="events">An optional list of the events provided by this soundbank</param> /// <param name="files">An optional list of the sound files provided by this soundbank</param> /// <remarks> /// Call Open() to begin reading the file /// </remarks> internal BNKReader(string soundBankName, IFolderWrapper folderWrapper, Stream stream, IReadOnlyList <EventInfo> events, IReadOnlyList <FileInfo> files) { this.soundBankName = soundBankName; this.folderWrapper = folderWrapper; // Create something to read the segment srcStream = stream; binaryReader = new BinaryReader(srcStream, Encoding.UTF8, true); // Add in info about the events if (null != events) { foreach (var evt in events) { objectId2Info[evt.Name.ToString().ToUpper()] = evt; } } // Add in info about the events if (null != files) { foreach (var file in files) { objectId2Info[file.ID] = file; } } }
/// <summary> /// Opens up the assets area and reads the meta data /// </summary> /// <param name="folderWrapper">The file/archive wrapper that can access /// the sound bank information</param> void Open(IFolderWrapper folderWrapper) { // Kep the base path to the sound bank the files this.folderWrapper = folderWrapper; // Load the soundbank bundle info. This is is in Vector-style resources SoundbankBundleInfo(); // This indicates we are working with a Cozmo-style audio assets file PluginInfo(); SoundBanksInfo(); }
/// <summary> /// Creates an object that can access the audio system resources /// </summary> /// <param name="folderWrapper">The file/archive wrapper that can access /// the sound bank information</param> public AudioAssets(IFolderWrapper folderWrapper) { Open(folderWrapper); }