Latest build (version 2.2)

This commit is contained in:
Tiberiu Chibici 2013-11-18 20:11:53 +02:00
parent 43c240001c
commit 26d355ce07
503 changed files with 186904 additions and 1139 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<drumkitConfig>
<drums>
<drumConfig targetId="defaultkick">
<volume>1.0</volume>
<vkey>A</vkey>
</drumConfig>
<drumConfig targetId="defaultsnare">
<volume>1.0</volume>
<vkey>B</vkey>
</drumConfig>
<drumConfig targetId="defaulthitom">
<volume>1.0</volume>
<vkey>C</vkey>
</drumConfig>
<drumConfig targetId="defaultlotom">
<volume>1.0</volume>
<vkey>D</vkey>
</drumConfig>
<drumConfig targetId="defaultfltom">
<volume>1.0</volume>
<vkey>E</vkey>
</drumConfig>
<drumConfig targetId="defaulthihatcl">
<volume>1.0</volume>
<vkey>F</vkey>
</drumConfig>
<drumConfig targetId="defaulthihatop">
<volume>1.0</volume>
<vkey>G</vkey>
</drumConfig>
<drumConfig targetId="defaultcrash">
<volume>1.0</volume>
<vkey>H</vkey>
</drumConfig>
<drumConfig targetId="defaultride">
<volume>1.0</volume>
<vkey>I</vkey>
</drumConfig>
</drums>
</drumkitConfig>

View File

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8" ?>
<drumkit>
<!-- General info -->
<name>Default</name>
<description>Default drums</description>
<!-- Files -->
<configfile>config.xml</configfile>
<layoutfile>layout.xml</layoutfile>
<!-- Drums -->
<drums>
<drum id="defaultkick">
<name>Kick</name>
<image>Images/kick.png</image>
<imagePressed>Images/kickPressed.png</imagePressed>
<sounds>
<sound intensity="0">Sounds/Kick07.wav</sound>
</sounds>
</drum>
<drum id="defaultsnare">
<name>Snare</name>
<image>Images/drum.png</image>
<imagePressed>Images/drumPressed.png</imagePressed>
<sounds>
<sound intensity="0">Sounds/Snare08.wav</sound>
</sounds>
</drum>
<drum id="defaulthitom">
<name>High Tom</name>
<image>Images/drum.png</image>
<imagePressed>Images/drumPressed.png</imagePressed>
<sounds>
<sound intensity="0">Sounds/TomHigh04.wav</sound>
</sounds>
</drum>
<drum id="defaultlotom">
<name>Low Tom</name>
<image>Images/drum.png</image>
<imagePressed>Images/drumPressed.png</imagePressed>
<sounds>
<sound intensity="0">Sounds/TomLow04.wav</sound>
</sounds>
</drum>
<drum id="defaultfltom">
<name>Floor Tom</name>
<image>Images/drum.png</image>
<imagePressed>Images/drumPressed.png</imagePressed>
<sounds>
<sound intensity="0">Sounds/Floor04.wav</sound>
</sounds>
</drum>
<drum id="defaulthihatcl">
<name>Hi-Hat Closed (pedal)</name>
<image>Images/pedal.png</image>
<imagePressed>Images/pedalPressed.png</imagePressed>
<sounds>
<sound intensity="0">Sounds/HiHatClosed04.wav</sound>
</sounds>
</drum>
<drum id="defaulthihatop">
<name>Hi-Hat Opened</name>
<image>Images/plate.png</image>
<imagePressed>Images/platePressed.png</imagePressed>
<sounds>
<sound intensity="0">Sounds/HiHatOpen04.wav</sound>
</sounds>
</drum>
<drum id="defaultcrash">
<name>Crash</name>
<image>Images/plate.png</image>
<imagePressed>Images/platePressed.png</imagePressed>
<sounds>
<sound intensity="0">Sounds/Crash05.wav</sound>
</sounds>
</drum>
<drum id="defaultride">
<name>Ride</name>
<image>Images/plate.png</image>
<imagePressed>Images/platePressed.png</imagePressed>
<sounds>
<sound intensity="0">Sounds/Ride04.wav</sound>
</sounds>
</drum>
</drums>
<!--
[Kick]
position=.41,.2
size=.3
image=ms-appx:///Assets/Drums/big_drum_of.png
sound,0=ms-appx:///Assets/Sounds/Kick07.wav
[Snare]
position=.16,.34
size=.25
image=ms-appx:///Assets/Drums/drum_of.png
sound,0=ms-appx:///Assets/Sounds/Snare08.wav
[High Tom]
position=.33,.05
size=.22
image=ms-appx:///Assets/Drums/drum_of.png
sound,0=ms-appx:///Assets/Sounds/TomHigh04.wav
[Low Tom]
position=.55,.05
size=.22
image=ms-appx:///Assets/Drums/drum_of.png
sound,0=ms-appx:///Assets/Sounds/TomLow04.wav
[Floor Tom]
position=.66,.44
size=.29
image=ms-appx:///Assets/Drums/drum_of.png
sound,0=ms-appx:///Assets/Sounds/Floor04.wav
[Hi-Hat Closed]
position=.10,.87
size=.05
image=ms-appx:///Assets/Drums/HiHat_off.png
sound,0=ms-appx:///Assets/Sounds/HiHatClosed04.wav
[Hi-Hat Opened]
position=.03,.55
size=.21
image=ms-appx:///Assets/Drums/plate_off.png
sound,0=ms-appx:///Assets/Sounds/HiHatOpen04.wav
[Crash]
position=.1,.02
size=.25
image=ms-appx:///Assets/Drums/plate_off.png
sound,0=ms-appx:///Assets/Sounds/Crash05.wav
[Ride]
position=.72,.04
size=.25
image=ms-appx:///Assets/Drums/plate_off.png
sound,0=ms-appx:///Assets/Sounds/Ride04.wav-->
</drumkit>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8" ?>
<drumkitLayoutCollection>
<items>
<!-- Standard layout - all views -->
<drumkitLayout>
<name>Standard layout</name>
<targetView>Snapped|Landscape|Filled|Portrait</targetView>
<isDefault>true</isDefault>
<drums>
<drumLayout targetId="defaultkick">
<size>.3</size>
<x>.41</x>
<y>.2</y>
<zindex>0</zindex>
</drumLayout>
<drumLayout targetId="defaultsnare">
<size>.25</size>
<x>.16</x>
<y>.34</y>
<zindex>2</zindex>
</drumLayout>
<drumLayout targetId="defaulthitom">
<size>.22</size>
<x>.33</x>
<y>.05</y>
<zindex>1</zindex>
</drumLayout>
<drumLayout targetId="defaultlotom">
<size>.22</size>
<x>.55</x>
<y>.05</y>
<zindex>1</zindex>
</drumLayout>
<drumLayout targetId="defaultfltom">
<size>.29</size>
<x>.66</x>
<y>.44</y>
<zindex>1</zindex>
</drumLayout>
<drumLayout targetId="defaulthihatcl">
<size>.05</size>
<x>.10</x>
<y>.87</y>
<zindex>3</zindex>
</drumLayout>
<drumLayout targetId="defaulthihatop">
<size>.21</size>
<x>.03</x>
<y>.55</y>
<zindex>4</zindex>
</drumLayout>
<drumLayout targetId="defaultcrash">
<size>.26</size>
<x>.1</x>
<y>.02</y>
<zindex>4</zindex>
</drumLayout>
<drumLayout targetId="defaultride">
<size>.25</size>
<x>.72</x>
<y>.04</y>
<zindex>4</zindex>
</drumLayout>
</drums>
</drumkitLayout>
</items>
</drumkitLayoutCollection>

