Пример #1
0
		/// <summary>
		/// Reads a SoundFont Version structure
		/// </summary>
		public override object Read(BinaryReader br)
		{
			var v = new SFVersion();
			v.Major = br.ReadInt16();
			v.Minor = br.ReadInt16();
			data.Add(v);
			return v;
		}
Пример #2
0
        /// <summary>
        /// Reads a SoundFont Version structure
        /// </summary>
        public override object Read(BinaryReader br)
        {
            var v = new SFVersion();

            v.Major = br.ReadInt16();
            v.Minor = br.ReadInt16();
            data.Add(v);
            return(v);
        }
Пример #3
0
		internal InfoChunk(RiffChunk chunk)
		{
			bool ifilPresent = false;
			bool isngPresent = false;
			bool INAMPresent = false;
			if (chunk.ReadChunkID() != "INFO")
			{
				throw new ApplicationException("Not an INFO chunk");
			}
			//this.chunk = chunk;
			RiffChunk c;
			while ((c = chunk.GetNextSubChunk()) != null)
			{
				switch (c.ChunkID)
				{
					case "ifil":
						ifilPresent = true;
						verSoundFont = (SFVersion) c.GetDataAsStructure(new SFVersionBuilder());
						break;
					case "isng":
						isngPresent = true;
						WaveTableSoundEngine = c.GetDataAsString();
						break;
					case "INAM":
						INAMPresent = true;
						BankName = c.GetDataAsString();
						break;
					case "irom":
						DataROM = c.GetDataAsString();
						break;
					case "iver":
						ROMVersion = (SFVersion) c.GetDataAsStructure(new SFVersionBuilder());
						break;
					case "ICRD":
						CreationDate = c.GetDataAsString();
						break;
					case "IENG":
						Author = c.GetDataAsString();
						break;
					case "IPRD":
						TargetProduct = c.GetDataAsString();
						break;
					case "ICOP":
						Copyright = c.GetDataAsString();
						break;
					case "ICMT":
						Comments = c.GetDataAsString();
						break;
					case "ISFT":
						Tools = c.GetDataAsString();
						break;
					default:
						throw new ApplicationException(String.Format("Unknown chunk type {0}", c.ChunkID));
				}
			}
			if (!ifilPresent)
			{
				throw new ApplicationException("Missing SoundFont version information");
			}
			if (!isngPresent)
			{
				throw new ApplicationException("Missing wavetable sound engine information");
			}
			if (!INAMPresent)
			{
				throw new ApplicationException("Missing SoundFont name information");
			}
		}
Пример #4
0
        internal InfoChunk(RiffChunk chunk)
        {
            bool ifilPresent = false;
            bool isngPresent = false;
            bool INAMPresent = false;

            if (chunk.ReadChunkID() != "INFO")
            {
                throw new ApplicationException("Not an INFO chunk");
            }
            //this.chunk = chunk;
            RiffChunk c;

            while ((c = chunk.GetNextSubChunk()) != null)
            {
                switch (c.ChunkID)
                {
                case "ifil":
                    ifilPresent  = true;
                    verSoundFont = (SFVersion)c.GetDataAsStructure(new SFVersionBuilder());
                    break;

                case "isng":
                    isngPresent          = true;
                    WaveTableSoundEngine = c.GetDataAsString();
                    break;

                case "INAM":
                    INAMPresent = true;
                    BankName    = c.GetDataAsString();
                    break;

                case "irom":
                    DataROM = c.GetDataAsString();
                    break;

                case "iver":
                    ROMVersion = (SFVersion)c.GetDataAsStructure(new SFVersionBuilder());
                    break;

                case "ICRD":
                    CreationDate = c.GetDataAsString();
                    break;

                case "IENG":
                    Author = c.GetDataAsString();
                    break;

                case "IPRD":
                    TargetProduct = c.GetDataAsString();
                    break;

                case "ICOP":
                    Copyright = c.GetDataAsString();
                    break;

                case "ICMT":
                    Comments = c.GetDataAsString();
                    break;

                case "ISFT":
                    Tools = c.GetDataAsString();
                    break;

                default:
                    throw new ApplicationException(String.Format("Unknown chunk type {0}", c.ChunkID));
                }
            }
            if (!ifilPresent)
            {
                throw new ApplicationException("Missing SoundFont version information");
            }
            if (!isngPresent)
            {
                throw new ApplicationException("Missing wavetable sound engine information");
            }
            if (!INAMPresent)
            {
                throw new ApplicationException("Missing SoundFont name information");
            }
        }