This repository has been archived by the owner on Sep 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathProject.cs
64 lines (56 loc) · 2.04 KB
/
Project.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System.Collections.Generic;
using System.IO;
namespace Monad.FLParser
{
public class Project
{
public const int MaxInsertCount = 127;
public const int MaxTrackCount = 199;
public int MainVolume { get; set; } = 300;
public int MainPitch { get; set; } = 0;
public int Ppq { get; set; } = 0;
public double Tempo { get; set; } = 140;
public string ProjectTitle { get; set; } = string.Empty;
public string Comment { get; set; } = string.Empty;
public string Author { get; set; } = string.Empty;
public string Genre { get; set; } = string.Empty;
public string VersionString { get; set; } = string.Empty;
public int Version { get; set; } = 0x100;
public List<Channel> Channels { get; set; } = new List<Channel>();
public Track[] Tracks { get; set; } = new Track[MaxTrackCount];
public List<Pattern> Patterns = new List<Pattern>();
public Insert[] Inserts { get; set; } = new Insert[MaxInsertCount];
public bool PlayTruncatedNotes { get; set; } = false;
public Project()
{
for (var i = 0; i < MaxTrackCount; i++)
{
Tracks[i] = new Track();
}
for (var i = 0; i < MaxInsertCount; i++)
{
Inserts[i] = new Insert { Id = i, Name = $"Insert {i}" };
}
Inserts[0].Name = "Master";
}
public static Project Load(string path, bool verbose)
{
using (var stream = File.OpenRead(path))
{
return Load(stream, verbose);
}
}
public static Project Load(Stream stream, bool verbose)
{
using (var reader = new BinaryReader(stream))
{
return Load(reader, verbose);
}
}
public static Project Load(BinaryReader reader, bool verbose)
{
var parser = new ProjectParser(verbose);
return parser.Parse(reader);
}
}
}