launch-bristol 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/bin/sh
  2. # launch-bristol.sh - by B. Watson <yalhcru@gmail.com>, licensed
  3. # under the WTFPL. Part of the SlackBuilds.org bristol build.
  4. # Simple KDialog-based launcher for Bristol synth. Bristol is a
  5. # GUI application once it's running, but it emulates 40+ different
  6. # synths, and the only way to choose the synth is by passing an
  7. # argument to startBristol (e.g. -mini or -prophet).
  8. # We want to be able to launch it from a .desktop file, which means
  9. # one of three things:
  10. # 1. The .desktop file would have a synth type hardcoded, other emulations
  11. # would require CLI startup.
  12. # 2. There would have to be 40+ .desktop files, one per synth type (ugh).
  13. # 3. The .desktop file would launch some kind of selector to let the user
  14. # pick the synth type. That's what this script is for.
  15. # This works, but doesn't offer a way to set any of the other CLI
  16. # options. We have "-jack" hardcoded here, since I doubt many people
  17. # ever use "-alsa" with bristol...
  18. # If this file exists, it contains the last choice the user made,
  19. # last time this script was run and its OK button pressed.
  20. # Pressing Cancel doesn't create or alter this file.
  21. file=~/.launch-bristol
  22. # This is more complex than it should be, because kdialog's --default
  23. # option requires the *text* of the selected item (e.g. 'moog mini'),
  24. # but kdialog doesn't print this text (it prints the ID of the option,
  25. # e.g. '-mini'). So this script greps itself to find the item text
  26. # that goes with the saved item ID.
  27. if [ -e $file ]; then
  28. dflt="$( cat $file )"
  29. dflttxt="$( grep "^ $dflt" $0 | cut -d"'" -f2 )"
  30. else
  31. dflttxt='hammond B3 (default)'
  32. fi
  33. # Try to center the window. Unfortunately kdialog's not smart enough
  34. # to auto-size, I have to hardcode a width and height to avoid having
  35. # a tiny window that requires a ton of scrolling. Also I have no idea
  36. # how (or if) the font and font-size are chosen...
  37. xpos=0; ypos=0
  38. width=400; height=800
  39. x="$( xwininfo -root | grep Width | sed 's,.* ,,' )"
  40. y="$( xwininfo -root | grep Height | sed 's,.* ,,' )"
  41. if [ "$x" -gt "$width" -a "$y" -gt "$height" ]; then
  42. xpos=$(( $x / 2 - $width / 2 ))
  43. ypos=$(( $y / 2 - $height / 2 ))
  44. fi
  45. # The list of synths came from "startBristol --help".
  46. kdialog --title 'Bristol Launcher' --menu 'Select Synth Emulation' \
  47. --geometry ${width}x${height}+${xpos}+${ypos} \
  48. --default "$dflttxt" -- \
  49. -b3 'hammond B3 (default)' \
  50. -mini 'moog mini' \
  51. -explorer 'moog voyager' \
  52. -voyager 'moog voyager electric blue' \
  53. -memory 'moog memory' \
  54. -sonic6 'moog sonic 6' \
  55. -mg1 'moog/realistic mg-1 concertmate' \
  56. -hammond 'hammond module (deprecated, use -b3)' \
  57. -prophet 'sequential circuits prophet-5' \
  58. -pro52 'sequential circuits prophet-5/fx' \
  59. -pro10 'sequential circuits prophet-10' \
  60. -pro1 'sequential circuits pro-one' \
  61. -rhodes 'fender rhodes mark-I stage 73' \
  62. -rhodesbass 'fender rhodes bass piano' \
  63. -roadrunner 'crumar roadrunner electric piano' \
  64. -bitone 'crumar bit 01' \
  65. -bit99 'crumar bit 99' \
  66. -bit100 'crumar bit + mods' \
  67. -stratus 'crumar stratus synth/organ combo' \
  68. -trilogy 'crumar trilogy synth/organ/string combo' \
  69. -obx 'oberheim OB-X' \
  70. -obxa 'oberheim OB-Xa' \
  71. -axxe 'arp axxe' \
  72. -odyssey 'arp odyssey' \
  73. -arp2600 'arp 2600' \
  74. -solina 'arp/solina string ensemble' \
  75. -polysix 'korg polysix' \
  76. -poly800 'korg poly-800' \
  77. -monopoly 'korg mono/poly' \
  78. -ms20 'korg ms20 (unfinished: -libtest only)' \
  79. -vox 'vox continental' \
  80. -voxM2 'vox continental super/300/II' \
  81. -juno 'roland juno-60' \
  82. -jupiter 'roland jupiter-8' \
  83. -bme700 'baumann bme-700' \
  84. -bm 'bristol bassmaker sequencer' \
  85. -dx 'yamaha dx-7' \
  86. -cs80 'yamaha cs-80 (unfinished)' \
  87. -sidney 'commodore-64 SID chip synth' \
  88. -melbourne 'commodore-64 SID polysynth (unfinished)' \
  89. -granular 'granular synthesiser (unfinished)' \
  90. -aks 'ems synthi-a (unfinished)' \
  91. -mixer '16 track mixer (unfinished: -libtest only)' \
  92. > $file.new
  93. opt="$( cat $file.new )"
  94. if [ "$opt" = "" ]; then
  95. rm -f $file.new
  96. exit 0
  97. fi
  98. mv $file.new $file
  99. if [ "$1" = "--fake" ]; then
  100. echo "exec startBristol -jack $opt"
  101. else
  102. exec startBristol -jack $opt
  103. fi