@pro-gram/flux 0.0.0-stage → 1.6.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 (79) hide show
  1. package/LICENSE +23 -0
  2. package/NOTICE.txt +33 -0
  3. package/README.md +125 -2
  4. package/bin/flux.js +29 -0
  5. package/dependencies.json +15 -0
  6. package/package.json +60 -6
  7. package/payload/DrumBuddy-Setup.exe +4 -0
  8. package/scripts/install.js +60 -0
  9. package/scripts/version.js +12 -0
  10. package/source/AssetBootstrap.cs +49 -0
  11. package/source/Audio Decoders.txt +230 -0
  12. package/source/Audio.cs +453 -0
  13. package/source/AudioDeviceSettings.cs +126 -0
  14. package/source/AudioEndpointWatcher.cs +25 -0
  15. package/source/AudioInputs.cs +50 -0
  16. package/source/AudioOutputs.cs +307 -0
  17. package/source/AudioWorkspace.cs +72 -0
  18. package/source/BrandArtwork.cs +71 -0
  19. package/source/Build Instructions.txt +65 -0
  20. package/source/Build.ps1 +135 -0
  21. package/source/ControlMode.cs +687 -0
  22. package/source/ControlTests.cs +88 -0
  23. package/source/ConversionFormats.cs +59 -0
  24. package/source/ConversionTests.cs +66 -0
  25. package/source/DockablePane.cs +95 -0
  26. package/source/DriverSetup.cs +28 -0
  27. package/source/EditorCompactLayout.cs +36 -0
  28. package/source/EditorPlaybackTests.cs +87 -0
  29. package/source/EditorSelectionTests.cs +73 -0
  30. package/source/EditorToolInteractions.cs +227 -0
  31. package/source/EditorTools.cs +78 -0
  32. package/source/EditorToolsTests.cs +93 -0
  33. package/source/EditorView.cs +798 -0
  34. package/source/Fetch-Dependencies.ps1 +15 -0
  35. package/source/FloatRecording.cs +99 -0
  36. package/source/FloatRecordingTests.cs +170 -0
  37. package/source/Flux-Logo.png +0 -0
  38. package/source/Flux-Mark.svg +49 -0
  39. package/source/FluxTempo Logo Prompt.txt +3 -0
  40. package/source/FluxTempo-Mark.svg +49 -0
  41. package/source/HomeView.cs +32 -0
  42. package/source/InterfaceSettings.cs +225 -0
  43. package/source/InterfaceTests.cs +172 -0
  44. package/source/LICENSE.txt +23 -0
  45. package/source/Logo Prompt.txt +16 -0
  46. package/source/Main.cs +787 -0
  47. package/source/Main.xaml +289 -0
  48. package/source/MediaPlayerView.cs +274 -0
  49. package/source/MidiControl.cs +113 -0
  50. package/source/MidiPerformance.cs +125 -0
  51. package/source/Mixer.cs +280 -0
  52. package/source/NativeMemory.cs +165 -0
  53. package/source/PanelFeedback.cs +75 -0
  54. package/source/PlaybackTests.cs +141 -0
  55. package/source/Quick Start.txt +96 -0
  56. package/source/SelfTest.cs +78 -0
  57. package/source/SettingsWindow.cs +209 -0
  58. package/source/Setup.cs +196 -0
  59. package/source/Setup.xaml +28 -0
  60. package/source/ShellStyles.xaml +99 -0
  61. package/source/TempoGrid.cs +95 -0
  62. package/source/TempoGridTests.cs +108 -0
  63. package/source/Third Party Notices.txt +33 -0
  64. package/source/Timeline.cs +268 -0
  65. package/source/TimelineGestures.cs +57 -0
  66. package/source/TimelineZoom.cs +21 -0
  67. package/source/Uninstall.cs +69 -0
  68. package/source/WaveformDetail.cs +104 -0
  69. package/source/WindowsAudioPlayer.cs +137 -0
  70. package/source/WorkspaceTests.cs +202 -0
  71. package/source/ZoomTests.cs +95 -0
  72. package/source/app.manifest +7 -0
  73. package/source/brand-archive/Drum-Buddy-Black-Hair.png +0 -0
  74. package/source/dependency-lock.json +62 -0
  75. package/source/fluxtempo-mark.png +0 -0
  76. package/source/logo.png +0 -0
  77. package/source/r16-panel.png +0 -0
  78. package/source/references/R16 Format Research.txt +16 -0
  79. package/test/package.test.js +55 -0
@@ -0,0 +1,135 @@
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 'Flux-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','Audio Decoders.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
+ # Use the current Flux mark for every executable/shortcut icon. The drummer
39
+ # artwork is retained separately in source/brand-archive.
40
+ Add-Type -AssemblyName System.Drawing
41
+ $image = [Drawing.Image]::FromFile((Join-Path $PSScriptRoot 'Flux-Logo.png'))
42
+ $sizes = @(16,24,32,48,64,128,256)
43
+ $iconImages = @()
44
+ foreach ($size in $sizes) {
45
+ $bitmap = New-Object Drawing.Bitmap($size,$size,[Drawing.Imaging.PixelFormat]::Format32bppArgb)
46
+ $graphics = [Drawing.Graphics]::FromImage($bitmap)
47
+ $graphics.Clear([Drawing.Color]::Transparent)
48
+ $graphics.InterpolationMode = [Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
49
+ $markBounds = New-Object Drawing.Rectangle(100,280,1050,800)
50
+ $scale = [Math]::Min($size / $markBounds.Width,$size / $markBounds.Height)
51
+ $w = [int]($markBounds.Width * $scale)
52
+ $h = [int]($markBounds.Height * $scale)
53
+ $destinationBounds = New-Object Drawing.Rectangle([int](($size-$w)/2),[int](($size-$h)/2),$w,$h)
54
+ $graphics.DrawImage($image,$destinationBounds,$markBounds,[Drawing.GraphicsUnit]::Pixel)
55
+ $memory = New-Object IO.MemoryStream
56
+ $bitmap.Save($memory,[Drawing.Imaging.ImageFormat]::Png)
57
+ $iconImages += ,$memory.ToArray()
58
+ $memory.Dispose()
59
+ $graphics.Dispose()
60
+ $bitmap.Dispose()
61
+ }
62
+ $image.Dispose()
63
+ $iconPath = Join-Path $BuildFolder 'DrumBuddy.ico'
64
+ $iconStream = [IO.File]::Create($iconPath)
65
+ $iconWriter = New-Object IO.BinaryWriter($iconStream)
66
+ $iconWriter.Write([uint16]0)
67
+ $iconWriter.Write([uint16]1)
68
+ $iconWriter.Write([uint16]$sizes.Count)
69
+ $offset = 6 + $sizes.Count * 16
70
+ for ($i=0; $i -lt $sizes.Count; $i++) {
71
+ $dimension = if ($sizes[$i] -eq 256) { 0 } else { $sizes[$i] }
72
+ $iconWriter.Write([byte]$dimension)
73
+ $iconWriter.Write([byte]$dimension)
74
+ $iconWriter.Write([byte]0)
75
+ $iconWriter.Write([byte]0)
76
+ $iconWriter.Write([uint16]1)
77
+ $iconWriter.Write([uint16]32)
78
+ $iconWriter.Write([uint32]$iconImages[$i].Length)
79
+ $iconWriter.Write([uint32]$offset)
80
+ $offset += $iconImages[$i].Length
81
+ }
82
+ foreach ($bytes in $iconImages) { $iconWriter.Write([byte[]]$bytes) }
83
+ $iconWriter.Dispose()
84
+
85
+ $standard = Get-ChildItem -LiteralPath (Join-Path $env:WINDIR 'Microsoft.NET\assembly\GAC_MSIL\netstandard') -Recurse -Filter netstandard.dll | Select-Object -First 1
86
+ if (!$standard) { throw '.NET Framework 4.8 netstandard facade is missing.' }
87
+ $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 $_) }
88
+ $refs += @('PresentationFramework.dll','PresentationCore.dll','WindowsBase.dll') | ForEach-Object { '/reference:' + (Join-Path $framework ('WPF\' + $_)) }
89
+ $refs += '/reference:' + $standard.FullName
90
+ $refs += Get-ChildItem -LiteralPath $package -Filter '*.dll' | ForEach-Object { '/reference:' + $_.FullName }
91
+ $common = @('/nologo','/target:winexe','/platform:x64','/optimize+','/utf8output',('/win32manifest:' + (Join-Path $PSScriptRoot 'app.manifest')),('/win32icon:' + $iconPath))
92
+ $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 $_ })
93
+ $appArgs += '/resource:' + (Join-Path $PSScriptRoot 'ShellStyles.xaml') + ',ShellStyles.xaml'
94
+ $appArgs += '/resource:' + (Join-Path $PSScriptRoot 'Flux-Mark.svg') + ',Flux-Mark.svg'
95
+ $appArgs += Join-Path $PSScriptRoot 'BrandArtwork.cs'
96
+ $appArgs += @('TimelineZoom.cs','WaveformDetail.cs','ZoomTests.cs') | ForEach-Object { Join-Path $PSScriptRoot $_ }
97
+ $appArgs += @('WindowsAudioPlayer.cs','AudioEndpointWatcher.cs') | ForEach-Object { Join-Path $PSScriptRoot $_ }
98
+ $appArgs += Join-Path $PSScriptRoot 'EditorPlaybackTests.cs'
99
+ $appArgs += Join-Path $PSScriptRoot 'EditorSelectionTests.cs'
100
+ $appArgs += @('EditorTools.cs','EditorToolInteractions.cs') | ForEach-Object { Join-Path $PSScriptRoot $_ }
101
+ $appArgs += Join-Path $PSScriptRoot 'EditorToolsTests.cs'
102
+ $appArgs += Join-Path $PSScriptRoot 'EditorCompactLayout.cs'
103
+ & $compiler @appArgs
104
+ if ($LASTEXITCODE -ne 0) { throw 'App compilation failed.' }
105
+ $iconVersion = [Reflection.AssemblyName]::GetAssemblyName((Join-Path $package 'DrumBuddy.exe')).Version.ToString(3)
106
+ Copy-Item -LiteralPath $iconPath -Destination (Join-Path $package ('Flux-' + $iconVersion + '.ico')) -Force
107
+ @'
108
+ <?xml version="1.0" encoding="utf-8"?>
109
+ <configuration><startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup><runtime><AppContextSwitchOverrides value="Switch.System.Windows.DoNotScaleForDpiChanges=false"/></runtime></configuration>
110
+ '@ | Set-Content -LiteralPath (Join-Path $package 'DrumBuddy.exe.config') -Encoding UTF8
111
+ if ($AppOnly) { Write-Output ('Built app: ' + (Join-Path $package 'DrumBuddy.exe')); return }
112
+ $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'))
113
+ & $compiler @uninstallArgs
114
+ if ($LASTEXITCODE -ne 0) { throw 'Uninstaller compilation failed.' }
115
+
116
+ Add-Type -AssemblyName System.IO.Compression.FileSystem
117
+ $payload = Join-Path $BuildFolder 'payload.zip'
118
+ if (Test-Path -LiteralPath $payload) { Remove-Item -LiteralPath $payload }
119
+ [IO.Compression.ZipFile]::CreateFromDirectory($package,$payload,[IO.Compression.CompressionLevel]::Optimal,$false)
120
+ $manifest = Get-ChildItem -LiteralPath $package -Recurse -File | ForEach-Object {
121
+ $relative = $_.FullName.Substring($package.Length + 1).Replace('\','/')
122
+ (Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash + ' ' + $relative
123
+ }
124
+ $manifestPath = Join-Path $BuildFolder 'payload.sha256'
125
+ [IO.File]::WriteAllLines($manifestPath,[string[]]$manifest,(New-Object Text.UTF8Encoding($false)))
126
+ $setupRefs = $refs | Where-Object { $_ -notmatch 'NAudio|Microsoft.Win32.Registry|System.Security' }
127
+ $setupRefs += '/reference:' + (Join-Path $framework 'System.IO.Compression.dll')
128
+ $setupRefs += '/reference:' + (Join-Path $framework 'System.IO.Compression.FileSystem.dll')
129
+ $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 'Flux-Logo.png') + ',Flux-Logo.png'),(Join-Path $PSScriptRoot 'Setup.cs'),(Join-Path $PSScriptRoot 'DriverSetup.cs'),(Join-Path $PSScriptRoot 'AssetBootstrap.cs'))
130
+ $setupArgs += '/resource:' + (Join-Path $PSScriptRoot 'Flux-Mark.svg') + ',Flux-Mark.svg'
131
+ $setupArgs += Join-Path $PSScriptRoot 'BrandArtwork.cs'
132
+ & $compiler @setupArgs
133
+ if ($LASTEXITCODE -ne 0) { throw 'Installer compilation failed.' }
134
+ Write-Output ('Built app: ' + (Join-Path $package 'DrumBuddy.exe'))
135
+ Write-Output ('Built installer: ' + (Join-Path $BuildFolder 'DrumBuddy-Setup.exe'))