commit 4662efaf2ade3e85e763ac24e2fe4e951acdb35e parent 78a897e596ecb995acfc2b3e6ca33b042efb46a4 Author: Matt Demanett <matt@demanett.net> Date: Wed, 12 Aug 2020 22:48:07 -0400 Update scripts for screenshots to support skins; add documentation and screenshots for skins to REAMDE; add RGate to screenshots. Diffstat:
34 files changed, 149 insertions(+), 17 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -42,3 +42,4 @@ scatter scatter.* lldb.cmd !test/* +doc/module_screenshots/ diff --git a/README.md b/README.md @@ -32,6 +32,13 @@ Some modules have expanders; see <a href="#expanders">notes on expanders</a>.  +The modules have two <a href="#alternate_panels">alternate panel designs</a>, "Dark": + + + +And "Dark {low-contrast)": + + ## Builds/Releases @@ -1088,6 +1095,23 @@ Rack allows left expanders as well as right, but to simplify things we've chosen Some expanders may be chainable: multiple instances can be added to continue expanding the base. In this case, the expanders must all be to the right of the base, and all touching. +## <a name="alternate_panels"></a> Alternate Panels + + + +There are three sets of alternate panels for the modules: + - Light + - Dark + - Dark (low-contrast) + +For nearly all modules (ANALYZER-XL is an exception), the panel to use can be set on the module's "Panel" context menu. Also, a global default can be set for the plugin, with the "Default to..." panel menu options. + +When new modules are added to a patch, they are set to use the default panel design (which is Light, unless the default has been changed to something else). When the default is changed, all modules set to use the default panels will update. + +The default panel set is used when the modules are displayed in Rack's module browser (though, the module browser may not update immediately when the default changes; restarting Rack will force it to). + +When a new default panel set is selected, the module places a file named `Bogaudio.json` in your Rack user directory (e.g. `~/Documents/Rack` on Mac), to save the preference. + ## Other Notes #### <a name="resumeloop"></a> Loop Behavior on Patch Load diff --git a/doc/www/alternate_panels.png b/doc/www/alternate_panels.png Binary files differ. diff --git a/doc/www/dynamics.png b/doc/www/dynamics.png Binary files differ. diff --git a/doc/www/envelopes1.png b/doc/www/envelopes1.png Binary files differ. diff --git a/doc/www/envelopes2.png b/doc/www/envelopes2.png Binary files differ. diff --git a/doc/www/envelopes3.png b/doc/www/envelopes3.png Binary files differ. diff --git a/doc/www/filters.png b/doc/www/filters.png Binary files differ. diff --git a/doc/www/lfos.png b/doc/www/lfos.png Binary files differ. diff --git a/doc/www/mixers1.png b/doc/www/mixers1.png Binary files differ. diff --git a/doc/www/mixers2.png b/doc/www/mixers2.png Binary files differ. diff --git a/doc/www/mixers3.png b/doc/www/mixers3.png Binary files differ. diff --git a/doc/www/mixers4.png b/doc/www/mixers4.png Binary files differ. diff --git a/doc/www/modules1.png b/doc/www/modules1.png Binary files differ. diff --git a/doc/www/modules2.png b/doc/www/modules2.png Binary files differ. diff --git a/doc/www/modules3.png b/doc/www/modules3.png Binary files differ. diff --git a/doc/www/modules4.png b/doc/www/modules4.png Binary files differ. diff --git a/doc/www/modules5.png b/doc/www/modules5.png Binary files differ. diff --git a/doc/www/noise.png b/doc/www/noise.png Binary files differ. diff --git a/doc/www/oscillators1.png b/doc/www/oscillators1.png Binary files differ. diff --git a/doc/www/oscillators2.png b/doc/www/oscillators2.png Binary files differ. diff --git a/doc/www/parametric_eqs.png b/doc/www/parametric_eqs.png Binary files differ. diff --git a/doc/www/pitch.png b/doc/www/pitch.png Binary files differ. diff --git a/doc/www/poly1.png b/doc/www/poly1.png Binary files differ. diff --git a/doc/www/poly2.png b/doc/www/poly2.png Binary files differ. diff --git a/doc/www/sequencers1.png b/doc/www/sequencers1.png Binary files differ. diff --git a/doc/www/sequencers2.png b/doc/www/sequencers2.png Binary files differ. diff --git a/doc/www/skin-dark.png b/doc/www/skin-dark.png Binary files differ. diff --git a/doc/www/skin-lowcontrast.png b/doc/www/skin-lowcontrast.png Binary files differ. diff --git a/doc/www/utilities.png b/doc/www/utilities.png Binary files differ. diff --git a/doc/www/vcas.png b/doc/www/vcas.png Binary files differ. diff --git a/doc/www/visualizers.png b/doc/www/visualizers.png Binary files differ. diff --git a/scripts/make_module_screenshsots.rb b/scripts/make_module_screenshsots.rb @@ -0,0 +1,80 @@ +#!/usr/bin/env ruby + +require 'fileutils' + +base_dir = File.absolute_path(File.join(File.dirname($0), '..')) + +skins = ['default'] +Dir.glob(File.join(base_dir, 'res-src', 'skin-*.css')).each do |fn| + if File.basename(fn) =~ /^skin-(\w+).css$/ + skins << $1 + end +end + +screens_dir = File.join(base_dir, 'doc', 'module_screenshots') +if Dir.exist?(screens_dir) + skins.each do |skin| + skin_dir = File.join(screens_dir, skin) + if Dir.exist?(skin_dir) + puts "Deleting #{skin_dir}..." + FileUtils.rm_rf(skin_dir) + end + end +else + puts "Creating #{screens_dir}..." + FileUtils.mkdir(screens_dir) +end + +rack_dir = File.absolute_path(File.join(base_dir, '..', '..')) +prefs_file = File.join(rack_dir, 'Bogaudio.json') +backup_prefs_file = File.join(rack_dir, 'Bogaudio.json.bak') +if File.exist?(prefs_file) + puts "Backing up #{prefs_file} to #{backup_prefs_file}..." + File.write(backup_prefs_file, File.read(prefs_file)) +end + +rack_output_dir = File.join(rack_dir, 'screenshots', 'Bogaudio') +skins.each do |skin| + if Dir.exist?(rack_output_dir) + puts "Deleting #{rack_output_dir}..." + FileUtils.rm_rf(rack_output_dir) + end + + puts "Generating screens for skin #{skin}..." + if skin == 'default' + FileUtils.rm_f(prefs_file) + else + File.write(prefs_file, %Q|{ "skins": { "default": "#{skin}" } }|) + end + + FileUtils.cd(rack_dir) + out = `./Rack -d -t 1 Bogaudio 2>&1` + unless $?.success? + STDERR.puts "Calling Rack failed:\n#{out}" + exit 1 + end + + unless Dir.exist?(rack_output_dir) && File.readable?(File.join(rack_output_dir, 'Bogaudio-ADSR.png')) + STDERR.puts "Rack produced no screenshots? Check #{rack_output_dir}...\nRack output was:\n#{out}" + exit 1 + end + + skin_dir = File.join(screens_dir, skin) + unless Dir.exist?(skin_dir) + puts "Creating #{skin_dir}..." + FileUtils.mkdir(skin_dir) + end + + puts "Copying screens to #{skin_dir}..." + count = 0 + Dir.glob(File.join(rack_output_dir, '*.png')).each do |fn| + count += 1 + out_fn = File.join(skin_dir, File.basename(fn).sub(/^Bogaudio-/, '')) + FileUtils.cp(fn, out_fn) + end + puts "...copied #{count}" +end + +puts "Restoring #{prefs_file}, deleting backup..." +File.write(prefs_file, File.read(backup_prefs_file)) +FileUtils.rm_f(backup_prefs_file) diff --git a/scripts/make_screenshots.rb b/scripts/make_screenshots.rb @@ -1,9 +1,8 @@ #!/usr/bin/env ruby -# To reggenerate README screenshots: -# 1. rm -rf ../../screenshots/Bogaudio/ -# 2. (cd ../.. && ./Rack -d -t 1 Bogaudio) -# 3. ./scripts/make_screenshots.rb ../../screenshots/Bogaudio +# To reggenerate screenshots: +# 1. Extract module screenshots from Rack: ./scripts/make_module_screenshots.rb +# 2. Make composite screenshots for README: ./scripts/make_screenshots.rb screens = [ { @@ -20,7 +19,7 @@ screens = [ rows: [ ['VCF', 'LVCF', 'FFB', 'EQ', 'EQS'], ['PEQ', 'PEQ6', 'PEQ6XF', 'PEQ14', 'PEQ14XF'], - ['DADSRH', 'DADSRHPlus', 'Shaper', 'ShaperPlus', 'AD', 'ASR', 'ADSR', 'Follow', 'DGate', 'Edge'] + ['DADSRH', 'DADSRHPlus', 'Shaper', 'ShaperPlus', 'AD', 'ASR', 'ADSR', 'Follow', 'DGate', 'RGate', 'Edge'] ] }, { @@ -52,6 +51,27 @@ screens = [ }, { + file: 'skin-dark.png', + crop: false, + rows: [ + ['VCO', 'XCO', 'FMOp', 'Walk2', 'VCF', 'DADSRH', 'FFB', 'SampleHold', 'Pan'], + ['Mix4', 'AddrSeq', 'Pgmr', 'Switch44', 'Analyzer', 'Pressor', 'Offset', 'Blank6'] + ], + skin: 'dark', + nopad: true + }, + { + file: 'skin-lowcontrast.png', + crop: false, + rows: [ + ['VCO', 'XCO', 'FMOp', 'Walk2', 'VCF', 'DADSRH', 'FFB', 'SampleHold', 'Pan'], + ['Mix4', 'AddrSeq', 'Pgmr', 'Switch44', 'Analyzer', 'Pressor', 'Offset', 'Blank6'] + ], + skin: 'lowcontrast', + nopad: true + }, + + { file: 'oscillators1.png', crop: true, rows: [ @@ -104,7 +124,7 @@ screens = [ file: 'envelopes3.png', crop: true, rows: [ - ['DGate', 'Edge'] + ['DGate', 'RGate', 'Edge'] ] }, { @@ -218,21 +238,22 @@ HP = 15 PAD_EDGE = 1 * HP PAD_MODULE = 1 * HP PAD_GROUP = 3 * HP -OUT_DIR = './doc/www' BACKGROUND_FILE = './doc/rack_background.png' # require 'chunky_png' require 'oily_png' require 'pp' -screens_dir = ARGV[0] -if screens_dir.nil? - STDERR.puts "Usage: #{$0}: <rack screenshot output directory for plugin>" +base_dir = File.absolute_path(File.join(File.dirname($0), '..')) +screens_dir = File.join(base_dir, 'doc', 'module_screenshots') +unless Dir.exists?(screens_dir) + STDERR.puts "No screenshots directory: #{screens_dir}\nMake it with ./scripts/make_module_screenshots.rb" exit 1 end +out_dir = File.join(base_dir, 'doc', 'www') unless Dir.exists?(screens_dir) - STDERR.puts "No such screenshots directory: #{screens_dir}" + STDERR.puts "No output directory: #{out_dir}" exit 1 end @@ -253,6 +274,10 @@ end screens.each do |screen| next unless screen + unless screen.key?(:skin) + screen[:skin] = 'default' + end + rows = screen[:rows] out = background_for_rows(rows.size) x = 0 @@ -260,22 +285,24 @@ screens.each do |screen| x = PAD_EDGE row.each_with_index do |item, j| if item == '-' - x += PAD_GROUP - x -= PAD_MODULE if j > 0 + unless screen[:nopad] + x += PAD_GROUP + x -= PAD_MODULE if j > 0 + end else - image = ChunkyPNG::Image.from_file(File.join(screens_dir, "Bogaudio-#{item}.png")) + image = ChunkyPNG::Image.from_file(File.join(screens_dir, screen[:skin], "#{item}.png")) out.compose!(image, x, i * $row_background.dimension.height) x += image.dimension.width - x += PAD_MODULE + x += PAD_MODULE unless screen[:nopad] end end - x -= PAD_MODULE if rows.last.size > 0 + x -= PAD_MODULE if rows.last.size > 0 && !screen[:nopad] x += PAD_EDGE end out.crop!(0, 0, x, out.dimension.height) if screen[:crop] - file = File.join(OUT_DIR, screen[:file]) + file = File.join(out_dir, screen[:file]) out.save(file) puts "wrote #{file}" # system("open #{file}")