Class FileSegment
Represents a segment of a target file. It can also store the parent file that a new segment has been derived from. A segment is just a stored start and end for a target file - it represents a future, or a request. Other functions can take the segment request, cut out the selected range, and return a new file segment. New file segments, or segments that represent a whole file, will not have the segment properties set because they do not represent a request anymore.
Inherited Members
Namespace: AnalysisBase
Assembly: AnalysisBase.dll
Syntax
public class FileSegment : ICloneable, ISegment<FileInfo>, IEquatable<ISegment<FileInfo>>
Constructors
| Improve this Doc View SourceFileSegment(FileInfo, TimeAlignment)
Initializes a new instance of the FileFileDateBehavior.Required
.
NOTE: Start offset will be set to start of file, and end offset set to the end of the file.
Declaration
public FileSegment(FileInfo source, TimeAlignment alignment)
Parameters
Type | Name | Description |
---|---|---|
File |
source | |
Time |
alignment |
FileSegment(FileInfo, TimeAlignment, IAudioUtility, FileSegment.FileDateBehavior)
Initializes a new instance of the FileFileDateBehavior.Required
.
NOTE: Start offset will be set to start of file, and end offset set to the end of the file.
Declaration
public FileSegment(FileInfo source, TimeAlignment alignment, IAudioUtility utility = null, FileSegment.FileDateBehavior dateBehavior = FileSegment.FileDateBehavior.Try)
Parameters
Type | Name | Description |
---|---|---|
File |
source | |
Time |
alignment | |
IAudio |
utility | |
File |
dateBehavior |
FileSegment(FileInfo, DateTimeOffset, IAudioUtility)
Declaration
public FileSegment(FileInfo source, DateTimeOffset startDate, IAudioUtility utility = null)
Parameters
Type | Name | Description |
---|---|---|
File |
source | |
Date |
startDate | |
IAudio |
utility |
FileSegment(FileInfo, Int32, TimeSpan, FileSegment.FileDateBehavior)
Initializes a new instance of the File
Declaration
public FileSegment(FileInfo source, int sampleRate, TimeSpan duration, FileSegment.FileDateBehavior dateBehavior)
Parameters
Type | Name | Description |
---|---|---|
File |
source | |
Int32 | sampleRate | |
Time |
duration | |
File |
dateBehavior |
FileSegment(FileInfo, Int32, TimeSpan, Nullable<DateTimeOffset>)
Initializes a new instance of the File
Declaration
public FileSegment(FileInfo source, int sampleRate, TimeSpan duration, DateTimeOffset? suppliedDate = default(DateTimeOffset? ))
Parameters
Type | Name | Description |
---|---|---|
File |
source | |
Int32 | sampleRate | |
Time |
duration | |
Nullable<Date |
suppliedDate |
Properties
| Improve this Doc View SourceAlignment
Gets the style of alignment padding to use - indicates that bad start dates should be shifted to the nearest minute.
Declaration
public TimeAlignment Alignment { get; }
Property Value
Type | Description |
---|---|
Time |
EndOffsetSeconds
Declaration
public double EndOffsetSeconds { get; }
Property Value
Type | Description |
---|---|
Double |
IsSegmentSet
Gets a value indicating whether gets ISegmentSet - whether or not either of the segment properties have been set.
Declaration
public bool IsSegmentSet { get; }
Property Value
Type | Description |
---|---|
Boolean |
SegmentEndOffset
Gets or sets SegmentEndOffset - the value that represents what ending point of the target file should be used.
Declaration
public TimeSpan? SegmentEndOffset { get; set; }
Property Value
Remarks
These properties are the source for End
SegmentStartOffset
Gets or sets SegmentStartOffset - the value that represents what starting point of the target file should be used.
Declaration
public TimeSpan? SegmentStartOffset { get; set; }
Property Value
Remarks
These properties are the source for Start
Source
Gets the target file for this file segment.
Declaration
public FileInfo Source { get; }
Property Value
Type | Description |
---|---|
File |
SourceMetadata
Declaration
public SourceMetadata SourceMetadata { get; }
Property Value
Type | Description |
---|---|
Source |
StartOffsetSeconds
Declaration
public double StartOffsetSeconds { get; }
Property Value
Type | Description |
---|---|
Double |
TargetFileDuration
Gets the entire audio file duration FOR THE TARGET FILE.
Declaration
public TimeSpan? TargetFileDuration { get; }
Property Value
| Improve this Doc View SourceTargetFileSampleRate
Gets the TARGET FILE'S audio file Sample rate. May be required when doing analysis.
Declaration
public int? TargetFileSampleRate { get; }
Property Value
| Improve this Doc View SourceTargetFileStartDate
Gets the TargetFileStartDate.
Declaration
public DateTimeOffset? TargetFileStartDate { get; }
Property Value
Type | Description |
---|---|
Nullable<Date |
Methods
| Improve this Doc View SourceClone()
Declaration
public object Clone()
Returns
Type | Description |
---|---|
Object |
Remarks
Constructs a new instance of this
Equals(ISegment<FileInfo>)
Determines if two FileSegments represent the same part of a source file.
It compares Source, Start
Declaration
public bool Equals(ISegment<FileInfo> other)
Parameters
Returns
Type | Description |
---|---|
Boolean | True if the segments are considered equal. |
SplitSegment(Double, Double)
Declaration
public ISegment<FileInfo> SplitSegment(double newStart, double newEnd)
Parameters
Returns
| Improve this Doc View SourceToString()
Returns a friendly string representation of this object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
| Improve this Doc View SourceValidate()
Validate the File
Declaration
public bool Validate()
Returns
Type | Description |
---|---|
Boolean | True if properties are valid, otherwise false. |