BIN
#Resources/manual.docx Normal file

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

BIN
#Resources/summary.pptx Normal file

Binary file not shown.

View File

@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DrumKit", "DrumKit\DrumKit.csproj", "{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DrumKit", "DrumKit\DrumKit.csproj", "{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tarball", "Tarball\Tarball.csproj", "{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -39,11 +41,24 @@ Global
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.ActiveCfg = Release|x86 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.ActiveCfg = Release|x86
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.Build.0 = Release|x86 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.Build.0 = Release|x86
{9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.Deploy.0 = Release|x86 {9A5D3F55-DFD5-45DB-99FF-C82EFCC3294D}.Release|x86.Deploy.0 = Release|x86
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|ARM.ActiveCfg = Debug|ARM
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|ARM.Build.0 = Debug|ARM
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x64.ActiveCfg = Debug|x64
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x64.Build.0 = Debug|x64
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x86.ActiveCfg = Debug|x86
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Debug|x86.Build.0 = Debug|x86
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|Any CPU.Build.0 = Release|Any CPU
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|ARM.ActiveCfg = Release|ARM
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|ARM.Build.0 = Release|ARM
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x64.ActiveCfg = Release|x64
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x64.Build.0 = Release|x64
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x86.ActiveCfg = Release|x86
{5CB567D7-572E-4BAE-802F-7E3F62CDDF64}.Release|x86.Build.0 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal EndGlobal

Binary file not shown.

View File

@ -13,6 +13,7 @@
Required by Visual Studio project and item templates Required by Visual Studio project and item templates
--> -->
<ResourceDictionary Source="Common/StandardStyles.xaml"/> <ResourceDictionary Source="Common/StandardStyles.xaml"/>
<ResourceDictionary Source="Common/TextButtonStyles.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>

View File

@ -80,22 +80,10 @@ namespace DrumKit
/// </summary> /// </summary>
/// <param name="sender">The source of the suspend request.</param> /// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param> /// <param name="e">Details about the suspend request.</param>
private async void OnSuspending(object sender, SuspendingEventArgs e) private void OnSuspending(object sender, SuspendingEventArgs e)
{ {
var deferral = e.SuspendingOperation.GetDeferral(); var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
try {
await DataManager.Close();
}
catch (Exception ex) {
Log.Error("Exception in OnSuspending method!");
Log.Except(ex);
}
Log.Write("Application suspended.");
//TODO:::...
deferral.Complete(); deferral.Complete();
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 325 KiB

View File

@ -89,56 +89,10 @@
<image>Images/plate.png</image> <image>Images/plate.png</image>
<imagePressed>Images/platePressed.png</imagePressed> <imagePressed>Images/platePressed.png</imagePressed>
<sounds> <sounds>
<sound intensity="0">Sounds/Ride04.wav</sound> <sound intensity="0">Sounds/Ride06.wav</sound>
</sounds> </sounds>
</drum> </drum>
</drums> </drums>
<!--
[Kick]
position=.41,.2
size=.3
image=ms-appx:///Assets/Drums/big_drum_of.png
sound,0=ms-appx:///Assets/Sounds/Kick07.wav
[Snare]
position=.16,.34
size=.25
image=ms-appx:///Assets/Drums/drum_of.png
sound,0=ms-appx:///Assets/Sounds/Snare08.wav
[High Tom]
position=.33,.05
size=.22
image=ms-appx:///Assets/Drums/drum_of.png
sound,0=ms-appx:///Assets/Sounds/TomHigh04.wav
[Low Tom]
position=.55,.05
size=.22
image=ms-appx:///Assets/Drums/drum_of.png
sound,0=ms-appx:///Assets/Sounds/TomLow04.wav
[Floor Tom]
position=.66,.44
size=.29
image=ms-appx:///Assets/Drums/drum_of.png
sound,0=ms-appx:///Assets/Sounds/Floor04.wav
[Hi-Hat Closed]
position=.10,.87
size=.05
image=ms-appx:///Assets/Drums/HiHat_off.png
sound,0=ms-appx:///Assets/Sounds/HiHatClosed04.wav
[Hi-Hat Opened]
position=.03,.55
size=.21
image=ms-appx:///Assets/Drums/plate_off.png
sound,0=ms-appx:///Assets/Sounds/HiHatOpen04.wav
[Crash]
position=.1,.02
size=.25
image=ms-appx:///Assets/Drums/plate_off.png
sound,0=ms-appx:///Assets/Sounds/Crash05.wav
[Ride]
position=.72,.04
size=.25
image=ms-appx:///Assets/Drums/plate_off.png
sound,0=ms-appx:///Assets/Sounds/Ride04.wav-->
</drumkit> </drumkit>

View File

@ -6,7 +6,7 @@
<!-- Standard layout - all views --> <!-- Standard layout - all views -->
<drumkitLayout> <drumkitLayout>
<name>Standard layout</name> <name>Standard layout</name>
<targetView>Snapped|Landscape|Filled|Portrait</targetView> <targetView>All</targetView>
<isDefault>true</isDefault> <isDefault>true</isDefault>
<drums> <drums>
@ -72,6 +72,152 @@
</drumLayout> </drumLayout>
</drums> </drums>
</drumkitLayout> </drumkitLayout>
<drumkitLayout>
<name>Portrait layout</name>
<targetView>Portrait</targetView>
<isDefault>true</isDefault>
<drums>
<drumLayout targetId="defaultkick">
<size>0.53359375</size>
<x>.2</x>
<y>.39</y>
<zindex>0</zindex>
<angle>-90</angle>
</drumLayout>
<drumLayout targetId="defaultsnare">
<size>0.4446614583</size>
<x>.34</x>
<y>.64</y>
<zindex>2</zindex>
<angle>-29</angle>
</drumLayout>
<drumLayout targetId="defaulthitom">
<size>0.3913020833</size>
<x>.05</x>
<y>.47</y>
<zindex>1</zindex>
<angle>60</angle>
</drumLayout>
<drumLayout targetId="defaultlotom">
<size>0.3913020833</size>
<x>.05</x>
<y>.25</y>
<zindex>1</zindex>
<angle>60</angle>
</drumLayout>
<drumLayout targetId="defaultfltom">
<size>0.5158072917</size>
<x>.44</x>
<y>.14</y>
<zindex>1</zindex>
<angle>-120</angle>
</drumLayout>
<drumLayout targetId="defaulthihatcl">
<size>0.0978255208</size>
<x>.89</x>
<y>.69</y>
<zindex>3</zindex>
<angle>-90</angle>
</drumLayout>
<drumLayout targetId="defaulthihatop">
<size>0.373515625</size>
<x>.55</x>
<y>.77</y>
<zindex>4</zindex>
<angle>-10</angle>
</drumLayout>
<drumLayout targetId="defaultcrash">
<size>0.4624479167</size>
<x>.02</x>
<y>.7</y>
<zindex>4</zindex>
<angle>-10</angle>
</drumLayout>
<drumLayout targetId="defaultride">
<size>0.4446614583</size>
<x>.04</x>
<y>.08</y>
<zindex>4</zindex>
<angle>-90</angle>
</drumLayout>
</drums>
</drumkitLayout>
<drumkitLayout>
<name>Snapped layout</name>
<targetView>Snapped</targetView>
<isDefault>true</isDefault>
<drums>
<drumLayout targetId="defaultkick">
<size>0.6</size>
<x>0.49444900512695339</x>
<y>0.32627955277760762</y>
<zindex>0</zindex>
<angle>-90</angle>
</drumLayout>
<drumLayout targetId="defaultsnare">
<size>0.5</size>
<x>0.39433132171630869</x>
<y>0.56396647930145249</y>
<zindex>2</zindex>
<angle>61</angle>
</drumLayout>
<drumLayout targetId="defaulthitom">
<size>0.44</size>
<x>0.057991533279419152</x>
<y>0.43292328516642276</y>
<zindex>1</zindex>
<angle>60</angle>
</drumLayout>
<drumLayout targetId="defaultlotom">
<size>0.44</size>
<x>0.087597298622131434</x>
<y>0.26619099378585825</y>
<zindex>1</zindex>
<angle>60</angle>
</drumLayout>
<drumLayout targetId="defaultfltom">
<size>0.58</size>
<x>0.47881852149963317</x>
<y>0.10023623943328863</y>
<zindex>1</zindex>
<angle>-120</angle>
</drumLayout>
<drumLayout targetId="defaulthihatcl">
<size>0.11</size>
<x>0.83815117835998587</x>
<y>0.80136797269185378</y>
<zindex>3</zindex>
<angle>-90</angle>
</drumLayout>
<drumLayout targetId="defaulthihatop">
<size>0.42</size>
<x>0.45826869487762456</x>
<y>0.74660433133443138</y>
<zindex>4</zindex>
<angle>-10</angle>
</drumLayout>
<drumLayout targetId="defaultcrash">
<size>0.52</size>
<x>-0.015512061119079568</x>
<y>0.62290350516637261</y>
<zindex>4</zindex>
<angle>-10</angle>
</drumLayout>
<drumLayout targetId="defaultride">
<size>0.5</size>
<x>0.019840950965881135</x>
<y>0.06086617549260457</y>
<zindex>4</zindex>
<angle>-90</angle>
</drumLayout>
</drums>
</drumkitLayout>
</items> </items>
</drumkitLayoutCollection> </drumkitLayoutCollection>

View File

@ -28,6 +28,9 @@
<x:String x:Key="ChevronGlyph">&#xE26B;</x:String> <x:String x:Key="ChevronGlyph">&#xE26B;</x:String>
<!-- User defined brushes -->
<SolidColorBrush x:Key="ApplicationBackgroundColor" Color="#164646" />
<!-- RichTextBlock styles --> <!-- RichTextBlock styles -->
<Style x:Key="BasicRichTextStyle" TargetType="RichTextBlock"> <Style x:Key="BasicRichTextStyle" TargetType="RichTextBlock">
@ -233,6 +236,11 @@
<Setter Property="Foreground" Value="{StaticResource ApplicationSecondaryForegroundThemeBrush}"/> <Setter Property="Foreground" Value="{StaticResource ApplicationSecondaryForegroundThemeBrush}"/>
</Style> </Style>
<Style x:Key="MyButtonStyle" TargetType="Button" BasedOn="{StaticResource TextButtonStyle}">
<Setter Property="Margin" Value="0,0,14,0" />
</Style>
<!-- <!--
TextRadioButtonStyle is used to style a RadioButton using subheader-styled text with no other adornment. TextRadioButtonStyle is used to style a RadioButton using subheader-styled text with no other adornment.
This style is used in the SearchResultsPage to allow selection among filters. This style is used in the SearchResultsPage to allow selection among filters.
@ -430,6 +438,18 @@
<Setter Property="Content" Value="&#xE116;"/> <Setter Property="Content" Value="&#xE116;"/>
</Style> </Style>
<Style x:Key="DeleteAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId" Value="DeleteAppBarButton"/>
<Setter Property="AutomationProperties.Name" Value="Delete"/>
<Setter Property="Content" Value="&#xE106;"/>
</Style>
<Style x:Key="SaveAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId" Value="SaveAppBarButton"/>
<Setter Property="AutomationProperties.Name" Value="Save"/>
<Setter Property="Content" Value="&#xE105;"/>
</Style>
<!-- <!--
<Style x:Key="SkipBackAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> <Style x:Key="SkipBackAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
@ -443,16 +463,7 @@
<Setter Property="Content" Value="&#xE101;"/> <Setter Property="Content" Value="&#xE101;"/>
</Style> </Style>
<Style x:Key="SaveAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId" Value="SaveAppBarButton"/>
<Setter Property="AutomationProperties.Name" Value="Save"/>
<Setter Property="Content" Value="&#xE105;"/>
</Style>
<Style x:Key="DeleteAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId" Value="DeleteAppBarButton"/>
<Setter Property="AutomationProperties.Name" Value="Delete"/>
<Setter Property="Content" Value="&#xE106;"/>
</Style>
<Style x:Key="DiscardAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> <Style x:Key="DiscardAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId" Value="DiscardAppBarButton"/> <Setter Property="AutomationProperties.AutomationId" Value="DiscardAppBarButton"/>
<Setter Property="AutomationProperties.Name" Value="Discard"/> <Setter Property="AutomationProperties.Name" Value="Discard"/>
@ -523,12 +534,15 @@
<Setter Property="AutomationProperties.Name" Value="Photo"/> <Setter Property="AutomationProperties.Name" Value="Photo"/>
<Setter Property="Content" Value="&#xE114;"/> <Setter Property="Content" Value="&#xE114;"/>
</Style> </Style>
-->
<Style x:Key="SettingsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}"> <Style x:Key="SettingsAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId" Value="SettingsAppBarButton"/> <Setter Property="AutomationProperties.AutomationId" Value="SettingsAppBarButton"/>
<Setter Property="AutomationProperties.Name" Value="Settings"/> <Setter Property="AutomationProperties.Name" Value="Settings"/>
<Setter Property="Content" Value="&#xE115;" /> <Setter Property="Content" Value="&#xE115;" />
</Style> </Style>
-->
<!-- <!--
@ -1833,4 +1847,10 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<SolidColorBrush x:Key="ListViewItemSelectedBackgroundThemeBrush" Color="#075369"></SolidColorBrush>
<SolidColorBrush x:Key="ListViewItemPointerOverBackgroundThemeBrush" Color="#30ffffff"></SolidColorBrush>
<SolidColorBrush x:Key="ListViewItemSelectedPointerOverBackgroundThemeBrush" Color="#ab188DAD"></SolidColorBrush>
<SolidColorBrush x:Key="ListViewItemSelectedPointerOverBorderThemeBrush" Color="#ab188DAD"></SolidColorBrush>
</ResourceDictionary> </ResourceDictionary>

View File

@ -0,0 +1,155 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="TextBoxBackgroundThemeBrush" Color="#ffff" />
<SolidColorBrush x:Key="TextBoxBorderThemeBrush" Color="#efff" />
<SolidColorBrush x:Key="TextBoxDisabledBackgroundThemeBrush" Color="Transparent" />
<SolidColorBrush x:Key="TextBoxDisabledBorderThemeBrush" Color="#66FFFFFF" />
<SolidColorBrush x:Key="TextBoxDisabledForegroundThemeBrush" Color="#FF666666" />
<SolidColorBrush x:Key="TextBoxForegroundThemeBrush" Color="#f000" />
<x:Double x:Key="TextControlBackgroundThemeOpacity">0</x:Double>
<x:Double x:Key="TextControlBorderThemeOpacity">0</x:Double>
<x:Double x:Key="TextControlPointerOverBackgroundThemeOpacity">0.17</x:Double>
<x:Double x:Key="TextControlPointerOverBorderThemeOpacity">0.17</x:Double>
<x:Double x:Key="TextControlThemeMinHeight">32</x:Double>
<x:Double x:Key="TextControlThemeMinWidth">64</x:Double>
<Thickness x:Key="TextControlBorderThemeThickness">2</Thickness>
<Thickness x:Key="TextControlThemePadding">10,3,10,5</Thickness>
<Style x:Key="MyTextBoxStyle" TargetType="TextBox">
<Setter Property="MinWidth" Value="{StaticResource TextControlThemeMinWidth}" />
<Setter Property="MinHeight" Value="{StaticResource TextControlThemeMinHeight}" />
<Setter Property="Foreground" Value="{StaticResource TextBoxForegroundThemeBrush}" />
<Setter Property="Background" Value="{StaticResource TextBoxBackgroundThemeBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorderThemeBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource TextControlBorderThemeThickness}" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
<Setter Property="Padding" Value="{StaticResource TextControlThemePadding}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="EditIconElement"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="White" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Opacity"
Duration="0"
To="0" />
<DoubleAnimation Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="Opacity"
Duration="0"
To="0" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="White" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Opacity"
Duration="0"
To="0.1" />
<DoubleAnimation Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="Opacity"
Duration="0"
To="0.1" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="White" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Focused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="EditIconElement"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="Gray" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="0" />
</Grid.ColumnDefinitions>
<Border x:Name="BackgroundElement"
Background="{TemplateBinding Background}"
Margin="{TemplateBinding BorderThickness}"
Grid.ColumnSpan="3"/>
<Border x:Name="BorderElement"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Grid.ColumnSpan="3"/>
<TextBlock x:Name="EditIconElement"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="5,5,0,5"
Foreground="#8fff"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontStyle="Normal" FontSize="14"
Opacity=".6"
Text="&#xe104;" />
<ScrollViewer x:Name="ContentElement"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
IsTabStop="False"
ZoomMode="Disabled"
Grid.Column="1"/>
<Button x:Name="DeleteButton"
IsTabStop="False"
Grid.Column="2"
Visibility="Collapsed"
Opacity="0"
IsEnabled="False" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DrumKit
{
class ControllerException : Exception
{
public ControllerException() :
base() { }
public ControllerException(string message) :
base(message) { }
public ControllerException(string message, Exception innerException) :
base(message, innerException) { }
}
}

View File

@ -0,0 +1,440 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.UI.Xaml;
namespace DrumKit
{
public static class DataController
{
#region Fields: Repositories
private static Repository.DataRepository DataRepo { get; set; }
private static Repository.DrumkitRepository DrumkitRepo { get; set; }
private static Repository.SoundRepository SoundRepository { get; set; }
private static SoundPool SoundPool { get; set; }
#endregion
#region Fields: Timers
private static DispatcherTimer saveConfigTimer { get; set; }
private static DispatcherTimer saveLayoutTimer { get; set; }
private static DispatcherTimer saveSettingsTimer { get; set; }
#endregion
#region Fields: Public properties
/// <summary>
/// Gets application's installation info
/// </summary>
public static AppInstallInfo InstallInfo
{
get
{
return (DataRepo == null) ? null : DataRepo.InstallInfo;
}
}
/// <summary>
/// Gets application's settings.
/// </summary>
public static AppSettings Settings
{
get
{
return (DataRepo == null) ? null : DataRepo.Settings;
}
}
/// <summary>
/// Gets the list of available drumkits.
/// </summary>
public static Dictionary<string, Drumkit> AvailableDrumkits
{
get
{
return (DrumkitRepo == null) ? null : DrumkitRepo.AvailableDrumKits;
}
}
/// <summary>
/// Gets or sets the current drumkit.
/// </summary>
public static Drumkit CurrentDrumkit
{
get
{
return AvailableDrumkits[CurrentDrumkitName];
}
set
{
CurrentDrumkitName = value.Name;
}
}
/// <summary>
/// Gets the current drumkit names.
/// </summary>
public static string CurrentDrumkitName { get; private set; }
/// <summary>
/// Gets the current drumkit layouts.
/// </summary>
public static DrumkitLayoutCollection CurrentLayouts { get; private set; }
/// <summary>
/// Gets the current drums configuration.
/// </summary>
public static DrumkitConfig CurrentConfig { get; private set; }
/// <summary>
/// Gets or sets the master volume.
/// </summary>
public static float MasterVolume
{
get {
return Settings.MasterVolume;
}
set {
Settings.MasterVolume = value;
SoundPool.MasterVolume = value;
}
}
#endregion
#region Events
/// <summary>
/// Triggered when the progress of the initialize method changed.
/// </summary>
public static event EventHandler<KeyValuePair<int, string>> ProgressChanged;
#endregion
#region Initialization
/// <summary>
/// Initializes everything.
/// </summary>
public static async Task Initialize()
{
// Initialize timers
InitializeTimers();
// Prepare data
ReportProgress(1 * 100 / 8, "Loading data...");
await InitializeData();
// Open log file
await Log.Initialize();
// Prepare drumkits
ReportProgress(4 * 100 / 8, "Loading drums...");
await InitializeDrumkits();
// Figure out current drumkit, throw ControllerException if nothing found.
CurrentDrumkitName = GetCurrentDrumkit();
// Load drumkit layouts and config
ReportProgress(5 * 100 / 8, "Loading drums...");
CurrentLayouts = await DrumkitRepo.ReadLayouts(CurrentDrumkitName);
CurrentConfig = await DrumkitRepo.ReadConfig(CurrentDrumkitName);
// Load drumkit sounds
ReportProgress(6 * 100 / 8, "Loading sounds...");
await InitializeSounds();
// Load user interface (images and stuff)
ReportProgress(7 * 100 / 8, "Loading interface...");
await InitializeUI();
}
/// <summary>
/// Initializes the timers for IO operations
/// The timers are used in order to avoid problems from too many IO requests in a short period of time.
/// </summary>
private static void InitializeTimers()
{
saveConfigTimer = new DispatcherTimer();
saveConfigTimer.Interval = TimeSpan.FromSeconds(.5);
saveConfigTimer.Tick += SaveConfigTick;
saveLayoutTimer = new DispatcherTimer();
saveLayoutTimer.Interval = TimeSpan.FromSeconds(.5);
saveLayoutTimer.Tick += SaveLayoutTick;
saveSettingsTimer = new DispatcherTimer();
saveSettingsTimer.Interval = TimeSpan.FromSeconds(.5);
saveSettingsTimer.Tick += SaveSettingsTick;
}
/// <summary>
/// Initializes the data: loads settings, app install info, performs after install actions.
/// </summary>
private static async Task InitializeData()
{
DataRepo = new Repository.DataRepository();
await DataRepo.Initialize(ApplicationData.Current);
}
/// <summary>
/// Initializes the drumkit repository: loads information about every drumkit
/// </summary>
private static async Task InitializeDrumkits()
{
StorageFolder repo = await ApplicationData.Current.RoamingFolder.CreateFolderAsync("Drumkits", CreationCollisionOption.OpenIfExists);
DrumkitRepo = new Repository.DrumkitRepository();
await DrumkitRepo.Initialize(repo);
}
/// <summary>
/// Initializes the sound repository: loads all the drums associated with the current drumkit, creates soundpool.
/// </summary>
private static async Task InitializeSounds()
{
// Create repository
StorageFolder repo = CurrentDrumkit.RootFolder;
SoundRepository = new Repository.SoundRepository(repo);
// Load drums
foreach (var i in CurrentDrumkit.DrumsList)
if (CurrentConfig.Drums[i.Id].IsEnabled)
await SoundRepository.LoadSounds(i);
// Create soundpool
if (SoundRepository.LoadedSounds.Count > 0)
SoundPool = new SoundPool(SoundRepository.LoadedSounds.First().Value.WaveFormat, Settings.Polyphony);
else
SoundPool = new SoundPool(new SharpDX.Multimedia.WaveFormat(), Settings.Polyphony);
SoundPool.MasterVolume = Settings.MasterVolume;
}
/// <summary>
/// Determines the current drumkit
/// </summary>
private static string GetCurrentDrumkit()
{
// Try the application settings
if (AvailableDrumkits.ContainsKey(Settings.CurrentKit))
return Settings.CurrentKit;
// Nope, try default
if (AvailableDrumkits.ContainsKey("Default"))
return "Default";
// Nope, try anything
if (AvailableDrumkits.Count > 0)
return AvailableDrumkits.First().Key;
// Still nothing? Error
throw new ControllerException("No drumkits available!");
}
/// <summary>
/// Loads the drum images
/// </summary>
private static async Task InitializeUI()
{
// Load images
foreach (var i in CurrentDrumkit.DrumsList)
{
i.LoadedImageSource = await IOHelper.GetImageAsync(CurrentDrumkit.RootFolder, i.ImageSource);
i.LoadedImagePressedSource = await IOHelper.GetImageAsync(CurrentDrumkit.RootFolder, i.ImagePressedSource);
}
}
#endregion
/// <summary>
/// Resets to factory settings
/// </summary>
public static async Task FactoryReset()
{
await ApplicationData.Current.ClearAsync();
}
#region Private methods
/// <summary>
/// Reports current progress (calls event).
/// </summary>
/// <param name="percent">Percentage of task completed.</param>
/// <param name="info">What is happening, like a message to the user.</param>
private static void ReportProgress(int percent, string info)
{
if (ProgressChanged != null)
ProgressChanged(null, new KeyValuePair<int, string>(percent, info));
}
#endregion
#region Playback
/// <summary>
/// Plays a sound if loaded.
/// </summary>
/// <param name="drum_id">ID of the drum the sound belongs to.</param>
/// <param name="intensity">Intensity of sound</param>
public static void PlaySound(string drum_id, int intensity=0)
{
// Get sound
Sound? sound = SoundRepository.GetLoadedSound(drum_id, intensity);
// If possible, play
if (sound.HasValue)
{
float l = Convert.ToSingle(CurrentConfig.Drums[drum_id].VolumeL);
float r = Convert.ToSingle(CurrentConfig.Drums[drum_id].VolumeR);
SoundPool.PlayBuffer(sound.Value, l, r);
}
}
#endregion
#region Drumkit repository
/// <summary>
/// Deletes a drumkit from the system.
/// </summary>
/// <param name="name">Name (identifier) of drumkit</param>
public static async Task RemoveDrumkit (string name)
{
// Make sure there is at least a drumkit remaining
if (AvailableDrumkits.Count <= 1)
throw new ControllerException("Cannot remove last drumkit.");
// Is it current drumkit?
if (name == CurrentDrumkitName)
throw new ArgumentException("Cannot remove currently loaded drumkit.");
// Remove
await DrumkitRepo.Remove(name);
}
/// <summary>
/// Installs a drumkit package.
/// </summary>
/// <param name="tarball">A .tar file</param>
public static async Task InstallDrumkit(StorageFile tarball)
{
await DrumkitRepo.InstallTarball(tarball);
}
/// <summary>
/// Exports a drumkit package.
/// </summary>
/// <param name="drumkit_key">The key of the drumkit to export</param>
/// <param name="tarball">The destination file</param>
public static async Task ExportDrumkit(string drumkit_key, StorageFile tarball)
{
await DrumkitRepo.ExportTarball(drumkit_key, tarball);
}
/// <summary>
/// Creates a new layout
/// </summary>
public static void CreateLayout()
{
// Create object
var layout = new DrumkitLayout();
// Add layout for each of the existing drums
foreach (var i in CurrentDrumkit.Drums.Keys)
layout.Drums.Add(i, new DrumLayout() { TargetId = i });
// Add to layout list
CurrentLayouts.Items.Add(layout);
}
#endregion
#region Save methods
/// <summary>
/// Saves the drum configuration settings for current drumkit.
/// </summary>
public static void SaveConfig()
{
saveConfigTimer.Stop();
saveConfigTimer.Start();
}
/// <summary>
/// Saves the drum layout settings for current drumkit.
/// </summary>
public static void SaveLayout()
{
saveLayoutTimer.Stop();
saveLayoutTimer.Start();
}
/// <summary>
/// Saves the applications settings.
/// </summary>
public static void SaveSettings()
{
saveSettingsTimer.Stop();
saveSettingsTimer.Start();
}
/// <summary>
/// Save settings timer.
/// </summary>
private static async void SaveSettingsTick(object sender, object e)
{
// Save settings
await DataRepo.WriteSettings();
Log.Write("Saved settings");
// Stop timer
var timer = sender as DispatcherTimer;
if (timer != null)
timer.Stop();
}
/// <summary>
/// Save layouts timer
/// </summary>
private static async void SaveLayoutTick(object sender, object e)
{
// Save layouts
await DrumkitRepo.WriteLayouts(CurrentDrumkitName, CurrentLayouts);
Log.Write("Saved layout...");
// Stop timer
var timer = sender as DispatcherTimer;
if (timer != null)
timer.Stop();
}
/// <summary>
/// Save drum configuration timer.
/// </summary>
private static async void SaveConfigTick(object sender, object e)
{
// Save drumkit configuration
await DrumkitRepo.WriteConfig(CurrentDrumkitName, CurrentConfig);
Log.Write("Saved configuration...");
// Stop timer
var timer = sender as DispatcherTimer;
if (timer != null)
timer.Stop();
}
#endregion
/// <summary>
/// Saves settings and other stuff
/// </summary>
public static void Dispose()
{
DrumkitRepo.Dispose();
SoundRepository.Dispose();
SoundPool.Dispose();
}
}
}

View 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;
}
}
}

View File

@ -19,11 +19,23 @@ namespace DrumKit
[XmlElement("animations")] [XmlElement("animations")]
public bool Animations { get; set; } 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() public AppSettings()
{ {
this.CurrentKit = "Default"; this.CurrentKit = "Default";
this.ShowKeyBindings = false; this.ShowKeyBindings = false;
this.Animations = true; this.Animations = true;
this.MasterVolume = 0.8f;
this.DebugMode = false;
this.Polyphony = 64;
} }
} }
} }

