Skip to content

Commit

Permalink
Update stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Kermalis committed Aug 19, 2021
1 parent 6ece2e1 commit a5f6e96
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 27 deletions.
27 changes: 14 additions & 13 deletions VG Music Studio/Core/GBA/AlphaDream/SoundFontSaver_DLS.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Kermalis.DLS2;
using System;
using System.Collections.Generic;
using System.Diagnostics;

Expand All @@ -7,16 +8,16 @@ namespace Kermalis.VGMusicStudio.Core.GBA.AlphaDream
internal sealed class SoundFontSaver_DLS
{
// Since every key will use the same articulation data, just store one instance
private static readonly Level2ArticulatorChunk _art2 = new Level2ArticulatorChunk()
private static readonly Level2ArticulatorChunk _art2 = new Level2ArticulatorChunk
{
new Level2ArticulatorConnectionBlock() { Destination = Level2ArticulatorDestination.LFOFrequency, Scale = 2786 },
new Level2ArticulatorConnectionBlock() { Destination = Level2ArticulatorDestination.VIBFrequency, Scale = 2786 },
new Level2ArticulatorConnectionBlock() { Source = Level2ArticulatorSource.KeyNumber, Destination = Level2ArticulatorDestination.Pitch },
new Level2ArticulatorConnectionBlock() { Source = Level2ArticulatorSource.Vibrato, Control = Level2ArticulatorSource.Modulation_CC1, Destination = Level2ArticulatorDestination.Pitch, BipolarSource = true, Scale = 0x320000 },
new Level2ArticulatorConnectionBlock() { Source = Level2ArticulatorSource.Vibrato, Control = Level2ArticulatorSource.ChannelPressure, Destination = Level2ArticulatorDestination.Pitch, BipolarSource = true, Scale = 0x320000 },
new Level2ArticulatorConnectionBlock() { Source = Level2ArticulatorSource.Pan_CC10, Destination = Level2ArticulatorDestination.Pan, BipolarSource = true, Scale = 0xFE0000 },
new Level2ArticulatorConnectionBlock() { Source = Level2ArticulatorSource.ChorusSend_CC91, Destination = Level2ArticulatorDestination.Reverb, Scale = 0xC80000 },
new Level2ArticulatorConnectionBlock() { Source = Level2ArticulatorSource.Reverb_SendCC93, Destination = Level2ArticulatorDestination.Chorus, Scale = 0xC80000 }
new Level2ArticulatorConnectionBlock { Destination = Level2ArticulatorDestination.LFOFrequency, Scale = 2786 },
new Level2ArticulatorConnectionBlock { Destination = Level2ArticulatorDestination.VIBFrequency, Scale = 2786 },
new Level2ArticulatorConnectionBlock { Source = Level2ArticulatorSource.KeyNumber, Destination = Level2ArticulatorDestination.Pitch },
new Level2ArticulatorConnectionBlock { Source = Level2ArticulatorSource.Vibrato, Control = Level2ArticulatorSource.Modulation_CC1, Destination = Level2ArticulatorDestination.Pitch, BipolarSource = true, Scale = 0x320000 },
new Level2ArticulatorConnectionBlock { Source = Level2ArticulatorSource.Vibrato, Control = Level2ArticulatorSource.ChannelPressure, Destination = Level2ArticulatorDestination.Pitch, BipolarSource = true, Scale = 0x320000 },
new Level2ArticulatorConnectionBlock { Source = Level2ArticulatorSource.Pan_CC10, Destination = Level2ArticulatorDestination.Pan, BipolarSource = true, Scale = 0xFE0000 },
new Level2ArticulatorConnectionBlock { Source = Level2ArticulatorSource.ChorusSend_CC91, Destination = Level2ArticulatorDestination.Reverb, Scale = 0xC80000 },
new Level2ArticulatorConnectionBlock { Source = Level2ArticulatorSource.Reverb_SendCC93, Destination = Level2ArticulatorDestination.Chorus, Scale = 0xC80000 }
};

public static void Save(Config config, string path)
Expand Down Expand Up @@ -61,7 +62,7 @@ private static void AddInfo(Config config, DLS dls)
fmt.WaveInfo.BlockAlign = 1;
fmt.FormatInfo.BitsPerSample = 8;
// Create wave sample chunk and add loop if there is one
var wsmp = new WaveSampleChunk()
var wsmp = new WaveSampleChunk
{
UnityNote = 60,
Options = WaveSampleOptions.NoTruncation | WaveSampleOptions.NoCompression
Expand All @@ -77,7 +78,7 @@ private static void AddInfo(Config config, DLS dls)
}
// Get PCM sample
byte[] pcm = new byte[sh.Length];
System.Array.Copy(config.ROM, ofs + 0x10, pcm, 0, sh.Length);
Array.Copy(config.ROM, ofs + 0x10, pcm, 0, sh.Length);

// Add
int dlsIndex = waves.Count;
Expand Down Expand Up @@ -144,13 +145,13 @@ void Add(ushort low, ushort high, ushort baseKey)
lrgn.Add(new ListChunk("rgn2")
{
rgnh,
new WaveSampleChunk()
new WaveSampleChunk
{
UnityNote = baseKey,
Options = WaveSampleOptions.NoTruncation | WaveSampleOptions.NoCompression,
Loop = value.Item1.Loop
},
new WaveLinkChunk()
new WaveLinkChunk
{
Channels = WaveLinkChannels.Left,
TableIndex = (uint)value.Item2
Expand Down
10 changes: 5 additions & 5 deletions VG Music Studio/Core/GBA/AlphaDream/SoundFontSaver_SF2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ internal sealed class SoundFontSaver_SF2
public static void Save(Config config, string path)
{
var sf2 = new SF2();
AddInfo(config, sf2);
AddInfo(config, sf2.InfoChunk);
Dictionary<int, (SampleHeader, int)> sampleDict = AddSamples(config, sf2);
AddInstruments(config, sf2, sampleDict);
sf2.Save(path);
}

private static void AddInfo(Config config, SF2 sf2)
private static void AddInfo(Config config, InfoListChunk chunk)
{
sf2.InfoChunk.Bank = config.Name;
//sf2.InfoChunk.Copyright = config.Creator;
sf2.InfoChunk.Tools = Util.Utils.ProgramName + " by Kermalis";
chunk.Bank = config.Name;
//chunk.Copyright = config.Creator;
chunk.Tools = Util.Utils.ProgramName + " by Kermalis";
}

private static Dictionary<int, (SampleHeader, int)> AddSamples(Config config, SF2 sf2)
Expand Down
15 changes: 9 additions & 6 deletions VG Music Studio/VG Music Studio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
<Reference Include="DLS2">
<HintPath>Dependencies\DLS2.dll</HintPath>
</Reference>
<Reference Include="EndianBinaryIO, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EndianBinaryIO.1.1.1\lib\netstandard2.0\EndianBinaryIO.dll</HintPath>
<Reference Include="EndianBinaryIO, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EndianBinaryIO.1.1.2\lib\netstandard2.0\EndianBinaryIO.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.2\lib\Microsoft.WindowsAPICodePack.dll</HintPath>
Expand All @@ -73,8 +73,11 @@
<Reference Include="Microsoft.WindowsAPICodePack.ShellExtensions, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll</HintPath>
</Reference>
<Reference Include="NAudio, Version=1.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NAudio.1.10.0\lib\net35\NAudio.dll</HintPath>
<Reference Include="NAudio.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=e279aa5131008a41, processorArchitecture=MSIL">
<HintPath>..\packages\NAudio.Core.2.0.0\lib\netstandard2.0\NAudio.Core.dll</HintPath>
</Reference>
<Reference Include="NAudio.Wasapi, Version=2.0.0.0, Culture=neutral, PublicKeyToken=e279aa5131008a41, processorArchitecture=MSIL">
<HintPath>..\packages\NAudio.Wasapi.2.0.0\lib\netstandard2.0\NAudio.Wasapi.dll</HintPath>
</Reference>
<Reference Include="ObjectListView, Version=2.9.1.1072, Culture=neutral, PublicKeyToken=b1c5bf581481bcd4, processorArchitecture=MSIL">
<HintPath>..\packages\ObjectListView.Official.2.9.1\lib\net20\ObjectListView.dll</HintPath>
Expand All @@ -99,8 +102,8 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="YamlDotNet, Version=8.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.8.1.2\lib\net45\YamlDotNet.dll</HintPath>
<Reference Include="YamlDotNet, Version=11.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.11.2.1\lib\net45\YamlDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
7 changes: 4 additions & 3 deletions VG Music Studio/packages.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EndianBinaryIO" version="1.1.1" targetFramework="net48" />
<package id="EndianBinaryIO" version="1.1.2" targetFramework="net48" />
<package id="Microsoft.WindowsAPICodePack-Core" version="1.1.0.2" targetFramework="net471" />
<package id="Microsoft.WindowsAPICodePack-Shell" version="1.1.0.0" targetFramework="net471" />
<package id="NAudio" version="1.10.0" targetFramework="net461" />
<package id="NAudio.Core" version="2.0.0" targetFramework="net48" />
<package id="NAudio.Wasapi" version="2.0.0" targetFramework="net48" />
<package id="ObjectListView.Official" version="2.9.1" targetFramework="net471" />
<package id="YamlDotNet" version="8.1.2" targetFramework="net461" />
<package id="YamlDotNet" version="11.2.1" targetFramework="net48" />
</packages>

0 comments on commit a5f6e96

Please sign in to comment.