-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
1,030 additions
and
310 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// 有关程序集的常规信息通过以下 | ||
// 特性集控制。更改这些特性值可修改 | ||
// 与程序集关联的信息。 | ||
[assembly: AssemblyTitle("Faders")] | ||
[assembly: AssemblyDescription("Mygod")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("Mygod")] | ||
[assembly: AssemblyProduct("Faders")] | ||
[assembly: AssemblyCopyright("Copyright © Mygod 2014")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// 将 ComVisible 设置为 false 使此程序集中的类型 | ||
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, | ||
// 则将该类型上的 ComVisible 特性设置为 true。 | ||
[assembly: ComVisible(false)] | ||
|
||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | ||
[assembly: Guid("3a71495b-5104-44b4-8c99-93c27fe0c7e6")] | ||
|
||
// 程序集的版本信息由下面四个值组成: | ||
// | ||
// 主版本 | ||
// 次版本 | ||
// 生成号 | ||
// 修订号 | ||
// | ||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, | ||
// 方法是按如下所示使用“*”: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.2.1")] | ||
[assembly: AssemblyFileVersion("1.0.2.1")] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
|
||
namespace Mygod.Musicript.VolumeControllers.Faders | ||
{ | ||
/// <summary> | ||
/// 线性衰减器。 | ||
/// </summary> | ||
public class LinearFader | ||
{ | ||
private double speed; | ||
|
||
/// <summary> | ||
/// 设置衰减速度。 | ||
/// </summary> | ||
/// <param name="value">衰减速度。</param> | ||
public void SetSpeed(string value) | ||
{ | ||
speed = double.Parse(value); | ||
} | ||
|
||
/// <summary> | ||
/// 控制指定时刻的音量。 | ||
/// </summary> | ||
/// <param name="time">时刻。</param> | ||
/// <returns>指定时刻的音量。</returns> | ||
public double GetVolume(double time) | ||
{ | ||
var temp = 1 - time * speed; | ||
return temp < 0 ? 0 : temp; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// 对数衰减器。 | ||
/// </summary> | ||
public class LogarithmicFader | ||
{ | ||
private double speed; | ||
|
||
/// <summary> | ||
/// 设置衰减速度。 | ||
/// </summary> | ||
/// <param name="value">衰减速度。</param> | ||
public void SetSpeed(string value) | ||
{ | ||
speed = double.Parse(value); | ||
} | ||
|
||
/// <summary> | ||
/// 控制指定时刻的音量。 | ||
/// </summary> | ||
/// <param name="time">时刻。</param> | ||
/// <returns>指定时刻的音量。</returns> | ||
public double GetVolume(double time) | ||
{ | ||
return Math.Exp(-time * speed); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{330A8B06-12C6-482C-8AA3-AD9A4C4BA77B}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>Mygod.Musicript.VolumeControllers.Faders</RootNamespace> | ||
<AssemblyName>Faders</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>..\Musicript\Presets\VolumeControllers\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DocumentationFile>..\Musicript\Presets\VolumeControllers\Faders.XML</DocumentationFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Faders.cs" /> | ||
<Compile Include="AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// 有关程序集的常规信息通过以下 | ||
// 特性集控制。更改这些特性值可修改 | ||
// 与程序集关联的信息。 | ||
[assembly: AssemblyTitle("Inflection")] | ||
[assembly: AssemblyDescription("Mygod")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("Mygod")] | ||
[assembly: AssemblyProduct("Inflection")] | ||
[assembly: AssemblyCopyright("Copyright © Mygod 2014")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// 将 ComVisible 设置为 false 使此程序集中的类型 | ||
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, | ||
// 则将该类型上的 ComVisible 特性设置为 true。 | ||
[assembly: ComVisible(false)] | ||
|
||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | ||
[assembly: Guid("4f5749a4-a3f2-43d2-acdd-4dbc1d324554")] | ||
|
||
// 程序集的版本信息由下面四个值组成: | ||
// | ||
// 主版本 | ||
// 次版本 | ||
// 生成号 | ||
// 修订号 | ||
// | ||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, | ||
// 方法是按如下所示使用“*”: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.2.1")] | ||
[assembly: AssemblyFileVersion("1.0.2.1")] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
|
||
namespace Mygod.Musicript.Interpolators.Inflection | ||
{ | ||
/// <summary> | ||
/// 线性变调插值。 | ||
/// </summary> | ||
public sealed class LinearInflection | ||
{ | ||
private static double speed; | ||
|
||
/// <summary> | ||
/// 设置变调速度。 | ||
/// </summary> | ||
/// <param name="value"></param> | ||
public void SetSpeed(string value) | ||
{ | ||
speed = double.Parse(value); | ||
} | ||
|
||
/// <summary> | ||
/// 插值。 | ||
/// </summary> | ||
/// <param name="frequency">原频率。</param> | ||
/// <param name="time">时刻。</param> | ||
/// <returns>插值后映射到的时刻。</returns> | ||
public double Interpolate(double frequency, double time) | ||
{ | ||
var result = time * (frequency + speed * time / 2); | ||
if (speed >= 0) return result; | ||
var temp = -frequency / speed; | ||
return time > temp ? temp * frequency / 2 : result; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// 对数变调插值。 | ||
/// </summary> | ||
public sealed class LogarithmicInflection | ||
{ | ||
private static double speed; | ||
|
||
/// <summary> | ||
/// 设置变调速度。 | ||
/// </summary> | ||
/// <param name="value"></param> | ||
public void SetSpeed(string value) | ||
{ | ||
speed = double.Parse(value); | ||
} | ||
|
||
/// <summary> | ||
/// 插值。 | ||
/// </summary> | ||
/// <param name="frequency">原频率。</param> | ||
/// <param name="time">时刻。</param> | ||
/// <returns>插值后映射到的时刻。</returns> | ||
public double Interpolate(double frequency, double time) | ||
{ | ||
if (Math.Abs(speed) < 1e-8) return frequency * time; | ||
// no inflection | ||
return frequency * (Math.Exp(speed * time) - 1) / speed; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{037D134F-FCDC-4FC8-8A8D-FF808BDC5AEF}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>Mygod.Musicript.Interpolators.Inflection</RootNamespace> | ||
<AssemblyName>Inflection</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>..\Musicript\Presets\Interpolators\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DocumentationFile>..\Musicript\Presets\Interpolators\Inflection.XML</DocumentationFile> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Inflection.cs" /> | ||
<Compile Include="AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<Application x:Class="Mygod.Musicript.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml" | ||
<Application x:Class="Mygod.Musicript.App" StartupUri="MainWindow.xaml" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
DispatcherUnhandledException="OnUnhandledException" /> |
Oops, something went wrong.