View File

@ -26,12 +26,24 @@ namespace DrumKit
[XmlElement("image")] [XmlElement("image")]
public string ImageSource { get; set; } 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> /// <summary>
/// Gets or sets the image uri. /// Gets or sets the image uri.
/// </summary> /// </summary>
[XmlElement("imagePressed")] [XmlElement("imagePressed")]
public string ImagePressedSource { get; set; } 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> /// <summary>
/// Gets or sets the list of sound sources. /// Gets or sets the list of sound sources.
/// </summary> /// </summary>
@ -45,6 +57,10 @@ namespace DrumKit
this.Name = null; this.Name = null;
this.ImageSource = null; this.ImageSource = null;
this.ImagePressedSource = null; this.ImagePressedSource = null;
this.LoadedImageSource = null;
this.LoadedImagePressedSource = null;
this.Sounds = new List<SoundSource>(); this.Sounds = new List<SoundSource>();
} }

View File

@ -36,9 +36,30 @@ namespace DrumKit
[XmlElement("volumeR")] [XmlElement("volumeR")]
public double VolumeR { get; set; } public double VolumeR { get; set; }
[XmlElement("vkey")] [XmlIgnore()]
public Windows.System.VirtualKey Key { get; set; } 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() public DrumConfig()
{ {
this.TargetId = null; this.TargetId = null;

View File

@ -22,8 +22,29 @@ namespace DrumKit
[XmlElement("layoutfile")] [XmlElement("layoutfile")]
public string LayoutFilePath { get; set; } public string LayoutFilePath { get; set; }
[XmlIgnore()]
public Dictionary<string, Drum> Drums { get; private set; }
[XmlArray("drums")] [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() public Drumkit()
{ {
@ -31,7 +52,8 @@ namespace DrumKit
this.Description = null; this.Description = null;
this.ConfigFilePath = null; this.ConfigFilePath = null;
this.LayoutFilePath = null; this.LayoutFilePath = null;
this.Drums = new List<Drum>(); this.Drums = new Dictionary<string,Drum>();
this.RootFolder = null;
} }
} }
} }

