@pro-gram/flux 0.0.0-stage → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/LICENSE +23 -0
  2. package/NOTICE.txt +32 -0
  3. package/README.md +102 -2
  4. package/bin/flux.js +29 -0
  5. package/dependencies.json +14 -0
  6. package/package.json +60 -6
  7. package/payload/DrumBuddy-Setup.exe +0 -0
  8. package/scripts/install.js +58 -0
  9. package/scripts/version.js +12 -0
  10. package/source/AssetBootstrap.cs +49 -0
  11. package/source/Audio.cs +453 -0
  12. package/source/AudioDeviceSettings.cs +126 -0
  13. package/source/AudioInputs.cs +50 -0
  14. package/source/AudioOutputs.cs +327 -0
  15. package/source/AudioWorkspace.cs +71 -0
  16. package/source/BrandArtwork.cs +71 -0
  17. package/source/Build Instructions.txt +59 -0
  18. package/source/Build.ps1 +123 -0
  19. package/source/ControlMode.cs +687 -0
  20. package/source/ControlTests.cs +88 -0
  21. package/source/ConversionFormats.cs +59 -0
  22. package/source/ConversionTests.cs +66 -0
  23. package/source/DockablePane.cs +95 -0
  24. package/source/DriverSetup.cs +28 -0
  25. package/source/EditorView.cs +626 -0
  26. package/source/Fetch-Dependencies.ps1 +15 -0
  27. package/source/FloatRecording.cs +99 -0
  28. package/source/FloatRecordingTests.cs +170 -0
  29. package/source/Flux-Mark.svg +49 -0
  30. package/source/FluxTempo Logo Prompt.txt +3 -0
  31. package/source/FluxTempo-Mark.svg +49 -0
  32. package/source/HomeView.cs +32 -0
  33. package/source/InterfaceSettings.cs +219 -0
  34. package/source/InterfaceTests.cs +166 -0
  35. package/source/LICENSE.txt +23 -0
  36. package/source/Logo Prompt.txt +16 -0
  37. package/source/Main.cs +781 -0
  38. package/source/Main.xaml +292 -0
  39. package/source/MediaPlayerView.cs +274 -0
  40. package/source/MidiControl.cs +113 -0
  41. package/source/MidiPerformance.cs +125 -0
  42. package/source/Mixer.cs +280 -0
  43. package/source/NativeMemory.cs +165 -0
  44. package/source/PanelFeedback.cs +75 -0
  45. package/source/PlaybackTests.cs +134 -0
  46. package/source/Quick Start.txt +77 -0
  47. package/source/SelfTest.cs +78 -0
  48. package/source/SettingsWindow.cs +208 -0
  49. package/source/Setup.cs +192 -0
  50. package/source/Setup.xaml +28 -0
  51. package/source/ShellStyles.xaml +99 -0
  52. package/source/TempoGrid.cs +95 -0
  53. package/source/TempoGridTests.cs +108 -0
  54. package/source/Third Party Notices.txt +32 -0
  55. package/source/Timeline.cs +261 -0
  56. package/source/TimelineGestures.cs +57 -0
  57. package/source/Uninstall.cs +69 -0
  58. package/source/WorkspaceTests.cs +198 -0
  59. package/source/app.manifest +7 -0
  60. package/source/brand-archive/Drum-Buddy-Black-Hair.png +0 -0
  61. package/source/dependency-lock.json +62 -0
  62. package/source/fluxtempo-mark.png +0 -0
  63. package/source/logo.png +0 -0
  64. package/source/r16-panel.png +0 -0
  65. package/source/references/R16 Format Research.txt +16 -0
  66. package/test/package.test.js +55 -0
@@ -0,0 +1,123 @@
1
+ param(
2
+ [string]$Dependencies = (Join-Path $PSScriptRoot '..\deps'),
3
+ [string]$BuildFolder = (Join-Path $PSScriptRoot '..\build'),
4
+ [switch]$AppOnly,
5
+ [switch]$BootstrapOnly
6
+ )
7
+ $ErrorActionPreference = 'Stop'
8
+ $framework = Join-Path $env:WINDIR 'Microsoft.NET\Framework64\v4.0.30319'
9
+ $compiler = Join-Path $framework 'csc.exe'
10
+ if (!(Test-Path -LiteralPath $compiler)) { throw 'Build on 64-bit Windows with .NET Framework 4.8 installed.' }
11
+ $Dependencies = [IO.Path]::GetFullPath($Dependencies)
12
+ $BuildFolder = [IO.Path]::GetFullPath($BuildFolder)
13
+ $package = Join-Path $BuildFolder 'DrumBuddy'
14
+ New-Item -ItemType Directory -Force -Path $package,(Join-Path $package 'tools'),(Join-Path $package 'drivers\ZoomR16'),(Join-Path $package 'licenses') | Out-Null
15
+
16
+ foreach ($name in @('NAudio.Core','NAudio.Asio','NAudio.WinMM','NAudio.Wasapi')) {
17
+ Copy-Item -LiteralPath (Join-Path $Dependencies ($name.ToLowerInvariant() + '\lib\netstandard2.0\' + $name + '.dll')) -Destination $package -Force
18
+ }
19
+ foreach ($name in @('Microsoft.Win32.Registry','System.Security.AccessControl','System.Security.Principal.Windows')) {
20
+ Copy-Item -LiteralPath (Join-Path $Dependencies ($name.ToLowerInvariant() + '\lib\net461\' + $name + '.dll')) -Destination $package -Force
21
+ }
22
+ if (!$BootstrapOnly) {
23
+ $ffmpeg = Get-ChildItem -LiteralPath (Join-Path $Dependencies 'ffmpeg') -Recurse -Filter ffmpeg.exe | Select-Object -First 1
24
+ if (!$ffmpeg) { throw 'FFmpeg is missing. See Fetch-Dependencies.ps1.' }
25
+ Copy-Item -LiteralPath $ffmpeg.FullName -Destination (Join-Path $package 'tools\ffmpeg.exe') -Force
26
+ $ffRoot = Split-Path (Split-Path $ffmpeg.FullName)
27
+ Copy-Item -LiteralPath (Join-Path $ffRoot 'LICENSE') -Destination (Join-Path $package 'licenses\FFmpeg-GPLv3.txt') -Force
28
+ Copy-Item -LiteralPath (Join-Path $ffRoot 'README.txt') -Destination (Join-Path $package 'licenses\FFmpeg-build.txt') -Force
29
+ $panelSource = Join-Path $PSScriptRoot 'r16-panel.png'
30
+ if (!(Test-Path -LiteralPath $panelSource)) { $panelSource = Join-Path $Dependencies 'r16-panel.png' }
31
+ Copy-Item -LiteralPath $panelSource -Destination $package -Force
32
+ }
33
+ Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'logo.png') -Destination $package -Force
34
+ Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'Flux-Mark.svg') -Destination $package -Force
35
+ foreach ($file in @('Quick Start.txt','LICENSE.txt','Third Party Notices.txt')) { Copy-Item -LiteralPath (Join-Path $PSScriptRoot $file) -Destination $package -Force }
36
+ if (Test-Path -LiteralPath (Join-Path $Dependencies 'NAudio-license.txt')) { Copy-Item -LiteralPath (Join-Path $Dependencies 'NAudio-license.txt') -Destination (Join-Path $package 'licenses\NAudio-MIT.txt') -Force }
37
+
38
+ # Convert the original logo into the native Windows ICO container, preserving alpha.
39
+ Add-Type -AssemblyName System.Drawing
40
+ $image = [Drawing.Image]::FromFile((Join-Path $PSScriptRoot 'logo.png'))
41
+ $sizes = @(16,24,32,48,64,128,256)
42
+ $iconImages = @()
43
+ foreach ($size in $sizes) {
44
+ $bitmap = New-Object Drawing.Bitmap($size,$size,[Drawing.Imaging.PixelFormat]::Format32bppArgb)
45
+ $graphics = [Drawing.Graphics]::FromImage($bitmap)
46
+ $graphics.Clear([Drawing.Color]::Transparent)
47
+ $graphics.InterpolationMode = [Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
48
+ $scale = [Math]::Min($size / $image.Width,$size / $image.Height)
49
+ $w = [int]($image.Width * $scale)
50
+ $h = [int]($image.Height * $scale)
51
+ $graphics.DrawImage($image,[int](($size-$w)/2),[int](($size-$h)/2),$w,$h)
52
+ $memory = New-Object IO.MemoryStream
53
+ $bitmap.Save($memory,[Drawing.Imaging.ImageFormat]::Png)
54
+ $iconImages += ,$memory.ToArray()
55
+ $memory.Dispose()
56
+ $graphics.Dispose()
57
+ $bitmap.Dispose()
58
+ }
59
+ $image.Dispose()
60
+ $iconPath = Join-Path $BuildFolder 'DrumBuddy.ico'
61
+ $iconStream = [IO.File]::Create($iconPath)
62
+ $iconWriter = New-Object IO.BinaryWriter($iconStream)
63
+ $iconWriter.Write([uint16]0)
64
+ $iconWriter.Write([uint16]1)
65
+ $iconWriter.Write([uint16]$sizes.Count)
66
+ $offset = 6 + $sizes.Count * 16
67
+ for ($i=0; $i -lt $sizes.Count; $i++) {
68
+ $dimension = if ($sizes[$i] -eq 256) { 0 } else { $sizes[$i] }
69
+ $iconWriter.Write([byte]$dimension)
70
+ $iconWriter.Write([byte]$dimension)
71
+ $iconWriter.Write([byte]0)
72
+ $iconWriter.Write([byte]0)
73
+ $iconWriter.Write([uint16]1)
74
+ $iconWriter.Write([uint16]32)
75
+ $iconWriter.Write([uint32]$iconImages[$i].Length)
76
+ $iconWriter.Write([uint32]$offset)
77
+ $offset += $iconImages[$i].Length
78
+ }
79
+ foreach ($bytes in $iconImages) { $iconWriter.Write([byte[]]$bytes) }
80
+ $iconWriter.Dispose()
81
+
82
+ $standard = Get-ChildItem -LiteralPath (Join-Path $env:WINDIR 'Microsoft.NET\assembly\GAC_MSIL\netstandard') -Recurse -Filter netstandard.dll | Select-Object -First 1
83
+ if (!$standard) { throw '.NET Framework 4.8 netstandard facade is missing.' }
84
+ $refs = @('System.dll','System.Core.dll','System.Xml.dll','System.Drawing.dll','System.Windows.Forms.dll','System.Xaml.dll') | ForEach-Object { '/reference:' + (Join-Path $framework $_) }
85
+ $refs += @('PresentationFramework.dll','PresentationCore.dll','WindowsBase.dll') | ForEach-Object { '/reference:' + (Join-Path $framework ('WPF\' + $_)) }
86
+ $refs += '/reference:' + $standard.FullName
87
+ $refs += Get-ChildItem -LiteralPath $package -Filter '*.dll' | ForEach-Object { '/reference:' + $_.FullName }
88
+ $common = @('/nologo','/target:winexe','/platform:x64','/optimize+','/utf8output',('/win32manifest:' + (Join-Path $PSScriptRoot 'app.manifest')),('/win32icon:' + $iconPath))
89
+ $appArgs = $common + $refs + @(('/out:' + (Join-Path $package 'DrumBuddy.exe')),('/resource:' + (Join-Path $PSScriptRoot 'Main.xaml') + ',Main.xaml')) + @('Main.cs','Audio.cs','FloatRecording.cs','FloatRecordingTests.cs','Timeline.cs','TempoGrid.cs','TempoGridTests.cs','TimelineGestures.cs','AudioWorkspace.cs','AudioOutputs.cs','AudioInputs.cs','AudioDeviceSettings.cs','InterfaceSettings.cs','DockablePane.cs','SettingsWindow.cs','HomeView.cs','InterfaceTests.cs','ConversionFormats.cs','ConversionTests.cs','PlaybackTests.cs','MediaPlayerView.cs','EditorView.cs','WorkspaceTests.cs','SelfTest.cs','Mixer.cs','NativeMemory.cs','MidiControl.cs','MidiPerformance.cs','ControlMode.cs','ControlTests.cs','PanelFeedback.cs','DriverSetup.cs' | ForEach-Object { Join-Path $PSScriptRoot $_ })
90
+ $appArgs += '/resource:' + (Join-Path $PSScriptRoot 'ShellStyles.xaml') + ',ShellStyles.xaml'
91
+ $appArgs += '/resource:' + (Join-Path $PSScriptRoot 'Flux-Mark.svg') + ',Flux-Mark.svg'
92
+ $appArgs += Join-Path $PSScriptRoot 'BrandArtwork.cs'
93
+ & $compiler @appArgs
94
+ if ($LASTEXITCODE -ne 0) { throw 'App compilation failed.' }
95
+ @'
96
+ <?xml version="1.0" encoding="utf-8"?>
97
+ <configuration><startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup><runtime><AppContextSwitchOverrides value="Switch.System.Windows.DoNotScaleForDpiChanges=false"/></runtime></configuration>
98
+ '@ | Set-Content -LiteralPath (Join-Path $package 'DrumBuddy.exe.config') -Encoding UTF8
99
+ if ($AppOnly) { Write-Output ('Built app: ' + (Join-Path $package 'DrumBuddy.exe')); return }
100
+ $uninstallArgs = $common + @('/reference:System.dll','/reference:System.Core.dll','/reference:System.Windows.Forms.dll',('/out:' + (Join-Path $package 'Uninstall.exe')),(Join-Path $PSScriptRoot 'Uninstall.cs'))
101
+ & $compiler @uninstallArgs
102
+ if ($LASTEXITCODE -ne 0) { throw 'Uninstaller compilation failed.' }
103
+
104
+ Add-Type -AssemblyName System.IO.Compression.FileSystem
105
+ $payload = Join-Path $BuildFolder 'payload.zip'
106
+ if (Test-Path -LiteralPath $payload) { Remove-Item -LiteralPath $payload }
107
+ [IO.Compression.ZipFile]::CreateFromDirectory($package,$payload,[IO.Compression.CompressionLevel]::Optimal,$false)
108
+ $manifest = Get-ChildItem -LiteralPath $package -Recurse -File | ForEach-Object {
109
+ $relative = $_.FullName.Substring($package.Length + 1).Replace('\','/')
110
+ (Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash + ' ' + $relative
111
+ }
112
+ $manifestPath = Join-Path $BuildFolder 'payload.sha256'
113
+ [IO.File]::WriteAllLines($manifestPath,[string[]]$manifest,(New-Object Text.UTF8Encoding($false)))
114
+ $setupRefs = $refs | Where-Object { $_ -notmatch 'NAudio|Microsoft.Win32.Registry|System.Security' }
115
+ $setupRefs += '/reference:' + (Join-Path $framework 'System.IO.Compression.dll')
116
+ $setupRefs += '/reference:' + (Join-Path $framework 'System.IO.Compression.FileSystem.dll')
117
+ $setupArgs = $common + $setupRefs + @(('/out:' + (Join-Path $BuildFolder 'DrumBuddy-Setup.exe')),('/resource:' + $payload + ',payload.zip'),('/resource:' + $manifestPath + ',payload.sha256'),('/resource:' + (Join-Path $PSScriptRoot 'Setup.xaml') + ',Setup.xaml'),('/resource:' + (Join-Path $PSScriptRoot 'logo.png') + ',logo.png'),(Join-Path $PSScriptRoot 'Setup.cs'),(Join-Path $PSScriptRoot 'DriverSetup.cs'),(Join-Path $PSScriptRoot 'AssetBootstrap.cs'))
118
+ $setupArgs += '/resource:' + (Join-Path $PSScriptRoot 'Flux-Mark.svg') + ',Flux-Mark.svg'
119
+ $setupArgs += Join-Path $PSScriptRoot 'BrandArtwork.cs'
120
+ & $compiler @setupArgs
121
+ if ($LASTEXITCODE -ne 0) { throw 'Installer compilation failed.' }
122
+ Write-Output ('Built app: ' + (Join-Path $package 'DrumBuddy.exe'))
123
+ Write-Output ('Built installer: ' + (Join-Path $BuildFolder 'DrumBuddy-Setup.exe'))