Class AbstractUtility
Base abstract class for all audio and spectrogram utilities.
Inherited Members
Namespace: Acoustics.Tools.Audio
Assembly: Acoustics.Tools.dll
Syntax
public abstract class AbstractUtility
Constructors
| Improve this Doc View SourceAbstractUtility()
Initializes a new instance of the Abstract
Declaration
protected AbstractUtility()
Fields
| Improve this Doc View SourceLog
Provides logging.
Declaration
protected readonly ILog Log
Field Value
Type | Description |
---|---|
log4net. |
MimeTypeExtensionErrorFormatString
Format string for mime type and extension mis-match. Params: Mimetype, extension.
Declaration
protected readonly string MimeTypeExtensionErrorFormatString
Field Value
Type | Description |
---|---|
String |
Properties
| Improve this Doc View SourceProcessRunnerMaxRetries
Gets or sets ProcessRunnerMaxRetries. The maximum number of times a process will attempt a retry after a failure.
Declaration
public int ProcessRunnerMaxRetries { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
ProcessRunnerTimeout
Gets or sets ProcessRunnerTimeout. That is, how long to wait for a running executable to finish.
Declaration
public TimeSpan ProcessRunnerTimeout { get; set; }
Property Value
Type | Description |
---|---|
Time |
Methods
| Improve this Doc View SourceBuildFileDebuggingOutput(FileInfo)
The build file debugging output.
Declaration
protected string BuildFileDebuggingOutput(FileInfo file)
Parameters
Type | Name | Description |
---|---|---|
File |
file | The file. |
Returns
Type | Description |
---|---|
String | The System.String. |
CanProcess(FileInfo, IEnumerable<String>, IEnumerable<String>)
Check if a file can be processed.
Declaration
protected void CanProcess(FileInfo file, IEnumerable<string> validMediaTypes, IEnumerable<string> invalidMediaTypes)
Parameters
Type | Name | Description |
---|---|---|
File |
file | The file to check. |
IEnumerable<String> | validMediaTypes | The valid Mime Types. |
IEnumerable<String> | invalidMediaTypes | The invalid Mime Types. |
Exceptions
Type | Condition |
---|---|
Not |
|
File |
|
CheckExe(FileInfo, String)
The check exe.
Declaration
protected void CheckExe(FileInfo file, string expectedFileName)
Parameters
Exceptions
Type | Condition |
---|---|
Argument |
|
File |
Could not find exe. |
Argument |
file. |
CheckFile(FileInfo)
The check file.
Declaration
protected void CheckFile(FileInfo file)
Parameters
Type | Name | Description |
---|---|---|
File |
file | The file. |
Exceptions
Type | Condition |
---|---|
Argument |
file. |
Argument |
file. |
CheckMimeTypeExtension(FileInfo, String)
Check that mime type and extension match.
Declaration
protected bool CheckMimeTypeExtension(FileInfo file, string mimeType)
Parameters
Returns
Type | Description |
---|---|
Boolean | True if mime type and extension match, otherwise false. |
Exceptions
Type | Condition |
---|---|
Argument |
|
CheckMp3BitRate(Int32)
The check mp 3 bit rate.
Declaration
protected void CheckMp3BitRate(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | The value. |
CheckMp3SampleRate(Int32)
The check mp 3 sample rate.
Declaration
protected void CheckMp3SampleRate(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | The value. |
CheckRequestValidForMediaType(FileInfo, String, AudioUtilityRequest)
The check request valid for output.
Declaration
protected void CheckRequestValidForMediaType(FileInfo output, string outputMediaType, AudioUtilityRequest request)
Parameters
Type | Name | Description |
---|---|---|
File |
output | The output. |
String | outputMediaType | The output media type. |
Audio |
request | The request. |
GetExtension(FileInfo)
Get file extension in uppercase, without dot.
Declaration
protected string GetExtension(FileInfo file)
Parameters
Type | Name | Description |
---|---|---|
File |
file | The file to get extension from. |
Returns
Type | Description |
---|---|
String | Cleaned extension. |
OutputContains(ProcessRunner, String)
The output contains.
Declaration
protected bool OutputContains(ProcessRunner runner, string compareString)
Parameters
Type | Name | Description |
---|---|---|
Process |
runner | The runner. |
String | compareString | The compare string. |
Returns
Type | Description |
---|---|
Boolean | The System.Boolean. |
ParseDoubleStringWithException(String, String, IEnumerable<String>)
Declaration
protected double? ParseDoubleStringWithException(string text, string propertyName, IEnumerable<string> expectedNonNumeric = null)
Parameters
Type | Name | Description |
---|---|---|
String | text | |
String | propertyName | |
IEnumerable<String> | expectedNonNumeric |
Returns
| Improve this Doc View SourceParseIntStringWithException(String, String, IEnumerable<String>)
Declaration
protected int? ParseIntStringWithException(string text, string propertyName, IEnumerable<string> expectedNonNumeric = null)
Parameters
Type | Name | Description |
---|---|---|
String | text | |
String | propertyName | |
IEnumerable<String> | expectedNonNumeric |
Returns
| Improve this Doc View SourceParseLongStringWithException(String, String, IEnumerable<String>)
Declaration
protected long? ParseLongStringWithException(string text, string propertyName, IEnumerable<string> expectedNonNumeric = null)
Parameters
Type | Name | Description |
---|---|---|
String | text | |
String | propertyName | |
IEnumerable<String> | expectedNonNumeric |
Returns
| Improve this Doc View SourceRunExe(ProcessRunner, String, String)
Run an executable. Will wait for up to ProcessTimeout
time,
then kill the process. Will retry up to 3 times if the timeout is reached.
Declaration
protected void RunExe(ProcessRunner processRunner, string arguments, string workingDirectory)
Parameters
Type | Name | Description |
---|---|---|
Process |
processRunner | The process runner. |
String | arguments | The arguments. |
String | workingDirectory | The working Directory. |
ValidateMimeTypeExtension(FileInfo, String)
Validate to ensure that mime type and file extension match.
Declaration
protected void ValidateMimeTypeExtension(FileInfo source, string sourceMimeType)
Parameters
| Improve this Doc View SourceValidateMimeTypeExtension(FileInfo, String, FileInfo, String)
Validate to ensure that mime type and file extension match for source and output.
Declaration
protected void ValidateMimeTypeExtension(FileInfo source, string sourceMimeType, FileInfo output, string outputMimeType)
Parameters
Type | Name | Description |
---|---|---|
File |
source | The source audio file. |
String | sourceMimeType | The source Mime Type. |
File |
output | The output audio file. |
String | outputMimeType | The output Mime Type. |