View File

@ -10,7 +10,35 @@ namespace DrumKit
[XmlType("drumkitConfig")] [XmlType("drumkitConfig")]
public class DrumkitConfig public class DrumkitConfig
{ {
[XmlIgnore()]
public Dictionary<string, DrumConfig> Drums { get; private set; }
[XmlArray("drums")] [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>();
}
} }
} }

View File

@ -17,7 +17,7 @@ namespace DrumKit
public DrumkitLayoutTargetView TargetView { get; set; } public DrumkitLayoutTargetView TargetView { get; set; }
[XmlElement("targetView")] [XmlElement("targetView")]
private string TargetViewSerialize public string TargetViewSerialize
{ {
get get
{ {
@ -65,15 +65,36 @@ namespace DrumKit
[XmlElement("isDefault")] [XmlElement("isDefault")]
public bool IsDefault { get; set; } public bool IsDefault { get; set; }
[XmlIgnore()]
public Dictionary<string, DrumLayout> Drums { get; set; }
[XmlArray("drums")] [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() public DrumkitLayout()
{ {
this.Name = null; this.Name = null;
this.IsDefault = false; this.IsDefault = false;
this.Drums = new List<DrumLayout>(); this.Drums = new Dictionary<string, DrumLayout>();
this.TargetView = DrumkitLayoutTargetView.All; this.TargetView = DrumkitLayoutTargetView.All;
} }
} }

17
DrumKit/Domain/Sound.cs Normal file
View 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; }
}
}

