Click here to Skip to main content
15,892,746 members
Articles / Programming Languages / C#

nBASS: A sound libary for .NET

Rate me:
Please Sign up or sign in to vote.
4.74/5 (30 votes)
10 Nov 2002BSD5 min read 480.8K   7.1K   134  
nBASS provides .NET users with sound functionality
using System;
using System.Text;

namespace nBASS
{
	/// <summary>
	/// Summary description for ID3v1Tag.
	/// </summary>
	public class ID3v1Tag //really 1.1 :)
	{
		string TAG; //last 3 bytes
		string songtitle; // 30 characters 
		string artist; // 30 characters 
		string album; //30 characters 
		string year; //4 characters 
		string comment; //28 characters
		byte track; // 1 byte, 0 byte b4 that
		byte genre;// 1 byte

		public ID3v1Tag(byte[] block)
		{
			if (block.Length != 128) throw new Exception("Black must be 128 bytes in size");
			TAG = Encoding.Default.GetString(block, 0, 3);
			songtitle = Encoding.Default.GetString(block, 3, 30);
			artist = Encoding.Default.GetString(block, 33, 30);
			album = Encoding.Default.GetString(block, 63, 30);
			year = Encoding.Default.GetString(block, 93, 4);
			comment = Encoding.Default.GetString(block, 97, 28);
			track = block[126];
			genre = block[127];
		}

		public string SongTitle {get {return songtitle;}}
		public string Artist {get {return artist;}}
		public string Album {get {return album;}}
		public string Year {get {return year;}}
		public string Comment {get {return comment;}}
		public int Track {get {return track;}}
		public string Genre {get {return ((GenreType)genre).ToString();}}

		private enum GenreType :byte
		{
			Blues = 0,
			ClassicRock,
			Country,
			Dance,
			Disco,
			Funk,
			Grunge,
			HipHop,
			Jazz,
			Metal,
			NewAge,
			Oldies,
			Other,
			Pop,
			RnB,
			Rap,
			Reggae,
			Rock,
			Techno,
			Industrial,
			Alternative,
			Ska,
			DeathMetal,
			Pranks,
			Soundtrack,
			EuroTechno,
			Ambient,
			TripHop,
			Vocal,
			JazzFunk,
			Fusion,
			Trance,
			Classical,
			Instrumental,
			Acid,
			House,
			Game,
			SoundClip,
			Gospel,
			Noise,
			AlternRock,
			Bass,
			Soul,
			Punk,
			Space,
			Meditative,
			InstrumentalPop,
			InstrumentalRock,
			Ethnic,
			Gothic,
			Darkwave,
			TechnoIndustrial,
			Electronic,
			PopFolk,
			Eurodance,
			Dream,
			SouthernRock,
			Cult,
			Gangsta,
			Top40,
			ChristianRap,
			PopFunk,
			Jungle,
			NativeAmerican,
			Cabaret,
			NewWave,
			Psychadelic,
			Rave,
			Showtunes,
			Trailer,
			LoFi,
			Tribal,
			AcidPunk,
			AcidJazz,
			Polka,
			Retro,
			Musical,
			RocknRoll,
			HardRock,
			None = 255,
		}

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
Software Developer
South Africa South Africa
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions