mirror of
https://github.com/chibicitiberiu/drumkit.git
synced 2024-02-24 10:53:32 +00:00
Latest build (version 2.2)
This commit is contained in:
27
DrumKit/Domain/AppInstallInfo.cs
Normal file
27
DrumKit/Domain/AppInstallInfo.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using System.Reflection;
|
||||
|
||||
namespace DrumKit
|
||||
{
|
||||
[XmlType("DrumkitInstalled")]
|
||||
public class AppInstallInfo
|
||||
{
|
||||
[XmlElement("when")]
|
||||
public DateTime When { get; set; }
|
||||
|
||||
[XmlElement("version")]
|
||||
public int Version { get; set; }
|
||||
|
||||
public AppInstallInfo()
|
||||
{
|
||||
this.When = DateTime.Now;
|
||||
var ver = typeof(AppInstallInfo).GetTypeInfo().Assembly.GetName().Version;
|
||||
this.Version = ver.Major * 1000 + ver.Minor;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,11 +19,23 @@ namespace DrumKit
|
||||
[XmlElement("animations")]
|
||||
public bool Animations { get; set; }
|
||||
|
||||
[XmlElement("masterVolume")]
|
||||
public float MasterVolume { get; set; }
|
||||
|
||||
[XmlElement("debugMode")]
|
||||
public bool DebugMode { get; set; }
|
||||
|
||||
[XmlElement("polyphony")]
|
||||
public int Polyphony { get; set; }
|
||||
|
||||
public AppSettings()
|
||||
{
|
||||
this.CurrentKit = "Default";
|
||||
this.ShowKeyBindings = false;
|
||||
this.Animations = true;
|
||||
this.MasterVolume = 0.8f;
|
||||
this.DebugMode = false;
|
||||
this.Polyphony = 64;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,12 +26,24 @@ namespace DrumKit
|
||||
[XmlElement("image")]
|
||||
public string ImageSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the image loaded into memory.
|
||||
/// </summary>
|
||||
[XmlIgnore()]
|
||||
public Windows.UI.Xaml.Media.ImageSource LoadedImageSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the image uri.
|
||||
/// </summary>
|
||||
[XmlElement("imagePressed")]
|
||||
public string ImagePressedSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the pressed image loaded into memory.
|
||||
/// </summary>
|
||||
[XmlIgnore()]
|
||||
public Windows.UI.Xaml.Media.ImageSource LoadedImagePressedSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of sound sources.
|
||||
/// </summary>
|
||||
@ -45,6 +57,10 @@ namespace DrumKit
|
||||
this.Name = null;
|
||||
this.ImageSource = null;
|
||||
this.ImagePressedSource = null;
|
||||
|
||||
this.LoadedImageSource = null;
|
||||
this.LoadedImagePressedSource = null;
|
||||
|
||||
this.Sounds = new List<SoundSource>();
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,30 @@ namespace DrumKit
|
||||
[XmlElement("volumeR")]
|
||||
public double VolumeR { get; set; }
|
||||
|
||||
[XmlElement("vkey")]
|
||||
[XmlIgnore()]
|
||||
public Windows.System.VirtualKey Key { get; set; }
|
||||
|
||||
[XmlElement("vkey")]
|
||||
public string KeyString
|
||||
{
|
||||
get {
|
||||
if (Enum.IsDefined(typeof(Windows.System.VirtualKey), this.Key))
|
||||
return Enum.GetName(typeof(Windows.System.VirtualKey), this.Key);
|
||||
|
||||
return Convert.ToString((int)this.Key);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Windows.System.VirtualKey key;
|
||||
|
||||
if (Enum.TryParse(value, out key))
|
||||
this.Key = key;
|
||||
|
||||
else this.Key = (Windows.System.VirtualKey) int.Parse(value);
|
||||
}
|
||||
}
|
||||
|
||||
public DrumConfig()
|
||||
{
|
||||
this.TargetId = null;
|
||||
|
@ -22,8 +22,29 @@ namespace DrumKit
|
||||
[XmlElement("layoutfile")]
|
||||
public string LayoutFilePath { get; set; }
|
||||
|
||||
[XmlIgnore()]
|
||||
public Dictionary<string, Drum> Drums { get; private set; }
|
||||
|
||||
[XmlArray("drums")]
|
||||
public List<Drum> Drums { get; set; }
|
||||
public Drum[] DrumsList {
|
||||
get {
|
||||
List<Drum> drums = new List<Drum>();
|
||||
|
||||
foreach (var i in Drums)
|
||||
drums.Add(i.Value);
|
||||
|
||||
return drums.ToArray();
|
||||
}
|
||||
|
||||
set {
|
||||
foreach (var i in value)
|
||||
Drums.Add(i.Id, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[XmlIgnore()]
|
||||
public Windows.Storage.StorageFolder RootFolder { get; set; }
|
||||
|
||||
public Drumkit()
|
||||
{
|
||||
@ -31,7 +52,8 @@ namespace DrumKit
|
||||
this.Description = null;
|
||||
this.ConfigFilePath = null;
|
||||
this.LayoutFilePath = null;
|
||||
this.Drums = new List<Drum>();
|
||||
this.Drums = new Dictionary<string,Drum>();
|
||||
this.RootFolder = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,35 @@ namespace DrumKit
|
||||
[XmlType("drumkitConfig")]
|
||||
public class DrumkitConfig
|
||||
{
|
||||
[XmlIgnore()]
|
||||
public Dictionary<string, DrumConfig> Drums { get; private set; }
|
||||
|
||||
[XmlArray("drums")]
|
||||
public List<DrumConfig> Drums { get; set; }
|
||||
public DrumConfig[] DrumsList
|
||||
{
|
||||
get
|
||||
{
|
||||
List<DrumConfig> configs = new List<DrumConfig>();
|
||||
|
||||
foreach (var i in Drums)
|
||||
configs.Add(i.Value);
|
||||
|
||||
return configs.ToArray();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
foreach (var i in value)
|
||||
Drums.Add(i.TargetId, i);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public DrumkitConfig()
|
||||
{
|
||||
this.Drums = new Dictionary<string, DrumConfig>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace DrumKit
|
||||
public DrumkitLayoutTargetView TargetView { get; set; }
|
||||
|
||||
[XmlElement("targetView")]
|
||||
private string TargetViewSerialize
|
||||
public string TargetViewSerialize
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -65,15 +65,36 @@ namespace DrumKit
|
||||
[XmlElement("isDefault")]
|
||||
public bool IsDefault { get; set; }
|
||||
|
||||
[XmlIgnore()]
|
||||
public Dictionary<string, DrumLayout> Drums { get; set; }
|
||||
|
||||
[XmlArray("drums")]
|
||||
public List<DrumLayout> Drums { get; set; }
|
||||
public DrumLayout[] DrumsList
|
||||
{
|
||||
get
|
||||
{
|
||||
List<DrumLayout> layouts = new List<DrumLayout>();
|
||||
|
||||
foreach (var i in this.Drums)
|
||||
layouts.Add(i.Value);
|
||||
|
||||
return layouts.ToArray();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
foreach (var i in value)
|
||||
this.Drums.Add(i.TargetId, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public DrumkitLayout()
|
||||
{
|
||||
this.Name = null;
|
||||
this.IsDefault = false;
|
||||
this.Drums = new List<DrumLayout>();
|
||||
this.Drums = new Dictionary<string, DrumLayout>();
|
||||
this.TargetView = DrumkitLayoutTargetView.All;
|
||||
}
|
||||
}
|
||||
|
17
DrumKit/Domain/Sound.cs
Normal file
17
DrumKit/Domain/Sound.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using SharpDX.Multimedia;
|
||||
using SharpDX.XAudio2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DrumKit
|
||||
{
|
||||
public struct Sound
|
||||
{
|
||||
public AudioBuffer Buffer { get; set; }
|
||||
public uint[] DecodedPacketsInfo { get; set; }
|
||||
public WaveFormat WaveFormat { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user