View File

@ -106,11 +106,49 @@
<Compile Include="App.xaml.cs"> <Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Archiving\TarballReader.cs" /> <Compile Include="Controller\DataController.cs" />
<Compile Include="Controller\ControllerException.cs" />
<Compile Include="Domain\AppInstallInfo.cs" />
<Compile Include="Domain\AppSettings.cs" /> <Compile Include="Domain\AppSettings.cs" />
<Compile Include="IOHelper.cs" /> <Compile Include="Domain\Sound.cs" />
<Compile Include="Recorder.cs" />
<Compile Include="UI\DrumPlayUI.xaml.cs">
<DependentUpon>DrumPlayUI.xaml</DependentUpon>
</Compile>
<Compile Include="UI\DrumEditUI.xaml.cs">
<DependentUpon>DrumEditUI.xaml</DependentUpon>
</Compile>
<Compile Include="UI\EditorPage.xaml.cs">
<DependentUpon>EditorPage.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Settings\LayoutsSettingsControl.xaml.cs">
<DependentUpon>LayoutsSettingsControl.xaml</DependentUpon>
</Compile>
<Compile Include="Utils\UIHelper.cs" />
<Compile Include="UI\Settings\ExperimentsSettingsControl.xaml.cs">
<DependentUpon>ExperimentsSettingsControl.xaml</DependentUpon>
</Compile>
<Compile Include="UI\CommonControls\FileControl.xaml.cs">
<DependentUpon>FileControl.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Settings\DrumsSettingsControl.xaml.cs">
<DependentUpon>DrumsSettingsControl.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Settings\DrumkitsSettingsControl.xaml.cs">
<DependentUpon>DrumkitsSettingsControl.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Settings\GeneralSettingsControl.xaml.cs">
<DependentUpon>GeneralSettingsControl.xaml</DependentUpon>
</Compile>
<Compile Include="Repository\LogRepository.cs" />
<Compile Include="Repository\DataRepository.cs" />
<Compile Include="Repository\SoundRepository.cs" />
<Compile Include="UI\SettingsPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon>
</Compile>
<Compile Include="Repository\RepositoryException.cs" />
<Compile Include="Utils\IOHelper.cs" />
<Compile Include="Log.cs" /> <Compile Include="Log.cs" />
<Compile Include="Managers\DataManager.cs" />
<Compile Include="Domain\Drum.cs" /> <Compile Include="Domain\Drum.cs" />
<Compile Include="Domain\DrumConfig.cs" /> <Compile Include="Domain\DrumConfig.cs" />
<Compile Include="Domain\Drumkit.cs" /> <Compile Include="Domain\Drumkit.cs" />
@ -119,26 +157,26 @@
<Compile Include="Domain\DrumkitLayoutCollection.cs" /> <Compile Include="Domain\DrumkitLayoutCollection.cs" />
<Compile Include="Domain\DrumkitLayoutTargetView.cs" /> <Compile Include="Domain\DrumkitLayoutTargetView.cs" />
<Compile Include="Domain\DrumLayout.cs" /> <Compile Include="Domain\DrumLayout.cs" />
<Compile Include="Managers\DrumsManager.cs" /> <Compile Include="Repository\DrumkitRepository.cs" />
<Compile Include="Managers\UIManager.cs" />
<Compile Include="UI\DrumUI.cs" />
<Compile Include="UI\LoadingPage.xaml.cs"> <Compile Include="UI\LoadingPage.xaml.cs">
<DependentUpon>LoadingPage.xaml</DependentUpon> <DependentUpon>LoadingPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\MainPage.xaml.cs"> <Compile Include="UI\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon> <DependentUpon>MainPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Recorder.cs" />
<Compile Include="Managers\SoundManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SoundPool.cs" /> <Compile Include="SoundPool.cs" />
<Compile Include="Domain\SoundSource.cs" /> <Compile Include="Domain\SoundSource.cs" />
<Compile Include="UI\Settings\LogControl.xaml.cs">
<DependentUpon>LogControl.xaml</DependentUpon>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AppxManifest Include="Package.appxmanifest"> <AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</AppxManifest> </AppxManifest>
<Content Include="Assets\ApplicationData.tar" /> <Content Include="Assets\ApplicationData.tar" />
<Content Include="Features.txt" />
<None Include="Build\7z.exe" /> <None Include="Build\7z.exe" />
<None Include="Build\ApplicationData\Drumkits\Default\config.xml" /> <None Include="Build\ApplicationData\Drumkits\Default\config.xml" />
<None Include="Build\ApplicationData\Drumkits\Default\drumkit.xml" /> <None Include="Build\ApplicationData\Drumkits\Default\drumkit.xml" />
@ -185,6 +223,51 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Common\TextButtonStyles.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="UI\DrumPlayUI.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\DrumEditUI.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\EditorPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Settings\LayoutsSettingsControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Settings\ExperimentsSettingsControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\CommonControls\FileControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Settings\DrumsSettingsControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UI\Settings\DrumkitsSettingsControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Settings\GeneralSettingsControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\SettingsPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\LoadingPage.xaml"> <Page Include="UI\LoadingPage.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@ -193,6 +276,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="UI\Settings\LogControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="SharpDX, Version=2.4.2.0, Culture=neutral, PublicKeyToken=627a3d6d1956f55a, processorArchitecture=MSIL"> <Reference Include="SharpDX, Version=2.4.2.0, Culture=neutral, PublicKeyToken=627a3d6d1956f55a, processorArchitecture=MSIL">
@ -204,7 +291,12 @@
<HintPath>..\..\..\..\WebDownloads\SharpDX242\Bin\Signed-winrt\SharpDX.XAudio2.dll</HintPath> <HintPath>..\..\..\..\WebDownloads\SharpDX242\Bin\Signed-winrt\SharpDX.XAudio2.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<ProjectReference Include="..\Tarball\Tarball.csproj">
<Project>{5cb567d7-572e-4bae-802f-7e3f62cddf64}</Project>
<Name>Tarball</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' "> <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
<VisualStudioVersion>11.0</VisualStudioVersion> <VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup> </PropertyGroup>

