Exemple #1
0
			public Marker AddMarker(UInt32 SamplePos, String Label)
			{
				Marker mk = AddMarker(SamplePos);
				CkList listChunk = (CkList)GetChunk<CkList>() ?? (CkList)AddChunk(CkType.LIST);
				var lb = new LiCkInfoLabl(mk.CuePoint, Label);
				listChunk.Chunks.Add(lb);
				return mk;
			}
Exemple #2
0
            public Marker AddMarker(UInt32 SamplePos, String Label)
            {
                Marker mk        = AddMarker(SamplePos);
                CkList listChunk = (CkList)GetChunk <CkList>() ?? (CkList)AddChunk(CkType.LIST);
                var    lb        = new LiCkInfoLabl(mk.CuePoint, Label);

                listChunk.Chunks.Add(lb);
                return(mk);
            }
Exemple #3
0
            public Region AddRegion(UInt32 Start, UInt32 Length, string Label)
            {
                Region newRegion = AddRegion(Start, Length);
                // label
                var listChunk = GetChunk <CkList>() as CkList;
                var newLabl   = new LiCkInfoLabl(newRegion.CuePoint, Label);

                if (listChunk != null)
                {
                    listChunk.Chunks.Add(newLabl);
                }
                return(newRegion);
            }
Exemple #4
0
			public static void AddMarkers(String WaveFile, Dictionary<double, string> Markers)
			{
				var file = new RiffFile(WaveFile, false);

				var reader = new WaveFileReader(WaveFile);
				WaveFormat fmt = reader.WaveFormat;

				string temp1name = Path.GetDirectoryName(WaveFile) + Path.GetFileNameWithoutExtension(WaveFile) + "-temp" +
								   Path.GetExtension(WaveFile);

				// find old cue chunk, or add new
				var cueChunk = file.GetChunk<CkCue>() as CkCue;
				if (cueChunk == null)
				{
					cueChunk = file.AddChunk(CkType.cue) as CkCue;
				}
				else
					cueChunk.CuePoints.Clear();

				var listChunk = file.GetChunk<CkList>() as CkList;
				if (listChunk == null || listChunk.TypeID != LiCkType.adtl)
				{
					listChunk = file.AddChunk(CkType.LIST) as CkList;
					if (listChunk != null) listChunk.TypeID = LiCkType.adtl;
				}

				if (listChunk != null) listChunk.Chunks.Clear();

				uint cueCounter = 0;

				foreach (var pair in Markers)
				{
					var samplePos = (uint)(pair.Key * fmt.SampleRate);
					var cp = new CuePoint(samplePos) { ID = ++cueCounter };
					if (cueChunk != null) cueChunk.CuePoints.Add(cp);
					var labl = new LiCkInfoLabl(cp, pair.Value);
					if (listChunk != null) listChunk.Chunks.Add(labl);
				}
				reader.Close();
				reader.Dispose();
				file.Save(temp1name);
				file.Close();

				File.Replace(temp1name, WaveFile, null);
			}
Exemple #5
0
			public Region AddRegion(UInt32 Start, UInt32 Length, string Label)
			{
				Region newRegion = AddRegion(Start, Length);
				// label
				var listChunk = GetChunk<CkList>() as CkList;
				var newLabl = new LiCkInfoLabl(newRegion.CuePoint, Label);
				if (listChunk != null) listChunk.Chunks.Add(newLabl);
				return newRegion;
			}
Exemple #6
0
            public static void AddMarkers(String WaveFile, Dictionary <double, string> Markers)
            {
                var file = new RiffFile(WaveFile, false);

                var        reader = new WaveFileReader(WaveFile);
                WaveFormat fmt    = reader.WaveFormat;

                string temp1name = Path.GetDirectoryName(WaveFile) + Path.GetFileNameWithoutExtension(WaveFile) + "-temp" +
                                   Path.GetExtension(WaveFile);

                // find old cue chunk, or add new
                var cueChunk = file.GetChunk <CkCue>() as CkCue;

                if (cueChunk == null)
                {
                    cueChunk = file.AddChunk(CkType.cue) as CkCue;
                }
                else
                {
                    cueChunk.CuePoints.Clear();
                }

                var listChunk = file.GetChunk <CkList>() as CkList;

                if (listChunk == null || listChunk.TypeID != LiCkType.adtl)
                {
                    listChunk = file.AddChunk(CkType.LIST) as CkList;
                    if (listChunk != null)
                    {
                        listChunk.TypeID = LiCkType.adtl;
                    }
                }

                if (listChunk != null)
                {
                    listChunk.Chunks.Clear();
                }

                uint cueCounter = 0;

                foreach (var pair in Markers)
                {
                    var samplePos = (uint)(pair.Key * fmt.SampleRate);
                    var cp        = new CuePoint(samplePos)
                    {
                        ID = ++cueCounter
                    };
                    if (cueChunk != null)
                    {
                        cueChunk.CuePoints.Add(cp);
                    }
                    var labl = new LiCkInfoLabl(cp, pair.Value);
                    if (listChunk != null)
                    {
                        listChunk.Chunks.Add(labl);
                    }
                }
                reader.Close();
                reader.Dispose();
                file.Save(temp1name);
                file.Close();

                File.Replace(temp1name, WaveFile, null);
            }