45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System;
|
|
using JD.Audio.Annotations;
|
|
using JD.Audio.Sound;
|
|
using TeaBox.Macros;
|
|
|
|
namespace JDSongConverter.Tasks
|
|
{
|
|
/// <summary>
|
|
/// Creates a trk file from a wave file
|
|
/// </summary>
|
|
class CreateTrkFileTask : Task
|
|
{
|
|
public string InputWaveFile { get; set; }
|
|
public string OutputTrkFile { get; set; }
|
|
|
|
public void Init(string inputWavFile, string outputTrkFile)
|
|
{
|
|
InputWaveFile = inputWavFile;
|
|
OutputTrkFile = outputTrkFile;
|
|
}
|
|
|
|
public override string Name
|
|
{
|
|
get { return "Create trk file"; }
|
|
set { }
|
|
}
|
|
|
|
public override string ProgressText
|
|
{
|
|
get { return String.Format("Creating trk file '{0}'", OutputTrkFile); }
|
|
}
|
|
|
|
public override TaskResult Process(IExecutionContext executionContext)
|
|
{
|
|
if (!System.IO.File.Exists(InputWaveFile))
|
|
return TaskResult.ParametersError;
|
|
|
|
var wave = new Wave(InputWaveFile);
|
|
wave.Annotations.BeginUpdate();
|
|
new LuaAnnotations(wave).Save(OutputTrkFile);
|
|
|
|
return TaskResult.Ok;
|
|
}
|
|
}
|
|
}
|