Last active
September 27, 2018 16:56
-
-
Save mes51/8784aea945eba8200560724303bfee1b to your computer and use it in GitHub Desktop.
Intervallo JsonLoader Format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExportSample | |
{ | |
public static void Export(string filePath, double framePeriod, ScaleInterpolationType interpolationType, double[] scales) | |
{ | |
var data = new ScaleData | |
{ | |
FramePeriod = framePeriod, | |
InterpolationType = interpolationType, | |
Scales = scales | |
}; | |
using (var fs = new FileStream(filePath, FileMode.Create) | |
{ | |
var serializer = new DataContractJsonSerializer(typeof(ScaleData)); | |
serializer.WriteObject(fs, data); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// 音階データ | |
/// </summary> | |
public class ScaleData | |
{ | |
/// <summary> | |
/// 各フレームの長さ(ms) | |
/// </summary> | |
public double FramePeriod { get; set; } | |
/// <summary> | |
/// 補間タイプ | |
/// </summary> | |
public ScaleInterpolationType InterpolationType { get; set; } | |
/// <summary> | |
/// フレームごとの音階(MIDIノート番号) | |
/// </summary> | |
public double[] Scales { get; set; } | |
} | |
/// <summary> | |
/// 補間モード | |
/// </summary> | |
public enum ScaleInterpolationType | |
{ | |
/// <summary> | |
/// 線形補間 | |
/// </summary> | |
Linear, | |
/// <summary> | |
/// CatmullRom補間 | |
/// </summary> | |
CatmullRom | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DataContractJsonSerializerで書き出されたものを前提とします | |
{ | |
"FramePeriod": 2.0, | |
"InterpolationType": 1, | |
"Scales": [ | |
0.0, | |
60.0, | |
68.0, | |
60.0, | |
70.0, | |
67.0, | |
69.0, | |
60.0 | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment