; Change_PSA_Settings
; $VER: 1.5
; by Floyd Diebel/EMRL for Maurizio Ciccione/Audiolabs
;
; History
;
; v1.5 [14Feb00]
;	* Brought inline with PSA v3 features.
;	* Now protects original icon settings.  
;	* Happy valentines' day.
; 
; v1.3 [17Nov99]
;       * Fixed a few bugs in checking CD access.  Thanks to Frank
;         Moreno for finding the problems.
;
; v1.2 [9Nov99]
;       * Brought in line with the Installer options
;
; v1.1 [11Oct99]
;       * Fixed CGFX_DEPTH options
;       * Added DRIVER_PRI option
;
; v1.0 [04Jul99]
;       * First release

(onerror 
    (cleanup)
    )

(procedure cleanup
            (run "copy ProStationAudio_OLD.info ProStationAudio.info") 
            (run "delete ProStationAudio_OLD.info")
    )

(procedure alldone
            (run "delete ProStationAudio_OLD.info")
    )

(set #bad-installer ("You need at least Installer v42.9.  Check your  ProstationAudio distribution ")
            )

(set #noicon "\n\nThe software could not find the needed files.\nPlease make sure you are running this program from within the same drawer as ProStationAudio; check your software installation and try again.")

(set #whereisPSA  "Where is ProStationAudio located? ")

(set #audio (cat "Select Audio Driver"
                "\n\n"
                "Select the audio driver that corresponds with the hardware in your system. "
                "\n"
                "You will need your ProStationAudio Application CD ready."
                "\n")
            )

(set #drvpri (cat "Increase Driver Priority?"
                  "\n\n"
                  "This feature gives more of your system's resources to "
                  "your audio driver. "
                  "It is recommended you disable this feature, unless you are "
                  "experiencing problems with timing and sync."
                  "\n")
            )

(set #invert (cat "Invert Stereo Output?"
                  "\n\n"
                  "This feature inverts the L/R channel output.  Some hardware "
                  "requires this. "
                  "It is recommended you disable this feature, unless your "
                  "soundcard specifically demands it."
                  "\n")
            )

(set #dma (cat  "Use Fast DMA?"
                "\n\n"
                "This option is only valid when using the SoftMary driver for "
                "the built-in Amiga audio (Paula). "
                "This feature allows the internal audio subsystem to work "
                "at the nominal rate (1:1).  Normally, the audio is subsampled "
                "(2:1).  A 31khz screen is required for this option to work. "
                "\n")
            )

(set #ppc (cat "Use PowerPC?"
                "\n\n"
                "ProStationAudio can take advantage of the Motorola PowerPC "
                "CPU present in this system."
                "\n"
                "Make sure you have ppc.library v46.0 or higher installed.  "
                "\n")
            )

(set #vmm (cat "Virtual Memory Configuration"
                "\n\n"
                "This setting controls the amount of memory allocated to the "
                "virtual memory manager, and influences the amount of tracks that can be "
                "played in realtime.  "
                "\n")
            )

(set #dual (cat "Use Dual Monitors?"
                "\n\n"
                "Would you like ProStationAudio to open on dual monitors? "
                "You'll need two graphics cards, or one card and the onboard "
                "chipset. "
                "\n")
            )

(set #graph (cat "Optimize for Graphics Cards?"
                "\n\n"
                "This setting optimizes PSA for use with graphics cards.  "
                "DO NOT enable this setting if you do not "
                "have a graphics board. "
                "\n")
            )

(set #scr (cat "Show Screen Selector?"
                "\n\n"
                "Would you like ProStationAudio to open a screen selector "
                "at startup?  "
                "PSA supports drivers for every OS compliant retargetable "
                "graphic system."
                "\n")
            )

(set #wgfx (cat "Enable High-Resolution Waveform Graphics?"
                "\n\n"
                "Would you like ProStationAudio to save detailed waveform "
                "graphics inside AudioLabs Support Files?  "
                "Recommended for all systems."
                "\n")
            )

(set #back (cat "Enable Backdrop?"
                "\n\n"
                "This setting can enable/disable the use of PSA's decorative "
                "screen backdrop. "
                "On systems without graphics cards, it is recommended you "
                "disable this feature, as this will save chip ram."
                "\n")
            )

(set #pri (cat "Set Task Priority"
                "\n\n"
                "What should ProStationAudio's Task Priority be? "
                "\n")
            )

(set #cmem (cat "Set ProStationAudio's Allocated Memory"
                "\n\n"
                "This setting influences the maximum size allowed for a session "
                "to be played or mixed to disc.  It doesn't influence the size of "
                "the session itself, you can add as many objects as your free "
                "memory permits."
                "\n")
            )

(set #acct (cat "Define PSA's Accounting Threshold"
                  "\n\n"
                  "This option can filter out (from PSA's accounting reports) operations "
                  "shorter that a preferred amount of minutes.  See your documentation "
                  "for more information on PSA's accounting system."
                  "\n")
            )


; Begin

(message "\n\n\nProStationAudio Configuration Utility.\n\n"
                "This utility allows for easy manipulation of PSA's "
                "many configuration options.  Please see your "
                "documentation for more details."
                "\n\n"
                )

(set name (cat "ProStationAudio") )

;(

;(set Name (askfile (prompt #whereisPSA)
;                        (help   #whereisPSA)
;                        (default "/ /ProStationAudio")
;       )
;   )
;)

(if (< (exists (cat Name ".info")) 1) (abort #noicon) )
(run "copy " (cat Name ".info")  (cat Name "_old.info") )

(tooltype (dest Name)

        (settooltype "OUT_DRIVER")
        (settooltype "DRIVER_PRI")
        (settooltype "INVERT_STEREO")
        (settooltype "PAULAFASTDMA")
        (settooltype "USE_PPC_POWERUP")
        (settooltype "VMM_BUFFERS")
        (settooltype "DUAL_MONITOR")
        (settooltype "CGFX_DEPTH")
        (settooltype "CGFX_DEPTH2")
        (settooltype "SHOW_SCR_SELECTOR")
        (settooltype "IMPORT_PATH")
        (settooltype "ULTRA_WGFX")
        (settooltype "NOBACKDROP")
        (settooltype "INVERT_STEREO")
        (settooltype "TASKPRI")
        (settooltype "C_MEM_MODEL")
        (settooltype "ACCOUNT_THRESHOLD")
; again for good measure.
        (settooltype "OUT_DRIVER")
        (settooltype "DRIVER_PRI")
        (settooltype "INVERT_STEREO")
        (settooltype "PAULAFASTDMA")
        (settooltype "USE_PPC_POWERUP")
        (settooltype "VMM_BUFFERS")
        (settooltype "DUAL_MONITOR")
        (settooltype "CGFX_DEPTH")
        (settooltype "CGFX_DEPTH2")
        (settooltype "SHOW_SCR_SELECTOR")
        (settooltype "IMPORT_PATH")
        (settooltype "ULTRA_WGFX")
        (settooltype "NOBACKDROP")
        (settooltype "INVERT_STEREO")
        (settooltype "TASKPRI")
        (settooltype "C_MEM_MODEL")
        (settooltype "ACCOUNT_THRESHOLD")
; better do it once more.
        (settooltype "OUT_DRIVER")
        (settooltype "DRIVER_PRI")
        (settooltype "INVERT_STEREO")
        (settooltype "PAULAFASTDMA")
        (settooltype "USE_PPC_POWERUP")
        (settooltype "VMM_BUFFERS")
        (settooltype "DUAL_MONITOR")
        (settooltype "CGFX_DEPTH")
        (settooltype "CGFX_DEPTH2")
        (settooltype "SHOW_SCR_SELECTOR")
        (settooltype "IMPORT_PATH")
        (settooltype "ULTRA_WGFX")
        (settooltype "NOBACKDROP")
        (settooltype "INVERT_STEREO")
        (settooltype "TASKPRI")
        (settooltype "C_MEM_MODEL")
        (settooltype "ACCOUNT_THRESHOLD")
; better do it once more.
        (settooltype "OUT_DRIVER")
        (settooltype "DRIVER_PRI")
        (settooltype "INVERT_STEREO")
        (settooltype "PAULAFASTDMA")
        (settooltype "USE_PPC_POWERUP")
        (settooltype "VMM_BUFFERS")
        (settooltype "DUAL_MONITOR")
        (settooltype "CGFX_DEPTH")
        (settooltype "CGFX_DEPTH2")
        (settooltype "SHOW_SCR_SELECTOR")
        (settooltype "IMPORT_PATH")
        (settooltype "ULTRA_WGFX")
        (settooltype "NOBACKDROP")
        (settooltype "INVERT_STEREO")
        (settooltype "TASKPRI")
        (settooltype "C_MEM_MODEL")
        (settooltype "ACCOUNT_THRESHOLD")
    )
(

(set audio (askchoice (choices  "DelfinInOut"
                                "DelfinaOut"
                                "PreludeOut"
                                "ToccataOut"
                                "MaestroOut"
                                "SoundStageOut"
                                "AHIInOut"
                                "SoftMary (Paula)"
                        (prompt #audio)
                        (help   "ProStationAudio supports a number of Amiga soundcards with external drivers.  These drivers are"
                                "\n"
                                "available from http://www.audiolabs.it/files, and should be installed in the 'Drivers' drawer in PSA's root directory. "
                                "\n\n\n"
                                "Available drivers include the following : "
                                "\n\n"
                                "SoftMary  -  for the Amiga's built-in audio.  This driver is internal to PSA - no external files are needed."
                                "\n\n"
                                "DelfinaInOut  -  for Petsoff's Delfina Classic, Lite, or Plus.  This is a record/playback driver."
                                "\n\n"
                                "DelfinaOut  -  for Petsoff's Delfina Classic, Lite, or Plus.  This is a playback driver."
                                "\n\n"
                                "PreludeOut  -  for ACT's Prelude.  This is a playback driver."
                                "\n\n"
                                "ToccataOut  -  for MacroSystem's Toccata.  This is a playback driver.  Use this driver if you have a Draco Workstation."
                                "\n\n"
                                "MaestroOut  -  for MacroSystem's Maestro.  This is a playback driver."
                                "\n\n"
                                "SoundStageOut - for Applied Magic's SoundStage card.  This is a playback driver."
                                "\n\n"
                                "AHIInOut - for the AHI system.  Allows PSA to use any supported audio hardware."
                                "\n\n")
                        )
                )
        )


(tooltype       (dest Name)
                        (if (= audio 0) (settooltype "OUT_DRIVER" "DelfinaOut") )
                        (if (= audio 1) (settooltype "OUT_DRIVER" "DelfinaOut") )
                        (if (= audio 2) (settooltype "OUT_DRIVER" "PreludeOut") )
                        (if (= audio 3) (settooltype "OUT_DRIVER" "ToccataOut") )
                        (if (= audio 4) (settooltype "OUT_DRIVER" "MaestroOut") )
                        (if (= audio 5) (settooltype "OUT_DRIVER" "SoundStageOut") )
                        (if (= audio 6) (settooltype "OUT_DRIVER" "AHIOut") )
                        (if (= audio 7) (settooltype "OUT_DRIVER" )
                )
        )

(copyfiles
        (dest (cat "Drivers" ) )
                        (if (= audio 0) (source "ProStationAudio:PSA_Archives/drivers/DelfinaInOut" ) )
                        (if (= audio 1) (source "ProStationAudio:PSA_Archives/drivers/DelfinaOut" ) )
                        (if (= audio 2) (source "ProStationAudio:PSA_Archives/drivers/PreludeOut" ) )
                        (if (= audio 3) (source "ProStationAudio:PSA_Archives/drivers/ToccataOut" ) )
                        (if (= audio 4) (source "ProStationAudio:PSA_Archives/drivers/MaestroOut" ) )
                        (if (= audio 5) (source "ProStationAudio:PSA_Archives/drivers/SoundStageOut" ) )
                        (if (= audio 6) (source "ProStationAudio:PSA_Archives/drivers/AHIInOut" ) )
                        (if (= audio 7) (source "ProStationAudio:PSA_Archives/drivers/null" )
                )

        )
)

(set drvpri (askchoice (choices    "Disable Boosting Audio Driver Priority"
                                   "Enable Boosting Audio Driver Priority"
                         (prompt #drvpri)
                         (help "If you are experiencing sync problems with you audio, enable this feature.  It will boot the task prioirty of your audio output. ")
                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype (dest Name)
                        (if (= drvpri 0) (settooltype "DRIVER_PRI") )
                        (if (= drvpri 1) (settooltype "DRIVER_PRI" "" )

        )
)

(set invrt (askchoice (choices    "Disable Stereo Invert"
                                   "Enable Stereo Invert"
                         (prompt #invert)
                         (help "Some sound hardware has a problem with inverting its L/R channels.  This option will re-invert the channels, thereby fixing the problem.  The Delfina Lite is one such card. ")

                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype (dest Name)
                        (if (= invrt 0) (settooltype "INVERT_STEREO" ) )
                        (if (= invrt 1) (settooltype "INVERT_STEREO" "" )

        )
)

(set paula (askchoice (choices     "Disable Fast DMA"
                                   "Enable Fast DMA"
                         (prompt #dma)
                         (help "Enabling Fast DMA will give better results when using the SoftMary driver.  Note that a 31khz screen driver is REQUIRED for using this feature.  Do not enable this feature if using an external audio driver.")
                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype (dest Name)
                        (if (= paula 0) (settooltype "PAULAFASTDMA" ) )
                        (if (= paula 1) (settooltype "PAULAFASTDMA" "" )

        )
)

(set ppc (askchoice (choices    "Disable PowerPC Code"
                                "Enable PowerPC Code"
                         (prompt #ppc)
                         (help "Pretty self-explanatory.  If you have a PPC processor, enable this feature, as it will give you smoother operation and greater track playback.")
                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype (dest Name)
                        (if (= ppc 0) (settooltype "USE_PPC_POWERUP" ) )
                        (if (= ppc 1) (settooltype "USE_PPC_POWERUP" "" )

        )
)


(set vmm (askchoice (choices    "Small (16mb Systems)"
                                "Medium (32mb Systems)"
                                "Large (64mb+ Systems)"
                         (prompt #vmm)
                         (help "Use this feature to control the amount of memory allocated to PSA's virtual memory manager.  This setting influences the amount of tracks that can be played in realtime.  Increasing the amount of memory allocated allows to handle more tracks at once but also increases the delay between the instant you issue the PLAY command and the time the system actually starts playing."
                               "\n\n"
                               "With the maximum setting, the VMM consumes 16MB RAM."
                           )
                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype       (dest Name)
                        (if (= vmm 0) (settooltype "VMM_BUFFERS" "SMALL") )
                        (if (= vmm 1) (settooltype "VMM_BUFFERS" "MEDIUM") )
                        (if (= vmm 2) (settooltype "VMM_BUFFERS" "LARGE")

        )
)
(set dual (askchoice (choices    "Disable Dual Monitors"
                                 "Enable Dual Monitors"
                         (prompt #dual)
                         (help  "Enable this feature if you want PSA to open on two monitors at once.  The Timeline and Transport controls will open on one screen, and the Mixer Console and Plugins will open on the second screen."
                                "\n\n"
                                "You'll need two graphic cards, or just one card and the onboard chipset.  When using the dual monitor option, PSA will try to close the Workbench in order to make screen swapping more comfortable."
                                "\n\n\n"
                                "NOTE: OS3.x has a bug that prevents the Workbench from opening after it gets closed.  You'll need to install a patch if enabling PSA's dual monitor feature to fix this.  One is available with the NewIcons package, called 'PatchOpenWB'.  If you run 'MCP', this feature is built-in, and merely needs to be enabled."
                            )
                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype (dest Name)
                        (if (= dual 0) (settooltype "DUAL_MONITOR" ) )
                        (if (= dual 1) (settooltype "DUAL_MONITOR" "" )

        )
)

(set graph (askchoice (choices    "Disable GraphicsOptimization"
                                  "Optimize Single/First Monitor"
                                  "Optimize Second Monitor"
                                  "Optimize Both Monitors"
                         (prompt #graph)
                         (help   "This feature is for systems retargeting their displays to graphic boards. DON'T enable this feature if you are using the standard video display."
                                "\n\n\n"
                                "Disable Optimization - If you have no graphics cards, choose this option."
                                "\n\n"
                                "Optimize Single/First Monitor - If you have one graphics card, use this option."
                                "\n\n"
                                "Optimize second Monitor - If you are using the 15khz video output along with a graphics card, and want the 15khz output to be your 'first monitor' [timeline display] and the graphics card to be your 'second monitor' [mixer display], choose this option."
                                "\n\n"
                                "Optimize both Monitors - If you have dual screens enabled and two graphics cards, choose this option.")
                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype       (dest Name)
                        (if (= graph 0) (settooltype "CGFX_DEPT#?" ) )
                        (if (= graph 1) (settooltype "CGFX_DEPTH" "" ) )
                        (if (= graph 2) (settooltype "CGFX_DEPTH2" "" ) )
                        (if (= graph 3) (settooltype "CGFX_DEPTH" "" ) )
                        (if (= graph 3) (settooltype "CGFX DEPTH2" "" )
        )
)

(set scr (askchoice (choices    "Disable Screen Requestor"
                                "Enable Screen Requestor"
                         (prompt #scr)
                         (help  "This feature, if enabled, will tell ProStationAudio to open a screen mode selector at each and every launch.  The can be useful to bypass the saved screen preferences in order to redefine them.  If you are running PSA in dual monitor mode, you will be presented a seperate selector for each monitor."
                            )
                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype       (dest Name)
                        (if (= scr 0) (settooltype "SHOW_SCR_SELECTOR" ) )
                        (if (= scr 1) (settooltype "SHOW_SCR_SELECTOR" "" )
        )
)


(set wgfx (askchoice (choices   "Disable High-Resolution Waveform Graphics"
                                "Enable High-Resolution Waveform Graphics"
                         (prompt #wgfx)
                         (help "Enabling this setting will allow PSA the handle/store high resolution waveform graphics inside ALSF (AudioLabs Support Files) files.  Recommended for all systems.")
                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype       (dest Name)
                        (if (= wgfx 0) (settooltype "ULTRA_WGFX" ) )
                        (if (= wgfx 1) (settooltype "ULTRA_WGFX" "" )
        )
)

(set noback (askchoice (choices "Disable Desktop Background"
                                "Enable Desktop Background"
                         (prompt #back)
                         (help "Use this feature to reduce chipram usage.  The solid color screen backdrop will be replaced by the color zero.")
                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype       (dest Name)
                        (if (= noback 0) (settooltype "NOBACKDROP" "" ) )
                        (if (= noback 1) (settooltype "NOBACKDROP" )
        )
)

(set pri (askchoice (choices    "Normal Priority"
                                "High Priority (Recommended)"
                                "Ultra Priority (Can interefere with OS)"
                         (prompt #pri)
                         (help "The setting defines how much of your system's resources are allocated to PSA.")
                     )
          )
)
(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype       (dest Name)
                        (if (= pri 0) (settooltype "TASKPRI" ) )
                        (if (= pri 1) (settooltype "TASKPRI" "HIGH") )
                        (if (= pri 2) (settooltype "TASKPRI" "ULTRA")

        )
)

(set cmem (askchoice (choices   "Mini"
                                "Small"
                                "Medium"
                                "Large"
                                "Huge"
				"Ultra"
                         (prompt #cmem)
                         (help  "This setting influences the maximum size allowed for a session to be played or mixed to disc.  It doesn't influence the size of the session itself - you can add as many objects as your free memory permits."
                                "\n\n"
                                "The 'weight' of a session is determined by the amount of tracks multiplied by the timeline duration.  For example, a 5 minute timeline with 8 tracks (5 times 8) needs more memory that a 10 minute timeline with 2 tracks (10 times 2)."
                            )
                     )
          )
)

(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype       (dest Name)
                        (if (= cmem 0) (settooltype "C_MEM_MODEL" "MINI" ) )
                        (if (= cmem 1) (settooltype "C_MEM_MODEL" "SMALL" ) )
                        (if (= cmem 2) (settooltype "C_MEM_MODEL" "MEDIUM" ) )
                        (if (= cmem 3) (settooltype "C_MEM_MODEL" "LARGE" ) )
                        (if (= cmem 4) (settooltype "C_MEM_MODEL" "HUGE" ) )
			(if (= cmem 5) (settooltype "C_MEM_MODEL" "ULTRA")

        )
)

(set acct (askchoice (choices   "1 minute"
                                "3 minutes"
                                "5 minutes"
                                "10 minutes"
                                "15 minutes"
                         (prompt #acct)
                         (help "This feature filters out operations shorter than a preferred amount of minutes.  this is handy to ignore operations not involved with normal working activity, such as viewing contents of a project or accessing it to generate a report.  In any case, PSA tracks every access - the threshold value is NOT destructive and used just for filtering the global access list.")
                     )
          )
)

(if (< (exists (cat Name ".info")) 1) (abort #noicon) )

(tooltype       (dest Name)
                        (if (= acct 0) (settooltype "ACCOUNT_THRESHOLD" "1" ) )
                        (if (= acct 1) (settooltype "ACCOUNT_THRESHOLD" "3" ) )
                        (if (= acct 2) (settooltype "ACCOUNT_THRESHOLD" "5" ) )
                        (if (= acct 3) (settooltype "ACCOUNT_THRESHOLD" "10" ) )
                        (if (= acct 4) (settooltype "ACCOUNT_THRESHOLD" "15" )
        )
)

; goodbye!

(message "\n\n\nProStationAudio configuration complete.\n\n"
                "It's safe to run PSA now and check your new configuration. ")



(set @default-dest Name)

(if (= ProStationAudioisreallygreat 46) (welcome) )

(alldone)
(exit)