10
DrumKit/Features.txt Normal file
View File

@ -0,0 +1,10 @@
Feature ideas:
* drum hit intensity
* audio effects (echo & stuff)
* additional drum sets
* create/delete drums
* create drum kits
* z index in editor
* recording
* sequencer

View File

@ -10,54 +10,42 @@ namespace DrumKit
{ {
static class Log static class Log
{ {
private static StreamWriter output = null;
public static async Task Initialize() public static async Task Initialize()
{ {
// Create "Logs" folder if not created // Create "Logs" folder if not created
var folder = await ApplicationData.Current.RoamingFolder.CreateFolderAsync("AppLogs", CreationCollisionOption.OpenIfExists); var folder = await ApplicationData.Current.RoamingFolder.CreateFolderAsync("AppLogs", CreationCollisionOption.OpenIfExists);
// Create a log file // Initialize the log repository
var file = await folder.CreateFileAsync(DateTime.Now.Ticks.ToString() + ".csv", CreationCollisionOption.GenerateUniqueName); await Repository.LogRepository.Initialize(folder);
// Open stream
var stream = await file.OpenAsync(FileAccessMode.ReadWrite);
var iostream = stream.AsStream();
output = new StreamWriter(iostream);
output.AutoFlush = true;
// Write an initial message
Write("Session started");
} }
public static void Write(string format, params object[] args) public static void Write(string format, params object[] args)
{ {
if (output == null) return; // Prepare data
string res = string.Format(format, args); string res = string.Format(format, args);
string final = string.Format("{0} INFO: {1}", DateTime.Now, res);
// Write data // Write
output.WriteLine("{0},Information,{1}", DateTime.Now, res); Repository.LogRepository.WriteLine(final);
} }
public static void Error(string format, params object[] args) public static void Error(string format, params object[] args)
{ {
if (output == null) return; // Prepare data
string res = string.Format(format, args); string res = string.Format(format, args);
string final = string.Format("{0} ERROR: {1}", DateTime.Now, res);
// Write data // Write
output.WriteLine("{0},Error,{1}", DateTime.Now, res); Repository.LogRepository.WriteLine(final);
} }
public static void Except(Exception ex) public static void Except(Exception ex)
{ {
if (output == null) return; // Prepare data
string final = string.Format("{0} EXCEPTION: {1}", DateTime.Now, ex.ToString());
// Prepare
string stack = ex.StackTrace.Replace("\n", ",,,,");
// Write data
output.WriteLine("{0},Exception,{1},{2},{3}", DateTime.Now, ex.Message, ex.Source, stack);
}
// Write
Repository.LogRepository.WriteLine(final);
}
} }
} }

Some files were not shown because too many files have changed in this diff Show More